From 48197e551b770df9348648ce2188402703774f53 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 12 三月 2024 10:41:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/system/check-template/index.vue |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/views/system/check-template/index.vue b/src/views/system/check-template/index.vue
index efca3d7..4ee886c 100644
--- a/src/views/system/check-template/index.vue
+++ b/src/views/system/check-template/index.vue
@@ -106,7 +106,7 @@
         <el-form-item label="妯℃澘鍚嶇О" prop="templateName">
           <el-input v-model="form.templateName" placeholder="璇疯緭鍏ユā鏉垮悕绉�" />
         </el-form-item>
-        <el-form-item label="鑰冩牳瑙勫垯">
+        <el-form-item label="鑰冩牳瑙勫垯" prop="tempRuleFormList">
           <div class="row-warp">
             <div class="row" v-for="(form) in tempRuleFormList">
               <div class="row-left">
@@ -211,6 +211,9 @@
       form: {},
       // 琛ㄥ崟鏍¢獙
       rules: {
+        templateName: [
+          { required: true, message: "妯℃澘鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
+        ],
         adjustCoefficient: [
           { required: true, message: "璋冩暣绯绘暟涓嶈兘涓虹┖", trigger: "blur" }
         ],
@@ -231,14 +234,14 @@
       this.tempRuleFormList = this.tempRuleFormList.filter(item => item !== form)
     },
     nextAdd() {
-      if (this.tempRuleFormList.length === 0) {
-        this.tempRuleFormList.push({"ruleId": null, "adjustCoefficient": null})
-      } else {
-        this.ruleFormList.push(this.tempRuleForm);
-        this.tempRuleFormList.push(this.tempRuleForm);
-        this.tempRuleForm = {};
-      }
-
+      // if (this.tempRuleFormList.length === 0) {
+      //   this.tempRuleFormList.push({"ruleId": null, "weight": null})
+      // } else {
+      //   this.ruleFormList.push(this.tempRuleForm);
+      //   this.tempRuleFormList.push(this.tempRuleForm);
+      //   this.tempRuleForm = {};
+      // }
+      this.tempRuleFormList.push({"ruleId": null, "weight": null})
     },
     // 鑰冩牳瑙勫垯涓嬫媺鏁版嵁
     selectCheckRule() {
@@ -307,6 +310,7 @@
       getCheckTemplate(id).then(response => {
         this.form = response.data;
         this.tempRuleFormList = this.form.ruleFormList;
+        this.ruleFormList = this.form.ruleFormList;
         this.open = true;
         this.title = "淇敼鑰冩牳妯℃澘";
       });
@@ -315,11 +319,13 @@
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          this.form.ruleFormList = this.ruleFormList;
+          this.form.ruleFormList = this.tempRuleFormList;
           if (this.form.id != null) {
             updateCheckTemplate(this.form).then(response => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
               this.open = false;
+              this.tempRuleFormList = [];
+              this.form = {};
               this.getList();
             });
           } else {

--
Gitblit v1.8.0