tong 4 năm trước cách đây
mục cha
commit
58709545f4
1 tập tin đã thay đổi với 148 bổ sung35 xóa
  1. 148 35
      src/views/warehouseBusiness/inStock/index.vue

+ 148 - 35
src/views/warehouseBusiness/inStock/index.vue

@@ -248,8 +248,8 @@
                 placeholder="请选择货权方"
               >
                 <el-option
-                  v-for="dict in fMblnoOptions"
-                  :key="dict.fId"
+                  v-for="(dict, index) in fMblnoOptions"
+                  :key="index.fId"
                   :label="dict.fName"
                   :value="dict.fId"
                 ></el-option>
@@ -552,7 +552,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="贸易方式" prop="ftrademodeid">
+            <el-form-item label="贸易方式" prop="fTrademodeid">
               <el-select
                 v-model="form.fTrademodeid"
                 placeholder="请选择贸易方式"
@@ -665,8 +665,8 @@
               placeholder="请选择品名"
             >
               <el-option
-                v-for="dict in goodsOptions"
-                :key="dict.fId"
+                v-for="(dict,index) in goodsOptions"
+                :key="index.fId"
                 :label="dict.fName"
                 :value="dict.fId"
               ></el-option>
@@ -825,17 +825,33 @@
           align="center"
           label="库区"
         >
-          <template slot-scope="scope">
+          <!-- <template slot-scope="scope">
             <el-input
               oninput="value=value.replace(/[^\d.]/g,'')"
               v-model="scope.row.fWarehouselocid"
               placeholder="库区"
               show-word-limit
             />
+          </template> -->
+          <template slot-scope="scope">
+            <el-select
+              v-model="scope.row.fWarehouselocid"
+              filterable
+              remote
+              :remote-method="kqhouseRemoteMethod"
+              placeholder="请选择库区"
+            >
+              <el-option
+                v-for="dict in kqhouseOptions"
+                :key="dict.fId"
+                :label="dict.fName"
+                :value="dict.fId"
+              ></el-option>
+            </el-select>
           </template>
         </el-table-column>
         <el-table-column
-          prop="fBoxno"
+          prop="fCntrno"
           header-align="center"
           width="150px"
           align="center"
@@ -843,7 +859,7 @@
         >
           <template slot-scope="scope">
             <el-input
-              v-model="scope.row.fBoxno"
+              v-model="scope.row.fCntrno"
               placeholder="箱号"
               show-word-limit
             />
@@ -1042,8 +1058,8 @@
               placeholder="客户名称"
             >
               <el-option
-                v-for="dict in KHblnoOptions"
-                :key="dict.fId"
+                v-for="(dict, index) in KHblnoOptions"
+                :key="index.fId"
                 :label="dict.fName"
                 :value="dict.fId"
               ></el-option>
@@ -1275,8 +1291,8 @@
               placeholder="客户名称"
             >
               <el-option
-                v-for="dict in KHblnoOptions"
-                :key="dict.fId"
+                v-for="(dict, index) in KHblnoOptions"
+                :key="index.fId"
                 :label="dict.fName"
                 :value="dict.fId"
               ></el-option>
@@ -1773,6 +1789,8 @@ import { listFees } from "@/api/basicdata/fees";
 
 import { listWarehouse } from "@/api/basicdata/warehouse";
 
+import { listArea } from "@/api/basicdata/area";
+
 import { listGoods } from "@/api/basicdata/goods";
 
 import { listUser, queryUserVal } from "@/api/system/user";
@@ -1831,6 +1849,7 @@ export default {
       deptOptions: [],
       // 仓库(仓库数据)
       warehouseOptions: [],
+      kqhouseOptions: [],
       // 贸易方式(数据字典),对应t_trademodels 字典
       fTrademodeidOptions: [],
       // 计费单位(数据字典),下拉选择毛重或净重字典
@@ -1919,6 +1938,9 @@ export default {
         fBsdate: [
           { required: true, message: "请选择业务日期", trigger: "blur" },
         ],
+        fTrademodeid: [
+          { required: true, message: "请选择贸易方式", trigger: "blur" },
+        ],
         fStorekeeper: {
           required: true,
           message: "请输入仓管员",
@@ -1981,7 +2003,7 @@ export default {
     showFile(row) {
       console.log(row);
       // this.$set(this.relevantAttachments[0], 'fName', row.fileName)
-      this.$set(this.relevantAttachments[0], 'fUrl', row.url)
+      this.$set(this.relevantAttachments[0], "fUrl", row.url);
     },
     printSomething() {
       // 此处的style即为打印时的样式
@@ -2063,9 +2085,9 @@ export default {
     },
     queryUser() {
       queryUserVal().then((response) => {
-        console.log(response)
-        console.log(this.form)
-        console.log(this.relevantAttachments)
+        console.log(response);
+        console.log(this.form);
+        console.log(this.relevantAttachments);
         if (response.user !== null) {
           this.userVal = response.user;
           this.$set(this.form, "fDeptid", this.userVal.deptId);
@@ -2198,7 +2220,7 @@ export default {
       this.dataList = [];
       this.warehouseCrList = [];
       this.warehouseDrList = [];
-      this.relevantAttachments = []
+      this.relevantAttachments = [];
       this.title = "入库单";
     },
     /** 修改按钮操作 */
@@ -2206,15 +2228,28 @@ export default {
       this.reset();
       const fId = row.fId || this.ids;
       getWarehousebills(fId).then((response) => {
-        console.log(response)
-        console.log(response.data.corps)
+        console.log(response);
+        console.log(response.data.corps);
         this.form = response.data.warehousebills;
-        this.fMblnoOptions = []
         this.fMblnoOptions = response.data.corps;
-        this.dataList = response.data.goodsList;
+        this.KHblnoOptions = response.data.corps;
+        this.dataList = response.data.warehouseBillsItem;
         this.relevantAttachments = response.data.enclosures;
         this.warehouseDrList = response.data.warehousebillsfeesDr;
         this.warehouseCrList = response.data.warehousebillsfeesCr;
+        this.warehouseOptions = response.data.warehouse;
+        this.userOptions = response.data.sysUser;
+        this.goodsOptions = response.data.goodsList;
+        this.$set(
+          this.form,
+          "fBsdate",
+          Date.parse(response.data.warehousebills.fBsdate)
+        );
+        // this.$set(
+        //   this.dataList,
+        //   "fBsdate",
+        //   Date.parse(response.data.warehouseBillsItem[0].fBsdate)
+        // );
         // this.$set(this.form, "fCorpid", response.data.corps[0].fName);
         // this.$set(this.form, "fStltypeid", response.data.corps[0].fName);
         // console.log(this.form)
@@ -2231,11 +2266,7 @@ export default {
         // );
         // this.$set(this.form, "fTel", response.data.warehousebills.ftel);
         // this.$set(this.form, "fMblno", response.data.warehousebills.fmblno);
-        // this.$set(
-        //   this.form,
-        //   "fBsdate",
-        //   Date.parse(response.data.warehousebills.fbsdate)
-        // );
+
         // this.$set(
         //   this.form,
         //   "fStorekeeper",
@@ -2375,16 +2406,97 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      if(typeof this.form.fBillstatus === 'undefined' || this.form.fBillstatus==null) {
+      console.log(this.dataList)
+      console.log(this.relevantAttachments)
+      console.log(this.warehouseDrList)
+      console.log(this.warehouseCrList)
+      
+      if (
+        typeof this.form.fBillstatus === "undefined" ||
+        this.form.fBillstatus == null || this.dataList
+      ) {
         this.form.fBillstatus = 6;
       }
+     
       this.$refs["form"].validate((valid) => {
+        if (this.dataList.length ===  0) {
+          this.$message.error('请添加库存明细!')
+          return false
+        }
+        if (this.relevantAttachments.length ===  0) {
+          this.$message.error('请添加附件上传!')
+          return false
+        }
+        if (this.warehouseDrList.length ===  0) {
+          this.$message.error('请添加收款信息!')
+          return false
+        }
+        if (this.warehouseCrList.length ===  0) {
+          this.$message.error('请添加付款信息!')
+          return false
+        }
+        // this.dataList.map((item, index)=> {
+        //   console.log(index)
+        //   if (!this.dataList[index].fGoodsid) {
+        //   this.$message.error('请输入品名!')
+        //   return false
+        // }
+        // })
+//         for( var i = 0; i <= this.dataList.length;i++){
+//           console.log(JSON.stringify(this.dataList[i].fGoodsid))
+// if (!this.dataList[i].fGoodsid) {
+//           this.$message.error('请输入品名!')
+//           return false
+//         }
+//         }
+         
+         for (let list in this.dataList) {
+           console.log(JSON.stringify(this.dataList))
+           if (!this.dataList[list].fGoodsid) {
+              this.$message.error('请输入品名!')
+              return false
+            }
+         }
+         for (let list in this.dataList) {
+           console.log(JSON.stringify(this.dataList))
+           if (!this.dataList[list].fWarehouselocid) {
+              this.$message.error('请输入库区!')
+              return false
+            }
+         }
+         for (let list in this.relevantAttachments) {
+            if (this.relevantAttachments[list].fName ===  null) {
+          this.$message.error('请输入附件名称!')
+          return false
+        }
+         }
+        // if (this.relevantAttachments[0].fUrl ===  null) {
+        //   this.$message.error('请上传附件')
+        //   return false
+        // }
+         for (let list in this.warehouseDrList) {
+            if (!this.warehouseDrList[list].fCorpid) {
+          this.$message.error('请选择客户名称')
+          return false
+        }
+        
+         }
+          for (let list in this.warehouseCrList) {
+            if (!this.warehouseDrList[list].fCorpid) {
+          this.$message.error('请选择客户名称')
+          return false
+        }
+        
+         }
         if (valid) {
           let formData = new window.FormData();
           // 附件数据
           formData.append("tWarehouseBills", JSON.stringify(this.form));
           // 附件数据
-          formData.append("tWhgenleg", JSON.stringify(this.relevantAttachments));
+          formData.append(
+            "tWhgenleg",
+            JSON.stringify(this.relevantAttachments)
+          );
           // // 费用明细付款
           formData.append(
             "tWarehousebillsfeesCr",
@@ -2400,6 +2512,7 @@ export default {
             "tWarehousebillsitems",
             JSON.stringify(this.dataList)
           );
+          console.log(this.dataList)
           addWarehousebills(formData).then((response) => {
             console.log(response);
             this.msgSuccess("新增成功");
@@ -2495,21 +2608,21 @@ export default {
       if (name == null || name === "") {
         return false;
       }
-      let queryParams = { pageNum: 1, pageSize: 10, fName: name};
+      let queryParams = { pageNum: 1, pageSize: 10, fName: name };
       listWarehouse(queryParams).then((response) => {
-        console.log(response)
+        console.log(response);
         this.warehouseOptions = response.rows;
       });
     },
     /* 远程模糊查询库区 */
-    warehouseRemoteMethod(name) {
+    kqhouseRemoteMethod(name) {
       if (name == null || name === "") {
         return false;
       }
-      let queryParams = { pageNum: 1, pageSize: 10, fName: name};
-      listWarehouse(queryParams).then((response) => {
-        console.log(response)
-        this.warehouseOptions = response.rows;
+      let queryParams = { pageNum: 1, pageSize: 10, fName: name };
+      listArea(queryParams).then((response) => {
+        console.log(response);
+        this.kqhouseOptions = response.rows;
       });
     },
     /* 远程模糊查询操作用户 */