yijing пре 1 година
родитељ
комит
0be0927add

+ 18 - 9
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -1,12 +1,13 @@
 <template>
-  <ele-modal :visible.sync="visible" :closed="cancel" :title="`${type == 'add' ? '创建' : '编辑'}配料计划`"
+  <ele-modal :visible.sync="visible" @closed="cancel" :title="`${type == 'add' ? '创建' : '编辑'}配料计划`"
     custom-class="ele-dialog-form" :close-on-click-modal="false" :close-on-press-escape="false" width="80%"
     :maxable="true">
     <el-form :model="formData" ref="formRef" label-width="120px" class="ele-body" :rules="rules">
       <el-row :gutter="24">
         <el-col :span="8">
           <el-form-item label="需求类型" prop="demandType">
-            <el-select v-model="formData.demandType" placeholder="请选择" style="width: 100%" :disabled="type == 'detail'">
+            <el-select v-model="formData.demandType" :key="formData.demandType" placeholder="请选择" style="width: 100%"
+              :disabled="type == 'detail'">
               <el-option v-for="item in demandTypeList" :key="item.dictCode" :label="item.dictValue"
                 :value="item.dictCode">
               </el-option>
@@ -569,11 +570,13 @@ export default {
 
   methods: {
     async open(type, row) {
+
       this.type = type;
-      if (type == 'add') {
-        // this.formData.demandType = '';
-        this.formData.name = '';
-        this.formData.remark = '';
+
+      this.formData.demandType = '1';
+
+      if (this.type == 'add') {
+        this.formData.demandType = '1';
       }
 
       this.formData.orderType = 1;
@@ -872,9 +875,15 @@ export default {
     },
     cancel() {
       this.visible = false;
-      this.formData = {};
-      this.formData.detailRemoveIds = [];
-      this.formData.materialRemoveIds = [];
+
+      this.formData = {
+        demandType: '1', // 增加默认值重置
+        name: '',
+        remark: '',
+        detailRemoveIds: [],
+        materialRemoveIds: [],
+        orderType: 1
+      };
       this.$refs.table.setData([]);
       this.$refs.formRef.resetFields();
     },

+ 18 - 9
src/views/materialPlan/components/producePlan.vue

@@ -1,12 +1,13 @@
 <template>
-  <ele-modal :visible.sync="visible" :closed="cancel" :title="`${type == 'add' ? '创建' : '编辑'}采购计划`"
+  <ele-modal :visible.sync="visible" @closed="cancel" :title="`${type == 'add' ? '创建' : '编辑'}采购计划`"
     custom-class="ele-dialog-form" :close-on-click-modal="false" :close-on-press-escape="false" width="80%"
     :maxable="true">
     <el-form :model="formData" ref="formRef" label-width="120px" class="ele-body" :rules="rules">
       <el-row :gutter="24">
         <el-col :span="8">
           <el-form-item label="需求类型" prop="demandType">
-            <el-select v-model="formData.demandType" placeholder="请选择" style="width: 100%" :disabled="type == 'detail'">
+            <el-select v-model="formData.demandType" :key="formData.demandType" placeholder="请选择" style="width: 100%"
+              :disabled="type == 'detail'">
               <el-option v-for="item in demandTypeList" :key="item.dictCode" :label="item.dictValue"
                 :value="item.dictCode">
               </el-option>
@@ -567,10 +568,12 @@ export default {
   methods: {
     async open(type, row) {
       this.type = type;
-      if (type == 'add') {
-        // this.formData.demandType = '';
-        this.formData.name = '';
-        this.formData.remark = '';
+      this.type = type;
+
+      this.formData.demandType = '1';
+
+      if (this.type == 'add') {
+        this.formData.demandType = '1';
       }
       this.formData.orderType = 2;
       this.visible = true;
@@ -855,9 +858,15 @@ export default {
     },
     cancel() {
       this.visible = false;
-      this.formData = {};
-      this.formData.detailRemoveIds = [];
-      this.formData.materialRemoveIds = [];
+
+      this.formData = {
+        demandType: '1',
+        name: '',
+        remark: '',
+        detailRemoveIds: [],
+        materialRemoveIds: [],
+        orderType: 2
+      };
       this.$refs.table.setData([]);
       this.$refs.formRef.resetFields();
     },