ysy hai 1 ano
pai
achega
e07430bbd7
Modificáronse 2 ficheiros con 24 adicións e 1 borrados
  1. 9 0
      src/api/codeManagement/index.js
  2. 15 1
      src/views/material/product/detail.vue

+ 9 - 0
src/api/codeManagement/index.js

@@ -58,3 +58,12 @@ export async function checkCode (code) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 根据根级物品id升级物品编码
+export async function rootCategoryCode (rootCategoryLevelId) {
+  const res = await request.get(`/main/category/copyInfo/${rootCategoryLevelId}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 15 - 1
src/views/material/product/detail.vue

@@ -235,7 +235,7 @@
   import linkMsg from './components/link-msg.vue';
   import { getDetails } from '@/api/classifyManage/itemInformation';
 
-  import { getCode } from '@/api/codeManagement';
+  import { getCode ,rootCategoryCode } from '@/api/codeManagement';
 
   import { addMaterial } from '@/api/material/list.js';
   import { deepClone } from '@/utils/index';
@@ -347,6 +347,7 @@
       async _getDetails() {
         const data = await getDetails(this.$route.query.id);
         const info = deepClone(data);
+        console.log(123, info);
         this.form = {
           ...info.category
         };
@@ -355,6 +356,15 @@
         this.judgeSet(info);
         this.searchDeptNodeClick(this.form.chargeDeptId);
 
+
+        
+        if (this.status == 1) {
+            rootCategoryCode(this.categoryLevelPathId).then((res) => {
+              this.$set(this.form, 'code', res);
+            });
+          }
+
+
         this.$forceUpdate()
       },
       // 判断字段类型并赋值
@@ -429,6 +439,10 @@
             const code = await getCode(ruleCode);
             this.$set(this.form, 'code', code);
           }
+
+
+    
+
         }
 
         this.$forceUpdate();