Explorar o código

JLHWEB: 1、修复特殊工艺逻辑问题

JohnnyChan hai 1 mes
pai
achega
5dc2b70c53

+ 27 - 1
JLHWEB/src/views/baseinfo/extra/index.vue

@@ -83,6 +83,14 @@
       <div class="mb-8">
         <el-input v-model="typeItem.typename" placeholder="请输入类型名称"></el-input>
       </div>
+      <div class="mb-8">
+        <span>录入类型: </span>
+        <!-- <el-select v-model="typeItem.inputtype" style="width: 120px">
+          <el-option label="仅可选择" :value="0"></el-option>
+          <el-option label="选择且可录入" :value="1"></el-option>
+        </el-select> -->
+        <el-segmented v-model="typeItem.inputtype" :options="inputtypeOptions" size="small" />
+      </div>
       <div style="display: flex; text-align: right; margin: 0">
         <el-button class="flx-1" size="small" type="primary" @click="gotoSaveType">保存</el-button>
       </div>
@@ -153,6 +161,21 @@ const tableProps = {
   // }
 };
 
+const inputtypeOptions = [
+  {
+    label: "仅可选择",
+    value: 0
+  },
+  {
+    label: "选择且可录入",
+    value: 1
+  },
+  {
+    label: "不可修改",
+    value: 2
+  }
+];
+
 const { t } = useI18n();
 const { VxeTableRef, LjDetailRef, columns, fSave, fDelete } = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -175,7 +198,8 @@ const type_name = ref("");
 const typeItem = ref<any>({
   extraid: 0,
   typename: "",
-  typeid: 0
+  typeid: 0,
+  inputtype: 0
 });
 
 const popoverTitle = computed(() => {
@@ -192,6 +216,7 @@ const openTypePopover = (refName: string) => {
   typeItem.value.extraid = 0;
   typeItem.value.typeid = initParams.value.arg_typeid;
   typeItem.value.typename = "";
+  typeItem.value.inputtype = 0;
 
   LjPopoverRef.value.show(addBtnRef.value);
 };
@@ -235,6 +260,7 @@ const handleEditType = (node: any, refName: string) => {
   typeItem.value.extraid = node.data.extraid;
   typeItem.value.typeid = initParams.value.arg_typeid;
   typeItem.value.typename = node.data.typename;
+  typeItem.value.inputtype = node.data.inputtype;
 
   LjPopoverRef.value.show(dynamicRefs.value[refName]);
 };

+ 119 - 35
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -4722,7 +4722,7 @@ export const useHooks = (t?: any) => {
               >
                 {{
                   reference: () => {
-                    return <ElButton type="danger" plain circle disabled={oItem.inputtype == 2} icon={Minus} />;
+                    return <ElButton type="danger" plain circle disabled={oItem.extrainputtype == 2} icon={Minus} />;
                   }
                 }}
               </ElPopconfirm>
@@ -4742,15 +4742,18 @@ export const useHooks = (t?: any) => {
       // }
       editRender: {},
       editColRender: (scope: any) => {
-        console.log("extratypename state.specialProcessesEnum :>> ", state.specialProcessesEnum);
         return (
-          <el-select v-model={scope.row.extraid} disabled={scope.row.extraid == 1}>
+          <el-select
+            v-model={scope.row.extraid}
+            disabled={scope.row.extrainputtype == 2}
+            onChange={val => extratypeOnChange(val, scope)}
+          >
             {{
               default: () => {
                 let rs = [];
                 if (state.specialProcessesEnum.length) {
                   state.specialProcessesEnum.map((t: any) => {
-                    rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.extraid == 1} />);
+                    rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
                   });
                 }
                 return rs;
@@ -4773,19 +4776,43 @@ export const useHooks = (t?: any) => {
       field: "extraname",
       editRender: {},
       editColRender: (scope: any) => {
-        let _disabled = scope.row.inputtype == 2;
-        return (
-          <el-autocomplete
-            v-model={scope.row.extraname}
-            disabled={_disabled}
-            value-key="extramxname"
-            fetch-suggestions={(queryString: string, callback: any) =>
-              querySearch_processes(queryString, callback, scope, state.specialProcessesMxData)
-            }
-            onSelect={itm => additionalOnSelect(itm, scope)}
-            clearable
-          />
-        );
+        let _disabled = scope.row.extrainputtype == 2;
+        if (scope.row.extrainputtype == 0) {
+          return (
+            <el-select
+              v-model={scope.row.extramxid}
+              disabled={_disabled}
+              onChange={val => additionalOnChange(val, scope, state.specialProcessesMxData)}
+            >
+              {{
+                default: () => {
+                  let rs = [];
+                  if (state.specialProcessesMxData.length) {
+                    state.specialProcessesMxData
+                      .filter(t => t.extraid == scope.row.extraid)
+                      .map((t: any) => {
+                        rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
+                      });
+                  }
+                  return rs;
+                }
+              }}
+            </el-select>
+          );
+        } else {
+          return (
+            <el-autocomplete
+              v-model={scope.row.extraname}
+              disabled={_disabled}
+              value-key="extramxname"
+              fetch-suggestions={(queryString: string, callback: any) =>
+                querySearch_processes(queryString, callback, scope, state.specialProcessesMxData)
+              }
+              onSelect={itm => additionalOnSelect(itm, scope)}
+              clearable
+            />
+          );
+        }
       }
     },
     {
@@ -4866,13 +4893,17 @@ export const useHooks = (t?: any) => {
       editRender: {},
       editColRender: (scope: any) => {
         return (
-          <el-select v-model={scope.row.extraid}>
+          <el-select
+            v-model={scope.row.extraid}
+            disabled={scope.row.extrainputtype == 2}
+            onChange={val => extratypeOnChange(val, scope)}
+          >
             {{
               default: () => {
                 let rs = [];
                 if (state.additionalCostsEnum.length) {
-                  state.additionalCostsEnum.map((t: any) => {
-                    rs.push(<el-option label={t.typename} value={t.extraid} />);
+                  state.specialProcessesEnum.map((t: any) => {
+                    rs.push(<el-option label={t.typename} value={t.extraid} disabled={t.inputtype == 2} />);
                   });
                 }
                 return rs;
@@ -4896,19 +4927,43 @@ export const useHooks = (t?: any) => {
       editRender: {},
       editColRender: (scope: any) => {
         console.log("editColRender 1111 scope :>> ", scope);
-        let _disabled = scope.row.inputtype == 2;
-        return (
-          <el-autocomplete
-            v-model={scope.row.extraname}
-            disabled={_disabled}
-            value-key="extramxname"
-            fetch-suggestions={(queryString: string, callback: any) =>
-              querySearch_additional(queryString, callback, scope, state.additionalCostsMxData)
-            }
-            onSelect={itm => additionalOnSelect(itm, scope)}
-            clearable
-          />
-        );
+        let _disabled = scope.row.extrainputtype == 2;
+        if (scope.row.extrainputtype == 0) {
+          return (
+            <el-select
+              v-model={scope.row.extramxid}
+              disabled={_disabled}
+              onChange={val => additionalOnChange(val, scope, state.additionalCostsMxData)}
+            >
+              {{
+                default: () => {
+                  let rs = [];
+                  if (state.additionalCostsMxData.length) {
+                    state.additionalCostsMxData
+                      .filter(t => t.extraid == scope.row.extraid)
+                      .map((t: any) => {
+                        rs.push(<el-option label={t.extramxname} value={t.extramxid} />);
+                      });
+                  }
+                  return rs;
+                }
+              }}
+            </el-select>
+          );
+        } else {
+          return (
+            <el-autocomplete
+              v-model={scope.row.extraname}
+              disabled={_disabled}
+              value-key="extramxname"
+              fetch-suggestions={(queryString: string, callback: any) =>
+                querySearch_additional(queryString, callback, scope, state.additionalCostsMxData)
+              }
+              onSelect={itm => additionalOnSelect(itm, scope)}
+              clearable
+            />
+          );
+        }
       }
     },
     {
@@ -4940,6 +4995,35 @@ export const useHooks = (t?: any) => {
     }
   ];
 
+  const extratypeOnChange = (value: any, scope: any) => {
+    const { row } = scope;
+
+    if (state.specialProcessesEnum.length) {
+      let item = state.specialProcessesEnum.find(t => t.extraid == value);
+      if (item) {
+        row.extrainputtype = item.inputtype;
+
+        row.extramxid = 0;
+        row.inputtype = 0;
+        row.extraname = "";
+        row.price = 0;
+        row.qty = 0;
+        row.dscrp = "";
+      }
+    }
+  };
+
+  const additionalOnChange = (value: any, scope: any, enumdata: any) => {
+    const { row } = scope;
+
+    if (enumdata.length) {
+      let item = enumdata.find(t => t.extraid == row.extraid && t.extramxid == value);
+      if (item) {
+        additionalOnSelect(item, scope);
+      }
+    }
+  };
+
   const additionalOnSelect = (item: Record<string, any>, scope: any) => {
     const { row } = scope;
     // console.log("additionalOnSelect: >>", item);
@@ -4951,11 +5035,11 @@ export const useHooks = (t?: any) => {
     //   const row = visibleData[$rowIndex];
     //   console.log("additionalOnSelect: row >>", row);
     // row.extramxname = item.extramxname;
-    row.extramxid = item.extramxid;
+    row.extramxid = item.extramxid ?? 0;
     row.inputtype = item.inputtype;
     row.extraid = item.extraid;
     row.extraname = item.extramxname;
-    row.typeid = item.typeid;
+    // row.typeid = item.typeid;
     row.price = item.price;
     row.qty = item.qty;
     row.dscrp = item.dscrp;