Browse Source

JLHWEB: 1、床垫报价计算公式兼容床网大小单计算
2、床垫报价的报价清单,结构更改
3、床垫清单新增领料工组选择(新旧L1)

JohnnyChan 1 week ago
parent
commit
8fc07735fb

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

@@ -1286,6 +1286,7 @@ export namespace Mattress {
     formulas: any;
     message: string;
     formulas_origin: any;
+    formulas_bednet: any;
     differ?: any;
   }
   export interface ReqRefreshMattressInterface {

+ 9 - 0
JLHWEB/src/api/modules/common.ts

@@ -83,6 +83,15 @@ export const GetERPWrkGrpList = (params?: GenericApi.ReqGetERPWrkGrpList) => {
   return http.post<GenericApi.ResGetERPWrkGrpList>(PORT1 + `/GetERPWrkGrpList`, params);
 };
 
+export const GetERPWrkGrpList2 = () => {
+  let newParams: any = {};
+  newParams.dsname = "_Mapper_wrkgrpcode2";
+  newParams.queryparams = {};
+  newParams.pageindex = 0;
+  newParams.pagesize = 0;
+  return CommonDynamicSelect(newParams);
+};
+
 export const GetERPMtrlTypeList = () => {
   return http.post<Basicinfo.ResGetMtrlTypeList>(PORT1 + `/GetERPMtrlTypeList`);
 };

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

@@ -78,7 +78,7 @@ import { useI18n } from "vue-i18n";
 import { useRoute, useRouter } from "vue-router";
 import { useHooks } from "./hooks/index";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
-import { CommonDynamicSelect, GetERPWrkGrpList } from "@/api/modules/common";
+import { CommonDynamicSelect, GetERPWrkGrpList, GetERPWrkGrpList2 } from "@/api/modules/common";
 import { SaveMattressInterface } from "@/api/modules/quote";
 import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
 import mittBus from "@/utils/mittBus";
@@ -131,6 +131,7 @@ const {
   MtrldefErpDialogProps,
   tableProps_mx,
   workgrpEnum,
+  workgrpEnum2,
   configureTypeEnum,
   RetriveMattressInterface,
   RefreshMattressInterfaceList,
@@ -488,18 +489,22 @@ onMounted(async () => {
     workgrpEnum.value = result.workgroupList.map(item => {
       return {
         label: item.wrkgrpname,
-        value: item.wrkgrpid
+        value: item.wrkgrpid,
+        code: item.wrkgrpcode
       };
     });
 
-    columns_qd.value = columns_qd.value.map(item => {
-      if (item.field == "wrkgrpid") {
-        item.editRender.options = workgrpEnum.value;
-      }
-      return item;
-    });
+    // columns_qd.value = columns_qd.value.map(item => {
+    //   if (item.field == "wrkgrpid") {
+    //     item.editRender.options = workgrpEnum.value;
+    //   }
+    //   return item;
+    // });
   }
 
+  const result2 = await GetERPWrkGrpList2();
+  workgrpEnum2.value = result2.datatable ?? [];
+
   if (route.query?.id) {
     // 刷新数据
     initParams.value.mattressid = Number(route.query?.id);

+ 103 - 15
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -49,6 +49,7 @@ interface defaultState {
   MtrldefErpDialogRef: any;
   MtrldefErpDialogProps: any;
   workgrpEnum: any;
+  workgrpEnum2: any;
   configureTypeEnum: any;
   VxeTableMxRef: any;
   YwTableRef: any;
@@ -77,6 +78,7 @@ export const useHooks = (t?: any) => {
     MtrldefErpDialogRef: null,
     MtrldefErpDialogProps: {},
     workgrpEnum: [],
+    workgrpEnum2: [],
     configureTypeEnum: []
   });
 
@@ -637,15 +639,15 @@ export const useHooks = (t?: any) => {
       width: 80,
       enum: [
         {
-          value: "0",
+          value: 0,
           label: "选择"
         },
         {
-          value: "1",
+          value: 1,
           label: "录入"
         },
         {
-          value: "2",
+          value: 2,
           label: "带出"
         }
       ],
@@ -653,15 +655,15 @@ export const useHooks = (t?: any) => {
         name: "$select",
         options: [
           {
-            value: "0",
+            value: 0,
             label: "选择"
           },
           {
-            value: "1",
+            value: 1,
             label: "录入"
           },
           {
-            value: "2",
+            value: 2,
             label: "带出"
           }
         ]
@@ -835,11 +837,11 @@ export const useHooks = (t?: any) => {
     }
   ];
 
-  // const enumMap = inject("enumMap", ref(new Map()));
-  // const workgrpEnum = computed(() => {
-  //   console.log('领用工组领用工组领用工组领用工组 enumMap.value.get("wrkgrpid") :>> ', enumMap.value.get("wrkgrpid"));
-  //   return enumMap.value.get("wrkgrpid");
-  // });
+  const enumMap = inject("enumMap", ref(new Map()));
+  const workgrpEnum = computed(() => {
+    console.log('领用工组领用工组领用工组领用工组 enumMap.value.get("wrkgrpid") :>> ', enumMap.value.get("wrkgrpid"));
+    return enumMap.value.get("wrkgrpid");
+  });
 
   const columns_qd = ref<ColumnProps<any>[]>([
     {
@@ -1009,17 +1011,103 @@ export const useHooks = (t?: any) => {
       //   return { data: data.workgroupList };
       // },
       // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
-      enum: async () => {
-        console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
-        return { data: state.workgrpEnum };
+      // enum: async () => {
+      //   console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
+      //   return { data: state.workgrpEnum };
+      // },
+      isFilterEnum: true,
+      editRender: {
+        // name: "$select"
       },
+      editColRender: (scope: any) => {
+        console.log("formulakind editColRender scope :>> ", scope);
+        return (
+          <el-select v-model={scope.row.wrkgrpid} onChange={val => rModelSetWrkgrp1(val, scope.row)}>
+            {{
+              default: () => {
+                let rs = [];
+                if (state.workgrpEnum.length) {
+                  state.workgrpEnum.map((t: any) => {
+                    rs.push(<el-option label={t.label} value={t.value} />);
+                  });
+                }
+                return rs;
+              },
+              label: ({ label, value }) => label
+            }}
+          </el-select>
+        );
+      },
+      render: scope => {
+        let item = state.workgrpEnum.find(t => t.value == scope.row.wrkgrpid);
+        if (item) {
+          return item.label + " - " + item.code;
+        } else {
+          return "";
+        }
+      }
+    },
+    {
+      field: "wrkgrpid2",
+      title: "领用工组(新L1)",
+      // enum: async () => {
+      //   const data = await GetERPWrkGrpList();
+      //   console.log("领用工组领用工组领用工组领用工组 data :>> ", data);
+      //   return { data: data.workgroupList };
+      // },
+      // fieldNames: { label: "wrkgrpname", value: "wrkgrpid" },
+      // enum: async () => {
+      //   console.log("领用工组领用工组领用工组领用工组 state.workgrpEnum :>> ", state.workgrpEnum);
+      //   return { data: state.workgrpEnum };
+      // },
       isFilterEnum: true,
       editRender: {
-        name: "$select"
+        // name: "$select"
+      },
+      editColRender: (scope: any) => {
+        console.log("formulakind editColRender scope :>> ", scope);
+        return (
+          <el-select v-model={scope.row.wrkgrpid2} onChange={val => rModelSetWrkgrp2(val, scope.row)}>
+            {{
+              default: () => {
+                let rs = [];
+                if (state.workgrpEnum2.length) {
+                  state.workgrpEnum2.map((t: any) => {
+                    rs.push(<el-option label={t.label} value={t.value} />);
+                  });
+                }
+                return rs;
+              },
+              label: ({ label, value }) => label
+            }}
+          </el-select>
+        );
+      },
+      render: scope => {
+        let item = state.workgrpEnum2.find(t => t.value == scope.row.wrkgrpid2);
+        if (item) {
+          return item.label + " - " + item.code;
+        } else {
+          return "";
+        }
       }
     }
   ]);
 
+  const rModelSetWrkgrp1 = (value: any, data: any) => {
+    let item = state.workgrpEnum.find(t => t.value == value);
+    if (item) {
+      data.wrkgrpcode1 = item.code;
+    }
+  };
+
+  const rModelSetWrkgrp2 = (value: any, data: any) => {
+    let item = state.workgrpEnum2.find(t => t.value == value);
+    if (item) {
+      data.wrkgrpcode2 = item.code;
+    }
+  };
+
   // const columns_export = [
   //   {
   //     name: "行号",

+ 33 - 13
JLHWEB/src/views/quote/bednetQuote/components/AllFormula.vue

@@ -104,20 +104,38 @@ const isNormalFormulas = computed(() => {
 
   // let _formula = formulaList.value.filter((item: any) => item.type == 0);
   let _formula = cloneDeep(formulaList.value);
-  _formula = _formula.map((item: any) => {
-    let _val = fieldsReplace.value.find((_item: any) => _item.label == item.label);
-    if (!_val) {
-      let tgItem = formulaList.value.find(_item => _item.value.indexOf(item.label) > -1);
-      if (tgItem) {
-        item.parentId = tgItem.label;
-      } else {
-        item.parentId = null;
-      }
-    } else {
-      item.parentId = null;
+  // _formula = _formula.map((item: any) => {
+  //   let _val = fieldsReplace.value.find((_item: any) => _item.label == item.label);
+  //   if (!_val) {
+  //     let tgItem = formulaList.value.find(_item => _item.value.indexOf(item.label) > -1);
+  //     if (tgItem) {
+  //       item.parentId = tgItem.label;
+  //     } else {
+  //       item.parentId = null;
+  //     }
+  //   } else {
+  //     item.parentId = null;
+  //   }
+  //   return item;
+  // });
+
+  // return buildTreeArr(_formula).filter((item: any) => item.type == 0);
+
+  _formula = formulaList.value.map((item: any) => {
+    let matchArr = formulaList.value.filter((_item: any) => _item.type != 0 && item.value.indexOf(_item.label) > -1);
+
+    if (matchArr.length > 0) {
+      item.children = matchArr;
     }
     return item;
   });
+  console.log("_formula :>> ", _formula);
+  console.log(
+    "_formula 0:>> ",
+    _formula.filter((item: any) => item.type == 0)
+  );
+  // console.log("isNormalFormulas: >>> ", buildTreeArr(_formula));
+  // return buildTreeArr(_formula);
 
   // let replaceFormula = cloneDeep(_formula.filter((item: any) => item.ifnotreplace == true));
 
@@ -133,9 +151,11 @@ const isNormalFormulas = computed(() => {
   //     _formula[index].children.push(item);
   //   }
   // });
-  console.log("isNormalFormulas: >>> ", buildTreeArr(_formula));
+  console.log("_formula :>> ", _formula);
+  // console.log("isNormalFormulas: >>> ", buildTreeArr(_formula));
 
-  return buildTreeArr(_formula).filter((item: any) => item.type == 0);
+  // return buildTreeArr(_formula);
+  return _formula.filter((item: any) => item.type == 0);
 });
 
 const isMxFormulas = computed(() => {

+ 79 - 39
JLHWEB/src/views/quote/bednetQuote/components/FormulaItem.vue

@@ -55,6 +55,46 @@ const funcFormulaToArray = (formula: string) => {
 const RenderVariable = (data: any, rprops: any) => {
   let fieldName = data.slice(1, -1); // 去掉方括号
 
+  if (rprops.data?.children) {
+    let _trgItem = rprops.data.children.find(c => {
+      let _label = c.label.replace(/【/g, "[").replace(/】/g, "]").slice(1, -1);
+      if (_label === fieldName) {
+        return c;
+      }
+    });
+    if (_trgItem) {
+      let sumVal = props.fields.find(f => {
+        let _label = f.label.slice(1, -1);
+        if (_label === fieldName) {
+          return f;
+        }
+      });
+
+      // let _value = isFilterPrice(sumVal?.value) ?? "";
+      let _value = sumVal?.value ?? "";
+
+      return (
+        <>
+          <div class="flx-col flx-end formula-wrapper__item formula-wrapper__item-children">
+            <div class="formula-wrapper__item-children-inner">
+              <el-tooltip effect="dark" content={"= " + _trgItem.value} placement="top">
+                <div class="formula-wrapper__item-children-label text-secondary-text text-body-c flx-center w-full">
+                  <el-icon>
+                    <InfoFilled />
+                  </el-icon>
+                  {fieldName} = {_value}
+                </div>
+              </el-tooltip>
+              <span class="value text-primary-text text-h5-b flx-end-end">
+                (<RenderFormulaItem data={_trgItem} fields={props.fields} />)
+              </span>
+            </div>
+          </div>
+        </>
+      );
+    }
+  }
+
   let sumVal = props.fields.find(f => {
     let _label = f.label.slice(1, -1);
     if (_label === fieldName) {
@@ -65,45 +105,45 @@ const RenderVariable = (data: any, rprops: any) => {
   let _value = "";
   if (sumVal) {
     _value = isFilterPrice(sumVal.value);
-  } else {
-    if (rprops.data?.children) {
-      let _trgItem = rprops.data.children.find(c => {
-        let _label = c.label.replace(/【/g, "[").replace(/】/g, "]").slice(1, -1);
-        if (_label === fieldName) {
-          return c;
-        }
-      });
-      if (_trgItem) {
-        return (
-          <>
-            <div class="flx-col flx-end formula-wrapper__item formula-wrapper__item-children">
-              <div class="formula-wrapper__item-children-inner">
-                <el-tooltip effect="dark" content={"= " + _trgItem.value} placement="top">
-                  <div class="formula-wrapper__item-children-label text-secondary-text text-body-c flx-center w-full">
-                    {fieldName}
-                    <el-icon>
-                      <InfoFilled />
-                    </el-icon>
-                  </div>
-                </el-tooltip>
-                <span class="value text-primary-text text-h5-b flx-end-end">
-                  (<RenderFormulaItem data={_trgItem} fields={props.fields} />)
-                </span>
-              </div>
-            </div>
-          </>
-        );
-      } else {
-        return (
-          <>
-            <div class="flx-col flx-end formula-wrapper__item">
-              <span class="label text-secondary-text text-body-c">{fieldName}</span>
-              <span class="value text-primary-text text-h5-b">0</span>
-            </div>
-          </>
-        );
-      }
-    }
+    // } else {
+    //   if (rprops.data?.children) {
+    //     let _trgItem = rprops.data.children.find(c => {
+    //       let _label = c.label.replace(/【/g, "[").replace(/】/g, "]").slice(1, -1);
+    //       if (_label === fieldName) {
+    //         return c;
+    //       }
+    //     });
+    //     if (_trgItem) {
+    //       return (
+    //         <>
+    //           <div class="flx-col flx-end formula-wrapper__item formula-wrapper__item-children">
+    //             <div class="formula-wrapper__item-children-inner">
+    //               <el-tooltip effect="dark" content={"= " + _trgItem.value} placement="top">
+    //                 <div class="formula-wrapper__item-children-label text-secondary-text text-body-c flx-center w-full">
+    //                   {fieldName}
+    //                   <el-icon>
+    //                     <InfoFilled />
+    //                   </el-icon>
+    //                 </div>
+    //               </el-tooltip>
+    //               <span class="value text-primary-text text-h5-b flx-end-end">
+    //                 (<RenderFormulaItem data={_trgItem} fields={props.fields} />)
+    //               </span>
+    //             </div>
+    //           </div>
+    //         </>
+    //       );
+    //     } else {
+    //       return (
+    //         <>
+    //           <div class="flx-col flx-end formula-wrapper__item">
+    //             <span class="label text-secondary-text text-body-c">{fieldName}</span>
+    //             <span class="value text-primary-text text-h5-b">0</span>
+    //           </div>
+    //         </>
+    //       );
+    //     }
+    //   }
   }
 
   // let _value = sumVal ? isFilterPrice(sumVal.value) : "无";

+ 33 - 12
JLHWEB/src/views/quote/mattressQuote/components/AllFormula.vue

@@ -79,20 +79,39 @@ const dannumOptions = ["散单", "小单", "标准", "大单"];
 
 const isNormalFormulas = computed(() => {
   let _formula = formulaList.value.filter((item: any) => item.type == 0);
-  _formula = _formula.map((item: any) => {
-    let _val = fieldsReplace.value.find((_item: any) => _item.label == item.label);
-    if (!_val) {
-      let tgItem = formulaList.value.find(_item => _item.value.indexOf(item.label) > -1);
-      if (tgItem) {
-        item.parentId = tgItem.label;
-      } else {
-        item.parentId = null;
-      }
-    } else {
-      item.parentId = null;
+  let _formula1 = formulaList.value.filter((item: any) => item.type == 1);
+  // _formula = _formula.map((item: any) => {
+  // let _val = fieldsReplace.value.find((_item: any) => _item.label == item.label);
+  // if (!_val) {
+  //   let tgItem = formulaList.value.find(_item => _item.value.indexOf(item.label) > -1);
+  //   if (tgItem) {
+  //     item.parentId = tgItem.label;
+  //   } else {
+  //     item.parentId = null;
+  //   }
+  // } else {
+  //   item.parentId = null;
+  // }
+  //   return item;
+  // });
+
+  // return buildTreeArr(_formula);
+
+  _formula = formulaList.value.map((item: any) => {
+    let matchArr = formulaList.value.filter((_item: any) => _item.type != 0 && item.value.indexOf(_item.label) > -1);
+
+    if (matchArr.length > 0) {
+      item.children = matchArr;
     }
     return item;
   });
+  console.log("_formula :>> ", _formula);
+  console.log(
+    "_formula 0:>> ",
+    _formula.filter((item: any) => item.type == 0)
+  );
+  // console.log("isNormalFormulas: >>> ", buildTreeArr(_formula));
+  // return buildTreeArr(_formula);
 
   // let replaceFormula = cloneDeep(_formula.filter((item: any) => item.ifnotreplace == true));
 
@@ -108,9 +127,11 @@ const isNormalFormulas = computed(() => {
   //     _formula[index].children.push(item);
   //   }
   // });
+  console.log("_formula :>> ", _formula);
   // console.log("isNormalFormulas: >>> ", buildTreeArr(_formula));
 
-  return buildTreeArr(_formula);
+  // return buildTreeArr(_formula);
+  return _formula.filter((item: any) => item.type == 0);
 });
 const isNormalFormulasOri = computed(() => {
   return formulaListOri.value.filter((item: any) => item.type == 0);

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

@@ -1,84 +1,220 @@
 <template>
-  <div>
-    <el-table :data="tableData" style="width: 100%; margin-bottom: 20px" row-key="id" border default-expand-all>
-      <el-table-column prop="date" label="Date" sortable />
-      <el-table-column prop="name" label="Name" sortable />
-      <el-table-column prop="address" label="Address" sortable />
-    </el-table>
-
-    <el-table
-      :data="tableData1"
-      style="width: 100%"
-      row-key="id"
-      border
-      lazy
-      :load="load"
-      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
-    >
-      <el-table-column prop="date" label="Date" />
-      <el-table-column prop="name" label="Name" />
-      <el-table-column prop="address" label="Address" />
-    </el-table>
-  </div>
+  <LjDrawer ref="LjDrawerRef" size="50%" :class="prefixCls">
+    <template #header>
+      <div class="flx-1">
+        {{ $t("business.detail.quoteList") }}
+
+        <el-button v-if="iforigin" type="primary" size="small" @click="handleOpenOriginQuote">
+          {{ ifShowOrigin ? "返回新报价清单" : "查看旧报价清单" }}
+        </el-button>
+        <el-checkbox
+          v-if="!ifShowOrigin"
+          v-model="ifExpandAll"
+          label="展开明细"
+          size="small"
+          style="margin-left: 20px"
+          @change="toggleRowExpansionAll(tableData2, ifExpandAll)"
+        ></el-checkbox>
+      </div>
+    </template>
+
+    <el-descriptions :column="3">
+      <template #title>
+        <span class="text-body-b">报价日期:</span>
+        <span class="text-body-b" v-if="showData.data.createtime">{{ isFilterTime(showData.data.createtime) }}</span>
+      </template>
+      <template #extra v-if="ifShowOrigin">
+        <span class="text-body-b">报价金额:</span>
+        <span class="text-body-b">{{ isFilterPrice(showData.data.foreign_cost) + isCurrency }}</span>
+      </template>
+      <el-descriptions-item v-for="(item, idx) in fields" :key="idx" width="80">
+        <template #label>
+          <span class="text-secondary-text"> {{ item.label }}: </span>
+        </template>
+        <span class="text-body-m">{{
+          Object.keys(item).includes("value") ? item.value : isFilterPrice(showData.data[item.field])
+        }}</span>
+      </el-descriptions-item>
+    </el-descriptions>
+
+    <template v-if="!ifShowOrigin">
+      <el-table
+        :data="tableData"
+        size="small"
+        border
+        style="width: 100%"
+        :summary-method="getSummaries"
+        :span-method="objectSpanMethod"
+      >
+        <el-table-column prop="level" label="类目" />
+        <el-table-column prop="group" label="二级项目" />
+        <template v-if="ifExpandAll">
+          <el-table-column prop="label" label="项目" />
+          <el-table-column prop="dscrp" label="内容" width="160" />
+          <el-table-column prop="qty" label="数量" align="right" />
+          <el-table-column prop="useqty" label="用量" align="right" />
+          <el-table-column prop="price" label="单价" align="right" />
+        </template>
+        <el-table-column prop="costamt_2" label="标准金额" align="right" />
+        <el-table-column prop="costamt_1" label="散单金额" align="right" />
+        <el-table-column prop="costamt_4" label="小单金额" align="right" />
+        <el-table-column prop="costamt_3" label="大单金额" align="right" />
+      </el-table>
+
+      <!-- <vxe-table
+        border="full"
+        ref="tableRef"
+        :tree-config="treeConfig"
+        :data="tableData"
+        @toggle-tree-expand="toggleExpandChangeEvent"
+      >
+        <vxe-column field="label" title="项目" tree-node width="120"></vxe-column>
+        <vxe-column field="dscrp" title="内容" width="160"></vxe-column>
+        <vxe-column field="qty" title="数量"></vxe-column>
+        <vxe-column field="costamt" title="数量"></vxe-column>
+        <template v-if="iforigin && !ifShowOrigin">
+          <vxe-column field="costamt_1" title="散单金额"></vxe-column>
+          <vxe-column field="costamt_1" title="标准金额"></vxe-column>
+          <vxe-column field="costamt_1" title="大单金额"></vxe-column>
+          <vxe-column field="costamt_1" title="小单金额"></vxe-column>
+        </template>
+        <vxe-column field="useqty" title="用量"></vxe-column>
+        <vxe-column field="price" title="单价"></vxe-column>
+      </vxe-table> -->
+    </template>
+
+    <template v-else>
+      <el-table
+        :data="tableData"
+        height="100%"
+        size="small"
+        border
+        style="width: 100%"
+        show-summary
+        :summary-method="getSummaries"
+        :span-method="objectSpanMethod"
+      >
+        <el-table-column prop="label" label="项目" />
+        <el-table-column prop="dscrp" label="内容" width="160" />
+        <el-table-column prop="qty" label="数量" align="right" />
+        <el-table-column prop="costamt" label="金额" align="right" />
+        <el-table-column prop="useqty" label="用量" align="right" />
+        <el-table-column prop="price" label="单价" align="right" />
+      </el-table>
+      <!-- <el-table
+        :data="tableData"
+        size="small"
+        border
+        style="width: 100%"
+        show-summary
+        :summary-method="getSummaries"
+        :span-method="objectSpanMethod"
+      >
+        <el-table-column prop="label" label="项目" />
+        <el-table-column prop="dscrp" label="内容" width="160" />
+        <el-table-column prop="qty" label="数量" align="right" />
+        <el-table-column prop="costamt" label="金额" align="right" />
+        <template v-if="iforigin && !ifShowOrigin">
+          <el-table-column prop="costamt_1" label="散单金额" align="right" />
+          <el-table-column prop="costamt_2" label="标准金额" align="right" />
+          <el-table-column prop="costamt_3" label="大单金额" align="right" />
+          <el-table-column prop="costamt_4" label="小单金额" align="right" />
+        </template>
+        <el-table-column prop="useqty" label="用量" align="right" />
+        <el-table-column prop="price" label="单价" align="right" />
+      </el-table> -->
+      <!-- <el-table
+        ref="elTableRef"
+        :data="tableData2"
+        style="width: 100%; margin-bottom: 20px"
+        row-key="id"
+        border
+        :default-expand-all="ifExpandAll"
+        :span-method="objectSpanMethod3"
+        :expand-change="expandChangeFunc"
+      >
+        <el-table-column prop="label" label="Date" />
+        <el-table-column prop="name" label="Name" />
+        <el-table-column prop="address" label="Address" />
+      </el-table> -->
+    </template>
+  </LjDrawer>
 </template>
 
-<script lang="ts" setup>
-interface User {
-  id: number;
-  date: string;
-  name: string;
-  address: string;
-  hasChildren?: boolean;
-  children?: User[];
+<script setup lang="tsx" name="mattressQuoteLjDrawerQuoteList">
+import { ref, computed, reactive, nextTick } from "vue";
+import LjDrawer from "@/components/LjDrawer/index.vue";
+import { useDesign } from "@/hooks/useDesign";
+import { formatTime, formatAmount3, floatAdd } from "@/utils/index";
+import { isFunction } from "@/utils/is";
+import { cloneDeep, pick } from "lodash-es";
+// import { useUserStore } from "@/stores/modules/user";
+import { CommonDynamicSelect } from "@/api/modules/common";
+import { useHooksCpQuote } from "../hooks/cpQuote";
+import { isFilterPrice, autoMergeCells } from "@/utils/index";
+
+interface WidgetProps {
+  // data: any;
+  iforigin: boolean;
 }
 
-const load = (row: User, treeNode: unknown, resolve: (data: User[]) => void) => {
-  setTimeout(() => {
-    resolve([
-      {
-        id: 31,
-        date: "2016-05-01",
-        name: "wangxiaohu",
-        address: "No. 189, Grove St, Los Angeles"
-      },
-      {
-        id: 32,
-        date: "2016-05-01",
-        name: "wangxiaohu",
-        address: "No. 189, Grove St, Los Angeles"
-      }
-    ]);
-  }, 1000);
-};
+// interface WidgetTableItem {
+//   label: string;
+//   dscrp: any;
+//   qty?: number | string;
+//   costamt?: number | string;
+//   useqty?: number | string;
+//   price?: number | string;
+//   [key: string]: any;
+// }
+
+const props = withDefaults(defineProps<WidgetProps>(), {
+  iforigin: false
+});
+
+const { prefixCls } = useDesign("ljdrawer-quotelist");
+// const { userInfo } = useUserStore();
+const { enumMap, tableData, oriTableData, wf_retrieve_qingdan } = useHooksCpQuote();
+
+const LjDrawerRef = ref();
+const elTableRef = ref();
+const tableRef = ref();
+const mainData = ref<any>({});
+const showData = ref<any>({});
+const ifExpandAll = ref<any>(false);
+
+const isCurrency = computed(() => {
+  return showData.value.data?.moneyrate != 1 ? "美金" : "人民币";
+});
 
-const tableData: User[] = [
+const tableData2: any[] = [
   {
     id: 1,
-    date: "2016-05-02",
+    label: "2016-05-02",
     name: "wangxiaohu",
     address: "No. 189, Grove St, Los Angeles"
   },
   {
     id: 2,
-    date: "2016-05-04",
+    label: "2016-05-04",
     name: "wangxiaohu",
     address: "No. 189, Grove St, Los Angeles"
   },
   {
     id: 3,
-    date: "2016-05-01",
+    label: "2016-05-01",
     name: "wangxiaohu",
     address: "No. 189, Grove St, Los Angeles",
     children: [
       {
         id: 31,
-        date: "2016-05-01",
+        label: "2016-05-01",
         name: "wangxiaohu",
         address: "No. 189, Grove St, Los Angeles"
       },
       {
         id: 32,
-        date: "2016-05-01",
+        label: "2016-05-01",
         name: "wangxiaohu",
         address: "No. 189, Grove St, Los Angeles"
       }
@@ -86,37 +222,291 @@ const tableData: User[] = [
   },
   {
     id: 4,
-    date: "2016-05-03",
+    label: "2016-05-03",
     name: "wangxiaohu",
     address: "No. 189, Grove St, Los Angeles"
   }
 ];
 
-const tableData1: User[] = [
-  {
-    id: 1,
-    date: "2016-05-02",
-    name: "wangxiaohu",
-    address: "No. 189, Grove St, Los Angeles"
-  },
-  {
-    id: 2,
-    date: "2016-05-04",
-    name: "wangxiaohu",
-    address: "No. 189, Grove St, Los Angeles"
-  },
-  {
-    id: 3,
-    date: "2016-05-01",
-    name: "wangxiaohu",
-    hasChildren: true,
-    address: "No. 189, Grove St, Los Angeles"
-  },
-  {
-    id: 4,
-    date: "2016-05-03",
-    name: "wangxiaohu",
-    address: "No. 189, Grove St, Los Angeles"
+const treeConfig = reactive<any>({
+  transform: true,
+  rowField: "id",
+  parentField: "parentId"
+});
+
+const toggleExpandChangeEvent: any = params => {
+  const $table = tableRef.value;
+  if ($table) {
+    const { row, expanded } = params;
+    console.log("节点展开事件", expanded, "获取父节点:", $table.getParentRow(row));
   }
-];
+};
+
+const ifShowOrigin = ref(false);
+const originData = ref<any>();
+
+const setOriginData = () => {
+  let _data = cloneDeep(mainData.value);
+  if (ifShowOrigin.value) {
+    // 旧报价
+    fields.value.map(item => {
+      let _rp = originData.value.find(itm => itm.label.replace(/【/g, "").replace(/】/g, "") === item.replacelabel);
+      if (_rp) {
+        _data.data[item.field] = _rp.value;
+      }
+    });
+    let _rp = originData.value.find(itm => itm.label.replace(/【/g, "").replace(/】/g, "") === "散单金额");
+    if (_rp) {
+      _data.data.foreign_cost = _rp.value;
+    }
+  }
+  showData.value = _data;
+  wf_retrieve_qingdan(_data, !ifShowOrigin.value, ifExpandAll.value);
+};
+
+const handleOpenOriginQuote = () => {
+  ifShowOrigin.value = !ifShowOrigin.value;
+
+  console.log("handleOpenOriginQuote>>>>>  ", mainData.value);
+  setOriginData();
+};
+const toggleRowExpansionAll = (data, isExpansion) => {
+  wf_retrieve_qingdan(mainData.value, !ifShowOrigin.value, ifExpandAll.value);
+  // data.forEach(async item => {
+  //   // const elTableRef = await getElTableExpose()
+  //   elTableRef.value?.toggleRowExpansion(item, isExpansion);
+  //   if (item.children !== undefined && item.children !== null) {
+  //     toggleRowExpansionAll(item.children, isExpansion);
+  //   }
+  // });
+};
+
+const objectSpanMethod3 = ({ row, column, rowIndex, columnIndex }: any) => {
+  // // console.log("objectSpanMethod row,column, rowIndex,columnIndex :>> ", data);
+  // if (column.property == "label") {
+  //   let rowspan = 1;
+  //   let currentVal = row.label;
+  //   let lastVal = "";
+  //   // 上一个
+  //   if (rowIndex - 1 >= 0) {
+  //     lastVal = tableData2[rowIndex - 1]?.label;
+  //   }
+
+  //   if (lastVal) {
+  //     if (lastVal != currentVal) {
+  //       // 计算合并行数
+  //       let _span = 0;
+  //       for (let i = rowIndex + 1; i < tableData2.length; i++) {
+  //         if (tableData2[i].label == currentVal) {
+  //           _span++;
+  //         } else {
+  //           break;
+  //         }
+  //       }
+  //       rowspan += _span;
+  //       console.log("rowspan _span :>> ", lastVal, currentVal, rowspan, _span);
+  //     } else {
+  //       rowspan = 0;
+  //     }
+  //   }
+
+  //   return {
+  //     rowspan,
+  //     colspan: rowspan > 0 ? 1 : 0
+  //   };
+  // }
+
+  // //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
+  // const fields = ["label"];
+  // // 当前行的数据
+  // const cellValue = row[column.property];
+  // // 判断只合并定义字段的列数据
+  // if (cellValue && fields.includes(column.property)) {
+  //   const prevRow = tableData2[rowIndex - 1]; //上一行数据
+  //   let nextRow = tableData2[rowIndex + 1]; //下一行数据
+  //   // 当上一行的数据等于当前行数据时,当前行单元格隐藏
+  //   if (prevRow && prevRow[column.property] === cellValue) {
+  //     return { rowspan: 0, colspan: 0 };
+  //   } else {
+  //     // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
+  //     let countRowspan = 1; //用于合并计数多少单元格
+  //     while (nextRow && nextRow[column.property] === cellValue) {
+  //       nextRow = tableData2[++countRowspan + rowIndex];
+  //     }
+  //     if (countRowspan > 1) {
+  //       return { rowspan: countRowspan, colspan: 1 };
+  //     }
+  //   }
+  // }
+
+  if (columnIndex === 0) {
+    if (rowIndex === 2) {
+      return {
+        rowspan: 3,
+        colspan: 1
+      };
+    } else if (rowIndex >= 3 && rowIndex < 4) {
+      return {
+        rowspan: 0,
+        colspan: 0
+      };
+    }
+  }
+
+  console.log("elTableRef.value :>> ", elTableRef.value);
+};
+
+const expandChangeFunc = () => {};
+
+const show = (params: any, originReplace?: any) => {
+  console.log("show>>>>>  ", params, originReplace);
+  originData.value = [];
+  if (ifShowOrigin.value) {
+    setOriginData();
+  }
+  mainData.value = cloneDeep(params);
+  showData.value = cloneDeep(params);
+  wf_retrieve_qingdan(params, !ifShowOrigin.value, ifExpandAll.value);
+
+  LjDrawerRef.value.show();
+  // nextTick(() => {
+  //   let mergeCells = autoMergeCells(tableRef.value, ["label"]);
+  //   console.log("resetMergeCellsInner autoMergeCells  :>> ", mergeCells);
+  //   tableRef.value.setMergeCells(mergeCells);
+  // });
+};
+
+const isFilterTime = time => {
+  return formatTime(time, "{y}-{m}-{d}", false);
+};
+
+const fields = computed(() => {
+  if (!ifShowOrigin.value) {
+    const { data } = showData.value;
+
+    let _enum = enumMap.value.get("mattresstypeid");
+    let result = "";
+    if (_enum) {
+      result = _enum.find(t => t.value == data.mattresstypeid).label ?? "";
+    }
+
+    let arr = [];
+    if (Number(data.if_m_chai) == 1) {
+      arr.push("面拆");
+    }
+    if (Number(data.if_z_chai) == 1) {
+      arr.push("中拆");
+    }
+    if (Number(data.if_d_chai) == 1) {
+      arr.push("底拆");
+    }
+    if (Number(data.if_n_butao) == 1) {
+      arr.push("内布套");
+    }
+    if (Number(data.if_w_butao) == 1) {
+      arr.push("外布套");
+    }
+    return [
+      { label: "核价编码", value: data.mattresscode },
+      { label: "核价名称", value: data?.mattressname == "" ? "未命名" : data?.mattressname },
+      { label: "床垫类别", value: result },
+      { label: "床垫规格", value: `${data.mattress_width} * ${data.mattress_length} * ${data.mattress_height}` },
+      { label: "拆装、布套", value: arr.join(" ") },
+      { label: "地区", value: data.area ?? "" },
+      { label: "柜型", value: data.cabinet_type ?? "" }
+    ];
+  } else {
+    return [
+      { label: "财务底价", field: "nottax_dept_cost", replacelabel: "部门不含税价" },
+      { label: "佣金点数", field: "commission", replacelabel: "佣金点数" },
+      { label: "税率", field: "taxrate", replacelabel: "税率" },
+      { label: "额外点数", field: "other_rate", replacelabel: "额外点数" },
+      { label: "额外费用", field: "extras_cost", replacelabel: "额外费用" },
+      { label: "汇率", field: "moneyrate", replacelabel: "汇率" },
+      { label: "款式费用", field: "hrcost", replacelabel: "人工费用" },
+      { label: "边带费用", field: "biandaicost", replacelabel: "边带费用" },
+      { label: "总成本", field: "total_cost", replacelabel: "车间成本" },
+      { label: "工厂利润率", field: "profitrate", replacelabel: "工厂利润率" },
+      { label: "工艺点数", field: "profitrate_point", replacelabel: "工艺点数" },
+      { label: "不含税出厂价", field: "nottax_factory_cost", replacelabel: "不含税出厂价" },
+      { label: "部门利润率", field: "dept_profitrate", replacelabel: "部门利润率" },
+      { label: "FOB费用", field: "fob", replacelabel: "FOB" },
+      { label: "部门售价", field: "nottax_dept_cost", replacelabel: "部门不含税价" },
+      { label: "让利点数", field: "dept_profitrate_rangli", replacelabel: "部门让利点数" },
+      { label: "海绵款扣点", field: "haimian_point", replacelabel: "海绵扣点" }
+    ];
+  }
+});
+
+const getSummaries = (param: any) => {
+  const { columns, data } = param;
+  console.log("getSummaries param :>> ", param);
+  const sums: any[] = [];
+  columns.forEach((column, index) => {
+    if (index === 0) {
+      sums[index] = <div>材料合计:</div>;
+      return;
+    }
+    const values = data.map(item => Number(item[column.property]?.toString().replace(/,/g, "")));
+    if (column.property == "costamt" && !values.every(value => Number.isNaN(value))) {
+      // console.log("values :>> ", values);
+      sums[index] = `${values.reduce((prev, curr) => {
+        // console.log("prev,curr :>> ", prev, curr);
+        const value = Number(curr);
+        if (!Number.isNaN(value)) {
+          return floatAdd(prev, curr);
+        } else {
+          return prev;
+        }
+      }, 0)}`;
+    } else {
+      sums[index] = "";
+    }
+  });
+
+  return sums;
+};
+
+const objectSpanMethod = (data: any) => {
+  const { row, column, rowIndex, columnIndex } = data;
+  // console.log("objectSpanMethod row,column, rowIndex,columnIndex :>> ", data);
+  if (["level", "group", "label"].includes(column.property)) {
+    let rowspan = 1;
+    let currentVal = row[column.property];
+    let lastVal = "";
+    // 上一个
+    if (rowIndex - 1 >= 0) {
+      lastVal = tableData.value[rowIndex - 1][column.property];
+    }
+
+    console.log("objectSpanMethod lastVal rowIndex :>> ", lastVal, rowIndex, lastVal || rowIndex == 0);
+    if (currentVal && (lastVal || rowIndex == 0)) {
+      if (lastVal != currentVal) {
+        // 计算合并行数
+        let _span = 0;
+        for (let i = rowIndex + 1; i < tableData.value.length; i++) {
+          console.log("tableData.value[i].label :>> ", tableData.value[i][column.property], currentVal, _span);
+          if (tableData.value[i][column.property] == currentVal) {
+            _span++;
+          } else {
+            break;
+          }
+        }
+        rowspan += _span;
+      } else {
+        rowspan = 0;
+      }
+    }
+    console.log("rowspan _span :>> ", lastVal, currentVal, rowspan);
+
+    return {
+      rowspan,
+      colspan: rowspan > 0 ? 1 : 0
+    };
+  }
+};
+
+defineExpose({
+  show
+});
 </script>

+ 12 - 3
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -799,7 +799,8 @@ import { ArrowDown } from "@element-plus/icons-vue";
 // import { calculateFormula } from "@/utils/index";
 import MtrldefDialog from "@/views/system/selector/mtrldef/index.vue";
 import BednetDialog from "@/views/system/selector/bednet/index.vue";
-import LjDrawerQuoteList from "./components/QuoteList.vue";
+// import LjDrawerQuoteList from "./components/QuoteList.vue";
+import LjDrawerQuoteList from "./components/QuoteListNew.vue";
 import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords, floatAdd, floatMul } from "@/utils/index";
@@ -904,6 +905,7 @@ const {
   cmpFormulas,
   cmpFormulaReplace,
   cmpFormulasOri,
+  cmpFormulasBednet,
   cmpDiffer,
   subSpecsRef,
   columnsMx_subSpecs,
@@ -2080,7 +2082,13 @@ const orderDefaultAction = [
         mxdata: isQuoteListMxData.value,
         enumMap: LjDetailRef.value.enumMap,
         fabricMx: fabricMxTabList.value,
-        formulakindenum: formulaKindEnum.value
+        formulakindenum: formulaKindEnum.value,
+        dannum_type: LjDetailRef.value._mainData.dannum_type,
+        formula: cmpFormulas.value,
+        replace: cmpFormulaReplace.value,
+        formula_ori: cmpFormulasOri.value,
+        formula_bednet: cmpFormulasBednet.value,
+        differ: cmpDiffer.value
       };
       QuoteListDrawerRef.value.show(_data);
     }
@@ -2096,7 +2104,8 @@ const orderDefaultAction = [
         mxdata: isQuoteListMxData.value,
         enumMap: LjDetailRef.value.enumMap,
         fabricMx: fabricMxTabList.value,
-        formulakindenum: formulaKindEnum.value
+        formulakindenum: formulaKindEnum.value,
+        differ: cmpDiffer.value
       };
       await toExcelQuote(_data, "床垫报价单_" + LjDetailRef.value._mainData.mattresscode);
       loadingStatus.download = false;

+ 358 - 49
JLHWEB/src/views/quote/mattressQuote/hooks/cpQuote.ts

@@ -23,7 +23,10 @@ interface WidgetTableItem {
 interface defaultState {
   tableData: any;
   oriTableData: WidgetTableItem[];
+  newTableData: WidgetTableItem[];
   enumMap: any;
+  // tabldId: number;
+  bednet_qingdan: any;
 }
 
 interface wfQingdanProps {
@@ -38,13 +41,20 @@ interface wfQingdanProps {
    */
   fabricMx?: any;
   formulakindenum?: any;
+  dannum_type?: number;
+  formula?: any;
+  // replace?: any;
+  // formula_ori?: any;
+  differ?: any;
 }
 
 export const useHooksCpQuote = (t?: any) => {
   const { userInfo } = useUserStore();
 
   const state = reactive<defaultState>({
+    // tabldId: 0,
     tableData: [],
+    bednet_qingdan: [],
     oriTableData: [
       {
         label: "核价编码",
@@ -114,6 +124,7 @@ export const useHooksCpQuote = (t?: any) => {
         price: ""
       }
     ],
+    newTableData: [],
     enumMap: null
   });
 
@@ -121,13 +132,18 @@ export const useHooksCpQuote = (t?: any) => {
     return formatAmount3({ val: data });
   };
 
-  const wf_retrieve_qingdan_bednet = async (data: any) => {
+  const wf_retrieve_qingdan_bednet = async (data: any, index: any) => {
     const { getDataMxAdd, getDataMxSpring, dataCallback } = useHooks(t);
     let s_bednet_qingdan = [];
+    let bednet_qingdan_item = [];
+    let default_bednet_qingdan = {
+      level: "车间成本",
+      group: `床网${index + 1}-总材料成本`
+    };
 
     // let bednetMxData = [];
     // let bednetMxSpringData = [];
-    console.log("data :>> ", data);
+    console.log("wf_retrieve_qingdan_bednet data :>> ", data);
     let res = await getDataMxAdd({ arg_bednetid: data.list[0].bednetid });
     let mxResult = dataCallback(res);
     console.log("wf_retrieve_qingdan_bednet mxResult :>> ", mxResult);
@@ -209,7 +225,6 @@ export const useHooksCpQuote = (t?: any) => {
       useqty: 0
     };
 
-    console.log("mxResult.list[0].if_part :>> ", mxResult.list[0].if_part, springResult);
     //弹簧线径/高度/口径/中心直径/圈数
     if (Number(mxResult.list[0].if_part) == 0) {
       item.pznamemx = mxResult.list[0].springname;
@@ -243,6 +258,23 @@ export const useHooksCpQuote = (t?: any) => {
       ls_弹簧 = ls_t_temp + "/" + ls_right;
     }
     s_bednet_qingdan.push(item);
+    let result = cloneDeep(default_bednet_qingdan);
+    result.label = "弹簧";
+    result.dscrp = ls_弹簧;
+    result.costamt = mxResult.list[0].spring_mtrl_cost;
+    result.costamt_1 = isFilterPrice(
+      formatCutNumber({ val: floatMul(mxResult.list[0].spring_mtrl_cost ?? 0, 1 + mxResult.list[0].dannum1_rate) })
+    );
+    result.costamt_2 = isFilterPrice(
+      formatCutNumber({ val: floatMul(mxResult.list[0].spring_mtrl_cost ?? 0, 1 + mxResult.list[0].dannum2_rate) })
+    );
+    result.costamt_3 = isFilterPrice(
+      formatCutNumber({ val: floatMul(mxResult.list[0].spring_mtrl_cost ?? 0, 1 + mxResult.list[0].dannum3_rate) })
+    );
+    result.costamt_4 = isFilterPrice(
+      formatCutNumber({ val: floatMul(mxResult.list[0].spring_mtrl_cost ?? 0, 1 + mxResult.list[0].dannum4_rate) })
+    );
+    bednet_qingdan_item.push(result);
     console.log("s_bednet_qingdan ls_弹簧:>> ", ls_弹簧);
 
     //多区弹簧/高度/口径/中心直径/圈数
@@ -273,6 +305,16 @@ export const useHooksCpQuote = (t?: any) => {
     if (Number(mxResult.list[0].side_iron_qty) > 0) {
       item.pznamemx = mxResult.list[0].side_iron_qty + "条";
       ls_边铁 = Number(mxResult.list[0].side_iron_qty) + "条边铁";
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "边铁";
+      result.dscrp = ls_边铁;
+      result.costamt = mxResult.list[0].side_iron_mtrl_cost;
+      result.costamt_1 = mxResult.list[0].side_iron_mtrl_cost;
+      result.costamt_2 = mxResult.list[0].side_iron_mtrl_cost;
+      result.costamt_3 = mxResult.list[0].side_iron_mtrl_cost;
+      result.costamt_4 = mxResult.list[0].side_iron_mtrl_cost;
+      bednet_qingdan_item.push(result);
     } else {
       ls_边铁 = "无边铁";
     }
@@ -288,13 +330,33 @@ export const useHooksCpQuote = (t?: any) => {
     if (Number(mxResult.list[0].fabrics2_mtrlid) > 0) {
       let enumItem = mxResult.tableinfo.columns.find((item: any) => item.field == "fabrics2_mtrlid");
       let _pznamemx = "";
+      let enumItem_enum = null;
 
       console.log("fabrics2_mtrlid enumItem :>> ", enumItem);
       if (enumItem) {
-        _pznamemx = enumItem.enum.find((item: any) => item.value == mxResult.list[0].fabrics2_mtrlid)?.label;
+        enumItem_enum = enumItem.enum.find((item: any) => item.value == mxResult.list[0].fabrics2_mtrlid);
+        _pznamemx = enumItem_enum?.label;
       }
       item.pznamemx = _pznamemx;
       ls_底面无纺布 = _pznamemx;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "底面无纺布";
+      result.dscrp = ls_底面无纺布;
+      result.costamt = mxResult.list[0].fabrics2_mtrl_cost;
+      result.costamt_1 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics2_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum1_rate) })
+      );
+      result.costamt_2 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics2_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum2_rate) })
+      );
+      result.costamt_3 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics2_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum3_rate) })
+      );
+      result.costamt_4 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics2_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum4_rate) })
+      );
+      bednet_qingdan_item.push(result);
     } else {
       ls_底面无纺布 = "";
     }
@@ -308,14 +370,35 @@ export const useHooksCpQuote = (t?: any) => {
       amt: 0,
       useqty: 0
     };
+    console.log("Number(data.list[0].fabrics1_mtrlid) :>> ", Number(mxResult.list[0].fabrics1_mtrlid), mxResult.list[0]);
     if (Number(mxResult.list[0].fabrics1_mtrlid) > 0) {
       let enumItem = mxResult.tableinfo.columns.find((item: any) => item.field == "fabrics1_mtrlid");
+      let enumItem_enum = null;
       let _pznamemx = "";
       if (enumItem) {
-        _pznamemx = enumItem.enum.find((item: any) => item.value == mxResult.list[0].fabrics1_mtrlid)?.label;
+        enumItem_enum = enumItem.enum.find((item: any) => item.value == mxResult.list[0].fabrics1_mtrlid);
+        _pznamemx = enumItem_enum?.label;
       }
       item.pznamemx = _pznamemx;
       ls_入袋无纺布 = _pznamemx;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "入袋无纺布";
+      result.dscrp = ls_入袋无纺布;
+      result.costamt = mxResult.list[0].fabrics1_mtrl_cost;
+      result.costamt_1 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics1_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum1_rate) })
+      );
+      result.costamt_2 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics1_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum2_rate) })
+      );
+      result.costamt_3 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics1_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum3_rate) })
+      );
+      result.costamt_4 = isFilterPrice(
+        formatCutNumber({ val: floatMul(mxResult.list[0].fabrics1_mtrl_cost ?? 0, 1 + enumItem_enum?.dannum4_rate) })
+      );
+      bednet_qingdan_item.push(result);
     } else {
       ls_入袋无纺布 = "";
     }
@@ -328,9 +411,19 @@ export const useHooksCpQuote = (t?: any) => {
       amt: 0,
       useqty: 0
     };
-    if (data.list[0].mtrl_felt_name) {
+    if (Number(data.list[0].felt_mtrlid) > 0) {
       item.pznamemx = data.list[0].mtrl_felt_name;
       ls_上垫层物料 = data.list[0].mtrl_felt_name;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "上垫层物料";
+      result.dscrp = ls_上垫层物料;
+      result.costamt = data.list[0].felt_mtrl_cost;
+      result.costamt_1 = data.list[0].felt_mtrl_cost;
+      result.costamt_2 = data.list[0].felt_mtrl_cost;
+      result.costamt_3 = data.list[0].felt_mtrl_cost;
+      result.costamt_4 = data.list[0].felt_mtrl_cost;
+      bednet_qingdan_item.push(result);
     } else {
       ls_上垫层物料 = "";
     }
@@ -343,9 +436,19 @@ export const useHooksCpQuote = (t?: any) => {
       amt: 0,
       useqty: 0
     };
-    if (data.list[0].mtrl_felt_x_name) {
+    if (Number(data.list[0].felt_x_mtrlid) > 0) {
       item.pznamemx = data.list[0].mtrl_felt_x_name;
       ls_下垫层物料 = data.list[0].mtrl_felt_x_name;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "下垫层物料";
+      result.dscrp = ls_下垫层物料;
+      result.costamt = data.list[0].felt_mtrl_x_cost;
+      result.costamt_1 = data.list[0].felt_mtrl_x_cost;
+      result.costamt_2 = data.list[0].felt_mtrl_x_cost;
+      result.costamt_3 = data.list[0].felt_mtrl_x_cost;
+      result.costamt_4 = data.list[0].felt_mtrl_x_cost;
+      bednet_qingdan_item.push(result);
     } else {
       ls_下垫层物料 = "";
     }
@@ -374,6 +477,16 @@ export const useHooksCpQuote = (t?: any) => {
     };
     if (Number(mxResult.list[0].if_hard_around) > 0) {
       item.pznamemx = mxResult.list[0].hard_around_springname;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "四周加硬弹簧";
+      result.dscrp = mxResult.list[0].hard_around_springname;
+      result.costamt = mxResult.list[0].hard_around_mtrl_cost;
+      result.costamt_1 = mxResult.list[0].hard_around_mtrl_cost;
+      result.costamt_2 = mxResult.list[0].hard_around_mtrl_cost;
+      result.costamt_3 = mxResult.list[0].hard_around_mtrl_cost;
+      result.costamt_4 = mxResult.list[0].hard_around_mtrl_cost;
+      bednet_qingdan_item.push(result);
     }
     s_bednet_qingdan.push(item);
 
@@ -387,6 +500,16 @@ export const useHooksCpQuote = (t?: any) => {
     if (data.list[0].mtrl_sponge_name) {
       item.pznamemx = data.list[0].mtrl_sponge_name;
       ls_海绵包边物料 = data.list[0].sponge_thickness + "分" + data.list[0].sponge_height + "高" + data.list[0].mtrl_sponge_name;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "海绵包边物料:" + data.list[0].mtrl_sponge_name;
+      result.dscrp = ls_海绵包边物料;
+      result.costamt = data.list[0].sponge_mtrl_cost;
+      result.costamt_1 = data.list[0].sponge_mtrl_cost;
+      result.costamt_2 = data.list[0].sponge_mtrl_cost;
+      result.costamt_3 = data.list[0].sponge_mtrl_cost;
+      result.costamt_4 = data.list[0].sponge_mtrl_cost;
+      bednet_qingdan_item.push(result);
     }
     s_bednet_qingdan.push(item);
 
@@ -413,6 +536,16 @@ export const useHooksCpQuote = (t?: any) => {
       item.pznamemx = data.list[0].mtrl_sponge_tc_name;
       ls_填充海绵物料 =
         data.list[0].sponge_tc_thickness + "分" + data.list[0].sponge_tc_height + "高" + data.list[0].mtrl_sponge_tc_name;
+
+      let result = cloneDeep(default_bednet_qingdan);
+      result.label = "填充海绵物料:" + data.list[0].mtrl_sponge_tc_name;
+      result.dscrp = ls_填充海绵物料;
+      result.costamt = data.list[0].sponge_mtrl_tc_cost;
+      result.costamt_1 = data.list[0].sponge_mtrl_tc_cost;
+      result.costamt_2 = data.list[0].sponge_mtrl_tc_cost;
+      result.costamt_3 = data.list[0].sponge_mtrl_tc_cost;
+      result.costamt_4 = data.list[0].sponge_mtrl_tc_cost;
+      bednet_qingdan_item.push(result);
     } else {
       ls_填充海绵物料 = "";
     }
@@ -525,8 +658,8 @@ export const useHooksCpQuote = (t?: any) => {
       amt: 0,
       useqty: 0
     };
-    if (Number(mxResult.list[0].pocket_around_row) > 0) {
-      item.pznamemx = mxResult.list[0].pocket_around_row + "排";
+    if (Number(data.list[0].pocket_around_row) > 0) {
+      item.pznamemx = data.list[0].pocket_around_row + "排";
     }
     s_bednet_qingdan.push(item);
 
@@ -537,8 +670,8 @@ export const useHooksCpQuote = (t?: any) => {
       amt: 0,
       useqty: 0
     };
-    if (Number(mxResult.list[0].if_pocket_around) > 0) {
-      item.pznamemx = mxResult.list[0].pocket_around_springname;
+    if (Number(data.list[0].if_pocket_around) > 0) {
+      item.pznamemx = data.list[0].pocket_around_springname;
     }
     s_bednet_qingdan.push(item);
 
@@ -547,7 +680,7 @@ export const useHooksCpQuote = (t?: any) => {
     //床网类型丨规格丨排列丨高度丨单/多区丨线径丨边铁丨海绵包边丨四周加硬丨弹叉丨底面物料
     let ls_temp_name = s_bednet_qingdan[1].pznamemx + "丨" + s_bednet_qingdan[3].pznamemx + "丨" + s_bednet_qingdan[4].pznamemx; // + s_bednet_qingdan[3].pznamemx + '丨'
 
-    if (Number(mxResult.list[0].if_part) > 0) {
+    if (Number(data.list[0].if_part) > 0) {
       ls_temp_name += "丨" + data.list[0].duo_qv_str + "区";
     } else {
       if (s_bednet_qingdan[5].pznamemx != "") {
@@ -557,7 +690,7 @@ export const useHooksCpQuote = (t?: any) => {
       }
     }
 
-    if (Number(mxResult.list[0].if_part) > 0) {
+    if (Number(data.list[0].if_part) > 0) {
       ls_区区 = data.list[0].duo_qv_str + "区";
     } else {
       ls_区区 = "单区";
@@ -665,11 +798,14 @@ export const useHooksCpQuote = (t?: any) => {
     s_bednet_qingdan[0].amt = data.list[0].nottax_factory_cost;
     s_bednet_qingdan[0].useqty = 0;
 
+    state.bednet_qingdan.push(bednet_qingdan_item);
+
     console.log("s_bednet_qingdan :>> ", s_bednet_qingdan);
+    console.log("bednet_qingdan_item :>> ", bednet_qingdan_item);
     return s_bednet_qingdan;
   };
 
-  const f_get_bednet_qingdan = async (bednetid: any) => {
+  const f_get_bednet_qingdan = async (bednetid: any, index: any) => {
     if (!Number(bednetid)) return [];
     let _params = {
       dsname: "web_bednet_define",
@@ -711,17 +847,130 @@ export const useHooksCpQuote = (t?: any) => {
       throw new Error(_data.bednetcode + ", pricelistid错误!");
     }
 
-    let rtStr = await wf_retrieve_qingdan_bednet(result);
+    let rtStr = await wf_retrieve_qingdan_bednet(result, index);
 
     //带上erpcode?
     return rtStr;
   };
 
+  /**
+   * @description 新报价清单列
+   * @param data
+   */
+  const set_new_table_data = (params: any) => {
+    let { data, mxdata, fabricMx, formulakindenum, enumMap } = params;
+
+    console.log("set_new_table_data params :>> ", params);
+
+    let arr = [];
+
+    /**
+     * @description 车间成本
+     */
+    arr = arr.concat(init_new_formula_item(params, "【车间成本】", "床垫-"));
+
+    let cushionsItem = mxdata.find((itm: any) => itm.field == "cushions");
+    if (cushionsItem) {
+      if (cushionsItem.data.bednet.length > 0) {
+        cushionsItem.data.bednet.map((itm: any, index: any) => {
+          if (itm.mtrlid > 0) {
+            arr = arr.concat(
+              init_new_formula_item(
+                { ...params, formula: params.formula_bednet },
+                "【车间成本】",
+                `床网${index + 1}-`,
+                "replace_bednet"
+              )
+            );
+          }
+        });
+      }
+    }
+    // arr = arr.concat(
+    //   init_new_formula_item({ ...params, formula: params.formula_bednet }, "【车间成本】", "床网-", "replace_bednet")
+    // );
+    arr = arr.concat(init_new_formula_item(params, "【不含税出厂价】"));
+    arr = arr.concat(init_new_formula_item(params, "【部门不含税价】"));
+    arr = arr.concat(init_new_formula_item(params, "【部门含税价】"));
+    arr = arr.concat(init_new_formula_item(params, "【外币价】"));
+    arr = arr.concat(init_new_formula_item(params, "【佣金】"));
+
+    console.log("set_new_table_data arr :>> ", arr);
+    return arr;
+  };
+
+  const init_new_formula_item = ({ formula, differ, dannum_type }: any, target: string, prefix = "", replaceKey = "replace") => {
+    let formulaItem = formula.find((item: any) => item.label == target);
+    console.log("init_new_formula_item formulaItem :>> ", formulaItem);
+    let arr = [];
+    let item = {
+      level: target.replace("【", "").replace("】", ""),
+      group: "",
+      label: "",
+      dscrp: "",
+      qty: "",
+      costamt: "",
+      costamt_1: "",
+      costamt_2: "",
+      costamt_3: "",
+      costamt_4: "",
+      useqty: "",
+      price: ""
+    };
+    if (formulaItem) {
+      let reg = /\【(.*?)\】/g;
+      let formulaItemArr = formulaItem.value.match(reg);
+
+      if (formulaItemArr.length) {
+        formulaItemArr.map(fName => {
+          let _item = {
+            level: target.replace("【", "").replace("】", ""),
+            group: prefix + fName.replace("【", "").replace("】", ""),
+            label: "",
+            dscrp: "",
+            qty: "",
+            costamt: "",
+            costamt_1: "",
+            costamt_2: "",
+            costamt_3: "",
+            costamt_4: "",
+            useqty: "",
+            price: ""
+          };
+          differ.map((itm: any) => {
+            let _valueReplace = itm[replaceKey].find((t: any) => t.label == fName);
+            _item["costamt_" + itm.type] = isFilterPrice(_valueReplace?.value ?? 0);
+            if (dannum_type == itm.type) {
+              _item.costamt = isFilterPrice(_valueReplace?.value ?? 0);
+            }
+          });
+
+          arr.push(_item);
+        });
+      }
+
+      differ.map((itm: any) => {
+        let _valueReplace = itm[replaceKey].find((t: any) => t.label == target);
+        item["costamt_" + itm.type] = isFilterPrice(_valueReplace?.value ?? 0);
+        if (dannum_type == itm.type) {
+          item.costamt = isFilterPrice(_valueReplace?.value ?? 0);
+        }
+      });
+      item.group = "小计";
+      console.log("item :>> ", item);
+      arr.push(item);
+    }
+    return arr;
+  };
+
   /**
    * @description 刷新报价清单
    */
-  const wf_retrieve_qingdan = async (params: wfQingdanProps) => {
+  const wf_retrieve_qingdan = async (params: wfQingdanProps, isNew?: boolean, ifExpandAll?: boolean) => {
     let { data, mxdata, fabricMx, formulakindenum, enumMap } = params;
+    state.bednet_qingdan = [];
+    let _isNew = isNew ?? false;
+    let _ifExpandAll = ifExpandAll ?? false;
     state.enumMap = enumMap;
     state.tableData = [];
     let _tData = cloneDeep(state.oriTableData);
@@ -734,8 +983,20 @@ export const useHooksCpQuote = (t?: any) => {
       return item;
     });
 
+    console.log("wf_retrieve_qingdan isNew :>> ", isNew);
+    if (_isNew) {
+      state.tableData = set_new_table_data(params);
+    }
+
     console.log("mxdata data:>> ", mxdata, data);
     let _mxitm = null;
+    let level_mattress = "车间成本";
+    let group_mattress = "床垫-总材料成本";
+    let result_default: any = {
+      level: level_mattress,
+      group: group_mattress
+    };
+    let mattressArr: any = [];
     for (let index = 0; index < mxdata.length; index++) {
       let item = mxdata[index];
       switch (item.field) {
@@ -747,7 +1008,7 @@ export const useHooksCpQuote = (t?: any) => {
           _mxitm = fabricMx.find(t => t.name == item.field);
           item.data.map(itm => {
             if ((Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) && _mxitm.type.includes(Number(itm.formulakind))) {
-              let result: any = {};
+              let result: any = cloneDeep(result_default);
               result.label = itm.chastr != "" ? itm.chastr : item.label;
               let _formulaName = "";
               if (formulakindenum) {
@@ -773,7 +1034,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.price = isFilterPrice(itm.price ?? 0);
               }
               result.index = index;
-              state.tableData.push(result);
+              mattressArr.push(result);
             }
           });
           break;
@@ -784,7 +1045,7 @@ export const useHooksCpQuote = (t?: any) => {
               (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) &&
               !_mxitm.type.includes(Number(itm.formulakind))
             ) {
-              let result: any = {};
+              let result: any = cloneDeep(result_default);
               // result.label = itm.label;
               result.label = "其他工艺";
               let _formulaName = "";
@@ -809,7 +1070,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.price = isFilterPrice(itm.price ?? 0);
               }
               result.index = index;
-              state.tableData.push(result);
+              mattressArr.push(result);
             }
           });
           break;
@@ -824,7 +1085,7 @@ export const useHooksCpQuote = (t?: any) => {
           for (let k = 0; k < item.data.cushions.length; k++) {
             let itm = item.data.cushions[k];
             if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0 || [999].includes(Number(itm.formulakind))) {
-              let result: any = {};
+              let result: any = cloneDeep(result_default);
               let _formulaName = "";
               if (formulakindenum) {
                 _formulaName = formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
@@ -849,7 +1110,7 @@ export const useHooksCpQuote = (t?: any) => {
                 }
 
                 result.index = _index;
-                state.tableData.push(result);
+                mattressArr.push(result);
               } else {
                 // 999是床网
 
@@ -863,7 +1124,7 @@ export const useHooksCpQuote = (t?: any) => {
                   if (item.data.bednet.length == 1) {
                     //单床网
                     ll_bednetid = item.data.bednet[0].mtrlid;
-                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
+                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid, 0);
                     console.log("cushions item.data.bednet s_bednet_qingdan :>> ", s_bednet_qingdan);
                     if (s_bednet_qingdan.length) {
                       result.dscrp = s_bednet_qingdan[0].pznamemx;
@@ -878,7 +1139,7 @@ export const useHooksCpQuote = (t?: any) => {
                     //多床网
                     ll_bednetid = item.data.bednet[bendet999Index].mtrlid;
                     console.log("f_get_bednet_qingdan t ll_bednetid:>> ", bendet999Index, item.data.bednet[bendet999Index]);
-                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
+                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid, bendet999Index);
                     if (s_bednet_qingdan.length) {
                       result.dscrp = s_bednet_qingdan[0].pznamemx;
                       result.qty = 1;
@@ -895,12 +1156,12 @@ export const useHooksCpQuote = (t?: any) => {
 
                   result.index = _index;
                   // 查找数组中,从结尾数起最后出现的index=_index的元素的索引,在起后面插入result
-                  let _arrData = cloneDeep(state.tableData);
+                  let _arrData = cloneDeep(mattressArr);
                   let _last = _arrData.reverse().findIndex(t => t.index == _index);
                   if (_last == -1) {
-                    state.tableData.push(result);
+                    mattressArr.push(result);
                   } else {
-                    state.tableData.splice(state.tableData.length - _last, 0, result);
+                    mattressArr.splice(mattressArr.length - _last, 0, result);
                   }
                 }
               }
@@ -911,7 +1172,7 @@ export const useHooksCpQuote = (t?: any) => {
         case "accessories": // 辅料
           item.data.map(itm => {
             if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
-              let result: any = {};
+              let result: any = cloneDeep(result_default);
               result.label = itm.label;
               let _formulaName = "";
               if (formulakindenum) {
@@ -935,7 +1196,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.price = isFilterPrice(itm.price ?? 0);
               }
               result.index = index;
-              state.tableData.push(result);
+              mattressArr.push(result);
             }
           });
           break;
@@ -956,7 +1217,7 @@ export const useHooksCpQuote = (t?: any) => {
               Number(itm.mtrlid) > 0 || Number(itm.costamt) != 0
             );
             if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
-              let result: any = {};
+              let result: any = cloneDeep(result_default);
               result.label = itm.label;
               let _formulaName = "";
               if (formulakindenum) {
@@ -980,31 +1241,68 @@ export const useHooksCpQuote = (t?: any) => {
                 result.price = isFilterPrice(itm.price ?? 0);
               }
               result.index = index;
-              state.tableData.push(result);
+              mattressArr.push(result);
             }
           });
           break;
       }
     }
 
-    console.log("wf_retrieve_qingdan state.tableData :>> ", JSON.stringify(state.tableData));
+    if (!isNew) {
+      state.tableData = state.tableData.concat(mattressArr);
+      state.tableData.push({
+        label: "地区",
+        dscrp: data.area ?? "",
+        qty: "",
+        costamt: "",
+        useqty: "",
+        price: ""
+      });
+      state.tableData.push({
+        label: "柜型",
+        dscrp: data.cabinet_type ?? "",
+        qty: "",
+        costamt: "",
+        useqty: "",
+        price: ""
+      });
+    } else {
+      if (_ifExpandAll) {
+        console.log("state.tableData bf:>> ", state.tableData);
+        console.log("smattressArr bf:>> ", mattressArr);
+
+        // 插入床垫车间成本-总材料成本明细
+        let _idx = state.tableData.findIndex(t => t.group === "床垫-总材料成本");
+        if (_idx > -1) {
+          state.tableData[_idx].label = "小计";
+          state.tableData.splice(_idx, 0, ...mattressArr);
+        }
 
-    state.tableData.push({
-      label: "地区",
-      dscrp: data.area ?? "",
-      qty: "",
-      costamt: "",
-      useqty: "",
-      price: ""
-    });
-    state.tableData.push({
-      label: "柜型",
-      dscrp: data.cabinet_type ?? "",
-      qty: "",
-      costamt: "",
-      useqty: "",
-      price: ""
-    });
+        // 插入床网车间成本-总材料成本明细
+        let cushionsItem = mxdata.find((itm: any) => itm.field == "cushions");
+        if (cushionsItem) {
+          if (cushionsItem.data.bednet.length > 0) {
+            cushionsItem.data.bednet.map((itm: any, index: any) => {
+              if (itm.mtrlid > 0) {
+                let _idx = state.tableData.findIndex(t => t.group === `床网${index + 1}-总材料成本`);
+                if (_idx > -1) {
+                  state.tableData[_idx].label = "小计";
+                  state.bednet_qingdan[index] && state.tableData.splice(_idx, 0, ...state.bednet_qingdan[index]);
+                }
+              }
+            });
+          }
+        }
+      }
+    }
+
+    // state.tableData = state.tableData.map(item => {
+    //   item.id = item.id ?? null;
+    //   item.parentId = item.parentId ?? null;
+    //   return item;
+    // });
+
+    console.log("state.tableData state.tableData:>> ", state.tableData);
   };
 
   const formatAmount = (value: any) => {
@@ -1209,7 +1507,18 @@ export const useHooksCpQuote = (t?: any) => {
     // cellESum.value = getSummaries(state.tableData, "costamt");
     const footerRows = worksheet.insertRow(
       9 + state.tableData.length,
-      { label: "材料合计:", dscrp: "", qty: "", costamt: getSummaries(state.tableData, "costamt"), useqty: "", price: "" },
+      {
+        label: "材料合计:",
+        dscrp: "",
+        qty: "",
+        costamt: getSummaries(state.tableData, "costamt"),
+        costamt_1: getSummaries(state.tableData, "costamt_1"),
+        costamt_2: getSummaries(state.tableData, "costamt_2"),
+        costamt_3: getSummaries(state.tableData, "costamt_3"),
+        costamt_4: getSummaries(state.tableData, "costamt_4"),
+        useqty: "",
+        price: ""
+      },
       "n"
     );
 

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

@@ -123,6 +123,7 @@ interface defaultState {
   cmpFormulas: any;
   cmpFormulaReplace: any;
   cmpFormulasOri: any;
+  cmpFormulasBednet: any;
   cmpDiffer: any;
   specialProcessesMxRef: any;
   additionalCostsMxRef: any;
@@ -378,6 +379,7 @@ export const useHooks = (t?: any) => {
     cmpFormulas: [],
     cmpFormulaReplace: [],
     cmpFormulasOri: [],
+    cmpFormulasBednet: [],
     cmpDiffer: [],
     specialProcessesMxRef: null,
     additionalCostsMxRef: null,
@@ -2582,6 +2584,7 @@ export const useHooks = (t?: any) => {
       state.cmpFormulaReplace = res.replace;
       // state.
       state.cmpFormulasOri = res.formulas_origin ?? [];
+      state.cmpFormulasBednet = res.formulas_bednet ?? [];
       state.cmpDiffer = res.differ;
     } else {
       setTimeout(() => {