فهرست منبع

物品显示code

yusheng 9 ماه پیش
والد
کامیت
1f2d8c1191
2فایلهای تغییر یافته به همراه46 افزوده شده و 10 حذف شده
  1. 23 3
      src/views/material/product/index.vue
  2. 23 7
      src/views/material/product/oneProduct.vue

+ 23 - 3
src/views/material/product/index.vue

@@ -15,7 +15,11 @@
             :highlight-current="true"
             node-key="id"
             @node-click="handleNodeClick"
-          ></el-tree>
+          >
+            <span class="custom-tree-node" slot-scope="{ node, data }">
+              {{( isCode == 1 ? data.code : '' )+ ' ' + data.name }}
+            </span>
+          </el-tree>
         </div>
 
         <template v-slot:content>
@@ -64,7 +68,7 @@
                   <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
                     <el-form-item label="节点编码:">
                       <div class="ele-text-secondary">
-                        {{ current.code }}
+                        {{ currentData.categoryLevelPathCode }}
                       </div>
                     </el-form-item>
                   </el-col>
@@ -129,6 +133,7 @@
 
   import dictMixins from '@/mixins/dictMixins';
   import { getTreeByGroup } from '@/api/classifyManage';
+  import { parameterGetByCode } from '@/api/system/dictionary/index.js';
 
   import { getInfoById } from '@/api/classifyManage';
 
@@ -143,6 +148,7 @@
     data() {
       return {
         loading: false,
+        isCode: 0,
         current: {},
         curNode: {},
         treeList: [],
@@ -192,6 +198,14 @@
     },
     created() {
       this.getTreeData();
+      //是否显示code
+      parameterGetByCode({
+        code: 'mian_product_code'
+      }).then((res) => {
+        if (res.value) {
+          this.isCode = res.value;
+        }
+      });
     },
     methods: {
       async getTreeData() {
@@ -292,22 +306,28 @@
         }
 
         this.pathList.unshift(data);
+
         const PathInfo = {
           categoryLevelPath: '',
           categoryLevelPathId: [],
-          // rootCategoryLevelId: null,
+          categoryLevelPathCode: '',
           categoryLevelId: '',
           categoryLevelName: '',
           ruleCode: ''
         };
         const pathName = [];
+        const pathCode = [];
+        console.log(this.pathList, 'this.pathList');
         this.pathList.map((item) => {
           pathName.unshift(item.name);
+          pathCode.unshift(item.code);
+
           PathInfo.categoryLevelPathId.unshift(item.id);
           // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
         });
         PathInfo.categoryLevelPath = pathName.join('-');
         PathInfo.categoryLevelPathId = PathInfo.categoryLevelPathId.join(',');
+        PathInfo.categoryLevelPathCode = pathCode.join('-');
         PathInfo.categoryLevelId = data.id;
         PathInfo.categoryLevelName = data.name;
         PathInfo.ruleCode = ruleCode;

+ 23 - 7
src/views/material/product/oneProduct.vue

@@ -15,7 +15,11 @@
             :highlight-current="true"
             node-key="id"
             @node-click="handleNodeClick"
-          ></el-tree>
+          >
+            <span class="custom-tree-node" slot-scope="{ node, data }">
+              {{( isCode == 1 ? data.code : '' )+ ' ' + data.name }}
+            </span>
+          </el-tree>
         </div>
 
         <template v-slot:content>
@@ -63,7 +67,7 @@
                   <el-col v-bind="styleResponsive ? { sm: 6 } : { span: 6 }">
                     <el-form-item label="节点编码:">
                       <div class="ele-text-secondary">
-                        {{ current.code }}
+                        {{ currentData.categoryLevelPathCode }}
                       </div>
                     </el-form-item>
                   </el-col>
@@ -118,8 +122,8 @@
             >
             </IndexData>
           </div>
-        </template> </ele-split-layout
-      >
+        </template>
+      </ele-split-layout>
     </el-card>
   </div>
 </template>
@@ -133,6 +137,7 @@
   import { getInfoById } from '@/api/classifyManage';
 
   import { deepClone } from '@/utils';
+  import { parameterGetByCode } from '@/api/system/dictionary/index.js';
 
   export default {
     name: 'oneProductIndex',
@@ -146,13 +151,14 @@
       return {
         loading: false,
         current: {},
+        isCode:0,
         curNode: {},
         currentData: {},
         treeList: [],
         treeLoading: false,
         formData: {},
         rootTreeId: null,
-        where:{},
+        where: {},
         defaultProps: {
           children: 'children',
           label: 'name'
@@ -190,6 +196,14 @@
     },
     created() {
       this.getTreeData();
+            //是否显示code
+      parameterGetByCode({
+        code: 'mian_product_code'
+      }).then((res) => {
+        if (res.value) {
+          this.isCode = res.value;
+        }
+      });
     },
     methods: {
       async getTreeData() {
@@ -297,14 +311,16 @@
         const PathInfo = {
           categoryLevelPath: '',
           categoryLevelPathId: [],
-          // rootCategoryLevelId: null,
+          categoryLevelPathCode: '',
           categoryLevelId: '',
           categoryLevelName: '',
           ruleCode: ''
         };
         const pathName = [];
+        const pathCode = [];
         this.pathList.map((item) => {
           pathName.unshift(item.name);
+          pathCode.unshift(item.code);
           PathInfo.categoryLevelPathId.unshift(item.id);
           // PathInfo.rootCategoryLevelId = item.rootCategoryLevelId;
         });
@@ -313,7 +329,7 @@
         PathInfo.categoryLevelId = data.id;
         PathInfo.categoryLevelName = data.name;
         PathInfo.ruleCode = ruleCode;
-
+        PathInfo.categoryLevelPathCode = pathCode.join('-');
         this.currentData = deepClone(PathInfo);
         console.log(this.currentData, '选中的产品分类');
       },