黄梓星 преди 2 години
родител
ревизия
ecb018115d
променени са 2 файла, в които са добавени 49 реда и са изтрити 24 реда
  1. 37 24
      src/views/purchase/PurchaseDemandList/add.vue
  2. 12 0
      src/views/purchase/transferOrder/add.vue

+ 37 - 24
src/views/purchase/PurchaseDemandList/add.vue

@@ -15,7 +15,7 @@
          </el-col>
 
         <el-col :span="1.5">
-            <el-form-item label="组织">
+            <el-form-item label="组织" prop="org" :rules="{ required: true, message: '请选择组织', trigger: 'blur' }">
               <el-select clearable size="small" v-model="basicForm.org" :disabled="sonDisable" @focus="chooseOrg('ORG_PARAM', true, '选择组织')" style="width: 200px">
                 <el-option v-for="item in orgOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
@@ -41,7 +41,7 @@
           </el-col>
 
          <el-col :span="1.5">
-            <el-form-item label="需求客户">
+            <el-form-item label="需求客户" prop="customer" :rules="{ required: true, message: '请选择需求客户', trigger: 'blur' }">
               <el-select clearable size="small" v-model="basicForm.customer" :disabled="sonDisable" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')" style="width: 200px">
                 <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
@@ -82,7 +82,7 @@
           </el-col>
 
           <el-col :span="1.5">
-            <el-form-item label="需求日期">
+            <el-form-item label="需求日期" prop="demandDate" :rules="{ required: true, message: '请选择需求日期', trigger: 'blur' }">
               <el-date-picker
                 v-model="basicForm.demandDate"
                 :disabled="sonDisable"
@@ -227,7 +227,7 @@
           <el-table-column show-overflow-tooltip label="采购员" align="center"  prop="buyer"/>
           <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode" width="230px">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'materialCode'" :rules="{ required: true, message: '请选择物料编码', trigger: 'blur' }">
                 <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.materialCode" @focus="chooseMaterial(scope.$index)">
                   <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMaterial(scope.$index)"></el-button>
                 </el-input>
@@ -262,7 +262,7 @@
           <el-table-column show-overflow-tooltip label="月均销量" align="center"  prop="averageQtyMonth" width="120px"/>
           <el-table-column show-overflow-tooltip label="实际(业务)需求量" align="center"  prop="qty" width="120px">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'qty'" :rules="{ required: true, message: '请填写实际(业务)需求量', trigger: 'blur' }">
                 <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.qty"/>
               </el-form-item>
             </template>
@@ -271,7 +271,7 @@
           <el-table-column show-overflow-tooltip label="集团预测分类" align="center"  prop="forecastClassify" width="120px"/>
           <el-table-column show-overflow-tooltip label="交货日期" align="center"  prop="deliveryDate" width="230px">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'deliveryDate'" :rules="{ required: true, message: '请填写交货日期', trigger: 'blur' }">
                 <el-date-picker
                   v-model="scope.row.deliveryDate"
                   :readonly="sonDisable"
@@ -386,7 +386,7 @@
           </el-table-column>
           <el-table-column show-overflow-tooltip label="补单供应商编码" align="center"  prop="additionalSupplier" width="200px">
             <template slot-scope="scope">
-              <el-form-item class="hang">
+              <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'additionalSupplier'" :rules="{ required: isBDXQ, message: '请选择补单供应商', trigger: 'blur' }">
                 <el-input clearable :disabled="sonDisable || BDZT" size="small" v-model="scope.row.additionalSupplier" @clear="clearHang(scope.$index, '选择补单供应商')" @focus="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')">
                   <el-button size="small" :disabled="sonDisable || BDZT" slot="append" icon="el-icon-more" @click="chooseDept(scope.$index, 'SUPPLIER_PARAM', true, '选择补单供应商')"></el-button>
                 </el-input>
@@ -548,6 +548,7 @@ export default {
       personOptions: [],
       deptOptions: [],
       customerOptions: [],
+      isBDXQ: false
     }
   },
   created() {
@@ -562,9 +563,11 @@ export default {
     // 更改业务类型调整明细行内补单或紧急标识
     changeBillType() {
       if (this.basicForm.billType == 'BDXQ' && this.basicForm.puDemandItemList.length != 0) {
+        this.isBDXQ = true
         this.BDZT = false
         this.basicForm.puDemandItemList.forEach(item => {item.isReplenishment = 'Y'})
       } else {
+        this.isBDXQ = false
         this.BDZT = true
         this.basicForm.puDemandItemList.forEach(item => { 
           item.isReplenishment = 'N' 
@@ -620,23 +623,27 @@ export default {
     },
     async save() {
       if(this.basicForm.puDemandItemList.length !== 0) {
-        if(this.sonPageStu == 'add') {
-          await this.handleData()
-          await addDemand(this.basicForm).then(res => {
-            console.log(333)
-            if (res.code === 200) {
-              this.$modal.msgSuccess("保存成功");
-              this.back()
-            }
-          })
-        } else if (this.sonPageStu == 'edit') {
-          editDemand(this.basicForm).then(res => {
-            if (res.code === 200) {
-              this.$modal.msgSuccess("编辑成功");
-              this.back()
+        this.$refs['basic'].validate((valid) => {
+          if(valid) {
+            if(this.sonPageStu == 'add') {
+              this.handleData()
+              addDemand(this.basicForm).then(res => {
+                console.log(333)
+                if (res.code === 200) {
+                  this.$modal.msgSuccess("保存成功");
+                  this.back()
+                }
+              })
+            } else if (this.sonPageStu == 'edit') {
+              editDemand(this.basicForm).then(res => {
+                if (res.code === 200) {
+                  this.$modal.msgSuccess("编辑成功");
+                  this.back()
+                }
+              })
             }
-          })
-        }
+          }
+        })
       } else {
         this.$modal.msgWarning("明细信息不能为空!");
       }
@@ -798,7 +805,13 @@ export default {
               if(this.basicForm.demandDept) { this.reBackRefer('DEPT_PARAM', this.basicForm.demandDept) }
               // 详情时将收货仓库id赋值给stordocId
               // 如果业务类型为补单需求,则明细内补单供应商编码可以编辑
-              if(this.basicForm.billType == 'BDXQ') { this.BDZT = false } else { this.BDZT = true }
+              if(this.basicForm.billType == 'BDXQ') {
+                 this.BDZT = false 
+                 this.isBDXQ = true
+              } else {
+                 this.BDZT = true
+                 this.isBDXQ = false
+              }
             }
           })
         }

+ 12 - 0
src/views/purchase/transferOrder/add.vue

@@ -317,6 +317,7 @@
                   :readonly="sonDisable"
                   type="date"
                   size="small"
+                  :picker-options="pickerOptionsEnd"
                   value-format="yyyy-MM-dd">
                 </el-date-picker>
               </el-form-item>
@@ -681,6 +682,17 @@ export default {
       receiveInfo: [],
       priceList: [],
       resultList: [],
+      pickerOptionsEnd: {
+        disabledDate: (time) => {
+          let beginDateVal = this.basicForm.billDate;
+          if (beginDateVal) {
+            return (
+              time.getTime() <
+              new Date(beginDateVal).getTime()
+            );
+          }
+        }
+      }
     }
   },
   created() {