Browse Source

JLHWEB: 1、详情页组件支持tree-select显示父节点信息
2、床垫清单,产品配置tab可修改/录入
3、床垫报价:垫层、內布套标签页,新增特定尺寸(规格长、规格宽)默认0时读取床垫尺寸;
4、修复选择erp物料弹窗,获取数据逻辑

JohnnyChan 1 month ago
parent
commit
015e23af60

+ 1 - 0
JLHWEB/src/api/interface/index.ts

@@ -1279,6 +1279,7 @@ export namespace Mattress {
     mattressid: number;
     isPz?: number;
     isCheck?: number;
+    isEdit?: number;
   }
   export interface ResRefreshMattressInterface {
     mxList: any[];

+ 47 - 1
JLHWEB/src/components/LjDetail/components/BaseFormItem.vue

@@ -32,6 +32,9 @@
       }}</component>
     </template>
     <slot v-else></slot>
+    <template #label="scope" v-if="column?.el === 'tree-select'">
+      {{ getSimpleParentNodes(scope.value) }}
+    </template>
     <template #decrease-icon v-if="column?.el === 'input-number'">
       <el-icon><Minus /></el-icon>
     </template>
@@ -92,13 +95,14 @@ const enumData = computed(() => {
 });
 const columnEnum = computed(() => {
   let enumData = enumMap.value.get(props.field);
-  console.log("enumData :>> ", enumData, props.field, enumMap.value);
+  // console.log("enumData :>> ", enumData, props.field, enumMap.value);
   if (!enumData) return [];
   if (props.column?.el === "select-v2" && props.fieldNames) {
     enumData = enumData.map((item: { [key: string]: any }) => {
       return { ...item, label: item[props.fieldNames.label], value: item[props.fieldNames.value] };
     });
   }
+  console.log("enumData :>> ", enumData, props.fieldNames, enumMap.value);
   return enumData;
 });
 
@@ -134,4 +138,46 @@ const clearable = computed(() => {
   const search = props.column;
   return search?.props?.clearable ?? (search?.defaultValue == null || search?.defaultValue == undefined);
 });
+
+/**
+ * @description 查找父级节点
+ * @param tree 数据源
+ * @param targetId 目标值
+ * @param key 目标字段
+ * @param path
+ */
+const findParentNodes = (tree, targetId, key = "id", path = []) => {
+  for (const node of tree) {
+    if (node[key] === targetId) {
+      return [...path, node];
+    }
+    if (node.children.length > 0) {
+      const result = findParentNodes(node.children, targetId, key, [...path, node]);
+      if (result) {
+        return result;
+      }
+    }
+  }
+  return null;
+};
+
+/**
+ * @description 显示父级节点名称
+ * @param tree 数据源
+ * @param targetId 目标值
+ * @param key 目标字段
+ */
+const getSimpleParentNodes = targetId => {
+  let parentNodes = findParentNodes(columnEnum.value, targetId, props.fieldNames.value);
+  if (!parentNodes) {
+    return null;
+  }
+  parentNodes = parentNodes.map(node => {
+    let item = { ...node };
+    delete item.children;
+    return item;
+  });
+
+  return parentNodes.map(node => node.mtrltype).join(" >> ");
+};
 </script>

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

@@ -131,6 +131,7 @@ const {
   MtrldefErpDialogProps,
   tableProps_mx,
   workgrpEnum,
+  configureTypeEnum,
   RetriveMattressInterface,
   RefreshMattressInterfaceList,
   RefreshMattressInterfaceQdList,

+ 47 - 57
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -47,6 +47,7 @@ interface defaultState {
   MtrldefErpDialogRef: any;
   MtrldefErpDialogProps: any;
   workgrpEnum: any;
+  configureTypeEnum: any;
   VxeTableMxRef: any;
   YwTableRef: any;
   QdTableRef: any;
@@ -73,7 +74,8 @@ export const useHooks = (t?: any) => {
     MattressDialogProps: {},
     MtrldefErpDialogRef: null,
     MtrldefErpDialogProps: {},
-    workgrpEnum: []
+    workgrpEnum: [],
+    configureTypeEnum: []
   });
 
   const toCreateORDelMtrlPf = (type: number, mattressid: number) => {
@@ -434,9 +436,7 @@ export const useHooks = (t?: any) => {
             // fModelChoseMtrl()
           }
         },
-        editable: () => {
-          return false;
-        },
+        editable: ALLOW_EDIT_STATE,
         group: "单据信息",
         order: 1,
         span: 1
@@ -447,9 +447,7 @@ export const useHooks = (t?: any) => {
       title: "新物料名称",
       basicinfo: {
         el: "input",
-        editable: () => {
-          return false;
-        },
+        editable: ALLOW_EDIT_STATE,
         group: "单据信息",
         order: 4,
         span: 1
@@ -478,20 +476,30 @@ export const useHooks = (t?: any) => {
       }
     },
     {
-      field: "erp_mtrltype",
+      field: "erp_mtrltypeid",
       title: "物料类别",
       basicinfo: {
         el: "tree-select",
         editable: ALLOW_EDIT_STATE,
         group: "单据信息",
         order: 3,
-        span: 1
+        span: 1,
+        props: {
+          filterable: true
+          // onChange: ()=> {
+
+          // },
+          // renderContent: data => {
+          //   console.log("erp_mtrltypeid value data :>> ", data);
+          //   return <div>321</div>;
+          // }
+        }
+      },
+      enum: async () => {
+        const data = await GetERPMtrlTypeList();
+        console.log("GetERPMtrlTypeList data :>> ", data?.reList);
+        return transformTreeData(data.reList);
       },
-      // enum: async () => {
-      //   const data = await GetERPMtrlTypeList();
-      //   console.log("GetERPMtrlTypeList data :>> ", data?.DataList);
-      //   return transformTreeData(data.DataList);
-      // },
       fieldNames: {
         label: "mtrltype",
         value: "mtrltypeid",
@@ -502,11 +510,28 @@ export const useHooks = (t?: any) => {
       field: "erp_configcodetype",
       title: "配置类型",
       basicinfo: {
-        el: "input",
+        el: "select",
         editable: ALLOW_EDIT_STATE,
         group: "单据信息",
         order: 6,
         span: 1
+      },
+      enum: async () => {
+        const data = await getConfigureTypeList({});
+
+        console.log("data configureTypeEnum:>> ", data);
+
+        // let dataEnum = data.datatable.map(item => {
+        //   return {
+        //     label: item.configuretypename,
+        //     value: item.configuretypeid
+        //   };
+        // });
+        return data.datatable;
+      },
+      fieldNames: {
+        label: "contfigtypename",
+        value: "contfigtypeid"
       }
     },
     {
@@ -620,7 +645,7 @@ export const useHooks = (t?: any) => {
         if (row.bj_inputtype == "0") {
           return (
             <CodemxSelect
-              value={row.mtrlid}
+              value={scope.row.mtrlid}
               {...params}
               clearable
               placeholder="请选择配置"
@@ -629,7 +654,7 @@ export const useHooks = (t?: any) => {
             ></CodemxSelect>
           );
         } else if (row.bj_inputtype == "1") {
-          return <el-input v-model={row.bj_namemx} />;
+          return <el-input v-model={scope.row.bj_namemx} />;
         } else {
           return <span>{row.bj_namemx}</span>;
         }
@@ -696,19 +721,13 @@ export const useHooks = (t?: any) => {
     },
     {
       field: "bj_namemx",
-      title: "明细名称",
-      editRender: {
-        name: "$input"
-      }
+      title: "明细名称"
     },
     {
       field: "actual_size",
       title: "生产尺寸",
       limited: () => {
         return state.editType == 1;
-      },
-      editRender: {
-        name: "$input"
       }
     },
     {
@@ -741,24 +760,7 @@ export const useHooks = (t?: any) => {
           value: "2",
           label: "带出"
         }
-      ],
-      editRender: {
-        name: "$select",
-        options: [
-          {
-            value: "0",
-            label: "选择"
-          },
-          {
-            value: "1",
-            label: "录入"
-          },
-          {
-            value: "2",
-            label: "带出"
-          }
-        ]
-      }
+      ]
     },
     {
       field: "itemname",
@@ -769,9 +771,6 @@ export const useHooks = (t?: any) => {
       title: "锁边工艺",
       limited: () => {
         return state.editType == 1;
-      },
-      editRender: {
-        name: "$input"
       }
     },
     {
@@ -779,9 +778,6 @@ export const useHooks = (t?: any) => {
       title: "锁边后尺寸",
       limited: () => {
         return state.editType == 1;
-      },
-      editRender: {
-        name: "$input"
       }
     },
     {
@@ -790,10 +786,7 @@ export const useHooks = (t?: any) => {
       limited: () => {
         return state.editType == 1;
       },
-      datatype: "number",
-      editRender: {
-        name: "$input"
-      }
+      datatype: "number"
     },
     {
       field: "ls_rate",
@@ -801,10 +794,7 @@ export const useHooks = (t?: any) => {
       limited: () => {
         return state.editType == 1;
       },
-      datatype: "number",
-      editRender: {
-        name: "$input"
-      }
+      datatype: "number"
     }
   ];
 
@@ -1344,7 +1334,7 @@ export const useHooks = (t?: any) => {
    * @param mattressid 床垫ID
    */
   const RetriveMattressInterface = async (mattressid: number) => {
-    let res = await GetMattressInterfaceList({ mattressid });
+    let res = await GetMattressInterfaceList({ mattressid, isEdit: Number(state.orderStatus != "") });
     state.mainData = res.mattress;
     state.mattressYWList = res.interfaceList;
     state.mattressQDList = res.qdList;

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

@@ -3508,6 +3508,16 @@ export const useHooks = (t?: any) => {
         }
       }
     },
+    {
+      title: "规格宽/CM",
+      field: "mattress_width",
+      visible: false
+    },
+    {
+      title: "规格长/CM",
+      field: "mattress_length",
+      visible: false
+    },
     {
       title: "物料单价",
       field: "price",
@@ -4162,6 +4172,24 @@ export const useHooks = (t?: any) => {
           </>
         );
       }
+    },
+    {
+      title: "规格宽/CM",
+      field: "mattress_width",
+      datatype: "number",
+      editRender: {
+        name: "input"
+      },
+      visible: true
+    },
+    {
+      title: "规格长/CM",
+      field: "mattress_length",
+      datatype: "number",
+      editRender: {
+        name: "input"
+      },
+      visible: true
     }
   ];
   const accessoriesColumns: ColumnProps<any>[] = [
@@ -4430,6 +4458,22 @@ export const useHooks = (t?: any) => {
       editRender: {
         name: "input"
       }
+    },
+    {
+      title: "规格宽/CM",
+      field: "mattress_width",
+      datatype: "number",
+      editRender: {
+        name: "input"
+      }
+    },
+    {
+      title: "规格长/CM",
+      field: "mattress_length",
+      datatype: "number",
+      editRender: {
+        name: "input"
+      }
     }
   ];
 

+ 11 - 1
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -449,7 +449,17 @@ const action: detailAction[] = [
   buttonDefault({
     label: t("common.businessSupplement"),
     power: 72,
-    clickFunc: item => {}
+    clickFunc: item => {
+      const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+      let _cur = $table.getCurrentRecord() ?? curRecords[curRecords.length - 1];
+      let type = 1;
+      router.push(`/erpapi/mattressInterface/${type}/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}&type=${type}`);
+    }
   }),
   buttonDefault({
     label: t("common.recalculateERPCost"),

+ 65 - 46
JLHWEB/src/views/system/selector/mtrldefErp/index.vue

@@ -99,18 +99,8 @@
       </el-collapse-item>
     </template>
     <template #default>
-      <!-- <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting" :dwname="dwname">
-        <template #left>
-          <TreeFilter
-            id="value"
-            label="text"
-            :expand-on-click-node="true"
-            :request-api="getMtrlType"
-            @change="changeTreeFilter"
-          />
-        </template> -->
       <div class="main-box flx-col">
-        <LjVxeTable
+        <!-- <LjVxeTable
           ref="vxeTableRef"
           :data="list"
           :columns="columns"
@@ -121,26 +111,26 @@
           :extraLoading="extraLoading"
           :table-events="tableEvents"
           :tool-button="[]"
+          pagination
+        > -->
+        <LjVxeTable
+          ref="LjTableRef"
+          table-cls=""
+          :columns="columns"
+          :request-api="getData"
+          :data-callback="dataCallback"
+          :init-param="initParams"
+          :dwname="dwname"
+          pagination
+          :table-events="tableEvents"
+          :table-props="tableProps"
+          :tool-button="[]"
+          :auto-load-layout="false"
+          collapse-buttons
         >
         </LjVxeTable>
       </div>
-      <!-- </LjFoldLayout> -->
     </template>
-
-    <!-- <template #footer>
-      <div class="flx-justify-between">
-        <div class="dialog-footer">
-          <el-button @click="drawerVisible = false">{{ $t("common.cancelText") }}</el-button>
-          <el-button type="primary" :disabled="!selectList.length" @click="confirm">
-            {{ $t("common.okText") }}
-            <template v-if="selectList.length">
-              {{ `(${selectList.length})` }}
-            </template>
-          </el-button>
-        </div>
-      </div>
-    </template> -->
-    <!-- </el-dialog> -->
   </LjSelector>
 </template>
 
@@ -212,6 +202,17 @@ const tableEvents = {
   "cell-click": handleClickTable
 };
 
+const dataCallback = (data: any) => {
+  console.log("data :>> ", data);
+  return {
+    list: data.mtrldefList,
+    // tableinfo: data.tableinfo,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
 const rowClsNameFunc = (data: any) => {
   const { row, rowIndex, $rowIndex } = data;
   return "";
@@ -275,26 +276,41 @@ const searchEvent = () => {
 // 节流
 const disshow = throttle((val: any) => {
   console.log("val :>> ", val);
-  searchField.value = val;
-  val ? searchEvent() : getData();
+  initParams.value.keyword = val;
+  // getData();
+  // val ? searchEvent() : getData();
 }, 500);
 
 // 获取表格数据
-const getData = async () => {
-  try {
-    extraLoading.value = true;
-    const data = await GetERPMtrldefList(initParams.value);
-    console.log("getData data :>> ", data);
-    if (data?.mtrldefList) {
-      let list = Object.freeze<any>(data.mtrldefList);
-      tableData.value = list;
-    }
-    extraLoading.value = false;
-    searchEvent();
-  } catch (error) {
-    extraLoading.value = false;
-    console.error(error);
-  }
+// const getData = async () => {
+//   try {
+//     extraLoading.value = true;
+//     const data = await GetERPMtrldefList(initParams.value);
+//     console.log("getData data :>> ", data);
+//     if (data?.mtrldefList) {
+//       let list = Object.freeze<any>(data.mtrldefList);
+//       tableData.value = list;
+//     }
+//     extraLoading.value = false;
+//     searchEvent();
+//   } catch (error) {
+//     extraLoading.value = false;
+//     console.error(error);
+//   }
+// };
+
+const getData = (params: any) => {
+  // console.log("getData params :>> ", params);
+  let newParams: any = params;
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+
+  delete params.pageNum;
+  delete params.pageSize;
+  // newParams.queryParams = initParams.value;
+  // console.log("params :>> ", newParams);
+  // newParams.dsname = "web_mtrl_choose";
+  return GetERPMtrldefList(newParams);
 };
 
 const show = (params: any) => {
@@ -305,9 +321,12 @@ const show = (params: any) => {
 
   console.log("show bfff initParams.value :>> ", initParams.value, params);
   initParams.value = defaultsDeep(params, initParams.value);
+
+  // initParams.value.pageindex = 1;
+  // initParams.value.pagesize = 100;
   console.log("show afff initParams.value :>> ", initParams.value);
   LjSelectorRef.value.show(initParams.value, "mtrl");
-  getData();
+  // getData();
 };
 
 const LjSelectorRef = ref();
@@ -323,7 +342,7 @@ const openColSetting = () => {
 const LjFoldLayoutRef = ref();
 
 const getMtrlType = async () => {
-  const data = await GetERPMtrlTypeList({ RecurionType: 1 });
+  const data = await GetERPMtrlTypeList();
   console.log("getL1MtrlType data :>> ", data);
   return data.reList;
 };