From 12fd39b5af293d6ba4868da8f7fe5cd644cf22b6 Mon Sep 17 00:00:00 2001 From: yangchunlong <292345300@qq.com> Date: Tue, 15 Jul 2025 10:04:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A7=A9=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=87=BA=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/deliveryAndOutbound.ts | 10 +- src/stores/modules/auth.ts | 27 ++- src/utils/index.ts | 22 +++ src/utils/rexg/index.ts | 12 +- src/utils/rexg/numberDecimalSeparatorRexg.ts | 1 + src/utils/rexg/numberDecimalSeparatorRexg5.ts | 22 +++ src/utils/routerControl/constant/boxMark.ts | 22 +++ src/utils/routerControl/constant/index.ts | 3 + .../routerControl/constant/subscription.ts | 21 ++ src/utils/routerControl/index.ts | 13 ++ .../constant/details/columns.ts | 37 +++- .../outboundTaskList/details.vue | 187 ++++++++++++++++-- .../outboundTaskList/index.vue | 2 +- src/views/login/index5.vue | 132 +++++++++++++ 14 files changed, 489 insertions(+), 22 deletions(-) create mode 100644 src/utils/rexg/numberDecimalSeparatorRexg5.ts create mode 100644 src/utils/routerControl/constant/boxMark.ts create mode 100644 src/utils/routerControl/constant/index.ts create mode 100644 src/utils/routerControl/constant/subscription.ts create mode 100644 src/utils/routerControl/index.ts create mode 100644 src/views/login/index5.vue diff --git a/src/api/modules/deliveryAndOutbound.ts b/src/api/modules/deliveryAndOutbound.ts index cd76e4c..a2b49ee 100644 --- a/src/api/modules/deliveryAndOutbound.ts +++ b/src/api/modules/deliveryAndOutbound.ts @@ -15,6 +15,12 @@ export const getOutStockListApi = (params: Record) => { export const getDetailsApi = (id: any) => { return http.get(`OutStock/GetInfo/${id}`); }; -export const getTaskDetailsApi = (id: any) => { - return http.get(`OutStockTask/GetInfo/${id}`); +//出库单详情列表 +export const getTaskDetailsApi = (params: any) => { + return http.post(`OutStockTask/GetInfoByNo`, params); +}; + +//修改出库箱信息 +export const getEditBoxInfoApi = (params: Record) => { + return http.post(`OutStock/EditBoxInfo`, params); }; diff --git a/src/stores/modules/auth.ts b/src/stores/modules/auth.ts index b24499f..b5d3fa6 100644 --- a/src/stores/modules/auth.ts +++ b/src/stores/modules/auth.ts @@ -1,11 +1,18 @@ import { defineStore } from "pinia"; // import router from "@/routers"; import { getAuthMenuListApi } from "@/api/modules/login"; -import { getFlatMenuList, getShowMenuList, getAllBreadcrumbList, setKeeAliveRoute } from "@/utils"; +import { getFlatMenuList, getShowMenuList, getAllBreadcrumbList, setKeeAliveRoute, getBtnsAuthList } from "@/utils"; +// import { setRouterControl } from "@/utils/routerControl"; +import { boxMarkIndexAdd, subscriptionIndexAdd } from "@/utils/routerControl/constant/index"; + +// const TYPES_NUMBER: any = { +// boxMarkIndexAdd: 6 +// }; + //setKeeAliveRoute -export const useAuthStore = defineStore({ +export const useAuthStore: any = defineStore({ id: "wms-auth", - state: (): Record => ({ + state: (): any => ({ // 菜单权限列表 authMenuList: [], // 当前页面的 router name,用来做按钮权限筛选 @@ -19,7 +26,9 @@ export const useAuthStore = defineStore({ // 菜单权限列表 ==> 扁平化之后的一维数组菜单,主要用来添加动态路由 flatMenuListGet: state => getFlatMenuList(state.authMenuList), // 递归处理后的所有面包屑导航列表 - breadcrumbListGet: state => getAllBreadcrumbList(state.authMenuList) + breadcrumbListGet: state => getAllBreadcrumbList(state.authMenuList), + //设置按钮权限 + btnsAuthList: state => getBtnsAuthList(state.authMenuList) }, actions: { // Get AuthMenuList @@ -40,6 +49,16 @@ export const useAuthStore = defineStore({ } } ]; + // //判断箱唛列表是否有新增按钮 + let btnName: any = this.authMenuList[6]?.children[0]?.children[0]?.children[0]?.name; + let btnName1: any = this.authMenuList[6]?.children[1]?.children[0]?.children[0]?.name; + //如果箱唛列表页面有新增按钮就增加该路由! + if (btnName === "boxMarkIndexAdd") { + this.authMenuList[6]?.children[0]?.children.push(boxMarkIndexAdd); + } + if (btnName1 === "subscriptionIndexAdd") { + this.authMenuList[6]?.children[1]?.children.push(subscriptionIndexAdd); + } }, // Set RouteName async setRouteName(name: string) { diff --git a/src/utils/index.ts b/src/utils/index.ts index dd83c1d..09fc7a6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -307,3 +307,25 @@ export function findItemNested(enumData: any, callValue: any, value: string, chi if (current[children]) return findItemNested(current[children], callValue, value, children); }, null); } +//递归将按钮取出 +function recursiveExtractNames(menuList: any) { + let names: any[] = []; + for (let item of menuList) { + if (item.type === 0) { + names.push(item.name); + } + if (item.children && item.children.length > 0) { + names = names.concat(recursiveExtractNames(item.children)); + } + } + return names; +} +//按钮权限 +export function getBtnsAuthList(menuList: any) { + let length = menuList.length; + if (!length) { + return []; + } + let obj: any = recursiveExtractNames(menuList); + return obj; +} diff --git a/src/utils/rexg/index.ts b/src/utils/rexg/index.ts index 894ae37..6c379df 100644 --- a/src/utils/rexg/index.ts +++ b/src/utils/rexg/index.ts @@ -5,4 +5,14 @@ import { integerRexg } from "./integerRexg"; import { unitMultipleInputRexg } from "./unitMultipleInputRexg"; import { numberRexg1 } from "./numberRexg1"; import { numberDecimalSeparatorRexg } from "./numberDecimalSeparatorRexg"; -export { numberRexg, inputEnterRexg, productRexg, integerRexg, unitMultipleInputRexg, numberRexg1, numberDecimalSeparatorRexg }; +import { numberDecimalSeparatorRexg5 } from "./numberDecimalSeparatorRexg5"; +export { + numberRexg, + inputEnterRexg, + productRexg, + integerRexg, + unitMultipleInputRexg, + numberRexg1, + numberDecimalSeparatorRexg, + numberDecimalSeparatorRexg5 +}; diff --git a/src/utils/rexg/numberDecimalSeparatorRexg.ts b/src/utils/rexg/numberDecimalSeparatorRexg.ts index 3ba3a93..b80d9f2 100644 --- a/src/utils/rexg/numberDecimalSeparatorRexg.ts +++ b/src/utils/rexg/numberDecimalSeparatorRexg.ts @@ -7,5 +7,6 @@ export const numberDecimalSeparatorRexg = (value: any) => { value = value.replace(/[^\d.]/g, ""); // 清除"数字"和"."以外的字符 只能输入数字和小数点 value = value.replace(/\.{2,}/g, "."); // 不能连续输入两个及以上小数点 value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", "."); // 只保留第一个".", 清除多余的"." + return value; }; diff --git a/src/utils/rexg/numberDecimalSeparatorRexg5.ts b/src/utils/rexg/numberDecimalSeparatorRexg5.ts new file mode 100644 index 0000000..d21eefd --- /dev/null +++ b/src/utils/rexg/numberDecimalSeparatorRexg5.ts @@ -0,0 +1,22 @@ +//只允许输入数字和小数点(小数点后面5位) +export const numberDecimalSeparatorRexg5 = (value: any) => { + if (!value) { + return; + } + + // 清除"数字"和"."以外的字符,只能输入数字和小数点 + value = value.replace(/[^\d.]/g, ""); + // 不能连续输入两个及以上小数点 + value = value.replace(/\.{2,}/g, "."); + // 只保留第一个".", 清除多余的"." + value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", "."); + + // 限制小数点后最多 5 位 + const parts = value.split("."); + if (parts.length > 1 && parts[1].length > 5) { + parts[1] = parts[1].slice(0, 5); + value = parts.join("."); + } + + return value; +}; diff --git a/src/utils/routerControl/constant/boxMark.ts b/src/utils/routerControl/constant/boxMark.ts new file mode 100644 index 0000000..5ac1fdf --- /dev/null +++ b/src/utils/routerControl/constant/boxMark.ts @@ -0,0 +1,22 @@ +export const boxMarkIndexAdd = { + id: 938, + pid: 936, + module: 25, + title: "箱唛详情", + name: "boxMarkDetails", + path: "/setUp/boxMark/details", + component: "/setUp/boxMark/details", + icon: "", + redirect: "", + sort: 1, + type: 1, + hidden: true, + closed: false, + disable: false, + children: [], + meta: { + title: "箱唛详情", + icon: "", + isKeepAlive: true + } +}; diff --git a/src/utils/routerControl/constant/index.ts b/src/utils/routerControl/constant/index.ts new file mode 100644 index 0000000..90784a2 --- /dev/null +++ b/src/utils/routerControl/constant/index.ts @@ -0,0 +1,3 @@ +import { boxMarkIndexAdd } from "./boxMark"; +import { subscriptionIndexAdd } from "./subscription"; +export { boxMarkIndexAdd, subscriptionIndexAdd }; diff --git a/src/utils/routerControl/constant/subscription.ts b/src/utils/routerControl/constant/subscription.ts new file mode 100644 index 0000000..579e681 --- /dev/null +++ b/src/utils/routerControl/constant/subscription.ts @@ -0,0 +1,21 @@ +export const subscriptionIndexAdd = { + id: 949, + pid: 947, + module: 25, + title: "订阅详情", + name: "subscriptionDetails", + path: "/setUp/subscription/details", + component: "/setUp/subscription/details", + icon: "", + redirect: "", + sort: 1, + type: 1, + hidden: true, + closed: false, + disable: false, + children: [], + meta: { + title: "订阅详情", + icon: "" + } +}; diff --git a/src/utils/routerControl/index.ts b/src/utils/routerControl/index.ts new file mode 100644 index 0000000..d11da43 --- /dev/null +++ b/src/utils/routerControl/index.ts @@ -0,0 +1,13 @@ +import { boxMarkIndexAdd } from "./constant/index"; +import { useAuthStore } from "@/stores/modules/auth"; +const authStore = useAuthStore(); +const ROUTERS: any = { + boxMarkIndexAdd +}; +const TYPES_NUMBER: any = { + boxMarkIndexAdd: 6 +}; +export const setRouterControl = (type: string) => { + let authMenuListIndex = TYPES_NUMBER[type]; + authStore.authMenuList[authMenuListIndex].children[0].children.push(ROUTERS[type]); +}; diff --git a/src/views/deliveryAndOutbound/outboundTaskList/constant/details/columns.ts b/src/views/deliveryAndOutbound/outboundTaskList/constant/details/columns.ts index 4f2a387..0c78128 100644 --- a/src/views/deliveryAndOutbound/outboundTaskList/constant/details/columns.ts +++ b/src/views/deliveryAndOutbound/outboundTaskList/constant/details/columns.ts @@ -1,9 +1,41 @@ //明细信息 export const COLUMNS = [ + { + label: "", + align: "center", + prop: "indexNumber", + disabled: false, + width: "60px" + }, { label: "箱号", prop: "boxBillNo", - disabled: false + disabled: false, + width: "200px" + }, + { + label: "长CM", + prop: "boxLength", + disabled: false, + width: "140px" + }, + { + label: "宽CM", + prop: "boxWide", + disabled: false, + width: "140px" + }, + { + label: "高CM", + prop: "boxHigh", + disabled: false, + width: "140px" + }, + { + label: "重量KG", + prop: "boxWeight", + disabled: false, + width: "140px" }, { label: "规格型号", @@ -42,6 +74,7 @@ export const COLUMNS = [ { label: "出库时间", prop: "createTime", - disabled: false + disabled: false, + width: "200px" } ]; diff --git a/src/views/deliveryAndOutbound/outboundTaskList/details.vue b/src/views/deliveryAndOutbound/outboundTaskList/details.vue index 471b36b..ab004ff 100644 --- a/src/views/deliveryAndOutbound/outboundTaskList/details.vue +++ b/src/views/deliveryAndOutbound/outboundTaskList/details.vue @@ -21,12 +21,20 @@ +
+ 编辑 +
@@ -34,6 +42,52 @@
+ + +
+
+
箱号
+
长CM
+
宽CM
+
高CM
+
重量KG
+
规格型号
+
+
+
+ + + + + + +
+
+
+ + +
@@ -41,8 +95,12 @@ import DetailsSearch from "@/components/DetailsSearch/index.vue"; import { FORMDATA, RULEFORM, COLUMNS } from "./constant/details/index"; import { cloneDeep } from "lodash-es"; -import { getTaskDetailsApi } from "@/api/modules/deliveryAndOutbound"; - +import { getTaskDetailsApi, getEditBoxInfoApi } from "@/api/modules/deliveryAndOutbound"; +import { useMsg } from "@/hooks/useMsg"; +import { numberDecimalSeparatorRexg5 } from "@/utils/rexg/index"; +import { useAuthStore } from "@/stores/modules/auth"; +const authStore = useAuthStore(); +console.log(authStore, "============authStore============="); let labelWidth = "107px"; const tableRef = ref(null); @@ -52,39 +110,95 @@ const datas = reactive({ columns: COLUMNS, //明细信息列表配置项 ruleForm: cloneDeep(RULEFORM), // 表单 formData: cloneDeep(FORMDATA), //表头配置项 - tableHeight: 0 + tableHeight: 0, //表格高度 + isBtn: false, //控制编辑按钮显示 + isEdit: false, //控制编辑弹窗 + editList: [], //表格编辑数据 + pageSize: 1000, //默认请求1000条数据(现在一个单最多300条,需做分页优化,暂无该需求) + pageNo: 1 }); const $route = useRoute(); - let activeName = ref("outboundTaskListDetails"); let formActiveName = ref("infoBasic"); //获取详情 -const getDetails = async (id: any) => { - if (!id) { +const getDetails = async (billNo: any) => { + if (!billNo) { return false; } - const result = await getTaskDetailsApi(id); + console.log("12323"); + const result = await getTaskDetailsApi({ + billNo, + pageSize: datas.pageSize, + pageNo: datas.pageNo + }); if (result.status === 200) { const { data } = result; - datas.ruleForm = data; + datas.ruleForm = cloneDeep(data); + datas.isBtn = !datas.ruleForm.details.length; } }; -getDetails($route.query.id); +getDetails($route.query.billNo); //动态计算表格高度 const handleResize = () => { nextTick(() => { - datas.tableHeight = tableRef.value.clientHeight - 280; + datas.tableHeight = tableRef.value.clientHeight - 350; if (datas.tableHeight <= 92) { datas.tableHeight = 92; } }); }; +//限制input输入 +const handleInput = (item: any, type: any) => { + item[type] = numberDecimalSeparatorRexg5(item[type]); +}; +//窗口关闭 +const handleDiaLog = () => { + datas.editList = []; +}; +//编辑 +const handleEditClick = () => { + if (datas.isBtn) { + return; + } + //赋值 + datas.editList = cloneDeep(datas.ruleForm); + //打开编辑窗口 + datas.isEdit = true; +}; +//编辑确认 +const handleEditCommit = async () => { + let params: any = []; + datas.editList.details.forEach((item: any) => { + params.push({ + boxHigh: item.boxHigh, + boxLength: item.boxLength, + boxWeight: item.boxWeight, + boxWide: item.boxWide, + outStockBoxDetailsId: item.outStockBoxDetailsId, + outStockId: item.outStockId + }); + }); + const result = await getEditBoxInfoApi(params); + const { isSuccess, message } = result; + if (result.status === 200) { + if (isSuccess) { + useMsg("success", "数据修改成功 !"); + getDetails($route.query.billNo); + datas.isEdit = false; + datas.editList = []; + } else { + useMsg("error", message); + } + } else { + useMsg("error", message); + } +}; + onMounted(() => { handleResize(); }); // 详情 onActivated(() => { - getDetails($route.query.id); window.addEventListener("resize", handleResize); }); onDeactivated(() => { @@ -94,3 +208,52 @@ onBeforeUnmount(() => { window.removeEventListener("resize", handleResize); }); + diff --git a/src/views/deliveryAndOutbound/outboundTaskList/index.vue b/src/views/deliveryAndOutbound/outboundTaskList/index.vue index 3a1acd1..9344bc0 100644 --- a/src/views/deliveryAndOutbound/outboundTaskList/index.vue +++ b/src/views/deliveryAndOutbound/outboundTaskList/index.vue @@ -126,7 +126,7 @@ const handleToDetail = (row: any) => { $router.push({ path: "/deliveryAndOutbound/outboundTaskList/details", query: { - id: row.id + billNo: row.billNo } }); }; diff --git a/src/views/login/index5.vue b/src/views/login/index5.vue new file mode 100644 index 0000000..4a0e903 --- /dev/null +++ b/src/views/login/index5.vue @@ -0,0 +1,132 @@ + + +