Browse Source

1、更新代码

MY 1 day ago
parent
commit
c37d8c19eb

+ 71 - 4
JLHWEB/src/views/quote/softbedQuote/detail.vue

@@ -16,10 +16,12 @@
       <LjVxeTable
         ref="VxeTableHeadBoardMxRef"
         row-key="key"
-        table-cls=""
+        table-cls="h-full"
         :data="headBoardMx"
         :columns="columnsMx"
         :dwname="DwnameEnum.softbedQuoteMx"
+        :table-props="tableProps_mx"
+        :tool-button="[]"
         :auto-load-layout="false"
         :request-auto="false"
       >
@@ -35,10 +37,12 @@
       <LjVxeTable
         ref="VxeTableNightStandMxRef"
         row-key="key"
-        table-cls=""
+        table-cls="h-full"
         :data="nightStandMx"
         :columns="columnsMx"
         :dwname="DwnameEnum.softbedQuoteMx"
+        :table-props="tableProps_mx"
+        :tool-button="[]"
         :auto-load-layout="false"
         :request-auto="false"
       >
@@ -54,10 +58,12 @@
       <LjVxeTable
         ref="VxeTableBedFrameMxRef"
         row-key="key"
-        table-cls=""
+        table-cls="h-full"
         :data="bedFrameMx"
         :columns="columnsMx"
         :dwname="DwnameEnum.softbedQuoteMx"
+        :table-props="tableProps_mx"
+        :tool-button="[]"
         :auto-load-layout="false"
         :request-auto="false"
       >
@@ -178,6 +184,67 @@ const tableProps = ref({
   }
 });
 
+/**
+ * @description 明细表格组件基础配置
+ */
+const tableProps_mx = ref({
+  height: "auto",
+  align: "left",
+  // height: "",
+  minHeight: "100px",
+  editConfig: { trigger: "click", mode: "row", enabled: false, autoClear: false },
+  // editRules: {
+  // mattress_width: [
+  //   {
+  //     validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
+  //       const { _mainData } = LjDetailRef.value;
+  //       let _value = Number(cellValue);
+  //       if (_value < 0) {
+  //         return new Error("不能小于0");
+  //       }
+  //       if (!isNaN(_value) && _value > Number(_mainData.mattress_width)) {
+  //         return new Error("不能大于床垫尺寸");
+  //       }
+  //       return true;
+  //     }
+  //   }
+  // ],
+  // mattress_length: [
+  //   {
+  //     validator: ({ cellValue, rule, rules, row, rowIndex, column, columnIndex }) => {
+  //       const { _mainData } = LjDetailRef.value;
+  //       let _value = Number(cellValue);
+  //       if (_value < 0) {
+  //         return new Error("不能小于0");
+  //       }
+  //       if (!isNaN(_value) && _value > Number(_mainData.mattress_length)) {
+  //         return new Error("不能大于床垫尺寸");
+  //       }
+  //       return true;
+  //     }
+  //   }
+  // ]
+  // },
+  keyboardConfig: {
+    isEdit: true,
+    isArrow: true,
+    isEnter: true,
+    isTab: true,
+    isDel: true,
+    isBack: true,
+    isEsc: true,
+    editMethod({ $table, row, column }) {
+      // 先清空原先的值
+      row[column.field] = "";
+      // 再激活编辑状态并输入新值
+      $table.setEditCell(row, column);
+    }
+  },
+  mouseConfig: {
+    selected: true
+  }
+});
+
 const detailProps = reactive<DetailProp>({
   dwname: DwnameEnum.softbedQuote,
   columns: columns,
@@ -303,7 +370,7 @@ const orderDefaultAction = [
       const list = [{ softbed_id: softBed.value.softbed_id }];
       onDelete(list, () => {
         tabRemove(route.fullPath);
-        router.replace("/mattressQuote");
+        router.replace("/softbedQuote");
       });
     }
   }),

+ 10 - 3
JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

@@ -830,19 +830,25 @@ export const useHooks = (t?: any) => {
       field: "cutting_length",
       title: "下料长(mm)",
       datatype: "number",
-      editRender: {}
+      editRender: {
+        name: "$input"
+      }
     },
     {
       field: "cutting_width",
       title: "下料宽(mm)",
       datatype: "number",
-      editRender: {}
+      editRender: {
+        name: "$input"
+      }
     },
     {
       field: "cutting_qty",
       title: "下料数量",
       datatype: "number",
-      editRender: {}
+      editRender: {
+        name: "$input"
+      }
     },
     {
       field: "useqty",
@@ -1180,6 +1186,7 @@ export const useHooks = (t?: any) => {
       };
       const { row } = await $table.insertAt(records, -1);
       await $table.setCurrentRow(row);
+      await $table.setEditRow(row);
     }
   };