Forráskód Böngészése

fix: 修复新建分组,重复新建数据没有清空的问题

wu.jian2 1 éve
szülő
commit
5e97647db1

+ 5 - 14
data-room-ui/packages/BigScreenList/CatalogEditForm.vue

@@ -79,7 +79,7 @@
     </el-dialog>
     <!-- 新增或编辑目录弹窗 -->
     <el-dialog
-      :title="groupForm.code ? '编辑分组':'新建分组'"
+      :title="currentCatalog.code ? '编辑分组':'新建分组'"
       :visible.sync="catalogVisible"
       custom-class="bs-el-dialog"
       width="30%"
@@ -88,7 +88,7 @@
     >
       <el-form
         ref="form"
-        :model="groupForm"
+        :model="currentCatalog"
         label-width="80px"
         :rules="formRules"
         class="bs-el-form"
@@ -98,7 +98,7 @@
           prop="name"
         >
           <el-input
-            v-model.trim="groupForm.name"
+            v-model.trim="currentCatalog.name"
             class="bs-el-input"
             clearable
           />
@@ -107,7 +107,7 @@
           label="排序"
         >
           <el-input-number
-            v-model="groupForm.orderNum"
+            v-model="currentCatalog.orderNum"
             :min="0"
             :max="30000"
             controls-position="right"
@@ -157,11 +157,6 @@ export default {
       searchKey: '', // 分组查询
       catalogVisible: false,
       currentCatalog: {},
-      groupForm: {
-        code: '',
-        name: '',
-        orderNum: ''
-      },
       formVisible: false,
       formRules: {
         name: [
@@ -203,10 +198,6 @@ export default {
         if (!valid) {
           return
         }
-        this.currentCatalog = {
-          ...this.currentCatalog,
-          ...this.groupForm
-        }
         if (!this.currentCatalog.id) {
           this.$dataRoomAxios.post('/bigScreen/type/add',
             {
@@ -235,7 +226,7 @@ export default {
       this.catalogVisible = true
     },
     editCatalog (row) {
-      this.groupForm = cloneDeep(row)
+      this.currentCatalog = cloneDeep(row)
       this.catalogVisible = true
     },
     // 删除目录

+ 5 - 14
data-room-ui/packages/BigScreenMag/SideMenu.vue

@@ -57,7 +57,7 @@
     </div>
     <!-- 新增或编辑目录弹窗 -->
     <el-dialog
-      :title="groupForm.code ? '编辑分组':'新建分组'"
+      :title="currentCatalog.code ? '编辑分组':'新建分组'"
       :visible.sync="catalogVisible"
       custom-class="bs-el-dialog"
       width="30%"
@@ -66,7 +66,7 @@
     >
       <el-form
         ref="form"
-        :model="groupForm"
+        :model="currentCatalog"
         label-width="80px"
         :rules="formRules"
         class="bs-el-form"
@@ -76,7 +76,7 @@
           prop="name"
         >
           <el-input
-            v-model.trim="groupForm.name"
+            v-model.trim="currentCatalog.name"
             class="bs-el-input"
             clearable
           />
@@ -85,7 +85,7 @@
           label="排序"
         >
           <el-input-number
-            v-model="groupForm.orderNum"
+            v-model="currentCatalog.orderNum"
             :min="0"
             :max="30000"
             controls-position="right"
@@ -141,11 +141,6 @@ export default {
         code: '',
         orderNum: 0
       },
-      groupForm: {
-        code: '',
-        name: '',
-        orderNum: 0
-      },
       formRules: {
         name: [
           { required: true, message: '分组名称不能为空', trigger: 'blur' }
@@ -187,10 +182,6 @@ export default {
         if (!valid) {
           return
         }
-        this.currentCatalog = {
-          ...this.currentCatalog,
-          ...this.groupForm
-        }
         if (!this.currentCatalog.id) {
           this.$dataRoomAxios.post('/bigScreen/type/add',
             {
@@ -225,7 +216,7 @@ export default {
     },
     // 编辑目录
     catalogEdit () {
-      this.groupForm = cloneDeep(this.currentCatalog)
+      this.currentCatalog = cloneDeep(this.currentCatalog)
       this.catalogVisible = true
     },
     // 删除目录

+ 5 - 14
data-room-ui/packages/ComponentList/CatalogEditForm.vue

@@ -83,7 +83,7 @@
     </el-dialog>
     <!-- 新增或编辑目录弹窗 -->
     <el-dialog
-      :title="groupForm.code ? '编辑分组':'新建分组'"
+      :title="currentCatalog.code ? '编辑分组':'新建分组'"
       :visible.sync="catalogVisible"
       custom-class="bs-el-dialog"
       width="30%"
@@ -92,7 +92,7 @@
     >
       <el-form
         ref="form"
-        :model="groupForm"
+        :model="currentCatalog"
         label-width="80px"
         :rules="formRules"
         class="bs-el-form"
@@ -102,7 +102,7 @@
           prop="name"
         >
           <el-input
-            v-model.trim="groupForm.name"
+            v-model.trim="currentCatalog.name"
             class="bs-el-input"
             clearable
           />
@@ -111,7 +111,7 @@
           label="排序"
         >
           <el-input-number
-            v-model="groupForm.orderNum"
+            v-model="currentCatalog.orderNum"
             :min="0"
             :max="30000"
             controls-position="right"
@@ -165,11 +165,6 @@ export default {
         name: [
           { required: true, message: '分组名称不能为空', trigger: 'blur' }
         ]
-      },
-      groupForm: {
-        code: '',
-        name: '',
-        orderNum: 0
       }
     }
   },
@@ -204,10 +199,6 @@ export default {
         if (!valid) {
           return
         }
-        this.currentCatalog = {
-          ...this.currentCatalog,
-          ...this.groupForm
-        }
         if (!this.currentCatalog.id) {
           this.$dataRoomAxios.post('/bigScreen/type/add',
             {
@@ -236,7 +227,7 @@ export default {
       this.catalogVisible = true
     },
     editCatalog (row) {
-      this.groupForm = cloneDeep(row)
+      this.currentCatalog = cloneDeep(row)
       this.catalogVisible = true
     },
     // 删除目录

+ 8 - 15
data-room-ui/packages/SourceMag/SideMenu.vue

@@ -66,7 +66,7 @@
     </div>
     <!-- 新增或编辑目录弹窗 -->
     <el-dialog
-      :title="groupForm.code ? '编辑分组' : '新建分组'"
+      :title="currentCatalog.code ? '编辑分组' : '新建分组'"
       :visible.sync="catalogVisible"
       custom-class="bs-el-dialog"
       width="30%"
@@ -75,7 +75,7 @@
     >
       <el-form
         ref="form"
-        :model="groupForm"
+        :model="currentCatalog"
         label-width="80px"
         :rules="formRules"
         class="bs-el-form"
@@ -85,14 +85,14 @@
           prop="name"
         >
           <el-input
-            v-model.trim="groupForm.name"
+            v-model.trim="currentCatalog.name"
             class="bs-el-input"
             clearable
           />
         </el-form-item>
         <el-form-item label="排序">
           <el-input-number
-            v-model="groupForm.orderNum"
+            v-model="currentCatalog.orderNum"
             :min="0"
             :max="30000"
             controls-position="right"
@@ -113,7 +113,9 @@
         <el-button
           type="primary"
           @click="addOrEditCatalog"
-        >确定</el-button>
+        >
+          确定
+        </el-button>
       </span>
     </el-dialog>
   </div>
@@ -162,11 +164,6 @@ export default {
         id: '',
         code: ''
       },
-      groupForm: {
-        code: '',
-        name: '',
-        orderNum: ''
-      },
       formRules: {
         name: [{ required: true, message: '分组名称不能为空', trigger: 'blur' }]
       }
@@ -211,10 +208,6 @@ export default {
         if (!valid) {
           return
         }
-        this.currentCatalog = {
-          ...this.currentCatalog,
-          ...this.groupForm
-        }
         if (!this.currentCatalog.id) {
           this.$dataRoomAxios.post('/bigScreen/type/add', {
             ...this.currentCatalog,
@@ -250,7 +243,7 @@ export default {
     },
     // 编辑目录
     catalogEdit () {
-      this.groupForm = cloneDeep(this.currentCatalog)
+      this.currentCatalog = cloneDeep(this.currentCatalog)
       this.catalogVisible = true
     },
     // 删除目录