瀏覽代碼

JLHWEB: 1、床垫清单,生成物料\清单支持批量设置;2、床垫清单更改地址;

JohnnyChan 1 月之前
父節點
當前提交
6867e714cc

+ 3 - 3
JLHWEB/src/api/modules/common.ts

@@ -101,7 +101,7 @@ export const GetERPMtrlTypeList = () => {
  * @param params
  * @returns
  */
-export const CreatMtrlPf = (params?: Mattress.ReqRefreshMattressInterface) => {
+export const CreatMtrlPf = (params?: Mattress.ReqMultiMattressBcp) => {
   return http.post<Mattress.ResSaveMattressBcp>(PORT1 + `/CreatMtrldef`, params);
 };
 /**
@@ -109,7 +109,7 @@ export const CreatMtrlPf = (params?: Mattress.ReqRefreshMattressInterface) => {
  * @param params
  * @returns
  */
-export const CreatPrdPf = (params?: Mattress.ReqRefreshMattressInterface) => {
+export const CreatPrdPf = (params?: Mattress.ReqMultiMattressBcp) => {
   return http.post(PORT1 + `/CreatPrdPf`, params);
 };
 
@@ -118,6 +118,6 @@ export const CreatPrdPf = (params?: Mattress.ReqRefreshMattressInterface) => {
  * @param params
  * @returns
  */
-export const DelMtrlPf = (params?: Mattress.ReqRefreshMattressInterface) => {
+export const DelMtrlPf = (params?: Mattress.ReqMultiMattressBcp) => {
   return http.post(PORT1 + `/DelMtrlPf`, params);
 };

+ 30 - 12
JLHWEB/src/components/LjDetail/index.vue

@@ -125,17 +125,18 @@ const detailData_api = ref();
  * @description 主表数据,影子,只读
  */
 // const _mainData = computed(() => tableData.value[0] ?? props.data[0] ?? infoParam.value);
-const _mainData = computed(() => {
-  // console.log("_mainData tableData.value[0] :>> ", tableData.value, tableData.value[0]);
-  // console.log("_mainData props.data.value[0] :>> ", props.data, props.data[0]);
-  // console.log("_mainData infoParam.value[0] :>> ", infoParam.value);
-  // console.log(
-  //   "tableData.value[0] ?? props.data[0] ?? infoParam.value :>> ",
-  //   tableData.value[0] ?? (props.data.length && props.data[0]) ?? infoParam.value,
-  //   tableData.value[0] ?? { ...infoParam.value, ...props.data[0] }
-  // );
-  return tableData.value[0] ?? { ...infoParam.value, ...props.data[0] };
-});
+// const _mainData = computed(() => {
+//   // console.log("_mainData tableData.value[0] :>> ", tableData.value, tableData.value[0]);
+//   // console.log("_mainData props.data.value[0] :>> ", props.data, props.data[0]);
+//   // console.log("_mainData infoParam.value[0] :>> ", infoParam.value);
+//   // console.log(
+//   //   "tableData.value[0] ?? props.data[0] ?? infoParam.value :>> ",
+//   //   tableData.value[0] ?? (props.data.length && props.data[0]) ?? infoParam.value,
+//   //   tableData.value[0] ?? { ...infoParam.value, ...props.data[0] }
+//   // );
+//   return tableData.value[0] ?? { ...infoParam.value, ...props.data[0] };
+// });
+const _mainData = ref<any>({});
 /**
  * @description 详情数据,影子,只读
  */
@@ -1540,7 +1541,7 @@ const RenderDetailHeader = (rProp: any) => {
 
 const tasItemRender = (data: detailModelItemProp, renderFnc: any, header = true, disabled = false) => {
   let val = _detailData.value && _detailData.value[data.id];
-  console.log(" _detailData.value :>> ", _detailData.value, data.id);
+  // console.log(" _detailData.value :>> ", _detailData.value, data.id);
   let vanSlot: any = {};
   if (slots[data.id + "__tabtitle"]) {
     vanSlot.title = () => {
@@ -1895,6 +1896,23 @@ const RenderLjDetail = (rProps: DetailProp) => {
   }
 };
 
+watch(
+  () => props.data,
+  val => {
+    if (val.length > 0) {
+      _mainData.value = { ...infoParam.value, ...val[0] };
+    } else {
+      _mainData.value = { ...infoParam.value };
+    }
+  }
+);
+watch(
+  () => tableData.value,
+  val => {
+    _mainData.value = val[0] ?? { ...infoParam.value, ...props.data[0] };
+  }
+);
+
 defineExpose({
   element: LjDetailRef,
   baseformRef: LjDetailBaseFormRef,

+ 8 - 2
JLHWEB/src/components/LjVxeTable/index.vue

@@ -566,7 +566,7 @@ const _defineProps = ref({
       return true;
     }
   },
-  columnConfig: { isHover: true, resizable: true },
+  columnConfig: { isCurrent: true, isHover: true, resizable: true },
   exportConfig: {},
   sortConfig: { trigger: "cell", multiple: true, chronological: true, defaultSort: {}, showIcon: false },
   checkboxConfig: { checkField: "checked", range: true },
@@ -2780,6 +2780,11 @@ const currentEditCell = ref<any>({
   rowIndex: 0
 });
 
+const scrollTo = (row: any, field: any) => {
+  tableRef.value.setCurrentRow(row);
+  tableRef.value.scrollToRow(row, field);
+};
+
 // 暴露给父组件的参数和方法(外部需要什么,都可以从这里暴露出去)
 defineExpose({
   element: tableRef,
@@ -2804,7 +2809,8 @@ defineExpose({
   // selectedList,
   // selectedListIds
   initLayoutColumns,
-  currentEditCell
+  currentEditCell,
+  scrollTo
 });
 </script>
 

+ 1 - 3
JLHWEB/src/languages/modules/zh-cn/menu.json

@@ -165,9 +165,7 @@
   "semifinprodQuoteAdd": "新建半成品报价",
   "mattressInterface": "床垫清单",
   "mattressInterfaceDetail": "床垫清单详情",
-  "mattressInterfaceEditYw": "床垫清单-业务补充",
-  "mattressInterfaceEditCp": "床垫清单-产品补充",
-  "mattressInterfaceEditQd": "床垫清单-清单补充",
+  "mattressInterfaceEditYw": "修改床垫清单",
   "erpapi": "ERP接口",
   "extra": "床垫额外费用定义"
 }

+ 22 - 9
JLHWEB/src/layouts/components/Tabs/index.vue

@@ -95,13 +95,15 @@ watch(
     };
     console.log("tabStore :>> ", tabStore, route);
     let isReplace = false;
-    if (tabsParams.path.indexOf("/edit?") > -1) {
+    if (tabsParams.path.indexOf("/edit?") > -1 || tabsParams.path.indexOf("/edit/") > -1) {
       let key = "/edit?";
       let name = "";
       let _path = tabsParams.path.replace(key, "/detail?");
+      // 使用路由参数的地址,忽略查询参数后,查找相同地址
+      let _path2 = tabsParams.path.replace("/edit/", "/detail/");
       let tabsMenuList = tabStore.tabsMenuList;
       for (let i = 0; i < tabsMenuList.length; i++) {
-        if (tabsMenuList[i].path == _path) {
+        if (tabsMenuList[i].path == _path || tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0]) {
           name = tabsMenuList[i].name;
           tabsMenuList[i] = tabsParams;
           isReplace = true;
@@ -110,24 +112,26 @@ watch(
       }
       console.log("keilll name :>> ", name);
       tabStore.setTabs(tabsMenuList);
-      name && keepAliveStore.removeKeepAliveName(name);
-    } else if (tabsParams.path.indexOf("/detail?") > -1) {
+      name && keepAliveStore.removeKeepAliveName(route);
+    } else if (tabsParams.path.indexOf("/detail?") > -1 || tabsParams.path.indexOf("/detail/") > -1) {
       let key = "/detail?";
       let _path = tabsParams.path.replace(key, "/edit?");
+      // 使用路由参数的地址,忽略查询参数后,查找相同地址
+      let _path2 = tabsParams.path.replace("/detail/", "/edit/");
       let tabsMenuList = tabStore.tabsMenuList;
       for (let i = 0; i < tabsMenuList.length; i++) {
-        if (tabsMenuList[i].path == _path) {
+        if (tabsMenuList[i].path == _path || tabsMenuList[i].path.split("?")[0] == _path2.split("?")[0]) {
           tabsMenuList[i] = tabsParams;
           isReplace = true;
           break;
         }
       }
       tabStore.setTabs(tabsMenuList);
-      route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route.name as string);
+      route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
       console.log("add keepAliveStore.keepAliveName :>> ", keepAliveStore.keepAliveName);
     }
     !isReplace && tabStore.addTabs(tabsParams);
-    !isReplace && route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route.name as string);
+    !isReplace && route.meta.isKeepAlive && keepAliveStore.addKeepAliveName(route);
   },
   { immediate: true }
 );
@@ -170,8 +174,17 @@ const tabClick = (tabItem: TabsPaneContext) => {
 
 // Remove Tab
 const tabRemove = (fullPath: TabPaneName) => {
-  const name = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0].name || "";
-  keepAliveStore.removeKeepAliveName(name);
+  // const name = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0].name || "";
+  let routeItem = tabStore.tabsMenuList.filter(item => item.path == fullPath)[0];
+  console.log("tabRemove tabStore.tabsMenuList :>> ", tabStore.tabsMenuList);
+  console.log("tabRemove routeItem :>> ", routeItem);
+  keepAliveStore.removeKeepAliveName(routeItem);
+  let arr = keepAliveStore.getKeepAliveList;
+
+  arr = arr.filter(item => item.fullPath !== routeItem.path);
+  console.log("tabRemove arr :>> ", arr);
+  keepAliveStore.setKeepAliveList(arr);
+
   tabStore.removeTabs(fullPath as string, fullPath == route.fullPath);
 };
 

+ 36 - 36
JLHWEB/src/routers/modules/erpApiRouter.ts

@@ -65,12 +65,12 @@ export const erpApiRouter: Menu.MenuOptions[] = [
           //   }
           // }
           {
-            path: "/erpapi/mattressInterface/detail",
+            path: "/erpapi/mattressInterface/detail/:id",
             name: "mattressInterfaceDetail",
             component: "/erpapi/mattressInterface/detail",
             meta: {
               icon: "iconpackage",
-              title: "床垫接口详情",
+              title: "床垫清单详情",
               isLink: "",
               isHide: true,
               isFull: false,
@@ -81,44 +81,12 @@ export const erpApiRouter: Menu.MenuOptions[] = [
             }
           },
           {
-            path: "/erpapi/mattressInterface/1/edit",
+            path: "/erpapi/mattressInterface/edit/:id",
             name: "mattressInterfaceEditYw",
             component: "/erpapi/mattressInterface/detail",
             meta: {
               icon: "iconpackage",
-              title: "修改床垫接口-业务补充",
-              isLink: "",
-              isHide: true,
-              isFull: false,
-              isAffix: false,
-              isKeepAlive: false,
-              funid: 71,
-              activeMenu: "/erpapi/mattressInterface"
-            }
-          },
-          {
-            path: "/erpapi/mattressInterface/2/edit",
-            name: "mattressInterfaceEditCp",
-            component: "/erpapi/mattressInterface/detail",
-            meta: {
-              icon: "iconpackage",
-              title: "修改床垫接口-产品补充",
-              isLink: "",
-              isHide: true,
-              isFull: false,
-              isAffix: false,
-              isKeepAlive: false,
-              funid: 71,
-              activeMenu: "/erpapi/mattressInterface"
-            }
-          },
-          {
-            path: "/erpapi/mattressInterface/3/edit",
-            name: "mattressInterfaceEditQd",
-            component: "/erpapi/mattressInterface/detail",
-            meta: {
-              icon: "iconpackage",
-              title: "修改床垫接口-清单补充",
+              title: "修改床垫清单",
               isLink: "",
               isHide: true,
               isFull: false,
@@ -128,6 +96,38 @@ export const erpApiRouter: Menu.MenuOptions[] = [
               activeMenu: "/erpapi/mattressInterface"
             }
           }
+          // {
+          //   path: "/erpapi/mattressInterface/2/edit",
+          //   name: "mattressInterfaceEditCp",
+          //   component: "/erpapi/mattressInterface/detail",
+          //   meta: {
+          //     icon: "iconpackage",
+          //     title: "修改床垫接口-产品补充",
+          //     isLink: "",
+          //     isHide: true,
+          //     isFull: false,
+          //     isAffix: false,
+          //     isKeepAlive: false,
+          //     funid: 71,
+          //     activeMenu: "/erpapi/mattressInterface"
+          //   }
+          // },
+          // {
+          //   path: "/erpapi/mattressInterface/3/edit",
+          //   name: "mattressInterfaceEditQd",
+          //   component: "/erpapi/mattressInterface/detail",
+          //   meta: {
+          //     icon: "iconpackage",
+          //     title: "修改床垫接口-清单补充",
+          //     isLink: "",
+          //     isHide: true,
+          //     isFull: false,
+          //     isAffix: false,
+          //     isKeepAlive: false,
+          //     funid: 71,
+          //     activeMenu: "/erpapi/mattressInterface"
+          //   }
+          // }
         ]
       }
     ]

+ 1 - 0
JLHWEB/src/styles/reset.scss

@@ -178,6 +178,7 @@
 
 .vxe-table--body-wrapper.fixed-left--wrapper {
   overflow-x: hidden !important;
+  padding-bottom: 13px;
 }
 
 .el-select__selected-item {

+ 89 - 27
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -33,8 +33,8 @@
       </div>
     </template>
     <template #mattressQD>
-      <el-row class="h-full" :gutter="10">
-        <el-col :span="6" class="h-full">
+      <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
+        <template #left>
           <LjVxeTable
             ref="YwTableRef"
             row-key="key"
@@ -49,8 +49,8 @@
             collapseButtons
           >
           </LjVxeTable>
-        </el-col>
-        <el-col :span="18" class="h-full">
+        </template>
+        <div class="main-box flx-col">
           <LjVxeTable
             ref="QdTableRef"
             row-key="key"
@@ -65,8 +65,8 @@
             collapseButtons
           >
           </LjVxeTable>
-        </el-col>
-      </el-row>
+        </div>
+      </LjFoldLayout>
     </template>
   </LjDetail>
 
@@ -75,7 +75,7 @@
 </template>
 
 <script setup lang="tsx" name="mattressInterfaceDetail">
-import { ref, watch, reactive, inject, onMounted, computed, nextTick } from "vue";
+import { ref, watch, reactive, inject, onMounted, computed, nextTick, onBeforeMount } from "vue";
 import { DwnameEnum } from "@/enums/dwnameEnum";
 import LjDetail from "@/components/LjDetail/index.vue";
 import { DetailProp } from "@/components/LjDetail/interface";
@@ -91,6 +91,7 @@ import { MittEnum } from "@/enums/mittEnum";
 import MattressDialog from "@/views/system/selector/mattress/index.vue";
 import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
 import { formatToDate } from "@/utils/dateUtil";
+import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
 
 interface detailProp {
   /**
@@ -145,7 +146,7 @@ const {
   toExcel,
   toCreateMtrl,
   toCreateORDelMtrlPf,
-  toUpdateL1Planprice,
+  // toUpdateL1Planprice,
   YWAudit,
   JSAudit,
   JS2Audit,
@@ -155,6 +156,8 @@ const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const initParams = ref({ mattressid: 0 as Number });
 
+const layoutSetting = reactive({});
+
 const detailProps = reactive<DetailProp>({
   dwname: DwnameEnum.mattressInterfaceDetail,
   columns: columns_detail,
@@ -193,10 +196,8 @@ const qdAction = [
     label: "批量设置",
     clickFunc: () => {
       let _cur = QdTableRef.value.currentEditCell;
-      console.log("qdAction _cur :>> ", _cur);
-      console.log("qdAction ![d) :>> ", !["wrkgrpid", "wrkgrpid2", "useqty"].includes(_cur.field));
 
-      if (!["wrkgrpid", "wrkgrpid2", "useqty"].includes(_cur.field)) {
+      if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
         return ElMessage.warning("此列暂不支持批量设置(仅支持实际用量、工组)");
       }
       // return mattressQDList.value.length == 0;
@@ -209,7 +210,7 @@ const qdAction = [
       if (visibleData) {
         let _val = visibleData[_cur.rowIndex];
         _data = visibleData.map((o, idx) => {
-          if (o.useqty > 0 && idx > _cur.rowIndex) {
+          if (o.actual_useqty > 0 && idx > _cur.rowIndex) {
             o[_cur.field] = _val[_cur.field];
             if (_cur.field == "wrkgrpid1") {
               o.wrkgrpcode1 = _val.wrkgrpcode1;
@@ -217,11 +218,18 @@ const qdAction = [
               o.wrkgrpcode2 = _val.wrkgrpcode2;
             }
           }
+          if (_cur.field == "actual_useqty") {
+            if (o.useqty > 0 && idx > _cur.rowIndex) {
+              o[_cur.field] = _val[_cur.field];
+            }
+          }
           return o;
         });
 
         $table.reloadData(_data);
         resetMergeCellsQd();
+
+        ElMessage.success("批设成功(有实际用量的数据行)");
       }
     }
   })
@@ -235,9 +243,21 @@ const orderDefaultAction = [
       return !orderStatus.value;
     },
     clickFunc: item => {
-      router.replace(
-        `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
-      );
+      // router.replace(
+      //   `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
+      // );
+
+      const _cur = mainData.value[0];
+      router.push({
+        name: "mattressInterfaceDetail",
+        params: {
+          id: _cur.mattressid
+        },
+        query: {
+          code: _cur.mattresscode
+        },
+        replace: true
+      });
     }
   }),
   buttonDefault({
@@ -270,10 +290,23 @@ const orderDefaultAction = [
                   message: t("sys.api.sueccessToSave"),
                   type: "success"
                 });
-                tabRemove(route.fullPath);
-                router.push(
-                  `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
-                );
+                // tabRemove(route.fullPath);
+                // router.replace(
+                //   `/erpapi/mattressInterface/detail?id=${LjDetailRef.value?._mainData.mattressid}&code=${LjDetailRef.value?._mainData.mattresscode}`
+                // );
+
+                // const _cur = LjDetailRef.value?._mainData;
+                // router.push({
+                //   name: "mattressInterfaceDetail",
+                //   params: {
+                //     id: _cur.mattressid
+                //   },
+                //   query: {
+                //     code: _cur.mattresscode
+                //   },
+                //   replace: true
+                // });
+                // LjDetailRef.value.refresh();
                 loadingStatus.save = false;
               })
               .catch(error => {
@@ -504,23 +537,31 @@ const orderDefaultAction = [
   ],
   buttonDefault({
     label: "生成/更新物料",
-    power: 90,
+    power: 88,
     limited: () => {
       return !!orderStatus.value;
     },
     clickFunc: item => {
-      toCreateMtrl(1, LjDetailRef.value?._mainData.mattressid);
+      toCreateMtrl(1, { list: [LjDetailRef.value?._mainData.mattressid] });
     }
   }),
   [
     buttonDefault({
       label: "生成金蝶清单",
       power: 90,
+      disabledTextCallBack: (data: any) => {
+        console.log("生成金蝶清单 disabledTextCallBack data", data);
+        if (data.js2_flag == 0) {
+          return "床垫清单未审核,无法生成金蝶清单";
+        }
+
+        return "";
+      },
       limited: () => {
         return !!orderStatus.value;
       },
       clickFunc: item => {
-        toCreateORDelMtrlPf(1, LjDetailRef.value?._mainData.mattressid);
+        toCreateORDelMtrlPf(1, { list: [LjDetailRef.value?._mainData.mattressid] });
       }
     })
     // buttonDefault({
@@ -550,9 +591,22 @@ const orderDefaultAction = [
 ];
 
 const routeToEdit = (type: any) => {
-  console.log("routeToEdit mainData :>> ", mainData);
+  console.log("routeToEdit mainData :>> ", mainData, route.fullPath);
+
   const _cur = mainData.value[0];
-  router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
+  // router.replace(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
+
+  router.push({
+    name: "mattressInterfaceEditYw",
+    params: {
+      id: _cur.mattressid
+    },
+    query: {
+      code: _cur.mattresscode,
+      type: type
+    },
+    replace: true
+  });
 };
 
 /**
@@ -576,6 +630,14 @@ const funcAfterMound = async () => {
   }
 };
 
+onBeforeMount(() => {
+  if (route.params?.id) {
+    // 刷新数据
+    initParams.value.mattressid = Number(route.params?.id);
+    editType.value = Number(route.query?.type);
+  }
+});
+
 onMounted(async () => {
   console.log("route onMounted:>> ", route);
   console.log("route onMounted:>> ", route.params);
@@ -603,10 +665,10 @@ onMounted(async () => {
   const result2 = await GetERPWrkGrpList2();
   workgrpEnum2.value = result2.datatable ?? [];
 
-  if (route.query?.id) {
+  if (route.params?.id) {
     // 刷新数据
-    initParams.value.mattressid = Number(route.query?.id);
-    editType.value = Number(route.query?.type);
+    // initParams.value.mattressid = Number(route.params?.id);
+    // editType.value = Number(route.query?.type);
     console.log("detail onMounted initParams.value :>> ", initParams.value);
     console.log("领用工组领用工组领用工组领用工组 columns_qd.value :>> ", columns_qd.value);
     await RetriveMattressInterface(initParams.value.mattressid.valueOf());

+ 62 - 34
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -83,15 +83,34 @@ export const useHooks = (t?: any) => {
     configureTypeEnum: []
   });
 
-  const toCreateORDelMtrlPf = (type: number, mattressid: number) => {
+  const toCreateORDelMtrlPf = (type: number, list: any) => {
     if (type === 1) {
+      const $table = state.QdTableRef.element;
+      if ($table) {
+        $table.clearEdit();
+
+        const { visibleData } = $table.getTableData();
+        console.log("visibleData :>> ", visibleData);
+        try {
+          visibleData.map((o, idx) => {
+            if (!o.erp_mtrlid && idx > 35) {
+              state.QdTableRef.scrollTo(o, "erp_mtrlid");
+              throw new Error(`第${idx + 1}行:产品补充未填入L1物料信息,请先选择L1物料修改`);
+            }
+          });
+        } catch (error) {
+          ElMessage.error(error.message);
+          return false;
+        }
+      }
+
       ElMessageBox.confirm(`是否确定要生成金蝶清单?`, "询问", {
         confirmButtonText: t("common.okText"),
         cancelButtonText: "否",
         type: "warning"
       })
         .then(() => {
-          CreatPrdPf({ mattressid }).then(() => {
+          CreatPrdPf({ list }).then(() => {
             ElNotification({
               title: "金蝶清单",
               message: "生成成功!",
@@ -113,7 +132,7 @@ export const useHooks = (t?: any) => {
         type: "warning"
       })
         .then(() => {
-          DelMtrlPf({ mattressid }).then(() => {
+          DelMtrlPf({ list }).then(() => {
             ElMessage.success("删除成功!");
           });
         })
@@ -126,14 +145,14 @@ export const useHooks = (t?: any) => {
         });
     }
   };
-  const toCreateMtrl = (type: number, mattressid: number) => {
+  const toCreateMtrl = (type: number, list: any) => {
     ElMessageBox.confirm(`是否确定要生成/更新物料?`, "询问", {
       confirmButtonText: t("common.okText"),
       cancelButtonText: "否",
       type: "warning"
     })
       .then(() => {
-        CreatMtrlPf({ mattressid }).then(res => {
+        CreatMtrlPf({ list }).then(res => {
           console.log("toCreateMtrl, res :>> ", res);
 
           state.LjDetailRef._mainData.erp_mtrlid = res.mattress.erp_mtrlid;
@@ -154,29 +173,29 @@ export const useHooks = (t?: any) => {
       });
   };
 
-  const toUpdateL1Planprice = (mattressid: number) => {
-    ElMessageBox.confirm(`是否确定要更新计划价?`, "询问", {
-      confirmButtonText: t("common.okText"),
-      cancelButtonText: "否",
-      type: "warning"
-    })
-      .then(() => {
-        CreatMtrlPf({ mattressid }).then(() => {
-          ElNotification({
-            title: "更新计划价",
-            message: "更新成功!",
-            type: "success"
-          });
-        });
-      })
-      .catch((e: TypeError) => {
-        console.log("e :>> ", e);
-        ElMessage({
-          type: "info",
-          message: "操作取消"
-        });
-      });
-  };
+  // const toUpdateL1Planprice = (mattressid: number) => {
+  //   ElMessageBox.confirm(`是否确定要更新计划价?`, "询问", {
+  //     confirmButtonText: t("common.okText"),
+  //     cancelButtonText: "否",
+  //     type: "warning"
+  //   })
+  //     .then(() => {
+  //       CreatMtrlPf({ mattressid }).then(() => {
+  //         ElNotification({
+  //           title: "更新计划价",
+  //           message: "更新成功!",
+  //           type: "success"
+  //         });
+  //       });
+  //     })
+  //     .catch((e: TypeError) => {
+  //       console.log("e :>> ", e);
+  //       ElMessage({
+  //         type: "info",
+  //         message: "操作取消"
+  //       });
+  //     });
+  // };
 
   const ywFlagChange = (value: any) => {
     console.log("value :>> ", value);
@@ -684,7 +703,6 @@ export const useHooks = (t?: any) => {
       ],
       editRender: {
         name: "$select",
-        enabled: false,
         options: [
           {
             value: 0,
@@ -892,7 +910,8 @@ export const useHooks = (t?: any) => {
     {
       field: "bj_pzname",
       title: "二级项目",
-      fixed: "left"
+      fixed: "left",
+      width: 120
     },
     {
       field: "bj_pzname_mx",
@@ -1072,7 +1091,7 @@ export const useHooks = (t?: any) => {
                 let rs = [];
                 if (state.workgrpEnum.length) {
                   state.workgrpEnum.map((t: any) => {
-                    rs.push(<el-option label={t.label} value={t.value} />);
+                    rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.value} />);
                   });
                 }
                 return rs;
@@ -1118,7 +1137,7 @@ export const useHooks = (t?: any) => {
                 let rs = [];
                 if (state.workgrpEnum2.length) {
                   state.workgrpEnum2.map((t: any) => {
-                    rs.push(<el-option label={t.label} value={t.value} />);
+                    rs.push(<el-option label={`${t.code} - ${t.label}`} value={t.value} />);
                   });
                 }
                 return rs;
@@ -1452,10 +1471,19 @@ export const useHooks = (t?: any) => {
     editConfig: {
       trigger: "click",
       mode: "cell",
-      enabled: false
+      enabled: false,
       // afterEditMethod: ({ row, rowIndex, column, columnIndex }) => {
       //   console.log("afterEditMethod :>> ", row);
       // }
+      beforeEditMethod: ({ row, rowIndex, column, columnIndex }) => {
+        console.log("state.editType == 1 :>> ", state.editType, column.field);
+        if (state.editType == 1) {
+          if (["bj_inputtype"].includes(column.field)) {
+            return false;
+          }
+        }
+        return true;
+      }
     },
     showOverflow: false,
     // exportConfig: {
@@ -1978,7 +2006,7 @@ export const useHooks = (t?: any) => {
     toExcel,
     toCreateMtrl,
     toCreateORDelMtrlPf,
-    toUpdateL1Planprice,
+    // toUpdateL1Planprice,
     YWAudit,
     JSAudit,
     JS2Audit,

+ 62 - 16
JLHWEB/src/views/erpapi/mattressInterface/index.vue

@@ -47,7 +47,7 @@ import { getCurrentRecords } from "@/utils/index";
 const { t } = useI18n();
 const router = useRouter();
 const globalStore = useGlobalStore();
-const { initParams, columns, toCreateORDelMtrlPf, YWAudit, JSAudit, JS2Audit } = useHooks(t);
+const { initParams, columns, toCreateMtrl, toCreateORDelMtrlPf, YWAudit, JSAudit, JS2Audit } = useHooks(t);
 // const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
@@ -84,7 +84,14 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
     window.open(routeUrl.href, "_blank");
   } else {
     // 打开新的标签页
-    router.push(`/erpapi/mattressInterface/detail?id=${row.mattressid}&code=${row.mattresscode}`);
+    // router.push(`/erpapi/mattressInterface/detail?id=${row.mattressid}&code=${row.mattresscode}`);
+
+    router.push({
+      path: `/erpapi/mattressInterface/detail/${row.mattressid}`,
+      query: {
+        code: row.mattresscode
+      }
+    });
   }
 };
 
@@ -231,8 +238,8 @@ const action: detailAction[] = [
   ],
   [
     buttonDefault({
-      label: "生成金蝶清单",
-      power: 90,
+      label: "生成/更新物料",
+      power: 88,
       clickFunc: item => {
         const { curRecords } = getCurrentRecords(vxeTableRef.value);
 
@@ -240,13 +247,15 @@ const action: detailAction[] = [
           ElMessage.warning(t("business.tips.mattress.records"));
           return;
         }
-
-        toCreateORDelMtrlPf(1, curRecords[curRecords.length - 1].mattressid);
+        let list = curRecords.map(item => item.mattressid);
+        toCreateMtrl(1, list);
       }
-    }),
+    })
+  ],
+  [
     buttonDefault({
-      label: "删除金蝶清单",
-      power: 91,
+      label: "生成金蝶清单",
+      power: 90,
       clickFunc: item => {
         const { curRecords } = getCurrentRecords(vxeTableRef.value);
 
@@ -255,9 +264,24 @@ const action: detailAction[] = [
           return;
         }
 
-        toCreateORDelMtrlPf(0, curRecords[curRecords.length - 1].mattressid);
+        let list = curRecords.map(item => item.mattressid);
+        toCreateORDelMtrlPf(1, list);
       }
     })
+    // buttonDefault({
+    //   label: "删除金蝶清单",
+    //   power: 91,
+    //   clickFunc: item => {
+    //     const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+    //     if (!curRecords.length) {
+    //       ElMessage.warning(t("business.tips.mattress.records"));
+    //       return;
+    //     }
+
+    //     toCreateORDelMtrlPf(0, curRecords[curRecords.length - 1].mattressid);
+    //   }
+    // })
   ]
 ];
 
@@ -286,13 +310,35 @@ const routeToEdit = type => {
     return;
   }
 
-  const _cur = $table.getCurrentRecord() ?? null;
-  if (_cur) {
-    router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
-  } else {
-    const _cur = curRecords[curRecords.length - 1];
-    router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
+  const _cur = curRecords[curRecords.length - 1];
+  // router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
+
+  try {
+    if (type === 1) {
+      if (_cur.yw_flag == 1) {
+        throw new Error(_cur.mattresscode + ":已业务补充审核,无法修改");
+      }
+    } else if (type === 2) {
+      if (_cur.js1_flag == 1) {
+        throw new Error(_cur.mattresscode + ":已产品补充审核,无法修改");
+      }
+    } else if (type === 3) {
+      if (_cur.js2_flag == 1) {
+        throw new Error(_cur.mattresscode + ":已清单补充审核,无法修改");
+      }
+    }
+  } catch (error) {
+    ElMessage.error(error.message);
+    return false;
   }
+
+  router.push({
+    path: `/erpapi/mattressInterface/edit/${_cur.mattressid}`,
+    query: {
+      code: _cur.mattresscode,
+      type: type
+    }
+  });
 };
 
 /**

+ 0 - 1
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -4469,7 +4469,6 @@ export const useHooks = (t?: any) => {
 
         return (
           <>
-            {row.formulakind}
             <MtrldefSelect
               value={row.mtrlid}
               {...params}