Browse Source

JLHWEB: 床网选择多区逻辑更新;床垫打印模块

JohnnyChan 5 months ago
parent
commit
8b9f276d2c

+ 1 - 0
JLHWEB/README.md

@@ -24,6 +24,7 @@ L1-ERP WEB 一款基于 Vue3.3、TypeScript、Vite4、Pinia、Element-Plus 开
 - 使用 Prettier 统一格式化代码,集成 ESLint、Stylelint 代码校验规范
 - 使用 husky、lint-staged、commitlint、czg、cz-git 规范提交信息
 - 使用 [vue-drag-select](https://gitee.com/ovsexia/DragSelect-Doc-Cn#https://ovsexia.gitee.io/dragselect-doc-cn/demo.html) 实现拖转框选
+- 使用 [ExcelJs](https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md) 实现自定义导出 Excel
 
 ### 安装使用步骤 📔
 

+ 16 - 0
JLHWEB/src/components/LjDetail/components/BaseForm.vue

@@ -565,6 +565,13 @@
                                 disabled
                                 v-bind="{ ...item.basicinfo.props, ...cpBasicinfoAttr(item) }"
                               />
+                              <template #error="errScope">
+                                <div class="error-box flx-center" v-if="errScope.error">
+                                  <el-tooltip :content="errScope.error" placement="top">
+                                    <el-icon><WarningFilled /></el-icon>
+                                  </el-tooltip>
+                                </div>
+                              </template>
                             </el-form-item>
                           </el-skeleton>
                         </GridItem>
@@ -2642,6 +2649,15 @@ defineExpose({
           padding-right: 40px;
         }
       }
+      .error-box {
+        position: absolute;
+        right: 24px;
+        color: $color-dust-red-5;
+        top: 0;
+        bottom: 0;
+        margin: auto;
+        font-size: 16px;
+      }
     }
     .el-input.is-disabled .el-input__inner {
       color: $color-text-title;

+ 1 - 1
JLHWEB/src/components/ToastWidget/Formula/index.vue

@@ -73,7 +73,7 @@ interface WidgetProps {
   /**
    * @description 类型ID
    */
-  powerid: number;
+  powerid?: number;
   /**
    * @description 分部id
    */

+ 2 - 2
JLHWEB/src/utils/index.ts

@@ -1,5 +1,5 @@
 import { isArray, isNullOrUnDef, isNumber, isString, isDate, isObject } from "@/utils/is";
-import { FieldNamesProps } from "@/components/ProTable/interface";
+import { FieldNamesProps } from "@/components/LjVxeTable/interface";
 import XEUtils from "xe-utils";
 import { cloneDeep, pick, get } from "lodash-es";
 import dayjs from "dayjs";
@@ -430,7 +430,7 @@ function formatDate({ val, format }: any) {
   return XEUtils.toDateString(val, format || "yyyy-MM-dd HH:mm:ss");
 }
 // 四舍五入金额,每隔3位逗号分隔,默认0位小数
-function formatIntNumber({ val }: any, digits = 0) {
+export function formatIntNumber({ val }: any, digits = 0) {
   if (isNaN(Number(val))) return val;
   return XEUtils.commafy(XEUtils.toNumber(val), { digits });
 }

+ 32 - 0
JLHWEB/src/utils/rules/index.ts

@@ -0,0 +1,32 @@
+/**
+ * @description form表单检测,数值检测
+ * @param rule
+ * @param value
+ * @param callback
+ * @returns
+ */
+export const numCheck = (rule: any, value: any, callback: any) => {
+  // 我这里不是必填的,如果是必填的再判断一下value === ''
+  let capital = /^[0-9.]*$/;
+  if (!capital.test(value)) {
+    callback(new Error(`请输入整数或小数`));
+  } else {
+    let data = JSON.stringify(value);
+    let arr = data.split("");
+    let mix = data.indexOf(".");
+    if (mix != -1) {
+      if (mix == 0 || mix == arr.length - 1) {
+        callback(new Error(`小数点不能在第一位或最后一位`));
+        return;
+      }
+      let dianNum = arr.filter((x: any) => x == ".");
+      if (dianNum.length > 1) {
+        callback(new Error(`小数点只能有一个`));
+        return;
+      }
+      callback();
+    } else {
+      callback();
+    }
+  }
+};

+ 1 - 0
JLHWEB/src/views/baseinfo/bednetarea/detail.vue

@@ -11,6 +11,7 @@
     :search-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
     :basic-group-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
     :enum="props.enum"
+    :if-basic-editable="false"
   >
     <!-- :action="orderStatus ? orderEditAction : orderDefaultAction" -->
   </LjDetail>

+ 37 - 21
JLHWEB/src/views/baseinfo/bednetarea/hooks/index.tsx

@@ -4,6 +4,8 @@ import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { ALLOW_EDIT_STATE } from "@/config/index";
 import { SaveBedNetArea, DeleteBedNetArea } from "@/api/modules/basicinfo";
 import { ElMessage, ElMessageBox } from "element-plus";
+import { numCheck } from "@/utils/rules/index";
+
 interface defaultState {
   /**
    * @description 单据当前状态
@@ -43,65 +45,79 @@ export const useHooks = (t?: any) => {
     },
     {
       field: "area_1",
-      title: "一区比例",
+      title: "一区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_2",
-      title: "二区比例",
+      title: "二区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_3",
-      title: "三区比例",
+      title: "三区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_4",
-      title: "四区比例",
+      title: "四区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_5",
-      title: "五区比例",
+      title: "五区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_6",
-      title: "六区比例",
+      title: "六区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     },
     {
       field: "area_7",
-      title: "七区比例",
+      title: "七区",
       basicinfo: {
         el: "input",
-        span: 2,
-        editable: ALLOW_EDIT_STATE
+        span: 4,
+        group: "比例设置",
+        editable: ALLOW_EDIT_STATE,
+        rules: [{ validator: numCheck, trigger: "blur" }]
       }
     }
   ];

+ 42 - 2
JLHWEB/src/views/baseinfo/bednetarea/index.vue

@@ -36,7 +36,7 @@
       </div>
     </template>
     <div class="flx-1 h-full">
-      <LjHeaderMenu :data="mainData" :action="orderStatus ? orderEditAction : orderDefaultAction" />
+      <LjHeaderMenu :action="orderStatus ? orderEditAction : orderDefaultAction" />
       <Detail class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" />
     </div>
   </LjDialog>
@@ -54,6 +54,7 @@ import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
 import { useI18n } from "vue-i18n";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
 import { cloneDeep } from "lodash-es";
+import { ElButton, ElMessage } from "element-plus";
 
 const dwname = "web_bednet_arealist";
 const mainData = ref({});
@@ -94,9 +95,24 @@ const orderEditAction = [
   buttonNew({
     label: t("common.saveText"),
     icon: "iconsave-01",
-    clickFunc: item => {
+    clickFunc: async item => {
       const save_data = LjDetailRef.value?._mainData;
 
+      await LjDetailRef.value.toValidateForm();
+
+      let arr = [];
+      for (const key in save_data) {
+        if (key.indexOf("area_") > -1) {
+          arr.push(Number(save_data[key]));
+        }
+      }
+
+      // 判断数值连续填写,中间不能有0
+      if (hasZerosBetweenNonZeroNumbers(arr) > 0) {
+        ElMessage.error(`分区比例应连续不间断填写,${hasZerosBetweenNonZeroNumbers(arr)}区不能为0`);
+        return false;
+      }
+
       fSave({ area: save_data }).then(() => {
         LjDrawerRef.value.hide();
       });
@@ -104,6 +120,30 @@ const orderEditAction = [
   })
 ];
 
+/**
+ * @description 判断数值连续填写,中间不能有0
+ * @param arr 数值数组
+ * @param {number} 存在0的位置
+ */
+function hasZerosBetweenNonZeroNumbers(arr) {
+  let foundNonZero = false;
+  let hasZeros = false;
+
+  for (let i = 0; i < arr.length; i++) {
+    if (Number(arr[i]) !== 0) {
+      if (foundNonZero && hasZeros) {
+        return i;
+      }
+      foundNonZero = true;
+      hasZeros = true;
+    } else if (foundNonZero) {
+      hasZeros = true;
+    }
+  }
+
+  return 0;
+}
+
 /*
  * @description 抽屉默认属性
  */

+ 28 - 28
JLHWEB/src/views/quote/bednetQuote/detail.vue

@@ -14,28 +14,8 @@
   >
     <template #bednetMx>
       <div class="main-box flx">
-        <div class="h-full flx-1 overflow-hidden pr-16">
-          <LjVxeTable
-            v-if="bednetMxData.length"
-            ref="vxeTableMxRef"
-            row-key="bednetmxid"
-            table-cls="h-full"
-            :columns="columnsMx"
-            :data="bednetMxData"
-            :dwname="DwnameEnum.bednetQuoteMx"
-            :table-props="tableProps_mx"
-            :auto-load-layout="false"
-            :search-btn-size-extent="[]"
-            :request-auto="false"
-            collapseButtons
-          >
-            <template #tableHeader>
-              <LjHeader class="flx-1" title="床网多网明细" />
-            </template>
-          </LjVxeTable>
-        </div>
         <div
-          class="flx flx-shrink h-full"
+          class="flx flx-shrink h-full pr-16"
           style="min-width: 542px"
           v-if="bednetMxData.length && Number(LjDetailRef._mainData.bednettypeid) == 11 && Number(bednetMxData[0].if_part)"
         >
@@ -46,18 +26,18 @@
             table-cls=""
             :columns="columnsMxSpring"
             :data="bednetMxSprintData"
-            :data-callback="dataCallback"
             :dwname="DwnameEnum.bednetQuoteMxSpring"
             :table-props="tableProps_mx"
             :auto-load-layout="false"
+            :tool-button="[]"
             :search-btn-size-extent="[]"
             collapseButtons
             :request-auto="false"
           >
             <template #tableHeader>
-              <div class="flx">
-                <LjHeader class="flx-shrink" title="多区袋装明细" />
-                <div class="flx-1 flx-end pb-8" v-if="AreaList.length">
+              <!-- <div class="flx"> -->
+              <LjHeader class="flx-shrink" title="多区袋装明细" />
+              <!-- <div class="flx-1 flx-end pb-8" v-if="AreaList.length">
                   <span class="text-secondary-text">比例设置</span>
                   <el-select v-model="currentArea" class="pl-4 pr-4" style="width: 80px" @change="setMxSpringLength">
                     <el-option
@@ -66,10 +46,29 @@
                       :label="item.areaname"
                       :value="item.areaname"
                     ></el-option>
-                    <!-- <el-option v-for="item in 7" :key="item" :label="item" :value="item"></el-option> -->
                   </el-select>
-                </div>
-              </div>
+                </div> -->
+              <!-- </div> -->
+            </template>
+          </LjVxeTable>
+        </div>
+        <div class="h-full flx-1 overflow-hidden">
+          <LjVxeTable
+            v-if="bednetMxData.length"
+            ref="vxeTableMxRef"
+            row-key="bednetmxid"
+            table-cls="h-full"
+            :columns="columnsMx"
+            :data="bednetMxData"
+            :dwname="DwnameEnum.bednetQuoteMx"
+            :table-props="tableProps_mx"
+            :auto-load-layout="false"
+            :search-btn-size-extent="[]"
+            :request-auto="false"
+            collapseButtons
+          >
+            <template #tableHeader>
+              <LjHeader class="flx-1" title="床网多网明细" />
             </template>
           </LjVxeTable>
         </div>
@@ -252,6 +251,7 @@ const orderDefaultAction: detailAction[] = [
         if (!(await wf_cmp_cb())) return;
 
         let bednet = LjDetailRef.value._mainData;
+        bednet.ifsaleout = Number(bednet.ifsaleout);
 
         let bednetMx = vxeTableMxRef.value?.element.getTableData().fullData;
 

+ 132 - 447
JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx

@@ -6,16 +6,17 @@ import { CommonDynamicSelect } from "@/api/modules/common";
 import { useUserStore } from "@/stores/modules/user";
 import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
 import SpringSelect from "@/views/system/selector/spring/select.vue";
-import { handleRowAccordingToProp } from "@/utils";
+// import { handleRowAccordingToProp } from "@/utils";
 import { ElButton, ElMessage, ElPopconfirm, ElMessageBox } from "element-plus";
 import { Minus, Plus, InfoFilled } from "@element-plus/icons-vue";
 import { DwnameEnum } from "@/enums/dwnameEnum";
 import { isArray } from "@/utils/is";
-import { calculateFormula, formulaPartsFormula, floatAdd, floatMul, formatFixedNumber } from "@/utils/index";
+import { calculateFormula, formulaPartsFormula, floatAdd, floatMul, formatFixedNumber, formatIntNumber } from "@/utils/index";
 import { cloneDeep, defaultsDeep } from "lodash-es";
 import { TYPE, useToast, POSITION } from "vue-toastification";
 import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
 import ToastHistoryPrice from "@/components/ToastWidget/HistoryPrice/index.vue";
+import { numCheck } from "@/utils/rules/index";
 
 interface defaultState {
   /**
@@ -525,7 +526,7 @@ export const useHooks = (t?: any) => {
 
     nextTick(() => {
       console.log("wf_b_bednet_type_ch state.vxeTableMxRef :>> ", state.vxeTableMxRef);
-      state.vxeTableMxRef.refresh();
+      state.vxeTableMxRef && state.vxeTableMxRef.refresh();
     });
   };
 
@@ -543,23 +544,23 @@ export const useHooks = (t?: any) => {
     // return [];
   };
 
-  /**
-   * @description 获取明细数据
-   * @param params
-   * @returns
-   */
-  const getDataMx = (params: any) => {
-    console.log("getData beatad 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_bednet_mx";
-    return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
-  };
+  // /**
+  //  * @description 获取明细数据
+  //  * @param params
+  //  * @returns
+  //  */
+  // const getDataMx = (params: any) => {
+  //   console.log("getData beatad 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_bednet_mx";
+  //   return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
+  // };
 
   /**
    * @description 获取弹簧明细
@@ -594,8 +595,12 @@ export const useHooks = (t?: any) => {
 
   const dataCallback = (data: any) => {
     console.log("dataCallback data :>> ", data);
+    let _list = data.datatable.map(t => {
+      t.ifsaleout = Boolean(t.ifsaleout);
+      return t;
+    });
     return {
-      list: data.datatable,
+      list: _list,
       tableinfo: data.tableinfo,
       total: data.totalcnt,
       pageNum: data.pageindex,
@@ -615,30 +620,12 @@ export const useHooks = (t?: any) => {
     };
   };
 
-  const numCheck = (rule: any, value: any, callback: any) => {
-    // 我这里不是必填的,如果是必填的再判断一下value === ''
-    let capital = /^[0-9.]*$/;
-    if (!capital.test(value)) {
-      callback(new Error(`请输入整数或小数`));
-    } else {
-      let data = JSON.stringify(value);
-      let arr = data.split("");
-      let mix = data.indexOf(".");
-      if (mix != -1) {
-        if (mix == 0 || mix == arr.length - 1) {
-          callback(new Error(`小数点不能在第一位或最后一位`));
-          return;
-        }
-        let dianNum = arr.filter((x: any) => x == ".");
-        if (dianNum.length > 1) {
-          callback(new Error(`小数点只能有一个`));
-          return;
-        }
-        callback();
-      } else {
-        callback();
-      }
-    }
+  const handleBlur = (value: any, data: any, field: string) => {
+    value = (value + "").replace(/[^\d.]/g, "");
+    console.log(value);
+    // 保留整数部分
+    value = parseInt(value, 10).toString();
+    data[field] = value;
   };
 
   const columns: ColumnProps<any>[] = [
@@ -773,13 +760,13 @@ export const useHooks = (t?: any) => {
         el: "input",
         rules: [{ validator: numCheck, trigger: "blur" }],
         editable: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.bednettypeid) > 11) {
+          if (Number(scope.searchParam.bednettypeid) > 11) {
             return true;
           }
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.bednettypeid) > 11) {
+          if (Number(scope.searchParam.bednettypeid) > 11) {
             return true;
           }
           return false;
@@ -1115,7 +1102,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.iffork)) {
+          if (Number(scope.searchParam.iffork)) {
             return true;
           }
           return false;
@@ -1197,7 +1184,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1206,13 +1193,24 @@ export const useHooks = (t?: any) => {
           return (
             <>
               <div class="flx w-full">
-                <el-select v-model={scope.searchParam.packtype} placeholder="方式" clearable>
+                <el-select
+                  v-model={scope.searchParam.packtype}
+                  placeholder="方式"
+                  clearable
+                  disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
+                >
                   <el-option label="压包" value="压包" />
                   <el-option label="卷包" value="卷包" />
                   <el-option label="不压不卷" value="不压不卷" />
                   <el-option label="裸包装" value="裸包装" />
                 </el-select>
-                <el-select v-model={scope.searchParam.packmtrl} class="ml-4" placeholder="材料" clearable>
+                <el-select
+                  v-model={scope.searchParam.packmtrl}
+                  class="ml-4"
+                  placeholder="材料"
+                  clearable
+                  disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
+                >
                   <el-option label="编辑袋" value="编辑袋" />
                   <el-option label="牛皮纸" value="牛皮纸" />
                   <el-option label="胶袋" value="胶袋" />
@@ -1237,7 +1235,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1303,7 +1301,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1326,7 +1324,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1349,7 +1347,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1379,7 +1377,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1402,7 +1400,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1422,7 +1420,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1445,7 +1443,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1466,7 +1464,7 @@ export const useHooks = (t?: any) => {
           return false;
         },
         editvisible: (scope: any) => {
-          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.ifsaleout)) {
+          if (Number(scope.searchParam.ifsaleout)) {
             return true;
           }
           return false;
@@ -1489,19 +1487,21 @@ export const useHooks = (t?: any) => {
           }
           return false;
         },
-        render: scope => {
+        render: (scope: any) => {
+          console.log("duo_qv_str scope :>> ", scope);
+          let optionRender = [];
+          scope.enum.map(item => {
+            optionRender.push(<el-option label={item.label} value={item.value} />);
+          });
           return (
             <>
               <el-select
                 v-model={scope.searchParam.duo_qv_str}
                 disabled={!ALLOW_EDIT_STATE.includes(scope.status)}
                 clearable
-                onChange={handelChangeDuoqv}
+                onChange={val => handelChangeDuoqv(val, scope.enum)}
               >
-                <el-option label="单" value="单" />
-                <el-option label="3" value="3" />
-                <el-option label="5" value="5" />
-                <el-option label="7" value="7" />
+                {optionRender}
               </el-select>
             </>
           );
@@ -1514,22 +1514,18 @@ export const useHooks = (t?: any) => {
    * @description 多区select,控制多区明细条数
    * @param val
    */
-  const handelChangeDuoqv = (val: any) => {
+  const handelChangeDuoqv = (val: any, enumArr: any) => {
     console.log("duo_qv_str val :>> ", val);
-    let num = 0;
-    if (val != "单") {
-      num = Number(val);
-    }
 
-    console.log("wf_b_bednet_type_ch state.vxeTableMxRef :>> ", num, state.vxeTableMxRef);
+    let item = enumArr.find((item: any) => item.value == val);
+    let arr = getDuoquVal(item);
+
     console.log("state.vxeTableMxRef.element.get :>> ", state.vxeTableMxRef.element.getTableData());
     let { fullData } = state.vxeTableMxRef.element.getTableData();
-    fullData[0].if_part = Boolean(num);
-
-    // const { areaArr, total } = setMxSpringLength();
-    // console.log("areaArr, total :>> ", areaArr, total);
+    let num = arr.length;
+    fullData[0].if_part = Number(num > 1);
 
-    if (num > 0) {
+    if (num > 1) {
       fullData[0].springid = 0;
       fullData[0].springname = "";
       nextTick(() => {
@@ -1544,7 +1540,7 @@ export const useHooks = (t?: any) => {
             const { fullData: springData } = $table.getTableData();
             console.log("handleAreaChange fullData :>> ", springData, num > 0 && springData.length < num);
 
-            if (num > 0 && springData.length < num) {
+            if (springData.length < num) {
               let arr = [];
               // let sum = Number(fullData[0].spring_qty_length);
               // let lengthValSum = 0;
@@ -1578,29 +1574,54 @@ export const useHooks = (t?: any) => {
           }
         }, 200);
       });
+    } else {
+      // 1
     }
   };
 
-  const setMxSpringLength = (val = state.currentArea) => {
-    let item = state.AreaList.find(t => t.areaname == val);
-    console.log("item :>> ", item, state.AreaList);
+  /**
+   * @description 获取多区数据,数组化
+   * @param item
+   * @returns
+   */
+  const getDuoquVal = item => {
     let arr = [];
     for (const key in item) {
-      if (key.indexOf("area_") > -1 && Number(item[key]) > 0) {
+      if (key.indexOf("area_") > -1) {
         arr.push(Number(item[key]));
       }
     }
+    // 忽略数组中尾部出现的多个0
+    let i = arr.length - 1;
+    while (arr[i] === 0) {
+      i--;
+    }
+    arr = arr.slice(0, i + 1);
+
+    return arr;
+  };
+
+  const setMxSpringLength = () => {
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    console.log("setMxSpringLength object :>> ", _mainData, enumMap);
+    let duoEnum = enumMap.get("duo_qv_str");
+    let item = {};
+    if (duoEnum) {
+      item = duoEnum.find(t => t.value == _mainData.duo_qv_str);
+    }
+    console.log("setMxSpringLength item :>> ", item);
+
+    let arr = getDuoquVal(item);
 
     let totality = arr.reduce((a, b) => a + b, 0);
 
-    // return { areaArr: arr, total: totality };
     let { fullData } = state.vxeTableMxRef.element.getTableData();
     let sum = Number(fullData[0].spring_qty_length);
     console.log("arr, totality  :>> ", arr, totality, sum);
 
     if (state.vxeTableMxSpringRef) {
       let { fullData: springData } = state.vxeTableMxSpringRef?.element.getTableData();
-      // fullData[0].if_part = Boolean(num);
       let lengthValSum = 0;
 
       springData.forEach((item, index) => {
@@ -1608,11 +1629,13 @@ export const useHooks = (t?: any) => {
         if (arr.length >= index + 1) {
           console.log("index, arr.length  :>> ", index, arr.length);
           if (index <= arr.length - 1) {
+            console.log("index == arr.length - 1 :>> ", index, arr.length - 1);
             if (index == arr.length - 1) {
               lengthVal = sum - lengthValSum;
+              console.log("lengthVal end:>> ", lengthVal, lengthValSum, sum);
             } else {
-              lengthVal = (arr[index] / totality) * sum;
-              lengthValSum += lengthVal;
+              lengthVal = formatIntNumber({ val: (arr[index] / totality) * sum });
+              lengthValSum += Number(lengthVal);
             }
           } else {
             lengthVal = 0;
@@ -1645,12 +1668,17 @@ export const useHooks = (t?: any) => {
     },
     {
       field: "spring_qty_width",
+      datatype: "integer",
       editRender: {},
       editColRender: (scope: any) => {
         const { column, row, status } = scope;
         return (
           <>
-            <el-input-number v-model={row.spring_qty_width} style="width: unset" />
+            <el-input
+              v-model={row.spring_qty_width}
+              onBlur={() => handleBlur(row.spring_qty_width, row, "spring_qty_width")}
+              style="width: unset"
+            />
           </>
         );
       }
@@ -1662,7 +1690,12 @@ export const useHooks = (t?: any) => {
         const { column, row, status } = scope;
         return (
           <>
-            <el-input-number v-model={row.spring_qty_length} onChange={() => setMxSpringLength()} style="width: unset" />
+            <el-input
+              v-model={row.spring_qty_length}
+              onBlur={() => handleBlur(row.spring_qty_length, row, "spring_qty_length")}
+              onChange={() => setMxSpringLength()}
+              style="width: unset"
+            />
           </>
         );
       }
@@ -1922,7 +1955,11 @@ export const useHooks = (t?: any) => {
         const { column, row, status } = scope;
         return (
           <>
-            <el-input-number v-model={row.spring_qty_width} style="width: unset" />
+            <el-input
+              v-model={row.spring_qty_width}
+              onBlur={() => handleBlur(row.spring_qty_width, row, "spring_qty_width")}
+              style="width: unset"
+            />
           </>
         );
       }
@@ -1934,7 +1971,11 @@ export const useHooks = (t?: any) => {
         const { column, row, status } = scope;
         return (
           <>
-            <el-input-number v-model={row.spring_qty_length} style="width: unset" />
+            <el-input
+              v-model={row.spring_qty_length}
+              onBlur={() => handleBlur(row.spring_qty_length, row, "spring_qty_length")}
+              style="width: unset"
+            />
           </>
         );
       }
@@ -2347,362 +2388,6 @@ export const useHooks = (t?: any) => {
     }
   };
 
-  /**
-   * @description 主表计算公式
-   */
-  const summaryData = ref<any>([
-    {
-      label: "弹簧材料总成本",
-      field: "spring_mtrl_cost",
-      formula:
-        "if([折叠款] = 1, ([总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用]) * 2, [总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用])"
-    },
-    {
-      label: "弹簧人工总成本",
-      field: "spring_hr_cost",
-      formula: "[总成本] * ([工厂利润率] + [利润率点数] + [布套点数] + [拆装点数] + [海绵点数]) * [管理费点]"
-    },
-    {
-      label: "蛇线材料成本",
-      field: "snake_wire_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1)) * [额外点数] + [fob]"
-    },
-    {
-      label: "四周口袋弹簧成本",
-      field: "pocket_around_spring_cost",
-      formula: "([部门售价] * ([税率] - 1)) + [佣金] * 0.05"
-    },
-    {
-      label: "四周口袋无纺布成本",
-      field: "pocket_around_fabrics_cost",
-      formula: "([部门售价] + [佣金] * 0.06) * [税率] * if([fob] = 0, 1, [折扣率])"
-    },
-    {
-      label: "四周加硬材料成本",
-      field: "hard_around_mtrl_cost",
-      formula: "if([汇率] <> 0, [部门含税价] / [汇率], 0)"
-    },
-    {
-      label: "四周加硬人力成本",
-      field: "hard_around_hr_cost",
-      formula: "if(([dept_profitrate] + [dept_profitrate_rangli] / 100) <> 0, [dijia_cost] ,0 )"
-    },
-    {
-      label: "入袋无纺布材料成本",
-      field: "fabrics1_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "胶水材料成本",
-      field: "glue_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "底面无纺布材料成本",
-      field: "fabrics2_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "边铁人力成本",
-      field: "side_iron_hr_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "边铁材料成本",
-      field: "side_iron_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "C钉/夹码材料成本",
-      field: "cnail_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "C钉/夹码人力成本",
-      field: "cnail_hr_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "海绵包边材料成本",
-      field: "sponge_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "海绵包边人力成本",
-      field: "sponge_hr_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "填充海绵成本",
-      field: "sponge_mtrl_tc_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "封边材料成本",
-      field: "edge_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "封边人力成本",
-      field: "edge_hr_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "弹叉材料成本",
-      field: "fork_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "弹叉人力成本",
-      field: "fork_hr_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "胶条/包角材料成本",
-      field: "rsorwa_mtrl_cost",
-      formula: "[dijia_cost] / (1 - ([佣金点数] - 1 )) - [dijia_cost]"
-    },
-    {
-      label: "胶条/包角人力成本",
-      field: "rsorwa_hr_cost",
-      formula: ""
-    },
-    {
-      label: "海绵打孔人力成本",
-      field: "sponge_drilling_hr_cost",
-      formula: ""
-    },
-    {
-      label: "上垫层物料成本",
-      field: "felt_mtrl_cost",
-      formula: ""
-    },
-    {
-      label: "下垫层物料成本",
-      field: "felt_mtrl_x_cost",
-      formula: ""
-    },
-    {
-      label: "上垫层人力成本",
-      field: "felt_hr_cost",
-      formula: ""
-    },
-    {
-      label: "下垫层人力成本",
-      field: "felt_hr_x_cost",
-      formula: ""
-    },
-    {
-      label: "包装材料成本",
-      field: "packet_mtrl_cost",
-      formula: ""
-    },
-    {
-      label: "包装人工成本",
-      field: "packet_hr_cost",
-      formula: ""
-    },
-    {
-      label: "总材料成本",
-      field: "total_mtrl_cost",
-      formula: ""
-    },
-    {
-      label: "总人力成本",
-      field: "total_hr_cost",
-      formula: ""
-    },
-    {
-      label: "总成本",
-      field: "total_cost",
-      formula: ""
-    },
-    {
-      label: "钢丝重量",
-      field: "spring_weight_qty",
-      formula: ""
-    },
-    {
-      label: "边铁重量",
-      field: "side_iron_weight_qty",
-      formula: ""
-    },
-    {
-      label: "四周加硬重量",
-      field: "hard_around_weight_qty",
-      formula: ""
-    },
-    {
-      label: "入袋无纺布重量",
-      field: "fabrics1_weight_qty",
-      formula: ""
-    },
-    {
-      label: "面底无纺布重量",
-      field: "fabrics2_weight_qty",
-      formula: ""
-    },
-    // {
-    //   label: "上垫层重量",
-    //   field: "felt_mtrl_cost",
-    //   formula: ""
-    // },
-    {
-      label: "下垫层重量",
-      field: "felt_weight_qty",
-      formula: ""
-    },
-    {
-      label: "C钉/夹码重量",
-      field: "cnail_weight_qty",
-      formula: ""
-    },
-    {
-      label: "海绵包边重量",
-      field: "sponge_weight_qty",
-      formula: ""
-    },
-    {
-      label: "填充海绵重量",
-      field: "sponge_weight_tc_qty",
-      formula: ""
-    },
-    {
-      label: "封边材料重量",
-      field: "edge_weight_qty",
-      formula: ""
-    },
-    {
-      label: "弹叉材料重量",
-      field: "fork_weight_qty",
-      formula: ""
-    },
-    {
-      label: "重量汇总",
-      field: "sum_weight",
-      formula: ""
-    },
-    {
-      label: "FOB",
-      field: "fob",
-      formula: "[fob]"
-    }
-  ]);
-
-  /**
-   * @description 主表公式字段照表
-   */
-  const fieldParams = ref<any>([
-    {
-      label: "总成本",
-      field: "total_cost"
-    },
-    {
-      label: "不含税出厂价",
-      field: "nottax_factory_cost"
-    },
-    {
-      label: "部门售价",
-      field: "nottax_dept_cost"
-    },
-    {
-      label: "税金",
-      field: "taxes"
-    },
-    {
-      label: "部门含税价",
-      field: "dept_cost"
-    },
-    {
-      label: "外币价",
-      field: "foreign_cost"
-    },
-    {
-      label: "总材料成本",
-      field: "total_material_cost"
-    },
-    {
-      label: "大小单",
-      field: "dannum_rate"
-    },
-    {
-      label: "款式费用",
-      field: "hrcost"
-    },
-    {
-      label: "边带费用",
-      field: "biandaicost"
-    },
-    {
-      label: "额外费用",
-      field: "extras_cost"
-    },
-    {
-      label: "制造费用",
-      field: "zhizao_amt"
-    },
-    {
-      label: "折叠款",
-      field: "if_zhedie_type"
-    },
-    {
-      label: "管理费点",
-      field: "guanli_rate"
-    },
-    {
-      label: "工厂利润率",
-      field: "profitrate"
-    },
-    {
-      label: "利润率点数",
-      field: "profitrate_point"
-    },
-    {
-      label: "布套点数",
-      field: "butao_point"
-    },
-    {
-      label: "拆装点数",
-      field: "chaizhuang_point"
-    },
-    {
-      label: "海绵点数",
-      field: "haimian_point"
-    },
-    {
-      label: "部门利润率",
-      field: "dept_profitrate"
-    },
-    {
-      label: "部门让利点",
-      field: "dept_profitrate_rangli"
-    },
-    {
-      label: "额外点数",
-      field: "other_rate"
-    },
-    {
-      label: "佣金点数",
-      field: "commission"
-    },
-    {
-      label: "税率",
-      field: "taxrate"
-    },
-    {
-      label: "折扣率",
-      field: "discount"
-    },
-    {
-      label: "汇率",
-      field: "moneyrate"
-    },
-    {
-      label: "底价",
-      field: "dijia_cost"
-    }
-  ]);
-
   return {
     ...toRefs(state),
     columns,
@@ -2712,7 +2397,7 @@ export const useHooks = (t?: any) => {
     dw_bednet_mx_spring,
     reload_dw2,
     getData,
-    getDataMx,
+    // getDataMx,
     getDataMxSpring,
     getDataMxAdd,
     dataCallback,

+ 292 - 288
JLHWEB/src/views/quote/mattressQuote/components/QuoteList.vue

@@ -49,8 +49,9 @@ 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 { useUserStore } from "@/stores/modules/user";
 import { CommonDynamicSelect } from "@/api/modules/common";
+import { useHooksCpQuote } from "../hooks/cpQuote";
 
 interface WidgetProps {
   data: any;
@@ -66,20 +67,21 @@ interface WidgetProps {
   formulakindenum?: any;
 }
 
-interface WidgetTableItem {
-  label: string;
-  dscrp: any;
-  qty?: number | string;
-  costamt?: number | string;
-  useqty?: number | string;
-  price?: number | string;
-  [key: string]: any;
-}
+// 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>(), {});
 
 const { prefixCls } = useDesign("ljdrawer-quotelist");
-const { userInfo } = useUserStore();
+// const { userInfo } = useUserStore();
+const { tableData, oriTableData, wf_retrieve_qingdan } = useHooksCpQuote();
 
 const LjDrawerRef = ref();
 
@@ -88,7 +90,9 @@ const isCurrency = computed(() => {
 });
 
 const show = () => {
-  wf_retrieve_qingdang();
+  wf_retrieve_qingdan({
+    ...props
+  });
   LjDrawerRef.value.show();
 };
 
@@ -100,7 +104,7 @@ const isFilterTime = time => {
   return formatTime(time, "{y}-{m}-{d}", false);
 };
 
-const tableData = ref<WidgetTableItem[]>([]);
+// const tableData = ref<WidgetTableItem[]>([]);
 
 const fields = [
   { label: "财务底价", field: "nottax_dept_cost" },
@@ -109,68 +113,68 @@ const fields = [
   { label: "额外点数", field: "other_rate" },
   { label: "额外费用", field: "extras_cost" },
   { label: "汇率", field: "moneyrate" },
-  { label: "款式费用", field: "hrcost1" },
-  { label: "边带费用", field: "biandaicost1" },
-  { label: "总成本", field: "total_cost_1" },
+  { label: "款式费用", field: "hrcost" },
+  { label: "边带费用", field: "biandaicost" },
+  { label: "总成本", field: "total_cost" },
   { label: "工厂利润率", field: "profitrate" },
   { label: "工艺点数", field: "profitrate_point" },
-  { label: "不含税出厂价", field: "nottax_factory_cost_1" },
+  { label: "不含税出厂价", field: "nottax_factory_cost" },
   { label: "部门利润率", field: "dept_profitrate" },
   { label: "FOB费用", field: "fob" },
-  { label: "部门售价", field: "nottax_dept_cost_1" },
+  { label: "部门售价", field: "nottax_dept_cost" },
   { label: "让利点数", field: "dept_profitrate_rangli" },
   { label: "海绵款扣点", field: "haimian_point" }
 ];
 
-const oriTableData = ref<WidgetTableItem[]>([
-  {
-    label: "床垫编码",
-    dscrp: () => props.data.mattresscode
-  },
-  {
-    label: "床垫名称",
-    dscrp: () => props.data.mattressname
-  },
-  {
-    label: "床垫类别",
-    dscrp: () => {
-      let _enum = props.enumMap.get("mattresstypeid");
-      let result = "";
-      if (_enum) {
-        result = _enum.find(t => t.value == props.data.mattresstypeid).label ?? "";
-      }
-      return result;
-    }
-  },
-  {
-    label: "床垫规格",
-    dscrp: () => {
-      return `${props.data.mattress_width} * ${props.data.mattress_length} * ${props.data.mattress_height}`;
-    }
-  },
-  {
-    label: "拆装、布套",
-    dscrp: () => {
-      let arr = [];
-      if (Number(props.data.if_m_chai) == 1) {
-        arr.push("面拆");
-      }
-      if (Number(props.data.if_z_chai) == 1) {
-        arr.push("中拆");
-      }
-      if (Number(props.data.if_d_chai) == 1) {
-        arr.push("底拆");
-      }
-      if (Number(props.data.if_n_butao) == 1) {
-        arr.push("内布套");
-      }
-      if (Number(props.data.if_w_butao) == 1) {
-        arr.push("外布套");
-      }
-      return arr.join(" ");
-    }
-  }
-]);
+// const oriTableData = ref<WidgetTableItem[]>([
+//   {
+//     label: "床垫编码",
+//     dscrp: () => props.data.mattresscode
+//   },
+//   {
+//     label: "床垫名称",
+//     dscrp: () => props.data.mattressname
+//   },
+//   {
+//     label: "床垫类别",
+//     dscrp: () => {
+//       let _enum = props.enumMap.get("mattresstypeid");
+//       let result = "";
+//       if (_enum) {
+//         result = _enum.find(t => t.value == props.data.mattresstypeid).label ?? "";
+//       }
+//       return result;
+//     }
+//   },
+//   {
+//     label: "床垫规格",
+//     dscrp: () => {
+//       return `${props.data.mattress_width} * ${props.data.mattress_length} * ${props.data.mattress_height}`;
+//     }
+//   },
+//   {
+//     label: "拆装、布套",
+//     dscrp: () => {
+//       let arr = [];
+//       if (Number(props.data.if_m_chai) == 1) {
+//         arr.push("面拆");
+//       }
+//       if (Number(props.data.if_z_chai) == 1) {
+//         arr.push("中拆");
+//       }
+//       if (Number(props.data.if_d_chai) == 1) {
+//         arr.push("底拆");
+//       }
+//       if (Number(props.data.if_n_butao) == 1) {
+//         arr.push("内布套");
+//       }
+//       if (Number(props.data.if_w_butao) == 1) {
+//         arr.push("外布套");
+//       }
+//       return arr.join(" ");
+//     }
+//   }
+// ]);
 
 const getSummaries = (param: any) => {
   const { columns, data } = param;
@@ -219,227 +223,227 @@ const getSummaries = (param: any) => {
 /**
  * @description 刷新报价清单
  */
-const wf_retrieve_qingdang = () => {
-  tableData.value = [];
-  let _tData = cloneDeep(oriTableData.value);
-  tableData.value = _tData.map(item => {
-    for (const key in item) {
-      if (isFunction(item[key])) {
-        item[key] = item[key]();
-      }
-    }
-    return item;
-  });
-
-  console.log("props.mxdata data:>> ", props.mxdata, props.data);
-  let _mxitm = null;
-  props.mxdata.map(item => {
-    switch (item.field) {
-      case "tabpage_8":
-      case "tabpage_9":
-      case "tabpage_10":
-      case "tabpage_11":
-      case "tabpage_12":
-        _mxitm = props.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 = {};
-            result.label = itm.chastr != "" ? itm.chastr : item.label;
-            let _formulaName = "";
-            if (props.formulakindenum) {
-              _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
-            }
-
-            _formulaName = _formulaName.replace(item.replace, "");
-
-            console.log("_formulaName  rp:>> ", _formulaName, item.replace);
-            result.dscrp = `${_formulaName}:${itm.mtrlname}`;
-
-            if (Number(itm.thickness) > 0) {
-              result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
-            }
-            result.qty = Number(itm.qty);
-            if (userInfo.usermode == 0) {
-              result.costamt = isFilterPrice(itm.costamt ?? 0);
-              result.useqty = Number(itm.useqty ?? 0);
-              result.price = isFilterPrice(itm.price ?? 0);
-            }
-            tableData.value.push(result);
-          }
-        });
-        break;
-      case "tabpage_13":
-        _mxitm = props.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 = {};
-            result.label = itm.label;
-            let _formulaName = "";
-            if (props.formulakindenum) {
-              _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
-            }
-
-            _formulaName = _formulaName.replace(item.replace, "");
-            result.dscrp = `${_formulaName}:${itm.mtrlname}`;
-
-            if (Number(itm.thickness) > 0) {
-              result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
-            }
-            result.qty = Number(itm.qty);
-            if (userInfo.usermode == 0) {
-              result.costamt = isFilterPrice(itm.costamt ?? 0);
-              result.useqty = Number(itm.useqty ?? 0);
-              result.price = isFilterPrice(itm.price ?? 0);
-            }
-            tableData.value.push(result);
-          }
-        });
-        break;
-      case "cushions": // 垫层
-        item.data.cushions.map(itm => {
-          if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0 || [999].includes(Number(itm.formulakind))) {
-            let result: any = {};
-            let _formulaName = "";
-            if (props.formulakindenum) {
-              _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
-            }
-
-            result.label = _formulaName;
-            result.dscrp = itm.mtrlname;
-
-            if (![999].includes(Number(itm.formulakind))) {
-              if (Number(itm.thickness) > 0) {
-                result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
-              }
-              result.qty = Number(itm.qty);
-              if (userInfo.usermode == 0) {
-                result.costamt = isFilterPrice(itm.costamt ?? 0);
-                result.useqty = Number(itm.useqty ?? 0);
-                result.price = isFilterPrice(itm.price ?? 0);
-              }
-            } else {
-              // 999是床网
-              // long ll_bednetid = 0
-              // decimal ld_bednet_height = 0
-              // s_bednet_qd s_bednet_qingdan[]
-              // string arg_temp_msg
-              // ll_bednetid = 0
-              // if dw_chuangwang.rowcount() = 1 then //单床网
-              //   ll_bednetid = dw_chuangwang.object.mtrlid[1]
-              //   f_get_bednet_qingdan(ll_bednetid,s_bednet_qingdan,arg_temp_msg)
-              //   if upperbound(s_bednet_qingdan) > 0 then
-              //     dw_qingdan.Object.str1[ll_row] = s_bednet_qingdan[1].pznamemx
-              //     dw_qingdan.Object.str2[ll_row] = '1'
-              //     IF sys_usermode = 0 THEN //管理员模式
-              //       dw_qingdan.Object.str3[ll_row] = string( s_bednet_qingdan[1].amt,'#,##0.00')
-              //     end if
-              //   end if
-              // else //多床网
-              //   for k = 1 to dw_chuangwang.rowcount()
-              //     ll_bednetid = 0
-              //     ld_bednet_height = 0
-              //     ll_bednetid = dw_chuangwang.object.mtrlid[k]
-              //     SELECT u_bednetmx.bednet_height Into :ld_bednet_height From u_bednetmx Where bednetid = :ll_bednetid;
-              //     if isnull(ld_bednet_height) then ld_bednet_height = 0
-              //     if ld_bednet_height = dw_dianceng.object.thickness[i] then
-              //       ll_bednetid = dw_chuangwang.object.mtrlid[k]
-              //       f_get_bednet_qingdan(ll_bednetid,s_bednet_qingdan,arg_temp_msg)
-              //       if upperbound(s_bednet_qingdan) > 0 then
-              //         dw_qingdan.Object.str1[ll_row] = s_bednet_qingdan[1].pznamemx
-              //         dw_qingdan.Object.str2[ll_row] = '1'
-              //         IF sys_usermode = 0 THEN //管理员模式
-              //           dw_qingdan.Object.str3[ll_row] = string( s_bednet_qingdan[1].amt,'#,##0.00')
-              //         end if
-              //       end if
-              //     end if
-              //   next
-              // end if
-            }
-
-            tableData.value.push(result);
-          }
-        });
-        break;
-      case "accessories": // 辅料
-        item.data.map(itm => {
-          if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
-            let result: any = {};
-            result.label = itm.label;
-            let _formulaName = "";
-            if (props.formulakindenum) {
-              _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
-            }
-
-            result.label = _formulaName;
-            result.dscrp = itm.mtrlname;
-
-            if (Number(itm.thickness) > 0) {
-              result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
-            }
-            result.qty = Number(itm.qty);
-            if (userInfo.usermode == 0) {
-              result.costamt = isFilterPrice(itm.costamt ?? 0);
-              result.useqty = Number(itm.useqty ?? 0);
-              result.price = isFilterPrice(itm.price ?? 0);
-            }
-            tableData.value.push(result);
-          }
-        });
-        break;
-      case "packag":
-        console.log("packag item.data :>> ", item.data, props.formulakindenum);
-        item.data.map(itm => {
-          console.log("(Number(itm.mtrlid) > 0 |:>> ", Number(itm.mtrlid) > 0);
-          console.log(
-            "(N Number(itm.costamt) != 0) :>> ",
-            Number(itm.costamt) != 0,
-            Number(itm.costamt),
-            itm.costamt,
-            Number(itm?.costamt),
-            Number(itm?.costamt) != 0
-          );
-          console.log(
-            "(Number(itm.mtrlid) > 0 || Number(itm.costamt) != 0) :>> ",
-            Number(itm.mtrlid) > 0 || Number(itm.costamt) != 0
-          );
-          if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
-            let result: any = {};
-            result.label = itm.label;
-            let _formulaName = "";
-            if (props.formulakindenum) {
-              _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
-            }
-            result.label = _formulaName;
-
-            result.dscrp = Number(itm.mtrlid) > 0 ? itm.mtrlname : _formulaName;
-
-            if (Number(itm.thickness) > 0) {
-              result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
-            }
-            result.qty = Number(itm.qty);
-            if (userInfo.usermode == 0) {
-              result.costamt = isFilterPrice(itm.costamt ?? 0);
-              result.useqty = Number(itm.useqty ?? 0);
-              result.price = isFilterPrice(itm.price ?? 0);
-            }
-            tableData.value.push(result);
-          }
-        });
-        break;
-    }
-  });
-
-  console.log("wf_retrieve_qingdang tableData.value :>> ", tableData.value);
-
-  tableData.value.push({
-    label: "地区",
-    dscrp: props.data.area ?? ""
-  });
-  tableData.value.push({
-    label: "柜型",
-    dscrp: props.data.cabinet_type ?? ""
-  });
-};
+// const wf_retrieve_qingdan = () => {
+//   tableData.value = [];
+//   let _tData = cloneDeep(oriTableData.value);
+//   tableData.value = _tData.map(item => {
+//     for (const key in item) {
+//       if (isFunction(item[key])) {
+//         item[key] = item[key]();
+//       }
+//     }
+//     return item;
+//   });
+
+//   console.log("props.mxdata data:>> ", props.mxdata, props.data);
+//   let _mxitm = null;
+//   props.mxdata.map(item => {
+//     switch (item.field) {
+//       case "tabpage_8":
+//       case "tabpage_9":
+//       case "tabpage_10":
+//       case "tabpage_11":
+//       case "tabpage_12":
+//         _mxitm = props.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 = {};
+//             result.label = itm.chastr != "" ? itm.chastr : item.label;
+//             let _formulaName = "";
+//             if (props.formulakindenum) {
+//               _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
+//             }
+
+//             _formulaName = _formulaName.replace(item.replace, "");
+
+//             console.log("_formulaName  rp:>> ", _formulaName, item.replace);
+//             result.dscrp = `${_formulaName}:${itm.mtrlname}`;
+
+//             if (Number(itm.thickness) > 0) {
+//               result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
+//             }
+//             result.qty = Number(itm.qty);
+//             if (userInfo.usermode == 0) {
+//               result.costamt = isFilterPrice(itm.costamt ?? 0);
+//               result.useqty = Number(itm.useqty ?? 0);
+//               result.price = isFilterPrice(itm.price ?? 0);
+//             }
+//             tableData.value.push(result);
+//           }
+//         });
+//         break;
+//       case "tabpage_13":
+//         _mxitm = props.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 = {};
+//             result.label = itm.label;
+//             let _formulaName = "";
+//             if (props.formulakindenum) {
+//               _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
+//             }
+
+//             _formulaName = _formulaName.replace(item.replace, "");
+//             result.dscrp = `${_formulaName}:${itm.mtrlname}`;
+
+//             if (Number(itm.thickness) > 0) {
+//               result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
+//             }
+//             result.qty = Number(itm.qty);
+//             if (userInfo.usermode == 0) {
+//               result.costamt = isFilterPrice(itm.costamt ?? 0);
+//               result.useqty = Number(itm.useqty ?? 0);
+//               result.price = isFilterPrice(itm.price ?? 0);
+//             }
+//             tableData.value.push(result);
+//           }
+//         });
+//         break;
+//       case "cushions": // 垫层
+//         item.data.cushions.map(itm => {
+//           if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0 || [999].includes(Number(itm.formulakind))) {
+//             let result: any = {};
+//             let _formulaName = "";
+//             if (props.formulakindenum) {
+//               _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
+//             }
+
+//             result.label = _formulaName;
+//             result.dscrp = itm.mtrlname;
+
+//             if (![999].includes(Number(itm.formulakind))) {
+//               if (Number(itm.thickness) > 0) {
+//                 result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
+//               }
+//               result.qty = Number(itm.qty);
+//               if (userInfo.usermode == 0) {
+//                 result.costamt = isFilterPrice(itm.costamt ?? 0);
+//                 result.useqty = Number(itm.useqty ?? 0);
+//                 result.price = isFilterPrice(itm.price ?? 0);
+//               }
+//             } else {
+//               // 999是床网
+//               // long ll_bednetid = 0
+//               // decimal ld_bednet_height = 0
+//               // s_bednet_qd s_bednet_qingdan[]
+//               // string arg_temp_msg
+//               // ll_bednetid = 0
+//               // if dw_chuangwang.rowcount() = 1 then //单床网
+//               //   ll_bednetid = dw_chuangwang.object.mtrlid[1]
+//               //   f_get_bednet_qingdan(ll_bednetid,s_bednet_qingdan,arg_temp_msg)
+//               //   if upperbound(s_bednet_qingdan) > 0 then
+//               //     dw_qingdan.Object.str1[ll_row] = s_bednet_qingdan[1].pznamemx
+//               //     dw_qingdan.Object.str2[ll_row] = '1'
+//               //     IF sys_usermode = 0 THEN //管理员模式
+//               //       dw_qingdan.Object.str3[ll_row] = string( s_bednet_qingdan[1].amt,'#,##0.00')
+//               //     end if
+//               //   end if
+//               // else //多床网
+//               //   for k = 1 to dw_chuangwang.rowcount()
+//               //     ll_bednetid = 0
+//               //     ld_bednet_height = 0
+//               //     ll_bednetid = dw_chuangwang.object.mtrlid[k]
+//               //     SELECT u_bednetmx.bednet_height Into :ld_bednet_height From u_bednetmx Where bednetid = :ll_bednetid;
+//               //     if isnull(ld_bednet_height) then ld_bednet_height = 0
+//               //     if ld_bednet_height = dw_dianceng.object.thickness[i] then
+//               //       ll_bednetid = dw_chuangwang.object.mtrlid[k]
+//               //       f_get_bednet_qingdan(ll_bednetid,s_bednet_qingdan,arg_temp_msg)
+//               //       if upperbound(s_bednet_qingdan) > 0 then
+//               //         dw_qingdan.Object.str1[ll_row] = s_bednet_qingdan[1].pznamemx
+//               //         dw_qingdan.Object.str2[ll_row] = '1'
+//               //         IF sys_usermode = 0 THEN //管理员模式
+//               //           dw_qingdan.Object.str3[ll_row] = string( s_bednet_qingdan[1].amt,'#,##0.00')
+//               //         end if
+//               //       end if
+//               //     end if
+//               //   next
+//               // end if
+//             }
+
+//             tableData.value.push(result);
+//           }
+//         });
+//         break;
+//       case "accessories": // 辅料
+//         item.data.map(itm => {
+//           if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
+//             let result: any = {};
+//             result.label = itm.label;
+//             let _formulaName = "";
+//             if (props.formulakindenum) {
+//               _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
+//             }
+
+//             result.label = _formulaName;
+//             result.dscrp = itm.mtrlname;
+
+//             if (Number(itm.thickness) > 0) {
+//               result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
+//             }
+//             result.qty = Number(itm.qty);
+//             if (userInfo.usermode == 0) {
+//               result.costamt = isFilterPrice(itm.costamt ?? 0);
+//               result.useqty = Number(itm.useqty ?? 0);
+//               result.price = isFilterPrice(itm.price ?? 0);
+//             }
+//             tableData.value.push(result);
+//           }
+//         });
+//         break;
+//       case "packag":
+//         console.log("packag item.data :>> ", item.data, props.formulakindenum);
+//         item.data.map(itm => {
+//           console.log("(Number(itm.mtrlid) > 0 |:>> ", Number(itm.mtrlid) > 0);
+//           console.log(
+//             "(N Number(itm.costamt) != 0) :>> ",
+//             Number(itm.costamt) != 0,
+//             Number(itm.costamt),
+//             itm.costamt,
+//             Number(itm?.costamt),
+//             Number(itm?.costamt) != 0
+//           );
+//           console.log(
+//             "(Number(itm.mtrlid) > 0 || Number(itm.costamt) != 0) :>> ",
+//             Number(itm.mtrlid) > 0 || Number(itm.costamt) != 0
+//           );
+//           if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0) {
+//             let result: any = {};
+//             result.label = itm.label;
+//             let _formulaName = "";
+//             if (props.formulakindenum) {
+//               _formulaName = props.formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
+//             }
+//             result.label = _formulaName;
+
+//             result.dscrp = Number(itm.mtrlid) > 0 ? itm.mtrlname : _formulaName;
+
+//             if (Number(itm.thickness) > 0) {
+//               result.dscrp += ` 厚度:${isFilterPrice(itm.thickness)}`;
+//             }
+//             result.qty = Number(itm.qty);
+//             if (userInfo.usermode == 0) {
+//               result.costamt = isFilterPrice(itm.costamt ?? 0);
+//               result.useqty = Number(itm.useqty ?? 0);
+//               result.price = isFilterPrice(itm.price ?? 0);
+//             }
+//             tableData.value.push(result);
+//           }
+//         });
+//         break;
+//     }
+//   });
+
+//   console.log("wf_retrieve_qingdan tableData.value :>> ", tableData.value);
+
+//   tableData.value.push({
+//     label: "地区",
+//     dscrp: props.data.area ?? ""
+//   });
+//   tableData.value.push({
+//     label: "柜型",
+//     dscrp: props.data.cabinet_type ?? ""
+//   });
+// };
 
 const objectSpanMethod = (data: any) => {
   const { row, column, rowIndex, columnIndex } = data;

+ 15 - 1
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -434,6 +434,7 @@ import LjDetail from "@/components/LjDetail/index.vue";
 import { DetailProp } from "@/components/LjDetail/interface";
 import { useI18n } from "vue-i18n";
 import { useHooks } from "./hooks/index";
+import { useHooksCpQuote } from "./hooks/cpQuote";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
 import LjVxeTable from "@/components/LjVxeTable/index.vue";
 // import { cloneDeep } from "lodash-es";
@@ -450,6 +451,7 @@ import LjDrawerQuoteList from "./components/QuoteList.vue";
 import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
+import { useUserStore } from "@/stores/modules/user";
 
 // interface detailProp {
 //   // /**
@@ -538,7 +540,9 @@ const {
   dynamicRef,
   wf_cmp_cb
 } = useHooks(t);
+const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+const { userInfo } = useUserStore();
 // const toast = useToast();
 
 // const orderStatus = ref("");
@@ -1205,6 +1209,9 @@ const orderDefaultAction = [
   }),
   buttonDefault({
     label: t("common.showFormula"),
+    disabledTextCallBack: () => {
+      return userInfo.usermode == 1 ? "业务员模式不可以查看!" : "";
+    },
     clickFunc: item => gotoSummy()
   }),
   buttonDefault({
@@ -1224,7 +1231,14 @@ const orderDefaultAction = [
     label: t("common.exportQuoteList"),
     power: 72,
     clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+      let _data = {
+        data: LjDetailRef.value._mainData,
+        mxdata: isQuoteListMxData.value,
+        enumMap: LjDetailRef.value.enumMap,
+        fabricMx: fabricMxTabList.value,
+        formulakindenum: formulaKindEnum.value
+      };
+      toExcelQuote(_data, "报价单");
     }
   })
   // buttonDefault({

File diff suppressed because it is too large
+ 1231 - 0
JLHWEB/src/views/quote/mattressQuote/hooks/cpQuote.ts


+ 7 - 14
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -501,6 +501,8 @@ export const useHooks = (t?: any) => {
     diancengAreaEnum: []
   });
 
+  const { userInfo } = useUserStore();
+
   state.orderStatus = inject("orderStatus", "");
 
   const getData_mx = (params: any) => {
@@ -1528,7 +1530,7 @@ export const useHooks = (t?: any) => {
   // /**
   //  * @description 刷新报价清单
   //  */
-  // const wf_retrieve_qingdang = () => {
+  // const wf_retrieve_qingdan = () => {
 
   // }
 
@@ -2189,6 +2191,10 @@ export const useHooks = (t?: any) => {
    * @param timeout
    */
   const gotoSummy = async (timeout = 0) => {
+    if (userInfo.usermode == 1) {
+      ElMessage.error("'业务员模式不可以查看计算公式!'");
+      return false;
+    }
     // console.log("LjDetailRef.value.mainData :>> ", LjDetailRef.value._mainData, summaryData.value);
     const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
     const toast = useToast();
@@ -2958,7 +2964,6 @@ export const useHooks = (t?: any) => {
       field: "price",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -2971,7 +2976,6 @@ export const useHooks = (t?: any) => {
       field: "shrinkage",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -2980,7 +2984,6 @@ export const useHooks = (t?: any) => {
       field: "gram_weight",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -2989,7 +2992,6 @@ export const useHooks = (t?: any) => {
       field: "cloth_width",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -2998,7 +3000,6 @@ export const useHooks = (t?: any) => {
       field: "if_inputqty",
       datatype: "checkbox",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3007,7 +3008,6 @@ export const useHooks = (t?: any) => {
       field: "if_areaprice",
       datatype: "checkbox",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3016,7 +3016,6 @@ export const useHooks = (t?: any) => {
       field: "costamt",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3024,7 +3023,6 @@ export const useHooks = (t?: any) => {
       title: "金额文本公式",
       field: "formula",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3032,7 +3030,6 @@ export const useHooks = (t?: any) => {
       title: "金额数字公式",
       field: "replace_formula",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3041,7 +3038,6 @@ export const useHooks = (t?: any) => {
       field: "useqty",
       datatype: "number",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3049,7 +3045,6 @@ export const useHooks = (t?: any) => {
       title: "用量文本公式",
       field: "useformula",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3057,7 +3052,6 @@ export const useHooks = (t?: any) => {
       title: "用量数字公式",
       field: "replace_useformula",
       limited: () => {
-        const { userInfo } = useUserStore();
         return userInfo.usermode != 0;
       }
     },
@@ -3077,7 +3071,6 @@ export const useHooks = (t?: any) => {
       formula:
         "if([折叠款] = 1, ([总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用]) * 2, [总材料成本]*[大小单]+[款式费用]+[边带费用]+[额外费用]+[制造费用])",
       power: () => {
-        const { userInfo } = useUserStore();
         if (userInfo.empid != 0 && userInfo.usermode != 0) {
           return false;
         } else {

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

@@ -31,6 +31,7 @@ import { ColumnProps } from "@/components/LjVxeTable/interface";
 import LjDrawer from "@/components/LjDrawer/index.vue";
 // import PriceListDetail from "./detail.vue";
 import { useHooks } from "./hooks/index";
+import { useHooksCpQuote } from "./hooks/cpQuote";
 import LjDialog from "@/components/LjDialog/index.vue";
 import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
 import { useI18n } from "vue-i18n";
@@ -51,6 +52,7 @@ const { t } = useI18n();
 const router = useRouter();
 const globalStore = useGlobalStore();
 const { columns, dataCallback } = useHooks();
+const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const initParams = ref({});
@@ -345,44 +347,7 @@ const action: detailAction[] = [
     label: t("common.businessSupplement"),
     power: 72,
     clickFunc: item => {
-      // const Exceljs = require("exceljs"); // 引入exceljs
-      const workbook = new Exceljs.Workbook(); // 创建工作簿
-      const workSheet = workbook.addWorksheet("总报价"); // 创建工作表(sheet1)
-      let cols = vxeTableRef.value.tableColumns.map((t: any) => {
-        let res = {
-          header: t.title,
-          key: t.field
-          // width: t.width
-        };
-        return res;
-      });
-      console.log("cols :>> ", cols, vxeTableRef.value.tableData);
-      workSheet.columns = cols; // 工作表添加表头
-      workSheet.addRows(vxeTableRef.value.tableData); // 往工作表插入数据
-      // workSheet.mergeCells("A1:M1"); //将A1到M1的单元格合并
-      // const cell = workSheet.getCell("A1"); // 获取A1单元格
-      // cell.value = "我是A1各自的数据";
-
-      //======================================= 第一行 =================================
-      // 合并A1到L1的单元格 (大标题)
-      workSheet.mergeCells("A1:M1");
-      const cell = workSheet.getCell("A1");
-      cell.value = "Mechanical  CO., LTD. - Quotation \n - 报价单";
-
-      // 设置第一行的单元格样式
-      cell.font = { size: 16, bold: true, name: "仿宋" }; // 设置字体大小为16,加粗,仿宋
-      cell.alignment = {
-        vertical: "middle", // 垂直居中
-        horizontal: "center", // 水平居中
-        wrapText: true // 自动换行
-      };
-      // 调整第一行的高度
-      workSheet.getRow(1).height = 70;
-
-      // 下载工作簿
-      workbook.xlsx.writeBuffer().then(buffer => {
-        saveAs(new Blob([buffer], { type: "application/octet-stream" }), "测试导出.xlsx");
-      });
+      toExcelQuote(vxeTableRef.value, "aces测试");
     }
   }),
   buttonDefault({

+ 3 - 3
JLHWEB/src/views/quote/semifinprodQuote/components/QuoteList.vue

@@ -88,7 +88,7 @@ const isCurrency = computed(() => {
 });
 
 const show = () => {
-  wf_retrieve_qingdang();
+  wf_retrieve_qingdan();
   LjDrawerRef.value.show();
 };
 
@@ -219,7 +219,7 @@ const getSummaries = (param: any) => {
 /**
  * @description 刷新报价清单
  */
-const wf_retrieve_qingdang = () => {
+const wf_retrieve_qingdan = () => {
   tableData.value = [];
   let _tData = cloneDeep(oriTableData.value);
   tableData.value = _tData.map(item => {
@@ -429,7 +429,7 @@ const wf_retrieve_qingdang = () => {
     }
   });
 
-  console.log("wf_retrieve_qingdang tableData.value :>> ", tableData.value);
+  console.log("wf_retrieve_qingdan tableData.value :>> ", tableData.value);
 
   tableData.value.push({
     label: "地区",