gaoshp
2024-11-19 f29900986f01cf5d39b5755cec674825cef27961
src/views/console/system/allocationDialog.vue
@@ -9,7 +9,7 @@
<template>
   <el-dialog title="字典名称字典配置" v-model="visible" :width="1000" destroy-on-close @closed="$emit('closed')">
      <div class="dict-main">
         <el-form :inline="true" :model="searchData" abel-width="120px">
         <el-form :inline="true" :model="searchData" label-width="80px">
            <el-form-item label="字典编号">
               <el-input v-model="searchData.code" placeholder="字典编号" clearable />
            </el-form-item>
@@ -70,6 +70,7 @@
      emits: ['success', 'closed'],
      data(){
         return {
            oldRow: {},
            selection: [],
            mode: "edit",
            visible: false,
@@ -127,7 +128,19 @@
         },
         //字典配置
         table_allocation(row) {
            this.addAllocation();
            this.addAllocation(row,"subitem");
         },
         showDict() {
            this.$HTTP.get("/api/blade-system/dict/tree?code=DICT").then(res=> {
               if(res.code == 200) {
                  res.data.forEach(item=> {
                     if(item.id == this.addAllocationForm.parentId) {
                        this.addAllocationForm.$parentId = item.title;
                     }
                  })
                  this.parentData = res.data;
               }
            })
         },
         //删除
         table_del(row) {
@@ -146,14 +159,19 @@
            })
         },
         //添加
         addAllocation(){
            this.dialog.allocation = true
         addAllocation(row,type){
            this.dialog.allocation = true;
            this.$nextTick(() => {
               this.$refs.SubitemAddDict.open('edit').setData(this.allocationTableData[0])
               if(type == "subitem") {  //添加子项
                  this.$refs.SubitemAddDict.open('edit').setData(row)
               }else {
                  this.$refs.SubitemAddDict.open('edit').setData(this.oldRow)
               }
            })
         },
         table_edit(row){
            this.dialog.allocation = true
            row.mode = "edit";
            this.$nextTick(() => {
               this.$refs.SubitemAddDict.open('edit').setData(row)
            })
@@ -161,6 +179,7 @@
         //查看
         table_show(row){
            this.dialog.allocation = true
            row.mode = "show";
            this.$nextTick(() => {
               this.$refs.SubitemAddDict.open('show').setData(row)
            })
@@ -209,6 +228,7 @@
         setData(row){
            //可以和上面一样单个注入,也可以像下面一样直接合并进去
            this.searchData.parentId = row.id;
            this.oldRow = row;
            this.searchBtn();
         },
         //显示