Przeglądaj źródła

fix:增加确认返工,和复选框

lupeng 6 miesięcy temu
rodzic
commit
0d9477fbb4

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

@@ -16,7 +16,30 @@ export function saveCompoents(data: object) {
     data: data,
   });
 }
+export function addBatch(data: object) {
+  return request({
+    url: "/api/v1/op/operationItem/addBatch",
+    method: "post",
+    data: data,
+  });
+}
+//批量新增esop
+export function addEsopBatch(data: object) {
+  return request({
+    url: "/api/v1/op/esop/addBatch",
+    method: "post",
+    data: data,
+  });
+}
 
+//批量新增检验项
+export function addCheckBatch(data: object) {
+  return request({
+    url: "/api/v1/op/operationCheck/addBatch",
+    method: "post",
+    data: data,
+  });
+}
 // 获取工艺工序组件路径信息
 export function getCompoentsList(opId: string) {
   return request({

+ 11 - 1
src/components/CommonTable/index.vue

@@ -54,6 +54,10 @@ const props = defineProps({
     default: "id",
     type: String,
   },
+  multipleRow: {
+    default: false,
+    type: Boolean,
+  },
 });
 
 const isShowTable = ref(false);
@@ -96,6 +100,7 @@ const {
   search,
   page,
   toDeleteIds,
+  selectedRows,
   Methords,
   Utils,
   commonConfig,
@@ -185,7 +190,12 @@ const onSelected = () => {
   if (props.multiple) {
     commonTableEmits("selectMultipleSure", toDeleteIds.value);
   } else {
-    commonTableEmits("selectedSure", selectRowValue.value);
+    if (props.multipleRow) {
+      console.log(selectedRows);
+      commonTableEmits("selectedSure", selectedRows.value);
+    } else {
+      commonTableEmits("selectedSure", selectRowValue.value);
+    }
   }
 
   isShowTable.value = false;

+ 5 - 1
src/hooks/userCrud.ts

@@ -58,7 +58,8 @@ export const useCrud = (config?: UseCrudConfig) => {
   // defaults ?: AvueCrudDefaults;
   // 多选返回的数组,命名是因为后来增加了很多功能,现在这个数组里面的值是根据multipleSelectKey来决定
   const toDeleteIds = ref<Array<string>>([]);
-
+  // 多选返回的数组,返回每一行的row数据
+  const selectedRows = ref<any[]>([]);
   const save = async (config?: UseCrudConfig) => {
     try {
       const path = config?.isEdit ? "/update" : "/add";
@@ -239,10 +240,12 @@ export const useCrud = (config?: UseCrudConfig) => {
     // 设置selection: true,后监听选中改变事件,将Id存入数组
     selectionChange: (rows?: any[]) => {
       toDeleteIds.value = [];
+      selectedRows.value = [];
       rows?.forEach((element) => {
         toDeleteIds.value.push(
           element[commonConfig.value?.multipleSelectKey ?? "id"]
         );
+        selectedRows.value.push(element);
       });
     },
 
@@ -393,6 +396,7 @@ export const useCrud = (config?: UseCrudConfig) => {
     toDeleteIds,
     Methords,
     Utils,
+    selectedRows,
     commonConfig,
   };
 };

+ 118 - 21
src/views/base/craftManagement/route/components/bottomTable.vue

@@ -44,6 +44,7 @@
       ref="commonTableRef"
       :tableTitle="tableTitle"
       :tableType="commonTableType"
+      :multipleRow="true"
       @selected-sure="onSelectedFinish"
     />
     <el-dialog v-model="dialogVisible">
@@ -61,6 +62,9 @@ import {
   saveCompoents,
   getBomVersion,
   getRouteMaxVersion,
+  addBatch,
+  addEsopBatch,
+  addCheckBatch,
 } from "@/api/craft/process/index";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 
@@ -131,6 +135,8 @@ const startCreat = () => {
         );
         commonTableRef.value?.mergeOption({
           searchShow: bomVersion.value ? false : true,
+          selection: true,
+          reserveSelection: true,
         });
       });
     });
@@ -138,6 +144,10 @@ const startCreat = () => {
     commonTableType.value = "OP_CHECK";
     nextTick(() => {
       commonTableRef.value?.startSelect();
+      commonTableRef.value?.mergeOption({
+        selection: true,
+        reserveSelection: true,
+      });
     });
   } else if (props.tableType === "ESOP") {
     commonTableType.value = "ESOP";
@@ -146,6 +156,10 @@ const startCreat = () => {
         materialCode: route.fullPath.split("/")[5],
         enable: 1,
       });
+      commonTableRef.value?.mergeOption({
+        selection: true,
+        reserveSelection: true,
+      });
     });
   } else {
     crudRef.value && crudRef.value.rowAdd();
@@ -167,31 +181,114 @@ const routeId = ref("");
 // ============公共弹窗table选择相关,物料采集等使用===============
 const commonTableRef = ref({});
 const commonTableType = ref("MARTERIAL_BOM");
+
+//批量增加物料采集
+const itemRecord = ref({});
+const itemRecordList = ref([]);
+//批量增加ESOP
+const esopItem = ref({});
+const esopList = ref([]);
+//批量增加点检
+const checkItem = ref({});
+const checkList = ref([]);
 const onSelectedFinish = (itemValue) => {
-  crudRef.value && crudRef.value.rowAdd();
+  //crudRef.value && crudRef.value.rowAdd();
+  itemRecordList.value = [];
+  itemRecord.value.itemRecordList = [];
+  checkList.value = [];
+  checkItem.value.checkList = [];
+  esopItem.value.esopList = [];
+  esopList.value = [];
   if (props.tableType === "wuliaocaiji") {
-    form.value.itemName = itemValue.bomMaterialName;
-    form.value.itemCode = itemValue.bomMaterialCode;
-    form.value.itemModel = itemValue.bomMaterialAttribute;
-    form.value.recordVersion = itemValue.bomVersion;
-    form.value.num = itemValue.bomMaterialNumber;
-    form.value.traceType = "S";
-    form.value.unit = itemValue.unit;
+    itemValue?.forEach((item, index) => {
+      const recordItem = ref({});
+      recordItem.value.itemName = item.bomMaterialName;
+      recordItem.value.itemCode = item.bomMaterialCode;
+      recordItem.value.itemModel = item.bomMaterialAttribute;
+      recordItem.value.recordVersion = item.bomVersion;
+      recordItem.value.num = item.bomMaterialNumber;
+      recordItem.value.traceType = "S";
+      recordItem.value.operationId = route.params.id;
+      recordItem.value.unit = item.unit;
+      recordItem.value.isTrace = 1;
+      itemRecordList.value.push(recordItem.value);
+    });
+    itemRecord.value.operationId = route.params.id;
+    itemRecord.value.itemRecordList = Array.from(itemRecordList.value);
+    addBatch(itemRecord.value).then((data) => {
+      if (data.code == "200") {
+        dataList();
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+      } else {
+        ElMessage({
+          message: data.msg,
+          type: "error",
+        });
+      }
+    });
   } else if (props.tableType === "dianjian") {
-    form.value.checkName = itemValue.checkName;
-    form.value.checkCode = itemValue.checkCode;
-    form.value.content = itemValue.content;
-    form.value.standard = itemValue.standard;
-    form.value.upper = itemValue.upper;
-    form.value.lower = itemValue.lower;
-    form.value.unit = itemValue.unit;
+    itemValue?.forEach((item, index) => {
+      const recordItem = ref({});
+      recordItem.value.operationId = route.params.id;
+      recordItem.value.checkName = item.checkName;
+      recordItem.value.checkCode = item.checkCode;
+      recordItem.value.content = item.content;
+      recordItem.value.standard = item.standard;
+      recordItem.value.upper = item.upper;
+      recordItem.value.lower = item.lower;
+      recordItem.value.unit = item.unit;
+      checkList.value.push(recordItem.value);
+    });
+    checkItem.value.operationId = route.params.id;
+    checkItem.value.checkList = Array.from(checkList.value);
+    addCheckBatch(checkItem.value).then((data) => {
+      if (data.code == "200") {
+        dataList();
+        commonTableRef.value?.mergeOption({
+          reserveSelection: false,
+        });
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+      } else {
+        ElMessage({
+          message: data.msg,
+          type: "error",
+        });
+      }
+    });
   } else if (props.tableType === "ESOP") {
-    form.value.filePath = itemValue.pdfPath;
-    pdfPath.value = import.meta.env.VITE_APP_UPLOAD_URL + itemValue.pdfPath;
-    form.value.drawingCode = itemValue.drawingCode;
-    form.value.recordVersion = itemValue.drawingVersion;
-    form.value.sortNum = itemValue.sort;
-    form.value.title = itemValue.drawingTitle;
+    itemValue?.forEach((item, index) => {
+      const recordItem = ref({});
+      recordItem.value.operationId = route.params.id;
+      recordItem.value.filePath = item.pdfPath;
+      recordItem.value.showAppointPageNum = 1;
+      recordItem.value.drawingCode = item.drawingCode;
+      recordItem.value.recordVersion = item.drawingVersion;
+      recordItem.value.sortNum = item.sort;
+      recordItem.value.title = item.drawingTitle;
+      esopList.value.push(recordItem.value);
+    });
+    esopItem.value.operationId = route.params.id;
+    esopItem.value.esopList = Array.from(esopList.value);
+    addEsopBatch(esopItem.value).then((data) => {
+      if (data.code == "200") {
+        dataList();
+        ElMessage({
+          message: data.msg,
+          type: "success",
+        });
+      } else {
+        ElMessage({
+          message: data.msg,
+          type: "error",
+        });
+      }
+    });
   }
 };
 

+ 9 - 3
src/views/quality/rework/index.vue

@@ -40,22 +40,28 @@
           type="primary"
           >返工工序</el-button
         >
-
         <el-button
           icon="el-icon-edit"
           text
           @click="handle(row, index, 2)"
           type="primary"
           v-if="row.state === 0"
-          :size="size"
           >驳回</el-button
         >
         <el-button
           icon="el-icon-edit"
           text
-          v-if="row.state === 0"
           @click="handle(row, index, 1)"
           type="primary"
+          v-if="row.state === 0"
+          >确认返工</el-button
+        >
+        <el-button
+          icon="el-icon-edit"
+          text
+          v-if="row.state === 1"
+          @click="handle(row, index, 3)"
+          type="primary"
           :size="size"
           >返工完成</el-button
         >