Kaynağa Gözat

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend into dev

quwangxin 2 yıl önce
ebeveyn
işleme
cd17d4c8e7

+ 19 - 0
src/api/technology/version/version.js

@@ -33,3 +33,22 @@ export async function getProcessByRoute(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+// 查询物料关联BOM子项列表
+export async function getBomSubList(data) {
+  const res = await request.get('/main/produceversion/resource/bomSubList', { params: data});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 保存bom子项列表 
+export async function saveBomList(data) {
+  const res = await request.post('/main/produceversion/resource/save', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 4 - 4
src/views/equipmentManage/components/link-material-dialog.vue

@@ -272,10 +272,10 @@
           return this.$message.error('请选择关联数据');
         }
         this.datasource = this.datasource.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
+          !this.selection.find((t) => t.categoryId == i.categoryId)
         );
         this.datasourceShow = this.datasourceShow.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
+          !this.selection.find((t) => t.categoryId == i.categoryId)
         );
 
         this.datasourceRightShow.push(...this.selection);
@@ -289,10 +289,10 @@
         }
 
         this.datasourceRight = this.datasourceRight.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+          !this.selectionRight.find((t) => t.categoryId == i.categoryId)
         );
         this.datasourceRightShow = this.datasourceRightShow.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+          !this.selectionRight.find((t) => t.categoryId == i.categoryId)
         );
 
         this.datasourceShow.push(...this.selectionRight);

+ 4 - 4
src/views/material/productLinkMaterial/components/link-material-dialog.vue

@@ -324,10 +324,10 @@
           return this.$message.error('请选择关联数据');
         }
         this.datasource = this.datasource.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
+          !this.selection.find((t) => t.categoryId == i.categoryId)
         );
         this.datasourceShow = this.datasourceShow.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
+          !this.selection.find((t) => t.categoryId == i.categoryId)
         );
 
         this.datasourceRightShow.push(...this.selection);
@@ -341,10 +341,10 @@
         }
 
         this.datasourceRight = this.datasourceRight.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+          !this.selectionRight.find((t) => t.categoryId == i.categoryId)
         );
         this.datasourceRightShow = this.datasourceRightShow.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+          !this.selectionRight.find((t) => t.categoryId == i.categoryId)
         );
 
         this.datasourceShow.push(...this.selectionRight);

+ 36 - 126
src/views/technology/version/components/link-material-dialog.vue

@@ -40,7 +40,7 @@
         </headerTitle>
         <ele-pro-table
           ref="tableRight"
-          :columns="columnsRight"
+          :columns="columns"
           :datasource="datasourceRightShow"
           :selection.sync="selectionRight"
           height="45vh"
@@ -88,44 +88,22 @@
 </template>
 
 <script>
-  import {
-    getRelatesInformationList,
-    unassociated,
-    productTieUpMaterial
-  } from '@/api/material/product.js';
-  import dictMixins from '@/mixins/dictMixins';
-  import categorySelect from '@/components/CommomSelect/category-select.vue';
+  import { getBomSubList , saveBomList } from '@/api/technology/version/version.js';
   export default {
-    mixins: [dictMixins],
-    components: { categorySelect },
+    components: {  },
     data () {
       return {
         visible: false,
         row: {},
-        datasource: [],
         datasourceShow: [],
         datasourceRightShow: [],
-        datasourceRight: [],
         selectionRight: [],
         selection: [],
-        whereRight: {},
-        where: {},
-        type: '',
-        idMap: {
-          8: '1678278350275198977',
-          4: '1678277959244431361',
-          5: '1678277781556936705'
-        }
-      };
+      }
     },
     created () {
-      // this.requestDict('类型用途');
     },
     computed: {
-      // catogaryName () {
-      //   return this.getDictValue('类型用途', this.type);
-      // },
-      dict () {},
       columns () {
         return [
           {
@@ -134,19 +112,19 @@
           },
           {
             label: '子项编号',
-            prop: 'categoryLevelGroupName'
+            prop: 'subCode'
           },
           {
             label: '子项物料编码',
-            prop: 'code'
+            prop: 'categoryCode'
           },
           {
             label: '子项物料名称',
-            prop: 'name'
+            prop: 'categoryName'
           },
           {
             label: '基本数量',
-            prop: 'modelType'
+            prop: 'baseNum'
           },
           {
             label: '单位',
@@ -154,40 +132,11 @@
           }
         ];
       },
-      columnsRight () {
-        return [
-          {
-            type: 'selection',
-            align: 'center'
-          },
-          {
-            label: '子项编号',
-            prop: 'categoryLevelGroupName'
-          },
-          {
-            label: '子项物料编码',
-            prop: 'code'
-          },
-          {
-            label: '子项物料名称',
-            prop: 'name'
-          },
-          {
-            label: '基本数量',
-            prop: 'modelType'
-          },
-          {
-            label: '单位',
-            prop: 'unit'
-          }
-        ];
-      }
     },
     methods: {
       open (row) {
         this.row = row;
         this.getDatasource();
-        this.getDatasourceRight();
         this.visible = true;
       },
       cancel () {
@@ -197,17 +146,17 @@
         if (!this.datasourceRightShow.length) {
           return this.$message.error('请添加关联数据');
         }
+        const arr = []
+        this.datasourceRightShow.map(item=>{
+           arr.push(item.bomSubId)
+        })
         const params = {
-          mainCategoryId: this.row.categoryLevelId,
-          mainCategoryLevelRootId: this.row.categoryLevelGroupId,
-          materialDetailsPOList: this.datasourceRightShow.map((i) => ({
-            ...i,
-            categoryLevelRootId: this.type
-          }))
+          produceVersionId:this.row.produceVersionId,
+          taskInstanceId:this.row.id,
+          bomSubId: arr
         };
-        await productTieUpMaterial(params);
+        await saveBomList(params);
         this.cancel();
-
         this.$message.success('操作成功!');
         this.$emit('success');
       },
@@ -215,81 +164,42 @@
         if (!this.selection.length) {
           return this.$message.error('请选择关联数据');
         }
-        this.datasource = this.datasource.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
-        );
         this.datasourceShow = this.datasourceShow.filter((i) =>
-          this.selection.find((t) => t.categoryId != i.categoryId)
+          !this.selection.find((t) => t.bomSubId == i.bomSubId)
         );
-
         this.datasourceRightShow.push(...this.selection);
-        this.datasourceRight.push(...this.selection);
-
         this.selection = [];
       },
       handleCancelConect () {
         if (!this.selectionRight.length) {
           return this.$message.error('请选择取消关联数据');
         }
-
-        this.datasourceRight = this.datasourceRight.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
-        );
         this.datasourceRightShow = this.datasourceRightShow.filter((i) =>
-          this.selectionRight.find((t) => t.categoryId != i.categoryId)
+          !this.selectionRight.find((t) => t.bomSubId == i.bomSubId)
         );
-
         this.datasourceShow.push(...this.selectionRight);
-        this.datasource.push(...this.selectionRight);
-
         this.selectionRight = [];
       },
-      reload () {
-        this.datasourceShow = this.datasource.filter((item) => {
-          return (
-            (!this.where.categoryLevelGroupId ||
-              item.categoryLevelGroupId.includes(
-                this.where.categoryLevelGroupId
-              )) &&
-            (!this.where.code || item.code.includes(this.where.code)) &&
-            (!this.where.name || item.name.includes(this.where.name)) &&
-            (!this.where.modelType ||
-              item.modelType.includes(this.where.modelType))
-          );
-        });
-      },
-      reloadRight () {
-        this.datasourceRightShow = this.datasourceRight.filter((item) => {
-          return (
-            (!this.whereRight.categoryLevelGroupId ||
-              item.categoryLevelGroupId.includes(
-                this.whereRight.categoryLevelGroupId
-              )) &&
-            (!this.whereRight.code ||
-              item.code.includes(this.whereRight.code)) &&
-            (!this.whereRight.name ||
-              item.name.includes(this.whereRight.name)) &&
-            (!this.whereRight.modelType ||
-              item.modelType.includes(this.whereRight.modelType))
-          );
-        });
-      },
       async getDatasource () {
-        const data = await unassociated({
-          categoryLevelGroupId: this.idMap[this.type]
-        });
-        this.datasource = data.slice(0);
-        this.datasourceShow = data.slice(0);
+         const params = {
+            bomId:this.row.bomId,
+            produceVersionId:this.row.produceVersionId,
+            routingTaskId:this.row.id,
+            pageNum:1,
+            size:-1
+         }
+        const data = await getBomSubList(params);
+          if(typeof data.uncorrelatedList == 'string' ){
+             this.datasource = []
+          }else{
+            this.datasourceShow = data.uncorrelatedList;
+          }
+          if(typeof data.correlatedList == 'string' ){
+             this.datasourceRightShow = []
+          }else{
+            this.datasourceRightShow = data.correlatedList;
+          }
       },
-      async getDatasourceRight () {
-        const data = await getRelatesInformationList({
-          mainCategoryId: this.row.categoryLevelId,
-          // categoryLevelGroupId: this.idMap[this.type],
-          categoryLevelRootId: this.type
-        });
-        this.datasourceRight = data.slice(0);
-        this.datasourceRightShow = data.slice(0);
-      }
     }
   };
 </script>

+ 2 - 0
src/views/technology/version/details.vue

@@ -143,6 +143,8 @@ export default {
 
     // 点击分配物料
     allocateMaterials(row){
+       row.bomId = this.infoData.bomId
+       row.produceVersionId =  this.infoData.id
        this.$refs.linkMaterialDialogRef.open(row);
     },
     goBack(){