Sfoglia il codice sorgente

编码管理bug修复

LAPTOP-16IUEB3P\Lenovo 3 anni fa
parent
commit
f9eb72f6e3

+ 5 - 0
src/views/codeManagement/components/addDialog.vue

@@ -153,6 +153,10 @@ export default {
           })
           Promise.all([a1, a2]).then(() => {
               const codeConfigurationList  = this.$refs.myTable.getTableValue()
+              if(!codeConfigurationList.length){
+                 this.$message.error('至少有1项配置内容');
+                 return
+              }
               // codeConfigurationList.map(item=>{
               //    item.type = item.type.code
               // })
@@ -172,6 +176,7 @@ export default {
                   this.addRoleDialog = false
                   this.$message.success(res);
                   this.$emit('done');
+                  this.restForm();
               })
               .catch((e) => {
                   this.loading = false;

+ 29 - 12
src/views/codeManagement/components/myTable.vue

@@ -54,7 +54,7 @@
                :rules="{
                  required: true,
                  message: '',
-                 trigger: 'blur'
+                 trigger: 'change'
                }"
               v-if="scope.row.type!=2"
              >
@@ -95,6 +95,7 @@
               <el-input
                 v-model="scope.row.length"
                 placeholder="请输入"
+                oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
               ></el-input>
             </el-form-item>
           </template>
@@ -113,6 +114,8 @@
               <el-input
                 v-model="scope.row.currentId"
                 placeholder="请输入"
+                :maxlength="scope.row.length"
+                oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
               ></el-input>
             </el-form-item>
           </template>
@@ -131,6 +134,8 @@
               <el-input
                 v-model="scope.row.step"
                 placeholder="请输入"
+                :maxlength="scope.row.length"
+                oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
               ></el-input>
             </el-form-item>
           </template>
@@ -207,11 +212,14 @@
        }
     },
     methods: {
+      handleEdit(e) {
+          let value = e.replace(/^(0+)|[^\d]+/g,''); // 以0开头或者输入非数字,会被替换成空
+      },
       selectionChange (selection) {
-        if (selection.length > 1) {
-          this.$refs.multipleTable.clearSelection();
-          this.$refs.multipleTable.toggleRowSelection(selection.pop());
-        }
+        // if (selection.length > 1) {
+        //   this.$refs.multipleTable.clearSelection();
+        //   this.$refs.multipleTable.toggleRowSelection(selection.pop());
+        // }
       },
 
       settype (row, val) {
@@ -231,13 +239,22 @@
       _delete () {
         let selection = this.getSelection();
         if (selection.length > 0) {
-          let itemIndex = this.form.tableData.findIndex((n) => {
-            return n.sort == selection[0].sort;
-          });
-          if (itemIndex !== -1) {
-            this.form.tableData.splice(itemIndex, 1);
-            this.againSort();
-          }
+          // let itemIndex = this.form.tableData.findIndex((n) => {
+          //   return n.sort == selection[0].sort;
+          // });
+          // if (itemIndex !== -1) {
+          //   this.form.tableData.splice(itemIndex, 1);
+          //   this.againSort();
+          // }
+          selection.map(item=>{
+              let itemIndex = this.form.tableData.findIndex((n) => {
+                return n.sort == item.sort;
+              });
+              if (itemIndex !== -1) {
+                this.form.tableData.splice(itemIndex, 1);
+                this.againSort();
+              }
+          })
         }else{
            this.$message.info('请先勾选需删除的配置项')
         }