Browse Source

JLHWEB: 1、新增物料的特殊工艺费用设置;2、床垫报价详情页价格优先读取上一次保存的结果

JohnnyChan 3 months ago
parent
commit
3f9e9f27ad

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

@@ -1116,6 +1116,9 @@ export namespace PrintTemplate {
 }
 
 export namespace Basicinfo {
+  export interface ReqUserList {
+    simple?: number;
+  }
   export interface ResUserList {
     userList: any[];
   }

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

@@ -3,8 +3,8 @@ import { PORT1 } from "@/api/config/servicePort";
 import http from "@/api";
 import { CommonDynamicSelect } from "@/api/modules/common";
 
-export const getUserList = () => {
-  return http.post<Basicinfo.ResUserList>(PORT1 + `/GetUserList`, {});
+export const getUserList = (params?: Basicinfo.ReqUserList) => {
+  return http.post<Basicinfo.ResUserList>(PORT1 + `/GetUserList`, params ?? {});
 };
 
 export const saveUserList = (params: Basicinfo.ResUserList) => {

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

@@ -201,13 +201,13 @@
   "moveUp": "上移",
   "moveDown": "下移",
   "delAllMx": "删除所有明细",
-  "copyFromMulitFlag": "已审批复制",
+  "copyFromMulitFlag": "分享报价",
   "recalculateFromNotFlag": "未审批重算",
   "showQuoteList": "显示报价清单",
   "exportQuoteList": "导出报价清单",
   "dataTransmission": "数据发送",
   "businessSupplement": "业务补充",
-  "recalculateERPCost": "重算ERP成本",
+  "recalculateERPCost": "重算报价",
   "pairingL1product": "配对L1成品",
   "businessAudit": "业务审核",
   "businessWidthrawAudit": "业务撤审",

+ 18 - 0
JLHWEB/src/views/baseinfo/extra/hooks/index.tsx

@@ -113,6 +113,24 @@ export const useHooks = (t?: any) => {
     {
       field: "inputtype",
       title: "录入类型",
+      enum: [
+        {
+          label: "选择",
+          value: 0
+        },
+        {
+          label: "录入",
+          value: 1
+        },
+        {
+          label: "带出",
+          value: 2
+        },
+        {
+          label: "选择物料",
+          value: 3
+        }
+      ],
       basicinfo: {
         el: "select",
         span: 1,

+ 17 - 5
JLHWEB/src/views/baseinfo/extra/index.vue

@@ -142,6 +142,7 @@ import { ElNotification, ClickOutside as vClickOutside } from "element-plus";
 import { DwnameEnum } from "@/enums/dwnameEnum";
 import LjPopover from "@/components/LjPopover/index.vue";
 import { useDynameicRef } from "@/hooks/useDynameicRef";
+import TreeFilter from "@/components/TreeFilter/index.vue";
 
 const dwname = "web_extra_costs";
 const mainData = ref({});
@@ -380,15 +381,26 @@ const drawerDefineProp = {
 };
 
 const getData = (params: any) => {
-  return getMattressExtraList(params);
+  // return getMattressExtraList(params);
+
+  let newParams: any = {};
+  newParams.dsname = "web_mattress_extralist";
+  newParams.queryparams = params;
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+  delete params.pageNum;
+  delete params.pageSize;
+  return CommonDynamicSelect(newParams, "web_mattress_extra");
 };
 
 const dataCallback = (data: any) => {
+  console.log("dataCallback data:>> ", data);
   data.tableinfo?.columns.map((item: any) => {
-    if (item?.field === "inputtype") {
-      let enumArr = item.enum.filter(item => item.value !== 0);
-      enumMap.value.set(item.field, enumArr);
-    } else if (item?.enum) {
+    // if (item?.field === "inputtype") {
+    //   let enumArr = item.enum.filter(item => item.value !== 0);
+    //   enumMap.value.set(item.field, enumArr);
+    // } else
+    if (item?.enum) {
       enumMap.value.set(item.field, item.enum);
     }
   });

+ 10 - 0
JLHWEB/src/views/baseinfo/mtrldef/hooks/index.tsx

@@ -404,6 +404,16 @@ export const useHooks = (t?: any) => {
         props: { type: "textarea", rows: 5 },
         row: 3
       }
+    },
+    {
+      field: "extra_cost",
+      title: "特殊工艺费用",
+      datatype: "number",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        editable: ALLOW_EDIT_STATE
+      }
     }
   ];
 

+ 14 - 4
JLHWEB/src/views/quote/mattressQuote/components/Statistic.vue

@@ -4,6 +4,7 @@
       <el-col :span="24" v-for="(item, index) in statisticData" :key="index">
         <StatisticItem
           :data="item"
+          :mainData="props.mainData"
           v-bind="$attrs"
           :iforigin="props.iforigin"
           @click="handleClick(item)"
@@ -22,6 +23,7 @@ import { useUserStore } from "@/stores/modules/user";
 
 interface WidgetProps {
   data: any;
+  mainData: any;
   differ?: any;
   iforigin?: any;
   moneyrate?: any;
@@ -41,6 +43,10 @@ interface statisticDataProps {
    * @desciption: 大小单类型
    */
   type?: number;
+  /**
+   * @description 字段名
+   */
+  field?: string;
   power?: () => boolean;
 }
 
@@ -121,28 +127,32 @@ const statisticData = ref<statisticDataProps[]>([
     value: 0,
     origin: 0,
     key: "【部门含税价】",
-    type: 1
+    type: 1,
+    field: "dannum_cost1"
   },
   {
     label: "【小单金额】",
     value: 0,
     origin: 0,
     key: "【部门含税价】",
-    type: 4
+    type: 4,
+    field: "dannum_cost4"
   },
   {
     label: "【标准金额】",
     value: 0,
     origin: 0,
     key: "【部门含税价】",
-    type: 2
+    type: 2,
+    field: "dannum_cost2"
   },
   {
     label: "【大单金额】",
     value: 0,
     origin: 0,
     key: "【部门含税价】",
-    type: 3
+    type: 3,
+    field: "dannum_cost3"
   }
 ]);
 

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

@@ -69,6 +69,7 @@ import { floatSub, formatAmount3 } from "@/utils/index";
 
 interface WidgetProps {
   data: any;
+  mainData: any;
   iforigin?: any;
   moneyrate?: any;
   ifMoneyrate?: any;
@@ -94,7 +95,7 @@ const currentMoneyrate = computed(() => {
 });
 
 const cprRateValue = computed(() => {
-  let _moneyrate = props.moneyrate == 0 ? 1 : props.moneyrate;
+  let _moneyrate = props.moneyrate <= 1 ? 1 : props.moneyrate;
   return formatAmount3({ val: source.value / _moneyrate });
 });
 
@@ -103,7 +104,11 @@ const isFilterLabel = val => {
 };
 
 const getDiscrepancy = computed(() => {
-  return Number(Math.trunc(floatSub(props.data.value, props.data.origin)));
+  let _val = props.data.value;
+  if (props.mainData.hasOwnProperty(props.data.field) && props.mainData[props.data.field] > 0) {
+    _val = props.mainData[props.data.field];
+  }
+  return Math.trunc(Number(floatSub(_val, props.data.origin)));
 });
 
 const isFilterPrice = data => {
@@ -120,7 +125,11 @@ watch(
   () => props.data,
   val => {
     console.log("mattressQuoteDetail_statistic-item val :>> ", val);
-    source.value = val.value;
+    if (props.mainData?.hasOwnProperty(val.field) && props.mainData[val.field] > 0) {
+      source.value = props.mainData[val.field];
+    } else {
+      source.value = val.value;
+    }
   },
   { immediate: true, deep: true }
 );

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

@@ -32,6 +32,7 @@
     <template #headerSuffix>
       <Statistic
         :data="cmpFormulaReplace"
+        :main-data="LjDetailRef?._mainData"
         :differ="cmpDiffer"
         :iforigin="isShowOriginFormulaMattress"
         :precision="2"

+ 54 - 1
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -1411,6 +1411,7 @@ export const useHooks = (t?: any) => {
             // 床网与主副规格互联
             updateSubspecsTable();
           }
+          autoLoadMtrlExtra(item, state.specialProcessesMxRef);
         });
       }
     }
@@ -5660,7 +5661,6 @@ export const useHooks = (t?: any) => {
     const $tableTarget = targetRef.element;
     const { visibleData: tgVisibleData } = $tableTarget.getTableData();
 
-    console.log();
     let arr = [];
     // 收集拼侧,并去重
     visibleData.map(t => arr.push(t[matchAttr]));
@@ -5706,6 +5706,59 @@ export const useHooks = (t?: any) => {
       $tableTarget.insertAt(_arr, -1);
     }
   };
+
+  /**
+   * @description 获取特殊工艺数据
+   * @params mtrlItem 物料
+   * @params targetRef 目标表格实例
+   * @params arg_extraid 数据库建立的特殊费用id,5: 物料的特殊工艺费用
+   */
+  const autoLoadMtrlExtra = (mtrlItem?: any, targetRef?: any, arg_extraid = 5) => {
+    //计算拼侧数量
+    if (mtrlItem?.extra_cost == 0) return;
+
+    // const $table = tableRef.element;
+    // const { visibleData } = $table.getTableData();
+    const $tableTarget = targetRef.element;
+    const { visibleData: tgVisibleData } = $tableTarget.getTableData();
+
+    let _remove = [];
+    tgVisibleData.map(t => {
+      if (t.extraid == arg_extraid && mtrlItem.mtrlid == t?.mtrlid) {
+        _remove.push(t);
+      }
+    });
+    $tableTarget.remove(_remove);
+    let result = [];
+
+    let extraArr = state.specialProcessesMxData.filter(item => item.typeid == 1 && item.extraid == arg_extraid);
+    if (extraArr.length) {
+      // 取额外费用数据模版,插入
+      result.push(extraArr[0]);
+    }
+
+    if (result.length) {
+      let _arr = [];
+      let _mattressId = state.LjDetailRef._mainData.mattressid;
+      result.map(o => {
+        let _itm = {
+          mattressid: _mattressId,
+          mattressmxid: 0,
+          extraid: o.extraid,
+          extramxid: o.extramxid,
+          extraname: mtrlItem.mtrlname,
+          price: mtrlItem.extra_cost,
+          qty: o.qty,
+          dscrp: o.dscrp,
+          inputtype: o.inputtype,
+          typeid: o.typeid,
+          mtrlid: mtrlItem.mtrlid
+        };
+        _arr.push(_itm);
+      });
+      $tableTarget.insertAt(_arr, -1);
+    }
+  };
   /**
    * @description 自动导入修改特殊工艺费用
    */

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

@@ -472,43 +472,43 @@ const action: detailAction[] = [
       await openDeptChoosen(curRecords);
     }
   }),
-  buttonDefault({
-    label: t("common.recalculateFromNotFlag"),
-    power: 72,
-    clickFunc: item => {
-      const { curRecords } = getCurrentRecords(vxeTableRef.value);
-
-      console.log("curRecords :>> ", curRecords);
-      if (!curRecords.length) {
-        ElMessage.warning(t("business.tips.mattress.records"));
-        return;
-      }
-
-      let list = curRecords.map((item: any) => {
-        return { mattressid: Number(item.mattressid) };
-      });
-
-      ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
-        confirmButtonText: t("common.okText"),
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {
-          ReCalculateNoAudit({ list }).then(() => {
-            ElMessage.success("批重算成功!");
-
-            vxeTableRef.value.refresh();
-          });
-        })
-        .catch((e: TypeError) => {
-          console.log("e :>> ", e);
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
-    }
-  }),
+  // buttonDefault({
+  //   label: t("common.recalculateFromNotFlag"),
+  //   power: 72,
+  //   clickFunc: item => {
+  //     const { curRecords } = getCurrentRecords(vxeTableRef.value);
+
+  //     console.log("curRecords :>> ", curRecords);
+  //     if (!curRecords.length) {
+  //       ElMessage.warning(t("business.tips.mattress.records"));
+  //       return;
+  //     }
+
+  //     let list = curRecords.map((item: any) => {
+  //       return { mattressid: Number(item.mattressid) };
+  //     });
+
+  //     ElMessageBox.confirm(`是否确定要批重算${curRecords.length}张床垫报价单吗?`, "询问", {
+  //       confirmButtonText: t("common.okText"),
+  //       cancelButtonText: "否",
+  //       type: "warning"
+  //     })
+  //       .then(() => {
+  //         ReCalculateNoAudit({ list }).then(() => {
+  //           ElMessage.success("批重算成功!");
+
+  //           vxeTableRef.value.refresh();
+  //         });
+  //       })
+  //       .catch((e: TypeError) => {
+  //         console.log("e :>> ", e);
+  //         ElMessage({
+  //           type: "info",
+  //           message: "操作取消"
+  //         });
+  //       });
+  //   }
+  // }),
   buttonDefault({
     label: t("common.viewHistoricalQuotes"),
     power: 72,