Browse Source

JLHWEB: 1、床垫清单拆分按钮功能

JohnnyChan 1 month ago
parent
commit
48c06744bb

+ 10 - 2
JLHWEB/src/api/modules/common.ts

@@ -97,12 +97,20 @@ export const GetERPMtrlTypeList = () => {
 };
 
 /**
- * @description 生成L1清单
+ * @description 生成L1物料
  * @param params
  * @returns
  */
 export const CreatMtrlPf = (params?: Mattress.ReqRefreshMattressInterface) => {
-  return http.post(PORT1 + `/CreatMtrlPf`, params);
+  return http.post(PORT1 + `/CreatMtrldef`, params);
+};
+/**
+ * @description 生成L1清单
+ * @param params
+ * @returns
+ */
+export const CreatPrdPf = (params?: Mattress.ReqRefreshMattressInterface) => {
+  return http.post(PORT1 + `/CreatPrdPf`, params);
 };
 
 /**

+ 1 - 1
JLHWEB/src/utils/index.ts

@@ -374,7 +374,7 @@ export function formatValue(callValue: any) {
  * */
 export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string, ...args: any) {
   if (args[0]) {
-    return row[prop] ? formatFn[args[0]]({ val: row[prop], format: args[0] }) : "";
+    return row[prop] && formatFn[args[0]] ? formatFn[args[0]]({ val: row[prop], format: args[0] }) : "";
   }
   if (!prop.includes(".")) return row[prop] ?? "";
   prop.split(".").forEach(item => (row = row[item] ?? ""));

+ 11 - 0
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -143,6 +143,7 @@ const {
   RefreshMattressInterfaceQdList,
   fModelChoseMattress,
   toExcel,
+  toCreateMtrl,
   toCreateORDelMtrlPf,
   toUpdateL1Planprice,
   YWAudit,
@@ -468,6 +469,16 @@ const orderDefaultAction = [
       }
     })
   ],
+  buttonDefault({
+    label: "生成/更新物料",
+    power: 90,
+    limited: () => {
+      return !!orderStatus.value;
+    },
+    clickFunc: item => {
+      toCreateMtrl(1, LjDetailRef.value?._mainData.mattressid);
+    }
+  }),
   [
     buttonDefault({
       label: "生成金蝶清单",

+ 25 - 1
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -11,6 +11,7 @@ import {
   GetERPWrkGrpList,
   GetERPMtrlTypeList,
   CreatMtrlPf,
+  CreatPrdPf,
   DelMtrlPf
 } from "@/api/modules/common";
 import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
@@ -90,7 +91,7 @@ export const useHooks = (t?: any) => {
         type: "warning"
       })
         .then(() => {
-          CreatMtrlPf({ mattressid }).then(() => {
+          CreatPrdPf({ mattressid }).then(() => {
             ElNotification({
               title: "金蝶清单",
               message: "生成成功!",
@@ -125,6 +126,28 @@ export const useHooks = (t?: any) => {
         });
     }
   };
+  const toCreateMtrl = (type: number, mattressid: number) => {
+    ElMessageBox.confirm(`是否确定要生成/更新物料?`, "询问", {
+      confirmButtonText: t("common.okText"),
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        CreatMtrlPf({ mattressid }).then(() => {
+          ElNotification({
+            title: "物料",
+            message: "生成/更新成功!",
+            type: "success"
+          });
+        });
+      })
+      .catch((e: TypeError) => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
 
   const toUpdateL1Planprice = (mattressid: number) => {
     ElMessageBox.confirm(`是否确定要更新计划价?`, "询问", {
@@ -1938,6 +1961,7 @@ export const useHooks = (t?: any) => {
     RefreshMattressInterfaceQdList,
     fModelChoseMattress,
     toExcel,
+    toCreateMtrl,
     toCreateORDelMtrlPf,
     toUpdateL1Planprice,
     YWAudit,