huang_an 2 years ago
parent
commit
1f4e797885

+ 30 - 37
src/views/warehouseManagement/stockLedger/index.vue

@@ -31,15 +31,14 @@
             /> -->
 
             <el-tree
-            :data="treeList"
-            :props="defaultProps"
-            ref="treeRef"
-            :default-expanded-keys="current && current.id ? [current.id] : []"
-            :highlight-current="true"
-            node-key="id"
-            @node-click="handleNodeClick"
-          ></el-tree>
-
+              :data="treeList"
+              :props="defaultProps"
+              ref="treeRef"
+              :default-expanded-keys="current && current.id ? [current.id] : []"
+              :highlight-current="true"
+              node-key="id"
+              @node-click="handleNodeClick"
+            ></el-tree>
           </div>
         </div>
         <template v-slot:content>
@@ -63,45 +62,39 @@
         treeData: [],
         current: {},
 
-
         defaultProps: {
-        children: 'children',
-        label: 'name'
-      },
+          children: 'children',
+          label: 'name'
+        },
         treeList: [],
-        treeLoading: false,
-      
+        treeLoading: false
       };
     },
     created() {
-
       this.getTreeData();
     },
     methods: {
-
       async getTreeData() {
-      try {
-        this.treeLoading = true;
-
-        const res = await getTreeByGroup({ type: 2 });
+        try {
+          this.treeLoading = true;
+          const res = await getTreeByGroup({ type: 2 });
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.$refs.treeRef.setCurrentKey(this.treeList[0].id);
+                this.current = this.treeList[0];
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {}
         this.treeLoading = false;
-        if (res?.code === '0') {
-          this.treeList = res.data;
-
-          this.$nextTick(() => {
-            // 默认高亮第一级树节点
-            if (this.treeList[0]) {
-              // this.getDetail(this.treeList[0].id);
-            }
-          });
-          return this.treeList;
-        }
-      } catch (error) {}
-      this.treeLoading = false;
-    },
-
+      },
 
-      onNodeClick(data, node) {
+      handleNodeClick(data, node) {
         this.current = node;
       },
       openEdit() {

+ 12 - 5
src/views/warehouseManagement/stockManagement/details.vue

@@ -25,9 +25,7 @@
               </el-col>
               <el-col :span="8">
                 <el-form-item label="入库物品类型:">
-                  <span>{{
-                    getDictValue('类型用途', infoData.assetType)
-                  }}</span>
+                  <span>{{ handleAssetType(infoData.assetType) }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
@@ -244,7 +242,7 @@
         <div class="mt20">
           <!-- =={{ getDictValue('类型用途', infoData.assetType) }} -->
           <header-title
-            :title="`${getDictValue('类型用途', infoData.assetType)}明细`"
+            :title="`${handleAssetType(infoData.assetType)}明细`"
             size="16px"
           ></header-title>
 
@@ -310,6 +308,7 @@
   import StatusStep from '@/components/StatusStep/common.vue';
   // import { fileSystemDownload } from '@/utils';
   import outin from '@/api/warehouseManagement/outin';
+  import { getTreeByPid } from '@/api/classifyManage';
 
   import {
     materialType,
@@ -328,6 +327,7 @@
     components: { StatusStep, PageHeader },
     data() {
       return {
+        codeList: [],
         auditStatus,
         infoData: {},
         warehousingMaterialList: {},
@@ -409,7 +409,10 @@
       getMaterialType: useDictLabel(materialType),
       getInputStatus: useDictLabel(inputStatus),
       getSceneState: useDictLabel(sceneState),
-
+      handleAssetType(r) {
+        const code = this.codeList.find((item) => item.dictCode == r);
+        return code.dictValue;
+      },
       rowClass({ row, column, rowIndex, columnIndex }) {
         if (rowIndex === 1) {
           return {
@@ -427,6 +430,10 @@
           this.infoData = res.inOutVO;
           this.warehousingMaterialList = res.warehouseLedgerInfos;
         }
+        const { data } = await getTreeByPid(0);
+        this.codeList = data.map((item) => {
+          return { dictCode: item.id, dictValue: item.name };
+        });
       },
       calcSum(a, b, c, row) {
         if (

+ 1 - 1
vue.config.js

@@ -33,7 +33,7 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.3.51:18086', // 测试环境
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.134:18086', //朱
+        target: 'http://192.168.1.132:18086', //朱
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {