ソースを参照

fix:同规格物料采集

lupeng 3 ヶ月 前
コミット
eca6125f9a

+ 32 - 0
src/api/craft/process/index.ts

@@ -130,3 +130,35 @@ export function treeDataUpdate(data: object) {
     data: data,
   });
 }
+
+export function treeDataAddBatch(data: object) {
+  return request({
+    url: `/api/v1/op/operationItem/updateBatch`,
+    method: "post",
+    data: data,
+  });
+}
+
+export function removeGroup(data: object) {
+  return request({
+    url: `/api/v1/op/operationItem/removeGroup`,
+    method: "post",
+    data: data,
+  });
+}
+
+export function  removeAccessoryGroup(data: object){
+  return request({
+    url: `/api/v1/operationAccessoryItem/removeGroup`,
+    method: "post",
+    data: data,
+  });
+}
+
+export function treeAccessoryAddBatch(data: object) {
+  return request({
+    url: `/api/v1/operationAccessoryItem/updateBatch`,
+    method: "post",
+    data: data,
+  });
+}

+ 6 - 2
src/components/CommonTable/configs/tableConfig.ts

@@ -866,6 +866,7 @@ export const tableConfig = {
       {
         label: "物料名称",
         prop: "itemName",
+        search: true,
         addDisabled: true,
         editDisabled: true,
       },
@@ -878,6 +879,7 @@ export const tableConfig = {
       {
         label: "物料编码",
         prop: "itemCode",
+        search: true,
         addDisabled: true,
         editDisabled: true,
       },
@@ -885,13 +887,13 @@ export const tableConfig = {
         label: "物料规格",
         prop: "itemModel",
         addDisabled: true,
+        search: true,
         editDisabled: true,
       },
       { label: "所需数量", prop: "num" },
       {
         label: "追溯类型",
         prop: "traceType",
-        search: true,
         filterable: true,
         type: "select",
         dataType: "string",
@@ -901,7 +903,6 @@ export const tableConfig = {
       {
         label: "单位",
         prop: "unit",
-        search: true,
         filterable: true,
         type: "select",
         dataType: "string",
@@ -925,6 +926,7 @@ export const tableConfig = {
         label: "物料名称",
         prop: "itemName",
         addDisabled: true,
+        search: true,
         editDisabled: true,
       },
       {
@@ -937,12 +939,14 @@ export const tableConfig = {
         label: "物料编码",
         prop: "itemCode",
         addDisabled: true,
+        search: true,
         editDisabled: true,
       },
       {
         label: "物料规格",
         prop: "itemModel",
         addDisabled: true,
+        search: true,
         editDisabled: true,
       },
       // {

+ 84 - 13
src/views/base/craftManagement/route/components/bottomTable.vue

@@ -43,7 +43,7 @@
 
 
       <template #menu="{ row, index, type }">
-        <el-button @click="deleteTep(row.id)" text type="primary" v-if="props.isTree=='1'&&props.groupId"
+        <el-button @click="deleteGroup(row.id)" text type="primary" v-if="props.isTree=='1'&&props.groupId"
         >删除
         </el-button
         >
@@ -98,6 +98,10 @@ import {
   addEsopBatch,
   addCheckBatch,
   addFuliao,
+  treeDataAddBatch,
+  removeGroup,
+  removeAccessoryGroup,
+  treeAccessoryAddBatch
 } from "@/api/craft/process/index";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 
@@ -169,7 +173,40 @@ const goToSelectMaterial = () => {
   selectedVersion.value = "";
   versionDV.value = false;
 };
+const deleteGroupId = ref({});
+const deleteGroup = (id) =>{
+  deleteGroupId.value.id = id;
+  if(props.tableType === "wuliaocaiji"){
+    removeGroup(deleteGroupId.value).then(
+      (data)=>{
+        if(data.code==='200'){
+          ElMessage({
+            message: data.msg,
+            type: "success",
+          });
+          search.value.itemGroupId = props.groupId
+          dataList();
+        }
+      }
+    )
+  }
+
+  if(props.tableType === "fuliaoCJ"){
+    removeAccessoryGroup(deleteGroupId.value).then(
+      (data)=>{
+        if(data.code==='200'){
+          ElMessage({
+            message: data.msg,
+            type: "success",
+          });
+          search.value.itemGroupId = props.groupId
+          dataList();
+        }
+      }
+    )
+  }
 
+}
 const startCreat = () => {
   if (props.tableType === "wuliaocaiji") {
     if (bomVersion.value) {
@@ -322,6 +359,7 @@ const esopList = ref([]);
 //批量增加点检
 const checkItem = ref({});
 const checkList = ref([]);
+const itemGroupList = ref([]);
 const onSelectedFinish = (itemValue) => {
   if (Object.keys(itemValue).length == 0) {
     ElMessage.error("请选择数据,数据不能为空!");
@@ -333,22 +371,62 @@ const onSelectedFinish = (itemValue) => {
   checkItem.value.checkList = [];
   esopItem.value.esopList = [];
   esopList.value = [];
+  itemGroupList.value = [];
   //主料分组保存
   if (commonTableType.value === "MATERIAL_GATHER") {
-    console.log("选择", itemGroup.value);
     if (!itemGroup.value) {
       ElMessage.error("未选择分组信息!");
+      return;
     }
+    itemValue?.forEach(
+      (item,index)=>{
+        const groupItem =  ref({});
+        groupItem.value.id = item.id;
+        groupItem.value.itemGroupId = itemGroup.value;
+        itemGroupList.value.push(groupItem.value);
+      }
+    )
+    treeDataAddBatch(itemGroupList.value).then(
+      (data)=>{
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+        search.value.itemGroupId = props.groupId
+        dataList();
+      }
+
+    )
     return;
   }
 
-  //主料分组保存
+  //料分组保存
   if (commonTableType.value === "OP_ACCESSORY") {
 
 
     if (!itemGroup.value) {
       ElMessage.error("未选择分组信息!");
     }
+
+    itemValue?.forEach(
+      (item,index)=>{
+        const groupItem =  ref({});
+        groupItem.value.id = item.id;
+        groupItem.value.itemGroupId = itemGroup.value;
+        itemGroupList.value.push(groupItem.value);
+      }
+    )
+    treeAccessoryAddBatch(itemGroupList.value).then(
+      (data)=>{
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+        search.value.itemGroupId = props.groupId
+        dataList();
+      }
+
+    )
     return;
   }
   if (props.tableType === "wuliaocaiji") {
@@ -493,7 +571,7 @@ onMounted(() => {
   search.value.isTree = props.isTree;
   if (props.groupId) {
     search.value.itemGroupId = props.groupId;
-
+    itemGroup.value=props.groupId;
   }
   //物料双规格分组的话没有编辑,删除要自定义
   if (props.isTree === '1') {
@@ -540,13 +618,6 @@ watch(
   }
 );
 
-watch(
-  () => itemGroup.value,
-  () => {
-    console.log("改变", itemGroup.value);
-
-  }
-);
 /**监听分组是否变化*/
 watch(
   () => props.groupId,
@@ -562,8 +633,8 @@ watch(
       column: tableConfig[props.tableType].column,
     });
     search.value.itemGroupId = props.groupId
-    itemGroup.value = "props.groupId "
-    console.log("监听", itemGroup.value);
+    itemGroup.value = props.groupId
+    console.log("aaaa",itemGroup.value);
     dataList();
   }
 );

+ 3 - 4
src/views/base/craftManagement/route/components/processComponent.vue

@@ -170,7 +170,6 @@ const loadTopList = () => {
   });
 };
 const bindCreate=()=>{
-  dataDetail.value.materialType="1";
   treeDataList(treeParam.value).then(
     (data)=>{
       if(data.code==='200'){
@@ -293,8 +292,8 @@ onMounted(async () => {
   await loadTopList();
   loadRouteInfo();
   dataDetail.value.operationId=route.fullPath.split("/")[4]
-
-
+  treeParam.value.materialType="1";
+  dataDetail.value.materialType="1";
 });
 
 // 顶部====================
@@ -404,7 +403,7 @@ const creatNewData = () => {
 };
 
 const creatGroupData = () => {
-  bottomTableRef.value && bottomTableRef.value.groupCreat();
+  tableTreeRef.value && tableTreeRef.value.groupCreat();
 };
 const saveSortData = () => {
   bottomTableRef.value && bottomTableRef.value.saveSortData();