Browse Source

JLHWEB: 床网报价修改

JohnnyChan 7 months ago
parent
commit
af582f078e

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

@@ -1073,15 +1073,12 @@ export namespace Basicinfo {
   export interface ReqDeleteBasicinfo {
     list: any[];
   }
-  export interface ResDeleteBasicinfo {
-
-  }
+  export interface ResDeleteBasicinfo {}
   export interface ReqBanBasicinfo {
     list: any[];
     type: Number;
   }
-  export interface ResBanBasicinfo {
-  }
+  export interface ResBanBasicinfo {}
   export interface ReqSaveBedNetType {
     bednet: any;
   }
@@ -1168,6 +1165,7 @@ export namespace Mattress {
   }
   export interface ResSaveMattress {
     mattressid: number;
+    message: string;
   }
   export interface ReqMultiMattress {
     mattressids: number[];
@@ -1189,8 +1187,11 @@ export namespace Mattress {
   }
   export interface ReqSaveBedNet {
     bednet: any;
+    bednetMx: any;
+    spring: any;
   }
   export interface ResSaveBedNet {
     bednet: any;
+    message: string;
   }
 }

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

@@ -64,3 +64,17 @@ export const AuditBedNet = (params: Mattress.ReqMultiMattressBcp) => {
 export const DeleteBedNet = (params: Mattress.ReqMultiMattressBcp) => {
   return http.post(PORT1 + `/DeleteBedNet`, params);
 };
+
+/**
+ * @name 床垫报价:计算
+ */
+export const GetComputeMattress = (params: Mattress.ReqSaveMattress) => {
+  return http.post<Mattress.ResSaveMattress>(PORT1 + `/GetComputeMattress`, params);
+};
+
+/**
+ * @name 床网报价:计算
+ */
+export const GetComputeBednet = (params: Mattress.ReqSaveBedNet) => {
+  return http.post<Mattress.ResSaveBedNet>(PORT1 + `/GetComputeBednet`, params);
+};

+ 86 - 81
JLHWEB/src/components/LjDetail/index.vue

@@ -1519,6 +1519,7 @@ const tasItemRender = (data: detailModelItemProp, renderFnc: any, header = true)
  * @param rProp prop
  */
 const RenderTabs = (rProps: DetailProp) => {
+  console.log("RenderTabs. :>> ", rProps, _mainData.value);
   let tabRender: any = [];
   let _sticky = rProps.header?.tabsProp?.sticky ?? DETAIL_LAYOUT_DEFINE.tabsProp.sticky;
 
@@ -1545,74 +1546,78 @@ const RenderTabs = (rProps: DetailProp) => {
     //   }
     // }
 
-    tabRender = rProps.mould.map((item: detailModelItemProp) => {
-      // console.log("tasItemRender item :>> ", item);
-      let _limited = isFunction(item?.limited) ? item.limited(_mainData.value) : item?.limited ?? false;
-      if (_limited) return;
-      if (!item.isHidden) {
-        if (slots[item.id]) {
-          return tasItemRender(item, () => {
-            let val = _detailData.value && _detailData.value[item.id];
-            return slots[item.id]?.({
-              data: _mainData.value,
-              props: item,
-              orderStatus: orderStatus.value,
-              isScrollspy: isScrollspy.value,
-              layout: currentMould.value.header
+    tabRender = rProps.mould
+      .map((item: detailModelItemProp) => {
+        // console.log("tasItemRender item :>> ", item);
+        let _limited = isFunction(item?.limited) ? item.limited(_mainData.value) : item?.limited ?? false;
+        if (_limited) return false;
+        if (!item.isHidden) {
+          if (slots[item.id]) {
+            return tasItemRender(item, () => {
+              let val = _detailData.value && _detailData.value[item.id];
+              return slots[item.id]?.({
+                data: _mainData.value,
+                props: item,
+                orderStatus: orderStatus.value,
+                isScrollspy: isScrollspy.value,
+                layout: currentMould.value.header
+              });
             });
-          });
-        } else if (item.render) {
-          return tasItemRender(item, () => {
-            let val = _detailData.value && _detailData.value[item.id];
-            return item.render && item.render(val);
-          });
-        } else {
-          return tasItemRender(
-            item,
-            () => {
-              // if (item.type == "base") {c
-              //   console.log("item.id!!! :>> ", item);
-              //   return (
-              //     <>
-              //       <div class="flx">
-              //         <div class="flx-1">
-              //           {slots[item.id] ? (
-              //             slots[item.id]?.({ data: _mainData.value, props: infoColumns.value, orderStatus: orderStatus.value })
-              //           ) : (
-              //             <BaseForm
-              //               columns={infoColumns.value}
-              //               searchParam={_params}
-              //               searchCol={{ xs: 2, sm: 4, md: 5, lg: 6, xl: 6 }}
-              //               {...item.props}
-              //               formProps={tableOptions.basicinfo ?? {}}
-              //               layoutAttrDefine={basicinfoFormDefaultComputed}
-              //               onConfirm={saveBasicSettingFunc}
-              //               onReset={resetBasicSettingFunc}
-              //               onSaveDefault={saveDefaultLayout}
-              //             />
-              //           )}
-              //         </div>
-              //         {slots.headerAside ? (
-              //           <div class="flx-shrink ml-12 enter-x">
-              //             {slots.headerAside({ data: _mainData.value, props: infoColumns.value })}
-              //           </div>
-              //         ) : (
-              //           ""
-              //         )}
-              //       </div>
-              //     </>
-              //   );
-              // } else {
-              return item.label;
-              // }
-            },
-            false
-          );
+          } else if (item.render) {
+            return tasItemRender(item, () => {
+              let val = _detailData.value && _detailData.value[item.id];
+              return item.render && item.render(val);
+            });
+          } else {
+            return tasItemRender(
+              item,
+              () => {
+                // if (item.type == "base") {c
+                //   console.log("item.id!!! :>> ", item);
+                //   return (
+                //     <>
+                //       <div class="flx">
+                //         <div class="flx-1">
+                //           {slots[item.id] ? (
+                //             slots[item.id]?.({ data: _mainData.value, props: infoColumns.value, orderStatus: orderStatus.value })
+                //           ) : (
+                //             <BaseForm
+                //               columns={infoColumns.value}
+                //               searchParam={_params}
+                //               searchCol={{ xs: 2, sm: 4, md: 5, lg: 6, xl: 6 }}
+                //               {...item.props}
+                //               formProps={tableOptions.basicinfo ?? {}}
+                //               layoutAttrDefine={basicinfoFormDefaultComputed}
+                //               onConfirm={saveBasicSettingFunc}
+                //               onReset={resetBasicSettingFunc}
+                //               onSaveDefault={saveDefaultLayout}
+                //             />
+                //           )}
+                //         </div>
+                //         {slots.headerAside ? (
+                //           <div class="flx-shrink ml-12 enter-x">
+                //             {slots.headerAside({ data: _mainData.value, props: infoColumns.value })}
+                //           </div>
+                //         ) : (
+                //           ""
+                //         )}
+                //       </div>
+                //     </>
+                //   );
+                // } else {
+                return item.label;
+                // }
+              },
+              false
+            );
+          }
         }
-      }
-    });
-  } else {
-    return;
+      })
+      .filter(Boolean);
+
+    // if (!tabRender.length) return;
+    // } else {
+    //   return;
   }
 
   let tabsSlot: any = {};
@@ -1624,19 +1629,21 @@ const RenderTabs = (rProps: DetailProp) => {
 
   return (
     <>
-      <van-tabs
-        class={`${prefixCls}__tabs ${isScrollspy.value ? "scrollspy" : ""}`}
-        v-model:active={tabsActive.value}
-        scrollspy={isScrollspy.value}
-        sticky={isScrollspy.value ? _sticky : false}
-        shrink={true}
-        offsetTop={headerAffixTop.value + headerAffixHeight.value}
-        lazy-render={false}
-        onClickTab={handleClickTabs}
-        v-slots={tabsSlot}
-      >
-        {tabRender}
-      </van-tabs>
+      {tabRender.length > 0 && (
+        <van-tabs
+          class={`${prefixCls}__tabs ${isScrollspy.value ? "scrollspy" : ""}`}
+          v-model:active={tabsActive.value}
+          scrollspy={isScrollspy.value}
+          sticky={isScrollspy.value ? _sticky : false}
+          shrink={true}
+          offsetTop={headerAffixTop.value + headerAffixHeight.value}
+          lazy-render={false}
+          onClickTab={handleClickTabs}
+          v-slots={tabsSlot}
+        >
+          {tabRender}
+        </van-tabs>
+      )}
     </>
   );
 };
@@ -1740,8 +1747,6 @@ const RenderLjDetail = (rProps: DetailProp) => {
     return (
       <>
         <div ref="LjDetailRef" class={`${prefixCls} ${assemblySize} fold-vertical`} id={prefixCls}>
-          {/* {orderStatus.value != "new" && RenderDetailHeader(rProps)} */}
-
           {rProps.ifFoldLayout ? (
             <LjFoldLayout
               ref={LjFoldLayoutRef}

+ 2 - 1
JLHWEB/src/components/LjVxeTable/components/TableColumn.vue

@@ -68,7 +68,8 @@ const RenderTableColumn: any = (item: ColumnProps) => {
     }
   };
 
-  if (item?.editRender && !Object.keys(item.editRender).length) {
+  // if (item?.editRender && !Object.keys(item.editRender).length) {
+  if (item?.editColRender) {
     _vxeCloumnSolt.edit = (scope: RenderScope<any>) => {
       if (item.editColRender) return item.editColRender({ ...scope, enum: enumData, field: item.field });
       if (slots["edit_" + handleProp(item.field!)]) return slots["edit_" + handleProp(item.field!)]!(scope);

+ 4 - 1
JLHWEB/src/components/LjVxeTable/index.vue

@@ -978,7 +978,10 @@ const defineFooterMethod = ({ columns, data }: any) => {
       if (columnIndex === 1) {
         return data.length;
       }
-      if ((column.field && column.field.indexOf("qty") > -1) || props.footerSumAttrs?.includes(column.field)) {
+      if (
+        (!props.footerSumAttrs && column.field && column.field.indexOf("qty") > -1) ||
+        props.footerSumAttrs?.includes(column.field)
+      ) {
         let count = 0;
         data.forEach((item: any) => {
           count = floatAdd(count, isNaN(Number(item[column.field])) ? 0 : Number(item[column.field]));

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

@@ -283,6 +283,9 @@
     },
     "spring": {
       "title": "弹簧选择"
+    },
+    "bednet": {
+      "title": "床网选择"
     }
   },
   "sptPriceChange": {

+ 2 - 1
JLHWEB/src/languages/modules/zh-cn/table.json

@@ -1559,6 +1559,7 @@
     "deptname": "部门",
     "keyword": "编码/名称",
     "bednetcode": "床网编码",
-    "bednetname": "床网名称"
+    "bednetname": "床网名称",
+    "typename": "类型"
   }
 }

+ 7 - 0
JLHWEB/src/styles/common.scss

@@ -542,3 +542,10 @@
     }
   }
 }
+
+.vxe-edit-col-middle {
+  display: block !important;
+  .el-checkbox__input {
+    vertical-align: bottom;
+  }
+}

+ 2 - 1
JLHWEB/src/styles/element.scss

@@ -341,7 +341,8 @@
   }
 }
 
-.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after {
+.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after,
+.is-disabled.el-checkbox__disabled-checked .el-checkbox__inner:after {
   border-color: var(--lj-color-gray-2) !important;
 }
 

+ 11 - 14
JLHWEB/src/views/baseinfo/bednetarea/index.vue

@@ -106,10 +106,11 @@ const orderEditAction = [
           arr.push(Number(save_data[key]));
         }
       }
+      console.log("hasZerosBetweenNonZeroNumbers(arr) :>> ", hasZerosBetweenNonZeroNumbers(arr));
 
       // 判断数值连续填写,中间不能有0
-      if (hasZerosBetweenNonZeroNumbers(arr) > 0) {
-        ElMessage.error(`分区比例应连续不间断填写,${hasZerosBetweenNonZeroNumbers(arr)}区不能为0`);
+      if (hasZerosBetweenNonZeroNumbers(arr)) {
+        ElMessage.error(`分区比例应连续不间断填写`);
         return false;
       }
 
@@ -126,22 +127,18 @@ const orderEditAction = [
  * @param {number} 存在0的位置
  */
 function hasZerosBetweenNonZeroNumbers(arr) {
-  let foundNonZero = false;
-  let hasZeros = false;
+  while (arr[arr.length - 1] === 0) {
+    arr.pop();
+  }
 
+  let hasZeroBetweenNonZero = false;
   for (let i = 0; i < arr.length; i++) {
-    if (Number(arr[i]) !== 0) {
-      if (foundNonZero && hasZeros) {
-        return i;
-      }
-      foundNonZero = true;
-      hasZeros = true;
-    } else if (foundNonZero) {
-      hasZeros = true;
+    if (arr[i] !== 0 && arr[i + 1] === 0) {
+      hasZeroBetweenNonZero = true;
+      break;
     }
   }
-
-  return 0;
+  return hasZeroBetweenNonZero;
 }
 
 /*

+ 15 - 8
JLHWEB/src/views/baseinfo/bednetvar/detail.vue

@@ -5,16 +5,20 @@
     v-bind="detailProps"
     v-model:order-status="orderStatus"
     :data="mainData"
-    :init-param="mainData[0]"
     :if-fold-layout="false"
     :if-layout-editable="false"
     :search-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
     :basic-group-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
     :enum="props.enum"
+    :if-basic-editable="false"
   >
     <!-- :action="orderStatus ? orderEditAction : orderDefaultAction" -->
-    <template #mxList>
+    <template #mxList="scope">
+      <!-- {{ scope }}
+      {{ LjDetailRef?._mainData.varclass }}
+      {{ LjDetailRef?._mainData?.varclass != "2" }} -->
       <LjVxeTable
+        v-if="scope?.data?.varclass != '2'"
         ref="VxeTableMxRef"
         row-key="varmxid"
         table-cls=""
@@ -26,7 +30,6 @@
         :table-props="tableProps"
         :auto-load-layout="false"
         :collapse-buttons="true"
-        v-if="showTable"
         :table-buttons="[]"
       >
       </LjVxeTable>
@@ -38,7 +41,7 @@
 import { ref, watch, reactive, inject, onMounted } from "vue";
 import { DwnameEnum } from "@/enums/dwnameEnum";
 import LjDetail from "@/components/LjDetail/index.vue";
-import { DetailProp } from "@/components/LjDetail/interface";
+import { DetailProp, detailModelItemProp } from "@/components/LjDetail/interface";
 import { useI18n } from "vue-i18n";
 import { useHooks } from "./hooks/index";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
@@ -81,7 +84,6 @@ const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const mainData = ref([{}]);
 const initParams_mx = ref({ varid: 0, varclass: 0 });
-const showTable = ref(false as Boolean);
 
 /**
  * @description 是否可编辑
@@ -109,8 +111,14 @@ const detailProps = reactive<DetailProp>({
     {
       id: "mxList",
       type: "table",
-      label: "变量明细定义",
-      isHidden: false
+      label: "变量明细定义"
+      // limited: (params: any) => {
+      //   console.log("mxList params?.if_w_butao :>> ", params);
+      //   if (!params) return true;
+      //   console.log("params?.varclass :>> ", params?.varclass);
+      //   return Number(params?.varclass) == 2;
+      //   // return true;
+      // }
     }
   ]
 });
@@ -150,7 +158,6 @@ watch(
     initParams_mx.value.varid = parseInt(val.varid);
     initParams_mx.value.varclass = parseInt(val.varclass);
     fChangeBedNetType(parseInt(val.varclass));
-    showTable.value = parseInt(val.varclass) < 3;
   },
   { immediate: true }
 );

+ 2 - 0
JLHWEB/src/views/baseinfo/bednetvar/hooks/index.tsx

@@ -72,6 +72,8 @@ export const useHooks = (t: any, handleSelMxData: (params: any) => any) => {
         defaultValue: "0",
         props: {
           onChange: (value: any) => {
+            console.log("value :>> ", value);
+            console.log("Lj :>> ", state.LjDetailRef._mainData);
             value = parseInt(value);
             handleSelMxData(value);
             fChangeBedNetType(value);

+ 6 - 4
JLHWEB/src/views/baseinfo/bednetvar/index.vue

@@ -218,10 +218,12 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
 };
 
 const handleOpenNewTable = () => {
-  mainData.value = {
-    varid: 0,
-    varclass: 0
-  };
+  mainData.value = [
+    {
+      varid: 0,
+      varclass: "0"
+    }
+  ];
   varname.value = "";
   orderStatus.value = "new";
   LjDrawerRef.value.show();

+ 170 - 10
JLHWEB/src/views/quote/bednetQuote/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <LjDetail
-    name="rpMustPayCrmDetail"
     ref="LjDetailRef"
+    name="rpMustPayCrmDetail"
     v-bind="detailProps"
     :request-api="getData"
     :data-callback="dataCallback"
@@ -19,19 +19,20 @@
           style="min-width: 542px"
           v-if="bednetMxData.length && Number(LjDetailRef._mainData.bednettypeid) == 11 && Number(bednetMxData[0].if_part)"
         >
-          <!-- v-if="bednetMxSprintData.length" -->
+          <!-- v-if="bednetMxSpringData.length" -->
           <LjVxeTable
             ref="vxeTableMxSpringRef"
             row-key="bednetmx_partid"
             table-cls=""
             :columns="columnsMxSpring"
-            :data="bednetMxSprintData"
+            :data="bednetMxSpringData"
             :dwname="DwnameEnum.bednetQuoteMxSpring"
-            :table-props="tableProps_mx"
+            :table-props="tableProps_spring"
             :auto-load-layout="false"
             :tool-button="[]"
             :search-btn-size-extent="[]"
             collapseButtons
+            :footer-sum-attrs="['springname', 'spring_qty_length']"
             :request-auto="false"
           >
             <template #tableHeader>
@@ -92,7 +93,7 @@ import LjVxeTable from "@/components/LjVxeTable/index.vue";
 // import { cloneDeep } from "lodash-es";
 import { useRoute, useRouter } from "vue-router";
 import { CommonDynamicSelect, GetFormulaCompute } from "@/api/modules/common";
-import { SaveBedNet, AuditBedNet, DeleteBedNet } from "@/api/modules/quote";
+import { SaveBedNet, AuditBedNet, DeleteBedNet, GetComputeBednet } 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";
@@ -121,7 +122,7 @@ const {
   initParamsMxSpring,
   orderStatus,
   bednetMxData,
-  bednetMxSprintData,
+  bednetMxSpringData,
   vxeTableMxRef,
   vxeTableMxSpringRef,
   MtrldefDialogRef,
@@ -158,7 +159,87 @@ const tableProps_mx = ref({
   align: "left",
   // height: "",
   minHeight: "300px",
-  editConfig: { trigger: "click", mode: "row", enabled: false },
+  editConfig: { trigger: "click", mode: "row", enabled: false, autoFocus: true },
+  editRules: {
+    bednet_height: [
+      { required: true, message: "请输入" },
+      {
+        validator({ cellValue }) {
+          if (Number(cellValue) <= 0) {
+            return new Error("请输入正数");
+          }
+        }
+      }
+    ],
+    spring_qty_width: [
+      { required: true, message: "请输入" },
+      {
+        validator({ cellValue }) {
+          if (Number(cellValue) <= 0) {
+            return new Error("请输入正数");
+          }
+        }
+      }
+    ],
+    spring_qty_length: [
+      { required: true, message: "请输入" },
+      {
+        validator({ cellValue }) {
+          if (Number(cellValue) <= 0) {
+            return new Error("请输入正数");
+          }
+        }
+      }
+    ],
+    springname: [
+      {
+        validator({ cellValue, row }) {
+          console.log("springname cellValue :>> ", cellValue, cellValue == "", Number(row.if_part) == 0, row);
+          if (cellValue == "" && Number(row.if_part) == 0) {
+            return new Error("请选择弹簧");
+          }
+        }
+      }
+    ]
+  },
+  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 tableProps_spring = ref({
+  height: "auto",
+  align: "left",
+  // height: "",
+  minHeight: "300px",
+  editConfig: { trigger: "click", mode: "row", enabled: false, autoFocus: true },
+  editRules: {
+    springname: [
+      {
+        validator({ cellValue, row }) {
+          console.log("springname cellValue :>> ", cellValue, row);
+          if (cellValue == "" && Number(row.spring_qty_length) > 0) {
+            return new Error("请选择弹簧");
+          }
+        }
+      }
+    ]
+  },
   keyboardConfig: {
     isEdit: true,
     isArrow: true,
@@ -248,12 +329,47 @@ const orderDefaultAction: detailAction[] = [
       try {
         await LjDetailRef.value.toValidateForm();
 
+        const $table = vxeTableMxRef.value.element;
+        console.log("vxeTableMxRef $table :>> ", $table);
+        if ($table) {
+          const errMap = await $table.validate(true);
+          console.log("vxeTableMxRef errMap :>> ", errMap);
+          if (errMap) {
+            // VxeUI.modal.message({ status: 'error', content: '校验不通过!' })
+            return false;
+          }
+        }
+
+        const $tableSpring = vxeTableMxSpringRef.value?.element;
+        console.log("vxeTableMxRef $tableSpring :>> ", $tableSpring);
+        if ($tableSpring) {
+          const errMap = await $tableSpring.validate(true);
+          console.log("vxeTableMxRef errMap :>> ", errMap);
+          if (errMap) {
+            // VxeUI.modal.message({ status: 'error', content: '校验不通过!' })
+            return false;
+          }
+        }
+
         if (!(await wf_cmp_cb())) return;
 
         let bednet = LjDetailRef.value._mainData;
+        bednet.if_doublenet = Number(bednet.if_doublenet);
+        bednet.if_doublespring = Number(bednet.if_doublespring);
+        bednet.if_side_iron = Number(bednet.if_side_iron);
+        bednet.if_rsorwa = Number(bednet.if_rsorwa);
+        bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
+        bednet.iffork = Number(bednet.iffork);
         bednet.ifsaleout = Number(bednet.ifsaleout);
+        bednet.if_jb = Number(bednet.if_jb);
 
         let bednetMx = vxeTableMxRef.value?.element.getTableData().fullData;
+        console.log("bednetMx :>> ", bednetMx, vxeTableMxRef.value?.element.getTableData().fullData);
+        bednetMx[0].if_side_iron = Number(bednetMx[0].if_side_iron);
+        bednetMx[0].if_part = Number(bednetMx[0].if_part);
+        bednetMx[0].if_15strip = Number(bednetMx[0].if_15strip);
+        bednetMx[0].if_pocket_around = Number(bednetMx[0].if_pocket_around);
+        bednetMx[0].if_hard_around = Number(bednetMx[0].if_hard_around);
 
         let spring = vxeTableMxSpringRef.value?.element.getTableData().fullData ?? [];
 
@@ -277,6 +393,15 @@ const orderDefaultAction: detailAction[] = [
               } else {
                 router.replace("/bednetQuote");
               }
+              setTimeout(() => {
+                if (res.message) {
+                  ElNotification({
+                    title: "计算失败",
+                    message: res.message,
+                    type: "warning"
+                  });
+                }
+              }, 100);
             })
             .catch(error => {
               console.log("error !! :>> ", error);
@@ -299,7 +424,7 @@ const orderDefaultAction: detailAction[] = [
       return !!orderStatus.value;
     },
     clickFunc: item => {
-      router.push(`/bednetQuote/new?id=0`);
+      router.push(`/bednetQuote/new?id=0&deptid=${LjDetailRef.value._mainData?.deptid ?? 0}`);
     }
   }),
   buttonDefault({
@@ -425,7 +550,41 @@ const orderDefaultAction: detailAction[] = [
     limited: () => {
       // 业务员模式
       return userInfo.usermode == 1;
+    },
+    clickFunc: async () => {
+      let bednet = LjDetailRef.value._mainData;
+      bednet.if_doublenet = Number(bednet.if_doublenet);
+      bednet.if_doublespring = Number(bednet.if_doublespring);
+      bednet.if_side_iron = Number(bednet.if_side_iron);
+      bednet.if_rsorwa = Number(bednet.if_rsorwa);
+      bednet.if_sponge_drilling = Number(bednet.if_sponge_drilling);
+      bednet.iffork = Number(bednet.iffork);
+      bednet.ifsaleout = Number(bednet.ifsaleout);
+      bednet.if_jb = Number(bednet.if_jb);
+      console.log("bednetMxSpringData :>> ", bednetMxSpringData);
+      console.log("vxeTableMxRef :>> ", vxeTableMxRef.value.element.getTableData());
+      console.log("bednetMxData :>> ", bednetMxData);
+      console.log("vxeTableMxSpringRef :>> ", vxeTableMxSpringRef.value?.element.getTableData());
+      let _params: any = {
+        bednet: bednet,
+        bednetMx: bednetMxData.value,
+        spring: bednetMxSpringData.value
+      };
+      let res = await GetComputeBednet(_params);
+      console.log("res :>> ", res);
+      if (res) {
+        let _data = {
+          total_cost: res.bednet.total_cost,
+          nottax_factory_cost: res.bednet.nottax_factory_cost,
+          nottax_dept_cost: res.bednet.nottax_dept_cost,
+          taxes: res.bednet.taxes,
+          dept_cost: res.bednet.dept_cost,
+          foreign_cost: res.bednet.foreign_cost
+        };
+        console.log("_data :>> ", _data);
+      }
     }
+    // gotoSummy()
   }),
   buttonDefault({
     label: t("common.copyQuote")
@@ -512,6 +671,7 @@ const funcAfterMound = async (data: any) => {
   } else {
     // 新增/编辑
     tableProps_mx.value.editConfig.enabled = true;
+    tableProps_spring.value.editConfig.enabled = true;
 
     let res = await getBedNetAreaList({});
 
@@ -559,13 +719,13 @@ const funcAfterMound = async (data: any) => {
     // res = await getDataMxSpring(initParamsMx.value);
     // result = dataCallbackMx(res);
     // columnsMxSpring.value = result.tableinfo.columns;
-    // bednetMxSprintData.value = result.list;
+    // bednetMxSpringData.value = result.list;
 
     reload_dw2(data, (params: any) => {
       const { mx, spring } = params;
       console.log("reload_dw2 22result :>> ", params);
       bednetMxData.value = mx.list;
-      bednetMxSprintData.value = spring.list;
+      bednetMxSpringData.value = spring.list;
 
       // vxeTableMxSpringRef.value.refresh();
     });

+ 117 - 61
JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx

@@ -28,7 +28,7 @@ interface defaultState {
   initParamsMx: any;
   initParamsMxSpring: any;
   bednetMxData: any;
-  bednetMxSprintData: any;
+  bednetMxSpringData: any;
   vxeTableMxRef: any;
   vxeTableMxSpringRef: any;
   MtrldefDialogRef: any;
@@ -53,7 +53,7 @@ const dw_bednet_define_add_mx = {
   wire_mtrlid: 0,
   springid: 0,
   springname: 0,
-  if_part: "0",
+  if_part: 0,
   if_15strip: 0,
   if_pocket_around: 0,
   pocket_around_springid: 0,
@@ -127,7 +127,7 @@ export const useHooks = (t?: any) => {
     initParamsMx: {},
     initParamsMxSpring: {},
     bednetMxData: [],
-    bednetMxSprintData: [],
+    bednetMxSpringData: [],
     MtrldefDialogRef: null,
     MtrldefDialogProps: {},
     SpringDialogRef: null,
@@ -282,6 +282,18 @@ export const useHooks = (t?: any) => {
     data.fabrics2_price = 0;
   };
 
+  const rModelSetHardAroundSpring = (data: any, item: any) => {
+    if (item) {
+      data.hard_around_springid = item.springid;
+      data.hard_around_springname = item.name;
+    }
+  };
+
+  const rModelClearHardAroundSpring = (data: any) => {
+    data.hard_around_springid = 0;
+    data.hard_around_springname = "";
+  };
+
   /**
    * @description 弹窗模块:选择物料
    * @param data 当前数据
@@ -400,7 +412,7 @@ export const useHooks = (t?: any) => {
    */
   const reload_dw2 = async (bednetData: any, cb?: any) => {
     state.bednetMxData = [];
-    state.bednetMxSprintData = [];
+    state.bednetMxSpringData = [];
     let res = await getDataMxAdd(state.initParamsMx);
     let result = dataCallbackMx(res);
 
@@ -490,9 +502,9 @@ export const useHooks = (t?: any) => {
     _mainData.fork_mtrl_formula = rBednetType.fork_mtrl_formula;
     _mainData.fork_hr_formula = rBednetType.fork_hr_formula;
 
-    _mainData.if_rsORwa = rBednetType.if_rsORwa;
-    _mainData.rsORwa_mtrl_formula = rBednetType.rsORwa_mtrl_formula;
-    _mainData.rsORwa_hr_formula = rBednetType.rsORwa_hr_formula;
+    _mainData.if_rsorwa = rBednetType.if_rsorwa;
+    _mainData.rsorwa_mtrl_formula = rBednetType.rsorwa_mtrl_formula;
+    _mainData.rsorwa_hr_formula = rBednetType.rsorwa_hr_formula;
     _mainData.sponge_drilling_hr_formula = rBednetType.sponge_drilling_hr_formula;
 
     _mainData.spring_mtrl_formula = rBednetType.spring_mtrl_formula;
@@ -521,7 +533,7 @@ export const useHooks = (t?: any) => {
     _mainData.fork_weight_formula = rBednetType.fork_weight_formula;
 
     reload_dw2(rBednetType, () => {
-      state.bednetMxData = [dw_bednet_define_add_mx];
+      state.bednetMxData = [cloneDeep(dw_bednet_define_add_mx)];
     });
 
     nextTick(() => {
@@ -544,23 +556,23 @@ export const useHooks = (t?: any) => {
     // return [];
   };
 
-  // /**
-  //  * @description 获取明细数据
-  //  * @param params
-  //  * @returns
-  //  */
-  // const getDataMx = (params: any) => {
-  //   console.log("getData beatad params :>> ", params);
-  //   let newParams: any = {};
-  //   params.pageNum && (newParams.pageindex = params.pageNum);
-  //   params.pageSize && (newParams.pagesize = params.pageSize);
-  //   delete params.pageNum;
-  //   delete params.pageSize;
-  //   newParams.queryParams = params;
-  //   console.log("params :>> ", params);
-  //   newParams.dsname = "web_bednet_mx";
-  //   return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
-  // };
+  /**
+   * @description 获取明细数据
+   * @param params
+   * @returns
+   */
+  const getDataMx = (params: any) => {
+    console.log("getData beatad params :>> ", params);
+    let newParams: any = {};
+    params.pageNum && (newParams.pageindex = params.pageNum);
+    params.pageSize && (newParams.pagesize = params.pageSize);
+    delete params.pageNum;
+    delete params.pageSize;
+    newParams.queryParams = params;
+    console.log("params :>> ", params);
+    newParams.dsname = "web_bednet_mx";
+    return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteMx);
+  };
 
   /**
    * @description 获取弹簧明细
@@ -596,7 +608,14 @@ export const useHooks = (t?: any) => {
   const dataCallback = (data: any) => {
     console.log("dataCallback data :>> ", data);
     let _list = data.datatable.map(t => {
+      t.if_doublenet = Boolean(t.if_doublenet);
+      t.if_doublespring = Boolean(t.if_doublespring);
+      t.if_side_iron = Boolean(t.if_side_iron);
+      t.if_rsorwa = Boolean(t.if_rsorwa);
+      t.if_sponge_drilling = Boolean(t.if_sponge_drilling);
+      t.iffork = Boolean(t.iffork);
       t.ifsaleout = Boolean(t.ifsaleout);
+      t.if_jb = Boolean(t.if_jb);
       return t;
     });
     return {
@@ -621,10 +640,11 @@ export const useHooks = (t?: any) => {
   };
 
   const handleBlur = (value: any, data: any, field: string) => {
-    value = (value + "").replace(/[^\d.]/g, "");
+    //保留小数点和-号
+    value = (value + "").replace(/[^-\d.]/g, "");
     console.log(value);
     // 保留整数部分
-    value = parseInt(value, 10).toString();
+    value = value == "" ? 0 : parseInt(value, 10).toString();
     data[field] = value;
   };
 
@@ -1520,14 +1540,16 @@ export const useHooks = (t?: any) => {
     let item = enumArr.find((item: any) => item.value == val);
     let arr = getDuoquVal(item);
 
-    console.log("state.vxeTableMxRef.element.get :>> ", state.vxeTableMxRef.element.getTableData());
-    let { fullData } = state.vxeTableMxRef.element.getTableData();
+    console.log("state.vxeTableMxRef :>> ", state.vxeTableMxRef);
+    // console.log("state.vxeTableMxRef.element.get :>> ", state.vxeTableMxRef.element.getTableData());
+    // let { fullData } = state.vxeTableMxRef.element.getTableData();
     let num = arr.length;
-    fullData[0].if_part = Number(num > 1);
+    state.bednetMxData[0].if_part = Boolean(num > 1);
+    console.log("fullData bednetMxData :>> ", state.bednetMxData);
 
     if (num > 1) {
-      fullData[0].springid = 0;
-      fullData[0].springname = "";
+      state.bednetMxData[0].springid = 0;
+      state.bednetMxData[0].springname = "";
       nextTick(() => {
         setTimeout(async () => {
           console.log(
@@ -1558,7 +1580,7 @@ export const useHooks = (t?: any) => {
 
                 let _data = {
                   ...dw_bednet_mx_spring,
-                  spring_qty_width: Number(fullData[0].spring_qty_width),
+                  spring_qty_width: Number(state.bednetMxData[0].spring_qty_width),
                   spring_qty_length: 0
                 };
                 arr.push(_data);
@@ -1601,6 +1623,33 @@ export const useHooks = (t?: any) => {
     return arr;
   };
 
+  /**
+   * @description 设置多区弹簧宽度
+   */
+  const setMxSpringWidth = row => {
+    console.log("setMxSpringWidth val :>> ", row);
+
+    // if (Number(row.if_part)) {
+    //   state.bednetMxSpringData = state.bednetMxSpringData.map(item => {
+    //     item.spring_qty_width = row.spring_qty_width;
+    //     return item;
+    //   });
+    // }
+    if (state.vxeTableMxSpringRef) {
+      let { fullData: springData } = state.vxeTableMxSpringRef?.element.getTableData();
+
+      springData.forEach((item, index) => {
+        item.spring_qty_width = row.spring_qty_width;
+      });
+      console.log("state.vxeTableMxSpringRef.element :>> ", state.vxeTableMxSpringRef.element);
+
+      state.vxeTableMxSpringRef.element.updateFooter();
+    }
+  };
+
+  /**
+   * @description 设置多区弹簧长度
+   */
   const setMxSpringLength = () => {
     const { _mainData, enumMap } = state.LjDetailRef;
 
@@ -1661,7 +1710,11 @@ export const useHooks = (t?: any) => {
         const { column, row, status } = scope;
         return (
           <>
-            <el-input-number v-model={row.bednet_height} style="width: unset" />
+            <el-input
+              v-model={row.bednet_height}
+              onBlur={() => handleBlur(row.bednet_height, row, "bednet_height")}
+              style="width: unset"
+            />
           </>
         );
       }
@@ -1677,6 +1730,7 @@ export const useHooks = (t?: any) => {
             <el-input
               v-model={row.spring_qty_width}
               onBlur={() => handleBlur(row.spring_qty_width, row, "spring_qty_width")}
+              onChange={() => setMxSpringWidth(row)}
               style="width: unset"
             />
           </>
@@ -1700,26 +1754,26 @@ export const useHooks = (t?: any) => {
         );
       }
     },
-    {
-      field: "if_part",
-      editRender: {},
-      editColRender: (scope: any) => {
-        const { column, row, status } = scope;
+    // {
+    //   field: "if_part"
+    // editRender: {},
+    // editColRender: (scope: any) => {
+    //   const { column, row, status } = scope;
 
-        console.log("if_part row :>> ", row);
+    //   console.log("if_part row :>> ", row);
 
-        if (Number(row.if_part) == 1) {
-          row.springid = 0;
-          row.springname = "";
-        }
+    //   if (Number(row.if_part) == 1) {
+    //     row.springid = 0;
+    //     row.springname = "";
+    //   }
 
-        return (
-          <>
-            <el-checkbox v-model={row.if_part} style="display: block"></el-checkbox>
-          </>
-        );
-      }
-    },
+    //   return (
+    //     <>
+    //       <el-checkbox v-model={row.if_part} style="display: block"></el-checkbox>
+    //     </>
+    //   );
+    // }
+    // },
     {
       field: "springname",
       editRender: {},
@@ -1753,7 +1807,7 @@ export const useHooks = (t?: any) => {
 
         return (
           <>
-            <el-checkbox v-model={row.if_side_iron} style="display: block"></el-checkbox>
+            <el-checkbox v-model={row.if_side_iron} class="vxe-edit-col-middle"></el-checkbox>
           </>
         );
       }
@@ -1783,7 +1837,7 @@ export const useHooks = (t?: any) => {
 
         return (
           <>
-            <el-checkbox v-model={row.if_hard_around} style="display: block"></el-checkbox>
+            <el-checkbox v-model={row.if_hard_around} class="vxe-edit-col-middle"></el-checkbox>
           </>
         );
       }
@@ -1804,6 +1858,7 @@ export const useHooks = (t?: any) => {
       field: "hard_around_springname",
       editRender: {},
       editColRender: (scope: any) => {
+        console.log("hard_around_springname editColRender scope :>> ", scope);
         const { column, row, status } = scope;
         let _label = column.title;
 
@@ -1814,9 +1869,9 @@ export const useHooks = (t?: any) => {
               disabled={Number(row.if_hard_around) == 0}
               clearable
               placeholder={_label}
-              onOpenModal={() => fModelChoseSpring(row, row.hard_around_springid, rModelSetSpring)}
-              onSelect={(val: any) => rModelSetSpring(row, val)}
-              onClear={() => rModelClearSpring(row)}
+              onOpenModal={() => fModelChoseSpring(row, row.hard_around_springid, rModelSetHardAroundSpring)}
+              onSelect={(val: any) => rModelSetHardAroundSpring(row, val)}
+              onClear={() => rModelClearHardAroundSpring(row)}
             />
           </>
         );
@@ -1830,7 +1885,7 @@ export const useHooks = (t?: any) => {
 
         return (
           <>
-            <el-checkbox v-model={row.if_15strip} style="display: block"></el-checkbox>
+            <el-checkbox v-model={row.if_15strip} class="vxe-edit-col-middle"></el-checkbox>
           </>
         );
       }
@@ -1930,6 +1985,7 @@ export const useHooks = (t?: any) => {
       field: "springname",
       editRender: {},
       editColRender: (scope: any) => {
+        console.log("springname editColRender scope :>> ", scope);
         const { column, row, status } = scope;
         let _label = column.title;
 
@@ -1940,9 +1996,9 @@ export const useHooks = (t?: any) => {
               disabled={Number(row.if_part) == 1}
               clearable
               placeholder={_label}
-              onOpenModal={() => fModelChoseSpring(row, row.springid, rModelSetSpring)}
-              onSelect={(val: any) => rModelSetSpring(row, val)}
-              onClear={() => rModelClearSpring(row)}
+              onOpenModal={() => fModelChoseSpring(scope.row, row.springid, rModelSetSpring)}
+              onSelect={(val: any) => rModelSetSpring(scope.row, val)}
+              onClear={() => rModelClearSpring(scope.row)}
             />
           </>
         );
@@ -2397,7 +2453,7 @@ export const useHooks = (t?: any) => {
     dw_bednet_mx_spring,
     reload_dw2,
     getData,
-    // getDataMx,
+    getDataMx,
     getDataMxSpring,
     getDataMxAdd,
     dataCallback,

+ 95 - 30
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -214,12 +214,12 @@
         :auto-load-layout="false"
         collapseButtons
       >
-        <template #tableHeader>
+        <!-- <template #tableHeader>
           <el-space wrap>
             <el-button type="primary">{{ $t("common.add") }}</el-button>
             <el-button type="danger">{{ $t("common.editText") }}</el-button>
           </el-space>
-        </template>
+        </template> -->
       </LjVxeTable>
     </template>
 
@@ -417,6 +417,7 @@
   </el-button>
 
   <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
+  <BednetDialog ref="BednetDialogRef" v-bind="BednetDialogProps" />
   <LjDrawerQuoteList
     ref="QuoteListDrawerRef"
     :data="LjDetailRef && LjDetailRef._mainData"
@@ -447,6 +448,7 @@ 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 BednetDialog from "@/views/system/selector/bednet/index.vue";
 import LjDrawerQuoteList from "./components/QuoteList.vue";
 import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
@@ -489,6 +491,8 @@ const {
   fieldParams,
   MtrldefDialogRef,
   MtrldefDialogProps,
+  BednetDialogRef,
+  BednetDialogProps,
   fabricMxTabList,
   mattresstypeEnum,
   fabricMxTabs,
@@ -559,7 +563,7 @@ const tableProps_mx = ref({
   align: "left",
   // height: "",
   minHeight: "300px",
-  editConfig: { trigger: "click", mode: "cell", enabled: false },
+  editConfig: { trigger: "click", mode: "row", enabled: false },
   // exportConfig: {
   //   filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
   // }
@@ -583,21 +587,21 @@ const tableProps_mx = ref({
   }
 });
 
-const keyboardConfig = ref<any>({
-  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);
-  }
-});
+// const keyboardConfig = ref<any>({
+//   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);
+//   }
+// });
 
 const isTabsBadge_packag = computed(() => {
   let arr = [];
@@ -871,18 +875,17 @@ const detailProps = reactive<DetailProp>({
     {
       id: "innerClothLayerMx",
       type: "table",
-      label: t("business.detail.innerClothLayer")
-      // limited: (params: any) => {
-      //   if (!params) return true;
-      //   return params?.if_n_butao == "0";
-      // }
+      label: t("business.detail.innerClothLayer"),
+      limited: (params: any) => {
+        if (!params) return true;
+        return params?.if_n_butao == "0";
+      }
     },
     {
       id: "topCottonMx",
       type: "table",
       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";
       }
@@ -939,10 +942,22 @@ const orderDefaultAction = [
       try {
         await LjDetailRef.value.toValidateForm();
 
-        wf_cmp_cb();
+        if (!(await wf_cmp_cb())) return;
         loadingStatus.save = true;
 
         let mattress = LjDetailRef.value._mainData;
+        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);
 
         let mattressMx = [];
         fabricMxTabList.value.map(t => {
@@ -978,6 +993,15 @@ const orderDefaultAction = [
               } else {
                 router.replace("/mattressQuote");
               }
+              setTimeout(() => {
+                if (res.message) {
+                  ElNotification({
+                    title: "计算失败",
+                    message: res.message,
+                    type: "warning"
+                  });
+                }
+              }, 100);
               loadingStatus.save = false;
             })
             .catch(error => {
@@ -1000,7 +1024,7 @@ const orderDefaultAction = [
       return !!orderStatus.value;
     },
     clickFunc: item => {
-      router.push(`/mattressQuote/new?id=0`);
+      router.push(`/mattressQuote/new?id=0&deptid=${LjDetailRef.value._mainData?.deptid ?? 0}`);
     }
   }),
   buttonDefault({
@@ -1420,6 +1444,8 @@ const funcAfterMound = async () => {
       return t;
     });
 
+    console.log("funcAfterMound oriMxData.value :>> ", oriMxData.value);
+
     funcChaifenTab();
     // funcGetFabricMxShowData(itmshow.name);
     // console.log("funcAfterMound resData :>> ", fabricMxData.value);
@@ -1580,10 +1606,49 @@ const handleDelFabricMxNewMtrlGroup = (target: string) => {
     });
 };
 
-const toMove = (action: number) => {
-  // console.log('bvtoMove action :>> ', action);
-  // const { $table , curRecords } = getCurrentRecords(cushionsMxRef.value)
-  // console.log('curRecords :>> ', curRecords);
+const toMove = async (action: number) => {
+  console.log("bvtoMove action :>> ", action);
+  // const { $table, curRecords } = getCurrentRecords(cushionsMxRef.value);
+  const $table = cushionsMxRef.value?.element;
+  const curRecords = $table?.getCurrentRecord();
+  console.log("curRecords :>> ", curRecords);
+
+  console.log("$table.getTableData() :>> ", $table.getTableData());
+  let fullData = $table.getTableData().fullData;
+
+  if (!curRecords) {
+    ElMessage.warning("请先选择要移动的行");
+    return;
+  }
+
+  let curIdx = fullData.findIndex(t => t === curRecords);
+  console.log("curIdx :>> ", curIdx);
+
+  if (action == 1) {
+    // 上移
+    if (curIdx == 0) {
+      ElMessage.warning("已经是第一条了");
+      return;
+    }
+    let prevRow = fullData[curIdx - 1];
+    fullData[curIdx - 1] = fullData[curIdx];
+    fullData[curIdx] = prevRow;
+
+    $table.reloadData(fullData);
+    await $table.setCurrentRow(curRecords);
+  } else if (action == -1) {
+    // 下移
+    if (curIdx == fullData.length - 1) {
+      ElMessage.warning("已经是最后一条了");
+      return;
+    }
+    let nextRow = fullData[curIdx + 1];
+    fullData[curIdx + 1] = fullData[curIdx];
+    fullData[curIdx] = nextRow;
+
+    $table.reloadData(fullData);
+    await $table.setCurrentRow(curRecords);
+  }
 };
 
 /**

+ 6 - 17
JLHWEB/src/views/quote/mattressQuote/hooks/cpQuote.ts

@@ -125,8 +125,8 @@ export const useHooksCpQuote = (t?: any) => {
     const { getDataMxAdd, getDataMxSpring, dataCallbackMx } = useHooks(t);
     let s_bednet_qingdan = [];
 
-    let bednetMxData = [];
-    let bednetMxSprintData = [];
+    // let bednetMxData = [];
+    // let bednetMxSpringData = [];
     let res = await getDataMxAdd({ arg_bednetid: data.bednetid });
     let mxResult = dataCallbackMx(res);
     console.log("mxResult :>> ", mxResult);
@@ -653,7 +653,7 @@ export const useHooksCpQuote = (t?: any) => {
     return s_bednet_qingdan;
   };
 
-  const f_get_bednet_qingdan = async (bednetid: any, data: any) => {
+  const f_get_bednet_qingdan = async (bednetid: any) => {
     let _params = {
       dsname: "web_bednet_define",
       queryparams: {
@@ -815,7 +815,7 @@ export const useHooksCpQuote = (t?: any) => {
                 if (item.data.bednet.length == 1) {
                   //单床网
                   ll_bednetid = item.data.bednet[0].mtrlid;
-                  let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid, data);
+                  let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
                   if (s_bednet_qingdan.length) {
                     result.dscrp = s_bednet_qingdan[1].pznamemx;
                     result.qty = 1;
@@ -827,19 +827,8 @@ export const useHooksCpQuote = (t?: any) => {
                   //多床网
                   item.data.bednet.map(async t => {
                     ll_bednetid = item.data.bednet[0].mtrlid;
-                    let _params = {
-                      dsname: "web_bednet_mx_add",
-                      queryparams: {
-                        arg_bednetid: ll_bednetid
-                      }
-                    };
-                    let res = await CommonDynamicSelect(_params);
-                    let bednetMxRs = {
-                      list: res?.datatable,
-                      tableinfo: res?.tableinfo
-                    };
-
-                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid, bednetMxRs);
+
+                    let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
                     if (s_bednet_qingdan.length) {
                       result.dscrp = s_bednet_qingdan[1].pznamemx;
                       result.qty = 1;

File diff suppressed because it is too large
+ 673 - 194
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx


+ 4 - 0
JLHWEB/src/views/saleprice/dept/detail.vue

@@ -99,4 +99,8 @@ watch(
   },
   { immediate: true, deep: true }
 );
+
+defineExpose({
+  detail: LjDetailRef
+});
 </script>

+ 13 - 6
JLHWEB/src/views/saleprice/dept/index.vue

@@ -37,7 +37,7 @@
     </template>
     <div class="flx-1 h-full">
       <LjHeaderMenu :data="mainData" :action="orderStatus ? orderEditAction : orderDefaultAction" />
-      <DeptListDetail class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" />
+      <DeptListDetail ref="detailRef" class="flx-1" :data="mainData" :status="orderStatus" :enum="enumMap" />
     </div>
   </LjDialog>
 </template>
@@ -56,6 +56,7 @@ import { useAuthButtons } from "@/hooks/useAuthButtons";
 import { cloneDeep } from "lodash-es";
 
 const dwname = "web_deptlist";
+const detailRef = ref();
 const mainData = ref({});
 const tableProps = {
   height: "auto",
@@ -95,12 +96,18 @@ const orderEditAction = [
   buttonNew({
     label: t("common.saveText"),
     icon: "iconsave-01",
-    clickFunc: item => {
-      const save_data = orderStatus.value == "new" ? LjDetailRef.value?.infoParam : LjDetailRef.value?._mainData;
+    clickFunc: async item => {
+      try {
+        await detailRef.value.detail.toValidateForm();
 
-      fSave({ dept: save_data }).then(() => {
-        LjDrawerRef.value.hide();
-      });
+        const save_data = orderStatus.value == "new" ? LjDetailRef.value?.infoParam : LjDetailRef.value?._mainData;
+
+        fSave({ dept: save_data }).then(() => {
+          LjDrawerRef.value.hide();
+        });
+      } catch (error) {
+        console.log("error :>> ", error);
+      }
     }
   })
 ];

+ 56 - 0
JLHWEB/src/views/system/selector/bednet/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/bednet/index.vue

@@ -0,0 +1,221 @@
+<template>
+  <LjSelector
+    ref="LjSelectorRef"
+    :title="`${$t('business.selector.bednet.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="SelectorBednetDialog">
+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 = "bednetid";
+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_bednet_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>

+ 126 - 0
JLHWEB/src/views/system/selector/bednet/select.vue

@@ -0,0 +1,126 @@
+<template>
+  <LjSelectorSelect
+    ref="selectStationRef"
+    v-model:value="props.value"
+    value-key="bednetid"
+    :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: 80px">{{ $t("table.u_bednet_define.bednetcode") }}</div>
+          <div class="table-td pr-4" style="width: 80px">{{ $t("table.u_bednet_define.bednetname") }}</div>
+          <div class="table-td pr-4" style="width: 40px">{{ $t("table.u_bednet_define.typename") }}</div>
+        </div>
+      </div>
+    </template>
+    <el-option
+      v-for="item in options"
+      :key="item.bednetid"
+      :label="item.bednetname"
+      :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: 80px" class="table-td pr-4 text-ellipsis-one" :title="item.bednetcode">{{ item.bednetcode }}</div>
+          <div style="width: 80px" class="table-td pr-4 text-ellipsis-one" :title="item.bednetname">{{ item.bednetname }}</div>
+          <div style="width: 40px" class="table-td pr-4 text-ellipsis-one">{{ item.typename }}</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="SelectorBednetSelect">
+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 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,
+    arg_deptid: props.deptid
+  };
+  newParams.dsname = "web_bednet_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);
+};
+
+const selectStationRef = ref();
+const toFocus = () => {
+  selectStationRef.value.elment.focus();
+};
+
+defineExpose({
+  toFocus
+});
+</script>