Преглед изворни кода

【新增】调整商用工程订单

莫绍宝 пре 3 година
родитељ
комит
fe344613a1
1 измењених фајлова са 19 додато и 6 уклоњено
  1. 19 6
      src/views/supply/engin/components/commerce_form.vue

+ 19 - 6
src/views/supply/engin/components/commerce_form.vue

@@ -155,7 +155,8 @@
     </div>
 
     <div class="table" style="margin-top: 20px">
-      <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
+      <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400" @selection-change="handleSelectionChange">
+        <el-table-column align="center" type="selection" width="55"></el-table-column>
         <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
         <el-table-column align="center" label="引用记录" prop="useRefCount" min-width="160" show-overflow-tooltip></el-table-column>
         <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="120" show-overflow-tooltip></el-table-column>
@@ -415,6 +416,7 @@ export default {
       // typeList: [],
       stockList: [],
       goodsList: [],
+      multipleSelection: [],
 
       isShowDialog: false, // 工程登录列表 - 弹窗
       screenForm: {
@@ -764,26 +766,37 @@ export default {
       else return '短缺';
     },
 
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+
     // 保存 / 提交审核
     clickSubmitForm(type) {
       this.$refs.mainForm.validate((valid) => {
         if (valid) {
-          for(let i=0; i<this.goodsList.length; i++) {
-            if(!this.goodsList[i].customerWalletId) {
+          if(this.goodsList.length < 1) {
+            return this.$errorMsg('请添加产品');
+          }
+          if(this.multipleSelection.length < 1) {
+            return this.$errorMsg('请选择产品');
+          }
+
+          for(let i=0; i<this.multipleSelection.length; i++) {
+            if(!this.multipleSelection[i].customerWalletId) {
               this.$errorMsg('请选择现金钱包');
               return;
             }
-            if(!this.goodsList[i].qty) {
+            if(!this.multipleSelection[i].qty) {
               this.$errorMsg('请输入数量');
               return;
             }
-            if(this.goodsList[i].qty > this.goodsList[i].enginNum) {
+            if(this.multipleSelection[i].qty > this.multipleSelection[i].enginNum) {
               this.$errorMsg('数量不能大于工程信息数量');
               return;
             }
           }
 
-          let goodsList = JSON.parse(JSON.stringify(this.goodsList));
+          let goodsList = JSON.parse(JSON.stringify(this.multipleSelection));
 
           goodsList.forEach(item => {
             delete item.rebateWallets;