fix: 🧩 代码迁移出错
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
22
src/utils/rexg/numberDecimalSeparatorRexg5.ts
Normal file
22
src/utils/rexg/numberDecimalSeparatorRexg5.ts
Normal file
@@ -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;
|
||||
};
|
||||
22
src/utils/routerControl/constant/boxMark.ts
Normal file
22
src/utils/routerControl/constant/boxMark.ts
Normal file
@@ -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
|
||||
}
|
||||
};
|
||||
3
src/utils/routerControl/constant/index.ts
Normal file
3
src/utils/routerControl/constant/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import { boxMarkIndexAdd } from "./boxMark";
|
||||
import { subscriptionIndexAdd } from "./subscription";
|
||||
export { boxMarkIndexAdd, subscriptionIndexAdd };
|
||||
21
src/utils/routerControl/constant/subscription.ts
Normal file
21
src/utils/routerControl/constant/subscription.ts
Normal file
@@ -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: ""
|
||||
}
|
||||
};
|
||||
13
src/utils/routerControl/index.ts
Normal file
13
src/utils/routerControl/index.ts
Normal file
@@ -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]);
|
||||
};
|
||||
Reference in New Issue
Block a user