Explorar el Código

分类管理详情页优化:添加分类编码显示及状态展示格式统一

yusheng hace 9 meses
padre
commit
616a079296
Se han modificado 1 ficheros con 33 adiciones y 19 borrados
  1. 33 19
      src/views/classifyManage/treeClassify/details.vue

+ 33 - 19
src/views/classifyManage/treeClassify/details.vue

@@ -39,7 +39,6 @@
                 :disabled="!current.id || current.id == rootId"
                 :disabled="!current.id || current.id == rootId"
                 @click="deleteCategory"
                 @click="deleteCategory"
                 v-if="$hasPermission('main:categorylevel:delete')"
                 v-if="$hasPermission('main:categorylevel:delete')"
-
               >
               >
                 删除
                 删除
               </el-button>
               </el-button>
@@ -54,7 +53,11 @@
               :highlight-current="true"
               :highlight-current="true"
               node-key="id"
               node-key="id"
               @node-click="handleNodeClick"
               @node-click="handleNodeClick"
-            ></el-tree>
+            >
+              <span class="custom-tree-node" slot-scope="{ node, data }">
+                {{ (isCode == 1 ? data.code : '') + ' ' + data.name }}
+              </span>
+            </el-tree>
           </div>
           </div>
         </div>
         </div>
         <template v-slot:content>
         <template v-slot:content>
@@ -104,7 +107,7 @@
                   <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
                   <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
                     <el-form-item label="状态:">
                     <el-form-item label="状态:">
                       <div class="ele-text-secondary">
                       <div class="ele-text-secondary">
-                        {{ current.isEnabled===0?'停用':'启用' }}
+                        {{ current.isEnabled === 0 ? '停用' : '启用' }}
                       </div>
                       </div>
                     </el-form-item>
                     </el-form-item>
                   </el-col>
                   </el-col>
@@ -148,7 +151,7 @@
                   <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
                   <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
                     <el-form-item label="状态:">
                     <el-form-item label="状态:">
                       <div class="ele-text-secondary">
                       <div class="ele-text-secondary">
-                        {{ current.isEnabled===0?'停用':'启用' }}
+                        {{ current.isEnabled === 0 ? '停用' : '启用' }}
                       </div>
                       </div>
                     </el-form-item>
                     </el-form-item>
                   </el-col>
                   </el-col>
@@ -178,19 +181,22 @@
     getInfoById,
     getInfoById,
     deleteCategory
     deleteCategory
   } from '@/api/classifyManage';
   } from '@/api/classifyManage';
+  import { parameterGetByCode } from '@/api/system/dictionary/index.js';
+
   export default {
   export default {
     components: {
     components: {
       classifyManageEdit,
       classifyManageEdit,
       ListEdit
       ListEdit
     },
     },
     mixins: [dictMixins],
     mixins: [dictMixins],
-    data () {
+    data() {
       return {
       return {
         loading: false,
         loading: false,
         current: {},
         current: {},
         curNode: {},
         curNode: {},
         treeData: [],
         treeData: [],
         formData: {},
         formData: {},
+        isCode: 0,
         defaultProps: {
         defaultProps: {
           children: 'children',
           children: 'children',
           label: 'name'
           label: 'name'
@@ -200,13 +206,13 @@
 
 
     computed: {
     computed: {
       // 是否开启响应式布局
       // 是否开启响应式布局
-      styleResponsive () {
+      styleResponsive() {
         return this.$store.state.theme.styleResponsive;
         return this.$store.state.theme.styleResponsive;
       },
       },
-      rootId () {
+      rootId() {
         return this.$route.query.id;
         return this.$route.query.id;
       },
       },
-      fullName () {
+      fullName() {
         let str = '';
         let str = '';
         let codeStr = '';
         let codeStr = '';
         let node = this.curNode;
         let node = this.curNode;
@@ -222,7 +228,7 @@
         );
         );
       }
       }
     },
     },
-    created () {
+    created() {
       this.requestDict('类型用途');
       this.requestDict('类型用途');
       this.requestDict('分隔符');
       this.requestDict('分隔符');
       this.getTree().then(() => {
       this.getTree().then(() => {
@@ -230,9 +236,17 @@
           this.getDetail(this.treeData[0]?.id);
           this.getDetail(this.treeData[0]?.id);
         });
         });
       });
       });
+      //是否显示code
+      parameterGetByCode({
+        code: 'mian_treeClassify_code'
+      }).then((res) => {
+        if (res.value) {
+          this.isCode = res.value;
+        }
+      });
     },
     },
     methods: {
     methods: {
-      async reload (isEdit) {
+      async reload(isEdit) {
         if (isEdit) {
         if (isEdit) {
           this.getTree().then(() => {
           this.getTree().then(() => {
             this.getDetail(this.current.id);
             this.getDetail(this.current.id);
@@ -241,13 +255,13 @@
           this.getTree();
           this.getTree();
         }
         }
       },
       },
-      back(){
-        this.$router.push('/treeClassify')
+      back() {
+        this.$router.push('/treeClassify');
       },
       },
-      handlOpen () {
+      handlOpen() {
         this.$refs.addDialog.open();
         this.$refs.addDialog.open();
       },
       },
-      deleteCategory () {
+      deleteCategory() {
         this.$confirm('确定要删除选中节点吗?', '提示', {
         this.$confirm('确定要删除选中节点吗?', '提示', {
           type: 'warning'
           type: 'warning'
         }).then(async () => {
         }).then(async () => {
@@ -262,7 +276,7 @@
           }
           }
         });
         });
       },
       },
-      async getTree () {
+      async getTree() {
         const res = await getTreeByPid(this.rootId);
         const res = await getTreeByPid(this.rootId);
 
 
         if (res.code == '0') {
         if (res.code == '0') {
@@ -272,7 +286,7 @@
 
 
         return Promise.reject();
         return Promise.reject();
       },
       },
-      async getDetail (id) {
+      async getDetail(id) {
         this.loading = true;
         this.loading = true;
         const res = await getInfoById(id);
         const res = await getInfoById(id);
         this.loading = false;
         this.loading = false;
@@ -283,10 +297,10 @@
           });
           });
         }
         }
       },
       },
-      openEdit (isAdd = true) {
+      openEdit(isAdd = true) {
         this.$refs.editRef.open(isAdd ? null : this.current, this.current);
         this.$refs.editRef.open(isAdd ? null : this.current, this.current);
       },
       },
-      handleNodeClick (data, node) {
+      handleNodeClick(data, node) {
         this.curNode = node;
         this.curNode = node;
         this.getDetail(data.id);
         this.getDetail(data.id);
       }
       }
@@ -318,7 +332,7 @@
   .form-wrapper {
   .form-wrapper {
     padding: 24px;
     padding: 24px;
   }
   }
-  .ele-toolbar-actions :deep(.ele-table-tool-title-content){
+  .ele-toolbar-actions :deep(.ele-table-tool-title-content) {
     display: flex;
     display: flex;
     justify-content: space-between;
     justify-content: space-between;
   }
   }