Bläddra i källkod

切换git账号提交

hezhanp 9 månader sedan
förälder
incheckning
9107821006
1 ändrade filer med 140 tillägg och 139 borttagningar
  1. 140 139
      src/views/codeManagement/businessCode/codeValueList.vue

+ 140 - 139
src/views/codeManagement/businessCode/codeValueList.vue

@@ -73,7 +73,6 @@
             title="确定要删除此码值吗?"
             @confirm="remove(scoped.$index)"
             v-if="$hasPermission('mian:businessCode:delete')"
-
           >
             <template v-slot:reference>
               <el-button type="danger"> 删除 </el-button>
@@ -90,7 +89,10 @@
         <template v-slot:remark="{ row }">
           <el-input v-model="row.remark" @change="valueChange(row)"></el-input>
         </template>
-        <template v-slot:toolbar v-if="form.roughRule != 4&&$hasPermission('mian:businessCode:save')">
+        <template
+          v-slot:toolbar
+          v-if="form.roughRule != 4 && $hasPermission('mian:businessCode:save')"
+        >
           <el-button type="primary" @click.native="openEdit('add')">
             增加
           </el-button>
@@ -102,148 +104,147 @@
 </template>
 
 <script>
-  import { roughRule, fineRule } from '@/enum/dict.js';
-  import { saveSegment } from '@/api/businessCode';
+import { roughRule, fineRule } from '@/enum/dict.js';
+import { saveSegment } from '@/api/businessCode';
 
-  export default {
-    props: {
-      // 上级
-      parentData: {
-        type: Object,
-        default: () => {}
-      }
-    },
+export default {
+  props: {
+    // 上级
+    parentData: {
+      type: Object,
+      default: () => {}
+    }
+  },
 
-    data() {
-      return {
-        form: {
-          roughRuleName: '',
-          fineRuleName: '',
-          name: '', //码段名称
-          businessCodeCategoryId: '', //分类id
-          length: '', //长度
-          delimiter: '', //间隔符
-          roughRule: '', //粗规则
-          fineRule: '', //细规则
-          value: [],
-          remark: '' //描述
-        },
-        tableList: [],
-        // 表格列配置
-        columns: []
-      };
-    },
-    created() {},
-    // watch: {
-    //   parentData(){
-    //     this.init()
-    //   }
-    // },
-    methods: {
-      reload() {
-        this.form = JSON.parse(JSON.stringify(this.parentData));
-        this.tableList = this.form.value;
-        this.form['roughRuleName'] = roughRule.find(
-          (item) => item.value == this.form.roughRule
-        )?.label;
-        let _fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-        this.form['fineRuleName'] = _fineRule.find(
-          (item) => item.value == this.form.fineRule
-        )?.label;
-        this.setColumns();
-      },
-      setColumns() {
-        this.columns = [
-          {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
-            align: 'center'
-          },
-          {
-            label:
-              '编码值' +
-              '(规则:' +
-              this.form.fineRuleName +
-              ',长度:' +
-              (this.form.length || '') +
-              ')',
-            prop: 'value',
-            width: 240,
-            slot: 'value',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'remark',
-            slot: 'remark',
-            label: '描述',
-            showOverflowTooltip: true
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 200,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            showOverflowTooltip: true,
-            fixed: 'right'
-          }
-        ];
+  data() {
+    return {
+      form: {
+        roughRuleName: '',
+        fineRuleName: '',
+        name: '', //码段名称
+        businessCodeCategoryId: '', //分类id
+        length: '', //长度
+        delimiter: '', //间隔符
+        roughRule: '', //粗规则
+        fineRule: '', //细规则
+        value: [],
+        remark: '' //描述
       },
-      valueChange(row) {
-        console.log(this.isReg(row), 'this.isReg(row)');
-        if (this.isReg(row)) {
-          this.save();
-        }
-      },
-      isReg(row) {
-        if (this.form.roughRule == 6) {
-          if (row.value.length == this.form.length) {
-            return true;
-          } else {
-            return false;
-          }
+      tableList: [],
+      // 表格列配置
+      columns: []
+    };
+  },
+  created() {},
+  // watch: {
+  //   parentData(){
+  //     this.init()
+  //   }
+  // },
+  //1111
+  methods: {
+    reload() {
+      this.form = JSON.parse(JSON.stringify(this.parentData));
+      this.tableList = this.form.value;
+      this.form['roughRuleName'] = roughRule.find(
+        (item) => item.value == this.form.roughRule
+      )?.label;
+      let _fineRule = fineRule.filter(
+        (item) => item.pid == this.form.roughRule
+      );
+      this.form['fineRuleName'] = _fineRule.find(
+        (item) => item.value == this.form.fineRule
+      )?.label;
+      this.setColumns();
+    },
+    setColumns() {
+      this.columns = [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center'
+        },
+        {
+          label:
+            '编码值' +
+            '(规则:' +
+            this.form.fineRuleName +
+            ',长度:' +
+            (this.form.length || '') +
+            ')',
+          prop: 'value',
+          width: 240,
+          slot: 'value',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'remark',
+          slot: 'remark',
+          label: '描述',
+          showOverflowTooltip: true
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 200,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true,
+          fixed: 'right'
         }
-        let _fineRule = fineRule.filter(
-          (item) => item.pid == this.form.roughRule
-        );
-        let reg = _fineRule.find(
-          (item) => item.value == this.form.fineRule
-        )?.reg;
-        let regexp = '/^' + reg + '{' + this.form.length + '}$/';
-        return RegExp(eval(regexp)).test(row.value);
-      },
-      /* 显示编辑 */
-      openEdit() {
-        this.tableList.push({
-          value: '',
-          remark: ''
-        });
-      },
-      /* 保存编辑 */
-      save() {
-        this.form.value = this.tableList;
-        saveSegment(this.form)
-          .then((msg) => {
-            this.$message.success('操作成功');
-            this.$emit('done', this.form);
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      },
-      /* 删除 */
-      remove(index) {
-        this.tableList.splice(index, 1);
+      ];
+    },
+    valueChange(row) {
+      console.log(this.isReg(row), 'this.isReg(row)');
+      if (this.isReg(row)) {
         this.save();
-      },
-      done() {
-        this.$emit('done', this.parentData);
       }
+    },
+    isReg(row) {
+      if (this.form.roughRule == 6) {
+        if (row.value.length == this.form.length) {
+          return true;
+        } else {
+          return false;
+        }
+      }
+      let _fineRule = fineRule.filter(
+        (item) => item.pid == this.form.roughRule
+      );
+      let reg = _fineRule.find((item) => item.value == this.form.fineRule)?.reg;
+      let regexp = '/^' + reg + '{' + this.form.length + '}$/';
+      return RegExp(eval(regexp)).test(row.value);
+    },
+    /* 显示编辑 */
+    openEdit() {
+      this.tableList.push({
+        value: '',
+        remark: ''
+      });
+    },
+    /* 保存编辑 */
+    save() {
+      this.form.value = this.tableList;
+      saveSegment(this.form)
+        .then((msg) => {
+          this.$message.success('操作成功');
+          this.$emit('done', this.form);
+        })
+        .catch((e) => {
+          this.loading = false;
+        });
+    },
+    /* 删除 */
+    remove(index) {
+      this.tableList.splice(index, 1);
+      this.save();
+    },
+    done() {
+      this.$emit('done', this.parentData);
     }
-  };
+  }
+};
 </script>