Pārlūkot izejas kodu

智慧数据弹窗

lichao 3 gadi atpakaļ
vecāks
revīzija
968dd33cda
1 mainītis faili ar 92 papildinājumiem un 19 dzēšanām
  1. 92 19
      src/views/Warehousing/inStock/noUpload.vue

+ 92 - 19
src/views/Warehousing/inStock/noUpload.vue

@@ -170,6 +170,7 @@
                 v-model.number="scope.row.fQty"
                 style="width: 100%"
                 placeholder="件数"
+                @change="dateSelected(scope,'fQty')"
               />
             </span>
           <span v-else-if="item.label == 'fGrossweight'">
@@ -178,6 +179,7 @@
                 v-input-limit="2"
                 style="width: 100%"
                 placeholder="毛重"
+                @change="dateSelected(scope,'fGrossweight')"
               />
             </span>
           <span v-else-if="item.label == 'fNetweight'">
@@ -186,6 +188,7 @@
                 v-input-limit="2"
                 style="width: 100%"
                 placeholder="净重"
+                @change="dateSelected(scope,'fNetweight')"
               />
             </span>
           <span v-else-if="item.label == 'fPackagespecs'">
@@ -252,8 +255,8 @@
     </el-dialog>
 
     <span slot="footer" class="dialog-footer">
-      <el-button @click="visible = false">取 消</el-button>
-      <el-button type="primary" @click="importData">确 定</el-button>
+      <el-button @click="visible = false" :loading="buttonLoading">取 消</el-button>
+      <el-button type="primary" @click="importData" :loading="buttonLoading">确 定</el-button>
     </span>
   </el-dialog>
 </template>
@@ -289,6 +292,7 @@ export default {
       visible: false,
       dataList: [],
       loading: false,
+      buttonLoading: false,
       tableHeight: '200',
       selection: [],
       goodsOptions: [],
@@ -362,7 +366,7 @@ export default {
           label: "fGrossweight",
           name: "毛重(kg)",
           checked: 0,
-          width: 100,
+          width: 130,
         },
 
         {
@@ -370,7 +374,7 @@ export default {
           label: "fNetweight",
           name: "净重(kg)",
           checked: 0,
-          width: 100,
+          width: 130,
         },
         {
           surface: "9",
@@ -417,6 +421,14 @@ export default {
       this.fStorageTypeOptions = response.data;
     });
   },
+  mounted() {
+    this.$nextTick(() => {
+      // 监听浏览器高度变化,改变表格高度
+      window.onresize = () => {
+        this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 200
+      }
+    })
+  },
   methods: {
     // 打开
     async init() {
@@ -434,13 +446,14 @@ export default {
       this.$emit("closeDialog")
     },
     getList() {
+      this.loading = true;
       axios({
           // url: 'http://192.168.1.114:9002/crawler/' + this.form.fMblno,
-        url: 'http://192.168.1.140:9002/crawler',
+        url: 'https://crawler.tubaosoft.com/prod-api/crawler/data',
         method: 'post',
         data: {
           token: this.bigDataToken,
-          param: 'YMLUI488198227',
+          param: this.form.fMblno,
           size: this.page.pageSize,
           page: this.page.pageNum
         },
@@ -449,34 +462,61 @@ export default {
         }
         }
       ).then(res => {
+        if (res.data.code == 500) {
+          return this.$message.error(res.data.msg)
+        }
         //SEAL_NO 铅封号
-        //CONTAINER_TYPE 箱号
+        //CONTAINER_NO 箱号
         //CARGO_QUANTITY 件数
         //TOTAL_GROSS_WEIGHT 重量
         //BILL_OF_LADING_NO 提单号
-        if (res.data.res[1].data.length == 0) {
+        if (res.data.data[1].data.length == 0) {
           // XH 箱号
           // QFH1 铅封号
           // MZ 箱整重
           //TDH 提单号
-          res.data.res[0].data.map(e => {
+          res.data.data[0].data.map(e => {
             e.fMblno = e.TDH;
             e.fSealno = e.QFH1;
             e.fGrossweight = e.MZ;
             e.fNetweight = e.MZ;
             e.fCntrno = e.XH;
           })
-          this.dataList = res.data.res[0].data
+          // if (res.data.data[0].data.length == 1) {
+          //   res.data.data[0].data.map(e => {
+          //     e.fGrossweight = e.MZ;
+          //     e.fNetweight = e.MZ;
+          //   })
+          // } else {
+          //   res.data.data[0].data.map(e => {
+          //     e.fGrossweight = '';
+          //     e.fNetweight = '';
+          //   })
+          // }
+          this.dataList = res.data.data[0].data
         } else {
-          res.data.res[1].data.map(e => {
+          res.data.data[1].data.map(e => {
             e.fMblno = e.BILL_OF_LADING_NO;
             e.fSealno = e.SEAL_NO;
-            e.fQty = e.CARGO_QUANTITY;
-            e.fGrossweight = e.TOTAL_GROSS_WEIGHT;
-            e.fNetweight = e.TOTAL_GROSS_WEIGHT;
-            e.fCntrno = e.CONTAINER_TYPE;
+            // e.fQty = e.CARGO_QUANTITY;
+            // e.fGrossweight = e.TOTAL_GROSS_WEIGHT;
+            // e.fNetweight = e.TOTAL_GROSS_WEIGHT;
+            e.fCntrno = e.CONTAINER_NO;
           })
-          this.dataList = res.data.res[1].data
+          if (res.data.data[1].data.length == 1) {
+            res.data.data[1].data.map(e => {
+              e.fQty = e.CARGO_QUANTITY;
+              e.fGrossweight = e.TOTAL_GROSS_WEIGHT;
+              e.fNetweight = e.TOTAL_GROSS_WEIGHT;
+            })
+          } else {
+            res.data.data[1].data.map(e => {
+              e.fQty = '';
+              e.fGrossweight = '';
+              e.fNetweight = '';
+            })
+          }
+          this.dataList = res.data.data[1].data
         }
         if (this.dataList.length > 0) {
           this.dataList.map(e => {
@@ -488,6 +528,9 @@ export default {
         setTimeout(() => {
           this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 200
         }, 300)
+        this.loading = false;
+      }).finally(() => {
+        this.loading = false;
       })
     },
     handleSelection(list) {
@@ -510,6 +553,18 @@ export default {
         this.dataList.forEach(item => {
           if (!item.fMarks) this.$set(item, 'fMarks', scope.row.fMarks)
         })
+      } else if (name === 'fQty') {
+        this.dataList.forEach(item => {
+          if (!item.fQty) this.$set(item, 'fQty', scope.row.fQty)
+        })
+      } else if (name === 'fGrossweight') {
+        this.dataList.forEach(item => {
+          if (!item.fGrossweight) this.$set(item, 'fGrossweight', scope.row.fGrossweight)
+        })
+      } else if (name === 'fNetweight') {
+        this.dataList.forEach(item => {
+          if (!item.fNetweight) this.$set(item, 'fNetweight', scope.row.fNetweight)
+        })
       }
     },
     getTreeselect(row) {
@@ -552,7 +607,9 @@ export default {
       });
     },
     importData() {
-      if (this.dataList.length == 0) return this.$message.error('表格未有数据,请完善或关闭')
+      if (this.dataList.length == 0) {
+        return this.$message.error('表格未有数据,请关闭')
+      }
       for (let item in this.dataList) {
         if (this.dataList[item].fBsdate == null) {
           return this.$message.error(
@@ -590,8 +647,24 @@ export default {
           );
         }
       }
-      this.$emit('addDetailList', this.dataList)
-      this.visible = false;
+      this.buttonLoading = true;
+      axios({
+        url: 'https://crawler.tubaosoft.com/prod-api/crawler/charge',
+        method: 'post',
+        data: {
+          token: this.bigDataToken,
+          param: this.form.fMblno,
+        },
+      }).then(res => {
+        if (res.data.code == 500) {
+          return this.$message.error(res.data.msg)
+        }
+        this.$emit('addDetailList', this.dataList)
+        this.buttonLoading = false;
+        this.visible = false;
+      }).finally(() => {
+        this.buttonLoading = false;
+      })
     },
     deleteRow(index) {
       this.dataList.splice(index, 1)