Przeglądaj źródła

修改采销录单 分类显示不是三级的问题

xiaodai2022 1 rok temu
rodzic
commit
2ee48cbe42

+ 2 - 2
src/views/netOrderEntry/netOrderEnter/addEdit-c.vue

@@ -775,14 +775,14 @@ export default {
         ...rest,
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(',') : [],
-        cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
+        cat_id: cat_id && cat_id.length === 3 ? [cat_id[cat_id.length - 1]] : [],
         supplierNo: supplierNo ? [supplierNo] : [],
         khNo: khNo ? [khNo] : [],
         tax: tax ? tax + '%' : '',
         goodUnit: goodUnit ? [goodUnit] : ''
       }
 
-      this.cat_id_name = cat_id.map(({ name }) => name).join('_')
+      this.cat_id_name = cat_id && cat_id.length === 3 ?cat_id.map(({ name }) => name).join('_'):""
       console.log(this.cat_id_name)
       this.unit_name = unitName
 

+ 2 - 2
src/views/netOrderEntry/netOrderEnter/addEdit.vue

@@ -795,14 +795,14 @@ export default {
         managerid:managerid ? [managerid] : managerid,
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(",") : [],
-        cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
+        cat_id: cat_id && cat_id.length === 3 ? [cat_id[cat_id.length - 1]] : [],
         supplierNo: supplierNo ? [supplierNo] : [],
         khNo: khNo ? [khNo] : [],
         tax: tax ? tax + "%" : "",
         goodUnit: goodUnit ? [goodUnit] : ""
       };
 
-      this.cat_id_name = cat_id.map(({ name }) => name).join("_");
+      this.cat_id_name = cat_id && cat_id.length === 3 ?cat_id.map(({ name }) => name).join("_"):"";
       console.log(this.cat_id_name);
       this.unit_name = unitName;
 

+ 69 - 71
src/views/netOrderEntry/netOrderEnter/detail-modal.vue

@@ -33,9 +33,9 @@
             <el-row>
               <el-col :span="12">
                 <el-form-item label="销售方公司:" label-width="100px" prop="companyNo">
-                  <p
-                    style="font-size: 14px; color: #606266; font-weight: 700"
-                  >{{ getCompanyWithCode(ruleForm.companyNo).name }}</p>
+                  <p style="font-size: 14px; color: #606266; font-weight: 700">
+                    {{ getCompanyWithCode(ruleForm.companyNo).name }}
+                  </p>
                   <!-- <search-work-company
                     disabled
                     :value="ruleForm.companyNo"
@@ -339,8 +339,12 @@
           </el-form>
         </el-col>
         <el-col :span="24" style="text-align: right">
-          <el-button v-if="id !== '007'" type="primary" @click="submitForm">保 存</el-button>
-          <el-button @click="showModelThis = false">{{ id == "007" ? "关 闭" : "取 消" }}</el-button>
+          <el-button v-if="id !== '007'" type="primary" @click="submitForm"
+            >保 存</el-button
+          >
+          <el-button @click="showModelThis = false">{{
+            id == "007" ? "关 闭" : "取 消"
+          }}</el-button>
         </el-col>
       </el-row>
     </el-card>
@@ -373,7 +377,7 @@ const defaultData = {
   goodNum: "",
   goodPrice: "",
   sale_total: "",
-  goodUnit: ""
+  goodUnit: "",
 };
 
 export default {
@@ -402,7 +406,7 @@ export default {
       cat_id_name: "",
       showModelThis: this.showModel,
       pickerOptions: {
-        disabledDate: time => time.getTime() > new Date()
+        disabledDate: (time) => time.getTime() > new Date(),
       },
       names: [],
       unit_name: "",
@@ -414,146 +418,146 @@ export default {
           {
             required: true,
             message: "请选择单位",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         platform_id: [
           {
             required: true,
             message: "请输入所属平台",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
 
         cgd_tax: [
           {
             required: true,
             message: "请输入采购毛利率",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cat_id: [
           {
             required: true,
             message: "请选择商品分类",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         supplierNo: [
           {
             type: "array",
             required: true,
             message: "请选择供应商公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         qrdType: [
           {
             required: true,
             message: "请输入订单来源",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         sale_total: [
           {
             required: true,
             message: "请输入销售总额",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         poCode: [
           {
             required: true,
             message: "请输入PO编号",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         khNo: [
           {
             type: "array",
             required: true,
             message: "请选择购买方公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         tax: [
           {
             required: true,
             message: "请选择税率",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         companyNo: [
           {
             required: true,
             message: "请选择销售方公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         contactor: [
           {
             required: true,
             message: "请输入收货人",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         mobile: [
           {
             required: true,
             validator: validatemobile,
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         addr: [
           {
             required: true,
             message: "请输入联系地址",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         sendtime: [
           {
             required: true,
             message: "请输入发货时间",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         goodName: [
           {
             required: true,
             message: "请输入商品名称",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         goodPrice: [
           {
             required: true,
             message: "请输入销售单价",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cgdPrice: [
           {
             required: true,
             message: "请选择采购单价",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         goodNum: [
           {
             required: true,
             message: "请输入数量",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cgd_total: [
           {
             required: true,
             message: "请输入采购总额",
-            trigger: "blur"
-          }
-        ]
-      }
+            trigger: "blur",
+          },
+        ],
+      },
     };
   },
   computed: {
@@ -568,10 +572,10 @@ export default {
     cgdTotalWatchSource() {
       const { goodNum, cgdPrice } = this.ruleForm;
       return { goodNum, cgdPrice };
-    }
+    },
   },
   watch: {
-    showModel: function(val) {
+    showModel: function (val) {
       this.showModelThis = val;
       if (val) {
         this.initForm();
@@ -591,7 +595,7 @@ export default {
 
         this.ruleForm.sale_total = accMul(goodPrice, goodNum);
       },
-      deep: true
+      deep: true,
     },
     cgdTotalWatchSource: {
       handler({ cgdPrice, goodNum }) {
@@ -602,8 +606,8 @@ export default {
 
         this.ruleForm.cgd_total = accMul(cgdPrice, goodNum);
       },
-      deep: true
-    }
+      deep: true,
+    },
   },
   methods: {
     async handleHandoverName(e) {
@@ -707,10 +711,7 @@ export default {
     number_change_total(current, prop) {
       const isCgdTotal = prop === "cgd_total";
       const { goodNum } = this.ruleForm;
-      this.ruleForm[isCgdTotal ? "cgdPrice" : "goodPrice"] = accDiv(
-        current,
-        goodNum
-      );
+      this.ruleForm[isCgdTotal ? "cgdPrice" : "goodPrice"] = accDiv(current, goodNum);
       this.ruleForm[prop] = current;
 
       let tax = 0;
@@ -746,14 +747,15 @@ export default {
         ...rest,
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(",") : [],
-        cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
+        cat_id: cat_id && cat_id.length === 3 ? [cat_id[cat_id.length - 1]] : [],
         supplierNo: supplierNo ? [supplierNo] : [],
         khNo: khNo ? [khNo] : [],
         tax: tax ? tax + "%" : "",
-        goodUnit: goodUnit ? [goodUnit] : ""
+        goodUnit: goodUnit ? [goodUnit] : "",
       };
 
-      this.cat_id_name = cat_id.map(({ name }) => name).join("_");
+      this.cat_id_name =
+        cat_id && cat_id.length === 3 ? cat_id.map(({ name }) => name).join("_") : "";
       console.log(this.cat_id_name);
       this.unit_name = unitName;
 
@@ -783,7 +785,7 @@ export default {
       this.$refs.ruleForm.validateField("cat_id");
     },
     async submitForm() {
-      await this.$refs.ruleForm.validate(async valid => {
+      await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           if (this.loading) {
             return;
@@ -793,12 +795,8 @@ export default {
           const model = JSON.parse(JSON.stringify(this.ruleForm));
           model.supplierNo = model.supplierNo[0];
           model.khNo = model.khNo[0];
-          model.buyerid = Array.isArray(model.buyerid)
-            ? model.buyerid[0]
-            : model.buyerid;
-          model.cat_id = model.cat_id
-            ? model.cat_id[model.cat_id.length - 1]
-            : "";
+          model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid;
+          model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : "";
           model.addr_code = model.addr_code.join(",");
           model.tax = model.tax.split("%")[0];
           model.pay_name = this.pay_name;
@@ -818,7 +816,7 @@ export default {
             const title = this.id === "003" ? "添加成功!" : "修改成功!";
             this.$notify.success({
               title,
-              message: ""
+              message: "",
             });
             this.showModelThis = false;
             // 刷新
@@ -833,8 +831,8 @@ export default {
           return false;
         }
       });
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 73 - 72
src/views/netOrderEntry/prestoreRecordingOrders/addEdit.vue

@@ -33,9 +33,9 @@
             <el-row>
               <el-col :span="12">
                 <el-form-item label="销售方公司:" label-width="100px" prop="companyNo">
-                  <p
-                    style="font-size:14px;color:#606266;font-weight:700"
-                  >{{ getCompanyWithCode(ruleForm.companyNo).name }}</p>
+                  <p style="font-size: 14px; color: #606266; font-weight: 700">
+                    {{ getCompanyWithCode(ruleForm.companyNo).name }}
+                  </p>
                 </el-form-item>
               </el-col>
 
@@ -109,7 +109,7 @@
               <el-col :span="12">
                 <el-form-item label="其他单号" prop="workCode">
                   <template #label>
-                    <p style="margin-left:10px">其他单号</p>
+                    <p style="margin-left: 10px">其他单号</p>
                   </template>
                   <el-input
                     v-model="ruleForm.workCode"
@@ -130,7 +130,7 @@
                     :is-detail="true"
                     placeholder="项目经理"
                     @searchChange="managerChange"
-                    style="width:100%"
+                    style="width: 100%"
                   />
                 </el-form-item>
               </el-col>
@@ -355,8 +355,12 @@
           </el-form>
         </el-col>
         <el-col :span="24" style="text-align: right">
-          <el-button v-if="id !== '007'" type="primary" @click="submitForm">保 存</el-button>
-          <el-button @click="showModelThis = false">{{ id == "007" ? "关 闭" : "取 消" }}</el-button>
+          <el-button v-if="id !== '007'" type="primary" @click="submitForm"
+            >保 存</el-button
+          >
+          <el-button @click="showModelThis = false">{{
+            id == "007" ? "关 闭" : "取 消"
+          }}</el-button>
         </el-col>
       </el-row>
     </el-card>
@@ -369,8 +373,8 @@ import { accMul, accDiv, accSub, isPhone, isMobile } from "@/utils/validate";
 import resToken from "@/mixins/resToken";
 
 const defaultData = {
-  manager:"",
-  managerid:[],
+  manager: "",
+  managerid: [],
   addr_code: [],
   cgd_total: "",
   cgdPrice: "",
@@ -393,7 +397,7 @@ const defaultData = {
   goodPrice: "",
   sale_total: "",
   goodUnit: "",
-  tax: ""
+  tax: "",
 };
 
 export default {
@@ -422,7 +426,7 @@ export default {
       cat_id_name: "",
       showModelThis: this.showModel,
       pickerOptions: {
-        disabledDate: time => time.getTime() > new Date()
+        disabledDate: (time) => time.getTime() > new Date(),
       },
       names: [],
       unit_name: "",
@@ -434,8 +438,8 @@ export default {
           {
             required: true,
             message: "请选择单位",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         // addr_code: [
         //   {
@@ -449,45 +453,45 @@ export default {
           {
             required: true,
             message: "请输入所属平台",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
 
         cgd_tax: [
           {
             required: true,
             message: "请输入采购毛利率",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cat_id: [
           {
             required: true,
             message: "请选择商品分类",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         supplierNo: [
           {
             type: "array",
             required: true,
             message: "请选择供应商公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         qrdType: [
           {
             required: true,
             message: "请输入订单来源",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         sale_total: [
           {
             required: true,
             message: "请输入货款总金额",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         // workCode: [
         //   {
@@ -500,97 +504,97 @@ export default {
           {
             required: true,
             message: "请输入PO编号",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         khNo: [
           {
             type: "array",
             required: true,
             message: "请选择购买方公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         tax: [
           {
             required: true,
             message: "请选择税率",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         companyNo: [
           {
             required: true,
             message: "请选择销售方公司",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
         contactor: [
           {
             required: true,
             message: "请输入收货人",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         mobile: [
           {
             required: true,
             validator: validatemobile,
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         addr: [
           {
             required: true,
             message: "请输入联系地址",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
 
         sendtime: [
           {
             required: true,
             message: "请输入发货时间",
-            trigger: "change"
-          }
+            trigger: "change",
+          },
         ],
 
         goodName: [
           {
             required: true,
             message: "请输入商品名称",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         goodPrice: [
           {
             required: true,
             message: "请输入销售单价",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cgdPrice: [
           {
             required: true,
             message: "请选择采购单价",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         goodNum: [
           {
             required: true,
             message: "请输入数量",
-            trigger: "blur"
-          }
+            trigger: "blur",
+          },
         ],
         cgd_total: [
           {
             required: true,
             message: "请输入采购总额",
-            trigger: "blur"
-          }
-        ]
-      }
+            trigger: "blur",
+          },
+        ],
+      },
     };
   },
   computed: {
@@ -601,10 +605,10 @@ export default {
     cgdTotalWatchSource() {
       const { goodNum, cgdPrice } = this.ruleForm;
       return { goodNum, cgdPrice };
-    }
+    },
   },
   watch: {
-    showModel: function(val) {
+    showModel: function (val) {
       this.showModelThis = val;
       if (val) {
         this.initForm();
@@ -614,7 +618,7 @@ export default {
       if (!val) {
         this.$emit("cancel");
       }
-    }
+    },
     // totalWatchSource: {
     //   handler({ goodPrice, goodNum }) {
     //     if (goodPrice === 0 || goodNum === 0) {
@@ -753,18 +757,19 @@ export default {
 
       this.ruleForm = {
         ...rest,
-        manager:manager || "",
-        managerid:managerid ? [managerid] : [],
+        manager: manager || "",
+        managerid: managerid ? [managerid] : [],
         buyerid: buyerid ? [buyerid] : [],
         addr_code: addr_code ? addr_code.split(",") : [],
-        cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
+        cat_id: cat_id && cat_id.length === 3 ? [cat_id[cat_id.length - 1]] : [],
         supplierNo: supplierNo ? [supplierNo] : [],
         khNo: khNo ? [khNo] : [],
         tax: tax ? tax + "%" : "",
-        goodUnit: goodUnit ? [goodUnit] : ""
+        goodUnit: goodUnit ? [goodUnit] : "",
       };
 
-      this.cat_id_name = cat_id.map(({ name }) => name).join("_");
+      this.cat_id_name =
+        cat_id && cat_id.length === 3 ? cat_id.map(({ name }) => name).join("_") : "";
       this.unit_name = unitName;
 
       this.khName = khName;
@@ -793,8 +798,8 @@ export default {
       this.$refs.ruleForm.validateField("cat_id");
     },
     async submitForm() {
-      console.log(111)
-      await this.$refs.ruleForm.validate(async valid => {
+      console.log(111);
+      await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           if (this.loading) {
             return;
@@ -804,12 +809,8 @@ export default {
           const model = JSON.parse(JSON.stringify(this.ruleForm));
           model.supplierNo = model.supplierNo[0];
           model.khNo = model.khNo[0];
-          model.buyerid = Array.isArray(model.buyerid)
-            ? model.buyerid[0]
-            : model.buyerid;
-          model.cat_id = model.cat_id
-            ? model.cat_id[model.cat_id.length - 1]
-            : "";
+          model.buyerid = Array.isArray(model.buyerid) ? model.buyerid[0] : model.buyerid;
+          model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : "";
           model.addr_code = model.addr_code.join(",");
           model.tax = model.tax.split("%")[0];
           model.pay_name = this.pay_name;
@@ -829,7 +830,7 @@ export default {
             const title = this.id === "003" ? "添加成功!" : "修改成功!";
             this.$notify.success({
               title,
-              message: ""
+              message: "",
             });
             this.showModelThis = false;
             // 刷新
@@ -844,8 +845,8 @@ export default {
           return false;
         }
       });
-    }
-  }
+    },
+  },
 };
 </script>