ysy 1 год назад
Родитель
Сommit
d6628a320d

+ 10 - 0
src/api/material/BOM.js

@@ -167,6 +167,16 @@ export async function convert(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 转换 ABOM
+export async function convertABom(data) {
+  const res = await request.post(`/main/bomCategory/convertABom`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
 // 文档
 export async function getBomFilePageList(params) {
   const res = await request.get(`/main/bomfile/page`, { params });

+ 11 - 14
src/views/material/BOMmanage/components/bomTreeDialog.vue

@@ -17,7 +17,6 @@
       <el-row>
         <el-col :span="12" label-width="100px">
           <el-form-item label="父级节点" prop="parentId">
-
             <selectTree
               ref="tree"
               class="form-ipt"
@@ -59,7 +58,11 @@
 
         <el-col :span="12" label-width="100px">
           <el-form-item label="编码" prop="code">
-            <el-input placeholder=""     @click.native="handleProduct()" v-model="attributeData.code"></el-input>
+            <el-input
+              placeholder=""
+              @click.native="handleProduct()"
+              v-model="attributeData.code"
+            ></el-input>
           </el-form-item>
         </el-col>
 
@@ -158,7 +161,6 @@
           </el-form-item>
         </el-col>
       </el-row>
-
     </el-form>
     <div class="btns">
       <el-button type="primary" size="small" @click="save">保存</el-button>
@@ -198,7 +200,6 @@
         },
 
         rules: {
-        
           code: [{ required: true, message: '请选择编码', trigger: 'change' }],
 
           name: [{ required: true, message: '请选择名称', trigger: 'change' }]
@@ -233,20 +234,16 @@
 
     methods: {
       getTreeValue(data) {
-        this.category = {
-        }
+        this.category = {};
         this.$set(this.attributeData, 'code', null);
         this.$set(this.attributeData, 'name', null);
-        if(data) {
+        if (data) {
           this.attributeData.parentId = data.id;
-          this.attributeData.level =  +data.level + 1;
+          this.attributeData.level = +data.level + 1;
         } else {
-          this.attributeData.parentId = null
-          this.attributeData.level = null
+          this.attributeData.parentId = null;
+          this.attributeData.level = null;
         }
-      
-
-
       },
       save() {
         this.$refs.form.validate((valid) => {
@@ -273,7 +270,7 @@
       },
 
       handleProduct() {
-        this.$refs.standardOutputRefs.open(this.attributeData.parentId ? 1 : 9 );
+        this.$refs.standardOutputRefs.open(this.attributeData.parentId ? 1 : 9);
       },
       chooseStandardList(type, data) {
         if (type == 9 || type == 1) {

+ 6 - 4
src/views/material/BOMmanage/details.vue

@@ -75,7 +75,7 @@
                 size="mini"
                 icon="el-icon-refresh"
                 plain
-                @click="transformation"
+                @click="transformation('M')"
                 v-if="currentNodeData.bomType == 1"
                 >转换MBOM</el-button
               >
@@ -85,7 +85,7 @@
                 size="mini"
                 icon="el-icon-refresh"
                 plain
-                @click="transformation"
+              @click="transformation('A')"
                 v-if="currentNodeData.bomType == 1"
                 >转换ABOM</el-button
               >
@@ -151,6 +151,7 @@
     getBomTreeList,
     getBomGetById,
     convert,
+    convertABom,
     deleteBomTreeList
   } from '@/api/material/BOM.js';
   import { getTreeByGroup } from '@/api/classifyManage';
@@ -268,13 +269,14 @@
       back() {
         this.$router.go(-1);
       },
-      transformation() {
+      transformation(tt) {
         this.loadingInstance = this.$loading({
           lock: true,
           text: '转换中...',
           background: 'rgba(0, 0, 0, 0.7)'
         });
-        convert({ versions: this.versions, categoryId: this.categoryId }).then(
+       let ULR = tt == 'M' ? convert : convertABom;
+       ULR({ versions: this.versions, categoryId: this.categoryId }).then(
           (data) => {
             if (data.code == '0') {
               this.loadingInstance.close();