Просмотр исходного кода

JLHWEB: 1、优化床垫清单物料选择组件的选择逻辑
2、选择床垫组件,增加多选

JohnnyChan 1 день назад
Родитель
Сommit
5423d07482

+ 2 - 1
JLHWEB/src/components/LjDialog/index.vue

@@ -44,7 +44,8 @@ const drawerKey = ref(0);
  */
 const drawerDefineProp = {
   draggable: true,
-  overflow: true
+  overflow: true,
+  closeOnClickModal: false
 };
 
 const drawer = ref(false);

+ 3 - 0
JLHWEB/src/styles/index.scss

@@ -48,6 +48,9 @@ code {
 .vxecol-gray {
   color: var(--lj-color-gray-7) !important;
 }
+.vxecol-gold {
+  color: var(--lj-color-calendula-gold-6) !important;
+}
 .vxecol-bg-green {
   background-color: var(--lj-color-polar-green-1);
 }

+ 11 - 13
JLHWEB/src/views/erpapi/mattressInterface/detail.vue

@@ -400,7 +400,8 @@ const qdActionYW: detailAction[] = [
         }
         ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
           confirmButtonText: "确定",
-          cancelButtonText: "取消"
+          cancelButtonText: "取消",
+          closeOnClickModal: false
         })
           .then(() => {
             // $table.remove(curRow);
@@ -546,7 +547,8 @@ const qdAction: detailAction[] = [
         }
         ElMessageBox.confirm(`是否确定删除当前行?`, "提示", {
           confirmButtonText: "确定",
-          cancelButtonText: "取消"
+          cancelButtonText: "取消",
+          closeOnClickModal: false
         })
           .then(() => {
             // $table.remove(curRow);
@@ -690,7 +692,8 @@ const orderDefaultAction = [
         ElMessageBox.confirm("是否确定要保存吗?", "询问", {
           confirmButtonText: "是",
           cancelButtonText: "否",
-          type: "warning"
+          type: "warning",
+          closeOnClickModal: false
         }).then(async () => {
           loadingStatus.value.save = true;
           try {
@@ -792,7 +795,7 @@ const orderDefaultAction = [
       return !orderStatus.value || editType.value == 3;
     },
     clickFunc: item => {
-      fModelChoseMattress().then((res: any) => {
+      fModelChoseMattress("", { arg_parentid: 0 }).then((res: any) => {
         RefreshMattressInterfaceList(res.mattressid, 1);
       });
     }
@@ -829,7 +832,7 @@ const orderDefaultAction = [
       return !orderStatus.value;
     },
     clickFunc: item => {
-      fModelChoseMattress().then((res: any) => {
+      fModelChoseMattress("", { arg_parentid: 0 }).then((res: any) => {
         RefreshMattressInterfaceQdList(res.mattressid, 1, 0);
       });
     }
@@ -1067,14 +1070,9 @@ const orderDefaultAction = [
       return "";
     },
     clickFunc: item => {
-      // dialog(SetSubspecsDialog, {
-      //   mattressid: initParams.value.mattressid
-      // }).then((data: any) => {
-      //   console.log(data);
-      // });
-      alert("功能维护中!");
-
-      // SetSubspecsDialogRef.value.show();
+      fModelChoseMattress("副规格", { arg_parentid: LjDetailRef.value?._mainData.mattressid }, 0).then((res: any) => {
+        // RefreshMattressInterfaceList(res.mattressid, 1);
+      });
     }
   }),
   buttonDefault({

+ 21 - 12
JLHWEB/src/views/erpapi/mattressInterface/hooks/index.tsx

@@ -212,7 +212,8 @@ export const useHooks = (t?: any) => {
       ElMessageBox.confirm(`是否确定要生成金蝶清单?`, "询问", {
         confirmButtonText: t("common.okText"),
         cancelButtonText: "否",
-        type: "warning"
+        type: "warning",
+        closeOnClickModal: false
       })
         .then(() => {
           state.loadingStatus.prdpf = true;
@@ -240,7 +241,8 @@ export const useHooks = (t?: any) => {
       ElMessageBox.confirm(`是否确定要删除金蝶清单?`, "询问", {
         confirmButtonText: t("common.delText"),
         cancelButtonText: "否",
-        type: "warning"
+        type: "warning",
+        closeOnClickModal: false
       })
         .then(() => {
           DelMtrlPf({ list }).then(() => {
@@ -260,7 +262,8 @@ export const useHooks = (t?: any) => {
     ElMessageBox.confirm(`是否确定要生成/更新物料?`, "询问", {
       confirmButtonText: t("common.okText"),
       cancelButtonText: "否",
-      type: "warning"
+      type: "warning",
+      closeOnClickModal: false
     })
       .then(() => {
         state.loadingStatus.mtrldef = true;
@@ -406,9 +409,9 @@ export const useHooks = (t?: any) => {
       data.erp_mtrlid = item.mtrlid;
       data.erp_mtrlname = item.mtrlname;
       data.erp_mtrlmode = item.mtrlmode;
-      attrStr != "erp_mtrlcode" && (data.erp_mtrlcode = item.mtrlcode);
+      attrStr != "mtrlcode" && (data.erp_mtrlcode = item.mtrlcode);
       data.erp_unit = item.unit;
-      attrStr != "erp_mtrlengname" && (data.erp_mtrlengname = item.zxmtrlmode);
+      attrStr != "zxmtrlmode" && (data.erp_mtrlengname = item.zxmtrlmode);
     }
   };
 
@@ -1188,10 +1191,10 @@ export const useHooks = (t?: any) => {
         return (
           <MtrldefErpInput
             v-model={row.erp_mtrlcode}
-            valueKey="erp_mtrlcode"
+            searchKey="mtrlcode"
             row={row}
             setMtrlerp={rModelSetMtrlErp}
-            onOpenModal={() => fModelChoseMtrlErp(row, params)}
+            onOpenModal={() => fModelChoseMtrlErp(row, { keyword: row.erp_mtrlcode })}
             onClear={() => rModelClearMtrlErp(row, 2)}
           ></MtrldefErpInput>
         );
@@ -1214,13 +1217,16 @@ export const useHooks = (t?: any) => {
       editColRender: (scope: any) => {
         const { $table, column, row, status } = scope;
 
+        let params = {
+          keyword: row.erp_mtrlengname
+        };
         return (
           <MtrldefErpInput
             v-model={row.erp_mtrlengname}
-            valueKey="erp_mtrlengname"
+            searchKey="zxmtrlmode"
             row={row}
             setMtrlerp={rModelSetMtrlErp}
-            onOpenModal={() => fModelChoseMtrlErp(row, {})}
+            onOpenModal={() => fModelChoseMtrlErp(row, params)}
             onClear={() => rModelClearMtrlErp(row, 2)}
           ></MtrldefErpInput>
         );
@@ -2368,7 +2374,8 @@ export const useHooks = (t?: any) => {
     ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
       confirmButtonText: t("common.okText"),
       cancelButtonText: "否",
-      type: "warning"
+      type: "warning",
+      closeOnClickModal: false
     })
       .then(() => {
         MattressYWAudit({ list, type }).then(() => {
@@ -2401,7 +2408,8 @@ export const useHooks = (t?: any) => {
     ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
       confirmButtonText: t("common.okText"),
       cancelButtonText: "否",
-      type: "warning"
+      type: "warning",
+      closeOnClickModal: false
     })
       .then(() => {
         MattressJSAudit({ list, type }).then(() => {
@@ -2434,7 +2442,8 @@ export const useHooks = (t?: any) => {
     ElMessageBox.confirm(`是否确定要${type ? "审核" : "撤审"}${curRecords.length}张床垫报价单吗?`, "询问", {
       confirmButtonText: t("common.okText"),
       cancelButtonText: "否",
-      type: "warning"
+      type: "warning",
+      closeOnClickModal: false
     })
       .then(() => {
         MattressJS2Audit({ list, type }).then(() => {

+ 1 - 1
JLHWEB/src/views/quote/mattressQuote/components/QuoteListNew.vue

@@ -17,7 +17,7 @@
         ></el-checkbox>
       </div>
       <div class="flx-shrink">
-        <el-button v-if="iforigin" size="small" @click="handleExportExcel"> 导出Excel </el-button>
+        <el-button size="small" @click="handleExportExcel"> 导出Excel </el-button>
       </div>
     </template>
 

+ 26 - 3
JLHWEB/src/views/system/selector/mattress/index.vue

@@ -5,6 +5,7 @@
     v-model:value="selectList"
     v-bind="$attrs"
     :item-key="TABLE_KEY"
+    :multiple-limit="multipleLimit"
     :layout="layout"
     @change-value="autoUpdateTableCheckbox"
   >
@@ -52,13 +53,19 @@ import { throttle } from "lodash-es";
 import { Search } from "@element-plus/icons-vue";
 // import variables from "@/styles/js.module.scss";
 
-// const props = withDefaults(defineProps<{}>(), {});
+const props = withDefaults(defineProps<{ multipleLimit?: number }>(), {
+  multipleLimit: 1
+});
 
 const { t } = useI18n();
 const { columns, initParams } = useOutrep(t);
 const selColumns: any = computed(() => {
   // let selCol: any = { type: "checkbox", width: 50, fixed: "left" };
   let selCol: any = { type: "radio", width: 50, fixed: "left" };
+
+  if (props.multipleLimit != 1) {
+    selCol = { type: "checkbox", width: 50, fixed: "left" };
+  }
   let _columns = cloneDeep(columns);
   // console.log(" _columns.unshift(selCol); :>> ", _columns.unshift(selCol));
   _columns.unshift(selCol);
@@ -81,11 +88,11 @@ const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 // const initParams = ref<any>({});
 const searchInput = ref("");
 const tableSearchCol = { xs: 4, sm: 5, md: 6, lg: 6, xl: 8 };
-const tableProps = {
+const tableProps = ref<any>({
   height: "auto",
   editConfig: { trigger: "click", mode: "cell" },
   rowConfig: { isCurrent: true, isHover: true, useKey: true, keyField: TABLE_KEY }
-};
+});
 
 const subtitle = ref("");
 
@@ -113,8 +120,24 @@ const handleDBlClickTable = async ({ row, column, rowIndex }: any) => {
   }
 };
 
+const handleCheckboxChange = (data: any) => {
+  const $table = LjTableRef.value.element;
+  console.log("handleCheckboxRangeChange data:>> ", data);
+  if (data.checked) {
+    selectList.value.push(data.row);
+  } else {
+    selectList.value = selectList.value.filter((item: any) => item[TABLE_KEY] != data.row[TABLE_KEY]);
+  }
+};
+
+const handleCheckboxRangeChange = (data: any) => {
+  selectList.value = data.records;
+};
+
 // 返回绑定的事件
 const tableEvents = {
+  "checkbox-change": handleCheckboxChange,
+  "checkbox-all": handleCheckboxRangeChange,
   "cell-dblclick": handleDBlClickTable,
   "cell-click": handleClickTable
 };

+ 38 - 7
JLHWEB/src/views/system/selector/mtrldefErp/input.vue

@@ -1,9 +1,11 @@
 <template>
-  <el-input v-model="inputValue" @input="disshow">
+  <el-input v-model="inputValue" @input="disshow" clearable @clear="handleClear" @keydown="handleKeydown">
     <template #suffix>
       <el-icon class="el-input__icon" v-if="loading">
         <Loading />
       </el-icon>
+      <el-icon v-else-if="successState && !successNoMatchState" class="vxecol-green"><CircleCheckFilled /></el-icon>
+      <el-icon v-else-if="successState && successNoMatchState" class="vxecol-gold"><WarningFilled /></el-icon>
       <el-icon v-else-if="successState" class="vxecol-green"><CircleCheckFilled /></el-icon>
       <el-icon v-else-if="errorState" class="vxecol-danger"><CircleCloseFilled /></el-icon>
       <el-icon v-else class="vxecol-gray" @click="openModal"><Search /></el-icon>
@@ -15,7 +17,7 @@
 import { ref, computed, nextTick } from "vue";
 import { GetERPMtrldefList } from "@/api/modules/common";
 import { ElInput, ElIcon } from "element-plus";
-import { Search, Loading, CircleCheckFilled, CircleCloseFilled } from "@element-plus/icons-vue";
+import { Search, Loading, CircleCheckFilled, CircleCloseFilled, WarningFilled } from "@element-plus/icons-vue";
 
 import { useUserStore } from "@/stores/modules/user";
 import { throttle } from "lodash-es";
@@ -39,16 +41,19 @@ const inputValue = computed({
 });
 
 const { userInfo } = useUserStore();
-const emit = defineEmits(["select", "update:value", "openModal"]);
+const emit = defineEmits(["select", "update:value", "openModal", "clear"]);
 const loading = ref(false);
 const successState = ref(false);
 const errorState = ref(false);
+const successNoMatchState = ref(false);
+const mtrldefList = ref<any[]>([]);
 
 const disshow = throttle(async (queryString: any) => {
   console.log("disshow props :>> ", props, queryString);
   loading.value = true;
   errorState.value = false;
   successState.value = false;
+  successNoMatchState.value = false;
 
   let newParams: any = {};
   newParams.pageindex = 1;
@@ -62,25 +67,51 @@ const disshow = throttle(async (queryString: any) => {
   console.log("newParams :>> ", newParams);
   let result = await GetERPMtrldefList(newParams);
 
+  mtrldefList.value = result.mtrldefList;
   console.log("result.datatable :>> ", result.mtrldefList);
 
   loading.value = false;
 
-  if (result.mtrldefList.length == 1) {
+  if (result.mtrldefList.length > 1) {
+    let matchItem = result.mtrldefList.find(o => o[props.searchKey] == queryString.trim());
+    if (matchItem) {
+      props.setMtrlerp(props.row, matchItem, props.searchKey);
+    } else {
+      successNoMatchState.value = true;
+    }
+    successState.value = true;
+    setTimeout(() => {
+      successState.value = false;
+    }, 1200);
+  } else if (result.mtrldefList.length == 1) {
     // emit("select", result.mtrldefList[0]);
-    props.setMtrlerp(props.row, result.mtrldefList[0], props.valueKey);
+    props.setMtrlerp(props.row, result.mtrldefList[0], props.searchKey);
     successState.value = true;
     setTimeout(() => {
       successState.value = false;
     }, 1200);
   } else {
-    props.setMtrlerp(props.row, {}, props.valueKey);
+    props.setMtrlerp(props.row, {}, props.searchKey);
     // emit("select", {});
     errorState.value = true;
+    setTimeout(() => {
+      errorState.value = false;
+    }, 1200);
   }
-}, 1500);
+}, 1000);
 
 const openModal = (e: any) => {
   emit("openModal", e);
 };
+
+const handleClear = () => {
+  emit("clear");
+};
+const handleKeydown = e => {
+  console.log("handleKeydown e :>> ", e);
+  // emit("clear");
+  if (e.key == "Enter" && mtrldefList.value.length > 1) {
+    emit("openModal", e);
+  }
+};
 </script>