浏览代码

补充提交

JohnnyChan 1 周之前
父节点
当前提交
3d51dca977

+ 1 - 1
JLHWEB/package.json

@@ -70,7 +70,7 @@
     "vue-toastification": "2.0.0-rc.5",
     "vuedraggable": "^4.1.0",
     "vxe-pc-ui": "4.2.0",
-    "vxe-table": "4.7.81",
+    "vxe-table": "4.9.28",
     "xe-utils": "^3.5.11"
   },
   "devDependencies": {

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

@@ -1328,4 +1328,9 @@ export namespace Mattress {
     extraEnum?: any[];
     extraTypeEnum?: any[];
   }
+  export interface ResMattressSubspecs {
+    mattresses?: any[];
+    bednetMxs?: any[];
+    mtrllist?: any[];
+  }
 }

+ 7 - 0
JLHWEB/src/api/modules/quote.ts

@@ -169,3 +169,10 @@ export const GetMattressImportDW2 = (params: Mattress.ReqMattressImport) => {
 export const GetMattressPackagMx = (params: Mattress.ReqMattressImport) => {
   return http.post<Mattress.ResMattressImport>(PORT1 + `/GetMattressPackagMx`, params);
 };
+
+/**
+ * @name 床垫报价:主副规格
+ */
+export const GetMattressSubspecs = (params: Mattress.ReqRefreshMattressInterface) => {
+  return http.post<Mattress.ResMattressSubspecs>(PORT1 + `/GetMattressSubspecs`, params);
+};

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

@@ -181,7 +181,7 @@ console.log("Ljdetail currentLayout :>> ", currentLayout);
  */
 const FoldLayoutFilterAttr = ["width", "hidden", "lastWidth"];
 
-const emit = defineEmits(["update:orderStatus", "toPinDetail", "afterMounted"]);
+const emit = defineEmits(["update:orderStatus", "toPinDetail", "afterMounted", "tabsClick"]);
 
 const basicinfoFormDefaultComputed = Object.assign(DETAIL_BASICINFO_FORM_DEFINE, props.basicDefault);
 
@@ -1123,6 +1123,8 @@ const handleClickTabs = (data: any) => {
     _detailtabs[props.dwname] = data.name;
     globalStore.setGlobalState("detailtabs", _detailtabs);
   }
+
+  emit("tabsClick", data);
 };
 
 /**

+ 20 - 6
JLHWEB/src/components/LjVxeTable/index.vue

@@ -829,7 +829,9 @@ const emit = defineEmits([
   "validError",
   "scroll",
   "scrollBoundary",
-  "custom"
+  "custom",
+  "rowDragstart",
+  "rowDragend"
 ]);
 // 表格绑定的事件
 const propsEvents = computed(() => {
@@ -893,6 +895,8 @@ const propsEvents = computed(() => {
     scroll: (data: any) => emit("scroll", data),
     scrollBoundary: (data: any) => emit("scrollBoundary", data),
     custom: (data: any) => emit("custom", data),
+    rowDragstart: (data: any) => emit("rowDragstart", data),
+    rowDragend: (data: any) => emit("rowDragend", data),
     menuClick({ menu, type, row, rowIndex, column, columnIndex, $event }: any) {
       console.log("menu :>> ", menu);
       console.log("menu row :>> ", row);
@@ -1162,7 +1166,7 @@ const defineFooterMethod = ({ columns, data }: any) => {
       if ((column.field && column.field.indexOf("qty") > -1) || props.footerSumAttrs?.includes(column.field)) {
         let count = 0;
         data.forEach((item: any) => {
-          count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field]));
+          item && (count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field])));
         });
         return count;
       }
@@ -2065,6 +2069,15 @@ const initLayoutColumns = () => {
   emit("layoutChange", tableColumns.value);
 };
 
+const loadColumns = (columns: any) => {
+  flatColumns.value = flatColumnsFunc(cloneDeep(columns));
+  tableColumns.value = loadRenderAttr(restoreColumnsFunc(flatColumns.value));
+  console.log("数行化,还原个性设置 tableColumns.value onllyyyyy:>> ", columns, tableColumns.value);
+  nextTick(() => {
+    isUpdate.value++;
+  });
+};
+
 /**
  * @description 获取表格数据后,自动执行选中第一行
  */
@@ -2186,8 +2199,8 @@ const saveDefaultLayout = async (column: any, param: any, cb: any) => {
 /**
  * @description 主动刷新数据
  */
-const refresh = async () => {
-  await getTableList();
+const refresh = async (outline?: boolean) => {
+  !outline && (await getTableList());
   nextTick(() => {
     isUpdate.value++;
 
@@ -2781,7 +2794,7 @@ const currentEditCell = ref<any>({
   rowIndex: 0
 });
 
-const scrollTo = (row: any, field: any) => {
+const scrollTo = (row: any, field?: any) => {
   tableRef.value.setCurrentRow(row);
   tableRef.value.scrollToRow(row, field);
 };
@@ -2811,7 +2824,8 @@ defineExpose({
   // selectedListIds
   initLayoutColumns,
   currentEditCell,
-  scrollTo
+  scrollTo,
+  loadColumns
 });
 </script>
 

+ 1 - 0
JLHWEB/src/components/LjVxeTable/interface/index.ts

@@ -270,6 +270,7 @@ export interface ColumnProps<T = any> extends Partial<Omit<VxeColumnProps<T>, "c
    * @description 自定义单元格内容渲染(tsx语法)- 用于表格编辑
    */
   editColRender?: (scope: RenderScope<T>, enumdata?: any, field?: string) => VNode | string;
+  [key: string]: any;
 }
 
 /**

+ 3 - 0
JLHWEB/src/config/columnStyle.ts

@@ -53,6 +53,9 @@ export const defineColumnStyle: any = {
   rep$: {
     width: 100
   },
+  createby$: {
+    width: 100
+  },
   rate$: {
     width: 80
   },

+ 1 - 1
JLHWEB/src/views/baseinfo/extra/index.vue

@@ -77,7 +77,7 @@
     </div>
   </div>
 
-  <LjPopover ref="LjPopoverRef" :title="popoverTitle" width="240">
+  <LjPopover ref="LjPopoverRef" :title="popoverTitle" width="320">
     <template v-if="!ifdel">
       <!-- <p>{{ popoverTitle }}</p> -->
       <div class="mb-8">

+ 21 - 1
JLHWEB/src/views/baseinfo/mtrldef/hooks/index.tsx

@@ -178,7 +178,27 @@ export const useHooks = (t?: any) => {
       title: "固定厚度",
       datatype: "checkbox",
       basicinfo: {
-        span: 2,
+        span: 1,
+        editable: ALLOW_EDIT_STATE,
+        render: (scope: any) => {
+          const { column, searchParam } = scope;
+
+          return (
+            <>
+              <div class="flx-align-center">
+                <el-checkbox v-model={searchParam[column.field]} true-value={1} false-value={0} />
+              </div>
+            </>
+          );
+        }
+      }
+    },
+    {
+      field: "if_subspecs",
+      title: "主副规格调整",
+      datatype: "checkbox",
+      basicinfo: {
+        span: 1,
         editable: ALLOW_EDIT_STATE,
         render: (scope: any) => {
           const { column, searchParam } = scope;

+ 118 - 8
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -60,10 +60,11 @@
             :columns="columns_qd"
             :dwname="DwnameEnum.mattressInterfaceQd"
             :request-auto="false"
-            :table-props="tableProps_mx"
+            :table-props="tableProps_qd"
             :tool-button="[]"
             :auto-load-layout="false"
             collapseButtons
+            @row-dragend="autoRowDragend"
           >
           </LjVxeTable>
         </div>
@@ -94,6 +95,7 @@ import MtrldefErpDialog from "@/views/system/selector/mtrldefErp/index.vue";
 import { formatToDate } from "@/utils/dateUtil";
 import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
 import { detailAction } from "@/components/LjDetail/interface";
+import { transformTreeData, autoMergeCells, isFilterPrice } from "@/utils/index";
 
 interface detailProp {
   /**
@@ -138,6 +140,7 @@ const {
   MtrldefErpDialogRef,
   MtrldefErpDialogProps,
   tableProps_mx,
+  tableProps_qd,
   workgrpEnum,
   workgrpEnum2,
   configureTypeEnum,
@@ -152,7 +155,9 @@ const {
   YWAudit,
   JSAudit,
   JS2Audit,
-  resetMergeCellsQd
+  resetMergeCellsQd,
+  funcAddRowQd,
+  funcCmpCC
 } = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
@@ -233,7 +238,11 @@ const moveData = async (index: number, nextIndex: number) => {
 
   $table.reloadData(visibleData);
   await $table.setCurrentRow(curRecords);
-  resetMergeCellsQd();
+  resetMergeCellsQd(() => {
+    setTimeout(() => {
+      $table.scrollToRow(curRecords);
+    }, 0);
+  });
 };
 
 const toMove = async (action: number) => {
@@ -269,6 +278,13 @@ const toMove = async (action: number) => {
 };
 
 const qdAction: detailAction[] = [
+  buttonDefault({
+    label: "增行"
+  }),
+  buttonDefault({
+    label: "插行",
+    divider: true
+  }),
   buttonDefault({
     label: "上移",
     clickFunc: () => toMove(1)
@@ -279,15 +295,23 @@ const qdAction: detailAction[] = [
     divider: true
   }),
   buttonDefault({
-    label: "增行"
+    label: "清单增加默认项目",
+    limited: () => {
+      return !orderStatus.value;
+    },
+    clickFunc: () => funcAddRowQd()
   }),
   buttonDefault({
-    label: "插行",
-    divider: true
+    label: "辅助计算生产尺寸",
+    divider: true,
+    limited: () => {
+      return !orderStatus.value;
+    },
+    clickFunc: () => funcCmpCC()
   }),
   buttonDefault({
     label: "批量设置",
-    clickFunc: () => {
+    clickFunc: async () => {
       let _cur = QdTableRef.value.currentEditCell;
 
       if (!["wrkgrpid", "wrkgrpid2", "actual_useqty"].includes(_cur.field)) {
@@ -319,7 +343,7 @@ const qdAction: detailAction[] = [
           return o;
         });
 
-        $table.reloadData(_data);
+        await $table.reloadData(_data);
         resetMergeCellsQd();
 
         ElMessage.success("批设成功(有实际用量的数据行)");
@@ -536,6 +560,52 @@ const orderDefaultAction = [
       }
     })
   ],
+  [
+    buttonDefault({
+      label: "增行",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: item => {}
+    }),
+    buttonDefault({
+      label: "插行",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: item => {},
+      divider: true
+    }),
+    buttonDefault({
+      label: "上移",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: item => {}
+    }),
+    buttonDefault({
+      label: "下移",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: item => {},
+      divider: true
+    }),
+    buttonDefault({
+      label: "清单增加默认项目",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: () => funcAddRowQd()
+    }),
+    buttonDefault({
+      label: "辅助计算生产尺寸",
+      limited: () => {
+        return !orderStatus.value;
+      },
+      clickFunc: () => funcCmpCC()
+    })
+  ],
   [
     buttonDefault({
       label: "业务补充",
@@ -759,6 +829,7 @@ const funcAfterMound = async () => {
   } else {
     // 新增/编辑
     tableProps_mx.value.editConfig.enabled = true;
+    tableProps_qd.value.editConfig.enabled = true;
     // tableProps_mx_yw.value.editConfig.enabled = true;
     // tableProps_mx_qd.value.editConfig.enabled = true;
   }
@@ -814,4 +885,43 @@ onMounted(async () => {
     await RetriveMattressInterface(initParams.value.mattressid.valueOf());
   }
 });
+
+/** 发现4.11~4.13版本reloadData加载超慢放弃使用 */
+const autoRowDragend = async data => {
+  const $table = QdTableRef.value.element;
+
+  $table.clearMergeCells();
+  // setTimeout(() => {
+  nextTick(() => {
+    console.time("autoRowDragend");
+    console.log("autoRowDragend data :>> ", data);
+    console.log(`拖拽完成,被拖拽行:${data.oldRow.itemname} 目标行:${data.newRow.itemname} 目标位置:${data.dragPos}`);
+    // resetMergeCellsQd();
+
+    // console.time("autoRowDragend getTableData");
+    // const { visibleData } = $table.getTableData();
+    // console.timeEnd("autoRowDragend getTableData");
+
+    // console.time("autoRowDragend arr");
+    // let arr = visibleData.map((o, idx) => {
+    //   o.printid = idx + 1;
+    //   return o;
+    // });
+    // console.timeEnd("autoRowDragend arr");
+
+    // console.time("autoRowDragend reloadData");
+    // await $table.reloadData(arr);
+    // console.timeEnd("autoRowDragend reloadData");
+
+    console.time("autoRowDragend autoMergeCells");
+    let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
+    console.timeEnd("autoRowDragend autoMergeCells");
+
+    console.time("autoRowDragend setMergeCells");
+    $table.setMergeCells(mergeCells);
+    console.timeEnd("autoRowDragend setMergeCells");
+    console.timeEnd("autoRowDragend");
+  });
+  // }, 1000);
+};
 </script>

+ 181 - 29
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -83,6 +83,96 @@ export const useHooks = (t?: any) => {
     configureTypeEnum: []
   });
 
+  const QdAddRowList = [
+    {
+      itemname: "补充物料",
+      bj_pzname: "边带",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "海绵芯",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "裥棉面线",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "裥棉底线",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "车位面线",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "车位底线",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "打底枪钉",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "胶水",
+      bj_pzname_mx: ""
+    },
+    {
+      itemname: "补充物料",
+      bj_pzname: "围边用线",
+      bj_pzname_mx: ""
+    }
+  ];
+
+  const funcAddRowQd = async () => {
+    const $table = state.QdTableRef?.element;
+
+    if ($table) {
+      $table.insertAt(QdAddRowList, -1);
+      const { visibleData } = $table.getTableData();
+      visibleData.map((o, idx) => {
+        o.printid = idx + 1;
+        return o;
+      });
+
+      $table.reloadData(visibleData);
+      resetMergeCellsQd();
+    }
+  };
+
+  const funcCmpCC = async () => {
+    const $table = state.VxeTableMxRef?.element;
+
+    if ($table) {
+      $table.clearEdit();
+
+      const mainData = state.LjDetailRef._mainData;
+
+      const { visibleData } = $table.getTableData();
+      console.log("visibleData :>> ", visibleData);
+      visibleData.map((o, idx) => {
+        if (["面层裥棉", "底层裥棉"].includes(o.bj_pzname)) {
+          //生产尺寸:((规格长)+2)*((规格宽)+2)
+          //锁边尺寸:((规格长)-1)*((规格宽)-1)
+          o.actual_size = mainData.mattress_width + 2 + "*" + (mainData.mattress_length + 2);
+          o.sb_craft = mainData.mattress_width - 1 + "*" + (mainData.mattress_length - 1);
+        }
+      });
+
+      await $table.reloadData(visibleData);
+      resetMergeCells();
+
+      ElMessage.success("操作成功!");
+    }
+  };
+
   const toCreateORDelMtrlPf = (type: number, list: any) => {
     if (type === 1) {
       if (state.QdTableRef) {
@@ -340,8 +430,8 @@ export const useHooks = (t?: any) => {
 
   // 表格配置项
   const columns: ColumnProps<any>[] = [
-    { type: "checkbox", width: 80, fixed: "left" },
-    { title: "#", field: "pid", fixed: "left", width: 80 },
+    { type: "checkbox", width: 40, fixed: "left" },
+    { title: "#", type: "seq", fixed: "left", width: 80 },
     {
       field: "yw_flag",
       title: "业务审核",
@@ -389,6 +479,7 @@ export const useHooks = (t?: any) => {
     {
       field: "deptid",
       title: "部门",
+      width: 120,
       search: {
         el: "select",
         key: "arg_deptid",
@@ -417,19 +508,19 @@ export const useHooks = (t?: any) => {
         return !scope.row?.child_count && !scope.row?.parentid ? (
           scope.row?.mattressname
         ) : scope.row?.parentid ? (
-          <>
-            <el-tag type="warning" effect="light" disable-transitions size="small" class="mr-4">
+          <div class="flx-justify-between">
+            <span class="mle">{scope.row?.mattressname}</span>
+            <el-tag type="warning" effect="light" disable-transitions size="small" round class="ml-4">
             </el-tag>
-            {scope.row?.mattressname}
-          </>
+          </div>
         ) : (
-          <>
-            <el-tag type="primary" effect="light" disable-transitions size="small" class="mr-4">
+          <div class="flx-justify-between">
+            <span class="mle">{scope.row?.mattressname}</span>
+            <el-tag type="primary" effect="light" disable-transitions size="small" round class="ml-4">
             </el-tag>
-            {scope.row?.mattressname}
-          </>
+          </div>
         );
       }
     },
@@ -653,7 +744,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         group: "单据信息",
-        order: 8,
+        order: 9,
         span: 1
       }
     },
@@ -675,7 +766,7 @@ export const useHooks = (t?: any) => {
         el: "input",
         editable: ALLOW_EDIT_STATE,
         group: "单据信息",
-        order: 9,
+        order: 8,
         span: 1
       }
     }
@@ -918,12 +1009,14 @@ export const useHooks = (t?: any) => {
   });
 
   const columns_qd = ref<ColumnProps<any>[]>([
-    {
-      field: "printid",
-      title: "排序",
-      width: 80,
-      fixed: "left"
-    },
+    { title: "#", type: "seq", fixed: "left", width: 60, dragSort: true },
+    // {
+    //   field: "printid",
+    //   title: "排序",
+    //   width: 80,
+    //   fixed: "left",
+    //   dragSort: true
+    // },
     {
       field: "itemname",
       title: "项目",
@@ -999,7 +1092,7 @@ export const useHooks = (t?: any) => {
       }
     },
     {
-      field: "mtrlengname",
+      field: "erp_mtrlengname",
       title: "自定义2",
       limited: () => {
         return state.editType == 1 || state.editType == 2;
@@ -1531,6 +1624,58 @@ export const useHooks = (t?: any) => {
     }
   });
 
+  const tableProps_qd = ref<any>({
+    height: "auto",
+    align: "left",
+    // height: "",
+    editConfig: {
+      trigger: "click",
+      mode: "cell",
+      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: {
+    //   filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
+    // }
+    keyboardConfig: {
+      isEdit: true,
+      isArrow: true,
+      isEnter: true,
+      isTab: true,
+      isDel: true,
+      isBack: true,
+      isEsc: true,
+      editMethod({ $table, row, column }) {
+        // 先清空原先的值
+        row[column.field] = "";
+        // 再激活编辑状态并输入新值
+        $table.setEditCell(row, column);
+      }
+    },
+    mouseConfig: {
+      selected: true
+    },
+    rowConfig: {
+      drag: true
+    },
+    rowDragConfig: {
+      trigger: "cell",
+      showGuidesStatus: true
+    }
+  });
+
   const resetMergeCells = () => {
     nextTick(() => {
       const $table = state.YwTableRef.element;
@@ -1546,15 +1691,19 @@ export const useHooks = (t?: any) => {
       }
     });
   };
-  const resetMergeCellsQd = () => {
-    nextTick(() => {
-      const $table = state.QdTableRef.element;
-      if ($table) {
-        let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
-        // console.log("autoMergeCells mergeCells :>> ", mergeCells);
-        $table.setMergeCells(mergeCells);
-      }
-    });
+  const resetMergeCellsQd = (cb?: any) => {
+    setTimeout(() => {
+      nextTick(() => {
+        const $table = state.QdTableRef?.element;
+        if ($table) {
+          let mergeCells = autoMergeCells($table, ["itemname", "bj_pzname", "bj_pzname_mx_mx"]);
+          // console.log("autoMergeCells mergeCells :>> ", mergeCells);
+          $table.setMergeCells(mergeCells);
+
+          cb && cb();
+        }
+      });
+    }, 200);
   };
 
   /**
@@ -2021,6 +2170,7 @@ export const useHooks = (t?: any) => {
     columns_yw_qd,
     columns_qd,
     tableProps_mx,
+    tableProps_qd,
     RetriveMattressInterface,
     RefreshMattressInterfaceList,
     RefreshMattressInterfaceQdList,
@@ -2032,6 +2182,8 @@ export const useHooks = (t?: any) => {
     YWAudit,
     JSAudit,
     JS2Audit,
-    resetMergeCellsQd
+    resetMergeCellsQd,
+    funcAddRowQd,
+    funcCmpCC
   };
 };

+ 5 - 6
JLHWEB/src/views/erpapi/mattressInterface/index.vue

@@ -7,7 +7,7 @@
       :init-param="initParams"
       :request-api="getData"
       :data-callback="dataCallback"
-      :dwname="DwnameEnum.mattressQuote"
+      :dwname="DwnameEnum.mattressInterface"
       :table-props="tableProps"
       :table-events="tableEvents"
       :auto-load-layout="false"
@@ -97,11 +97,10 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
 
 const rowClsNameFunc = (data: any) => {
   const { row, rowIndex, $rowIndex } = data;
-  if (Number(row.flag) == 0) {
-    if (Number(row.xd_flag) == 0) {
+  if (Number(row.creatmtrlqd_flag) != 1) {
+    if (Number(row.creatmtrl_flag) == 0) {
       return "vxecol-danger";
-    }
-    if (Number(row.xd_flag) == 1) {
+    } else {
       return "vxecol-blue";
     }
   }
@@ -118,7 +117,7 @@ const tableProps = {
     parentField: "parentid"
   },
   checkboxConfig: {
-    range: false
+    checkStrictly: true
   },
   exportConfig: {
     filename: t("menu.rpMsttake") + formatToDate(new Date(), "YYYY-MM-DD HH:mm:ss")

+ 54 - 34
JLHWEB/src/views/quote/mattressQuote/components/StatisticItem.vue

@@ -1,44 +1,64 @@
 <template>
-  <div class="statistic-card">
-    <el-statistic :value="outputValue" v-bind="$attrs">
-      <template #title>
-        {{ isFilterLabel(data.label) }}
-        <!-- <div class="footer-item">
-            <i class="iconfont iconjiu"></i>
-            <span>{{ isFilterPrice(data.origin) }}</span>
-          </div> -->
-
-        <div class="text-f-c text-secondary-text" v-if="ifMoneyrate">
-          {{ currentMoneyrate.label }}
+  <el-tooltip class="box-item" effect="dark" placement="left">
+    <template #content>
+      <div class="flx-col" style="width: 150px">
+        <div class="flx">
+          <span>
+            {{ isFilterLabel(data.label) }}
+          </span>
+          <div class="text-body-c ml-4 flx-1 text-right">
+            {{ isFilterPrice(outputValue) }}
+          </div>
         </div>
-      </template>
-      <template #suffix>
-        <div class="text-body-c text-secondary-text ml-4" v-if="ifMoneyrate" style="font-weight: 500">
-          {{ cprRateValue }}
+        <div class="flx" v-if="iforigin">
+          <span>旧核价报价</span>
+          <div class="text-body-c ml-4 flx-1 text-right">
+            {{ isFilterPrice(data.origin) }}
+          </div>
+        </div>
+        <div class="flx" v-if="iforigin">
+          <span>与旧核价相差</span>
+          <div class="text-body-c ml-4 flx-1 text-right">
+            {{ getDiscrepancy > 0 ? "+" : "" }}
+            {{ getDiscrepancy }}
+          </div>
         </div>
-        <!-- <span
-            v-if="getDiscrepancy !== 0"
-            class="statistic-suffix"
-            :class="getDiscrepancy > 0 ? 'green' : 'red'"
-            style="text-align: right"
-          >
+        <div class="flx" v-if="ifMoneyrate">
+          <span>{{ currentMoneyrate.label }}</span>
+          <div class="text-body-c ml-4 flx-1 text-right">
+            {{ cprRateValue }}
+          </div>
+        </div>
+      </div>
+    </template>
+    <div class="statistic-card">
+      <el-statistic :value="outputValue" v-bind="$attrs">
+        <template #title>
+          {{ isFilterLabel(data.label) }}
+          <div class="text-f-c text-secondary-text" v-if="ifMoneyrate">
+            {{ currentMoneyrate.label }}
+          </div>
+        </template>
+        <template #suffix>
+          <div class="text-body-c text-secondary-text ml-4" v-if="ifMoneyrate" style="font-weight: 500">
+            {{ cprRateValue }}
+          </div>
+        </template>
+      </el-statistic>
+      <div class="statistic-footer" v-if="iforigin">
+        <div class="footer-item">
+          <div class="flx-center">
+            <i class="iconfont iconjiu"></i>
+            <span>{{ isFilterPrice(data.origin) }}</span>
+          </div>
+          <span v-if="getDiscrepancy !== 0" :class="getDiscrepancy > 0 ? 'green' : 'red'" style="text-align: right">
+            {{ getDiscrepancy > 0 ? "+" : "" }}
             {{ getDiscrepancy }}
-          </span> -->
-      </template>
-    </el-statistic>
-    <div class="statistic-footer" v-if="iforigin">
-      <div class="footer-item">
-        <div class="flx-center">
-          <i class="iconfont iconjiu"></i>
-          <span>{{ isFilterPrice(data.origin) }}</span>
+          </span>
         </div>
-        <span v-if="getDiscrepancy !== 0" :class="getDiscrepancy > 0 ? 'green' : 'red'" style="text-align: right">
-          {{ getDiscrepancy > 0 ? "+" : "" }}
-          {{ getDiscrepancy }}
-        </span>
       </div>
     </div>
-  </div>
+  </el-tooltip>
 </template>
 
 <script setup lang="ts" name="mattressQuoteDetail_statistic-item">

+ 117 - 26
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -704,15 +704,13 @@
     </template>
     <template #subSpecs>
       <LjVxeTable
+        v-if="columnsMx_subSpecs_dis.length"
         ref="subSpecsRef"
         row-key="key"
         table-cls="h-full"
         :request-auto="false"
-        :request-api="getData_subSpecs"
-        :data-callback="dataCallbackMx"
-        :init-param="initParams"
-        :columns="columnsMx_subSpecs"
-        :dwname="DwnameEnum.mattressQuoteSubspecs"
+        :data="subSpecsData"
+        :columns="columnsMx_subSpecs_dis"
         :table-props="tableProps_subSpecs"
         :table-events="tableEvents"
         :tool-button="[]"
@@ -782,7 +780,7 @@ import LjVxeTable from "@/components/LjVxeTable/index.vue";
 import { cloneDeep } from "lodash-es";
 import { useRoute, useRouter } from "vue-router";
 import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
-import { SaveMattress, SaveMattressAuditing, DelMattress, GetMattressImportDW2 } from "@/api/modules/quote";
+import { SaveMattress, SaveMattressAuditing, DelMattress, GetMattressImportDW2, GetMattressSubspecs } from "@/api/modules/quote";
 // import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
 import { TYPE, useToast, POSITION } from "vue-toastification";
 import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
@@ -911,6 +909,8 @@ const {
   specialProcessesEnum,
   additionalCostsEnum,
   isShowOriginFormulaMattress,
+  columnsMx_subSpecs_dis,
+  subSpecsData,
   funcAddMxSide,
   funcChaifenTab,
   getData_mx,
@@ -934,7 +934,8 @@ const {
   resetMergeCellsTopCotton,
   wf_rtr_cwdc,
   resetSpecialProcesses,
-  gotoErpapi
+  gotoErpapi,
+  updateSubspecsTable
 } = useHooks(t);
 const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -1422,17 +1423,51 @@ const subSpecsNum = computed(() => {
   }
   return arr.length;
 });
-const getData_subSpecs = (params: any) => {
+const getData_subSpecs = (params?: any) => {
   console.log("getData_subSpecs getData params :>> ", params);
   let newParams: any = {};
-  params.pageNum && (newParams.pageindex = params.pageNum);
-  params.pageSize && (newParams.pagesize = params.pageSize);
-  delete params.pageNum;
-  delete params.pageSize;
-  newParams.queryParams = params;
-  console.log("params :>> ", params);
-  newParams.dsname = "web_mattress_subspecs";
-  return CommonDynamicSelect(newParams, DwnameEnum.mattressQuoteSubspecs);
+  newParams.mattressid = initParams.value.arg_mattressid;
+  return GetMattressSubspecs(newParams);
+};
+const dataCallbackSubspecs = (data: any) => {
+  let cols = [];
+  let list = data.mattresses.map((item: any, index: any) => {
+    let _item = {
+      mattress_width: item.mattress_width,
+      mattress_length: item.mattress_length,
+      mattress_height: item.mattress_height,
+      mattressid: item.mattressid,
+      mattresscode: item.mattresscode
+    };
+    let bednetMxs = data.bednetMxs.filter((t: any) => t.mattressid == item.mattressid);
+    console.log("dataCallbackSubspecs bednetMxs :>> ", bednetMxs);
+    if (bednetMxs.length > 0) {
+      bednetMxs
+        .filter(bItem => bItem.mattressid == item.mattressid)
+        .map((bItem, idx) => {
+          _item["spring_qty_width_" + (idx + 1)] = bItem.spring_qty_width;
+          _item["spring_qty_length_" + (idx + 1)] = bItem.spring_qty_length;
+        });
+    }
+
+    let mtrlList = data.mtrllist.filter((t: any) => t.mattressid == item.mattressid);
+    if (mtrlList.length > 0) {
+      mtrlList.map((bItem, idx) => {
+        _item["cushions_subspecs_" + (idx + 1)] = bItem.mtrlid;
+        _item["cushions_subspecs_formulakind_" + (idx + 1)] = bItem.formulakind;
+        _item["cushions_subspecs_mtrlname_" + (idx + 1)] = bItem.mtrlname;
+      });
+    }
+    return _item;
+  });
+
+  console.log("list dataCallbackSubspecs:>> ", list, columnsMx_subSpecs);
+  // columnsMx_subSpecs_dis.value = columnsMx_subSpecs.concat(cols);
+  console.log("list dataCallbackSubspecs:>> ", columnsMx_subSpecs_dis.value);
+  return {
+    list
+    // tableinfo: { columns: columnsMx_subSpecs_dis.value }
+  };
 };
 /**↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ */
 
@@ -1449,7 +1484,6 @@ const specialProcessesNum = computed(() => {
   return arr.length;
 });
 const getData_specialProcesses = (params: any) => {
-  console.log("getData_subSpecs getData params :>> ", params);
   let newParams: any = {};
   params.pageNum && (newParams.pageindex = params.pageNum);
   params.pageSize && (newParams.pagesize = params.pageSize);
@@ -1476,7 +1510,6 @@ const additionalCostsNum = computed(() => {
   return arr.length;
 });
 const getData_additionalCosts = (params: any) => {
-  console.log("getData_subSpecs getData params :>> ", params);
   let newParams: any = {};
   params.pageNum && (newParams.pageindex = params.pageNum);
   params.pageSize && (newParams.pagesize = params.pageSize);
@@ -1696,9 +1729,18 @@ const save = async () => {
           itm => Number(itm.mattress_width) > 0 || Number(itm.mattress_length) > 0 || Number(itm.mattress_height) > 0
         );
 
+        console.log("subspecs :>> ", subspecs);
+
         subspecs.map(itm => {
           if (Number(itm.mattress_width) <= 0 || Number(itm.mattress_length) <= 0 || Number(itm.mattress_height) <= 0) {
-            throw new Error("主副规格相关尺寸输入有误,请检查");
+            throw new Error("主副规格相关尺寸输入有误(不能为空),请输入正数");
+          }
+          for (const key in itm) {
+            if (key.indexOf("spring_qty_") > -1) {
+              if (Number(itm[key]) <= 0) {
+                throw new Error("主副规格相关弹簧排列数不能为空,请检查");
+              }
+            }
           }
         });
       } catch (error) {
@@ -2274,7 +2316,14 @@ const funcAfterMound = async () => {
 
     nextTick(() => {
       console.log("detail onMounted subSpecsRef.value :>> ", subSpecsRef.value);
-      subSpecsRef.value.refresh();
+      // subSpecsRef.value.refresh();
+      getData_subSpecs().then(res => {
+        const { list } = dataCallbackSubspecs(res);
+        subSpecsData.value = list;
+        console.log("detail onMounted subSpecsRef.value getData_subSpecs:>> ", res, subSpecsData.value);
+
+        updateSubspecsTable();
+      });
 
       gotoSummy(8000);
     });
@@ -2681,6 +2730,11 @@ const toMove = async (action: number, tableName: string) => {
       fMoveFormCushionsMxToBednetMx($table, curIdx, action);
     }
   }
+
+  // 床网与主副规格互联
+  nextTick(() => {
+    updateSubspecsTable();
+  });
 };
 
 /**
@@ -2741,14 +2795,21 @@ const toAddMx_cushions = async (type: number) => {
  * @description 垫层:删除
  */
 const toDelMx_cushions = () => {
+  const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
   ElMessageBox.confirm(`是否确定要删除明细吗?`, "询问", {
     confirmButtonText: t("common.delText"),
     cancelButtonText: "否",
     type: "error"
   })
     .then(() => {
-      const $table = cushionsMxRef.value.element;
+      if (curRecords.length == 1 && Number(curRecords[0].formulakind) == 999) {
+        wf_rtr_bednet(curRecords[0]);
+      }
       $table.removeCurrentRow();
+      nextTick(() => {
+        // 床网与主副规格互联
+        updateSubspecsTable();
+      });
     })
     .catch((e: TypeError) => {
       console.log("e :>> ", e);
@@ -2859,15 +2920,37 @@ const SetCurrentTabs = (data: any) => {
 const toAddMx_subSpecs = async () => {
   const $table = subSpecsRef.value.element;
   if ($table) {
+    // updateSubspecsTable();
+
+    console.log("$table.getTable :>> ", $table.getTableData());
+    const $tableCushions = cushionsMxRef.value.element;
+    let cushionsAttr = {};
+    if ($tableCushions) {
+      let idx = 0;
+      const { visibleData: visibleData_cushions } = $tableCushions.getTableData();
+      visibleData_cushions.map(item => {
+        if (item.mtrlid > 0 && item.if_subspecs == 1) {
+          cushionsAttr["cushions_subspecs_" + (idx + 1)] = item.mtrlid;
+          cushionsAttr["cushions_subspecs_formulakind_" + (idx + 1)] = item.formulakind;
+          cushionsAttr["cushions_subspecs_mtrlname_" + (idx + 1)] = item.mtrlname;
+
+          idx++;
+        }
+      });
+    }
+
     let records = {
       mattressid: 0,
       mattresscode: "",
-      mattress_width: "",
-      mattress_length: "",
-      mattress_height: LjDetailRef.value._mainData.mattress_height,
-      spring_qty_length: 0,
-      spring_qty_width: 0
+      mattress_width: 0,
+      mattress_length: 0,
+      mattress_height: LjDetailRef.value._mainData.mattress_height
+      // spring_qty_length: 0,
+      // spring_qty_width: 0
     };
+    for (const key in cushionsAttr) {
+      records[key] = cushionsAttr[key];
+    }
     const { row: newRow } = await $table.insertNextAt(records, -1);
     await $table.setEditCell(newRow, "mattress_width");
     await $table.setCurrentRow(newRow);
@@ -2963,6 +3046,14 @@ const cmpMoneyrate = computed(() => {
 const cmpIfMoneyrate = computed(() => {
   return LjDetailRef.value?._mainData.if_moneyrate ?? 0;
 });
+
+// const autoTabsClicks = (data: any) => {
+//   console.log("autoTabsClicks data :>> ", data);
+
+//   if (data.name == "subspecs") {
+//     updateSubspecsTable();
+//   }
+// };
 </script>
 
 <style lang="scss">

+ 309 - 118
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -134,6 +134,8 @@ interface defaultState {
   specialProcessesEnum: any;
   additionalCostsEnum: any;
   isShowOriginFormulaMattress: boolean;
+  columnsMx_subSpecs_dis: any[];
+  subSpecsData: any[];
 }
 
 interface bednetDrawerPropsdata {
@@ -401,7 +403,9 @@ export const useHooks = (t?: any) => {
     additionalCostsMxInitData: [],
     specialProcessesEnum: [],
     additionalCostsEnum: [],
-    isShowOriginFormulaMattress: false
+    isShowOriginFormulaMattress: false,
+    columnsMx_subSpecs_dis: [],
+    subSpecsData: []
   });
 
   const router = useRouter();
@@ -1079,7 +1083,7 @@ export const useHooks = (t?: any) => {
 
   /**
    * @description 在床网tab,更新垫层的床网厚度信息
-   * @param data 床网订单信息
+   * @param data 床网明细信息
    * @param item 床网信息
    * @param action 动作,add,set,del,clear
    */
@@ -1144,64 +1148,43 @@ export const useHooks = (t?: any) => {
 
   /**
    * @description 更新床网tab的垫层床网信息
-   * @param data 床网订单信息
+   * @param data 垫层明细信息
    */
-  const wf_rtr_bednet = (data: any, item: any, action: string) => {
-    console.log("wf_rtr_cwdc data :>> ", data);
+  const wf_rtr_bednet = (data: any) => {
+    console.log("wf_rtr_bednet data :>> ", data);
     const $table = state.cushionsMxRef.element;
-    let { fullData } = $table.getTableData();
+    let { visibleData } = $table.getTableData();
+    let currentcushionsIndex = $table.getRowSeq(data);
+    console.log("currentcushionsIndex :>> ", currentcushionsIndex);
 
-    // fullData.map(item => {
-    //   if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
-    //     $table.setRow(item, {
-    //       thickness: data.bednet_height,
-    //       qty: 1
-    //     });
-    //   }
-    // });
+    const $tableBednet = state.bednetMxRef.element;
+    let { visibleData: visibleData_bednet } = $tableBednet.getTableData();
+    let currentBednetIndex = 0;
+    let index = 0;
+    visibleData.map((o, idx) => {
+      if (Number(o.formulakind) == 999) {
+        if (idx + 1 == currentcushionsIndex) {
+          currentBednetIndex = index;
+        }
+        index++;
+      }
+    });
 
-    // const $tableBednet = state.bednetMxRef.element;
-    // let { fullData: bednetFullData } = $tableBednet.getTableData();
-    // let currentBednetIndex = $tableBednet.getRowSeq(data);
+    console.log("wf_rtr_bednet currentBednetIndex :>> ", currentBednetIndex);
 
-    // if (action == "add") {
-    //   let records = cloneDeep(fullData.find(o => o.formulakind == 999));
-    //   records.thickness = 0;
-    //   records.qty = 0;
-    //   records._X_ROW_KEY = "";
+    if (visibleData_bednet.length == 1) {
+      visibleData_bednet[0].mtrlid = 0;
+      visibleData_bednet[0].mtrlname = "";
+      visibleData_bednet[0].price = 0;
+      $tableBednet.reloadData(visibleData_bednet);
+    } else {
+      funcDelMtrlMx({ row: visibleData_bednet[currentBednetIndex], data: visibleData_bednet }, "bednetMxRef");
+    }
 
-    //   let bednetList = fullData.filter(o => Number(o.formulakind) == 999);
-    //   let lastIndex = bednetList[bednetList.length - 1];
-    //   console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
-    //   $tableBednet.insertAt(records, lastIndex);
-    // } else {
-    //   console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
-    //   let index = 1;
-    //   fullData.map(o => {
-    //     if (Number(o.formulakind) == 999) {
-    //       if (index == currentBednetIndex) {
-    //         if (action == "set") {
-    //           $table.setRow(o, {
-    //             thickness: item?.bednet_height,
-    //             qty: 1
-    //           });
-    //         } else if (action == "clear") {
-    //           $table.setRow(o, {
-    //             thickness: 0,
-    //             qty: 0
-    //           });
-    //         } else if (action == "del") {
-    //           // $table.setRow(o, {
-    //           //   thickness: 0,
-    //           //   qty: 0
-    //           // });
-    //           $table.remove(o);
-    //         }
-    //       }
-    //       index++;
-    //     }
-    //   });
-    // }
+    // 床网与主副规格互联
+    nextTick(() => {
+      updateSubspecsTable();
+    });
   };
 
   /**
@@ -1229,6 +1212,11 @@ export const useHooks = (t?: any) => {
         console.log("wf_rtr_cwdc curIndex :>> ", curIndex);
         rModelClearMtrl(scope.row);
         funcAddMtrlMx({ row: visibleData_bednet[curIndex] }, null, "bednetMxRef", arr.length == 0);
+
+        // 床网与主副规格互联
+        nextTick(() => {
+          updateSubspecsTable();
+        });
       }
     } else if (Number(val) !== 999 && Number(lastVal) === 999) {
       // 删除
@@ -1246,6 +1234,11 @@ export const useHooks = (t?: any) => {
         }
         rModelClearMtrl(scope.row);
         funcDelBednet({ row: visibleData_bednet[curIndex], data: visibleData_bednet }, null, "bednetMxRef");
+
+        // 床网与主副规格互联
+        nextTick(() => {
+          updateSubspecsTable();
+        });
       }
     } else {
       rModelClearMtrl(scope.row);
@@ -1277,6 +1270,9 @@ export const useHooks = (t?: any) => {
         $table.clearEdit();
         nextTick(() => {
           $table.setActiveRow(data);
+
+          // 床网与主副规格互联
+          updateSubspecsTable();
         });
       }
     }
@@ -1292,6 +1288,11 @@ export const useHooks = (t?: any) => {
 
     if ($table) {
       $table.clearEdit();
+
+      nextTick(() => {
+        // 床网与主副规格互联
+        updateSubspecsTable();
+      });
     }
   };
 
@@ -1345,6 +1346,7 @@ export const useHooks = (t?: any) => {
       data.cloth_width = item.cloth_width;
       data.if_inputqty = Number(item.if_inputqty);
       data.if_areaprice = item.if_areaprice;
+      data.if_subspecs = item.if_subspecs;
       data.mtrlname = item.mtrlname;
       data.priceunit = item.priceunit;
       data.shrinkage = item.price; // 收缩率
@@ -1368,6 +1370,12 @@ export const useHooks = (t?: any) => {
         $table.clearEdit();
         nextTick(() => {
           $table.setActiveRow(data);
+
+          console.log("rModelSetMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
+          if (data.formulatype == 1) {
+            // 床网与主副规格互联
+            updateSubspecsTable();
+          }
         });
       }
     }
@@ -1383,6 +1391,7 @@ export const useHooks = (t?: any) => {
     data.cloth_width = 0;
     data.if_inputqty = 0;
     data.if_areaprice = 0;
+    data.if_subspecs = 0;
     data.mtrlname = "";
     data.priceunit = "";
     data.shrinkage = 0;
@@ -1392,6 +1401,14 @@ export const useHooks = (t?: any) => {
 
     if ($table) {
       $table.clearEdit();
+
+      console.log("rModelClearMtrl data.formulatype == 99 :>> ", data.formulatype == 1);
+      nextTick(() => {
+        if (data.formulatype == 1) {
+          // 床网与主副规格互联
+          updateSubspecsTable();
+        }
+      });
     }
   };
 
@@ -1894,6 +1911,11 @@ export const useHooks = (t?: any) => {
     }
     cb && cb();
     funcDelMtrlMx(scope, refName);
+
+    // 床网与主副规格互联
+    nextTick(() => {
+      updateSubspecsTable();
+    });
   };
 
   /**
@@ -2834,8 +2856,8 @@ export const useHooks = (t?: any) => {
 
   // 表格配置项
   const columns: ColumnProps<any>[] = [
-    { type: "checkbox", width: 50, fixed: "left" },
-    { title: "#", field: "pid", fixed: "left", width: 80 },
+    { type: "checkbox", width: 40, fixed: "left" },
+    { title: "#", type: "seq", fixed: "left", width: 80 },
     {
       field: "deptid",
       title: "部门",
@@ -2914,19 +2936,19 @@ export const useHooks = (t?: any) => {
         return !scope.row?.child_count && !scope.row?.parentid ? (
           scope.row?.mattressname
         ) : scope.row?.parentid ? (
-          <>
-            <el-tag type="warning" effect="light" disable-transitions size="small" class="mr-4">
+          <div class="flx-justify-between">
+            <span class="mle">{scope.row?.mattressname}</span>
+            <el-tag type="warning" effect="light" disable-transitions size="small" round class="ml-4">
             </el-tag>
-            {scope.row?.mattressname}
-          </>
+          </div>
         ) : (
-          <>
-            <el-tag type="primary" effect="light" disable-transitions size="small" class="mr-4">
+          <div class="flx-justify-between">
+            <span class="mle">{scope.row?.mattressname}</span>
+            <el-tag type="primary" effect="light" disable-transitions size="small" round class="ml-4">
             </el-tag>
-            {scope.row?.mattressname}
-          </>
+          </div>
         );
       }
     },
@@ -5147,29 +5169,29 @@ export const useHooks = (t?: any) => {
       //     </>
       //   );
       // }
-    },
-    {
-      title: "弹簧排列个数-宽",
-      field: "spring_qty_width",
-      datatype: "integer",
-      editRender: {
-        name: "$input"
-        // props: {
-        //   type: "number"
-        // }
-      }
-    },
-    {
-      title: "弹簧排列个数-长",
-      field: "spring_qty_length",
-      datatype: "integer",
-      editRender: {
-        name: "$input"
-        // props: {
-        //   type: "number"
-        // }
-      }
     }
+    // {
+    //   title: "弹簧排列个数-宽",
+    //   field: "spring_qty_width",
+    //   datatype: "integer",
+    //   editRender: {
+    //     name: "$input"
+    //     // props: {
+    //     //   type: "number"
+    //     // }
+    //   }
+    // },
+    // {
+    //   title: "弹簧排列个数-长",
+    //   field: "spring_qty_length",
+    //   datatype: "integer",
+    //   editRender: {
+    //     name: "$input"
+    //     // props: {
+    //     //   type: "number"
+    //     // }
+    //   }
+    // }
   ];
 
   const handleToImportMxInner = async () => {
@@ -5447,39 +5469,43 @@ export const useHooks = (t?: any) => {
         return;
       }
 
-      let _mainData = visibleData[0];
-
       let _pricelistid = getPriceid();
-      let bednet = cloneDeep(_mainData);
-      bednet.bednetid = _mainData.mtrlid;
-      // bednet.if_doublenet = Number(bednet.if_doublenet);
-      // bednet.if_doublespring = Number(bednet.if_doublespring);
-      // bednet.if_side_iron = Number(bednet.if_side_iron);
-      // bednet.if_rsorwa = Number(bednet.if_rsorwa);
-      // bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
-      // bednet.iffork = Number(bednet.iffork);
-      // bednet.ifsaleout = Number(bednet.ifsaleout);
-      // bednet.if_jb = Number(bednet.if_jb);
-      // bednet.flag = Number(bednet.flag);
-      bednet.mattress_length = row.mattress_length;
-      bednet.mattress_width = row.mattress_width;
-      bednet.pricelistid = _pricelistid;
-
-      let _params: any = {
-        bednet: bednet
-        // bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
-        // spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
-      };
-      console.log("setMxSpringQtyWidthAndLength _params :>> ", _params);
-      let res = await GetComputeSpring(_params);
-
-      console.log("setMxSpringQtyWidthAndLength res :>> ", res);
-      console.log("setMxSpringQtyWidthAndLength row :>> ", row);
-      if (!res?.message) {
-        scope.row.spring_qty_width = res.bednetMx[0].spring_qty_width;
-        scope.row.spring_qty_length = res.bednetMx[0].spring_qty_length;
+      for (let i = 0; i < visibleData.length; i++) {
+        let _mainData = visibleData[i];
+
+        if (_mainData.mtrlid > 0) {
+          let bednet = cloneDeep(_mainData);
+          bednet.bednetid = _mainData.mtrlid;
+          // bednet.if_doublenet = Number(bednet.if_doublenet);
+          // bednet.if_doublespring = Number(bednet.if_doublespring);
+          // bednet.if_side_iron = Number(bednet.if_side_iron);
+          // bednet.if_rsorwa = Number(bednet.if_rsorwa);
+          // bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
+          // bednet.iffork = Number(bednet.iffork);
+          // bednet.ifsaleout = Number(bednet.ifsaleout);
+          // bednet.if_jb = Number(bednet.if_jb);
+          // bednet.flag = Number(bednet.flag);
+          bednet.mattress_length = row.mattress_length;
+          bednet.mattress_width = row.mattress_width;
+          bednet.pricelistid = _pricelistid;
+
+          let _params: any = {
+            bednet: bednet
+            // bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
+            // spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
+          };
+          console.log("setMxSpringQtyWidthAndLength _params :>> ", _params);
+          let res = await GetComputeSpring(_params);
+
+          console.log("setMxSpringQtyWidthAndLength res :>> ", res);
+          console.log("setMxSpringQtyWidthAndLength row :>> ", row);
+          if (!res?.message) {
+            scope.row["spring_qty_width_" + (i + 1)] = res.bednetMx[0].spring_qty_width;
+            scope.row["spring_qty_length_" + (i + 1)] = res.bednetMx[0].spring_qty_length;
+          }
+          console.log("setMxSpringQtyWidthAndLength scopes row :>> ", scope.row);
+        }
       }
-      console.log("setMxSpringQtyWidthAndLength scopes row :>> ", scope.row);
     }
   };
 
@@ -5576,6 +5602,170 @@ export const useHooks = (t?: any) => {
     });
   };
 
+  /**
+   * @description 更新主副规格表结构
+   */
+  const updateSubspecsTable = () => {
+    // state.columnsMx_subSpecs_dis = [];
+    // 检查床网
+    console.log("updateSubspecsTable state.columnsMx_subSpecs_dis :>> ", state.columnsMx_subSpecs_dis);
+    const $tableBendet = state.bednetMxRef.element;
+    const $tableSubspecs = state.subSpecsRef?.element;
+    let cols = [];
+    let visibleData = [];
+    if ($tableSubspecs) {
+      visibleData = $tableSubspecs.getTableData().visibleData;
+    }
+    if ($tableBendet) {
+      const { visibleData: bednetVisibleData } = $tableBendet.getTableData();
+
+      if (bednetVisibleData && bednetVisibleData.length) {
+        // let filedsName = state.columnsMx_subSpecs_dis
+        //   .filter((item: any) => item.field && item.field.indexOf("spring_qty_width_") > -1)
+        //   .map(item => item.field);
+        // let bednetFieldsName = bednetVisibleData
+        //   .filter((item: any) => item.mtrlid)
+        //   .map(item => "spring_qty_width_" + item.mtrlid);
+
+        console.log(
+          'filedsName.join(",") != bednetFieldsName.join(",") :>> ',
+          // filedsName.join(","),
+          // bednetFieldsName.join(","),
+          bednetVisibleData
+        );
+        // if (filedsName.join(",") != bednetFieldsName.join(",")) {
+        bednetVisibleData.map((item: any, idx: any) => {
+          if (item.mtrlid) {
+            cols.push({
+              title: "弹簧排列个数-宽" + "-床网" + (idx + 1),
+              field: "spring_qty_width_" + (idx + 1),
+              datatype: "integer",
+              editRender: {
+                name: "$input"
+              }
+            });
+            cols.push({
+              title: "弹簧排列个数-宽" + "-床网" + (idx + 1),
+              field: "spring_qty_length_" + (idx + 1),
+              datatype: "integer",
+              editRender: {
+                name: "$input"
+              }
+            });
+          }
+        });
+        // }
+      }
+    }
+
+    const $tableCushions = state.cushionsMxRef.element;
+    if ($tableCushions) {
+      const { visibleData: cushionsVisibleData } = $tableCushions.getTableData();
+      if (cushionsVisibleData && cushionsVisibleData.length) {
+        // let filedsName = state.columnsMx_subSpecs_dis
+        //   .filter((item: any) => item.field && item.field.indexOf("cushions_subspecs_") > -1)
+        //   .map(item => item.field);
+        // let cushionsFieldsName = cushionsVisibleData
+        //   .filter((item: any) => item.mtrlid && item.if_subspecs)
+        //   .map(item => "cushions_subspecs_" + item.mtrlid);
+
+        // console.log('filedsName.join(",") ', filedsName.join(","));
+        // console.log(' cushionsFieldsName.join(",") :>> ', cushionsFieldsName.join(","));
+        // if (filedsName.join(",") != cushionsFieldsName.join(",")) {
+        let idx = 0;
+        cushionsVisibleData.map((item: any, index: any) => {
+          if (item.mtrlid && item.if_subspecs) {
+            let _field = "cushions_subspecs_" + (idx + 1);
+            let _mtrlname = "cushions_subspecs_mtrlname_" + (idx + 1);
+            let _formulakind = "cushions_subspecs_formulakind_" + (idx + 1);
+
+            idx++;
+            visibleData = visibleData.map(itm => {
+              itm[_formulakind] = item.formulakind;
+              return itm;
+            });
+            cols.push({
+              title: "垫层物料-" + item.chastr + " " + (index + 1),
+              field: _mtrlname,
+              width: "200",
+              datatype: "integer",
+              editRender: {},
+              editColRender: (scope: any) => {
+                const { column, row, status, $table } = scope;
+                let _label = column.title;
+                let _pricelistid = getPriceid();
+
+                let _mtrltypeItem: any = mtrltypeTabList_cushions.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);
+    nextTick(() => {
+      // state.subSpecsRef.element.loadColumn(state.columnsMx_subSpecs_dis);
+      state.subSpecsRef.loadColumns(state.columnsMx_subSpecs_dis);
+
+      console.log("visibleData :>> ", visibleData);
+      if ($tableSubspecs) {
+        state.subSpecsData = visibleData;
+      }
+    });
+    // }
+  };
+
   return {
     ...toRefs(state),
     columns,
@@ -5613,6 +5803,7 @@ export const useHooks = (t?: any) => {
     resetSpecialProcesses,
     resetMergeCellsTopCotton,
     wf_rtr_cwdc,
-    gotoErpapi
+    gotoErpapi,
+    updateSubspecsTable
   };
 };

+ 14 - 3
JLHWEB/src/views/quote/mattressQuote/index.vue

@@ -74,8 +74,7 @@ import { detailAction } from "@/components/LjDetail/interface";
 import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
-import * as Exceljs from "exceljs";
-import { saveAs } from "file-saver";
+import { useUserStore } from "@/stores/modules/user";
 
 const { t } = useI18n();
 const router = useRouter();
@@ -180,7 +179,7 @@ const tableProps = {
     parentField: "parentid"
   },
   checkboxConfig: {
-    range: false
+    checkStrictly: true
   }
 };
 
@@ -301,6 +300,18 @@ const action: detailAction[] = [
         return;
       }
 
+      const { userInfo } = useUserStore();
+      try {
+        curRecords.map(item => {
+          if (item.createby !== userInfo.username && userInfo.empid != 0) {
+            throw new Error("只能删除自己创建的报价单");
+          }
+        });
+      } catch (error) {
+        ElMessage.error(error.message);
+        return false;
+      }
+
       let _mattressids = curRecords.map((item: any) => Number(item.mattressid));
 
       ElMessageBox.confirm(`是否确定要删除${curRecords.length}张床垫报价单吗?`, "询问", {