Procházet zdrojové kódy

fefactor:esop,点检,物料采集开窗多选 fix:修改字段名字

lupeng před 9 měsíci
rodič
revize
b7597044b0

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

@@ -16,7 +16,32 @@ 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({

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

@@ -49,6 +49,10 @@ const props = defineProps({
     default: false,
     type: Boolean,
   },
+  multipleRow: {
+    default: false,
+    type: Boolean,
+  },
   // 用于多选的返回值
   multipleKey: {
     default: "id",
@@ -96,6 +100,7 @@ const {
   search,
   page,
   toDeleteIds,
+  selectedRows,
   Methords,
   Utils,
   commonConfig,
@@ -185,7 +190,11 @@ const onSelected = () => {
   if (props.multiple) {
     commonTableEmits("selectMultipleSure", toDeleteIds.value);
   } else {
-    commonTableEmits("selectedSure", selectRowValue.value);
+    if(props.multipleRow){
+      commonTableEmits("selectedSure", selectedRows.value);
+    }else {
+      commonTableEmits("selectedSure", selectRowValue.value);
+    }
   }
 
   isShowTable.value = false;

+ 5 - 1
src/hooks/userCrud.ts

@@ -60,7 +60,8 @@ export const useCrud = (config?: UseCrudConfig) => {
   // defaults ?: AvueCrudDefaults;
   // 多选返回的数组,命名是因为后来增加了很多功能,现在这个数组里面的值是根据multipleSelectKey来决定
   const toDeleteIds = ref<Array<string>>([]);
-
+  // 多选返回的数组,返回每一行的row数据
+  const selectedRows = ref({});
   const save = async (config?: UseCrudConfig) => {
     try {
       const path = config?.isEdit ? "/update" : "/add";
@@ -245,10 +246,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);
       });
     },
 
@@ -398,6 +401,7 @@ export const useCrud = (config?: UseCrudConfig) => {
     search,
     page,
     toDeleteIds,
+    selectedRows,
     Methords,
     Utils,
     commonConfig,

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

@@ -44,6 +44,7 @@
       ref="commonTableRef"
       :tableTitle="tableTitle"
       :tableType="commonTableType"
+      :multipleRow="multipleRow"
       @selected-sure="onSelectedFinish"
     />
     <el-dialog v-model="dialogVisible">
@@ -51,7 +52,7 @@
     </el-dialog>
   </div>
 </template>
-<script setup>
+<script  setup>
 import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
 import { getTableConfig } from "./configs";
@@ -61,6 +62,9 @@ import {
   saveCompoents,
   getBomVersion,
   getRouteMaxVersion,
+  addBatch,
+  addEsopBatch,
+  addCheckBatch
 } from "@/api/craft/process/index";
 import SingleUpload from "@/components/Upload/SingleUpload.vue";
 
@@ -91,6 +95,7 @@ const { selectionChange, multipleUpdate } = Methords; //选中和批量删除事
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 const bomVersion = ref(null);
 const pdfPath = ref(null);
+const multipleRow = ref(true);
 const startCreat = () => {
   if (props.tableType === "wuliaocaiji") {
     if (data.value && data.value.length > 0) {
@@ -131,6 +136,8 @@ const startCreat = () => {
         );
         commonTableRef.value?.mergeOption({
           searchShow: bomVersion.value ? false : true,
+          selection: true,
+          reserveSelection : true,
         });
       });
     });
@@ -138,6 +145,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 +157,10 @@ const startCreat = () => {
         materialCode: route.query.prodtCode,
         enable: 1,
       });
+      commonTableRef.value?.mergeOption({
+        selection: true,
+        reserveSelection : true,
+      });
     });
   } else {
     crudRef.value && crudRef.value.rowAdd();
@@ -163,34 +178,140 @@ const onSortChange = () => {
   });
 };
 
+
 // ============公共弹窗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();
   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)=>{
+        itemRecordList.value = [];
+        if(data.code=="200"){
+          dataList();
+          ElMessage({
+            message: data.msg,
+            type: "success",
+          });
+        }else {
+          ElMessage({
+            message: data.msg,
+            type: "error",
+          });
+        }
+      }
+    )
+    //form.value.unit = itemValue.unit;
   } else if (props.tableType === "dianjian") {
-    form.value.checkName = itemValue.checkName;
+    /*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;
+    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)=>{
+        checkList.value = [];
+        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;
+    /*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;
+    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)=>{
+        esopList.value = [];
+        if(data.code=="200"){
+          dataList();
+          ElMessage({
+            message: data.msg,
+            type: "success",
+          });
+        }else {
+          ElMessage({
+            message: data.msg,
+            type: "error",
+          });
+        }
+      }
+    )
   }
 };
 
@@ -230,6 +351,7 @@ watch(
     url.value = tableConfig[props.tableType].url;
     option.value = Object.assign(option.value, {
       addBtn: false,
+      selection: true,
       searchShow: false,
       header: false,
       sortable: true,

+ 1 - 1
src/views/base/craftManagement/route/index.vue

@@ -312,7 +312,7 @@ option.value = Object.assign(option.value, {
       },
     },
     {
-      label: "物料编",
+      label: "物料编",
       prop: "prodtCode",
       overHidden: true,
       search: true,

+ 6 - 6
src/views/plan/order/index.vue

@@ -319,7 +319,7 @@ option.value = {
   },
   column: [
     {
-      label: "订单编号",
+      label: "计划编号",
       prop: "orderCode",
       search: true,
       width: 130,
@@ -341,7 +341,7 @@ option.value = {
       ],
     },
     {
-      label: "ERP号",
+      label: "SAP订单号",
       prop: "erpCode",
       search: true,
       width: 130,
@@ -349,7 +349,7 @@ option.value = {
       rules: [
         {
           required: true,
-          message: "订单号不能为空",
+          message: "SAP订单号不能为空",
           trigger: "trigger",
         },
       ],
@@ -414,7 +414,7 @@ option.value = {
       hide: true,
     },
     {
-      label: "产品编码",
+      label: "物料编码",
       prop: "materialCode",
       search: true,
       width: 130,
@@ -472,7 +472,7 @@ option.value = {
     },
 
     {
-      label: "订单数量",
+      label: "生产数量",
       prop: "orderNum",
       type: "number",
       width: 100,
@@ -482,7 +482,7 @@ option.value = {
       rules: [
         {
           required: true,
-          message: "订单数量不能为空",
+          message: "生产数量不能为空",
           trigger: "trigger",
         },
       ],

+ 1 - 1
src/views/plan/workOrder/index.vue

@@ -566,7 +566,7 @@ option.value = Object.assign(option.value, {
       },
     },
     {
-      label: "产品编号",
+      label: "物料编码",
       width: 125,
       overHidden: true,
       search: true,

+ 1 - 1
src/views/quality/faultHandle/index.vue

@@ -247,7 +247,7 @@ option.value = Object.assign(option.value, {
       prop: "unqualifiedNum",
     },
     {
-      label: "产品编码",
+      label: "物料编码",
       prop: "materialCode",
       overHidden: true,
     },

+ 1 - 1
src/views/quality/unqualified/columns.ts

@@ -31,7 +31,7 @@ export const columns = [
 
   },
   {
-    label: "产品编码", prop: "materialCode", overHidden: true,
+    label: "物料编码", prop: "materialCode", overHidden: true,
     width:120,
 
   },