|
@@ -7,10 +7,14 @@
|
|
<!-- 任务、消息、提醒、超期 -->
|
|
<!-- 任务、消息、提醒、超期 -->
|
|
<Panel :data-list="panelList"
|
|
<Panel :data-list="panelList"
|
|
@click="gotoNewRw"></Panel>
|
|
@click="gotoNewRw"></Panel>
|
|
- <button @click="openPort">测试</button>
|
|
|
|
- <button @click="closePort">关闭</button>
|
|
|
|
- <div>{{text}}</div>
|
|
|
|
- <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
|
|
|
|
|
|
+ <div v-show="true">
|
|
|
|
+ <el-button @click="test">test</el-button>
|
|
|
|
+ <el-button @click="test1">test1</el-button>
|
|
|
|
+ <el-button @click="openPort">openPort</el-button>
|
|
|
|
+ <el-button @click="closePort">closePort</el-button>
|
|
|
|
+ <div>{{text}}</div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- <img style='width:100%;margin-top:10px;' src="../../../public/img/tmt.gif" alt=""> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="mapXY"></div>
|
|
<div id="mapXY"></div>
|
|
@@ -115,7 +119,8 @@ export default {
|
|
},
|
|
},
|
|
vesselBankFlag: sessionStorage.getItem('ws-pf_vesselBankFlag'),
|
|
vesselBankFlag: sessionStorage.getItem('ws-pf_vesselBankFlag'),
|
|
shezhiVal: '',
|
|
shezhiVal: '',
|
|
- text:"数据"
|
|
|
|
|
|
+ text:"数据",
|
|
|
|
+ reader:null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -179,11 +184,11 @@ export default {
|
|
async created () {
|
|
async created () {
|
|
//获取快捷路口列表
|
|
//获取快捷路口列表
|
|
this.getRouteList()
|
|
this.getRouteList()
|
|
- this.checkUserInfoDialog()
|
|
|
|
|
|
+ // this.checkUserInfoDialog()
|
|
},
|
|
},
|
|
async mounted () {
|
|
async mounted () {
|
|
//获取新闻列表
|
|
//获取新闻列表
|
|
- this.getNewList()
|
|
|
|
|
|
+ // this.getNewList()
|
|
noticeNumber().toPromise().then(res => {
|
|
noticeNumber().toPromise().then(res => {
|
|
const { task = 0, remind = 0, overdue = 0, news = 0 } = res
|
|
const { task = 0, remind = 0, overdue = 0, news = 0 } = res
|
|
this.number.task = task
|
|
this.number.task = task
|
|
@@ -191,16 +196,16 @@ export default {
|
|
this.number.overdue = overdue
|
|
this.number.overdue = overdue
|
|
this.number.news = news
|
|
this.number.news = news
|
|
})
|
|
})
|
|
- if (this.vesselBankFlag !== 'V') {
|
|
|
|
- EventBus.$emit('addShipScript', () => {
|
|
|
|
- this.initShipMap()
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- setTimeout(() => {
|
|
|
|
- this.showEchart = true
|
|
|
|
- }, 900)
|
|
|
|
|
|
+ // if (this.vesselBankFlag !== 'V') {
|
|
|
|
+ // EventBus.$emit('addShipScript', () => {
|
|
|
|
+ // this.initShipMap()
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
+ // this.showEchart = true
|
|
|
|
+ // }, 900)
|
|
|
|
|
|
- this.showBlockList = []
|
|
|
|
|
|
+ // this.showBlockList = []
|
|
// if (this.vesselBankFlag === 'V') {
|
|
// if (this.vesselBankFlag === 'V') {
|
|
// this.$refs.noticeList.style.width = 'calc(50% - 7px)'
|
|
// this.$refs.noticeList.style.width = 'calc(50% - 7px)'
|
|
// this.$refs.newsList.style.width = 'calc(50% - 7px)'
|
|
// this.$refs.newsList.style.width = 'calc(50% - 7px)'
|
|
@@ -216,9 +221,9 @@ export default {
|
|
// }
|
|
// }
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
- getLanguage: function () {
|
|
|
|
- this.getShipList()
|
|
|
|
- }
|
|
|
|
|
|
+ // getLanguage: function () {
|
|
|
|
+ // this.getShipList()
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapActions('user', ['toSetShow', 'changeVesslBank']),
|
|
...mapActions('user', ['toSetShow', 'changeVesslBank']),
|
|
@@ -531,42 +536,47 @@ export default {
|
|
this.$router.push({ name: 'workNotification', query: { types: data } })
|
|
this.$router.push({ name: 'workNotification', query: { types: data } })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ test(){
|
|
|
|
+ console.log('testtesttesttest');
|
|
|
|
+ },
|
|
|
|
+ async test1(){
|
|
|
|
+ console.log('testtesttesttest111111');
|
|
|
|
+ },
|
|
async openPort(){
|
|
async openPort(){
|
|
- if ("serial" in navigator) {
|
|
|
|
- // The Web Serial API is supported.
|
|
|
|
- console.log("the Web Serial API is supported.");
|
|
|
|
- const port = await navigator.serial.requestPort();
|
|
|
|
- await port.open({ baudRate: 9600 }); // set baud rate
|
|
|
|
- const reader = port.readable.getReader();
|
|
|
|
- // 监听来自串行设备的数据
|
|
|
|
- while (true) {
|
|
|
|
- const { value, done } = await reader.read();
|
|
|
|
- console.log(value,done);
|
|
|
|
- if (done) {
|
|
|
|
- // 允许稍后关闭串口。
|
|
|
|
- reader.releaseLock();
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- var result="";
|
|
|
|
- if(value.length < 5){
|
|
|
|
- debugger
|
|
|
|
- }
|
|
|
|
- for(var i=0;i<value.length;i++){
|
|
|
|
- result += String.fromCharCode(value[i])
|
|
|
|
|
|
+ console.log('openPort');
|
|
|
|
+ if ('serial' in navigator) {
|
|
|
|
+ // The Web Serial API is supported.
|
|
|
|
+ console.log('the Web Serial API is supported.');
|
|
|
|
+ const port = await navigator.serial.requestPort();
|
|
|
|
+ await port.open({ baudRate: 9600 }); // set baud rate
|
|
|
|
+ this.reader = port.readable.getReader();
|
|
|
|
+ // 监听来自串行设备的数据
|
|
|
|
+ while (true) {
|
|
|
|
+ const { value, done } = await this.reader.read();
|
|
|
|
+ console.log(value,done);
|
|
|
|
+ if (done) {
|
|
|
|
+ // 允许稍后关闭串口。
|
|
|
|
+ this.reader.releaseLock();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ var result="";
|
|
|
|
+ if(value.length < 5){
|
|
|
|
+ }
|
|
|
|
+ for(var i=0;i<value.length;i++){
|
|
|
|
+ result += String.fromCharCode(value[i])
|
|
|
|
+ }
|
|
|
|
+ this.text = result
|
|
|
|
+ // value 是一个 Uint8Array
|
|
}
|
|
}
|
|
- this.text = result
|
|
|
|
- // value 是一个 Uint8Array
|
|
|
|
|
|
+ await port.close();
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ console.log('the Web Serial API is not supported.',navigator);
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
async closePort(){
|
|
async closePort(){
|
|
-
|
|
|
|
- const port = await navigator.serial.requestPort();
|
|
|
|
- await port.open({ baudRate: 9600 }); // set baud rate
|
|
|
|
- const reader = port.readable.getReader();
|
|
|
|
- reader.cancel()
|
|
|
|
- port.close();
|
|
|
|
|
|
+ console.log('closePort');
|
|
|
|
+ this.reader.cancel()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|