Browse Source

LJHweb:床垫床网代码

JohnnyChan 9 months ago
parent
commit
7b512f8c84
29 changed files with 4726 additions and 190 deletions
  1. 4 1
      JLHWEB/src/api/interface/index.ts
  2. 1 1
      JLHWEB/src/api/modules/quote.ts
  3. 4 4
      JLHWEB/src/components/Grid/index.vue
  4. 22 8
      JLHWEB/src/components/LjDetail/components/BaseForm.vue
  5. 19 5
      JLHWEB/src/components/LjDetail/components/ButtonGroup.vue
  6. 31 11
      JLHWEB/src/components/LjDetail/index.vue
  7. 8 0
      JLHWEB/src/components/LjDetail/interface/index.ts
  8. 1 1
      JLHWEB/src/components/LjFoldLayout/index.vue
  9. 5 5
      JLHWEB/src/hooks/useAuthButtons.ts
  10. 8 8
      JLHWEB/src/hooks/useDwLayout.tsx
  11. 5 1
      JLHWEB/src/languages/modules/zh-cn/business.json
  12. 1 0
      JLHWEB/src/languages/modules/zh-cn/common.json
  13. 3 0
      JLHWEB/src/languages/modules/zh-cn/menu.json
  14. 6 0
      JLHWEB/src/languages/modules/zh-cn/table.json
  15. 33 0
      JLHWEB/src/routers/modules/bednetQtuoteRouter.ts
  16. 2 2
      JLHWEB/src/routers/modules/mattressQtuoteRouter.ts
  17. 4 4
      JLHWEB/src/utils/index.ts
  18. 0 5
      JLHWEB/src/views/baseinfo/bednetarea/detail.vue
  19. 1 3
      JLHWEB/src/views/baseinfo/bednetarea/index.vue
  20. 685 0
      JLHWEB/src/views/quote/bednetQuote/detail.vue
  21. 1841 0
      JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx
  22. 434 1
      JLHWEB/src/views/quote/bednetQuote/index.vue
  23. 263 81
      JLHWEB/src/views/quote/mattressQuote/detail.vue
  24. 850 26
      JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx
  25. 8 22
      JLHWEB/src/views/quote/mattressQuote/index.vue
  26. 97 1
      JLHWEB/src/views/system/selector/mtrldef/index.vue
  27. 56 0
      JLHWEB/src/views/system/selector/spring/hooks/index.ts
  28. 221 0
      JLHWEB/src/views/system/selector/spring/index.vue
  29. 113 0
      JLHWEB/src/views/system/selector/spring/select.vue

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

@@ -1164,7 +1164,10 @@ export namespace SalePrice {
 export namespace Mattress {
   export interface ReqSaveMattress {
     mattress: any;
-    mattressMx: any[];
+    mattressMx?: any[];
+  }
+  export interface ResSaveMattress {
+    mattressid: number;
   }
   export interface ReqMultiMattress {
     mattressids: number[];

+ 1 - 1
JLHWEB/src/api/modules/quote.ts

@@ -6,7 +6,7 @@ import http from "@/api";
  * @name 床垫报价保存
  */
 export const SaveMattress = (params: Mattress.ReqSaveMattress) => {
-  return http.post(PORT1 + `/SaveMattress`, params);
+  return http.post<Mattress.ResSaveMattress>(PORT1 + `/SaveMattress`, params);
 };
 
 /**

+ 4 - 4
JLHWEB/src/components/Grid/index.vue

@@ -63,7 +63,7 @@ const { assemblySize } = useGlobalStore();
 onBeforeMount(() => props.collapsed && findIndex());
 onMounted(() => {
   // onBeforeMount(() => {
-  console.log("grid reset onmount:>> ", props.target, props.collapsed);
+  // console.log("grid reset onmount:>> ", props.target, props.collapsed);
   // props.collapsed && findIndex();
   resize({ target: { innerWidth: window.innerWidth } } as unknown as UIEvent);
   window.addEventListener("resize", resize);
@@ -85,11 +85,11 @@ const breakPointUpdate = inject("breakPointUpdate", (data: any, target: string)
 const resize = (e: UIEvent, callback?: any) => {
   nextTick(() => {
     let width = (e.target as Window).innerWidth;
-    console.log("grid resize props.target :>> ", props.target);
+    // console.log("grid resize props.target :>> ", props.target);
     if (props.target) {
       let _target = document.getElementById(props.target) as HTMLElement;
       _target && (width = _target.offsetWidth);
-      console.log("grid resize props.target width:>> ", props.target, width);
+      // console.log("grid resize props.target width:>> ", props.target, width);
     }
     switch (!!width) {
       case width < 768:
@@ -108,7 +108,7 @@ const resize = (e: UIEvent, callback?: any) => {
         breakPoint.value = "xl";
         break;
     }
-    console.log("grid resize breakPoint.value :>> ", breakPoint.value);
+    // console.log("grid resize breakPoint.value :>> ", breakPoint.value);
     breakPointUpdate(breakPoint.value, props.target);
     callback && callback();
   });

+ 22 - 8
JLHWEB/src/components/LjDetail/components/BaseForm.vue

@@ -29,7 +29,7 @@
               >
               <el-divider direction="vertical" />
               <el-button-group class="-enter-y">
-                <el-popover :visible="visibleNewGroup" trigger="click" placement="top" :width="240">
+                <el-popover :visible="visibleNewGroup" trigger="click" placement="top" :width="280">
                   <el-form label-position="top" @submit.prevent>
                     <el-form-item :label="$t('common.table.newGroupTitle')">
                       <el-input
@@ -42,9 +42,22 @@
                       />
                     </el-form-item>
                   </el-form>
-                  <div class="flx-end">
-                    <el-button text @click="visibleNewGroup = false">{{ $t("common.cancelText") }}</el-button>
-                    <el-button class="btn-group" type="primary" @click="toAddGroup">{{ $t("common.okText") }}</el-button>
+                  <div class="flx-justify-between">
+                    <el-space>
+                      <el-select
+                        v-model="newGroupSpan"
+                        :placeholder="String(searchCol[breakPoint])"
+                        class="flx-1"
+                        :teleported="false"
+                      >
+                        <template #prefix>
+                          <span class="text-f-c text-disable">{{ $t("sys.setting.columnNum") }}</span>
+                        </template>
+                        <el-option v-for="ritem in searchCol[breakPoint]" :key="ritem" :label="ritem" :value="ritem" />
+                      </el-select>
+                      <el-button text @click="visibleNewGroup = false">{{ $t("common.cancelText") }}</el-button>
+                      <el-button class="btn-group" type="primary" @click="toAddGroup">{{ $t("common.okText") }}</el-button>
+                    </el-space>
                   </div>
                   <template #reference>
                     <el-button class="btn-group" type="primary" @click="handleOpenAddGroupPopo" :disabled="!selectColumn.length">
@@ -506,7 +519,7 @@
                     <template #default>
                       <template v-for="(item, index) in showGroup(groupItem.list)" :key="item.field">
                         <GridItem
-                          v-if="!item?.basicinfo?.disabled"
+                          v-if="!item?.basicinfo?.disabled && getIfcanEditVisible(item)"
                           v-bind="getResponsive(item)"
                           :index="index"
                           :row="item.basicinfo?.row ?? 1"
@@ -517,7 +530,6 @@
                             animated
                             :loading="typeof searchParam[handleProp(item.field!)]  == 'undefined' && loading"
                             class="mr-12"
-                            v-if="getIfcanEditVisible(item)"
                           >
                             <template #template
                               ><el-skeleton-item variant="h3" style="height: 30px; vertical-align: middle"
@@ -1884,7 +1896,7 @@ onMounted(() => {
    */
   const observeDomGird = new MutationObserver((mutations, observe) => {
     nextTick(() => {
-      console.log("gridTaget.offsetWidth :>> ", props.formid + "-basicform-groups", gridTaget.offsetWidth);
+      // console.log("gridTaget.offsetWidth :>> ", props.formid + "-basicform-groups", gridTaget.offsetWidth);
       refresh();
     });
   });
@@ -2004,6 +2016,7 @@ const toSaveBaceGroupLabel = (item: any, index: number) => {
 const visibleNewGroup = ref(false);
 const newGroupName = ref("");
 const newGroupNameRef = ref();
+const newGroupSpan = ref(props.searchCol[breakPoint.value]);
 
 const handleOpenAddGroupPopo = () => {
   visibleNewGroup.value = true;
@@ -2042,7 +2055,8 @@ const toAddGroup = () => {
     // span: props.searchCol[breakPoint.value],
     list: cols,
     collapsed: true,
-    edit: false
+    edit: false,
+    span: newGroupSpan.value
   };
 
   groupFlatColumns.value.push(newGroup);

+ 19 - 5
JLHWEB/src/components/LjDetail/components/ButtonGroup.vue

@@ -153,6 +153,7 @@ const buttonItemRender = (item: any) => {
   //   return props.data && item.disabledTextCallBack && item.disabledTextCallBack(props.data);
   // });
   let btnDisabledTxt = props.data && item.disabledTextCallBack ? item.disabledTextCallBack(props.data) : "";
+  let _loading = isFunction(item.loading) ? item.loading() : false;
 
   // 排除多余属性,仅展示需要的属性继承
   let btnAttr = omitAttr(_item);
@@ -180,6 +181,7 @@ const buttonItemRender = (item: any) => {
               {...btnAttr}
               class={{ "is-disabled": disabled }}
               disabled={disabled}
+              loading={_loading}
               onClick={item.clickFunc}
               v-slots={iconRender}
               size={props.assemblySize}
@@ -190,7 +192,14 @@ const buttonItemRender = (item: any) => {
         );
       } else {
         return (
-          <el-button size={props.assemblySize} {...btnAttr} onClick={item.clickFunc} v-slots={iconRender}>
+          <el-button
+            size={props.assemblySize}
+            {...btnAttr}
+            disabled={_loading}
+            loading={_loading}
+            onClick={item.clickFunc}
+            v-slots={iconRender}
+          >
             {item.label}
           </el-button>
         );
@@ -216,6 +225,7 @@ const buttonsMenuRender = (item: any) => {
 
   // 排除多余属性,仅展示需要的属性继承
   let btnAttr = omitAttr(_item);
+  let _loading = isFunction(item?.loading) ? item.loading() : false;
 
   if (item.render) {
     // return item.render(item);
@@ -237,7 +247,8 @@ const buttonsMenuRender = (item: any) => {
             text
             {...btnAttr}
             class={{ "is-disabled": disabled, "flx-1": true }}
-            disabled={disabled}
+            disabled={disabled || _loading}
+            loading={_loading}
             onClick={item.clickFunc}
             v-slots={iconRender}
           >
@@ -248,7 +259,7 @@ const buttonsMenuRender = (item: any) => {
     );
   } else {
     return (
-      <el-dropdown-item {...btnAttr} onClick={item.clickFunc} class="flx-1">
+      <el-dropdown-item {...btnAttr} disabled={_loading} loading={_loading} onClick={item.clickFunc} class="flx-1">
         {item.label}
       </el-dropdown-item>
     );
@@ -306,6 +317,7 @@ const bottonDropdownRender = (item: any, placement?: string) => {
   let _btnAttr = omitAttr(_item);
   let btnDisabledTxt = props.data && _item.disabledTextCallBack ? _item.disabledTextCallBack(props.data) : "";
   let disabled = Boolean(btnDisabledTxt);
+  let _loading = isFunction(_item.loading) ? _item.loading() : false;
 
   const childrenSlot = {
     template: () => {
@@ -328,7 +340,8 @@ const bottonDropdownRender = (item: any, placement?: string) => {
                 <el-button
                   {..._btnAttr}
                   class={{ "is-disabled": disabled }}
-                  disabled={disabled}
+                  disabled={disabled || _loading}
+                  loading={_loading}
                   size={props.assemblySize}
                   onClick={_item.clickFunc}
                   v-slots={iconRender}
@@ -352,7 +365,8 @@ const bottonDropdownRender = (item: any, placement?: string) => {
                 <el-text
                   {..._btnAttr}
                   class={{ "is-disabled": disabled, "menu-more__text": true }}
-                  disabled={disabled}
+                  disabled={disabled || _loading}
+                  loading={_loading}
                   onClick={_item.clickFunc}
                   v-slots={iconRender}
                 >

+ 31 - 11
JLHWEB/src/components/LjDetail/index.vue

@@ -123,7 +123,18 @@ const detailData_api = ref();
 /**
  * @description 主表数据,影子,只读
  */
-const _mainData = computed(() => tableData.value[0] ?? props.data[0] ?? infoParam.value);
+// const _mainData = computed(() => tableData.value[0] ?? props.data[0] ?? infoParam.value);
+const _mainData = computed(() => {
+  // console.log("_mainData tableData.value[0] :>> ", tableData.value, tableData.value[0]);
+  // console.log("_mainData props.data.value[0] :>> ", props.data, props.data[0]);
+  // console.log("_mainData infoParam.value[0] :>> ", infoParam.value);
+  // console.log(
+  //   "tableData.value[0] ?? props.data[0] ?? infoParam.value :>> ",
+  //   tableData.value[0] ?? (props.data.length && props.data[0]) ?? infoParam.value,
+  //   tableData.value[0] ?? { ...infoParam.value, ...props.data[0] }
+  // );
+  return tableData.value[0] ?? { ...infoParam.value, ...props.data[0] };
+});
 /**
  * @description 详情数据,影子,只读
  */
@@ -593,7 +604,7 @@ const initLayoutColumns = () => {
   // 过滤需要搜索的配置项
   infoColumns.value = flatColumns.value.filter((item: any) => item.field && item.field != "pid");
 
-  console.log("detail init bf  end infoColumns.value :>> ", infoColumns.value);
+  console.log("detail init bf  end infoColumns.value :>> ", infoColumns.value, infoParam.value);
   // console.log("detail init 1end infoColumns.value :>> ", infoColumns.value);
   // 设置搜索表单排序默认值 && 设置搜索表单项的默认值
   infoColumns.value.forEach((column, index) => {
@@ -610,6 +621,8 @@ const initLayoutColumns = () => {
     }
     column.rules = column.basicinfo?.rules ?? undefined;
   });
+  console.log("props.defaultColumnsValue :>> ", props.defaultColumnsValue);
+  infoParam.value = defaultsDeep(cloneDeep(props.defaultColumnsValue), infoParam.value);
   // // 表格搜索栏,设置缓存搜索信息
   // Object.assign(searchParam.value, queryHabit);
   // 第一次搜索带入参数
@@ -1080,6 +1093,16 @@ const handleClickTabs = (data: any) => {
   }
 };
 
+/**
+ * @description 表单校验
+ * @param formEl
+ */
+const toValidateForm = async () => {
+  const { element } = LjDetailBaseFormRef.value;
+  if (!element) return;
+  return await element.validate();
+};
+
 /**
  * @description 当编辑状态不是从route中获取时,需要手动更新
  */
@@ -1139,15 +1162,11 @@ onMounted(async () => {
       console.log("_mainData :>> ", _mainData.value);
       console.log("props.data :>> ", props.data);
       console.log("onMounted detail end!!!! :>> ");
-      nextTick(() => {
-        props.afterMound && props.afterMound();
-      });
+      props.afterMound && props.afterMound();
     });
   } else {
     console.log("onMounted detail end!!!! :>> ");
-    nextTick(() => {
-      props.afterMound && props.afterMound();
-    });
+    props.afterMound && props.afterMound();
   }
 });
 
@@ -1363,7 +1382,7 @@ const RenderHeaderDefault = (rProp: any) => {
               {currentLayout.value && (
                 <el-button class="tag-item" circle onClick={toPinDetailClick} v-slots={pinBtnSlot}></el-button>
               )}
-              {slots.rightBtn && slots.rightBtn?.()}
+              {slots.rightBtn && slots.rightBtn?.({ data: _mainData.value })}
             </div>
           </div>
         </div>
@@ -1593,7 +1612,7 @@ const RenderTabs = (rProps: DetailProp) => {
       }
     });
   } else {
-    return <></>;
+    return;
   }
 
   let tabsSlot: any = {};
@@ -1775,7 +1794,8 @@ defineExpose({
   tabsActive,
   toSaveFoldLayout,
   toSetFloatBtnChange,
-  refresh: layoutRefresh
+  refresh: layoutRefresh,
+  toValidateForm
 });
 </script>
 

+ 8 - 0
JLHWEB/src/components/LjDetail/interface/index.ts

@@ -49,6 +49,10 @@ export type detailAction = {
    * @augments boolean ERP系统选项:是否限制显示
    */
   limited?: boolean | ((params?: any) => boolean);
+  /**
+   * @augments boolean ERP系统选项:是否限制显示
+   */
+  loading?: (params?: any) => boolean;
   /**
    * @argument 点击事件
    */
@@ -348,6 +352,10 @@ export interface DetailProp extends aboutVxetableApiProps {
    * @description 直接打开详情页时,传递枚举类型(字典)
    */
   enum?: Map<string, any>;
+  /**
+   * @description infoParams默认值
+   */
+  defaultColumnsValue?: any;
 }
 
 // /**

+ 1 - 1
JLHWEB/src/components/LjFoldLayout/index.vue

@@ -131,7 +131,7 @@ interface LjFoldLayoutProps {
   /**
    * @description 方向:水平,垂直
    */
-  direction?: "horizontal" | "vertical";
+  direction?: "horizontal" | "vertical" | string;
   /**
    * @description 主体内容class类名
    */

+ 5 - 5
JLHWEB/src/hooks/useAuthButtons.ts

@@ -66,8 +66,8 @@ export const useAuthButtons = (t?: any) => {
       label: data.label ?? t("common.add"),
       icon: data.icon ?? Plus,
       // type: data.type ?? "success",
-      type: undefined,
-      plain: true,
+      // type: undefined,
+      // plain: true,
       disabledTextCallBack: (item: any) => {
         return data.disabledTextCallBack ? data.disabledTextCallBack(item) : "";
       },
@@ -90,10 +90,10 @@ export const useAuthButtons = (t?: any) => {
   const buttonDefault = (data: BusinessButtonProps): detailAction => {
     return {
       ...data,
-      icon: data.icon ?? undefined,
+      icon: data.icon ?? undefined
       // type: data.type ?? "",
-      type: undefined,
-      plain: true
+      // type: undefined
+      // plain: true
     };
   };
 

+ 8 - 8
JLHWEB/src/hooks/useDwLayout.tsx

@@ -250,13 +250,13 @@ export const useDwLayout = (
         /**当个性布局为空时,读取默认 */
         let _define = getDefineAttr(col, layoutAttrDefine);
         let _limited = isFunction(_define?.limited) ? _define.limited() : _define?.limited ?? false;
-        console.log(
-          "当个性布局为空时,读取默认 isFunction(userStyle?.limited) :>>",
-          col.field,
-          _define,
-          isFunction(_define?.limited),
-          _limited
-        );
+        // console.log(
+        //   "当个性布局为空时,读取默认 isFunction(userStyle?.limited) :>>",
+        //   col.field,
+        //   _define,
+        //   isFunction(_define?.limited),
+        //   _limited
+        // );
 
         if (!_limited) {
           // 给每一项 column 添加默认属性
@@ -289,7 +289,7 @@ export const useDwLayout = (
 
     /**补充前端没有,但后台有返回的数据列 */
     dwMap.forEach((item, key) => {
-      console.log("补充前端没有,但后台有返回的数据列 item :>> ", item);
+      // console.log("补充前端没有,但后台有返回的数据列 item :>> ", item);
       if (item.limited) return;
       let index = flatArr.findIndex(item => item.field === key);
       if (index == -1) {

+ 5 - 1
JLHWEB/src/languages/modules/zh-cn/business.json

@@ -280,6 +280,9 @@
     },
     "mtrlprice": {
       "title": "物料选择"
+    },
+    "spring": {
+      "title": "弹簧选择"
     }
   },
   "sptPriceChange": {
@@ -441,6 +444,7 @@
     "innerClothLayer": "内布层",
     "topCotton": "顶布裥棉",
     "addChastr": "新增位置",
-    "delChastr": "删除位置"
+    "delChastr": "删除位置",
+    "bednetMxTitle": "床网多网明细|多区袋装明细"
   }
 }

+ 1 - 0
JLHWEB/src/languages/modules/zh-cn/common.json

@@ -192,6 +192,7 @@
   "businessOrderCancel": "取消业务下单",
   "viewHistoricalQuotes": "查看历史报价",
   "showFormula": "显示计算公式",
+  "showQuoteDetail": "查看详细报价",
   "enabled": "开启",
   "addSameLevel": "增同级",
   "addSubLevel": "增下级",

+ 3 - 0
JLHWEB/src/languages/modules/zh-cn/menu.json

@@ -152,6 +152,9 @@
   "mattressQuoteEdit": "修改床垫报价",
   "mattressQuoteAdd": "新建床垫报价",
   "bednetQuote": "床网报价",
+  "bednetQuoteDetail": "床网报价详情",
+  "bednetQuoteEdit": "修改床网报价",
+  "bednetQuoteAdd": "新建床网报价",
   "user": "用户权限",
   "bednetvar": "变量定义",
   "semifinprodQuote": "半成品报价",

+ 6 - 0
JLHWEB/src/languages/modules/zh-cn/table.json

@@ -1554,5 +1554,11 @@
     "priceunit": "单位",
     "pricelistprice": "单价",
     "dscrp": "备注"
+  },
+  "u_bednet_define": {
+    "deptname": "部门",
+    "keyword": "编码/名称",
+    "bednetcode": "床网编码",
+    "bednetname": "床网名称"
   }
 }

+ 33 - 0
JLHWEB/src/routers/modules/bednetQtuoteRouter.ts

@@ -62,6 +62,39 @@ export const bednetQtuoteRouter: Menu.MenuOptions[] = [
           isFull: false,
           isAffix: false,
           isKeepAlive: true,
+          funid: 61,
+          activeMenu: "/bednetQuote"
+        }
+      },
+      {
+        path: "/bednetQuote/new",
+        name: "bednetQuoteAdd",
+        component: "/quote/bednetQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "新增床网报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 62,
+          activeMenu: "/bednetQuote"
+        }
+      },
+      {
+        path: "/bednetQuote/edit",
+        name: "bednetQuoteEdit",
+        component: "/quote/bednetQuote/detail",
+        meta: {
+          icon: "iconuser-01",
+          title: "修改床网报价",
+          isLink: "",
+          isHide: true,
+          isFull: false,
+          isAffix: false,
+          isKeepAlive: true,
+          funid: 62,
           activeMenu: "/bednetQuote"
         }
       }

+ 2 - 2
JLHWEB/src/routers/modules/mattressQtuoteRouter.ts

@@ -72,7 +72,7 @@ export const mattressQtuoteRouter: Menu.MenuOptions[] = [
         component: "/quote/mattressQuote/detail",
         meta: {
           icon: "iconuser-01",
-          title: "新增客户档案",
+          title: "新增床垫报价",
           isLink: "",
           isHide: true,
           isFull: false,
@@ -88,7 +88,7 @@ export const mattressQtuoteRouter: Menu.MenuOptions[] = [
         component: "/quote/mattressQuote/detail",
         meta: {
           icon: "iconuser-01",
-          title: "修改客户档案",
+          title: "修改床垫报价",
           isLink: "",
           isHide: true,
           isFull: false,

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

@@ -451,7 +451,7 @@ function formatCutNumber3({ val }: any, digits = 3) {
   return XEUtils.toFixed(XEUtils.floor(val, digits), digits);
 }
 // 四舍五入,默认两位数
-function formatFixedNumber({ val }: any, digits = 2) {
+export function formatFixedNumber({ val }: any, digits = 2) {
   if (isNaN(Number(val))) return val;
   return XEUtils.toFixed(XEUtils.round(val, digits), digits);
 }
@@ -1115,7 +1115,7 @@ const funcGetFormulaValue = (item, tgList, fieldList, valueList) => {
     .replace(/【/g, "[")
     .replace(/】/g, "]")
     .match(/\[([^\]]*)\]/g);
-  let resultFormula = item?.formula;
+  let resultFormula = item?.formula.replace(/【/g, "[").replace(/】/g, "]");
 
   _paras.forEach(part => {
     // console.log(part);
@@ -1157,13 +1157,13 @@ const funcGetFormulaValue = (item, tgList, fieldList, valueList) => {
       }
       resultFormula = resultFormula.replace(part, res);
     } else {
-      resultFormula = resultFormula.replace(part, `${valueList[fieldName]}`);
+      valueList[fieldName] && (resultFormula = resultFormula.replace(part, `${valueList[fieldName]}`));
     }
   });
   return resultFormula;
 };
 
-const formulaPartsFormula = (formulaList, fieldList, valueList, tgList = formulaList) => {
+export const formulaPartsFormula = (formulaList, fieldList, valueList, tgList = formulaList) => {
   let result = [];
   formulaList.map((item, index) => {
     if (item?.formula) {

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

@@ -63,11 +63,6 @@ const detailProps = reactive<DetailProp>({
   // addPower: 5,
   // editPower: 4359,
   header: {
-    fieldNames: {
-      code: "deptname",
-      codeLabel: t("table.u_cust.cuscode") + ":",
-      name: "name"
-    },
     icon: "iconuser-01",
     tabsProp: {
       scrollspy: false,

+ 1 - 3
JLHWEB/src/views/baseinfo/bednetarea/index.vue

@@ -144,9 +144,7 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
 };
 
 const handleOpenNewTable = () => {
-  mainData.value = {
-    multipriceid: 0
-  };
+  mainData.value = {};
   orderStatus.value = "new";
   LjDrawerRef.value.show();
 };

+ 685 - 0
JLHWEB/src/views/quote/bednetQuote/detail.vue

@@ -0,0 +1,685 @@
+<template>
+  <LjDetail
+    name="rpMustPayCrmDetail"
+    ref="LjDetailRef"
+    v-bind="detailProps"
+    :request-api="getData"
+    :data-callback="dataCallback"
+    :init-param="initParams"
+    v-model:order-status="orderStatus"
+    :action="orderDefaultAction"
+    :after-mound="funcAfterMound"
+    :if-layout-editable="false"
+    :default-columns-value="defaultColumnsValue"
+  >
+    <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"
+          style="min-width: 542px"
+          v-if="bednetMxData.length && Number(LjDetailRef._mainData.bednettypeid) == 11 && Number(bednetMxData[0].if_part)"
+        >
+          <!-- v-if="bednetMxSprintData.length" -->
+          <LjVxeTable
+            ref="vxeTableMxSpringRef"
+            row-key="bednetmx_partid"
+            table-cls=""
+            :columns="columnsMxSpring"
+            :data="bednetMxSprintData"
+            :data-callback="dataCallback"
+            :dwname="DwnameEnum.bednetQuoteMxSpring"
+            :table-props="tableProps_mx"
+            :auto-load-layout="false"
+            :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">
+                  <span class="text-secondary-text">划分</span>
+                  <el-select v-model="currentArea" class="pl-4 pr-4" style="width: 80px" @change="handleAreaChange">
+                    <el-option
+                      v-for="item in AreaList"
+                      :key="item.areaname"
+                      :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>
+                  <span class="text-secondary-text">区</span>
+                </div>
+              </div>
+            </template>
+          </LjVxeTable>
+        </div>
+      </div>
+    </template>
+  </LjDetail>
+
+  <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
+  <SpringDialog ref="SpringDialogRef" v-bind="SpringDialogProps" />
+</template>
+
+<script setup lang="ts" name="bednetQuoteDetail">
+import { ref, watch, reactive, inject, nextTick, computed, onMounted, getCurrentInstance } from "vue";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import LjDetail from "@/components/LjDetail/index.vue";
+import { DetailProp, detailAction } from "@/components/LjDetail/interface";
+import { useI18n } from "vue-i18n";
+import { useHooks } from "./hooks/index";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import LjVxeTable from "@/components/LjVxeTable/index.vue";
+// import { cloneDeep } from "lodash-es";
+import { useRoute, useRouter } from "vue-router";
+import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
+// import { SaveMattress, SaveMattressAuditing, DelMattress } from "@/api/modules/quote";
+// import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
+import { TYPE, useToast, POSITION } from "vue-toastification";
+import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
+// import { ArrowDown } from "@element-plus/icons-vue";
+// import { calculateFormula } from "@/utils/index";
+import MtrldefDialog from "@/views/system/selector/mtrldef/index.vue";
+import SpringDialog from "@/views/system/selector/spring/index.vue";
+// 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";
+import { getBedNetAreaList } from "@/api/modules/basicinfo";
+
+const { t } = useI18n();
+const route = useRoute();
+const router = useRouter();
+const { userInfo } = useUserStore();
+const {
+  LjDetailRef,
+  columns,
+  columnsMx,
+  columnsMxSpring,
+  initParams,
+  initParamsMx,
+  initParamsMxSpring,
+  orderStatus,
+  bednetMxData,
+  bednetMxSprintData,
+  vxeTableMxRef,
+  vxeTableMxSpringRef,
+  MtrldefDialogRef,
+  MtrldefDialogProps,
+  SpringDialogRef,
+  SpringDialogProps,
+  currentArea,
+  AreaList,
+  dw_bednet_mx_spring,
+  getData,
+  getDataMxAdd,
+  getDataMxSpring,
+  dataCallback,
+  dataCallbackMx
+} = useHooks();
+
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+// const toast = useToast();
+
+// const orderStatus = ref("");
+// const mainData = ref([]);
+const tabRemove: Function = inject("tabRemove") as Function;
+
+const defaultColumnsValue = ref<any>({});
+
+/**
+ * @description 明细表格组件基础配置
+ */
+const tableProps_mx = ref({
+  height: "auto",
+  align: "left",
+  // height: "",
+  minHeight: "300px",
+  editConfig: { trigger: "click", mode: "row", enabled: false },
+  keyboardConfig: {
+    isEdit: true,
+    isArrow: true,
+    isEnter: true,
+    isTab: true,
+    isDel: true,
+    isBack: true,
+    isEsc: true,
+    editMethod({ $table, row, column }) {
+      // 先清空原先的值
+      row[column.field] = "";
+      // 再激活编辑状态并输入新值
+      $table.setEditCell(row, column);
+    }
+  },
+  rowConfig: { isCurrent: false },
+  mouseConfig: {
+    selected: true
+  }
+});
+
+const detailProps = reactive<DetailProp>({
+  dwname: DwnameEnum.bednetQuote,
+  columns: columns,
+  // headerstatus: ["status", "ifamt_ok"],
+  basicDefault: {},
+  header: {
+    fieldNames: {
+      code: "sptcode",
+      codeLabel: t("table.u_spt.sptcode") + ":",
+      name: "name"
+    }
+    // icon: "iconclipboard",
+    // tabsProp: {
+    //   scrollspy: true,
+    //   sticky: true
+    // }
+    // floatbtn: [
+    //   {
+    //     id: "oaFlow",
+    //     originLeft: 100,
+    //     originTop: 50
+    //   }
+    // ]
+  },
+  mould: [
+    {
+      id: "bednetMx",
+      type: "table",
+      label: t("business.detail.bednetMxTitle")
+    }
+  ]
+});
+
+const orderDefaultAction: detailAction[] = [
+  buttonDefault({
+    label: t("common.cancelText"),
+    icon: "iconchevron-left",
+    limited: () => {
+      return !orderStatus.value;
+    },
+    clickFunc: item => {
+      if (route.path.indexOf("/new") > -1) {
+        tabRemove(route.fullPath);
+        router.replace("/bednetQuote");
+      } else {
+        router.replace(
+          `/bednetQuote/detail?id=${LjDetailRef.value._mainData.bednetid}&code=${LjDetailRef.value._mainData.bednetcode}`
+        );
+      }
+    }
+  }),
+  buttonNew({
+    label: t("common.saveText"),
+    icon: "iconsave-01",
+    // loading: () => loadingStatus.save,
+    limited: () => !orderStatus.value,
+    clickFunc: async () => {
+      console.log("save LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
+
+      // console.log("save------------ :>> ", loadingStatus.save);
+      // console.log("save cushionsMxData :>> ", cushionsMxData.value);
+
+      // try {
+      //   await LjDetailRef.value.toValidateForm();
+
+      //   wf_cmp_cb();
+      //   loadingStatus.save = true;
+
+      //   let mattress = LjDetailRef.value._mainData;
+      //   console.log("save cushionsMxData :>> ", LjDetailRef.value._mainData, mattress?.if_d_chai, Number(mattress.if_d_chai));
+      //   mattress.mattressid = Number(mattress.mattressid ?? 0);
+      //   mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+      //   mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
+      //   mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
+      //   mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
+      //   mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
+      //   mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+      //   mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+      //   mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
+      //   mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
+      //   mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
+      //   mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
+      //   mattress.packqty = Number(mattress.packqty ?? 0);
+      //   mattress.woodpallettype = mattress?.woodpallettype ?? "0";
+      //   mattress.total_hr_cost = mattress?.total_hr_cost ?? "0";
+      //   mattress.total_material_cost = mattress?.total_material_cost ?? "0";
+      //   mattress.total_hr_cost = mattress?.total_hr_cost ?? 0;
+      //   mattress.total_material_cost = mattress?.total_material_cost ?? 0;
+      //   mattress.total_fees_cost = mattress?.total_fees_cost ?? 0;
+      //   mattress.total_cost = mattress?.total_cost ?? 0;
+      //   mattress.commissionrate = mattress?.commissionrate ?? 0;
+      //   mattress.fob = mattress?.fob ?? 0;
+      //   mattress.profitrate = mattress?.profitrate ?? 0;
+      //   mattress.nottax_factory_cost = mattress?.nottax_factory_cost ?? 0;
+      //   mattress.nottax_dept_cost = mattress?.nottax_dept_cost ?? 0;
+      //   mattress.foreign_cost = mattress?.foreign_cost ?? 0;
+      //   mattress.diameter = mattress?.diameter ?? 0;
+      //   mattress.area = mattress?.area ?? 0;
+      //   mattress.cabinet_type = mattress?.cabinet_type ?? 0;
+      //   mattress.hrcost = mattress?.hrcost ?? 0;
+      //   mattress.biandaicost = mattress?.biandaicost ?? 0;
+      //   mattress.flag = mattress?.flag ?? 0;
+      //   mattress.dept_profitrate_rangli = mattress?.dept_profitrate_rangli ?? 0;
+      //   mattress.profitrate_point = mattress?.profitrate_point ?? 0;
+      //   mattress.chaizhuang_point = mattress?.chaizhuang_point ?? 0;
+      //   mattress.haimian_point = mattress?.haimian_point ?? 0;
+      //   mattress.qr_auditingdate = mattress?.qr_auditingdate ?? 0;
+      //   mattress.zhizao_amt = mattress?.zhizao_amt ?? 0;
+      //   mattress.foreign_cost_bz = mattress?.foreign_cost_bz ?? 0;
+      //   mattress.cubage = mattress?.cubage ?? 0;
+
+      //   let mattressMx = [];
+      //   fabricMxTabList.value.map(t => {
+      //     if (t.ref) {
+      //       console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
+      //       if (dynamicRef(t.ref)) {
+      //         let { fullData } = dynamicRef(t.ref)?.element.getTableData();
+      //         console.log("fullData :>> ", fullData);
+      //         fullData = fullData.map((itm, idx) => {
+      //           itm.xu = idx + 1;
+      //           return itm;
+      //         });
+      //         mattressMx = mattressMx.concat(fullData);
+      //       }
+      //     }
+      //   });
+
+      //   mattressMx = mattressMx.map(t => {
+      //     t.formulaid = t.formulaid ?? 0;
+      //     t.formula = t.formula ?? "";
+      //     t.if_success = t.if_success ?? 0;
+      //     t.replace_formula = t.replace_formula ?? "";
+      //     t.priceunit = t.priceunit ?? "";
+      //     t.shrinkage = t.shrinkage ?? 0;
+      //     t.mtrlid = t.mtrlid ?? 0;
+      //     t.price = t.price ?? 0;
+      //     t.gram_weight = t.gram_weight ?? 0;
+      //     t.cloth_width = t.cloth_width ?? 0;
+      //     t.if_inputqty = t.if_inputqty ?? 0;
+      //     t.qty = t.qty ?? 0;
+      //     t.costamt = t.costamt ?? 0;
+      //     t.if_areaprice = t.if_areaprice ?? 0;
+      //     t.thickness = t.thickness ?? 0;
+      //     t.chastr = t.chastr ?? "";
+      //     t.useqty = t.useqty ?? 0;
+      //     t.useformula = t.useformula ?? "";
+      //     t.replace_useformula = t.replace_useformula ?? "";
+      //     t.gydscrp = t.gydscrp ?? "";
+      //     t.xu = t.xu ?? 0;
+      //     return t;
+      //   });
+
+      //   let _param_mf = {
+      //     mattress,
+      //     mattressMx
+      //   };
+      //   try {
+      //     console.log("综合 _param_mf :>> ", _param_mf);
+      //     // await SaveMattress(_param_mf)
+      //     //   .then(res => {
+      //     //     ElNotification({
+      //     //       title: "温馨提示",
+      //     //       message: t("sys.api.sueccessToSave"),
+      //     //       type: "success"
+      //     //     });
+      //     //     if (res.mattressid) {
+      //     //       router.replace(`/mattressQuote/detail?id=${res.mattressid}`);
+      //     //     } else {
+      //     //       router.replace("/mattressQuote");
+      //     //     }
+      //     //     loadingStatus.save = false;
+      //     //   })
+      //     //   .catch(error => {
+      //     //     console.log("error !! :>> ", error);
+      //     //     loadingStatus.save = false;
+      //     //   });
+      //   } catch (error) {
+      //     ElMessage.error(t("sys.api.operationFailed"));
+      //   }
+      // } catch (e) {
+      //   loadingStatus.save = false;
+      //   console.log("buttonNew eee :>> ", e, loadingStatus.save);
+      // }
+    }
+  }),
+  buttonDefault({
+    label: t("common.add"),
+    power: 62,
+    limited: () => {
+      return !!orderStatus.value;
+    },
+    clickFunc: item => {
+      router.push(`/bednetQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    power: 72,
+    label: t("common.editText"),
+    limited: () => {
+      return !!orderStatus.value;
+    },
+    clickFunc: item => {
+      router.replace(`/bednetQuote/edit?id=${LjDetailRef.value._mainData.bednetid}`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.delText"),
+    power: 76,
+    disabledTextCallBack: (data: any) => {
+      if (!CheckPower(76)) {
+        return "你没有【报价单-删除】的使用权限";
+      }
+
+      return "";
+    },
+    clickFunc: item => {
+      // const { curRecords } = getCurrentRecords(vxeTableRef.value);
+      // console.log("curRecords :>> ", curRecords);
+      // if (!curRecords.length) {
+      //   ElMessage.warning(t("business.tips.mattress.records"));
+      //   return;
+      // }
+      // let _mattressids = curRecords.map((item: any) => Number(item.mattressid));
+      // ElMessageBox.confirm(`是否确定要删除${curRecords.length}张床垫报价单吗?`, "询问", {
+      //   confirmButtonText: t("common.delText"),
+      //   cancelButtonText: "否",
+      //   type: "warning"
+      // })
+      //   .then(() => {
+      //     DelMattress({ mattressids: _mattressids }).then(() => {
+      //       ElMessage.success("删除成功!");
+      //       vxeTableRef.value.refresh();
+      //     });
+      //   })
+      //   .catch((e: TypeError) => {
+      //     console.log("e :>> ", e);
+      //     ElMessage({
+      //       type: "info",
+      //       message: "操作取消"
+      //     });
+      //   });
+    }
+  }),
+  [
+    buttonDefault({
+      label: t("common.auditFinance"),
+      power: 63,
+      limited: () => {
+        return !!orderStatus.value;
+      },
+      disabledTextCallBack: (data: any) => {
+        if (!CheckPower(63)) {
+          return `你没有【报价单-${t("common.auditFinance")}】的使用权限`;
+        }
+        return "";
+      },
+      clickFunc: item => {
+        // ElMessageBox.confirm(`是否确定要${t("common.auditFinance")}吗?`, "询问", {
+        //   confirmButtonText: "是",
+        //   cancelButtonText: "否",
+        //   type: "warning"
+        // })
+        //   .then(() => {
+        //     let _params = {
+        //       mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
+        //       flag: 1
+        //     };
+        //     SaveMattressAuditing(_params).then(() => {
+        //       ElMessage.success(t("sys.api.operationSuccess"));
+        //       LjDetailRef.value.refresh();
+        //     });
+        //   })
+        //   .catch((e: TypeError) => {
+        //     ElMessage({
+        //       type: "info",
+        //       message: "操作取消"
+        //     });
+        //   });
+      }
+    }),
+    buttonDefault({
+      label: t("common.withdrawAuditFinance"),
+      power: 64,
+      limited: () => {
+        return !!orderStatus.value;
+      },
+      disabledTextCallBack: (data: any) => {
+        if (!CheckPower(64)) {
+          return `你没有【报价单-${t("common.withdrawAuditFinance")}】的使用权限`;
+        }
+        return "";
+      },
+      clickFunc: item => {
+        // ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditFinance")}吗?`, "询问", {
+        //   confirmButtonText: "是",
+        //   cancelButtonText: "否",
+        //   type: "warning"
+        // })
+        //   .then(() => {
+        //     let _params = {
+        //       mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
+        //       flag: 0
+        //     };
+        //     SaveMattressAuditing(_params).then(() => {
+        //       ElMessage.success(t("sys.api.operationSuccess"));
+        //       LjDetailRef.value.refresh();
+        //     });
+        //   })
+        //   .catch((e: TypeError) => {
+        //     ElMessage({
+        //       type: "info",
+        //       message: "操作取消"
+        //     });
+        //   });
+      }
+    })
+  ],
+  buttonDefault({
+    label: t("common.showQuoteDetail"),
+    limited: () => {
+      // 业务员模式
+      return userInfo.usermode == 1;
+    }
+  }),
+  buttonDefault({
+    label: t("common.copyQuote")
+  }),
+  // buttonDefault({
+  //   label: t("common.showFormula")
+  //   // clickFunc: item => gotoSummy()
+  // }),
+  buttonDefault({
+    label: t("common.viewHistoricalQuotes"),
+    clickFunc: () => {
+      console.log("LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
+      // gotoHisprice(0, { id: LjDetailRef.value._mainData.mattressid, typeid: 1 });
+    }
+  })
+];
+
+onMounted(async () => {
+  initParams.value.arg_bednetid = Number(route.query?.id ?? 0);
+  initParamsMx.value.arg_bednetid = Number(route.query?.id ?? 0);
+  if (!Number(route.query?.id)) {
+    if (route.query?.deptid) {
+      defaultColumnsValue.value.deptid = route.query?.deptid;
+    }
+  }
+  defaultColumnsValue.value.sponge_mtrlid = 0;
+  console.log(
+    "donMounted efaultColumnsValue.value :>> ",
+    defaultColumnsValue.value,
+    Object.keys(route.query).includes("id"),
+    route.query?.id
+  );
+});
+
+/**
+ * @description 页面数据加载完成
+ */
+const funcAfterMound = async () => {
+  console.log("onMounted detail sale start!!!! :>> ", !orderStatus.value);
+  // console.log("LjDetailRef.value.currentMould :>> ", LjDetailRef.value.currentMould);
+  // console.log(
+  //   "Boolean(Number(CheckOption(sysOptionEnum.sys_option_043))) :>> ",
+  //   Boolean(Number(CheckOption(sysOptionEnum.sys_option_043)))
+  // );
+  // // 流转状况
+  // if (Boolean(Number(CheckOption(sysOptionEnum.sys_option_043))) && LjDetailRef.value.currentMould.header.floatbtn) {
+  // let _oaflowbtn = LjDetailRef.value.currentMould.header.floatbtn.find((itm: any) => itm.id == "oaFlow");
+  // if (_oaflowbtn) {
+  //   _oaflowbtn.originLeft && (oaFlowFloadProp.value.originLeft = _oaflowbtn.originLeft);
+  //   _oaflowbtn.originTop && (oaFlowFloadProp.value.originTop = _oaflowbtn.originTop);
+  // }
+  // oaFlowFloadProp.value.change = LjDetailRef.value.toSetFloatBtnChange;
+
+  //   if (!ALLOW_EDIT_STATE.includes(orderStatus.value)) {
+  //     // 非新增、修改时执行
+  //     getOaFlowList(initParams.value.scid, initParams.value.taskid).then(() => {
+  //       if (oaFlowList.value.length) {
+  //         gotoSummy();
+  //       }
+  //     });
+  //   }
+  // }
+
+  // if (ALLOW_EDIT_STATE.includes(orderStatus.value)) {
+  //   saleTaskMx_tableProps.value.editConfig.enabled = true;
+  // }
+  // if (orderStatus.value == "new") {
+  //   nextTick(async () => {
+  //     console.log("SaletaskmxListRef.value onmound new:>> ", SaletaskmxListRef.value);
+  //     if (SaletaskmxListRef.value) {
+  //       const $table = SaletaskmxListRef.value.element;
+  //       if ($table) {
+  //         const record = {};
+  //         const { row: newRow } = await $table.insertAt(record, null);
+  //         await $table.setEditCell(newRow, "mtrlcode");
+  //         console.log("onMounted saletask finish :>> ", $table);
+  //       }
+  //     }
+  //   });
+  // }
+  if (!orderStatus.value) {
+    // 详情页
+    // gotoSummy(8000);
+  } else {
+    // 新增/编辑
+    tableProps_mx.value.editConfig.enabled = true;
+
+    let res = await getBedNetAreaList({});
+
+    if (res.datatable.length) {
+      AreaList.value = res.datatable;
+    }
+  }
+  // ifAfterMound.value = true;
+
+  console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", tableProps_mx.value, LjDetailRef.value);
+
+  if (orderStatus.value != "new") {
+    // const { enumMap, _mainData } = LjDetailRef.value;
+    // console.log("enumMap :>> ", enumMap, _mainData);
+    // let _enum = enumMap.get("mattresstypeid");
+    // console.log("_enum :>> ", _enum);
+    // if (_enum) {
+    //   mattresstypeEnum.value = _enum.find(t => t.value == _mainData.mattresstypeid);
+    //   console.log("mattresstypeEnum :>> ", mattresstypeEnum);
+    // }
+
+    // let itmshow = fabricMxTabList.value.find(t => t.visible());
+    // fabricMxTabs.value = itmshow.name;
+
+    // let res = await getData_mx(initParams.value);
+    // oriMxData.value = dataCallback(res);
+    // oriMxData.value.list = oriMxData.value.list.map(t => {
+    //   t.formulakind = Number(t.formulakind);
+    //   t.thickness = Number(t.thickness);
+    //   return t;
+    // });
+
+    // getMattressType();
+
+    let res = await getDataMxAdd(initParamsMx.value);
+    let result = dataCallbackMx(res);
+    columnsMx.value = result.tableinfo.columns;
+    bednetMxData.value = result.list;
+
+    res = await getDataMxSpring(initParamsMx.value);
+    result = dataCallbackMx(res);
+    columnsMxSpring.value = result.tableinfo.columns;
+    bednetMxSprintData.value = result.list;
+    // bednetMxData.value = bednetMxData.value.map(t => {
+    //   // t.formulakind = Number(t.formulakind);
+    //   // t.thickness = Number(t.thickness);
+    //   // t.qty = Number(t.qty);
+    //   return t;
+    // });
+
+    console.log("bednetMxData after:>> ", bednetMxData.value, vxeTableMxRef.value.tableColumns);
+    // nextTick(() => {
+    //   vxeTableMxRef.value.refresh();
+    // });
+
+    // res = await getDataMxSpring(initParams.value);
+
+    // funcChaifenTab();
+    // funcGetFabricMxShowData(itmshow.name);
+    // console.log("funcAfterMound resData :>> ", fabricMxData.value);
+  }
+};
+
+const handleAreaChange = async (val: any) => {
+  console.log("handleAreaChange val :>> ", val);
+  let item = AreaList.value.find(t => t.areaname == val);
+
+  if (item) {
+    let num = 0;
+    for (const key in item) {
+      if (key.indexOf("area_") && Number(item[key]) > 0) {
+        num++;
+      }
+    }
+    console.log("num :>> ", num);
+    LjDetailRef.value._mainData.duo_qv_str = num;
+
+    const $table = vxeTableMxSpringRef.value.element;
+
+    const { fullData } = $table.getTableData();
+    console.log("handleAreaChange fullData :>> ", fullData);
+
+    if (num > 0 && fullData.length < num) {
+      for (let i = 0; i < num - fullData.length; i++) {
+        let _data = {
+          ...dw_bednet_mx_spring
+          // bednetmx_partid: LjDetailRef.value._mainData.bednetmxid,
+          // bednetmxid:
+        };
+        await $table.insertAt(_data, -1);
+      }
+    }
+  }
+};
+</script>

File diff suppressed because it is too large
+ 1841 - 0
JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx


+ 434 - 1
JLHWEB/src/views/quote/bednetQuote/index.vue

@@ -1 +1,434 @@
-<template>123</template>
+<template>
+  <LjFoldLayout ref="LjFoldLayoutRef" v-bind="layoutSetting">
+    <div class="main-box flx-col">
+      <LjVxeTable
+        ref="vxeTableRef"
+        row-key="bednetid"
+        :columns="columns"
+        :init-param="initParams"
+        :request-api="getData"
+        :data-callback="dataCallback"
+        :dwname="DwnameEnum.bednetQuote"
+        :table-props="tableProps"
+        :table-events="tableEvents"
+        :auto-load-layout="false"
+        :search-btn-size-extent="[]"
+        pagination
+        @on-mounted-data="autoMonthedData"
+      >
+        <!-- 表格 header 按钮 -->
+        <template #tableHeader>
+          <LjHeaderMenu :update="dialogVisible" :action="action" />
+          <!-- <el-button-group>
+              <el-button @click="toAdd">{{ $t("common.add") }}</el-button>
+              <el-button @click="toDel">{{ $t("common.delText") }}</el-button>
+              <el-button @click="toA">{{ $t("common.auditFinance") }}</el-button>
+              <el-button @click="toAdd">{{ $t("common.copyQuote") }}</el-button>
+              <el-button @click="toAdd">{{ $t("common.businessOrder") }}</el-button>
+              <el-button @click="toAdd">{{ $t("common.viewHistoricalQuotes") }}</el-button>
+            </el-button-group> -->
+        </template>
+      </LjVxeTable>
+    </div>
+    <template #right>
+      <div class="main-box flx card">
+        <LjVxeTable
+          ref="vxeTableMxRef"
+          row-key="bednetmxid"
+          table-cls="overflow-hidden pr-16"
+          :columns="columnsMx"
+          :init-param="initParamsMx"
+          :request-api="getDataMx"
+          :data-callback="dataCallbackMx"
+          :dwname="DwnameEnum.bednetQuoteMx"
+          :table-props="tableProps"
+          :table-events="tableEventsMx"
+          :auto-load-layout="false"
+          :search-btn-size-extent="[]"
+          collapseButtons
+          :request-auto="false"
+        >
+          <template #tableHeader>
+            <LjHeader class="flx-1" title="床网多网明细" />
+          </template>
+        </LjVxeTable>
+        <div class="flx flx-shrink h-full" style="min-width: 542px">
+          <LjVxeTable
+            ref="vxeTableMxSpringRef"
+            row-key="bednetmx_partid"
+            table-cls=""
+            :columns="columnsMxSpring"
+            :init-param="initParamsMxSpring"
+            :request-api="getDataMxSpring"
+            :data-callback="dataCallback"
+            :dwname="DwnameEnum.bednetQuoteMxSpring"
+            :table-props="tableProps"
+            :auto-load-layout="false"
+            :search-btn-size-extent="[]"
+            collapseButtons
+            :request-auto="false"
+          >
+            <template #tableHeader>
+              <LjHeader class="flx-1" title="多区袋装明细" />
+            </template>
+          </LjVxeTable>
+        </div>
+      </div>
+    </template>
+  </LjFoldLayout>
+</template>
+
+<script setup lang="ts" name="mattressQuote">
+import { ref, onMounted, inject } from "vue";
+import { useRouter } from "vue-router";
+import { SaveMattressAuditing, DelMattress } from "@/api/modules/quote";
+import { CommonDynamicSelect } from "@/api/modules/common";
+import { ColumnProps } from "@/components/LjVxeTable/interface";
+import LjDrawer from "@/components/LjDrawer/index.vue";
+// import PriceListDetail from "./detail.vue";
+import { useHooks } from "./hooks/index";
+import LjDialog from "@/components/LjDialog/index.vue";
+import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useI18n } from "vue-i18n";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import { formatToDateTime, formatToDate } from "@/utils/dateUtil";
+import { cloneDeep } from "lodash-es";
+import { useGlobalStore } from "@/stores/modules/global";
+import { ElMessage, ElMessageBox } from "element-plus";
+import { detailAction } from "@/components/LjDetail/interface";
+import mittBus from "@/utils/mittBus";
+import { MittEnum } from "@/enums/mittEnum";
+import { getCurrentRecords } from "@/utils/index";
+import LjFoldLayout from "@/components/LjFoldLayout/index.vue";
+
+const { t } = useI18n();
+const router = useRouter();
+const globalStore = useGlobalStore();
+const {
+  columns,
+  columnsMx,
+  columnsMxSpring,
+  initParams,
+  initParamsMx,
+  initParamsMxSpring,
+  getData,
+  getDataMx,
+  getDataMxSpring,
+  dataCallback,
+  dataCallbackMx
+} = useHooks();
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const dialogVisible = ref(false);
+const vxeTableRef = ref();
+const vxeTableMxRef = ref();
+const vxeTableMxSpringRef = ref();
+
+const LjFoldLayoutRef = ref();
+
+const layoutSetting = {
+  dwname: DwnameEnum.bednetQuote,
+  direction: "vertical",
+  right: {
+    // hidden: true
+  }
+};
+
+const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  if (globalStore.detailBlank) {
+    // 打开新的窗口
+    const routeUrl = router.resolve({
+      path: `/bednetQuote/detail`,
+      query: {
+        id: row.bednetid,
+        code: row.bednetcode
+      }
+    });
+    window.open(routeUrl.href, "_blank");
+  } else {
+    // if (currentLayout.value.right.hidden && globalStore.mxFloat?.includes("custCrmDetail")) {
+    //   // 弹窗
+    //   mainData.value = row;
+    //   LjDrawerRef.value.show();
+    // } else {
+    // 打开新的标签页
+    router.push(`/bednetQuote/detail?id=${row.bednetid}&code=${row.bednetcode}`);
+    // }
+  }
+};
+
+const handleClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  initParamsMx.value.arg_bednetid = row.bednetid;
+};
+
+const rowClsNameFunc = (data: any) => {
+  const { row, rowIndex, $rowIndex } = data;
+  if (row.flag == "0") {
+    return "vxecol-danger";
+  }
+  return "";
+};
+
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" },
+  rowClassName: rowClsNameFunc
+  // exportConfig: {
+  //   filename: t("menu.saletaskmx") + formatToDate(new Date(), "YYYY-MM-DD HH:mm:ss")
+  // }
+};
+
+const autoMonthedData = (data: any) => {
+  const $table = vxeTableRef.value.element;
+  console.log("autoMonthedData 123:>> ", $table);
+
+  if ($table) {
+    let { fullData } = $table.getTableData();
+    console.log("object :>> ", $table.getTableData());
+
+    if (fullData.length > 0) {
+      $table.setCurrentRow(fullData[0]);
+      initParamsMx.value.arg_bednetid = fullData[0].bednetid;
+    }
+  }
+};
+
+const handleClickTableMx = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  initParamsMxSpring.value.arg_bednetmxid = row.bednetmxid;
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable,
+  "cell-click": handleClickTable
+};
+
+// 返回绑定的事件
+const tableEventsMx = {
+  "cell-click": handleClickTableMx
+};
+
+/**
+ * @description 按钮展示
+ */
+const action: detailAction[] = [
+  buttonDefault({
+    label: t("common.redo"),
+    clickFunc: item => {
+      vxeTableRef.value.refresh();
+    }
+  }),
+  buttonDefault({
+    label: t("common.add"),
+    power: 62,
+    clickFunc: item => {
+      console.log("inewss   nitParams.value :>> ", vxeTableRef.value.searchParam);
+      let _deptid = 0;
+      if (Object.keys(vxeTableRef.value.searchParam).includes("arg_deptid")) {
+        _deptid = vxeTableRef.value.searchParam.arg_deptid;
+      }
+      router.push(`/mattressQuote/new?id=0&deptid=${_deptid}`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.editText"),
+    power: 62,
+    clickFunc: item => {
+      const { $table, curRecords } = getCurrentRecords(vxeTableRef.value);
+
+      if (!curRecords.length) {
+        ElMessage.warning(t("business.tips.mattress.records"));
+        return;
+      }
+
+      const _cur = $table.getCurrentRecord() ?? null;
+      if (_cur) {
+        router.push(`/mattressQuote/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
+      } else {
+        const _cur = curRecords[curRecords.length - 1];
+        router.push(`/mattressQuote/edit?id=${_cur.mattressid}&code=${_cur.mattresscode}`);
+      }
+    }
+  }),
+  buttonDefault({
+    label: t("common.delText"),
+    power: 76,
+    disabledTextCallBack: (data: any) => {
+      if (!CheckPower(76)) {
+        return "你没有【报价单-删除】的使用权限";
+      }
+
+      return "";
+    },
+    clickFunc: item => {
+      // const { curRecords } = getCurrentRecords(vxeTableRef.value);
+      // console.log("curRecords :>> ", curRecords);
+      // if (!curRecords.length) {
+      //   ElMessage.warning(t("business.tips.mattress.records"));
+      //   return;
+      // }
+      // let _mattressids = curRecords.map((item: any) => Number(item.mattressid));
+      // ElMessageBox.confirm(`是否确定要删除${curRecords.length}张床垫报价单吗?`, "询问", {
+      //   confirmButtonText: t("common.delText"),
+      //   cancelButtonText: "否",
+      //   type: "warning"
+      // })
+      //   .then(() => {
+      //     DelMattress({ mattressids: _mattressids }).then(() => {
+      //       ElMessage.success("删除成功!");
+      //       vxeTableRef.value.refresh();
+      //     });
+      //   })
+      //   .catch((e: TypeError) => {
+      //     console.log("e :>> ", e);
+      //     ElMessage({
+      //       type: "info",
+      //       message: "操作取消"
+      //     });
+      //   });
+    }
+  }),
+  [
+    buttonDefault({
+      label: t("common.auditFinance"),
+      power: 63,
+      disabledTextCallBack: (data: any) => {
+        if (!CheckPower(63)) {
+          return `你没有【报价单-${t("common.auditFinance")}】的使用权限`;
+        }
+        return "";
+      },
+      clickFunc: item => {
+        // ElMessageBox.confirm(`是否确定要${t("common.auditFinance")}吗?`, "询问", {
+        //   confirmButtonText: "是",
+        //   cancelButtonText: "否",
+        //   type: "warning"
+        // })
+        //   .then(() => {
+        //     let _params = {
+        //       mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
+        //       flag: 1
+        //     };
+        //     SaveMattressAuditing(_params).then(() => {
+        //       ElMessage.success(t("sys.api.operationSuccess"));
+        //       LjDetailRef.value.refresh();
+        //     });
+        //   })
+        //   .catch((e: TypeError) => {
+        //     ElMessage({
+        //       type: "info",
+        //       message: "操作取消"
+        //     });
+        //   });
+      }
+    }),
+    buttonDefault({
+      label: t("common.withdrawAuditFinance"),
+      power: 64,
+      disabledTextCallBack: (data: any) => {
+        if (!CheckPower(64)) {
+          return `你没有【报价单-${t("common.withdrawAuditFinance")}】的使用权限`;
+        }
+        return "";
+      },
+      clickFunc: item => {
+        // ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditFinance")}吗?`, "询问", {
+        //   confirmButtonText: "是",
+        //   cancelButtonText: "否",
+        //   type: "warning"
+        // })
+        //   .then(() => {
+        //     let _params = {
+        //       mattressids: [Number(LjDetailRef.value._mainData.mattressid)],
+        //       flag: 0
+        //     };
+        //     SaveMattressAuditing(_params).then(() => {
+        //       ElMessage.success(t("sys.api.operationSuccess"));
+        //       LjDetailRef.value.refresh();
+        //     });
+        //   })
+        //   .catch((e: TypeError) => {
+        //     ElMessage({
+        //       type: "info",
+        //       message: "操作取消"
+        //     });
+        //   });
+      }
+    })
+  ],
+  buttonDefault({
+    label: t("common.copyQuote"),
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  }),
+  // [
+  //   buttonDefault({
+  //     label: t("common.businessOrder"),
+  //     power: 94,
+  //     clickFunc: item => {
+  //       toAuditing({ xd_flag: 1 }, t("common.businessOrder"));
+  //     }
+  //   }),
+  //   buttonDefault({
+  //     label: t("common.businessOrderCancel"),
+  //     power: 95,
+  //     clickFunc: item => {
+  //       toAuditing({ xd_flag: 0 }, t("common.businessOrder"));
+  //     }
+  //   })
+  // ],
+  // [
+  //   buttonDefault({
+  //     label: t("common.auditFinance"),
+  //     power: 73,
+  //     clickFunc: item => {
+  //       toAuditing({ flag: 1 }, t("common.auditFinance"));
+  //     }
+  //   }),
+  //   buttonDefault({
+  //     label: t("common.withdrawAuditFinance"),
+  //     power: 74,
+  //     clickFunc: item => {
+  //       toAuditing({ flag: 0 }, t("common.withdrawAuditFinance"));
+  //     }
+  //   })
+  // ],
+  buttonDefault({
+    label: t("common.copyFromMulitFlag"),
+    power: 61,
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.recalculateFromNotFlag"),
+    power: 61,
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.viewHistoricalQuotes"),
+    power: 61,
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.showQuoteList"),
+    power: 61,
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  }),
+  buttonDefault({
+    label: t("common.dataTransmission"),
+    power: 61,
+    clickFunc: item => {
+      router.push(`/mattressQuote/new?id=0`);
+    }
+  })
+];
+</script>

+ 263 - 81
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -10,12 +10,23 @@
     :action="orderDefaultAction"
     :after-mound="funcAfterMound"
     :if-layout-editable="false"
+    :default-columns-value="defaultColumnsValue"
   >
+    <template #rightBtn="scope">
+      <el-select v-model="scope.data.dannum_rate" placeholder="大小单" style="width: 80px">
+        <el-option label="散单" value="1" />
+        <el-option label="标准" value="2" />
+        <el-option label="大单" value="3" />
+      </el-select>
+    </template>
     <!-- @to-pin-detail="emit('toPinDetail')" -->
     <template #fabricMx__tabtitle="scope">
-      <el-badge :value="isTabsBadge_fabric" :type="isTabsBadge_fabric > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="isTabsBadge_fabric">
+        <el-badge :value="isTabsBadge_fabric" :type="isTabsBadge_fabric > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #fabricMx>
       <el-tabs v-model="fabricMxTabs" type="card" class="h-full">
@@ -176,9 +187,12 @@
     </template>
 
     <template #bednetMx__tabtitle="scope">
-      <el-badge :value="isTabsBadge_bednet" :type="isTabsBadge_bednet > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="isTabsBadge_bednet">
+        <el-badge :value="isTabsBadge_bednet" :type="isTabsBadge_bednet > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #bednetMx>
       <LjVxeTable
@@ -203,9 +217,12 @@
     </template>
 
     <template #cushionsMx__tabtitle="scope">
-      <el-badge :value="isTabsBadge_cushions" :type="isTabsBadge_cushions > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="isTabsBadge_cushions">
+        <el-badge :value="isTabsBadge_cushions" :type="isTabsBadge_cushions > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #cushionsMx>
       <LjVxeTable
@@ -235,9 +252,12 @@
     </template>
 
     <template #accessoriesMx__tabtitle="scope">
-      <el-badge :value="isTabsBadge_accessories" :type="isTabsBadge_accessories > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="isTabsBadge_accessories">
+        <el-badge :value="isTabsBadge_accessories" :type="isTabsBadge_accessories > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #accessoriesMx>
       <LjVxeTable
@@ -262,9 +282,12 @@
     </template>
 
     <template #packagMx__tabtitle="scope">
-      <el-badge :value="isTabsBadge_packag" :type="isTabsBadge_packag > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="isTabsBadge_packag">
+        <el-badge :value="isTabsBadge_packag" :type="isTabsBadge_packag > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #packagMx="scope">
       <LjVxeTable
@@ -318,9 +341,12 @@
     </template>
 
     <template #innerClothLayerMx__tabtitle="scope">
-      <el-badge :value="innerClothLayerNum" :type="innerClothLayerNum > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="innerClothLayerNum">
+        <el-badge :value="innerClothLayerNum" :type="innerClothLayerNum > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #innerClothLayerMx>
       <LjVxeTable
@@ -328,7 +354,7 @@
         row-key="key"
         table-cls=""
         :request-api="getData_innerClothLayer"
-        :data-callback="dataCallback"
+        :data-callback="dataCallbackMx"
         :init-param="initParams"
         :columns="columnsMxInnerClothLayer"
         :dwname="DwnameEnum.mattressQuoteMxInnerClothLayer"
@@ -341,9 +367,12 @@
     </template>
 
     <template #topCottonMx__tabtitle="scope">
-      <el-badge :value="topCottonNum" :type="topCottonNum > 0 ? 'danger' : 'info'">
-        {{ scope.props.label }}
-      </el-badge>
+      <template v-if="topCottonNum">
+        <el-badge :value="topCottonNum" :type="topCottonNum > 0 ? 'danger' : 'info'">
+          {{ scope.props.label }}
+        </el-badge>
+      </template>
+      <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #topCottonMx>
       <LjVxeTable
@@ -351,7 +380,7 @@
         row-key="key"
         table-cls=""
         :request-api="getData_topCotton"
-        :data-callback="dataCallback"
+        :data-callback="dataCallbackMx"
         :init-param="initParams"
         :columns="columnsMx"
         :dwname="DwnameEnum.mattressQuoteMx"
@@ -403,7 +432,7 @@ import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
 import { SaveMattress, SaveMattressAuditing, DelMattress } from "@/api/modules/quote";
 // import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
 import { TYPE, useToast, POSITION } from "vue-toastification";
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage, ElMessageBox, ElNotification } from "element-plus";
 import { ArrowDown } from "@element-plus/icons-vue";
 // import { calculateFormula } from "@/utils/index";
 import MtrldefDialog from "@/views/system/selector/mtrldef/index.vue";
@@ -412,26 +441,26 @@ import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
 
-interface detailProp {
-  /**
-   * @argument any 页面数据
-   */
-  data1?: any;
-  /**
-   * @argument string 请求数据的api ==> 非必传
-   */
-  requestApi?: (params: any) => Promise<any>;
-  /**
-   * @argument any 基础信息,表格展示数据
-   */
-  // columns?: any;
-  /**
-   * @description 是否可编辑
-   */
-  status: "edit" | "new" | string;
-}
-
-const props = withDefaults(defineProps<detailProp>(), {});
+// interface detailProp {
+//   // /**
+//   //  * @argument any 页面数据
+//   //  */
+//   // data1?: any;
+//   // /**
+//   //  * @argument string 请求数据的api ==> 非必传
+//   //  */
+//   // requestApi?: (params: any) => Promise<any>;
+//   // /**
+//   //  * @argument any 基础信息,表格展示数据
+//   //  */
+//   // // columns?: any;
+//   // /**
+//   //  * @description 是否可编辑
+//   //  */
+//   // status: "edit" | "new" | string;
+// }
+
+// const props = withDefaults(defineProps<detailProp>(), {});
 const { t } = useI18n();
 const route = useRoute();
 const router = useRouter();
@@ -490,12 +519,14 @@ const {
   funcChaifenTab,
   getData_mx,
   dataCallback,
+  dataCallbackMx,
   getMattressType,
   gotoSummy,
   gotoHisprice,
   getFormulakindEnum,
   funcPacktypeChange,
-  dynamicRef
+  dynamicRef,
+  wf_cmp_cb
 } = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 // const toast = useToast();
@@ -504,6 +535,8 @@ const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 // const mainData = ref([]);
 const tabRemove: Function = inject("tabRemove") as Function;
 
+const defaultColumnsValue = ref<any>({});
+
 /**
  * @description 明细表格组件基础配置
  */
@@ -584,6 +617,7 @@ const isTabsBadge_fabric = computed(() => {
   arr = arr.concat(fabricMxTab11.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
   arr = arr.concat(fabricMxTab12.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
   arr = arr.concat(fabricMxTab13.value.filter(t => t.mtrlid && Number(t.mtrlid) > 0));
+  console.log("isTabsBadge_fabric arr :>> ", arr);
   return arr.length;
 });
 
@@ -832,11 +866,12 @@ const detailProps = reactive<DetailProp>({
     {
       id: "topCottonMx",
       type: "table",
-      label: t("business.detail.topCotton")
-      // limited: (params: any) => {
-      //   if (!params) return true;
-      //   return params?.if_w_butao == "0";
-      // }
+      label: t("business.detail.topCotton"),
+      limited: (params: any) => {
+        console.log("topCottonMx params?.if_w_butao :>> ", params?.if_w_butao);
+        if (!params) return true;
+        return !params?.if_w_butao || params?.if_w_butao == "0";
+      }
     }
   ]
 });
@@ -854,6 +889,9 @@ const getData = (params: any) => {
   return CommonDynamicSelect(newParams, DwnameEnum.mattressQuote);
   // return [];
 };
+const loadingStatus = reactive({
+  save: false
+});
 
 const orderDefaultAction = [
   buttonDefault({
@@ -876,39 +914,134 @@ const orderDefaultAction = [
   buttonNew({
     label: t("common.saveText"),
     icon: "iconsave-01",
-    limited: () => {
-      return !orderStatus.value;
-    },
+    loading: () => loadingStatus.save,
+    limited: () => !orderStatus.value,
     clickFunc: async () => {
       console.log("save LjDetailRef.value._mainData :>> ", LjDetailRef.value._mainData);
 
-      console.log("save------------ :>> ");
+      console.log("save------------ :>> ", loadingStatus.save);
       console.log("save cushionsMxData :>> ", cushionsMxData.value);
-      console.log("save cushionsMxtable getTableData :>> ", cushionsMxRef.value.element.getTableData());
-      console.log("save packagMxRef getTableData :>> ", packagMxRef.value.element.getTableData());
-
-      let mattressMx = [];
-      fabricMxTabList.value.map(t => {
-        if (t.ref) {
-          console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
-          if (dynamicRef(t.ref)) {
-            const { fullData } = dynamicRef(t.ref)?.element.getTableData();
-            console.log("fullData :>> ", fullData);
-            mattressMx = mattressMx.concat(fullData);
+
+      try {
+        await LjDetailRef.value.toValidateForm();
+
+        wf_cmp_cb();
+        loadingStatus.save = true;
+
+        let mattress = LjDetailRef.value._mainData;
+        console.log("save cushionsMxData :>> ", LjDetailRef.value._mainData, mattress?.if_d_chai, Number(mattress.if_d_chai));
+        mattress.mattressid = Number(mattress.mattressid ?? 0);
+        mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+        mattress.if_bcp_type = Number(mattress.if_bcp_type ?? 0);
+        mattress.if_d_chai = Number(mattress.if_d_chai ?? 0);
+        mattress.if_m_chai = Number(mattress.if_m_chai ?? 0);
+        mattress.if_m_wbutao_way = Number(mattress.if_m_wbutao_way ?? 0);
+        mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+        mattress.if_moneyrate = Number(mattress.if_moneyrate ?? 0);
+        mattress.if_n_butao = Number(mattress.if_n_butao ?? 0);
+        mattress.if_w_butao = Number(mattress.if_w_butao ?? 0);
+        mattress.if_z_chai = Number(mattress.if_z_chai ?? 0);
+        mattress.if_zhedie_type = Number(mattress.if_zhedie_type ?? 0);
+        mattress.packqty = Number(mattress.packqty ?? 0);
+        mattress.woodpallettype = mattress?.woodpallettype ?? "0";
+        mattress.total_hr_cost = mattress?.total_hr_cost ?? "0";
+        mattress.total_material_cost = mattress?.total_material_cost ?? "0";
+        mattress.total_hr_cost = mattress?.total_hr_cost ?? 0;
+        mattress.total_material_cost = mattress?.total_material_cost ?? 0;
+        mattress.total_fees_cost = mattress?.total_fees_cost ?? 0;
+        mattress.total_cost = mattress?.total_cost ?? 0;
+        mattress.commissionrate = mattress?.commissionrate ?? 0;
+        mattress.fob = mattress?.fob ?? 0;
+        mattress.profitrate = mattress?.profitrate ?? 0;
+        mattress.nottax_factory_cost = mattress?.nottax_factory_cost ?? 0;
+        mattress.nottax_dept_cost = mattress?.nottax_dept_cost ?? 0;
+        mattress.foreign_cost = mattress?.foreign_cost ?? 0;
+        mattress.diameter = mattress?.diameter ?? 0;
+        mattress.area = mattress?.area ?? 0;
+        mattress.cabinet_type = mattress?.cabinet_type ?? 0;
+        mattress.hrcost = mattress?.hrcost ?? 0;
+        mattress.biandaicost = mattress?.biandaicost ?? 0;
+        mattress.flag = mattress?.flag ?? 0;
+        mattress.dept_profitrate_rangli = mattress?.dept_profitrate_rangli ?? 0;
+        mattress.profitrate_point = mattress?.profitrate_point ?? 0;
+        mattress.chaizhuang_point = mattress?.chaizhuang_point ?? 0;
+        mattress.haimian_point = mattress?.haimian_point ?? 0;
+        mattress.qr_auditingdate = mattress?.qr_auditingdate ?? 0;
+        mattress.zhizao_amt = mattress?.zhizao_amt ?? 0;
+        mattress.foreign_cost_bz = mattress?.foreign_cost_bz ?? 0;
+        mattress.cubage = mattress?.cubage ?? 0;
+
+        let mattressMx = [];
+        fabricMxTabList.value.map(t => {
+          if (t.ref) {
+            console.log("t.ref?.value :>> ", t.ref, dynamicRef(t.ref));
+            if (dynamicRef(t.ref)) {
+              let { fullData } = dynamicRef(t.ref)?.element.getTableData();
+              console.log("fullData :>> ", fullData);
+              fullData = fullData.map((itm, idx) => {
+                itm.xu = idx + 1;
+                return itm;
+              });
+              mattressMx = mattressMx.concat(fullData);
+            }
           }
-        }
-      });
+        });
 
-      console.log("mattressMx all :>> ", mattressMx);
+        mattressMx = mattressMx.map(t => {
+          t.formulaid = t.formulaid ?? 0;
+          t.formula = t.formula ?? "";
+          t.if_success = t.if_success ?? 0;
+          t.replace_formula = t.replace_formula ?? "";
+          t.priceunit = t.priceunit ?? "";
+          t.shrinkage = t.shrinkage ?? 0;
+          t.mtrlid = t.mtrlid ?? 0;
+          t.price = t.price ?? 0;
+          t.gram_weight = t.gram_weight ?? 0;
+          t.cloth_width = t.cloth_width ?? 0;
+          t.if_inputqty = t.if_inputqty ?? 0;
+          t.qty = t.qty ?? 0;
+          t.costamt = t.costamt ?? 0;
+          t.if_areaprice = t.if_areaprice ?? 0;
+          t.thickness = t.thickness ?? 0;
+          t.chastr = t.chastr ?? "";
+          t.useqty = t.useqty ?? 0;
+          t.useformula = t.useformula ?? "";
+          t.replace_useformula = t.replace_useformula ?? "";
+          t.gydscrp = t.gydscrp ?? "";
+          t.xu = t.xu ?? 0;
+          return t;
+        });
 
-      let _param_mf = {
-        mattress: LjDetailRef.value._mainData,
-        mattressMx: mattressMx
-      };
-      try {
-        await SaveMattress(_param_mf);
-      } catch (error) {
-        ElMessage.error(t("sys.api.operationFailed"));
+        let _param_mf = {
+          mattress,
+          mattressMx
+        };
+        try {
+          console.log("综合 _param_mf :>> ", _param_mf);
+          // await SaveMattress(_param_mf)
+          //   .then(res => {
+          //     ElNotification({
+          //       title: "温馨提示",
+          //       message: t("sys.api.sueccessToSave"),
+          //       type: "success"
+          //     });
+          //     if (res.mattressid) {
+          //       router.replace(`/mattressQuote/detail?id=${res.mattressid}`);
+          //     } else {
+          //       router.replace("/mattressQuote");
+          //     }
+          //     loadingStatus.save = false;
+          //   })
+          //   .catch(error => {
+          //     console.log("error !! :>> ", error);
+          //     loadingStatus.save = false;
+          //   });
+        } catch (error) {
+          ElMessage.error(t("sys.api.operationFailed"));
+        }
+      } catch (e) {
+        loadingStatus.save = false;
+        console.log("buttonNew eee :>> ", e, loadingStatus.save);
       }
     }
   }),
@@ -1164,17 +1297,66 @@ onMounted(async () => {
   console.log("route onMounted:>> ", route.params);
   console.log("route onMounted:>> ", route.params.id);
 
-  if (route.query?.id) {
+  if (Number(route.query?.id)) {
     // 赋值主表数据
     // mainData.value = res.datatable.length ? res.datatable[0] : {};
     // console.log("mainData.value :>> ", mainData.value);
     // 刷新数据
     initParams.value.arg_mattressid = Number(route.query?.id);
     console.log("detail onMounted initParams.value :>> ", initParams.value);
-    // } else {
-    //   // 直接读取
-    //   mainData.value = props.data;
+  } else {
+    if (route.query?.deptid) {
+      defaultColumnsValue.value.deptid = route.query?.deptid;
+    }
   }
+  defaultColumnsValue.value.packtype = "0";
+  defaultColumnsValue.value.packqty = 1;
+  // defaultColumnsValue.value.woodpallettype = "0";
+  // defaultColumnsValue.value.total_cost = 0;
+  // defaultColumnsValue.value.nottax_factory_cost = 0;
+  // defaultColumnsValue.value.nottax_dept_cost = 0;
+  // defaultColumnsValue.value.foreign_cost = 0;
+  // defaultColumnsValue.value.fob = 0;
+  defaultColumnsValue.value.dannum_rate = "1";
+  defaultColumnsValue.value.if_moneyrate = "0";
+  defaultColumnsValue.value.moneyrate = "1";
+  defaultColumnsValue.value.taxrate = 1;
+  defaultColumnsValue.value.taxes = 1;
+  // defaultColumnsValue.value.flag = 0;
+
+  defaultColumnsValue.value.woodpallettype = "0";
+  defaultColumnsValue.value.total_hr_cost = "0";
+  defaultColumnsValue.value.total_material_cost = "0";
+  defaultColumnsValue.value.total_hr_cost = 0;
+  defaultColumnsValue.value.total_material_cost = 0;
+  defaultColumnsValue.value.total_fees_cost = 0;
+  defaultColumnsValue.value.total_cost = 0;
+  defaultColumnsValue.value.commissionrate = 0;
+  defaultColumnsValue.value.fob = 0;
+  defaultColumnsValue.value.profitrate = 0;
+  defaultColumnsValue.value.nottax_factory_cost = 0;
+  defaultColumnsValue.value.nottax_dept_cost = 0;
+  defaultColumnsValue.value.dept_cost = 0;
+  defaultColumnsValue.value.foreign_cost = 0;
+  defaultColumnsValue.value.diameter = 0;
+  defaultColumnsValue.value.area = 0;
+  defaultColumnsValue.value.cabinet_type = 0;
+  defaultColumnsValue.value.hrcost = 0;
+  defaultColumnsValue.value.biandaicost = 0;
+  defaultColumnsValue.value.flag = 0;
+  defaultColumnsValue.value.dept_profitrate_rangli = 0;
+  defaultColumnsValue.value.profitrate_point = 0;
+  defaultColumnsValue.value.chaizhuang_point = 0;
+  defaultColumnsValue.value.haimian_point = 0;
+  defaultColumnsValue.value.qr_auditingdate = "";
+  defaultColumnsValue.value.zhizao_amt = 0;
+  defaultColumnsValue.value.foreign_cost_bz = 0;
+  defaultColumnsValue.value.cubage = 0;
+  defaultColumnsValue.value.discount = 1;
+  defaultColumnsValue.value.butao_point = 1;
+  defaultColumnsValue.value.guanli_rate = 1;
+
+  console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
 
   getFormulakindEnum();
 });
@@ -1272,7 +1454,7 @@ const funcAfterMound = async () => {
     getMattressType();
 
     let res = await getData_mx(initParams.value);
-    oriMxData.value = dataCallback(res);
+    oriMxData.value = dataCallbackMx(res);
     oriMxData.value.list = oriMxData.value.list.map(t => {
       t.formulakind = Number(t.formulakind);
       t.thickness = Number(t.thickness);

+ 850 - 26
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -6,11 +6,11 @@ import { CommonDynamicSelect } from "@/api/modules/common";
 import { useUserStore } from "@/stores/modules/user";
 import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
 import { handleRowAccordingToProp } from "@/utils";
-import { ElButton, ElMessage, ElPopconfirm } from "element-plus";
+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 } from "@/utils/index";
+import { calculateFormula, formulaPartsFormula, floatAdd, floatMul, formatFixedNumber } from "@/utils/index";
 import { cloneDeep, defaultsDeep } from "lodash-es";
 import { TYPE, useToast, POSITION } from "vue-toastification";
 import ToastFormula from "@/components/ToastWidget/Formula/index.vue";
@@ -103,10 +103,7 @@ interface defaultState {
   cabinetTypeOptions: any;
   diancengAreaEnum: any;
 }
-/**
- * @description 表格多选数据操作
- * @param {String} rowKey 当表格可以多选时,所指定的 id
- * */
+
 export const useHooks = (t?: any) => {
   const state = reactive<defaultState>({
     orderStatus: "",
@@ -521,6 +518,23 @@ export const useHooks = (t?: any) => {
   };
 
   const dataCallback = (data: any) => {
+    console.log("dataCallback data :>> ", data);
+    if (data.datatable.length > 0) {
+      data.datatable = data.datatable.map((item: any) => {
+        item.dannum_rate = Number(item.dannum_rate);
+        return item;
+      });
+    }
+    return {
+      list: data.datatable,
+      tableinfo: data.tableinfo,
+      total: data.totalcnt,
+      pageNum: data.pageindex,
+      pageSize: data.pagesize
+    };
+  };
+
+  const dataCallbackMx = (data: any) => {
     console.log("dataCallback data :>> ", data);
     return {
       list: data.datatable,
@@ -535,7 +549,7 @@ export const useHooks = (t?: any) => {
     let newParams = {
       dsname: "_Mapper_deptid",
       queryparams: {
-        arg_deptid: data.deptid
+        deptid: data.deptid
       }
     };
     let res = await CommonDynamicSelect(newParams);
@@ -695,19 +709,19 @@ export const useHooks = (t?: any) => {
     }
   };
 
-  // const wf_mtrl_find = async (params: any) => {
-  //   let _params: any = {
-  //     dsname: "web_mtrl_choose",
-  //     queryparams: params
-  //   }
-  //   let res = await CommonDynamicSelect(_params);
+  const wf_mtrl_find = async (params: any) => {
+    let _params: any = {
+      dsname: "web_mtrl_choose",
+      queryparams: params
+    };
+    let res = await CommonDynamicSelect(_params);
 
-  //   if (res?.datatable?.length) {
-  //     return res?.datatable
-  //   } else {
-  //     return [];
-  //   }
-  // };
+    if (res?.datatable?.length) {
+      return res?.datatable;
+    } else {
+      return [];
+    }
+  };
 
   /**
    * @description 垫层配置  和  垫层可选项
@@ -1518,6 +1532,669 @@ export const useHooks = (t?: any) => {
 
   // }
 
+  /**
+   * @description 刷新报价清单
+   */
+  const wf_factory_profitrate = async () => {
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    console.log("wf_factory_profitrate enumMap :>> ", enumMap);
+
+    let deptEnum = enumMap.get("deptid");
+    console.log("deptEnum :>> ", deptEnum);
+    if (deptEnum) {
+      let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
+      console.log("depItem :>> ", depItem);
+      if (depItem) {
+        _mainData.dept_profitrate = Number(depItem.profitrate);
+      }
+    }
+
+    let _params = {
+      dsname: "web_factory_profitratelist",
+      queryparams: {
+        arg_deptid: _mainData.deptid,
+        arg_bednettypeid_mattresstypeid: _mainData.mattresstypeid,
+        kind: 1
+      }
+    };
+    let res = await CommonDynamicSelect(_params);
+    if (res?.datatable?.length > 0) {
+      _mainData.profitrate = res?.datatable[0].profitrate;
+    }
+  };
+
+  /**
+   * @description 获取部门汇率 和  折扣率
+   */
+  const wf_get_moneyrate_discount = () => {
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    let deptEnum = enumMap.get("deptid");
+    console.log("deptEnum :>> ", deptEnum);
+    if (deptEnum) {
+      let depItem = deptEnum.find((item: any) => item.value == _mainData.deptid);
+      console.log("wf_get_moneyrate_discount depItem :>> ", depItem);
+      if (depItem) {
+        let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
+        console.log("_mainData.if_moneyrate == 0 :>> ", _mainData.if_moneyrate == "0");
+        if (_mainData.if_moneyrate == "0" || !_mainData.if_moneyrate) {
+          _mainData.moneyrate = 1;
+        } else {
+          _mainData.moneyrate = _moneyrate;
+        }
+
+        _mainData.discount = depItem.discount;
+      }
+    }
+  };
+
+  /**
+   * @description 清除运算结果
+   */
+  const wf_clear = () => {
+    const { _mainData } = state.LjDetailRef;
+
+    _mainData.total_fees_cost = 0;
+    _mainData.total_cost = 0;
+    _mainData.nottax_factory_cost = 0;
+    _mainData.nottax_dept_cost = 0;
+    _mainData.taxes = 0;
+    _mainData.dept_cost = 0;
+    _mainData.foreign_cost = 0;
+    _mainData.hrcost = 0;
+    _mainData.biandaicost = 0;
+    _mainData.fob = 0;
+    _mainData.profitrate_point = 0;
+    _mainData.butao_point = 0;
+    _mainData.chaizhuang_point = 0;
+    _mainData.haimian_point = 0;
+
+    state.fabricMxTabList.map(t => {
+      if (t.ref && state[t.ref]) {
+        console.log("t.ref?.value :>> ", t.ref, state[t.ref]);
+        // console.log("state[t.ref].tableData :>> ", state[t.ref].tableData);
+        // state[t.ref].tableData.map(item => {
+        //   item.costamt = 0;
+        //   item.replace_formula = "";
+        //   item.if_success = 1;
+        //   item.thickness = 1;
+        // });
+        let { fullData } = state[t.ref].element.getTableData();
+        state[t.ref].element.setRow(fullData, {
+          costamt: 0,
+          replace_formula: "",
+          if_success: 0
+        });
+        // console.log("fullData :>> ", fullData);
+        // fullData = fullData.map((itm, idx) => {
+        //   itm.xu = idx + 1;
+        //   return itm
+        // });
+      }
+    });
+  };
+
+  /**
+   * @description 更新物料最新 单价等信息
+   */
+  const wf_cmp_update_mtrl = async () => {
+    const { _mainData, enumMap } = state.LjDetailRef;
+    let computeList = [
+      "tabpage_8",
+      "tabpage_9",
+      "tabpage_10",
+      "tabpage_11",
+      "tabpage_12",
+      "tabpage_13",
+      "cushionsMx",
+      "accessoriesMx",
+      "packagMx"
+    ];
+
+    let arg_array_formulakind = [];
+    state.fabricMxTabList.map(t => {
+      if (!computeList.includes(t.name)) {
+        return;
+      }
+
+      if (t.ref && state[t.ref]) {
+        let { fullData } = state[t.ref].element.getTableData();
+        fullData.map(itm => {
+          arg_array_formulakind.push(itm.formulakind);
+        });
+      }
+    });
+
+    // 数组去重
+    arg_array_formulakind = Array.from(new Set(arg_array_formulakind));
+
+    let _param = {
+      dsname: "web_mattress_formulalist",
+      queryparams: {
+        arg_array_formulakind: arg_array_formulakind
+      }
+    };
+    let res = await CommonDynamicSelect(_param);
+    if (res?.datatable?.length) {
+      state.fabricMxTabList.map(t => {
+        if (!computeList.includes(t.name)) {
+          return;
+        }
+
+        if (t.ref && state[t.ref]) {
+          let { fullData } = state[t.ref].element.getTableData();
+
+          fullData.map(item => {
+            let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
+
+            state[t.ref].element.setRow(item, {
+              formula: tFormula.formula ?? "err",
+              useformula: tFormula.useformula ?? "",
+              gydscrp: tFormula.gydscrp ?? ""
+            });
+          });
+        }
+      });
+    }
+
+    //______________________________________________________
+    state.fabricMxTabList.map(t => {
+      if (!computeList.includes(t.name)) {
+        return;
+      }
+
+      if (t.ref && state[t.ref]) {
+        let { fullData } = state[t.ref].element.getTableData();
+
+        fullData.map(async item => {
+          if (item?.mtrlid && Number(item.mtrlid) > 0) {
+            let res_mtrls = await wf_mtrl_find({ arg_mtrlid: item.mtrlid, arg_pricelistid: item.pricelistid });
+
+            if (res_mtrls.length > 0) {
+              let res_mtrl = res_mtrls[0];
+              let _data: any = {
+                mtrlname: res_mtrl.mtrlname,
+                price: res_mtrl.pricelistprice,
+                gram_weight: res_mtrl.gram_weight,
+                cloth_width: res_mtrl.cloth_width,
+                if_inputqty: res_mtrl.if_inputqty,
+                priceunit: res_mtrl.priceunit,
+                shrinkage: res_mtrl.shrinkage,
+                if_areaprice: res_mtrl.if_areaprice
+              };
+              if (Number(res_mtrl.if_inputqty) == 1) {
+                _data.thickness = res_mtrl.thickness;
+              }
+              if (!res_mtrl.formula) {
+                _data.formula = res_mtrl.formula;
+              }
+              if (!res_mtrl.qty_formula) {
+                _data.useformula = res_mtrl.qty_formula;
+              }
+              state[t.ref].element.setRow(item, _data);
+            }
+          }
+        });
+      }
+    });
+  };
+
+  /**
+   * @description 检查垫层  是否填写正确 并 更新 u_mattress_mx_mtrl_formulaid
+   */
+  const wf_check_dianceng_ifright = async () => {
+    let arg_array_formulakind = [];
+    let { fullData: dcData } = state.cushionsMxRef.element.getTableData();
+    dcData.map(itm => {
+      arg_array_formulakind.push(Number(itm.formulakind));
+    });
+
+    // 数组去重
+    arg_array_formulakind = Array.from(new Set(arg_array_formulakind));
+
+    let _param = {
+      dsname: "web_mattress_formulalist",
+      queryparams: {
+        arg_array_formulakind: arg_array_formulakind
+      }
+    };
+    let res = await CommonDynamicSelect(_param);
+    if (res?.datatable?.length) {
+      let { fullData } = state.cushionsMxRef.element.getTableData();
+
+      fullData.map(item => {
+        let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
+        state[t.ref].element.setRow(item, {
+          formulaid: tFormula.formulaid
+        });
+      });
+    }
+
+    //检查是否 含有床网
+    let lb_flag = arg_array_formulakind.includes(999);
+
+    let lb_re_cmp = false; //批重算
+    if (!lb_flag && !lb_re_cmp) {
+      // ElMessageBox.confirm("垫层没有包含床网_,是否继续?", "询问", {
+      //   confirmButtonText: '是',
+      //   cancelButtonText: "否",
+      //   type: "warning"
+      // })
+      //   .then(() => {
+
+      //     return
+      //   })
+      //   .catch((e: TypeError) => {
+      //     console.log("e :>> ", e);
+      ElMessage({
+        type: "info",
+        message: "垫层没有包含床网_!"
+      });
+      //   });
+    }
+  };
+
+  /**
+   * @description 重算床网价格
+   */
+  const wf_cmp_bednet = () => {
+    // bednetMxRef
+
+    return true;
+  };
+
+  /**
+   * @description 公式替换:替换大侧高度
+   */
+  const wf_replace_height_big_side = (arg_str: string, arg_chastr: string) => {
+    if (arg_str.indexOf("【大侧高度】") <= 0) return arg_str;
+    // let ls_str = arg_str;
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    let ls_seachstr = "大侧";
+
+    let lde_sum = 0;
+    state.cushionsMxRef.element.getTableData().fullData.map(itm => {
+      if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
+        lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
+      }
+    });
+
+    let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
+
+    let ls_formula_big_side = "";
+    let mtEnum = enumMap.get("mattresstypeid");
+    let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
+    console.log("deptEnum :>> ", mtEnum);
+    if (mtEnum) {
+      let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
+      console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
+      ls_formula_big_side = mtItem?.formula_big_side ?? "";
+    }
+
+    if (ls_formula_big_side) {
+      arg_str = arg_str.replaceAll("【大侧高度】", ` ( ${ls_formula_big_side} ) `);
+    }
+
+    if (lde_sum) {
+      arg_str = arg_str.replaceAll("【垫层】", ls_temp);
+      arg_str = arg_str.replaceAll("【大侧高度】", ls_temp);
+    }
+
+    arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
+
+    return arg_str;
+  };
+  /**
+   * @description 公式替换:小侧高度
+   */
+  const wf_replace_height_small_side = (arg_str: string, arg_chastr: string) => {
+    if (arg_str.indexOf("【小侧高度】") <= 0) return arg_str;
+    // let ls_str = arg_str;
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    let ls_seachstr = !arg_chastr || arg_chastr == "" ? "小侧1" : arg_chastr;
+
+    let lde_sum = 0;
+    state.cushionsMxRef.element.getTableData().fullData.map(itm => {
+      if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
+        lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
+      }
+    });
+
+    let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
+
+    let ls_formula_big_side = "";
+    let mtEnum = enumMap.get("mattresstypeid");
+    let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
+    console.log("deptEnum :>> ", mtEnum);
+    if (mtEnum) {
+      let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
+      console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
+      ls_formula_big_side = mtItem?.formula_big_side ?? "";
+    }
+
+    if (ls_formula_big_side) {
+      arg_str = arg_str.replaceAll("【小侧高度】", ` ( ${ls_formula_big_side} ) `);
+    }
+
+    if (lde_sum) {
+      arg_str = arg_str.replaceAll("【垫层】", ls_temp);
+    }
+
+    arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
+    arg_str = arg_str.replaceAll("【小侧高度】", ls_temp);
+
+    return arg_str;
+  };
+
+  /**
+   * @description 公式替换:V侧高度
+   */
+  const wf_replace_height_v_side = (arg_str: string, arg_chastr: string) => {
+    if (arg_str.indexOf("【V侧高度】") <= 0) return arg_str;
+    // let ls_str = arg_str;
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    let ls_seachstr = !arg_chastr || arg_chastr == "" ? "小侧1" : arg_chastr;
+
+    let lde_sum = 0;
+    state.cushionsMxRef.element.getTableData().fullData.map(itm => {
+      if (itm.chastr.indexOf(ls_seachstr) > 0 && Number(itm.qty) > 0 && Number(itm.thickness) > 0) {
+        lde_sum = floatAdd(lde_sum, floatMul(itm.qty, itm.thickness));
+      }
+    });
+
+    let ls_temp = formatFixedNumber({ val: lde_sum }, 4);
+
+    let ls_formula_big_side = "";
+    let mtEnum = enumMap.get("mattresstypeid");
+    let _mattresstypeid = _mainData?.mattresstypeid ?? 0;
+    console.log("deptEnum :>> ", mtEnum);
+    if (mtEnum) {
+      let mtItem = mtEnum.find((item: any) => Number(item.value) == _mattresstypeid);
+      console.log("wf_replace_height_big_side mtItem :>> ", mtItem);
+      ls_formula_big_side = mtItem?.formula_big_side ?? "";
+    }
+
+    if (ls_formula_big_side) {
+      arg_str = arg_str.replaceAll("【V侧高度】", ` ( ${ls_formula_big_side} ) `);
+    }
+
+    if (lde_sum) {
+      arg_str = arg_str.replaceAll("【垫层】", ls_temp);
+    }
+
+    arg_str = arg_str.replaceAll("【位置】", `'${ls_seachstr}'`);
+
+    ls_temp = formatFixedNumber({ val: 18 }, 4);
+    arg_str = arg_str.replaceAll("【V侧高度】", ls_temp);
+
+    return arg_str;
+  };
+
+  /**
+   * @description 替换布料幅宽star
+   * @returns string
+   */
+  const wf_replace_cloth_width = (item: any, fullData: any, formulakind: any) => {
+    let ls_bl_cloth_width = "";
+
+    // let { fullData: mlData } = state[t.ref].element.getTableData();
+    fullData.find(itm => {
+      if (!item?.chastr) {
+        if (Number(itm.formulakind) == formulakind) {
+          ls_bl_cloth_width = formatFixedNumber({ val: itm.cloth_width }, 4);
+          return true;
+        }
+      } else {
+        if (Number(itm.formulakind) == formulakind && itm.chastr == item?.chastr) {
+          ls_bl_cloth_width = formatFixedNumber({ val: itm.cloth_width }, 4);
+          return true;
+        }
+      }
+    });
+
+    // if (Number(ls_bl_cloth_width) > 0) {
+    //   ls_Expression = ls_Expression.replaceAll('【布料幅宽】', ls_bl_cloth_width);
+    //   ls_Use_Expression = ls_Use_Expression.replaceAll('【布料幅宽】', ls_bl_cloth_width);
+    // }
+    return ls_bl_cloth_width;
+  };
+
+  /**
+   * @description 计算价格
+   */
+  const wf_cmp_cb = async () => {
+    const { _mainData, enumMap, baseformRef } = state.LjDetailRef;
+
+    //清除运算结果
+    wf_clear();
+
+    await wf_factory_profitrate();
+
+    wf_get_moneyrate_discount();
+
+    wf_cmp_update_mtrl();
+
+    wf_check_dianceng_ifright();
+
+    if (!wf_cmp_bednet()) {
+      return;
+    }
+
+    // 佣金
+    if (_mainData?.commission == 0 || !_mainData.commission) {
+      _mainData.commission = 1;
+    }
+    if (_mainData?.taxrate == 0 || !_mainData.taxrate) {
+      _mainData.taxrate = 1;
+    }
+    if (_mainData?.other_rate == 0 || !_mainData.other_rate) {
+      _mainData.other_rate = 1;
+    }
+    if (_mainData?.moneyrate == 0 || !_mainData.moneyrate) {
+      _mainData.moneyrate = 1;
+    }
+
+    if (_mainData?.commission < 1) {
+      ElMessage.error("佣金点数不能小于1");
+      return;
+    }
+    if (_mainData?.taxrate < 1) {
+      ElMessage.error("税率不能小于1");
+      return;
+    }
+    if (_mainData?.other_rate < 1) {
+      ElMessage.error("额外点数不能小于1");
+      return;
+    }
+    if (_mainData?.dept_profitrate == 0) {
+      ElMessage.error("部门利润率不能为0!");
+      return;
+    }
+
+    let _data = {
+      ls_mattress_width: _mainData.mattress_width,
+      ls_mattress_length: _mainData.mattress_length,
+      ls_mattress_height: _mainData.mattress_height,
+      ls_packqty: _mainData.packqty,
+      ls_diameter: _mainData.diameter,
+      ls_woodpallettype: _mainData.woodpallettype,
+      ls_if_m_wbutao_way: _mainData.if_m_wbutao_way ?? "0",
+      ls_if_db_wbutao_way: _mainData.if_db_wbutao_wa ?? "0",
+      ls_s_cover_qty: _mainData.s_cover_qty ?? "0",
+      ls_z_cover_qty: _mainData.z_cover_qty ?? "0",
+      ls_x_cover_qty: _mainData.x_cover_qty ?? "0",
+      ls_s_m_cover_qty: _mainData.s_m_cover_qty ?? "0",
+      ls_z_m_cover_qty: _mainData.z_m_cover_qty ?? "0",
+      ls_x_m_cover_qty: _mainData.x_m_cover_qty ?? "0",
+      ls_if_m_chai: _mainData.if_m_chai ?? "0",
+      ls_if_z_chai: _mainData.if_z_chai ?? "0",
+      ls_if_d_chai: _mainData.if_d_chai ?? "0"
+    };
+
+    state.fabricMxTabList.map(t => {
+      if (t.ref && state[t.ref]) {
+        let { fullData } = state[t.ref].element.getTableData();
+        fullData.map(item => {
+          if ((!item.mtrlid || Number(item.mtrlid) == 0) && Number(item.formulakind) != 31) {
+            let ls_Expression = item.formula;
+            let ls_Use_Expression = item.useformula;
+
+            let _mxData = {
+              ls_price: item.price,
+              ls_gram_weight: item.gram_weight,
+              ls_cloth_width: item.cloth_width,
+              ls_if_inputqty: item.if_inputqty,
+              ls_qty: item.qty,
+              ls_thickness: item.thickness,
+              ls_shrinkage: Number(item.shrinkage) == 0 ? "1" : item.shrinkage,
+              ls_if_areaprice: item.if_areaprice,
+              ls_mtrlname: item.mtrlname ?? "null"
+            };
+
+            ls_Expression = wf_replace_height_big_side(ls_Expression, item.chastr);
+            ls_Use_Expression = wf_replace_height_big_side(ls_Use_Expression, item.chastr);
+
+            ls_Expression = wf_replace_height_small_side(ls_Expression, item.chastr);
+            ls_Use_Expression = wf_replace_height_small_side(ls_Use_Expression, item.chastr);
+
+            ls_Expression = wf_replace_height_v_side(ls_Expression, item.chastr);
+            ls_Use_Expression = wf_replace_height_v_side(ls_Use_Expression, item.chastr);
+
+            // 替换布料幅宽start
+            let ls_bl_cloth_width = "";
+            let _formulakind = Number(item.formulakind);
+            // 大侧
+            if (t.name == "tabpage_10" && t.type.includes(_formulakind)) {
+              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 2);
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+              }
+            }
+
+            //小侧
+            if (t.name == "tabpage_11" && t.type.includes(_formulakind)) {
+              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 3);
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+              }
+            }
+
+            //V侧
+            if (t.name == "tabpage_12" && t.type.includes(_formulakind)) {
+              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 4);
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+              }
+            }
+
+            //面裥绵
+            if (t.name == "tabpage_8" && t.type.includes(_formulakind)) {
+              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 0);
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+              }
+            }
+
+            //底裥绵
+            if (t.name == "tabpage_9" && t.type.includes(_formulakind)) {
+              ls_bl_cloth_width = wf_replace_cloth_width(item, fullData, 1);
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布料幅宽】", ls_bl_cloth_width);
+              }
+            }
+            //替换布料幅宽end
+
+            //替换布套高star
+            let ls_bl_bt_height = "";
+            // 内布套
+            let tabpage_14 = state.otherMxTabList.find(t => t.name == "tabpage_14");
+            if (tabpage_14.type.includes(_formulakind)) {
+              ls_bl_bt_height = "";
+
+              let { fullData: mlData } = state[t.ref].element.getTableData();
+              fullData.find(itm => {
+                if (itm.formulakind == 101) {
+                  ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
+                  return t;
+                }
+              });
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+              }
+            }
+            // 外布套
+            let tabpage_15 = state.otherMxTabList.find(t => t.name == "tabpage_15");
+            if (tabpage_15.type.includes(_formulakind)) {
+              ls_bl_bt_height = "";
+
+              let { fullData: mlData } = state[t.ref].element.getTableData();
+              fullData.find(itm => {
+                if (itm.formulakind == 101) {
+                  ls_bl_bt_height = formatFixedNumber({ val: itm.thickness }, 4);
+                  return t;
+                }
+              });
+
+              if (Number(ls_bl_cloth_width) > 0) {
+                ls_Expression = ls_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+                ls_Use_Expression = ls_Use_Expression.replaceAll("【布套高】", ls_bl_bt_height);
+              }
+            }
+            //替换布套高end
+
+            //计算裥绵收缩率
+            if ([50, 0, 40, 60, 70, 80].includes(_formulakind)) {
+              //...
+            }
+
+            console.log("fullData item :>> ", item, item.formula);
+            console.log("fullData item useformula :>> ", item.useformula);
+            summaryMxData.value = summaryMxData.value.map(itm => {
+              if (itm.field == "costamt") {
+                itm.formula = ls_Expression;
+              } else if (itm.field == "useqty") {
+                itm.formula = ls_Use_Expression;
+              }
+              return itm;
+            });
+
+            let result = formulaPartsFormula(summaryMxData.value, fieldMxParams.value, { ..._data, ..._mxData });
+            console.log(
+              "fabricMxTabList formula result :>> ",
+              summaryMxData.value,
+              fieldMxParams.value,
+              { ..._data, ..._mxData },
+              result
+            );
+          }
+          // let tFormula = res?.datatable.find(itm => itm.formulakind == item.formulakind);
+
+          // state[t.ref].element.setRow(item, {
+          //   formula: tFormula.formula ?? "err",
+          //   useformula: tFormula.useformula ?? "",
+          //   gydscrp: tFormula.gydscrp ?? ""
+          // });
+        });
+      }
+    });
+  };
+
   /**
    * @description 展示计算公式
    * @param timeout
@@ -1529,11 +2206,15 @@ export const useHooks = (t?: any) => {
 
     let result = await calculateFormula(summaryData.value, fieldParams.value, _mainData);
     if (result.length) {
-      let _data = cloneDeep(_mainData);
+      // let _data = cloneDeep(_mainData);
+      // result.map((t, i) => {
+      //   _data[t.field] = t.value;
+      // });
       result.map((t, i) => {
-        _data[t.field] = t.value;
+        _mainData[t.field] = t.value;
       });
-      console.log("_data :>> ", _data, result);
+
+      console.log("_data :>> ", _mainData, result);
       // toast.clear();
       toast(
         {
@@ -1541,7 +2222,7 @@ export const useHooks = (t?: any) => {
           props: {
             t: t,
             formulas: summaryData.value,
-            data: _data,
+            data: _mainData,
             fields: fieldParams.value,
             showFormula: state.showFormula
           },
@@ -1638,7 +2319,7 @@ export const useHooks = (t?: any) => {
       basicinfo: {
         el: "select",
         editable: ALLOW_EDIT_STATE,
-        rules: [{ required: true }],
+        rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
         props: {
           filterable: true,
           clearable: false
@@ -1661,7 +2342,7 @@ export const useHooks = (t?: any) => {
       basicinfo: {
         el: "select",
         editable: ALLOW_EDIT_STATE,
-        rules: [{ required: true }],
+        rules: [{ required: true, message: "请先选择床垫类别", trigger: "change" }],
         props: {
           clearable: false,
           filterable: true,
@@ -2397,6 +3078,9 @@ export const useHooks = (t?: any) => {
     }
   ];
 
+  /**
+   * @description 主表计算公式
+   */
   const summaryData = ref<any>([
     {
       label: "总成本",
@@ -2454,6 +3138,9 @@ export const useHooks = (t?: any) => {
     }
   ]);
 
+  /**
+   * @description 主表公式字段照表
+   */
   const fieldParams = ref<any>([
     {
       label: "总成本",
@@ -2565,6 +3252,141 @@ export const useHooks = (t?: any) => {
     }
   ]);
 
+  /**
+   * @description 明细公式字段照表
+   */
+  const fieldMxParams = ref<any>([
+    {
+      label: "名称前2位",
+      field: "ls_temp_left_2"
+    },
+    {
+      label: "规格宽",
+      field: "ls_mattress_width"
+    },
+    {
+      label: "规格长",
+      field: "ls_mattress_length"
+    },
+    {
+      label: "规格高",
+      field: "ls_mattress_height"
+    },
+    {
+      label: "压包数量",
+      field: "ls_packqty"
+    },
+    {
+      label: "卷包直径",
+      field: "ls_diameter"
+    },
+    {
+      label: "顶布裥棉外布套做法",
+      field: "ls_if_db_wbutao_way"
+    },
+    {
+      label: "面料外布套做法",
+      field: "ls_if_m_wbutao_way"
+    },
+    {
+      label: "内布套上覆",
+      field: "ls_s_cover_qty"
+    },
+    {
+      label: "内布套侧覆",
+      field: "ls_z_cover_qty"
+    },
+    {
+      label: "内布套下覆",
+      field: "ls_x_cover_qty"
+    },
+    {
+      label: "面料上覆",
+      field: "ls_s_m_cover_qty"
+    },
+    {
+      label: "面料侧覆",
+      field: "ls_z_m_cover_qty"
+    },
+    {
+      label: "面料下覆",
+      field: "ls_x_m_cover_qty"
+    },
+    {
+      label: "面拆",
+      field: "ls_if_m_chai"
+    },
+    {
+      label: "中拆",
+      field: "ls_if_z_chai"
+    },
+    {
+      label: "底拆",
+      field: "ls_if_d_chai"
+    },
+    {
+      label: "物料单价",
+      field: "ls_price"
+    },
+    {
+      label: "物料克重",
+      field: "ls_gram_weight"
+    },
+    {
+      label: "幅宽",
+      field: "ls_cloth_width"
+    },
+    {
+      label: "数量",
+      field: "ls_qty"
+    },
+    {
+      label: "物料厚度",
+      field: "ls_if_inputqty"
+    },
+    {
+      label: "固定厚度",
+      field: "ls_if_inputqty"
+    },
+    {
+      label: "厚度",
+      field: "ls_thickness"
+    },
+    {
+      label: "按面积单价",
+      field: "ls_if_areaprice"
+    },
+    {
+      label: "物料名称",
+      field: "ls_mtrlname"
+    },
+    {
+      label: "木托方式",
+      field: "ls_woodpallettype",
+      enum: [
+        { label: "  '普通木托'   ", value: "0" },
+        { label: "  '夹板木托'   ", value: "1" },
+        { label: "  '铁管木托'   ", value: "2" }
+      ]
+    }
+  ]);
+
+  /**
+   * @description 明细表计算公式
+   */
+  const summaryMxData = ref<any>([
+    {
+      label: "计算成本金额",
+      field: "costamt",
+      formula: ""
+    },
+    {
+      label: "计算清单用量",
+      field: "useqty",
+      formula: ""
+    }
+  ]);
+
   const funcMergeColumn = (columns: any, target: any) => {
     return columns.map(t => {
       let itm = target.find(item => t.field === item.field);
@@ -2699,11 +3521,13 @@ export const useHooks = (t?: any) => {
     funcChaifenTab,
     getData_mx,
     dataCallback,
+    dataCallbackMx,
     getMattressType,
     gotoSummy,
     gotoHisprice,
     getFormulakindEnum,
     funcPacktypeChange,
-    dynamicRef
+    dynamicRef,
+    wf_cmp_cb
   };
 };

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

@@ -17,14 +17,6 @@
       <!-- 表格 header 按钮 -->
       <template #tableHeader>
         <LjHeaderMenu :update="dialogVisible" :action="action" />
-        <!-- <el-button-group>
-          <el-button @click="toAdd">{{ $t("common.add") }}</el-button>
-          <el-button @click="toDel">{{ $t("common.delText") }}</el-button>
-          <el-button @click="toA">{{ $t("common.auditFinance") }}</el-button>
-          <el-button @click="toAdd">{{ $t("common.copyQuote") }}</el-button>
-          <el-button @click="toAdd">{{ $t("common.businessOrder") }}</el-button>
-          <el-button @click="toAdd">{{ $t("common.viewHistoricalQuotes") }}</el-button>
-        </el-button-group> -->
       </template>
     </LjVxeTable>
   </div>
@@ -58,7 +50,7 @@ import { saveAs } from "file-saver";
 const { t } = useI18n();
 const router = useRouter();
 const globalStore = useGlobalStore();
-const { columns } = useHooks();
+const { columns, dataCallback } = useHooks();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const initParams = ref({});
@@ -99,17 +91,6 @@ const getData = (params: any) => {
   // return [];
 };
 
-const dataCallback = (data: any) => {
-  console.log("data :>> ", data);
-  return {
-    list: data.datatable,
-    tableinfo: data.tableinfo,
-    total: data.totalcnt,
-    pageNum: data.pageindex,
-    pageSize: data.pagesize
-  };
-};
-
 const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
   if (globalStore.detailBlank) {
     // 打开新的窗口
@@ -117,7 +98,7 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
       path: `/mattressQuote/detail`,
       query: {
         id: row.mattressid,
-        code: row.cuscode
+        code: row.mattresscode
       }
     });
     window.open(routeUrl.href, "_blank");
@@ -216,7 +197,12 @@ const action: detailAction[] = [
     label: t("common.add"),
     power: 72,
     clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+      console.log("inewss   nitParams.value :>> ", vxeTableRef.value.searchParam);
+      let _deptid = 0;
+      if (Object.keys(vxeTableRef.value.searchParam).includes("arg_deptid")) {
+        _deptid = vxeTableRef.value.searchParam.arg_deptid;
+      }
+      router.push(`/mattressQuote/new?id=0&deptid=${_deptid}`);
     }
   }),
   buttonDefault({

+ 97 - 1
JLHWEB/src/views/system/selector/mtrldef/index.vue

@@ -191,6 +191,100 @@ const autoUpdateTableCheckbox = () => {
   }
 };
 
+const getTypename = (ins_type: number) => {
+  let ls_typename = "";
+  switch (ins_type) {
+    case 0:
+      ls_typename = "钢线";
+      break;
+    case 1:
+      ls_typename = "包边海绵";
+      break;
+    case 2:
+      ls_typename = "无纺布";
+      break;
+    case 3:
+      ls_typename = "布料";
+      break;
+    case 4:
+      ls_typename = "裥绵海绵";
+      break;
+    case 5:
+      ls_typename = "喷胶绵";
+      break;
+    case 6:
+      ls_typename = "垫层";
+      break;
+    case 7:
+      ls_typename = "毡类";
+      break;
+    case 8:
+      ls_typename = "床垫辅料";
+      break;
+    case 9:
+      ls_typename = "边带";
+      break;
+    case 10:
+      ls_typename = "拉手";
+      break;
+    case 11:
+      ls_typename = "刺绣位置";
+      break;
+    case 12:
+      ls_typename = "大侧*上下压线位置";
+      break;
+    case 13:
+      ls_typename = "外袋";
+      break;
+    case 14:
+      ls_typename = "内袋";
+      break;
+    case 16:
+      ls_typename = "PE";
+      break;
+    case 17:
+      ls_typename = "外层PE";
+      break;
+    case 18:
+      ls_typename = "PVC";
+      break;
+    case 19:
+      ls_typename = "卷包包装";
+      break;
+    case 20:
+      ls_typename = "牛皮纸袋";
+      break;
+    case 21:
+      ls_typename = "蓝色PE护角";
+      break;
+    case 22:
+      ls_typename = "无纺布袋";
+      break;
+    case 23:
+      ls_typename = "牛皮袋护角";
+      break;
+    case 24:
+      ls_typename = "编织袋";
+      break;
+    case 31:
+      ls_typename = "拉链";
+      break;
+    case 32:
+      ls_typename = "其他工艺";
+      break;
+    case 29:
+      ls_typename = "顶布";
+      break;
+    case 1201:
+      ls_typename = "顶布裥棉";
+      break;
+    default:
+      ls_typename = "类型未定义";
+      break;
+  }
+  return ls_typename;
+};
+
 /**
  * @description 打开组件
  * @param params 入参
@@ -199,7 +293,9 @@ const show = (params: any, label?: string) => {
   selectList.value = [];
   searchInput.value = "";
 
-  subtitle.value = label;
+  subtitle.value = label ?? getTypename(params.arg_mtrltype);
+
+  console.log("params :>> ", params, label ?? getTypename(params.mtrltype));
 
   console.log("show bfff initParams.value :>> ", initParams.value, params);
   initParams.value = defaultsDeep(params, initParams.value);

+ 56 - 0
JLHWEB/src/views/system/selector/spring/hooks/index.ts

@@ -0,0 +1,56 @@
+import { ColumnProps, SearchProps } from "@/components/LjVxeTable/interface";
+import type { uSale } from "@/typings/modules/sale";
+import { Table } from "@/hooks/interface/index";
+import { useUserStore } from "@/stores/modules/user";
+
+export const useHooks = (t: any) => {
+  // 表格配置项
+  const columns: ColumnProps<any>[] = [
+    {
+      field: "line_diameter",
+      search: {
+        el: "input",
+        key: "arg_line_diameter"
+      }
+    },
+    {
+      field: "height",
+      search: {
+        el: "input",
+        key: "arg_height"
+      }
+    },
+    {
+      field: "caliber",
+      search: {
+        el: "input",
+        key: "arg_caliber"
+      }
+    },
+    {
+      field: "center_diameter",
+      search: {
+        el: "input",
+        key: "arg_center_diameter"
+      }
+    },
+    {
+      field: "cyclenum",
+      search: {
+        el: "input",
+        key: "arg_cyclenum"
+      }
+    },
+    {
+      field: "springtypeid",
+      search: {
+        el: "select",
+        key: "arg_springtypeid"
+      }
+    }
+  ];
+
+  return {
+    columns
+  };
+};

+ 221 - 0
JLHWEB/src/views/system/selector/spring/index.vue

@@ -0,0 +1,221 @@
+<template>
+  <LjSelector
+    ref="LjSelectorRef"
+    :title="`${$t('business.selector.spring.title')}`"
+    v-model:value="selectList"
+    v-bind="$attrs"
+    :item-key="TABLE_KEY"
+    :layout="layout"
+    @change-value="autoUpdateTableCheckbox"
+  >
+    <template #default>
+      <LjVxeTable
+        ref="LjTableRef"
+        table-cls=""
+        :columns="selColumns"
+        :request-api="getData"
+        :data-callback="dataCallback"
+        :init-param="initParams"
+        :dwname="DwnameEnum.mtrlPrice"
+        pagination
+        :search-col="tableSearchCol"
+        :table-events="tableEvents"
+        :table-props="tableProps"
+        :tool-button="['refresh', 'setting', 'search']"
+        :auto-load-layout="false"
+        collapse-buttons
+        :page-change-call-back="autoUpdateTableCheckbox"
+      >
+        <!-- <template #tableHeader>
+          <el-input
+            v-model="searchInput"
+            size="default"
+            class="mb-8"
+            :prefix-icon="Search"
+            clearable
+            @input="disshow"
+            @clear="() => disshow('')"
+            placeholder="物料名称/备注"
+          ></el-input>
+        </template> -->
+      </LjVxeTable>
+    </template>
+  </LjSelector>
+</template>
+
+<script lang="tsx" setup name="SelectorMtrldefDialog">
+import { reactive, toRefs, ref, onMounted, nextTick, inject, watch, computed } from "vue";
+// import LjDialog from "@/components/LjDialog/index.vue";
+// import LjFoldLayoutDouble from "@/components/LjFoldLayoutDouble/index.vue";
+import LjVxeTable from "@/components/LjVxeTable/index.vue";
+// 注意: 需要按需引入使用到的第三方UI组件
+// import { ElDialog, ElButton } from "element-plus";
+
+import { useHooks } from "./hooks/index";
+import { useI18n } from "vue-i18n";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import { cloneDeep, pick, defaultsDeep } from "lodash-es";
+import { CommonDynamicSelect } from "@/api/modules/common";
+// import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
+import { useAuthButtons } from "@/hooks/useAuthButtons";
+
+import LjSelector from "@/components/LjSelector/index.vue";
+import { throttle } from "lodash-es";
+import { Search } from "@element-plus/icons-vue";
+// import variables from "@/styles/js.module.scss";
+
+// const props = withDefaults(defineProps<{}>(), {});
+
+const { t } = useI18n();
+const { columns } = useHooks(t);
+const selColumns: any = computed(() => {
+  // let selCol: any = { type: "checkbox", width: 50, fixed: "left" };
+  let selCol: any = { type: "radio", width: 50, fixed: "left" };
+  let _columns = cloneDeep(columns);
+  // console.log(" _columns.unshift(selCol); :>> ", _columns.unshift(selCol));
+  _columns.unshift(selCol);
+  console.log("_columns :>> ", _columns);
+  return _columns;
+});
+
+/**
+ * @description 已选列表
+ */
+const selectList = ref<any>([]);
+const TABLE_KEY = "mtrlid";
+const layout = { first: { left: { hidden: true } } };
+
+const LjSelectorRef = ref();
+const LjTableRef = ref();
+// const _variables: any = variables;
+const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
+
+const initParams = ref<any>({});
+const searchInput = ref("");
+const tableSearchCol = { xs: 8, sm: 8, md: 8, lg: 8, xl: 8 };
+const tableProps = {
+  height: "auto",
+  editConfig: { trigger: "click", mode: "cell" },
+  rowConfig: { isCurrent: true, isHover: true, useKey: true, keyField: TABLE_KEY }
+};
+
+const subtitle = ref("");
+
+/**
+ * @description 鼠标单击表格
+ */
+const handleClickTable = async ({ row, column, rowIndex }: any) => {
+  const $table = LjTableRef.value.element;
+  if ($table) {
+    selectList.value = [row];
+    $table.setRadioRow(row);
+  }
+};
+
+/**
+ * @description 鼠标双击表格
+ */
+const handleDBlClickTable = async ({ row, column, rowIndex }: any) => {
+  const $table = LjTableRef.value.element;
+  if ($table) {
+    selectList.value = [row];
+    $table.setRadioRow(row);
+
+    LjSelectorRef.value.funcSubmit();
+  }
+};
+
+// 返回绑定的事件
+const tableEvents = {
+  "cell-dblclick": handleDBlClickTable,
+  "cell-click": handleClickTable
+};
+
+// const selectedLayout = ref<any>({
+//   icon: "iconmove",
+//   header: [
+//     {
+//       value: "name",
+//       // icon: "iconuser-01",
+//       textClassName: "text-ellipsis-one2"
+//     },
+//     {
+//       value: "cuscode",
+//       // label: "描述",
+//       icon: "iconcode",
+//       textClassName: "text-ellipsis-one2"
+//     }
+//   ]
+//   // aside: {
+//   //   value: "cuscode"
+//   // }
+// });
+
+const dataCallback = (data: any) => {
+  console.log("data :>> ", data);
+  return {
+    list: data.datatable,
+    tableinfo: data.tableinfo,
+    total: data.totalcnt,
+    pageNum: data.pageindex,
+    pageSize: data.pagesize
+  };
+};
+
+const getData = (params: any) => {
+  // console.log("getData params :>> ", params);
+  let newParams: any = {};
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+
+  delete params.pageNum;
+  delete params.pageSize;
+  // newParams.queryParams = initParams.value;
+  newParams.queryParams = params;
+  console.log("params :>> ", newParams);
+  newParams.dsname = "web_spring_define_choose";
+  return CommonDynamicSelect(newParams, DwnameEnum.bednetSpringChoose);
+};
+
+const autoUpdateTableCheckbox = () => {
+  const $table = LjTableRef.value.element;
+  if ($table && selectList.value.length) {
+    console.log("autoUpdateTableCheckbox selectLst.value :>> ", selectList.value);
+    $table.clearCheckboxRow();
+    let _rows: any = [];
+    selectList.value.map((item: any) => {
+      if ($table.getRowById(item[TABLE_KEY])) {
+        _rows.push($table.getRowById(item[TABLE_KEY]));
+      }
+    });
+    _rows.length && $table.setCheckboxRow(_rows, true);
+  }
+};
+
+/**
+ * @description 打开组件
+ * @param params 入参
+ */
+const show = (params: any, label?: string) => {
+  selectList.value = [];
+  searchInput.value = "";
+
+  console.log("show bfff initParams.value :>> ", initParams.value, params);
+  initParams.value = defaultsDeep(params, initParams.value);
+  console.log("show afff initParams.value :>> ", initParams.value);
+  LjSelectorRef.value.show(initParams.value);
+};
+
+// 节流
+const disshow = throttle((val: any) => {
+  console.log("val :>> ", val);
+  // initParams.value = defaultsDeep({ keyword: val }, initParams.value);
+  initParams.value.keyword = val;
+
+  console.log("disshow initParams.value :>> ", initParams.value);
+}, 500);
+
+defineExpose({
+  show
+});
+</script>

+ 113 - 0
JLHWEB/src/views/system/selector/spring/select.vue

@@ -0,0 +1,113 @@
+<template>
+  <LjSelectorSelect
+    ref="selectStationRef"
+    v-model:value="props.value"
+    value-key="springid"
+    :loading="loading"
+    v-bind="$attrs"
+    :remote-method="remoteMethod"
+    @select="handleSelect"
+    @open-modal="openModal"
+  >
+    <template #header>
+      <div class="table-header lj-select__table">
+        <div class="table-tr">
+          <div class="table-td pr-4" style="width: 200px">{{ $t("table.u_mtrl_price.name") }}</div>
+        </div>
+      </div>
+    </template>
+    <el-option
+      v-for="item in options"
+      :key="item.springid"
+      :label="item.name"
+      :value="item"
+      class="lj-select__table pl-10 pr-10"
+      :class="{
+        'w-full': item.label
+      }"
+    >
+      <template v-if="item.label">
+        <div class="table-tr w-full text-center">{{ item.label }}</div>
+      </template>
+      <template v-else>
+        <div class="table-tr">
+          <div style="width: 200px" class="table-td pr-4 text-ellipsis-one" :title="item.name">{{ item.name }}</div>
+        </div>
+      </template>
+    </el-option>
+    <!-- <template #footer>
+      <el-radio-group v-model="isuse" size="small" @change="remoteMethod">
+        <el-radio-button label="全部" value="全部" />
+        <el-radio-button label="有效" value="有效" />
+        <el-radio-button label="无效" value="无效" />
+      </el-radio-group>
+    </template> -->
+  </LjSelectorSelect>
+</template>
+
+<script lang="ts" setup name="SelectorSpringSelect">
+import { ref, computed } from "vue";
+import { CommonDynamicSelect } from "@/api/modules/common";
+import { DwnameEnum } from "@/enums/dwnameEnum";
+import LjSelectorSelect from "@/components/LjSelector/select.vue";
+import { useUserStore } from "@/stores/modules/user";
+
+interface ProTableProps {
+  value: any;
+  [key: string]: any;
+}
+
+// 默认值
+const props = withDefaults(defineProps<ProTableProps>(), {});
+const { userInfo } = useUserStore();
+const emit = defineEmits(["select", "update:value", "openModal"]);
+const loading = ref(false);
+
+const options = ref<any[]>([]);
+// const isuse = ref("有效");
+
+const pricePower = computed(() => {
+  return userInfo.rsltFunids.includes(96);
+});
+
+const remoteMethod = async (queryString: string) => {
+  console.log("remoteMethod props :>> ", props, queryString);
+  loading.value = true;
+
+  let newParams: any = {};
+  newParams.pageindex = 1;
+  newParams.pagesize = 5;
+  newParams.queryParams = {
+    arg_search: queryString
+  };
+  newParams.dsname = "web_spring_define_choose";
+  let result = await CommonDynamicSelect(newParams, DwnameEnum.bednetSpringChoose);
+
+  console.log("result.datatable :>> ", result.datatable);
+  if (result.datatable.length) {
+    // options.value = result.datatable.map(item => {
+    //   item.label = item.cuscode;
+    //   return item;
+    // });
+    options.value = result.datatable;
+  } else {
+    options.value = [
+      {
+        label: "暂无数据",
+        disabled: true
+      }
+    ];
+  }
+
+  loading.value = false;
+};
+
+const handleSelect = (item: any) => {
+  console.log("handleSelect item :>> ", item);
+  emit("select", item);
+};
+
+const openModal = (e: any) => {
+  emit("openModal", e);
+};
+</script>