戴艳蓉 пре 3 година
родитељ
комит
2a09f52c7a

+ 91 - 10
src/views/goodStore/active/add.vue

@@ -3,7 +3,6 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '007')"
     >
-      活动新建
       <el-form
         :model="ruleForm"
         status-icon
@@ -24,9 +23,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="业务企业" prop="platform_code">
+            <el-form-item label="业务企业" prop="platform_code1">
               <search-work-company
-                :value="ruleForm.platform_code"
+                :value="ruleForm.platform_code1"
                 :disabled="false"
                 :size="'mini'"
                 :isDetail="false"
@@ -184,12 +183,70 @@ export default {
       loading: false,
       showModel: false,
       once: false,
-      ruleForm: {
-        activity_name: "",
-        platform_code: "",
-        a3: "",
-        activity_desc: "",
-        a5: "",
+      rulesThis: this.rules,
+      ruleForm: {},
+      rules: {
+        activity_name: [
+          {
+            required: true,
+            message: "活动标题不能为空",
+            trigger: "blur",
+          },
+        ],
+        platform_code1: [
+          {
+            type: "array",
+            required: true,
+            message: "业务公司不能为空",
+            trigger: "change",
+          },
+        ],
+        platform_code: [
+          {
+            type: "array",
+            required: true,
+            message: "所属平台不能为空",
+            trigger: "change",
+          },
+        ],
+        activity_start: [
+          {
+            required: true,
+            message: "开始时间不能为空",
+            trigger: "change",
+          },
+        ],
+        activity_end: [
+          {
+            required: true,
+            message: "结束时间不能为空",
+            trigger: "change",
+          },
+        ],
+
+        activity_desc: [
+          {
+            required: true,
+            message: "活动描述不能为空",
+            trigger: "blur",
+          },
+        ],
+        is_stock: [
+          {
+            required: true,
+            message: "请选择是否库存品",
+            trigger: "change",
+          },
+        ],
+
+        good_list: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择活动商品",
+            trigger: "change,blur",
+          },
+        ],
       },
     };
   },
@@ -199,9 +256,33 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
-
+      this.resetFormData();
+      this.rulesThis = this.rules;
+      await this.resetForm();
       this.loading = false;
     },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(async () => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.resetFormData();
+        }
+      });
+    },
+    resetFormData() {
+      this.ruleForm = {
+        activity_name: "",
+        platform_code1: [],
+        platform_code: [],
+        activity_start: "",
+        activity_end: "",
+        activity_desc: "",
+        is_stock: "",
+        good_list: [],
+      };
+    },
     handleClick(row) {
       console.log(row);
     },

+ 1 - 1
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -535,7 +535,7 @@ export default {
           },
         ],
       },
-      ruleForm: {},
+   
     };
   },
   mounted() {