Browse Source

JLHWEB: 1、床垫报价,辅料tab新增物料切换时触发判断是否需要主副规格调整
2、床垫报价、床垫清单,列表查询翻页后自动展开副规格数据

JohnnyChan 6 days ago
parent
commit
c74bab2e0b

+ 3 - 1
JLHWEB/src/components/LjDrawer/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-drawer v-model="drawer" v-bind="{ ...drawerDefineProp, ...$attrs }" :key="drawerKey">
+  <el-drawer v-model="drawer" v-bind="{ ...drawerDefineProp, ...$attrs }" :key="drawerKey" @closed="emit('closed')">
     <template v-for="slotKey in Object.keys($slots)" #[slotKey]="scope">
       <slot :name="slotKey" v-bind="scope"></slot>
     </template>
@@ -43,6 +43,8 @@ const props = withDefaults(defineProps<LjDrawerProps>(), {
   keepAlive: false
 });
 
+const emit = defineEmits(["closed"]);
+
 /**
  * @description 抽屉默认属性
  */

+ 8 - 0
JLHWEB/src/views/erpapi/mattressInterface/index.vue

@@ -13,6 +13,7 @@
       :auto-load-layout="false"
       :search-btn-size-extent="[]"
       pagination
+      :page-change-call-back="autoUpdateTableCheckbox"
     >
       <!-- 表格 header 按钮 -->
       <template #tableHeader>
@@ -361,4 +362,11 @@ const routeToEdit = type => {
 mittBus.on(MittEnum.MattressList, () => {
   vxeTableRef.value.refresh();
 });
+
+const autoUpdateTableCheckbox = () => {
+  const $table = vxeTableRef.value.element;
+  if ($table) {
+    $table.setAllTreeExpand(true);
+  }
+};
 </script>

+ 1 - 1
JLHWEB/src/views/quote/mattressQuote/components/QuoteListNew.vue

@@ -6,7 +6,7 @@
     :modal="false"
     :close-on-click-modal="false"
     modal-class="dialog_class"
-    :closed="emits('closed')"
+    @closed="emits('closed')"
   >
     <template #header>
       <div class="flx-1">

+ 18 - 0
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -2952,6 +2952,8 @@ const toAddMx_subSpecs = async () => {
     console.log("$table.getTable :>> ", $table.getTableData());
     const $tableCushions = cushionsMxRef.value?.element;
     let cushionsAttr = {};
+
+    // 垫层tab, 检测是否有副规格替换物料
     if ($tableCushions) {
       let idx = 0;
       const { visibleData: visibleData_cushions } = $tableCushions.getTableData();
@@ -2966,6 +2968,22 @@ const toAddMx_subSpecs = async () => {
       });
     }
 
+    // 辅料tab, 检测是否有副规格替换物料
+    const $tableAccessories = accessoriesMxRef.value?.element;
+    if ($tableAccessories) {
+      let idx = 0;
+      const { visibleData: visibleData_accessories } = $tableAccessories.getTableData();
+      visibleData_accessories.map(item => {
+        if (item.mtrlid > 0 && item.if_subspecs == 1) {
+          cushionsAttr["accessories_subspecs_" + (idx + 1)] = item.mtrlid;
+          cushionsAttr["accessories_subspecs_formulakind_" + (idx + 1)] = item.formulakind;
+          cushionsAttr["accessories_subspecs_mtrlname_" + (idx + 1)] = item.mtrlname;
+
+          idx++;
+        }
+      });
+    }
+
     let records = {
       mattressid: 0,
       mattresscode: "",

+ 103 - 8
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -1414,9 +1414,8 @@ export const useHooks = (t?: any) => {
         nextTick(() => {
           $table.setActiveRow(data);
 
-          console.log("rModelSetMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
-          if (data.formulatype == 1) {
-            // 床网与主副规格互联
+          // 垫层tab、辅料tab,修改物料后,触发刷新主规格
+          if (data.formulatype == 1 || data.formulatype == 2) {
             updateSubspecsTable();
           }
           autoLoadMtrlExtra(item);
@@ -1451,10 +1450,9 @@ export const useHooks = (t?: any) => {
     if ($table) {
       $table.clearEdit();
 
-      console.log("rModelClearMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
       nextTick(() => {
-        if (data.formulatype == 1) {
-          // 床网与主副规格互联
+        // 垫层tab、辅料tab,修改物料后,触发刷新主规格
+        if (data.formulatype == 1 || data.formulatype == 2) {
           updateSubspecsTable();
         }
 
@@ -1946,7 +1944,11 @@ export const useHooks = (t?: any) => {
    */
   const funcDelMtrlMx = (data: any, refName?: string) => {
     let { row } = data;
-
+    const _item = {
+      mtrlid: row.mtrlid,
+      mtrlname: row.mtrlname,
+      extra_cost: row.extra_cost
+    };
     let tgRefName = "";
     if (refName) {
       tgRefName = refName;
@@ -1961,6 +1963,8 @@ export const useHooks = (t?: any) => {
     const $table = state[tgRefName].element;
     if ($table) {
       $table.remove(row);
+
+      autoLoadMtrlExtra(_item, 5, "del");
     }
   };
 
@@ -6001,6 +6005,9 @@ export const useHooks = (t?: any) => {
       }
     }
 
+    /**
+     * @description 垫层tab-记录需要变更的主副规格调整物料
+     */
     const $tableCushions = state.cushionsMxRef.element;
     if ($tableCushions) {
       const { visibleData: cushionsVisibleData } = $tableCushions.getTableData();
@@ -6031,7 +6038,6 @@ export const useHooks = (t?: any) => {
               title: "垫层物料-" + item.chastr + " " + (index + 1),
               field: _mtrlname,
               width: "200",
-              datatype: "integer",
               editRender: {},
               editColRender: (scope: any) => {
                 const { column, row, status, $table } = scope;
@@ -6094,6 +6100,95 @@ export const useHooks = (t?: any) => {
       }
     }
 
+    /**
+     * @description 辅料tab-记录需要变更的主副规格调整物料
+     */
+    const $tableAccessories = state.accessoriesMxRef.element;
+    if ($tableAccessories) {
+      const { visibleData: accessVisibleData } = $tableAccessories.getTableData();
+      if (accessVisibleData && accessVisibleData.length) {
+        let idx = 0;
+        accessVisibleData.map((item: any, index: any) => {
+          if (item.mtrlid && item.if_subspecs) {
+            let _field = "accessories_subspecs_" + (idx + 1);
+            let _mtrlname = "accessories_subspecs_mtrlname_" + (idx + 1);
+            let _formulakind = "accessories_subspecs_formulakind_" + (idx + 1);
+
+            idx++;
+            visibleData = visibleData.map(itm => {
+              itm[_formulakind] = item.formulakind;
+              return itm;
+            });
+
+            let itmName = state.formulaKindEnum.find(t => t.value == item.formulakind)?.label ?? "";
+            cols.push({
+              title: "辅料物料-" + itmName + " " + (index + 1),
+              field: _mtrlname,
+              width: "200",
+              editRender: {},
+              editColRender: (scope: any) => {
+                const { column, row, status, $table } = scope;
+                let _label = column.title;
+                let _pricelistid = getPriceid();
+
+                let _mtrltypeItem: any = mtrltypeTabList_accessories.find(t =>
+                  t.formulakinds.includes(Number(row[_formulakind]))
+                );
+                if (!_mtrltypeItem) {
+                  // ElMessage.error("不是垫层类型行,不能选物料");
+                  // return <></>;
+                }
+
+                console.log("updateSubspecsTable _mtrltypeItem :>> ", _mtrltypeItem);
+
+                let params = {
+                  mtrltype: _mtrltypeItem?.value,
+                  pricelistid: _pricelistid
+                };
+
+                return (
+                  <>
+                    <MtrldefSelect
+                      value={row[_field]}
+                      {...params}
+                      disabled={!_mtrltypeItem}
+                      clearable
+                      placeholder={_label}
+                      onOpenModal={() =>
+                        fModelChoseMtrl(
+                          row,
+                          params,
+                          (data, val: any) => {
+                            row[_field] = val.mtrlid;
+                            row[_mtrlname] = val.mtrlname;
+                          },
+                          _mtrltypeItem?.label,
+                          $table
+                        )
+                      }
+                      onSelect={(val: any) => {
+                        row[_field] = val.mtrlid;
+                        row[_mtrlname] = val.mtrlname;
+                      }}
+                      onClear={() => {
+                        row[_field] = 0;
+                        row[_mtrlname] = "";
+                      }}
+                    >
+                      {{
+                        label: () => row[_mtrlname]
+                      }}
+                    </MtrldefSelect>
+                  </>
+                );
+              }
+            });
+          }
+        });
+        // }
+      }
+    }
+
     // if (cols.length > 0) {
     state.columnsMx_subSpecs_dis = columnsMx_subSpecs.concat(cols);
     console.log("updateSubspecsTable state.columnsMx_subSpecs_dis 321:>> ", state.columnsMx_subSpecs_dis);

+ 8 - 0
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -13,6 +13,7 @@
       :auto-load-layout="false"
       :search-btn-size-extent="[]"
       pagination
+      :page-change-call-back="autoUpdateTableCheckbox"
     >
       <!-- 表格 header 按钮 -->
       <template #tableHeader>
@@ -749,4 +750,11 @@ const BatchCopyMattressAudited = () => {
 mittBus.on(MittEnum.MattressList, () => {
   vxeTableRef.value.refresh();
 });
+
+const autoUpdateTableCheckbox = () => {
+  const $table = vxeTableRef.value.element;
+  if ($table) {
+    $table.setAllTreeExpand(true);
+  }
+};
 </script>