浏览代码

Merge branch 'master' of http://git.zthymaoyi.com:3000/gdc/yiliangyiyun-pc

gjy 3 年之前
父节点
当前提交
1c96b16490

+ 1 - 0
src/store/getters.js

@@ -45,6 +45,7 @@ const getters = {
   systemWarnNum: state => state.app.systemWarnNum,
   systemWarnNum: state => state.app.systemWarnNum,
   baseInfo: state => state.user.baseInfo, // 设置系统基础信息
   baseInfo: state => state.user.baseInfo, // 设置系统基础信息
   deptBudgetList: state => state.app.deptBudgetList,
   deptBudgetList: state => state.app.deptBudgetList,
+  reader: state => state.app.reader,
   guideInfo: state => state.user.guideInfo, // 新手指引信息
   guideInfo: state => state.user.guideInfo, // 新手指引信息
   sparepartSp: state => state.app.sparepartSp, // 搜索状态
   sparepartSp: state => state.app.sparepartSp, // 搜索状态
   sparepartMa: state => state.app.sparepartMa, // 搜索状态
   sparepartMa: state => state.app.sparepartMa, // 搜索状态

+ 9 - 1
src/store/modules/app.js

@@ -21,7 +21,8 @@ const state = {
   // 产品-体系运行-预警
   // 产品-体系运行-预警
   warnNum: 0,
   warnNum: 0,
   // 产品-体系运行-流转报表(待处理个数)
   // 产品-体系运行-流转报表(待处理个数)
-  circulationNum: 0
+  circulationNum: 0,
+  reader:''
 }
 }
 
 
 const mutations = {
 const mutations = {
@@ -88,6 +89,10 @@ const mutations = {
   SET_DEPTBUDGETLIST: (state, deptBudgetList) => {
   SET_DEPTBUDGETLIST: (state, deptBudgetList) => {
     state.deptBudgetList = deptBudgetList
     state.deptBudgetList = deptBudgetList
   },
   },
+  SET_READER: (state, reader) => {
+    state.reader = reader
+  },
+  
 }
 }
 
 
 const actions = {
 const actions = {
@@ -115,6 +120,9 @@ const actions = {
   setdeptBudgetList ({ commit }, params) {
   setdeptBudgetList ({ commit }, params) {
     commit('SET_DEPTBUDGETLIST', params)
     commit('SET_DEPTBUDGETLIST', params)
   },
   },
+  setReader ({ commit }, params) {
+    commit('SET_READER', params)
+  },
   setMapQueryParams ({ commit }, params) {
   setMapQueryParams ({ commit }, params) {
     commit('SET_SPAREPARTMAP_QUERY', params)
     commit('SET_SPAREPARTMAP_QUERY', params)
   },
   },

+ 38 - 26
src/views/houseSelfCollect/weightCheck.vue

@@ -119,7 +119,7 @@
               </el-table-column>
               </el-table-column>
               <el-table-column property="carNumber" label="车牌号">
               <el-table-column property="carNumber" label="车牌号">
               </el-table-column>
               </el-table-column>
-               <el-table-column property="status" label="状态">
+              <el-table-column property="status" label="状态">
               </el-table-column>
               </el-table-column>
             </el-table>
             </el-table>
             <div style="text-align: center">
             <div style="text-align: center">
@@ -236,12 +236,15 @@
         warehouseName: '',
         warehouseName: '',
         result1: '00',
         result1: '00',
         allowEdit: 0,
         allowEdit: 0,
-        mListTop:[],
-        mListBottom:[],
-        pListTop:[],
-        pListBottom:[]
+        mListTop: [],
+        mListBottom: [],
+        pListTop: [],
+        pListBottom: []
       }
       }
     },
     },
+    mounted() {
+      this.openPort()
+    },
     activated() {
     activated() {
       console.log(this.common.name)
       console.log(this.common.name)
       this.cangid = this.$route.query.cangid
       this.cangid = this.$route.query.cangid
@@ -354,18 +357,18 @@
           if (_list[i].status == '已质检') {
           if (_list[i].status == '已质检') {
             this.mListTop.push(_list[i])
             this.mListTop.push(_list[i])
           }
           }
-           if (_list[i].status == '已称毛重') {
+          if (_list[i].status == '已称毛重') {
             this.mListBottom.push(_list[i])
             this.mListBottom.push(_list[i])
           }
           }
           if (_list[i].status == '已称皮重') {
           if (_list[i].status == '已称皮重') {
             this.pListBottom.push(_list[i])
             this.pListBottom.push(_list[i])
           }
           }
           if (_list[i].status == '已称毛重') {
           if (_list[i].status == '已称毛重') {
-              this.pListTop.push(_list[i])
+            this.pListTop.push(_list[i])
           }
           }
         }
         }
-       this.mList= this.mListTop.concat(this.mListBottom)
-       this.pList= this.pListTop.concat(this.pListBottom)
+        this.mList = this.mListTop.concat(this.mListBottom)
+        this.pList = this.pListTop.concat(this.pListBottom)
         if (this.information == '毛重') {
         if (this.information == '毛重') {
           this.index = 0
           this.index = 0
           this.carList = this.mList
           this.carList = this.mList
@@ -433,10 +436,10 @@
         }
         }
       },
       },
       tabClick(val) {
       tabClick(val) {
-        this.mListTop=[]
-        this.mListBottom=[]
-        this.pListTop=[]
-        this.pListBottom=[]
+        this.mListTop = []
+        this.mListBottom = []
+        this.pListTop = []
+        this.pListBottom = []
         this.carWeightInfo.carNumber = ''
         this.carWeightInfo.carNumber = ''
         this.weighingList = []
         this.weighingList = []
         this.index = val
         this.index = val
@@ -469,17 +472,24 @@
         }
         }
       },
       },
       async openPort() {
       async openPort() {
-        console.log('openPort', navigator);
+        console.log('openPort', navigator)
         if ('serial' in navigator) {
         if ('serial' in navigator) {
-          // The Web Serial API is supported.
-          console.log('the Web Serial API is supported.');
-          console.log(this.param);
-          const port = await navigator.serial.requestPort();
-          await port.open({
-            baudRate: this.param
-          }); // set baud rate
-          this.reader = port.readable.getReader();
-
+          if (!this.$store.state.app.reader) {
+            // The Web Serial API is supported.
+            console.log('the Web Serial API is supported.')
+            console.log(this.param)
+            const port = await navigator.serial.requestPort()
+            await port.open({
+              baudRate: this.param,
+            }) // set baud rate
+            this.reader = port.readable.getReader()
+            console.log('beforeReader', port)
+            console.log('beforeReader', this.reader)
+            this.$store.dispatch('app/setReader', this.reader)
+          } else {
+            console.log('afterport', this.$store.state.app.reader)
+            this.reader = this.$store.state.app.reader
+          }
           // 监听来自串行设备的数据
           // 监听来自串行设备的数据
           while (true) {
           while (true) {
             const {
             const {
@@ -896,8 +906,9 @@
   }
   }
 
 
   .substance {
   .substance {
-      padding-bottom: 20px;
-      overflow-y: scroll;
+    padding-bottom: 20px;
+    overflow-y: scroll;
+
     .active {
     .active {
       background: #5878e8;
       background: #5878e8;
       color: white;
       color: white;
@@ -1083,7 +1094,8 @@
       width: 50%;
       width: 50%;
     }
     }
   }
   }
-  .car-right{
+
+  .car-right {
     width: 50%;
     width: 50%;
   }
   }
 </style>
 </style>

+ 22 - 9
src/views/outboundManagement/weighing.vue

@@ -137,7 +137,10 @@
 				reader:null,
 				reader:null,
 				param:9600
 				param:9600
 			}
 			}
-		},
+    },
+    mounted() {
+	  this.openPort()
+	  },
 		activated() {
 		activated() {
 			this.types = this.$route.query.typeNo
 			this.types = this.$route.query.typeNo
 			this.weighingList.number = this.$route.query.number
 			this.weighingList.number = this.$route.query.number
@@ -176,14 +179,24 @@
 				this.reader.cancel()
 				this.reader.cancel()
 			},
 			},
 			async openPort(){
 			async openPort(){
-			console.log('openPort',navigator);
-			if ('serial' in navigator) {
-				// The Web Serial API is supported.
-				console.log('the Web Serial API is supported.');
-				console.log(this.param);
-				const port = await navigator.serial.requestPort();
-				await port.open({ baudRate: this.param }); // set baud rate
-				this.reader = port.readable.getReader();
+			 console.log('openPort', navigator)
+        if ('serial' in navigator) {
+          if (!this.$store.state.app.reader) {
+            // The Web Serial API is supported.
+            console.log('the Web Serial API is supported.')
+            console.log(this.param)
+            const port = await navigator.serial.requestPort()
+            await port.open({
+              baudRate: this.param,
+            }) // set baud rate
+            this.reader = port.readable.getReader()
+            console.log('beforeReader', port)
+            console.log('beforeReader', this.reader)
+            this.$store.dispatch('app/setReader', this.reader)
+          } else {
+            console.log('afterport', this.$store.state.app.reader)
+            this.reader = this.$store.state.app.reader
+          }
 				// 监听来自串行设备的数据
 				// 监听来自串行设备的数据
 				while (true) {
 				while (true) {
 				const { value, done } = await this.reader.read();
 				const { value, done } = await this.reader.read();

+ 1 - 1
src/views/tranManagement/tranManagementthirdpartnarFeedback.vue

@@ -686,7 +686,7 @@ export default {
         .then(() => {
         .then(() => {
           this.$refs.deptBudgetList.validate((valid) => {
           this.$refs.deptBudgetList.validate((valid) => {
             if (valid) {
             if (valid) {
-              posttranprocessinfo({threeTranType:this.checkList.toString(),id:this.deptBudgetList.id,contractNo:this.deptBudgetList.contractNo,tranCarInfoList1,tranCarInfoList2,tranCarInfoList3,tranCarInfoList4})
+              posttranprocessinfo({threeTranType:this.checkList.toString(),id:this.deptBudgetList.id,infoId:this.deptBudgetList.infoId,contractNo:this.deptBudgetList.contractNo,tranCarInfoList1,tranCarInfoList2,tranCarInfoList3,tranCarInfoList4})
                 .toPromise()
                 .toPromise()
                 .then((response) => {
                 .then((response) => {
                   this.$message.success('提交成功')
                   this.$message.success('提交成功')

+ 18 - 9
src/views/warehouse/warehouseManagementGross.vue

@@ -915,6 +915,7 @@ export default {
     //   // this.deptBudgetList.inOutType = '退库'
     //   // this.deptBudgetList.inOutType = '退库'
     //   this.deptBudgetList.inOutTypeKey = '1'
     //   this.deptBudgetList.inOutTypeKey = '1'
     // }
     // }
+    this.openPort()
   },
   },
   methods: {
   methods: {
     async closePort() {
     async closePort() {
@@ -923,15 +924,23 @@ export default {
     },
     },
     async openPort() {
     async openPort() {
       console.log('openPort', navigator)
       console.log('openPort', navigator)
-      if ('serial' in navigator) {
-        // The Web Serial API is supported.
-        console.log('the Web Serial API is supported.')
-        console.log(this.param)
-        const port = await navigator.serial.requestPort()
-        await port.open({
-          baudRate: this.param,
-        }) // set baud rate
-        this.reader = port.readable.getReader()
+        if ('serial' in navigator) {
+          if (!this.$store.state.app.reader) {
+            // The Web Serial API is supported.
+            console.log('the Web Serial API is supported.')
+            console.log(this.param)
+            const port = await navigator.serial.requestPort()
+            await port.open({
+              baudRate: this.param,
+            }) // set baud rate
+            this.reader = port.readable.getReader()
+            console.log('beforeReader', port)
+            console.log('beforeReader', this.reader)
+            this.$store.dispatch('app/setReader', this.reader)
+          } else {
+            console.log('afterport', this.$store.state.app.reader)
+            this.reader = this.$store.state.app.reader
+          }
         // 监听来自串行设备的数据
         // 监听来自串行设备的数据
         while (true) {
         while (true) {
           const { value, done } = await this.reader.read()
           const { value, done } = await this.reader.read()

+ 21 - 10
src/views/warehouse/warehouseManagementNoWeightIn.vue

@@ -823,6 +823,9 @@ export default {
       ],
       ],
     }
     }
   },
   },
+  mounted() {
+	  this.openPort()
+	},
   activated() {
   activated() {
     if (this.$route.query.allowEdit == 1) {
     if (this.$route.query.allowEdit == 1) {
       this.allowEdit = false
       this.allowEdit = false
@@ -890,16 +893,24 @@ export default {
       this.reader.cancel()
       this.reader.cancel()
     },
     },
     async openPort() {
     async openPort() {
-      console.log('openPort', navigator)
-      if ('serial' in navigator) {
-        // The Web Serial API is supported.
-        console.log('the Web Serial API is supported.')
-        console.log(this.param)
-        const port = await navigator.serial.requestPort()
-        await port.open({
-          baudRate: this.param,
-        }) // set baud rate
-        this.reader = port.readable.getReader()
+       console.log('openPort', navigator)
+        if ('serial' in navigator) {
+          if (!this.$store.state.app.reader) {
+            // The Web Serial API is supported.
+            console.log('the Web Serial API is supported.')
+            console.log(this.param)
+            const port = await navigator.serial.requestPort()
+            await port.open({
+              baudRate: this.param,
+            }) // set baud rate
+            this.reader = port.readable.getReader()
+            console.log('beforeReader', port)
+            console.log('beforeReader', this.reader)
+            this.$store.dispatch('app/setReader', this.reader)
+          } else {
+            console.log('afterport', this.$store.state.app.reader)
+            this.reader = this.$store.state.app.reader
+          }
         // 监听来自串行设备的数据
         // 监听来自串行设备的数据
         while (true) {
         while (true) {
           const { value, done } = await this.reader.read()
           const { value, done } = await this.reader.read()

+ 12 - 1
src/views/warehouse/warehouseManagementNoWeightOut.vue

@@ -612,6 +612,9 @@ export default {
       result1: '00',
       result1: '00',
     }
     }
   },
   },
+  mounted() {
+	  this.openPort()
+	},
   activated() {
   activated() {
     if (this.$route.query.allowEdit == 1) {
     if (this.$route.query.allowEdit == 1) {
       this.allowEdit = false
       this.allowEdit = false
@@ -661,7 +664,8 @@ export default {
     },
     },
     async openPort() {
     async openPort() {
       console.log('openPort', navigator)
       console.log('openPort', navigator)
-      if ('serial' in navigator) {
+    if ('serial' in navigator) {
+      if (!this.$store.state.app.reader) {
         // The Web Serial API is supported.
         // The Web Serial API is supported.
         console.log('the Web Serial API is supported.')
         console.log('the Web Serial API is supported.')
         console.log(this.param)
         console.log(this.param)
@@ -670,6 +674,13 @@ export default {
           baudRate: this.param,
           baudRate: this.param,
         }) // set baud rate
         }) // set baud rate
         this.reader = port.readable.getReader()
         this.reader = port.readable.getReader()
+        console.log('beforeReader', port)
+        console.log('beforeReader', this.reader)
+        this.$store.dispatch('app/setReader', this.reader)
+      } else {
+        console.log('afterport', this.$store.state.app.reader)
+        this.reader = this.$store.state.app.reader
+      }
         // 监听来自串行设备的数据
         // 监听来自串行设备的数据
         while (true) {
         while (true) {
           const { value, done } = await this.reader.read()
           const { value, done } = await this.reader.read()

+ 10 - 1
src/views/warehouse/warehouseManagementTare.vue

@@ -773,6 +773,7 @@ export default {
         console.log(response)
         console.log(response)
         this.deptBudgetList1 = response
         this.deptBudgetList1 = response
       })
       })
+     this.openPort()  
   },
   },
   methods: {
   methods: {
     async closePort() {
     async closePort() {
@@ -781,7 +782,8 @@ export default {
     },
     },
     async openPort() {
     async openPort() {
       console.log('openPort', navigator)
       console.log('openPort', navigator)
-      if ('serial' in navigator) {
+    if ('serial' in navigator) {
+      if (!this.$store.state.app.reader) {
         // The Web Serial API is supported.
         // The Web Serial API is supported.
         console.log('the Web Serial API is supported.')
         console.log('the Web Serial API is supported.')
         console.log(this.param)
         console.log(this.param)
@@ -790,6 +792,13 @@ export default {
           baudRate: this.param,
           baudRate: this.param,
         }) // set baud rate
         }) // set baud rate
         this.reader = port.readable.getReader()
         this.reader = port.readable.getReader()
+        console.log('beforeReader', port)
+        console.log('beforeReader', this.reader)
+        this.$store.dispatch('app/setReader', this.reader)
+      } else {
+        console.log('afterport', this.$store.state.app.reader)
+        this.reader = this.$store.state.app.reader
+      }
         // 监听来自串行设备的数据
         // 监听来自串行设备的数据
         while (true) {
         while (true) {
           const { value, done } = await this.reader.read()
           const { value, done } = await this.reader.read()