snow 2 jaren geleden
bovenliggende
commit
f5047b371f

File diff suppressed because it is too large
+ 0 - 0
dist/static/js/0.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.js


+ 2 - 1
src/components/globalComponents/company-sort/index.vue

@@ -90,7 +90,8 @@ export default {
             label: this.options[index].cat_name + '',
             cat_desc: this.options[index].cat_desc,
             item: this.options[index].item + '',
-            pid: this.options[index].pid + ''
+            pid: this.options[index].pid + '',
+            is_gold: this.options[index].is_gold
           }
           console.log(model)
           this.$emit('searchChange', model)

+ 3 - 2
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -1977,12 +1977,13 @@ export default {
     },
     //商品分类选择
     async goods_class_change(e) {
-      const { code, pid, id, label, cat_desc } = e;
+      const { is_gold, pid, id, label, cat_desc } = e;
+      this.spec_tableData = []
       this.ruleForm.cat_id = id ? [id] : [];
       this.$refs.ruleForm.validateField("cat_id");
       this.ruleForm.after_sales = cat_desc || "";
       this.$refs.ruleForm.validateField("after_sales");
-      this.is_noble = pid === "6";
+      this.is_noble = is_gold;
       this.sch_is_noble();
       await this.set_must_spec();
       await this.get_all_fee();

+ 4 - 3
src/views/goodStore/supplierGoodsCost/components/baseForm.vue

@@ -178,7 +178,7 @@
                 v-model="ruleForm.is_stock"
                 filterable
                 clearable
-                :disabled="type === 'view' || type === 'editBase' || type === 'editCoin'"
+                :disabled="type === 'view' || type === 'editBase' || type === 'editCoin' || type === 'edit'"
                 style="width: 100%"
                 @change="stock_change"
                 placeholder="是否库存品"
@@ -1972,9 +1972,10 @@ export default {
     },
     //商品分类选择
     async goods_class_change(e) {
-      const { code, pid, id, label, cat_desc } = e;
+      const { code, is_gold, id, label, cat_desc } = e;
+      this.spec_tableData = []
 
-      if(pid === '6'){
+      if(is_gold){
         this.$message.warning('不允许创建贵金属商品');
         this.ruleForm.cat_id = []
         return

+ 81 - 10
src/views/netOrderEntry/netOrderEnter/importTemplateModal.vue

@@ -27,6 +27,8 @@
 <script>
 import { columns, getTableProperty } from './template'
 import companyHelper from '@/mixins/companyHelper'
+import { MessageBox } from 'element-ui'
+import { h } from 'vue'
 export default {
   mixins: [companyHelper],
   props: ['visible'],
@@ -69,22 +71,87 @@ export default {
       return isHeaderOk
     },
     /* 校验导入的销售方列表编码(与选择的公司必须一致) **/
-    validateCompanyNo() {
+    validateCompanyNo(companys = []) {
+      let isValid = true
+      const notValidRows = []
       const current = this.currentCompany
+
+      companys.forEach((companyNo, index) => {
+        if (companyNo !== current) {
+          isValid = false
+          notValidRows.push(index + 1)
+        }
+      })
+
+      return {
+        isValid,
+        notValidRows,
+        message: '销售方公司与选择的公司必须一致'
+      }
+    },
+    /* 校验导入的购买方列表编码(开头必须为KH) **/
+    validateKhNo(customers = []) {
+      let isValid = true
+      const notValidRows = []
+      customers.forEach((customerNo, index) => {
+        const perfix = String(customerNo || '').slice(0, 1)
+        if (perfix !== 'KH') {
+          isValid = false
+          notValidRows.push(index + 1)
+        }
+      })
+      return {
+        isValid,
+        notValidRows,
+        message: "购买方公司编码必须以'KH'开头"
+      }
+    },
+    /* 处理不合法的值,提示错误信息,并返回最终的验证状态 **/
+    handleNotValidFields(...validStates) {
+      const messages = {}
+      let finalValid = true
+
+      for (const validState of validStates) {
+        const { message, isValid, notValidRows } = validState
+        if (isValid) continue
+        finalValid = false
+
+        notValidRows.forEach(row => {
+          if (!messages[row]) messages[row] = []
+          messages[row].push(message)
+        })
+      }
+
+      console.log(Object.keys(messages), messages['1'])
+      if (!finalValid) {
+        MessageBox({
+          type: 'warning',
+          title: '数据填写错误',
+          message: h('ul', null, [])
+        })
+      }
+
+      return finalValid
     },
     /* 校验导入的数据 **/
     validateFields(tableData = []) {
-      for (const index in tableData) {
-        const tableItem = tableData[index]
-        const propertys = Object.keys(tableItem)
+      const tableFieldToTableData = {}
 
-        propertys.forEach(property => {
-          switch (property) {
-            case 'companyNo':
-              break
-          }
-        })
+      for (const tableItem of tableData) {
+        const propertys = Object.keys(tableItem)
+        for (const property of propertys) {
+          const value = tableItem[property]
+          if (!tableFieldToTableData[property]) tableFieldToTableData[property] = []
+          tableFieldToTableData[property].push(value)
+        }
       }
+
+      const finalValid = this.handleNotValidFields(
+        this.validateCompanyNo(tableFieldToTableData.companyNo),
+        this.validateKhNo(tableFieldToTableData.khNo)
+      )
+
+      return finalValid
     },
     mapTemplateItemToTableItem(templateItem) {
       const tableItem = {}
@@ -117,6 +184,10 @@ export default {
       })
 
       const isValid = this.validateFields(this.tableData)
+
+      if (isValid) {
+        this.tableData = []
+      }
     }
   }
 }

+ 1 - 1
src/views/netOrderEntry/netOrderEnter/index.vue

@@ -237,7 +237,7 @@ export default {
     };
 
     return {
-      templateModalVisible:false,
+      templateModalVisible: false,
       xs_order_type_options,
       xs_order_source_options,
       statusList: statusList,

Some files were not shown because too many files changed in this diff