gjy пре 3 година
родитељ
комит
86e68306f5
4 измењених фајлова са 85 додато и 13 уклоњено
  1. 3 0
      src/App.vue
  2. 4 2
      src/layout/index/top/index.vue
  3. 13 10
      src/views/home/index.vue
  4. 65 1
      src/views/warehouse/warehouseManagementList.vue

+ 3 - 0
src/App.vue

@@ -68,6 +68,9 @@ export default {
 .gird {
   display: gird;
 }
+.el-table th.gutter{
+   display: table-cell!important;
+}
 .el-select-dropdown .el-scrollbar .el-scrollbar__wrap {
   overflow: scroll !important;
 }

+ 4 - 2
src/layout/index/top/index.vue

@@ -19,6 +19,9 @@
     </div>
     <div class="top-bar__right">
       <!-- 使用租户 -->
+      <div >
+        <span style="padding: 0 4px;font-size:15px;">{{compName}}</span>
+      </div>
       <div class="hidden-content">
         <el-input ref="hiddenFocus" type="password" class="input-Style" v-model="barCode" size="small" @focus="focus" @blur="blur"
           @keyup.enter.native="payCode" placeholder="扫码枪内容"></el-input>
@@ -75,7 +78,6 @@
           <i :class="isFullScren ? 'el-icon-full-screen' : 'el-icon-full-screen'" @click="handleScreen"></i>
         </div>
       </el-tooltip>
-
       <img class="top-bar__img" v-lazy="userInfo.avatar" />
       <el-dropdown>
         <span class="el-dropdown-link">
@@ -289,7 +291,7 @@
         // deptId: '',
         // staffName: '',
         account: localStorage.getItem('ws-pf_account'),
-        // compName: '',
+        compName: localStorage.getItem('ws-pf_compName'),
         companyId: localStorage.getItem('ws-pf_compId'),
         cangid:'',
         tmp:{},

+ 13 - 10
src/views/home/index.vue

@@ -329,12 +329,14 @@
 
     },
     activated(){
+      var staffId=JSON.parse(localStorage.getItem('winseaview-userInfo')).content.staffId
            if ('WebSocket' in window) {
                   if (process.env.NODE_ENV === 'production') {
-                    this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/?adminId=84f62127b7384dcdbaeaddfe460329fc' )
+                    this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/'+staffId )
                   }
                   else {
-                    this.websocket = new WebSocket('ws://localhost:8080/websocket/?adminId=84f62127b7384dcdbaeaddfe460329fc' )
+                    //  this.websocket = new WebSocket('ws://192.168.1.115:8090/commonUser/api/onOpen?adminId=84f62127b7384dcdbaeaddfe460329fc' )
+                    this.websocket = new WebSocket('ws://192.168.1.115:8080/websocket/'+staffId )
                   }
                   this.initWebSocket()
                 } else {
@@ -356,16 +358,18 @@
       }
     },
     async mounted() {
+      var staffId=JSON.parse(localStorage.getItem('winseaview-userInfo')).content.staffId
       // getAdminId().toPromise().then(response => {
                 this.loading = false
                 // WebSocket
                 // this.$store.dispatch('setAdminId', response.data.data)
                 if ('WebSocket' in window) {
                   if (process.env.NODE_ENV === 'production') {
-                    this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/84f62127b7384dcdbaeaddfe460329fc' )
+                    this.websocket = new WebSocket('wss://www.zthymaoyi.com/wss/websocket/'+staffId )
                   }
                   else {
-                    this.websocket = new WebSocket('ws://192.168.1.115:8090/websocket/1' )
+                    //  this.websocket = new WebSocket('ws://192.168.1.115:8090/commonUser/api/onOpen?adminId=84f62127b7384dcdbaeaddfe460329fc' )
+                    this.websocket = new WebSocket('ws://192.168.1.115:8080/websocket/'+staffId )
                   }
                   this.initWebSocket()
                 } else {
@@ -447,7 +451,7 @@
         })
       },
          initWebSocket () {
-           console.log(this.webSocket,this.WebSocket)
+           console.log(this.websocket)
       // 连接错误
       this.websocket.onerror = this.setErrorMessage
       // 连接成功
@@ -463,15 +467,14 @@
       window.onbeforeunload = this.onbeforeunload
     },
     setErrorMessage () {
-      console.log(11111111)
-      console.log('WebSocket连接发生错误   状态码:' + this.websocket.readyState)
+      console.log('WebSocket连接发生错误   状态码:' +this.websocket.readyState)
     },
     setOnopenMessage () {
-      console.log(222222222)
+      // console.log(this.websocket)
       console.log('WebSocket连接成功    状态码:' + this.websocket.readyState)
     },
     setOnmessageMessage (event) {
-      console.log(3333)
+      // console.log(3333)
       // 根据服务器推送的消息做自己的业务处理
       console.log('服务端返回:' + event.data)
       var msg = event.data.split('$')
@@ -490,7 +493,7 @@
       that.$router.push({ path: currentPage })
     },
     setOncloseMessage () {
-      debugger
+      // console.log(this.websocket)
       console.log('WebSocket连接关闭    状态码:' + this.websocket.readyState)
     },
       //跳转

+ 65 - 1
src/views/warehouse/warehouseManagementList.vue

@@ -45,7 +45,7 @@
       </template>
     </BaseHeaderLayout>
     <div v-show="this.warehouseType == '1'" class="main_css">
-      <el-table class="wenzi" :data="warehouseList" style="width: 100%; margin-top: 20px" height="100%">
+      <el-table show-summary :summary-method="getSummaries" class="wenzi" :data="warehouseList" style="width: 100%; margin-top: 20px" height="100%">
         <el-table-column prop="warehouseName" label="仓库名">
         </el-table-column>
         <el-table-column prop="binNumber" label="仓位编号">
@@ -345,6 +345,70 @@
     },
 
     methods: {
+      getSummaries(param) {
+      const { columns, data } = param
+      const sums = []
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计'
+        } else if (
+          index === 4 ||
+          index === 5 ||
+          index === 6 
+        ) {
+          const values = data.map((item) => {
+            var val=item.warehouseNumViewList.map((items) => {
+            if(column.label=='入库量(吨)'){
+              return items.inNetWeight
+            }else if(column.label=='出库量(吨)'){
+              return items.outNetWeight
+            }else if(column.label=='应余量(吨)'){
+              return items.storage
+            }
+          })
+            return val
+          })
+          if (!values.every((value) => isNaN(value))) {
+            sums[index] = values.reduce((prev, curr) => {
+              if(curr.length>1){
+                var num=0
+                for (let i = 0; i < curr.length; i++) {
+                  num+=Number(curr[i])
+                }
+                return Number(prev) +num
+              }else{
+                const value = Number(curr)
+                if (!isNaN(value)) {
+                  return Number(prev) + Number(curr)
+                } else {
+                  return Number(prev)
+                }
+              }
+            }, 0)
+          } else {
+          sums[index] = '--'
+        }
+        } else {
+          sums[index] = '--'
+        }
+      })
+      if(typeof sums[4] =='number'){
+        sums[4]=sums[4].toFixed(2)
+      }
+      if(typeof sums[5] =='number'){
+        sums[5]=sums[5].toFixed(2)
+      }
+      if(typeof sums[6] =='number'){
+        sums[6]=sums[6].toFixed(2)
+      }
+			// sums[5]=sums[5].toFixed(2)
+      // sums[6]=sums[6].toFixed(2)
+      // sums[sums.length-7]=sums[sums.length-7].toFixed(2)
+      // sums[sums.length-9]=sums[sums.length-9].toFixed(2)
+      // sums[sums.length-12]=sums[sums.length-12].toFixed(2)
+      // sums[sums.length-13]=sums[sums.length-13].toFixed(2)
+      return sums
+    },
       //导出、打印
       outData(index) {
         if (index == 1) {