浏览代码

JLHweb:优化公式展示

JohnnyChan 10 月之前
父节点
当前提交
f697339611
共有 30 个文件被更改,包括 1930 次插入472 次删除
  1. 1 1
      JLHWEB/package.json
  2. 11 0
      JLHWEB/src/api/interface/index.ts
  3. 2 2
      JLHWEB/src/api/modules/quote.ts
  4. 1 1
      JLHWEB/src/components/BaseMsgForm/components/BaseForm.vue
  5. 7 2
      JLHWEB/src/components/LjDetail/index.vue
  6. 1 1
      JLHWEB/src/components/LjVxeTable/components/SearchForm.vue
  7. 1 1
      JLHWEB/src/components/ToastWidget/Formula/components/Item.vue
  8. 37 52
      JLHWEB/src/components/ToastWidget/Formula/index.vue
  9. 8 0
      JLHWEB/src/components/ToastWidget/HistoryPrice/components/Item.vue
  10. 12 4
      JLHWEB/src/components/ToastWidget/HistoryPrice/index.vue
  11. 5 1
      JLHWEB/src/enums/dwnameEnum.ts
  12. 4 1
      JLHWEB/src/languages/modules/zh-cn/business.json
  13. 5 0
      JLHWEB/src/styles/common.scss
  14. 1 1
      JLHWEB/src/styles/element.scss
  15. 175 0
      JLHWEB/src/views/quote/bednetQuote/components/AllFormula.vue
  16. 99 0
      JLHWEB/src/views/quote/bednetQuote/components/FormulaGroup.vue
  17. 160 0
      JLHWEB/src/views/quote/bednetQuote/components/FormulaItem.vue
  18. 20 54
      JLHWEB/src/views/quote/bednetQuote/detail.vue
  19. 184 178
      JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx
  20. 133 0
      JLHWEB/src/views/quote/mattressQuote/components/AllFormula.vue
  21. 80 0
      JLHWEB/src/views/quote/mattressQuote/components/FormulaGroup.vue
  22. 11 4
      JLHWEB/src/views/quote/mattressQuote/components/QuoteList.vue
  23. 114 32
      JLHWEB/src/views/quote/mattressQuote/detail.vue
  24. 58 30
      JLHWEB/src/views/quote/mattressQuote/hooks/cpQuote.ts
  25. 750 75
      JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx
  26. 3 3
      JLHWEB/src/views/quote/mattressQuote/index.vue
  27. 20 14
      JLHWEB/src/views/system/selector/bednet/hooks/index.ts
  28. 12 12
      JLHWEB/src/views/system/selector/bednet/index.vue
  29. 3 0
      JLHWEB/src/views/system/selector/bednet/select.vue
  30. 12 3
      JLHWEB/src/views/system/selector/mtrldef/select.vue

+ 1 - 1
JLHWEB/package.json

@@ -47,7 +47,7 @@
     "driver.js": "^1.3.1",
     "echarts": "^5.4.2",
     "echarts-liquidfill": "^3.1.0",
-    "element-plus": "^2.3.4",
+    "element-plus": "^2.7.4",
     "exceljs": "^4.4.0",
     "file-saver": "^2.0.5",
     "js-md5": "^0.7.3",

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

@@ -1194,4 +1194,15 @@ export namespace Mattress {
     bednet: any;
     message: string;
   }
+  export interface ResComputeBednet {
+    bednet?: any;
+    replace: any;
+    formulas: any;
+    message: string;
+  }
+  export interface ResComputeMattress {
+    replace: any;
+    formulas: any;
+    message: string;
+  }
 }

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

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

+ 1 - 1
JLHWEB/src/components/BaseMsgForm/components/BaseForm.vue

@@ -52,7 +52,7 @@
               </el-form-item>
             </GridItem>
           </template>
-          <GridItem suffix :span="5" class="flx-start-end">
+          <GridItem suffix :span="5" class="flx-end-start">
             <div class="flx-start flx-1">
               <div class="flx-shrink flx-start mr-32 h-full">
                 <template v-if="!settingStatus">

+ 7 - 2
JLHWEB/src/components/LjDetail/index.vue

@@ -1559,7 +1559,8 @@ 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;
+        // let _limited = isFunction(item?.limited) ? item.limited(_mainData.value) : item?.limited ?? false;
+        let _limited = isFunction(item?.limited) ? item.limited(detailParams) : item?.limited ?? false;
         if (_limited) return false;
         if (!item.isHidden) {
           if (slots[item.id]) {
@@ -1658,6 +1659,8 @@ const RenderTabs = (rProps: DetailProp) => {
   );
 };
 
+let detailParams = reactive<any>({});
+
 /**
  * @description 模块:基础信息
  */
@@ -1666,11 +1669,13 @@ const basicinfoRender = (rProps: any) => {
   // let _params =
   //   orderStatus.value == "new" ? infoParam.value : orderStatus.value == "edit" ? reactive(_mainData.value) : _mainData.value;
   let _params = editable.value ? reactive(_mainData.value) : _mainData.value;
+  detailParams = editable.value ? reactive(_mainData.value) : _mainData.value;
 
   console.log("basicinfoRender rProps :>> ", rProps);
   console.log("basicinfoRender _params :>> ", editable.value, _params);
   console.log("basicinfoRender _mainData.value :>> ", _mainData.value);
   console.log("basicinfoRender infoColumns.value :>> ", infoParam.value);
+  console.log("basicinfoRender searchParam.value :>> ", searchParam.value);
   // let codeValue = orderStatus.value == "new" ? true : convertStrToObj(_mainData.value, props.header.fieldNames?.code);
   return (
     <>
@@ -1683,7 +1688,7 @@ const basicinfoRender = (rProps: any) => {
               loading={orderStatus.value != "new" && tableLoading.value}
               ref={LjDetailBaseFormRef}
               columns={infoColumns.value}
-              searchParam={_params}
+              searchParam={detailParams}
               searchCol={rProps.searchCol}
               basicGroupCol={rProps.basicGroupCol}
               formProps={tableOptions.basicinfo ?? {}}

+ 1 - 1
JLHWEB/src/components/LjVxeTable/components/SearchForm.vue

@@ -82,7 +82,7 @@
               suffix
               :span="settingStatus || !collapsed ? scope.gridCols : 1"
               :class="
-                settingStatus || !collapsed ? `flx-start-end ${globalStore.assemblySize == 'small' ? 'mb-8' : 'mb-16'}` : 'flx'
+                settingStatus || !collapsed ? `flx-end-start ${globalStore.assemblySize == 'small' ? 'mb-8' : 'mb-16'}` : 'flx'
               "
             >
               <template v-if="!settingStatus">

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

@@ -93,7 +93,7 @@ const RenderFormulaItem = () => {
     return (
       <>
         {/* <ElScrollbar> */}
-        <div class="formula-wrapper flx-start-end">
+        <div class="formula-wrapper flx-end-start">
           {fArr.map((t, i) => {
             if (t.indexOf("[") === 0) {
               return <div>{RenderVariable(t)}</div>;

+ 37 - 52
JLHWEB/src/components/ToastWidget/Formula/index.vue

@@ -8,30 +8,24 @@
       </div>
     </header>
     <main class="w-full">
-      <div class="flx-end summary-box" v-for="item in formulas" :key="item.field">
-        <div class="flx-1 enter-x overflow-auto" v-if="ifShow" style="max-width: 450px">
+      <div class="flx-end summary-box" v-for="item in isFormulas" :key="item.label">
+        <!-- <div class="flx-1 enter-x overflow-auto" v-if="ifShow" style="max-width: 450px">
           <FormulaItem :data="item" :formulas="formulas" :dataValue="data" :fields="fields" />
-        </div>
-        <div
-          class="summary-box__summy"
-          :class="ifShow ? 'flx-shrink is-show' : 'flx-1'"
-          :style="{ width: ifShow ? '90px' : 'unset' }"
-        >
-          <div class="summary-box_item" :class="ifShow ? 'flx-col' : 'flx'">
-            <div class="flx-1 text-secondary-text text-body-c" :class="{ 'text-right': ifShow }">
+        </div> -->
+        <div class="summary-box__summy flx-1" :style="{ width: 'unset' }">
+          <div class="summary-box_item flx">
+            <div class="flx-1 text-secondary-text text-body-c">
               {{ item.label }}
             </div>
             <div class="flx-shrink ml-8 text-right text-h5-b">
-              {{ data[item.field] }}
+              {{ isFilterPrice(item) }}
             </div>
           </div>
         </div>
       </div>
     </main>
     <footer class="flx">
-      <el-button type="primary" class="flx-1" @click="handleToggleShow">{{
-        ifShow ? t("common.table.putAway") : t("common.showFormula")
-      }}</el-button>
+      <el-button type="primary" class="flx-1" @click="handleToggleShow">{{ t("common.showFormula") }}</el-button>
     </footer>
   </div>
 </template>
@@ -44,16 +38,17 @@ import { useUserStore } from "@/stores/modules/user";
 import { useOaFlow } from "@/components/LjOaFlow/hooks/index";
 import { CloseBold, Refresh } from "@element-plus/icons-vue";
 import FormulaItem from "./components/Item.vue";
+import { formatAmount3 } from "@/utils/index";
 
 export interface formulasProp {
   /**
    * @description 属性名称
    */
   label?: string;
-  /**
-   * @description 属性id
-   */
-  field: string;
+  // /**
+  //  * @description 属性id
+  //  */
+  // field: string;
   /**
    * @description 属性计算方法
    */
@@ -90,7 +85,7 @@ interface WidgetProps {
    * @description 状态enum
    */
   statusEnum?: any;
-  data?: any;
+  // data?: any;
   /**
    * @description 是否隐藏关闭按钮
    */
@@ -102,7 +97,7 @@ interface WidgetProps {
   /**
    * @description 字段对照表
    */
-  fields: formulasProp[];
+  fields: any[];
   showFormula?: boolean;
 }
 const props = withDefaults(defineProps<WidgetProps>(), {
@@ -111,8 +106,27 @@ const props = withDefaults(defineProps<WidgetProps>(), {
   data: () => {}
   // showFooter: true
 });
-const emit = defineEmits(["close-toast", "toggle-formula", "refresh"]);
-const ifShow = ref(false);
+const emit = defineEmits(["close-toast", "tomore", "refresh"]);
+// const ifShow = ref(false);
+
+const isFormulas = computed(() => {
+  return props.formulas.filter((item: any) => item.type == 0);
+});
+
+const isFilterPrice = data => {
+  let tg = props.fields.find((item: any) => item.label == data.label);
+  if (!tg) {
+    return "--";
+  }
+
+  let val = formatAmount3({ val: tg.value });
+  // 过滤掉末尾的0
+  let arr = val.split("");
+  while (arr[arr.length - 1] === "0") {
+    arr.pop();
+  }
+  return arr.join("");
+};
 
 // const { t } = useI18n();
 const { userInfo } = useUserStore();
@@ -122,37 +136,8 @@ const { itemData, oaFlowList, tabsValue, currentOaflow, oaDocStatus, isCurEmp, h
   props.powerid
 );
 
-const getOaFlowItem = async (docid: number) => {
-  // 流转状况
-  let { datatable } = await CommonDynamicSelect({
-    dsname: "web_oa_flow_status_view_bill",
-    queryparams: {
-      docid: docid
-    }
-  });
-  console.log("getOaFlowItem datatable :>> ", datatable);
-  itemData.value = datatable;
-
-  console.log("currentOaflow :>> ", currentOaflow.value);
-};
-const handleClickTabs = () => {
-  console.log(tabsValue.value);
-  // console.log("handleClickTabs pane :>> ", pane);
-  let _index: any = tabsValue.value ?? 0;
-  console.log("oaFlowList.value :>> ", oaFlowList.value);
-  console.log("_index :>> ", _index);
-  let { docid } = oaFlowList.value[_index];
-  getOaFlowItem(docid);
-};
-
-onMounted(async () => {
-  console.log("onMounted props.data 初始化:>> ", props.data);
-  ifShow.value = props.showFormula;
-});
-
 const handleToggleShow = () => {
-  ifShow.value = !ifShow.value;
-  emit("toggle-formula", ifShow.value);
+  emit("tomore");
 };
 </script>
 

+ 8 - 0
JLHWEB/src/components/ToastWidget/HistoryPrice/components/Item.vue

@@ -91,6 +91,14 @@ const isFilterPrice = data => {
   margin-top: $space-a2;
   padding-top: $space-b1;
   padding-bottom: $space-b1;
+  padding-right: $space-b1;
+
+  &:hover {
+    cursor: pointer;
+    background-color: $color-primary-000;
+    border-radius: $br-sm;
+  }
+
   &__left {
     position: relative;
     width: 0;

+ 12 - 4
JLHWEB/src/components/ToastWidget/HistoryPrice/index.vue

@@ -7,7 +7,15 @@
     </header>
     <main class="w-full lj-toast-hisprice__main" :class="{ 'is-empty': !data.length }">
       <div class="lj-toast-hisprice__main-content" v-if="data.length">
-        <HisItem :data-ref="'item' + index" v-for="(itm, index) in data" :t="t" :item="itm" :index="index" :key="index" />
+        <HisItem
+          :data-ref="'item' + index"
+          v-for="(itm, index) in data"
+          :t="t"
+          :item="itm"
+          :index="index"
+          :key="index"
+          @click="emit('todetail', itm)"
+        />
       </div>
       <el-empty v-else :description="t('sys.empty.nodate')" />
     </main>
@@ -51,7 +59,7 @@ const props = withDefaults(defineProps<WidgetProps>(), {
   hideClose: false
   // showFooter: true
 });
-const emit = defineEmits(["close-toast", "refresh"]);
+const emit = defineEmits(["close-toast", "refresh", "todetail"]);
 
 const data = ref<any>([]);
 
@@ -80,8 +88,8 @@ watch(
   [() => props.id, () => props.typeid],
   (val: any) => {
     console.log("watch oaflow val :>> ", val);
-    // refresh(val[0], val[1])
-    refresh(0, 1);
+    refresh(val[0], val[1]);
+    // refresh(0, 1);
   },
   { immediate: true }
 );

+ 5 - 1
JLHWEB/src/enums/dwnameEnum.ts

@@ -129,5 +129,9 @@ export enum DwnameEnum {
   /**
    * @description 半成品报价明细
    */
-  semifinprodQuoteMx = "u_semi_finished_product_mx"
+  semifinprodQuoteMx = "u_semi_finished_product_mx",
+  /**
+   * @description 床网报价表-选择
+   */
+  bednetQuoteChoose = "u_bednet_choose"
 }

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

@@ -448,6 +448,9 @@
     "topCotton": "顶布裥棉",
     "addChastr": "新增位置",
     "delChastr": "删除位置",
-    "bednetMxTitle": "床网多网明细|多区袋装明细"
+    "bednetMxTitle": "床网多网明细|多区袋装明细",
+    "importMx": "导入明细",
+    "deleteMx": "删除明细",
+    "deleteAllMx": "删除全部明细"
   }
 }

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

@@ -15,6 +15,11 @@
   justify-content: flex-start;
 }
 .flx-start-end {
+  display: flex;
+  align-items: flex-start;
+  justify-content: flex-end;
+}
+.flx-end-start {
   display: flex;
   align-items: flex-end;
   justify-content: flex-start;

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

@@ -343,7 +343,7 @@
 
 .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;
+  border-color: var(--lj-color-gray-8) !important;
 }
 
 .is-disabled,

+ 175 - 0
JLHWEB/src/views/quote/bednetQuote/components/AllFormula.vue

@@ -0,0 +1,175 @@
+<template>
+  <LjDrawer
+    v-if="visible"
+    ref="LjDrawerRef"
+    :class="`${prefixCls}`"
+    :id="prefixCls"
+    direction="rtl"
+    size="60%"
+    destroy-on-close
+    append-to-body
+    :show-close="false"
+    @close="autoClose"
+  >
+    <template #header>
+      <div class="flx-justify-between">
+        <div class="">详细报价</div>
+        <!-- <div class="flx flx-center mr-4" id="settingSearchInput">
+          <el-input
+            v-model="searchField"
+            :prefix-icon="Search"
+            clearable
+            style="width: 240px; height: 34px"
+            :placeholder="$t('business.baseMsgSetting.searchPh')"
+            @clear="searchEvent"
+            @input="disshow(searchField)"
+          >
+            <template #suffix v-if="searchField.length">
+              {{ matchSearchNum }}
+            </template>
+          </el-input>
+          <el-tooltip effect="dark" :content="$t('common.table.sesarhFilter')" placement="top" :show-after="200">
+            <el-button
+              :type="ifSearchFilter ? 'primary' : 'default'"
+              plain
+              class="ml-8 pl-10 pr-10"
+              @click="
+                () => {
+                  ifSearchFilter = !ifSearchFilter;
+                  disshow(searchField);
+                }
+              "
+            >
+              <template #icon>
+                <i class="iconfont" :class="ifSearchFilter ? 'iconfilter-funnel-01-fill' : 'iconfilter-funnel-01'"></i>
+              </template>
+            </el-button>
+          </el-tooltip>
+        </div> -->
+        <div class="flx-shrink">
+          <el-button type="danger" :icon="Close" text circle @click="cancelClick"></el-button>
+        </div>
+      </div>
+    </template>
+    <template #default>
+      <!-- <el-row :gutter="10" class="">
+        <el-col> -->
+      <LjHeader class="flx-1" title="单据统计" />
+      <FormulaGroup :data="isNormalFormulas" :fields="fieldsReplace" />
+
+      <LjHeader class="flx-1 mt-16" title="详细报价" />
+      <FormulaGroup :data="isMxFormulas" :fields="fieldsReplace" />
+
+      <LjHeader class="flx-1 mt-16" title="重量" />
+      <FormulaGroup :data="isWeigthFormulas" :fields="fieldsReplace" />
+      <!-- </el-col>
+      </el-row> -->
+    </template>
+  </LjDrawer>
+</template>
+
+<script setup lang="ts" name="bednetQuoteDetail_AllFormula">
+import { ref, computed, watch, nextTick } from "vue";
+import LjDrawer from "@/components/LjDrawer/index.vue";
+import { useI18n } from "vue-i18n";
+import { useDesign } from "@/hooks/useDesign";
+import { useGlobalStore } from "@/stores/modules/global";
+import { Close, Search } from "@element-plus/icons-vue";
+import FormulaGroup from "./FormulaGroup.vue";
+import LjHeader from "@/components/LjHeader/index.vue";
+
+const { t } = useI18n();
+const { prefixCls } = useDesign("bednet-formal-detail");
+const globalStore = useGlobalStore();
+
+const visible = ref(false);
+const LjDrawerRef = ref();
+const formulaList = ref<any>([]);
+const fieldsReplace = ref<any>([]);
+const mainData = ref<any>({});
+const formulaMxList = ref<any>([]);
+
+const isNormalFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 0);
+});
+
+const isMxFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 2);
+});
+const isWeigthFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 3);
+});
+
+const autoClose = () => {
+  setTimeout(() => {
+    visible.value = false;
+  }, 200);
+};
+
+const cancelClick = () => {
+  // searchField.value = "";
+  LjDrawerRef.value.hide();
+  // selectColumn.value = [];
+  // ifAllSelect.value = false;
+};
+
+/**
+ * @description 显示组件
+ */
+const open = (formulas: any, replace: any, data: any) => {
+  visible.value = true;
+  formulaList.value = formulas;
+  fieldsReplace.value = replace;
+  mainData.value = data;
+
+  formulaMxList.value;
+
+  nextTick(() => {
+    //   list.value = cloneDeep(params);
+    //   oriList.value = cloneDeep(params);
+
+    //   let arr: string[] = [];
+    //   params.map((item: any) => {
+    //     if (item.basicinfo && item.basicinfo.hasOwnProperty("group")) {
+    //       item.basicinfo.group && !arr.includes(item.basicinfo.group) && arr.push(item.basicinfo.group);
+    //     }
+    //   });
+    //   groupList.value = arr;
+
+    //   selectGroup.value = group;
+
+    LjDrawerRef.value.show();
+    //   console.log("open columnsDrag.value :>> ", columnsDrag.value);
+
+    //   nextTick(() => {
+    //     initDragSelect();
+    //   });
+  });
+};
+
+defineExpose({
+  open
+});
+</script>
+
+<style lang="scss" scoped>
+$prefix-cls: "#{$namespace}-bednet-formal-detail";
+
+.#{$prefix-cls} {
+  .summary-wrapper {
+    &__label-item {
+      position: relative;
+      margin-right: $space-a3;
+
+      &::after {
+        content: "=";
+        position: absolute;
+        bottom: 0;
+        right: -$space-b3;
+        font-size: 24px;
+        color: $color-text-disable;
+      }
+    }
+  }
+}
+</style>

+ 99 - 0
JLHWEB/src/views/quote/bednetQuote/components/FormulaGroup.vue

@@ -0,0 +1,99 @@
+<template>
+  <div class="summary-wrapper flx" v-for="item in data" :key="item.field">
+    <!-- <div class="summary-wrapper flx">
+      <div class="summary-wrapper__label flx-col flx-shrink">
+        <div class="summary-wrapper__label-item mb-8 flx-end" v-for="item in data" :key="item.field">
+          <div class="summary-box_item flx-col">
+            <div class="flx-1 text-secondary-text text-body-c text-right">
+              {{ isFilterLabel(item.label) }}
+            </div>
+            <div class="flx-shrink ml-8 text-right text-h5-b">
+              {{ isFilterPrice(isFilterFields(item)) }}
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="summary-wrapper__vale flx-col flx-1">
+        <div class="flx-1 enter-x overflow-auto mb-8" v-for="item in data" :key="item.field">
+          <FormulaItem :data="item" :fields="fields" />
+        </div>
+      </div>
+    </div> -->
+    <div class="summary-wrapper__label-item flx-start-end" :style="{ width: width + 'px' }">
+      <div class="summary-box_item flx-col mt-4">
+        <div class="flx-1 text-secondary-text text-body-c text-right">
+          {{ isFilterLabel(item.label) }}
+        </div>
+        <div class="flx-shrink ml-8 text-right text-h5-b">
+          {{ isFilterPrice(isFilterFields(item)) }}
+        </div>
+      </div>
+    </div>
+    <div class="flx-1 enter-x overflow-auto">
+      <FormulaItem :data="item" :fields="fields" />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts" name="bednetQuoteDetail_FormulaGroup">
+import {} from "vue";
+import FormulaItem from "./FormulaItem.vue";
+import { formatAmount3 } from "@/utils/index";
+
+interface WidgetProps {
+  data: any;
+  /**
+   * @description 字段对照表
+   */
+  fields: any[];
+  width?: number;
+}
+
+const props = withDefaults(defineProps<WidgetProps>(), {
+  width: 120
+});
+
+const isFilterFields = (data: any) => {
+  return props.fields.find(f => f.label == data.label)?.value ?? 0;
+};
+
+const isFilterLabel = (val: any) => {
+  return val.replace(/【/g, "").replace(/】/g, "");
+};
+
+const isFilterPrice = data => {
+  let val = formatAmount3({ val: data });
+  // 过滤掉末尾的0
+  let arr = val.split("");
+  while (arr[arr.length - 1] === "0") {
+    arr.pop();
+  }
+  return arr.join("");
+};
+</script>
+
+<style lang="scss" scoped>
+.summary-wrapper {
+  margin-bottom: 8px;
+  &:hover {
+    background: $color-primary-000;
+    border-radius: $br-md;
+  }
+  &__label-item {
+    margin-right: $space-a3;
+
+    .summary-box_item {
+      position: relative;
+
+      &::after {
+        content: "=";
+        position: absolute;
+        bottom: 0;
+        right: -$space-b3;
+        font-size: 24px;
+        color: $color-text-disable;
+      }
+    }
+  }
+}
+</style>

+ 160 - 0
JLHWEB/src/views/quote/bednetQuote/components/FormulaItem.vue

@@ -0,0 +1,160 @@
+<template>
+  <RenderFormulaItem />
+</template>
+
+<script setup lang="tsx" name="BednetFormulaItem">
+// import type { formulasProp } from "../index.vue";
+// import { ElScrollbar } from "element-plus";
+import { formatAmount3 } from "@/utils/index";
+
+interface itemProps {
+  data: any;
+  // /**
+  //  * @description 计算公式列表
+  //  */
+  // formulas: any[];
+  /**
+   * @description 字段对照表
+   */
+  fields: any[];
+  // dataValue: any;
+}
+
+const props = defineProps<itemProps>();
+
+const isFilterPrice = data => {
+  let val = formatAmount3({ val: data }, 4);
+  // 过滤掉末尾的0
+  let arr = val.split("");
+  while (arr[arr.length - 1] === "0") {
+    arr.pop();
+  }
+  return arr.join("");
+};
+
+const funcFormulaToArray = (formula: string) => {
+  if (!formula) return [];
+  let result = [];
+  let lastIndex = 0;
+  let _formula = formula;
+  _formula = formula.replace(/【/g, "[").replace(/】/g, "]");
+  let fArr = _formula.match(/\[(.*?)\]/g); //匹配方括号及其内容。
+
+  fArr.forEach((match, index) => {
+    let start = _formula.indexOf(match, lastIndex);
+    let end = start + match.length;
+
+    // 添加匹配前的部分
+    result.push(_formula.slice(lastIndex, start));
+
+    // 添加匹配到的内容
+    result.push(match);
+
+    // 更新 lastIndex
+    lastIndex = end;
+  });
+
+  // 添加最后一部分
+  result.push(formula.slice(lastIndex));
+
+  return result.filter(t => t);
+};
+
+const RenderVariable = (data: any) => {
+  let fieldName = data.slice(1, -1); // 去掉方括号
+
+  let sumVal = props.fields.find(f => {
+    let _label = f.label.slice(1, -1);
+    if (_label === fieldName) {
+      return f;
+    }
+  });
+
+  let _value = sumVal ? isFilterPrice(sumVal.value) : "无";
+  return (
+    <>
+      <div class="flx-col flx-end formula-wrapper__item">
+        <span class="label text-secondary-text text-body-c">{fieldName}</span>
+        <span class="value text-primary-text text-h5-b">{_value}</span>
+      </div>
+    </>
+  );
+};
+
+const RenderFormulaItem = () => {
+  // console.log("RenderFormulaItem props.data :>> ", props.data);
+  let fArr = funcFormulaToArray(props.data.value);
+  // console.log("fArr: --", fArr);
+  if (fArr.length > 0) {
+    return (
+      <>
+        {/* <ElScrollbar> */}
+        <div class="formula-wrapper">
+          {fArr.map((t, i) => {
+            if (t.indexOf("[") === 0 && !props.data.ifnotreplace) {
+              return <div>{RenderVariable(t)}</div>;
+            } else {
+              let _t = t.replace(/\*/g, "x");
+              if (props.data.ifnotreplace) {
+                _t = _t.replace(/\[/g, "【").replace(/\]/g, "】");
+              }
+              return (
+                <>
+                  <div class="flx-end-end">
+                    <span class="text-h5-r ">{_t}</span>
+                  </div>
+                </>
+              );
+            }
+          })}
+        </div>
+        {/* </ElScrollbar> */}
+      </>
+    );
+  }
+};
+</script>
+
+<style lang="scss">
+.formula-wrapper {
+  // width: 400px;
+
+  // display: table;
+  // width: max-content;
+  user-select: none;
+
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+
+  & > * {
+    // display: table-cell;
+    margin-top: 4px;
+    margin-left: 4px;
+    margin-bottom: 4px;
+  }
+
+  &__item {
+    display: flex;
+    padding: 0 4px;
+    // & + & {
+    //   margin-left: 4px;
+    // }
+
+    .value {
+      color: $color-primary-600;
+    }
+
+    &:hover {
+      background-color: $color-primary-400;
+      border-radius: $br-sm;
+      .label {
+        color: $color-primary-000;
+      }
+      .value {
+        color: $color-gray-1;
+      }
+    }
+  }
+}
+</style>

+ 20 - 54
JLHWEB/src/views/quote/bednetQuote/detail.vue

@@ -79,6 +79,7 @@
 
   <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
   <SpringDialog ref="SpringDialogRef" v-bind="SpringDialogProps" />
+  <AllFormula ref="AllFormulaRef" />
 </template>
 
 <script setup lang="ts" name="bednetQuoteDetail">
@@ -93,7 +94,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, GetComputeBednet } from "@/api/modules/quote";
+import { SaveBedNet, AuditBedNet, DeleteBedNet } 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";
@@ -107,6 +108,7 @@ import SpringDialog from "@/views/system/selector/spring/index.vue";
 // import { getCurrentRecords } from "@/utils/index";
 import { useUserStore } from "@/stores/modules/user";
 import { getBedNetAreaList } from "@/api/modules/basicinfo";
+import AllFormula from "./components/AllFormula.vue";
 
 const { t } = useI18n();
 const route = useRoute();
@@ -132,6 +134,7 @@ const {
   currentArea,
   AreaList,
   dw_bednet_mx_spring,
+  AllFormulaRef,
   reload_dw2,
   getData,
   getDataMxAdd,
@@ -139,8 +142,9 @@ const {
   dataCallback,
   dataCallbackMx,
   wf_cmp_cb,
-  setMxSpringLength
-} = useHooks();
+  setMxSpringLength,
+  gotoSummy
+} = useHooks(t);
 
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 // const toast = useToast();
@@ -354,14 +358,6 @@ const orderDefaultAction: detailAction[] = [
         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);
@@ -555,40 +551,7 @@ const orderDefaultAction: detailAction[] = [
       // 业务员模式
       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()
+    clickFunc: () => gotoSummy(0, true)
   }),
   buttonDefault({
     label: t("common.copyQuote")
@@ -614,13 +577,13 @@ onMounted(async () => {
       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
-  );
+  // defaultColumnsValue.value.sponge_mtrlid = 0;
+  // console.log(
+  //   "donMounted efaultColumnsValue.value :>> ",
+  //   defaultColumnsValue.value,
+  //   Object.keys(route.query).includes("id"),
+  //   route.query?.id
+  // );
 });
 
 /**
@@ -671,7 +634,6 @@ const funcAfterMound = async (data: any) => {
   // }
   if (!orderStatus.value) {
     // 详情页
-    // gotoSummy(8000);
   } else {
     // 新增/编辑
     tableProps_mx.value.editConfig.enabled = true;
@@ -725,7 +687,7 @@ const funcAfterMound = async (data: any) => {
     // columnsMxSpring.value = result.tableinfo.columns;
     // bednetMxSpringData.value = result.list;
 
-    reload_dw2(data, (params: any) => {
+    await reload_dw2(data, (params: any) => {
       const { mx, spring } = params;
       console.log("reload_dw2 22result :>> ", params);
       bednetMxData.value = mx.list;
@@ -733,6 +695,10 @@ const funcAfterMound = async (data: any) => {
 
       // vxeTableMxSpringRef.value.refresh();
     });
+
+    nextTick(() => {
+      gotoSummy(8000);
+    });
     // bednetMxData.value = bednetMxData.value.map(t => {
     //   // t.formulakind = Number(t.formulakind);
     //   // t.thickness = Number(t.thickness);

+ 184 - 178
JLHWEB/src/views/quote/bednetQuote/hooks/index.tsx

@@ -3,11 +3,12 @@ import { Table } from "@/hooks/interface";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { ALLOW_EDIT_STATE, sys_arry_formulatype } from "@/config/index";
 import { CommonDynamicSelect } from "@/api/modules/common";
+import { GetComputeBednet } from "@/api/modules/quote";
 import { useUserStore } from "@/stores/modules/user";
 import MtrldefSelect from "@/views/system/selector/mtrldef/select.vue";
 import SpringSelect from "@/views/system/selector/spring/select.vue";
 // import { handleRowAccordingToProp } from "@/utils";
-import { ElButton, ElMessage, ElPopconfirm, ElMessageBox } from "element-plus";
+import { ElButton, ElMessage, ElPopconfirm, ElMessageBox, ElNotification } from "element-plus";
 import { Minus, Plus, InfoFilled } from "@element-plus/icons-vue";
 import { DwnameEnum } from "@/enums/dwnameEnum";
 import { isArray } from "@/utils/is";
@@ -38,6 +39,7 @@ interface defaultState {
   currentArea: any;
   AreaList: any;
   bednetVarList: any;
+  AllFormulaRef: any;
 }
 
 /**
@@ -134,10 +136,13 @@ export const useHooks = (t?: any) => {
     SpringDialogProps: {},
     currentArea: null,
     AreaList: [],
-    bednetVarList: []
+    bednetVarList: [],
+    AllFormulaRef: null
   });
   state.orderStatus = inject("orderStatus", "");
 
+  const { userInfo } = useUserStore();
+
   const rModelSetFabrics2_mtrlid = (data: any) => {
     data.sponge_tc_mtrlid = 0;
     data.mtrl_sponge_tc_name = "";
@@ -294,6 +299,27 @@ export const useHooks = (t?: any) => {
     data.hard_around_springname = "";
   };
 
+  const getPriceid = () => {
+    let _deptid = state.LjDetailRef?._mainData?.deptid ?? 0;
+    if (!_deptid) {
+      ElMessage.warning("请先选择部门");
+      state.LjDetailRef?.baseformRef.element.validateField("deptid");
+      return 0;
+    }
+
+    let deptEnum = state.LjDetailRef.enumMap.get("deptid");
+    let _pricelistid = 0;
+    console.log("deptEnum :>> ", deptEnum);
+    if (deptEnum) {
+      let depItem = deptEnum.find((item: any) => item.value == _deptid);
+      console.log("depItem :>> ", depItem);
+      if (depItem) {
+        _pricelistid = Number(depItem.pricelistid);
+      }
+    }
+    return _pricelistid;
+  };
+
   /**
    * @description 弹窗模块:选择物料
    * @param data 当前数据
@@ -302,12 +328,15 @@ export const useHooks = (t?: any) => {
    */
   const fModelChoseMtrl = (data: any, params: any, cb: any) => {
     return new Promise((resolve, reject) => {
-      // if (!ALLOW_EDIT_STATE.includes(status)) return;
+      let _pricelistid = getPriceid();
+      if (!_pricelistid) return false;
 
+      // if (!ALLOW_EDIT_STATE.includes(status)) return;
+      console.log("fModelChoseMtrl fModelChoseMtrl params :>> ", params);
       let _params = {
         keyword: "",
         arg_mtrltype: params.mtrltype,
-        arg_pricelistid: params.pricelistid
+        arg_pricelistid: _pricelistid
       };
       state.MtrldefDialogProps = {
         onSubmit: (res: any) => {
@@ -606,20 +635,8 @@ 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 {
-      list: _list,
+      list: data.datatable,
       tableinfo: data.tableinfo,
       total: data.totalcnt,
       pageNum: data.pageindex,
@@ -653,7 +670,13 @@ export const useHooks = (t?: any) => {
     { title: "#", field: "pid", fixed: "left", width: 80 },
     {
       title: "审核",
-      field: "flag"
+      field: "flag",
+      basicinfo: {
+        props: {
+          trueValue: "1",
+          falseValue: "0"
+        }
+      }
     },
     {
       field: "deptid",
@@ -763,11 +786,31 @@ export const useHooks = (t?: any) => {
           let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
           return (
             <>
-              <el-checkbox v-model={scope.searchParam.if_doublespring} disabled={_disabled} label="双簧" class="mr-8" />
-              <el-checkbox v-model={scope.searchParam.if_rsorwa} disabled={_disabled} label="胶条 包角" class="mr-8" />
-              <el-checkbox v-model={scope.searchParam.if_sponge_drilling} disabled={_disabled} label="海绵打孔" />
-              <el-checkbox v-model={scope.searchParam.iffork} disabled={_disabled} label="弹叉" />
-              <el-checkbox v-model={scope.searchParam.if_jb} disabled={_disabled} label="卷包" />
+              <el-checkbox
+                v-model={scope.searchParam.if_doublespring}
+                disabled={_disabled}
+                true-value="1"
+                false-value="0"
+                label="双簧"
+                class="mr-8"
+              />
+              <el-checkbox
+                v-model={scope.searchParam.if_rsorwa}
+                disabled={_disabled}
+                true-value="1"
+                false-value="0"
+                label="胶条 包角"
+                class="mr-8"
+              />
+              <el-checkbox
+                v-model={scope.searchParam.if_sponge_drilling}
+                disabled={_disabled}
+                true-value="1"
+                false-value="0"
+                label="海绵打孔"
+              />
+              <el-checkbox v-model={scope.searchParam.iffork} disabled={_disabled} true-value="1" false-value="0" label="弹叉" />
+              <el-checkbox v-model={scope.searchParam.if_jb} disabled={_disabled} true-value="1" false-value="0" label="卷包" />
             </>
           );
         }
@@ -807,41 +850,19 @@ export const useHooks = (t?: any) => {
       basicinfo: {
         editable: ALLOW_EDIT_STATE,
         render: (scope: any) => {
-          console.log("mtrlname hooks render scope :>> ", scope);
-          console.log("mtrl_sponge_name hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
           const { column, row, status } = scope;
-          let field = column.field;
           let _label = column.title;
-          // if (column?.format) {
-          //   _label = handleRowAccordingToProp(searchParam, field, column?.format);
-          // }
-          let _deptid = state.LjDetailRef._mainData.deptid;
-          let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-          let _pricelistid = 0;
-          console.log("deptEnum :>> ", deptEnum);
-          if (deptEnum) {
-            let depItem = deptEnum.find((item: any) => item.value == _deptid);
-            console.log("depItem :>> ", depItem);
-            if (depItem) {
-              _pricelistid = Number(depItem.pricelistid);
-            }
-          }
-          // console.log("_pricelistid :>> ", _pricelistid, row);
-
-          let params = {
-            mtrltype: 1,
-            pricelistid: _pricelistid
-          };
 
           return (
             <>
               <MtrldefSelect
                 value={scope.searchParam.sponge_mtrlid}
-                {...params}
+                pricelistidfn={() => getPriceid()}
+                mtrltype={1}
                 disabled={!ALLOW_EDIT_STATE.includes(status)}
                 clearable
                 placeholder={_label}
-                onOpenModal={() => fModelChoseMtrl(scope.searchParam, params, rModelSetMtrlSponge)}
+                onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 1 }, rModelSetMtrlSponge)}
                 onSelect={(val: any) => rModelSetMtrlSponge(scope.searchParam, val)}
                 onClear={() => rModelClearMtrlSponge(scope.searchParam)}
               >
@@ -878,41 +899,19 @@ export const useHooks = (t?: any) => {
       basicinfo: {
         editable: ALLOW_EDIT_STATE,
         render: (scope: any) => {
-          console.log("mtrlname hooks render scope :>> ", scope);
-          console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
           const { column, row, status } = scope;
-          let field = column.field;
           let _label = column.title;
-          // if (column?.format) {
-          //   _label = handleRowAccordingToProp(searchParam, field, column?.format);
-          // }
-          let _deptid = state.LjDetailRef._mainData.deptid;
-          let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-          let _pricelistid = 0;
-          console.log("deptEnum :>> ", deptEnum);
-          if (deptEnum) {
-            let depItem = deptEnum.find((item: any) => item.value == _deptid);
-            console.log("depItem :>> ", depItem);
-            if (depItem) {
-              _pricelistid = Number(depItem.pricelistid);
-            }
-          }
-          // console.log("_pricelistid :>> ", _pricelistid, row);
-
-          let params = {
-            mtrltype: 1,
-            pricelistid: _pricelistid
-          };
 
           return (
             <>
               <MtrldefSelect
                 value={scope.searchParam.sponge_tc_mtrlid}
-                {...params}
+                pricelistidfn={() => getPriceid()}
+                mtrltype={1}
                 disabled={!ALLOW_EDIT_STATE.includes(status)}
                 clearable
                 placeholder={_label}
-                onOpenModal={() => fModelChoseMtrl(scope.searchParam, params, rModelSetMtrlSpongeTc)}
+                onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 1 }, rModelSetMtrlSpongeTc)}
                 onSelect={(val: any) => rModelSetMtrlSpongeTc(scope.searchParam, val)}
                 onClear={() => rModelClearMtrlSpongeTc(scope.searchParam)}
               >
@@ -949,41 +948,19 @@ export const useHooks = (t?: any) => {
       basicinfo: {
         editable: ALLOW_EDIT_STATE,
         render: (scope: any) => {
-          console.log("mtrlname hooks render scope :>> ", scope);
-          console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
           const { column, row, status } = scope;
-          let field = column.field;
           let _label = column.title;
-          // if (column?.format) {
-          //   _label = handleRowAccordingToProp(searchParam, field, column?.format);
-          // }
-          let _deptid = state.LjDetailRef._mainData.deptid;
-          let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-          let _pricelistid = 0;
-          console.log("deptEnum :>> ", deptEnum);
-          if (deptEnum) {
-            let depItem = deptEnum.find((item: any) => item.value == _deptid);
-            console.log("depItem :>> ", depItem);
-            if (depItem) {
-              _pricelistid = Number(depItem.pricelistid);
-            }
-          }
-          // console.log("_pricelistid :>> ", _pricelistid, row);
-
-          let params = {
-            mtrltype: 7,
-            pricelistid: _pricelistid
-          };
 
           return (
             <>
               <MtrldefSelect
                 value={scope.searchParam.edge_mtrlid}
-                {...params}
+                pricelistidfn={() => getPriceid()}
+                mtrltype={7}
                 disabled={!ALLOW_EDIT_STATE.includes(status)}
                 clearable
                 placeholder={_label}
-                onOpenModal={() => fModelChoseMtrl(scope.searchParam, params, rModelSetMtrlEdge)}
+                onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlEdge)}
                 onSelect={(val: any) => rModelSetMtrlEdge(scope.searchParam, val)}
                 onClear={() => rModelClearMtrlEdge(scope.searchParam)}
               >
@@ -1013,30 +990,17 @@ export const useHooks = (t?: any) => {
         render: (scope: any) => {
           const { column, row, status } = scope;
           let _label = column.title;
-          let _deptid = state.LjDetailRef._mainData.deptid;
-          let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-          let _pricelistid = 0;
-          if (deptEnum) {
-            let depItem = deptEnum.find((item: any) => item.value == _deptid);
-            if (depItem) {
-              _pricelistid = Number(depItem.pricelistid);
-            }
-          }
-
-          let params = {
-            mtrltype: 7,
-            pricelistid: _pricelistid
-          };
 
           return (
             <>
               <MtrldefSelect
                 value={scope.searchParam.felt_mtrlid}
-                {...params}
+                pricelistidfn={() => getPriceid()}
+                mtrltype={7}
                 disabled={!ALLOW_EDIT_STATE.includes(status)}
                 clearable
                 placeholder={_label}
-                onOpenModal={() => fModelChoseMtrl(scope.searchParam, params, rModelSetMtrlFelt)}
+                onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlFelt)}
                 onSelect={(val: any) => rModelSetMtrlFelt(scope.searchParam, val)}
                 onClear={() => rModelClearMtrlFelt(scope.searchParam)}
               >
@@ -1065,30 +1029,17 @@ export const useHooks = (t?: any) => {
         render: (scope: any) => {
           const { column, row, status } = scope;
           let _label = column.title;
-          let _deptid = state.LjDetailRef._mainData.deptid;
-          let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-          let _pricelistid = 0;
-          if (deptEnum) {
-            let depItem = deptEnum.find((item: any) => item.value == _deptid);
-            if (depItem) {
-              _pricelistid = Number(depItem.pricelistid);
-            }
-          }
-
-          let params = {
-            mtrltype: 7,
-            pricelistid: _pricelistid
-          };
 
           return (
             <>
               <MtrldefSelect
                 value={scope.searchParam.felt_x_mtrlid}
-                {...params}
+                pricelistidfn={() => getPriceid()}
+                mtrltype={7}
                 disabled={!ALLOW_EDIT_STATE.includes(status)}
                 clearable
                 placeholder={_label}
-                onOpenModal={() => fModelChoseMtrl(scope.searchParam, params, rModelSetMtrlFeltX)}
+                onOpenModal={() => fModelChoseMtrl(scope.searchParam, { mtrltype: 7 }, rModelSetMtrlFeltX)}
                 onSelect={(val: any) => rModelSetMtrlFeltX(scope.searchParam, val)}
                 onClear={() => rModelClearMtrlFeltX(scope.searchParam)}
               >
@@ -1171,7 +1122,11 @@ export const useHooks = (t?: any) => {
       field: "ifsaleout",
       basicinfo: {
         el: "checkbox",
-        editable: ALLOW_EDIT_STATE
+        editable: ALLOW_EDIT_STATE,
+        props: {
+          trueValue: "1",
+          falseValue: "0"
+        }
       }
     },
     {
@@ -1894,40 +1849,18 @@ export const useHooks = (t?: any) => {
       field: "fabrics2_mtrlid",
       editRender: {},
       editColRender: (scope: any) => {
-        console.log("mtrlname hooks render scope :>> ", scope);
-        console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
         const { column, row, status } = scope;
-        let field = column.field;
         let _label = column.title;
-        // if (column?.format) {
-        //   _label = handleRowAccordingToProp(searchParam, field, column?.format);
-        // }
-        let _deptid = state.LjDetailRef._mainData.deptid;
-        let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-        let _pricelistid = 0;
-        console.log("deptEnum :>> ", deptEnum);
-        if (deptEnum) {
-          let depItem = deptEnum.find((item: any) => item.value == _deptid);
-          console.log("depItem :>> ", depItem);
-          if (depItem) {
-            _pricelistid = Number(depItem.pricelistid);
-          }
-        }
-        console.log("_pricelistid :>> ", _pricelistid, row.formulakind);
-
-        let params = {
-          mtrltype: 2,
-          pricelistid: _pricelistid
-        };
 
         return (
           <>
             <MtrldefSelect
               value={row.fabrics2_mtrlid}
-              {...params}
+              pricelistidfn={() => getPriceid()}
+              mtrltype={2}
               clearable
               placeholder={_label}
-              onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrlFabrisc2)}
+              onOpenModal={() => fModelChoseMtrl(row, { mtrltype: 2 }, rModelSetMtrlFabrisc2)}
               onSelect={(val: any) => rModelSetMtrlFabrisc2(row, val)}
               onClear={() => rModelClearMtrlFabrisc2(row)}
             />
@@ -1939,36 +1872,18 @@ export const useHooks = (t?: any) => {
       field: "fabrics1_mtrlid",
       editRender: {},
       editColRender: (scope: any) => {
-        console.log("mtrlname hooks render scope :>> ", scope);
-        console.log("mtrlname hooks render LjDetailRef.value._mainData :>> ", state.LjDetailRef);
         const { column, row, status } = scope;
         let _label = column.title;
-        let _deptid = state.LjDetailRef._mainData.deptid;
-        let deptEnum = state.LjDetailRef.enumMap.get("deptid");
-        let _pricelistid = 0;
-        console.log("deptEnum :>> ", deptEnum);
-        if (deptEnum) {
-          let depItem = deptEnum.find((item: any) => item.value == _deptid);
-          console.log("depItem :>> ", depItem);
-          if (depItem) {
-            _pricelistid = Number(depItem.pricelistid);
-          }
-        }
-        console.log("_pricelistid :>> ", _pricelistid, row.formulakind);
-
-        let params = {
-          mtrltype: 2,
-          pricelistid: _pricelistid
-        };
 
         return (
           <>
             <MtrldefSelect
               value={row.fabrics1_mtrlid}
-              {...params}
+              pricelistidfn={() => getPriceid()}
+              mtrltype={2}
               clearable
               placeholder={_label}
-              onOpenModal={() => fModelChoseMtrl(row, params, rModelSetMtrlFabrisc1)}
+              onOpenModal={() => fModelChoseMtrl(row, { mtrltype: 2 }, rModelSetMtrlFabrisc1)}
               onSelect={(val: any) => rModelSetMtrlFabrisc1(row, val)}
               onClear={() => rModelClearMtrlFabrisc1(row)}
             />
@@ -2444,6 +2359,96 @@ export const useHooks = (t?: any) => {
     }
   };
 
+  /**
+   * @description 展示计算公式
+   * @param timeout
+   */
+  const gotoSummy = async (timeout = 0, ifdrawer?: boolean) => {
+    if (userInfo.usermode == 1) {
+      ElMessage.error("'业务员模式不可以查看计算公式!'");
+      return false;
+    }
+    console.log(
+      "state.vxeTableMxRef?.element.getTableData().fullData :>> ",
+      state.vxeTableMxRef?.element.getTableData().fullData,
+      state.vxeTableMxRef
+    );
+    let bednet = cloneDeep(state.LjDetailRef._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);
+    bednet.flag = Number(bednet.flag);
+
+    let _params: any = {
+      bednet: bednet,
+      bednetMx: state.vxeTableMxRef?.element.getTableData().fullData ?? [],
+      spring: state.vxeTableMxSpringRef?.element.getTableData().fullData ?? []
+    };
+    let res = await GetComputeBednet(_params);
+    console.log("GetComputeBednet res :>> ", res);
+    let summaryData = [];
+    let fieldParams = [];
+    let cpData = {};
+    if (!res.message) {
+      summaryData = res.formulas;
+      fieldParams = res.replace;
+      cpData = res.bednet;
+    } else {
+      setTimeout(() => {
+        if (res.message) {
+          ElNotification({
+            title: "计算失败",
+            message: res.message,
+            type: "warning"
+          });
+        }
+      }, 100);
+      return false;
+    }
+
+    console.log("summaryData :>> ", summaryData, fieldParams);
+
+    const toast = useToast();
+    if (ifdrawer) {
+      state.AllFormulaRef.open(summaryData, fieldParams, cpData);
+      toast.clear();
+    } else {
+      toast(
+        {
+          component: ToastFormula,
+          props: {
+            t: t,
+            formulas: summaryData,
+            // data: cpData,
+            fields: fieldParams
+          },
+          listeners: {
+            tomore: () => {
+              console.log("tomore summaryData :>> ", summaryData);
+              state.AllFormulaRef.open(summaryData, fieldParams, cpData);
+              toast.clear();
+            },
+            refresh: () => {
+              gotoSummy();
+            }
+          }
+        },
+        {
+          position: POSITION.BOTTOM_RIGHT,
+          icon: false,
+          timeout: timeout,
+          closeButton: false,
+          toastClassName: "longjoe-toast"
+        }
+      );
+    }
+  };
+
   return {
     ...toRefs(state),
     columns,
@@ -2459,6 +2464,7 @@ export const useHooks = (t?: any) => {
     dataCallback,
     dataCallbackMx,
     wf_cmp_cb,
-    setMxSpringLength
+    setMxSpringLength,
+    gotoSummy
   };
 };

+ 133 - 0
JLHWEB/src/views/quote/mattressQuote/components/AllFormula.vue

@@ -0,0 +1,133 @@
+<template>
+  <LjDrawer
+    v-if="visible"
+    ref="LjDrawerRef"
+    :class="`${prefixCls}`"
+    :id="prefixCls"
+    direction="rtl"
+    size="60%"
+    destroy-on-close
+    append-to-body
+    :show-close="false"
+    @close="autoClose"
+  >
+    <template #header>
+      <div class="flx-justify-between">
+        <div class="">详细报价</div>
+        <div class="flx-shrink">
+          <el-button type="danger" :icon="Close" text circle @click="cancelClick"></el-button>
+        </div>
+      </div>
+    </template>
+    <template #default>
+      <LjHeader class="flx-1" title="单据统计" />
+      <FormulaGroup :data="isNormalFormulas" :fields="fieldsReplace" />
+    </template>
+  </LjDrawer>
+</template>
+
+<script setup lang="ts" name="mattressQuoteDetail_AllFormula">
+import { ref, computed, watch, nextTick } from "vue";
+import LjDrawer from "@/components/LjDrawer/index.vue";
+import { useI18n } from "vue-i18n";
+import { useDesign } from "@/hooks/useDesign";
+import { useGlobalStore } from "@/stores/modules/global";
+import { Close, Search } from "@element-plus/icons-vue";
+import FormulaGroup from "./FormulaGroup.vue";
+import LjHeader from "@/components/LjHeader/index.vue";
+
+const { t } = useI18n();
+const { prefixCls } = useDesign("bednet-formal-detail");
+const globalStore = useGlobalStore();
+
+const visible = ref(false);
+const LjDrawerRef = ref();
+const formulaList = ref<any>([]);
+const fieldsReplace = ref<any>([]);
+// const mainData = ref<any>({});
+const formulaMxList = ref<any>([]);
+
+const isNormalFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 0);
+});
+
+const isMxFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 2);
+});
+const isWeigthFormulas = computed(() => {
+  return formulaList.value.filter((item: any) => item.type == 3);
+});
+
+const autoClose = () => {
+  setTimeout(() => {
+    visible.value = false;
+  }, 200);
+};
+
+const cancelClick = () => {
+  // searchField.value = "";
+  LjDrawerRef.value.hide();
+  // selectColumn.value = [];
+  // ifAllSelect.value = false;
+};
+
+/**
+ * @description 显示组件
+ */
+const open = (formulas: any, replace: any) => {
+  visible.value = true;
+  formulaList.value = formulas;
+  fieldsReplace.value = replace;
+  // mainData.value = data;
+
+  formulaMxList.value;
+
+  nextTick(() => {
+    //   list.value = cloneDeep(params);
+    //   oriList.value = cloneDeep(params);
+
+    //   let arr: string[] = [];
+    //   params.map((item: any) => {
+    //     if (item.basicinfo && item.basicinfo.hasOwnProperty("group")) {
+    //       item.basicinfo.group && !arr.includes(item.basicinfo.group) && arr.push(item.basicinfo.group);
+    //     }
+    //   });
+    //   groupList.value = arr;
+
+    //   selectGroup.value = group;
+
+    LjDrawerRef.value.show();
+    //   console.log("open columnsDrag.value :>> ", columnsDrag.value);
+
+    //   nextTick(() => {
+    //     initDragSelect();
+    //   });
+  });
+};
+
+defineExpose({
+  open
+});
+</script>
+
+<style lang="scss" scoped>
+$prefix-cls: "#{$namespace}-bednet-formal-detail";
+
+.#{$prefix-cls} {
+  .summary-wrapper {
+    &__label-item {
+      position: relative;
+      margin-right: $space-a3;
+
+      &::after {
+        content: "=";
+        position: absolute;
+        bottom: 0;
+        right: -$space-b3;
+        font-size: 24px;
+        color: $color-text-disable;
+      }
+    }
+  }
+}
+</style>

+ 80 - 0
JLHWEB/src/views/quote/mattressQuote/components/FormulaGroup.vue

@@ -0,0 +1,80 @@
+<template>
+  <div class="summary-wrapper flx" v-for="item in data" :key="item.field">
+    <div class="summary-wrapper__label-item flx-start-end" :style="{ width: width + 'px' }">
+      <div class="summary-box_item flx-col mt-4">
+        <div class="flx-1 text-secondary-text text-body-c text-right">
+          {{ isFilterLabel(item.label) }}
+        </div>
+        <div class="flx-shrink ml-8 text-right text-h5-b">
+          {{ isFilterPrice(isFilterFields(item)) }}
+        </div>
+      </div>
+    </div>
+    <div class="flx-1 enter-x overflow-auto">
+      <FormulaItem :data="item" :fields="fields" />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts" name="mattressQuoteDetail_FormulaGroup">
+import {} from "vue";
+import FormulaItem from "@/views/quote/bednetQuote/components/FormulaItem.vue";
+import { formatAmount3 } from "@/utils/index";
+
+interface WidgetProps {
+  data: any;
+  /**
+   * @description 字段对照表
+   */
+  fields: any[];
+  width?: number;
+}
+
+const props = withDefaults(defineProps<WidgetProps>(), {
+  width: 120
+});
+
+const isFilterFields = (data: any) => {
+  return props.fields.find(f => f.label == data.label)?.value ?? 0;
+};
+
+const isFilterLabel = (val: any) => {
+  return val.replace(/【/g, "").replace(/】/g, "");
+};
+
+const isFilterPrice = data => {
+  let val = formatAmount3({ val: data });
+  // 过滤掉末尾的0
+  let arr = val.split("");
+  while (arr[arr.length - 1] === "0") {
+    arr.pop();
+  }
+  return arr.join("");
+};
+</script>
+
+<style lang="scss" scoped>
+.summary-wrapper {
+  margin-bottom: 8px;
+  &:hover {
+    background: $color-primary-000;
+    border-radius: $br-md;
+  }
+  &__label-item {
+    margin-right: $space-a3;
+
+    .summary-box_item {
+      position: relative;
+
+      &::after {
+        content: "=";
+        position: absolute;
+        bottom: 0;
+        right: -$space-b3;
+        font-size: 24px;
+        color: $color-text-disable;
+      }
+    }
+  }
+}
+</style>

+ 11 - 4
JLHWEB/src/views/quote/mattressQuote/components/QuoteList.vue

@@ -97,7 +97,14 @@ const show = () => {
 };
 
 const isFilterPrice = data => {
-  return formatAmount3({ val: data });
+  // return formatAmount3({ val: data });
+  let val = formatAmount3({ val: data });
+  // 过滤掉末尾的0
+  let arr = val.split("");
+  while (arr[arr.length - 1] === "0") {
+    arr.pop();
+  }
+  return arr.join("");
 };
 
 const isFilterTime = time => {
@@ -187,9 +194,9 @@ const getSummaries = (param: any) => {
     }
     const values = data.map(item => Number(item[column.property]?.toString().replace(/,/g, "")));
     if (column.property == "costamt" && !values.every(value => Number.isNaN(value))) {
-      console.log("values :>> ", values);
+      // console.log("values :>> ", values);
       sums[index] = `${values.reduce((prev, curr) => {
-        console.log("prev,curr :>> ", prev, curr);
+        // console.log("prev,curr :>> ", prev, curr);
         const value = Number(curr);
         if (!Number.isNaN(value)) {
           return floatAdd(prev, curr);
@@ -469,7 +476,7 @@ const objectSpanMethod = (data: any) => {
           }
         }
         rowspan += _span;
-        console.log("rowspan _span :>> ", column.property, rowspan, _span);
+        // console.log("rowspan _span :>> ", lastVal, currentVal, rowspan, _span);
       } else {
         rowspan = 0;
       }

+ 114 - 32
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -29,7 +29,7 @@
       <template v-else>{{ scope.props.label }}</template>
     </template>
     <template #fabricMx>
-      <el-tabs v-model="fabricMxTabs" type="card" class="h-full">
+      <el-tabs v-model="fabricMxTabs" type="card" class="h-full flx-col fabric-mx-tabs">
         <el-tab-pane
           class="h-full flx"
           label="裥面"
@@ -48,6 +48,8 @@
             :auto-load-layout="false"
             collapseButtons
             :request-auto="false"
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
           </LjVxeTable>
         </el-tab-pane>
@@ -69,6 +71,8 @@
             :request-auto="false"
             :auto-load-layout="false"
             collapseButtons
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
           </LjVxeTable>
         </el-tab-pane>
@@ -90,8 +94,10 @@
             :request-auto="false"
             :auto-load-layout="false"
             collapseButtons
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
-            <template #tableHeader>
+            <template #tableHeader v-if="orderStatus">
               <el-space wrap>
                 <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_10', val)">
                   <el-button type="primary">
@@ -130,8 +136,10 @@
             :request-auto="false"
             :auto-load-layout="false"
             collapseButtons
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
-            <template #tableHeader>
+            <template #tableHeader v-if="orderStatus">
               <el-space wrap>
                 <el-dropdown placement="bottom-start" @command="val => handleSelFabricMxNewMtrlGroup('tabpage_11', val)">
                   <el-button type="primary">
@@ -170,6 +178,8 @@
             :request-auto="false"
             :auto-load-layout="false"
             collapseButtons
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
           </LjVxeTable>
         </el-tab-pane>
@@ -186,6 +196,8 @@
             :request-auto="false"
             :auto-load-layout="false"
             collapseButtons
+            :extra-loading="mxLoading"
+            :footer-sum-attrs="['costamt']"
           >
           </LjVxeTable>
         </el-tab-pane>
@@ -213,6 +225,8 @@
         :request-auto="false"
         :auto-load-layout="false"
         collapseButtons
+        :extra-loading="mxLoading"
+        :footer-sum-attrs="['costamt']"
       >
         <!-- <template #tableHeader>
           <el-space wrap>
@@ -244,8 +258,10 @@
         :request-auto="false"
         :auto-load-layout="false"
         collapseButtons
+        :extra-loading="mxLoading"
+        :footer-sum-attrs="['costamt']"
       >
-        <template #tableHeader>
+        <template #tableHeader v-if="orderStatus">
           <el-space wrap>
             <el-button type="primary" @click="toAddMx_cushions(0)">{{ $t("common.addText") }}</el-button>
             <el-button type="primary" @click="toAddMx_cushions(1)">{{ $t("common.insert") }}</el-button>
@@ -280,6 +296,8 @@
         :request-auto="false"
         :auto-load-layout="false"
         collapseButtons
+        :extra-loading="mxLoading"
+        :footer-sum-attrs="['costamt']"
       >
         <!-- <template #tableHeader>
           <el-space wrap>
@@ -311,6 +329,8 @@
         :request-auto="false"
         :auto-load-layout="false"
         collapseButtons
+        :extra-loading="mxLoading"
+        :footer-sum-attrs="['costamt']"
       >
         <template #tableHeader>
           <el-space wrap>
@@ -332,12 +352,12 @@
                 <el-input-number v-model="scope.data.packqty" :min="0" :max="1000" />
               </el-form-item>
               <el-form-item label="地区">
-                <el-select v-model="scope.data.area" style="width: 120px">
+                <el-select v-model="scope.data.area" style="width: 120px" clearable>
                   <el-option v-for="item in areaOptions" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
               </el-form-item>
               <el-form-item label="柜型">
-                <el-select v-model="scope.data.cabinet_type" style="width: 120px">
+                <el-select v-model="scope.data.cabinet_type" style="width: 120px" clearable>
                   <el-option v-for="item in cabinetTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
                 </el-select>
               </el-form-item>
@@ -372,7 +392,15 @@
         :tool-button="[]"
         :auto-load-layout="false"
         collapseButtons
+        :footer-sum-attrs="['costamt']"
       >
+        <template #tableHeader v-if="orderStatus">
+          <el-space wrap>
+            <el-button type="primary" @click="handleToImportMxInner">{{ $t("business.detail.importMx") }}</el-button>
+            <el-button type="danger" @click="hanleDelMxInner(0)">{{ $t("business.detail.deleteMx") }}</el-button>
+            <el-button type="danger" @click="hanleDelMxInner(1)">{{ $t("business.detail.deleteAllMx") }}</el-button>
+          </el-space>
+        </template>
       </LjVxeTable>
     </template>
 
@@ -398,12 +426,23 @@
         :tool-button="[]"
         :auto-load-layout="false"
         collapseButtons
+        :footer-sum-attrs="['costamt']"
       >
-        <template #tableHeader>
+        <template #tableHeader v-if="orderStatus">
           <el-space wrap>
-            <el-button type="primary">{{ $t("common.addText") }}</el-button>
-            <el-button type="danger">{{ $t("common.delText") }}</el-button>
-            <el-button type="danger">{{ $t("common.delAllMx") }}</el-button>
+            <el-dropdown placement="bottom-start" @command="wf_add_w_butao">
+              <el-button type="primary">
+                {{ $t("common.addText") }}<el-icon class="el-icon--right"><ArrowDown /></el-icon>
+              </el-button>
+              <template #dropdown>
+                <el-dropdown-menu>
+                  <el-dropdown-item v-for="item in topCottonAddList" :key="item.value" :command="item">{{
+                    item.label
+                  }}</el-dropdown-item>
+                </el-dropdown-menu>
+              </template>
+            </el-dropdown>
+            <el-button type="danger" @click="wf_del_w_butao">{{ $t("common.delText") }}</el-button>
           </el-space>
         </template>
       </LjVxeTable>
@@ -426,6 +465,7 @@
     :fabricMx="fabricMxTabList"
     :formulakindenum="formulaKindEnum"
   />
+  <AllFormula ref="AllFormulaRef" />
 </template>
 
 <script setup lang="ts" name="mattressQuoteDetail">
@@ -454,6 +494,7 @@ import mittBus from "@/utils/mittBus";
 import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
 import { useUserStore } from "@/stores/modules/user";
+import AllFormula from "./components/AllFormula.vue";
 
 // interface detailProp {
 //   // /**
@@ -487,8 +528,6 @@ const {
   columnsMxPackag,
   columnsMxInnerClothLayer,
   LjDetailRef,
-  summaryData,
-  fieldParams,
   MtrldefDialogRef,
   MtrldefDialogProps,
   BednetDialogRef,
@@ -531,6 +570,8 @@ const {
   woodpallettypeOptions,
   areaOptions,
   cabinetTypeOptions,
+  topCottonAddList,
+  AllFormulaRef,
   funcAddMxSide,
   funcChaifenTab,
   getData_mx,
@@ -542,7 +583,12 @@ const {
   getFormulakindEnum,
   funcPacktypeChange,
   dynamicRef,
-  wf_cmp_cb
+  wf_cmp_cb,
+  handleToImportMxInner,
+  hanleDelMxInner,
+  wf_add_w_butao,
+  wf_del_w_butao,
+  w_mattress_add_itemname_choose
 } = useHooks(t);
 const { toExcelQuote } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -554,6 +600,7 @@ const { userInfo } = useUserStore();
 const tabRemove: Function = inject("tabRemove") as Function;
 
 const defaultColumnsValue = ref<any>({});
+const mxLoading = ref(false);
 
 /**
  * @description 明细表格组件基础配置
@@ -563,7 +610,7 @@ const tableProps_mx = ref({
   align: "left",
   // height: "",
   minHeight: "300px",
-  editConfig: { trigger: "click", mode: "row", enabled: false },
+  editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
   // exportConfig: {
   //   filename: t("menu.saleTaskCrmDetail") + formatToDate(new Date(), "YYYY-MM-DDHH:mm:ss")
   // }
@@ -789,7 +836,12 @@ const isQuoteListMxData = computed(() => {
 // const innerClothLayerMxData = ref([]);
 // const innerClothLayerMxRef = ref();
 const innerClothLayerNum = computed(() => {
-  return innerClothLayerMxRef.value && innerClothLayerMxRef.value?.tableData ? innerClothLayerMxRef.value.tableData.length : 0;
+  let arr = [];
+  const $table = innerClothLayerMxRef.value?.element;
+  if ($table) {
+    arr = $table.getTableData().fullData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
+  }
+  return arr.length;
 });
 
 const getData_innerClothLayer = (params: any) => {
@@ -813,10 +865,16 @@ const getData_innerClothLayer = (params: any) => {
  */
 // const topCottonMxRef = ref();
 const topCottonNum = computed(() => {
-  return topCottonMxRef.value && topCottonMxRef.value?.tableData ? topCottonMxRef.value.tableData.length : 0;
+  let arr = [];
+  const $table = topCottonMxRef.value?.element;
+  if ($table) {
+    arr = $table.getTableData().fullData.filter(t => t.mtrlid && Number(t.mtrlid) > 0);
+  }
+  return arr.length;
 });
 
 const getData_topCotton = (params: any) => {
+  if (initParams.value.arg_mattressid == 0) return false;
   let _params = { ...params, arg_formulatype: [103] };
   return getData_mx(_params);
 };
@@ -878,7 +936,7 @@ const detailProps = reactive<DetailProp>({
       label: t("business.detail.innerClothLayer"),
       limited: (params: any) => {
         if (!params) return true;
-        return params?.if_n_butao == "0";
+        return !params?.if_n_butao || params?.if_n_butao == "0";
       }
     },
     {
@@ -947,17 +1005,17 @@ const orderDefaultAction = [
 
         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);
+        mattress.xd_flag = Number(mattress.xd_flag ?? 0);
+        console.log("bbbbbbbbbbbbbbbbbbbb mattress :>> ", mattress);
+        // 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_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 => {
@@ -1325,8 +1383,8 @@ onMounted(async () => {
   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.area = "";
+  defaultColumnsValue.value.cabinet_type = "";
   defaultColumnsValue.value.hrcost = 0;
   defaultColumnsValue.value.biandaicost = 0;
   defaultColumnsValue.value.flag = 0;
@@ -1341,6 +1399,14 @@ onMounted(async () => {
   defaultColumnsValue.value.discount = 1;
   defaultColumnsValue.value.butao_point = 1;
   defaultColumnsValue.value.guanli_rate = 1;
+  defaultColumnsValue.value.if_bcp_type = 0;
+  defaultColumnsValue.value.if_d_chai = 0;
+  defaultColumnsValue.value.if_m_chai = 0;
+  defaultColumnsValue.value.if_m_wbutao_way = 0;
+  defaultColumnsValue.value.if_n_butao = 0;
+  defaultColumnsValue.value.if_w_butao = 0;
+  defaultColumnsValue.value.if_z_chai = 0;
+  defaultColumnsValue.value.if_zhedie_type = 0;
 
   console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
 
@@ -1407,11 +1473,13 @@ const funcAfterMound = async () => {
   // }
   if (!orderStatus.value) {
     // 详情页
-    gotoSummy(8000);
   } else {
     // 新增/编辑
     tableProps_mx.value.editConfig.enabled = true;
+
+    topCottonAddList.value = w_mattress_add_itemname_choose(4);
   }
+
   ifAfterMound.value = true;
 
   console.log("onMounted detail sale start LjDetailRef.value.mainData :>> ", LjDetailRef.value);
@@ -1436,7 +1504,7 @@ const funcAfterMound = async () => {
     //   t.thickness = Number(t.thickness);
     //   return t;
     // });
-
+    mxLoading.value = true;
     getMattressType();
 
     let res = await getData_mx(initParams.value);
@@ -1451,6 +1519,11 @@ const funcAfterMound = async () => {
     console.log("funcAfterMound oriMxData.value :>> ", oriMxData.value);
 
     funcChaifenTab();
+    mxLoading.value = false;
+
+    nextTick(() => {
+      gotoSummy(8000);
+    });
     // funcGetFabricMxShowData(itmshow.name);
     // console.log("funcAfterMound resData :>> ", fabricMxData.value);
   }
@@ -1719,4 +1792,13 @@ const toDelMx_cushions = () => {
     text-align: right;
   }
 }
+.fabric-mx-tabs {
+  .el-tabs__content {
+    flex: 1;
+  }
+  .el-tab-pane {
+    display: flex;
+    flex-direction: column;
+  }
+}
 </style>

+ 58 - 30
JLHWEB/src/views/quote/mattressQuote/hooks/cpQuote.ts

@@ -127,9 +127,10 @@ export const useHooksCpQuote = (t?: any) => {
 
     // let bednetMxData = [];
     // let bednetMxSpringData = [];
-    let res = await getDataMxAdd({ arg_bednetid: data.bednetid });
+    console.log("data :>> ", data);
+    let res = await getDataMxAdd({ arg_bednetid: data.list[0].bednetid });
     let mxResult = dataCallbackMx(res);
-    console.log("mxResult :>> ", mxResult);
+    console.log("wf_retrieve_qingdan_bednet mxResult :>> ", mxResult);
 
     let ls_床网名称,
       ls_区区,
@@ -149,7 +150,7 @@ export const useHooksCpQuote = (t?: any) => {
       ls_填充海绵物料 = "";
     let item: any = {};
 
-    let res2 = await getDataMxSpring({ arg_bednetid: data.bednetid });
+    let res2 = await getDataMxSpring({ arg_bednetid: data.list[0].bednetid });
     let springResult = dataCallbackMx(res2);
     console.log("springResult :>> ", springResult);
 
@@ -159,9 +160,10 @@ export const useHooksCpQuote = (t?: any) => {
     });
 
     let enumItem = data.tableinfo.columns.find((item: any) => item.field == "bednettypeid");
+    console.log("bednettypeid enumItem :>> ", enumItem);
     let _pznamemx = "";
     if (enumItem) {
-      _pznamemx = enumItem.enum.find((item: any) => item.value == data.bednettypeid)?.label;
+      _pznamemx = enumItem.enum.find((item: any) => item.value == data.list[0].bednettypeid)?.label;
     }
 
     //床网类型
@@ -654,8 +656,9 @@ export const useHooksCpQuote = (t?: any) => {
   };
 
   const f_get_bednet_qingdan = async (bednetid: any) => {
+    if (!Number(bednetid)) return [];
     let _params = {
-      dsname: "web_bednet_define",
+      dsname: "web_bednet",
       queryparams: {
         arg_bednetid: bednetid
       }
@@ -669,9 +672,11 @@ export const useHooksCpQuote = (t?: any) => {
       list: res?.datatable,
       tableinfo: res?.tableinfo
     };
+    console.log("f_get_bednet_qingdan _data:>> ", _data);
 
     if (!Number(_data.deptid)) {
       throw new Error(_data.bednetcode + ", deptid错误!");
+      return [];
     }
 
     let deptEnum = state.enumMap.get("deptid");
@@ -717,7 +722,7 @@ export const useHooksCpQuote = (t?: any) => {
 
     console.log("mxdata data:>> ", mxdata, data);
     let _mxitm = null;
-    mxdata.map(item => {
+    mxdata.map(async (item, index) => {
       switch (item.field) {
         case "tabpage_8":
         case "tabpage_9":
@@ -748,6 +753,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.useqty = Number(itm.useqty ?? 0);
                 result.price = isFilterPrice(itm.price ?? 0);
               }
+              result.index = index;
               state.tableData.push(result);
             }
           });
@@ -760,7 +766,8 @@ export const useHooksCpQuote = (t?: any) => {
               !_mxitm.type.includes(Number(itm.formulakind))
             ) {
               let result: any = {};
-              result.label = itm.label;
+              // result.label = itm.label;
+              result.label = "其他工艺";
               let _formulaName = "";
               if (formulakindenum) {
                 _formulaName = formulakindenum.find(t => t.value == itm.formulakind)?.label ?? "";
@@ -778,11 +785,15 @@ export const useHooksCpQuote = (t?: any) => {
                 result.useqty = Number(itm.useqty ?? 0);
                 result.price = isFilterPrice(itm.price ?? 0);
               }
+              result.index = index;
               state.tableData.push(result);
             }
           });
           break;
         case "cushions": // 垫层
+          let _index = index;
+          console.log("cushions item.data.bednet :>> ", item.data.bednet);
+          console.log("cushions item.data.cushions :>> ", item.data.cushions);
           item.data.cushions.map(async itm => {
             if (Number(itm.mtrlid ?? 0) > 0 || Number(itm.costamt ?? 0) != 0 || [999].includes(Number(itm.formulakind))) {
               let result: any = {};
@@ -804,43 +815,58 @@ export const useHooksCpQuote = (t?: any) => {
                   result.useqty = Number(itm.useqty ?? 0);
                   result.price = isFilterPrice(itm.price ?? 0);
                 }
+
+                result.index = _index;
+                state.tableData.push(result);
               } else {
                 // 999是床网
 
+                console.log("itm.formulakind 9999:>> ", itm.formulakind);
+
                 let ll_bednetid = 0;
                 let ld_bednet_height = 0;
                 let s_bednet_qingdan = [];
                 // let arg_temp_msg;
-
-                if (item.data.bednet.length == 1) {
-                  //单床网
-                  ll_bednetid = item.data.bednet[0].mtrlid;
-                  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;
-                    if (userInfo.usermode == 0) {
-                      result.costamt = isFilterPrice(s_bednet_qingdan[1].amt ?? 0);
-                    }
-                  }
-                } else {
-                  //多床网
-                  item.data.bednet.map(async t => {
+                if (item.data.bednet.length && item.data.bednet[0].mtrlid > 0) {
+                  if (item.data.bednet.length == 1) {
+                    //单床网
                     ll_bednetid = item.data.bednet[0].mtrlid;
-
                     let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
+                    console.log("cushions item.data.bednet s_bednet_qingdan :>> ", s_bednet_qingdan);
                     if (s_bednet_qingdan.length) {
-                      result.dscrp = s_bednet_qingdan[1].pznamemx;
+                      result.dscrp = s_bednet_qingdan[0].pznamemx;
                       result.qty = 1;
                       if (userInfo.usermode == 0) {
-                        result.costamt = isFilterPrice(s_bednet_qingdan[1].amt ?? 0);
+                        result.costamt = isFilterPrice(s_bednet_qingdan[0]?.amt ?? 0);
                       }
                     }
-                  });
+                  } else {
+                    //多床网
+                    item.data.bednet.map(async t => {
+                      ll_bednetid = item.data.bednet[0].mtrlid;
+
+                      let s_bednet_qingdan = await f_get_bednet_qingdan(ll_bednetid);
+                      if (s_bednet_qingdan.length) {
+                        result.dscrp = s_bednet_qingdan[0].pznamemx;
+                        result.qty = 1;
+                        if (userInfo.usermode == 0) {
+                          result.costamt = isFilterPrice(s_bednet_qingdan[0]?.amt ?? 0);
+                        }
+                      }
+                    });
+                  }
+
+                  result.index = _index;
+                  // 查找数组中,从结尾数起最后出现的index=_index的元素的索引,在起后面插入result
+                  let _arrData = cloneDeep(state.tableData);
+                  let _last = _arrData.reverse().findIndex(t => t.index == _index);
+                  if (_last == -1) {
+                    state.tableData.push(result);
+                  } else {
+                    state.tableData.splice(state.tableData.length - _last, 0, result);
+                  }
                 }
               }
-
-              state.tableData.push(result);
             }
           });
           break;
@@ -866,6 +892,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.useqty = Number(itm.useqty ?? 0);
                 result.price = isFilterPrice(itm.price ?? 0);
               }
+              result.index = index;
               state.tableData.push(result);
             }
           });
@@ -906,6 +933,7 @@ export const useHooksCpQuote = (t?: any) => {
                 result.useqty = Number(itm.useqty ?? 0);
                 result.price = isFilterPrice(itm.price ?? 0);
               }
+              result.index = index;
               state.tableData.push(result);
             }
           });
@@ -951,9 +979,9 @@ export const useHooksCpQuote = (t?: any) => {
     let sums = "";
     const values = data.map(item => Number(item[field]?.toString().replace(/,/g, "")));
     if (!values.every(value => Number.isNaN(value))) {
-      console.log("values :>> ", values);
+      // console.log("values :>> ", values);
       sums = `${values.reduce((prev, curr) => {
-        console.log("prev,curr :>> ", prev, curr);
+        // console.log("prev,curr :>> ", prev, curr);
         const value = Number(curr);
         if (!Number.isNaN(value)) {
           return floatAdd(prev, curr);

文件差异内容过多而无法显示
+ 750 - 75
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx


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

@@ -155,9 +155,9 @@ const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
 
 const rowClsNameFunc = (data: any) => {
   const { row, rowIndex, $rowIndex } = data;
-  //   if (row.task_status == 2) {
-  //     return "vxecol-disable";
-  //   }
+  if (row.flag == "0") {
+    return "vxecol-danger";
+  }
   return "";
 };
 const tableProps = {

+ 20 - 14
JLHWEB/src/views/system/selector/bednet/hooks/index.ts

@@ -6,20 +6,26 @@ 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: "bednettypeid",
+      search: {
+        el: "select",
+        key: "arg_bednettypeid",
+        order: 1
+      }
+    },
+    {
+      field: "bednetcode",
+      search: {
+        el: "input",
+        key: "arg_search",
+        props: {
+          placeholder: "床网报价名称/编码/id"
+        },
+        order: 2,
+        span: 2
+      }
+    }
     // {
     //   field: "caliber",
     //   search: {

+ 12 - 12
JLHWEB/src/views/system/selector/bednet/index.vue

@@ -16,7 +16,7 @@
         :request-api="getData"
         :data-callback="dataCallback"
         :init-param="initParams"
-        :dwname="DwnameEnum.mtrlPrice"
+        :dwname="DwnameEnum.bednetQuoteChoose"
         pagination
         :search-col="tableSearchCol"
         :table-events="tableEvents"
@@ -35,7 +35,7 @@
             clearable
             @input="disshow"
             @clear="() => disshow('')"
-            placeholder="物料名称/备注"
+            placeholder="床网报价名称/编码/id"
           ></el-input>
         </template> -->
       </LjVxeTable>
@@ -60,8 +60,8 @@ import { CommonDynamicSelect } from "@/api/modules/common";
 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 { throttle } from "lodash-es";
+// import { Search } from "@element-plus/icons-vue";
 // import variables from "@/styles/js.module.scss";
 
 // const props = withDefaults(defineProps<{}>(), {});
@@ -170,11 +170,11 @@ const getData = (params: any) => {
 
   delete params.pageNum;
   delete params.pageSize;
-  // newParams.queryParams = initParams.value;
+  newParams.queryParams = initParams.value;
   newParams.queryParams = params;
   console.log("params :>> ", newParams);
   newParams.dsname = "web_bednet_choose";
-  return CommonDynamicSelect(newParams, DwnameEnum.bednetSpringChoose);
+  return CommonDynamicSelect(newParams, DwnameEnum.bednetQuoteChoose);
 };
 
 const autoUpdateTableCheckbox = () => {
@@ -207,13 +207,13 @@ const show = (params: any, label?: string) => {
 };
 
 // 节流
-const disshow = throttle((val: any) => {
-  console.log("val :>> ", val);
-  // initParams.value = defaultsDeep({ keyword: val }, initParams.value);
-  initParams.value.keyword = val;
+// const disshow = throttle((val: any) => {
+//   console.log("val :>> ", val);
+//   // initParams.value = defaultsDeep({ keyword: val }, initParams.value);
+//   initParams.value.arg_search = val;
 
-  console.log("disshow initParams.value :>> ", initParams.value);
-}, 500);
+//   console.log("disshow initParams.value :>> ", initParams.value);
+// }, 500);
 
 defineExpose({
   show

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

@@ -9,6 +9,9 @@
     @select="handleSelect"
     @open-modal="openModal"
   >
+    <template #label v-if="$slots?.label">
+      <slot name="label"></slot>
+    </template>
     <template #header>
       <div class="table-header lj-select__table">
         <div class="table-tr">

+ 12 - 3
JLHWEB/src/views/system/selector/mtrldef/select.vue

@@ -68,14 +68,15 @@ import { useUserStore } from "@/stores/modules/user";
 interface ProTableProps {
   value: any;
   mtrltype: any;
-  pricelistid: any;
+  pricelistid?: any;
+  pricelistidfn?: any;
   [key: string]: any;
 }
 
 // 默认值
 const props = withDefaults(defineProps<ProTableProps>(), {});
 const { userInfo } = useUserStore();
-const emit = defineEmits(["select", "update:value", "openModal"]);
+const emit = defineEmits(["select", "update:value", "openModal", "update:pricelistid"]);
 const loading = ref(false);
 
 const options = ref<any[]>([]);
@@ -88,6 +89,12 @@ const pricePower = computed(() => {
 const remoteMethod = async (queryString: string) => {
   console.log("remoteMethod props :>> ", props, queryString);
   loading.value = true;
+  let _pid = props.pricelistidfn && props.pricelistidfn();
+  console.log("_pid :>> ", _pid);
+
+  // if (!_pid) {
+  //   return false;
+  // }
 
   let newParams: any = {};
   newParams.pageindex = 1;
@@ -95,9 +102,10 @@ const remoteMethod = async (queryString: string) => {
   newParams.queryParams = {
     keyword: queryString,
     arg_mtrltype: props.mtrltype,
-    arg_pricelistid: props.pricelistid
+    arg_pricelistid: _pid ?? props.pricelistid
   };
   newParams.dsname = "web_mtrl_choose";
+  console.log("newParams :>> ", newParams);
   let result = await CommonDynamicSelect(newParams, DwnameEnum.mtrlPrice);
 
   console.log("result.datatable :>> ", result.datatable);
@@ -120,6 +128,7 @@ const remoteMethod = async (queryString: string) => {
 };
 
 const handleSelect = (item: any) => {
+  console.log("handleSelect 手动选择 :>> ", item);
   emit("select", item);
 };