yusheng il y a 1 an
Parent
commit
83935520c2

+ 5 - 0
src/views/codeManagement/businessCode/components/codeEdit.vue

@@ -136,8 +136,13 @@ export default {
 
     cancel() {
       this.form = { ...defaultForm };
+      this.form.useObjList=[]
       this.$refs.form.clearValidate();
+      this.$nextTick(() => {
+        this.$refs.treeRef.cancel();
+      });
       this.showEditFlag = false;
+    
     }
   }
 };

+ 147 - 141
src/views/codeManagement/businessCode/components/codeSegmentEdit.vue

@@ -17,7 +17,15 @@
             <el-input v-model="form.name" placeholder="请输入"></el-input>
           </el-form-item>
         </el-col>
-
+        <el-col :span="24">
+          <el-form-item label="排序" prop="sort">
+            <el-input
+              clearable
+              v-model.number="form.sort"
+              placeholder="请输入排序"
+            ></el-input>
+          </el-form-item>
+        </el-col>
         <el-col :span="24">
           <el-form-item label="描述" prop="remark">
             <el-input
@@ -38,10 +46,8 @@
             prop="length"
           >
             <el-input
-              v-model="form.length"
-              type="number"
-              min="0"
-              max="12"
+              v-model.number="form.length"
+      
               :disabled="form.roughRule == 4"
             ></el-input>
           </el-form-item>
@@ -99,158 +105,158 @@
     </template>
   </ele-modal>
 </template>
-  
-  <script>
-import { saveSegment } from '@/api/businessCode';
-import { roughRule, fineRule } from '@/enum/dict.js';
 
-export default {
-  components: {},
-  props: {
-    // 上级id
-    businessCodeCategoryId: [Number, String]
-  },
-  data() {
-    const defaultForm = {
-      name: '', //码段名称
-      businessCodeCategoryId: '', //分类id
-      length: '', //长度
-      delimiter: '', //间隔符
-      roughRule: '', //粗规则
-      fineRule: '', //细规则
-      value: [],
-      remark: '' //描述
-    };
-    return {
-      roughRule,
-      fineRule: [],
-      defaultForm,
-      // 表单数据
-      form: { ...defaultForm },
-      // 表单验证规则
-      rules: {},
-      // 提交状态
-      loading: false,
-      showEditFlag: false,
-      title: '',
-      type: '',
-      rules: {
-        name: [
-          {
-            required: true,
-            message: '请输入',
-            trigger: 'blur'
-          }
-        ],
-        // delimiter: [
-        //   {
-        //     required: true,
-        //     message: '请选择',
-        //     trigger: 'blur'
-        //   }
-        // ],
-        roughRule: [
-          {
-            required: true,
-            message: '请选择',
-            trigger: 'blur'
-          }
-        ],
-        fineRule: [
-          {
-            required: true,
-            message: '请选择',
-            trigger: 'blur'
-          }
-        ]
-      }
-    };
-  },
-  computed: {
-    // 是否开启响应式布局
-    styleResponsive() {
-      return this.$store.state.theme.styleResponsive;
-    }
-  },
-  created() {},
-  methods: {
-    async open(type, row) {
-      this.title = type === 'edit' ? '编辑' : '新增';
-      this.showEditFlag = true;
-      this.type = type;
-      if (type == 'add') {
-        this.form.businessCodeCategoryId = this.businessCodeCategoryId;
-      } else {
-        this.form = JSON.parse(JSON.stringify(row));
-        this.fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-      }
+<script>
+  import { saveSegment } from '@/api/businessCode';
+  import { roughRule, fineRule } from '@/enum/dict.js';
+
+  export default {
+    components: {},
+    props: {
+      // 上级id
+      businessCodeCategoryId: [Number, String]
     },
-    roughRuleChange(val) {
-      if (val == 4) {
-        this.form.length = '';
+    data() {
+      const defaultForm = {
+        name: '', //码段名称
+        businessCodeCategoryId: '', //分类id
+        length: '', //长度
+        delimiter: '', //间隔符
+        roughRule: '', //粗规则
+        fineRule: '', //细规则
+        value: [],
+        sort:'',
+        remark: '' //描述
+      };
+      return {
+        roughRule,
+        fineRule: [],
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        // 表单验证规则
+        rules: {},
+        // 提交状态
+        loading: false,
+        showEditFlag: false,
+        title: '',
+        type: '',
+        rules: {
+          name: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ],
+          sort: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ],
+          roughRule: [
+            {
+              required: true,
+              message: '请选择',
+              trigger: 'blur'
+            }
+          ],
+          fineRule: [
+            {
+              required: true,
+              message: '请选择',
+              trigger: 'blur'
+            }
+          ]
+        }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
       }
-      this.fineRule = fineRule.filter((item) => item.pid == val);
-      this.form.fineRule = '';
     },
-    /* 保存编辑 */
-    save() {
-      this.$refs.form.validate(async (valid) => {
-        if (!valid) {
-          return false;
+    created() {},
+    methods: {
+      async open(type, row) {
+        this.title = type === 'edit' ? '编辑' : '新增';
+        this.showEditFlag = true;
+        this.type = type;
+        if (type == 'add') {
+          this.form.businessCodeCategoryId = this.businessCodeCategoryId;
+        } else {
+          this.form = JSON.parse(JSON.stringify(row));
+          this.fineRule = fineRule.filter(
+            (item) => item.pid == this.form.roughRule
+          );
         }
-
-        const data = {
-          ...this.form
-        };
-        if (this.type != 'edit') {
-          delete data.id;
+      },
+      roughRuleChange(val) {
+        if (val == 4) {
+          this.form.length = '';
         }
-        this.loading = true;
-        saveSegment(data)
-          .then((msg) => {
-            this.loading = false;
-            this.cancel();
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
-    },
+        this.fineRule = fineRule.filter((item) => item.pid == val);
+        this.form.fineRule = '';
+      },
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) {
+            return false;
+          }
 
-    cancel() {
-      this.form = { ...this.defaultForm };
-      this.$refs.form.clearValidate();
-      this.showEditFlag = false;
+          const data = {
+            ...this.form
+          };
+          if (this.type != 'edit') {
+            delete data.id;
+          }
+          this.loading = true;
+          saveSegment(data)
+            .then((msg) => {
+              this.loading = false;
+              this.cancel();
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+
+      cancel() {
+        this.form = { ...this.defaultForm };
+        this.$refs.form.clearValidate();
+        this.showEditFlag = false;
+      }
     }
-  }
-};
+  };
 </script>
-  <style scoped lang="scss">
-.aaa {
-  width: 100%;
-
-  ::v-deep .upload-demo {
+<style scoped lang="scss">
+  .aaa {
     width: 100%;
 
-    .el-upload--text {
+    ::v-deep .upload-demo {
       width: 100%;
 
-      button {
+      .el-upload--text {
         width: 100%;
-        background: #ffffff;
-        border: 1px solid #dbdbdb;
-        border-radius: 5px;
+
+        button {
+          width: 100%;
+          background: #ffffff;
+          border: 1px solid #dbdbdb;
+          border-radius: 5px;
+        }
       }
-    }
 
-    .el-upload-list {
-      transform: translate(10px, -39px);
-      position: absolute;
+      .el-upload-list {
+        transform: translate(10px, -39px);
+        position: absolute;
+      }
     }
   }
-}
 </style>
-  

+ 3 - 7
src/views/codeManagement/businessCode/components/tree.vue

@@ -129,13 +129,6 @@ export default {
       });
     },
     filterLeftData(list, rightIds, newList) {
-      // console.log(rightIds)
-      // list.forEach(leftItem=>{
-      //   if(rightIds.includes(leftItem.id)){
-      //     leftItem
-      //     newList.push(leftItem)
-      //   }
-      // })
       for (let leftItem of list) {
         if (rightIds.includes(leftItem.id)) {
           if (leftItem.children && leftItem.children.length) {
@@ -161,6 +154,9 @@ export default {
       }
       return newList;
     },
+    cancel(){
+        this.selection=[]
+    },
     getList() {
       return this.selection;
     }