Browse Source

JLHWEB: 1、修复床垫清单保存时字段类型报错;
2、床垫报价,床网tab新增显示弹簧配列数

JohnnyChan 1 day ago
parent
commit
122ada803b

+ 3 - 0
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -748,6 +748,9 @@ const orderDefaultAction = [
               const { visibleData } = $tableQd.getTableData();
               const { visibleData } = $tableQd.getTableData();
               _qdList = visibleData.map((o, i) => {
               _qdList = visibleData.map((o, i) => {
                 o.printid = i + 1;
                 o.printid = i + 1;
+                o.sh_rate = Number(o.sh_rate);
+                o.actual_useqty = Number(o.actual_useqty);
+                o.qd_pfgroupqty = Number(o.qd_pfgroupqty);
                 return o;
                 return o;
               });
               });
             }
             }

+ 65 - 9
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -1094,10 +1094,10 @@ export const useHooks = (t?: any) => {
    * @param item 床网信息
    * @param item 床网信息
    * @param action 动作,add,set,del,clear
    * @param action 动作,add,set,del,clear
    */
    */
-  const wf_rtr_cwdc = (data: any, item: any, action: string) => {
+  const wf_rtr_cwdc = async (data: any, item: any, action: string) => {
     const $table = state.cushionsMxRef.element;
     const $table = state.cushionsMxRef.element;
     let { visibleData } = $table.getTableData();
     let { visibleData } = $table.getTableData();
-    console.log("wf_rtr_cwdc data :>> ", data, visibleData, item);
+    console.log("wf_rtr_cwdc data :>> ", data, visibleData, item, action);
 
 
     // fullData.map(item => {
     // fullData.map(item => {
     //   if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
     //   if (Number(item.formulakind) == 999 && Number(item.thickness) == 0) {
@@ -1112,7 +1112,12 @@ export const useHooks = (t?: any) => {
     let currentBednetIndex = $tableBednet.getRowSeq(data);
     let currentBednetIndex = $tableBednet.getRowSeq(data);
 
 
     if (action == "add") {
     if (action == "add") {
-      let records = cloneDeep(visibleData.find(o => o.formulakind == 999));
+      let cushionItem = visibleData.find(o => o.formulakind == 999);
+      let records = cloneDeep(cushionItem ?? {});
+      if (!records?.chastr) {
+        records.chastr = state.diancengAreaEnum[0].value;
+        records.formulakind = 999;
+      }
       records.thickness = 0;
       records.thickness = 0;
       records.qty = 0;
       records.qty = 0;
       records._X_ROW_KEY = "";
       records._X_ROW_KEY = "";
@@ -1124,16 +1129,37 @@ export const useHooks = (t?: any) => {
       }
       }
 
 
       let bednetList = visibleData.filter(o => Number(o.formulakind) == 999);
       let bednetList = visibleData.filter(o => Number(o.formulakind) == 999);
-      let lastIndex = $table.getRowSeq(bednetList[bednetList.length - 1]);
+      let lastIndex = bednetList.length > 0 ? $table.getRowSeq(bednetList[bednetList.length - 1]) : -1;
       console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
       console.log("wf_rtr_cwdc lastIndex :>> ", bednetList, lastIndex, records);
-      $table.insertAt(records, lastIndex);
+      let _index = visibleData.length > lastIndex ? lastIndex : -1;
+      console.log("wf_rtr_cwdc $table :>> ", $table, visibleData.length, _index);
+      $table.insertNextAt(records, _index);
     } else {
     } else {
       console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
       console.log("wf_rtr_cwdc currentBednetIndex :>> ", action, currentBednetIndex);
+
+      if (action == "set") {
+        let idx = 1;
+        let _match = false;
+        visibleData.map(o => {
+          if (Number(o.formulakind) == 999) {
+            if (idx == currentBednetIndex) {
+              _match = true;
+            }
+            idx++;
+          }
+        });
+        if (!_match) {
+          await wf_rtr_cwdc(data, null, "add");
+        }
+      }
+      let { visibleData: afterVisibleData } = $table.getTableData();
       let index = 1;
       let index = 1;
-      visibleData.map(o => {
+      console.log("after add set", afterVisibleData, item);
+      afterVisibleData.map(o => {
         if (Number(o.formulakind) == 999) {
         if (Number(o.formulakind) == 999) {
           if (index == currentBednetIndex) {
           if (index == currentBednetIndex) {
             if (action == "set") {
             if (action == "set") {
+              console.log("after add o :>> ", currentBednetIndex, o);
               $table.setRow(o, {
               $table.setRow(o, {
                 thickness: item?.bednet_height,
                 thickness: item?.bednet_height,
                 qty: 1
                 qty: 1
@@ -3942,14 +3968,18 @@ export const useHooks = (t?: any) => {
   //   }
   //   }
   // ]);
   // ]);
 
 
-  const funcMergeColumn = (columns: any, target: any) => {
-    return columns.map(t => {
+  const funcMergeColumn = (columns: any, target: any, extra?: any) => {
+    let col = columns.map(t => {
       let itm = target.find(item => t.field === item.field);
       let itm = target.find(item => t.field === item.field);
       if (itm) {
       if (itm) {
         t = defaultsDeep(itm, t);
         t = defaultsDeep(itm, t);
       }
       }
       return t;
       return t;
     });
     });
+    if (extra) {
+      col = col.concat(extra);
+    }
+    return col;
   };
   };
 
 
   // const cushionsEdit = reactive<any>({
   // const cushionsEdit = reactive<any>({
@@ -4064,6 +4094,32 @@ export const useHooks = (t?: any) => {
       }
       }
     }
     }
   ];
   ];
+
+  const bednetExtraColumns: ColumnProps<any>[] = [
+    {
+      title: "弹簧排列个数-宽",
+      field: "spring_qty_width",
+      datatype: "integer",
+      editRender: {
+        name: "$input"
+        // props: {
+        //   type: "number"
+        // }
+      }
+    },
+    {
+      title: "弹簧排列个数-长",
+      field: "spring_qty_length",
+      datatype: "integer",
+      editRender: {
+        name: "$input"
+        // props: {
+        //   type: "number"
+        // }
+      }
+    }
+  ];
+
   const cushionsColumns: ColumnProps<any>[] = [
   const cushionsColumns: ColumnProps<any>[] = [
     {
     {
       title: "位置",
       title: "位置",
@@ -5640,7 +5696,7 @@ export const useHooks = (t?: any) => {
     ...toRefs(state),
     ...toRefs(state),
     columns,
     columns,
     columnsMx,
     columnsMx,
-    columnsMxBednet: funcMergeColumn(columnsMx, bednetCoumns),
+    columnsMxBednet: funcMergeColumn(columnsMx, bednetCoumns, bednetExtraColumns),
     columnsMxCushions: funcMergeColumn(columnsMx, cushionsColumns),
     columnsMxCushions: funcMergeColumn(columnsMx, cushionsColumns),
     columnsMxAccessories: funcMergeColumn(columnsMx, accessoriesColumns),
     columnsMxAccessories: funcMergeColumn(columnsMx, accessoriesColumns),
     columnsMxPackag: funcMergeColumn(columnsMx, packagColumns),
     columnsMxPackag: funcMergeColumn(columnsMx, packagColumns),