Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a91367a16e | ||
|
|
c086a4d161 | ||
|
|
45363987fd | ||
|
|
da78b9c98a | ||
|
|
13992ffa58 | ||
|
|
a249e5e185 | ||
|
|
9eaa94a523 | ||
|
|
b39c076879 | ||
|
|
6d34bcfde7 | ||
|
|
3c56eb2ba0 | ||
|
|
a1d3485ba7 | ||
|
|
428c74047b | ||
|
|
b77ad54309 | ||
|
|
6137ac18b7 | ||
|
|
44f8d43775 | ||
|
|
eedf3f00c1 | ||
|
|
e7f868d319 | ||
|
|
0d063e887c | ||
|
|
4de59336b2 | ||
|
|
b992b2653a | ||
|
|
d673fc8685 | ||
|
|
55383cf501 | ||
|
|
c46a55e9c4 | ||
|
|
f51fe8433b | ||
|
|
fdc7639887 | ||
|
|
efb6b2598a | ||
|
|
f6595f784a | ||
|
|
963c0f5713 | ||
|
|
543662a2ac | ||
|
|
17b68cbc95 | ||
|
|
dd527a4994 | ||
|
|
977a998767 | ||
|
|
a57ebbcc62 | ||
|
|
5cdbee88b4 | ||
|
|
a8eaccc53e | ||
|
|
413c14083b | ||
| a86e6d4009 | |||
|
|
d4b2ac1f01 | ||
|
|
43b67f2e1a | ||
|
|
563285eb77 | ||
|
|
815d34f817 | ||
|
|
36b03efd0a | ||
|
|
fddbb8c9dc | ||
|
|
4f6c6cf943 | ||
|
|
5fd97ebe72 | ||
| 91eea8cc8a | |||
|
|
534cc0ab76 | ||
|
|
7efaa253a2 | ||
|
|
a3051c0ea4 | ||
| 7033c3cdc6 | |||
|
|
1ee1b05fca | ||
|
|
702d1bb699 | ||
|
|
87fe66da3e | ||
| 12201e065f | |||
| 95f54fb674 | |||
|
|
8f89252d8b | ||
|
|
65cb7826d3 | ||
|
|
39cbe0ff35 | ||
| fc248a5ed2 | |||
|
|
abc6db7f18 | ||
|
|
86e7705985 | ||
| 21441a64ad | |||
|
|
328696eb55 | ||
|
|
6a5c783419 | ||
|
|
44e7598b68 | ||
|
|
4b5498ad49 | ||
|
|
0797ea046f | ||
|
|
bf8c6a1d00 | ||
|
|
f05369556c | ||
|
|
3526432052 | ||
|
|
74c03a2358 | ||
|
|
50bebf451d | ||
|
|
6a1fa6458e | ||
| 760eb7c993 | |||
| ecb8404383 | |||
| f20cc42583 | |||
|
|
b28bcaaab7 | ||
|
|
9804baf8a3 | ||
|
|
4695a82b38 | ||
|
|
9929ea74b4 | ||
|
|
f72b5300be | ||
|
|
e4b1f05037 | ||
|
|
4b32e1f215 | ||
|
|
53d616ee49 | ||
|
|
17c9330f32 | ||
|
|
88e3ffe33b | ||
|
|
0ca2baa44a | ||
|
|
f08f45fb9c | ||
|
|
1ec486a42d | ||
|
|
4fc0781e05 | ||
|
|
9de2c874f0 | ||
| dc7e9d40e7 | |||
|
|
07ccde9f59 | ||
|
|
6abac988c7 | ||
|
|
ea254245c7 | ||
| d7518e41e4 | |||
|
|
51f408ce7a | ||
|
|
29bc14d3e1 | ||
|
|
c4c10ab9b4 | ||
|
|
1f22234b45 | ||
| 64ae879aee | |||
|
|
7f8aeebb1e | ||
|
|
c0fcba6a25 | ||
|
|
9a9807230d |
112
.merge_file_uAPEJh
Normal file
112
.merge_file_uAPEJh
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
||||||
|
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen";
|
||||||
|
import { LOGIN_URL } from "@/config";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { ResultData } from "@/api/interface";
|
||||||
|
import { ResultEnum } from "@/enums/httpEnum";
|
||||||
|
import { checkStatus } from "./helper/checkStatus";
|
||||||
|
import { useUserStore } from "@/stores/modules/user";
|
||||||
|
import router from "@/routers";
|
||||||
|
|
||||||
|
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||||
|
loading?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
// 默认地址请求地址,可在 .env.** 文件中修改
|
||||||
|
baseURL: import.meta.env.VITE_API_URL as string,
|
||||||
|
// 设置超时时间
|
||||||
|
timeout: ResultEnum.TIMEOUT as number,
|
||||||
|
// 跨域时候允许携带凭证
|
||||||
|
withCredentials: true,
|
||||||
|
// post请求指定数据类型以及编码
|
||||||
|
headers: { 'Content-Type': 'application/json;charset=utf-8' }
|
||||||
|
};
|
||||||
|
|
||||||
|
class RequestHttp {
|
||||||
|
service: AxiosInstance;
|
||||||
|
public constructor(config: AxiosRequestConfig) {
|
||||||
|
// 创建实例
|
||||||
|
this.service = axios.create(config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 请求拦截器
|
||||||
|
* 客户端发送请求 -> [请求拦截器] -> 服务器
|
||||||
|
* token校验(JWT) : 接受服务器返回的 token,存储到 vuex/pinia/本地储存当中
|
||||||
|
*/
|
||||||
|
this.service.interceptors.request.use(
|
||||||
|
(config: CustomAxiosRequestConfig) => {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||||
|
config.loading ?? (config.loading = true);
|
||||||
|
config.loading && showFullScreenLoading();
|
||||||
|
if (config.headers && typeof config.headers.set === "function") {
|
||||||
|
config.headers.set("x-access-token", userStore.token);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
(error: AxiosError) => {
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 响应拦截器
|
||||||
|
* 服务器换返回信息 -> [拦截统一处理] -> 客户端JS获取到信息
|
||||||
|
*/
|
||||||
|
this.service.interceptors.response.use(
|
||||||
|
(response: AxiosResponse) => {
|
||||||
|
const { data } = response;
|
||||||
|
const userStore = useUserStore();
|
||||||
|
tryHideFullScreenLoading();
|
||||||
|
// 登陆失效
|
||||||
|
if (data.code == ResultEnum.OVERDUE) {
|
||||||
|
userStore.setToken("");
|
||||||
|
router.replace(LOGIN_URL);
|
||||||
|
ElMessage.error(data.message);
|
||||||
|
return Promise.reject(data);
|
||||||
|
}
|
||||||
|
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||||
|
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||||
|
ElMessage.error(data.message);
|
||||||
|
return Promise.reject(data);
|
||||||
|
}
|
||||||
|
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
async (error: AxiosError) => {
|
||||||
|
const { response } = error;
|
||||||
|
tryHideFullScreenLoading();
|
||||||
|
// 请求超时 && 网络错误单独判断,没有 response
|
||||||
|
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
||||||
|
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
||||||
|
// 根据服务器响应的错误状态码,做不同的处理
|
||||||
|
if (response) checkStatus(response.status);
|
||||||
|
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
||||||
|
if (!window.navigator.onLine) router.replace("/500");
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 常用请求方法封装
|
||||||
|
*/
|
||||||
|
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||||
|
return this.service.get(url, { params, ..._object });
|
||||||
|
}
|
||||||
|
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
||||||
|
return this.service.post(url, params, _object);
|
||||||
|
}
|
||||||
|
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||||
|
return this.service.put(url, params, _object);
|
||||||
|
}
|
||||||
|
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
||||||
|
return this.service.delete(url, { params, ..._object });
|
||||||
|
}
|
||||||
|
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
|
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new RequestHttp(config);
|
||||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Chns",
|
"Chns",
|
||||||
|
"Combox",
|
||||||
"daterange",
|
"daterange",
|
||||||
"devicedata",
|
"devicedata",
|
||||||
"errordata",
|
"errordata",
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
"logdata",
|
"logdata",
|
||||||
"Pids",
|
"Pids",
|
||||||
"plandata",
|
"plandata",
|
||||||
|
"PQDIF",
|
||||||
"resourcedata",
|
"resourcedata",
|
||||||
"resourcename",
|
"resourcename",
|
||||||
"rmark",
|
"rmark",
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ VITE_API_URL=/api
|
|||||||
|
|
||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
|
|
||||||
# VITE_PROXY=[["/api","http://192.168.1.122:18092/"]]
|
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]]
|
||||||
VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]洪圣文
|
# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
|
||||||
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
|
||||||
import { Device } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name 被检设备管理模块
|
|
||||||
*/
|
|
||||||
// 获取检测脚本列表
|
|
||||||
export const getDeviceList = (params: Device.ReqDeviceParams) => {
|
|
||||||
return http.post<ResPage<Device.ResDeviceList>>(`/RoleList_Post`, params)
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/device/list`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getPlan_DeviceList = (params: Device.DeviceList) => {
|
|
||||||
//return http.post<ResPage<Device.ResDeviceList>>(`/RoleList_Post`, params)
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/device/list`, params)
|
|
||||||
}
|
|
||||||
437
frontend/src/api/device/device/deviceData.ts
Normal file
437
frontend/src/api/device/device/deviceData.ts
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
const data = [
|
||||||
|
{
|
||||||
|
id: 'device1',
|
||||||
|
deviceName:"模拟装置1",
|
||||||
|
deviceType:"PQS882B4电能质量监测装置",
|
||||||
|
deviceChannels:"4",
|
||||||
|
planName: "沧州220kV留古等4座变电站电能质量检测",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device2',
|
||||||
|
deviceName:"模拟装置2",
|
||||||
|
deviceType:"PQS882A电能质量监测装置",
|
||||||
|
deviceChannels:"1",
|
||||||
|
planName: "邯郸220kV团城站等4座站电能质量检测",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device3',
|
||||||
|
deviceName:"模拟装置3",
|
||||||
|
deviceType:"PQS882A电能质量监测装置",
|
||||||
|
deviceChannels:"1",
|
||||||
|
planName: "衡水冀州光伏电站配套出口工程",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "1",
|
||||||
|
deviceCompany: "南京灿能电力自动化股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'device4',
|
||||||
|
deviceName:"模拟装置4",
|
||||||
|
deviceType:"PMC-680M-22-22-00-115ANBC电能质量监测装置",
|
||||||
|
deviceChannels:"4",
|
||||||
|
planName: "深圳市中电软件有限公司委托送检",
|
||||||
|
deviceUn: "57.74",
|
||||||
|
deviceIn: "5",
|
||||||
|
deviceCompany: "深圳中电电力技术股份有限公司",
|
||||||
|
deviceModel: "模拟式",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const plan_devicedata = [
|
||||||
|
{
|
||||||
|
id: '1', //装置序号ID
|
||||||
|
name: '240001', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2', //装置序号ID
|
||||||
|
name: '240002', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '3', //装置序号ID
|
||||||
|
name: '240003', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4', //装置序号ID
|
||||||
|
name: '240004', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '5', //装置序号ID
|
||||||
|
name: '240005', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '有不合格项', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '6', //装置序号ID
|
||||||
|
name: '240006', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '有不合格项', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 1, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '7', //装置序号ID
|
||||||
|
name: '240007', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '全部合格', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 1, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '8', //装置序号ID
|
||||||
|
name: '240008', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '全部合格', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '9', //装置序号ID
|
||||||
|
name: '240009', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '有不合格项', //检测结果
|
||||||
|
report_State: '已生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 1, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '10', //装置序号ID
|
||||||
|
name: '240010', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '全部合格', //检测结果
|
||||||
|
report_State: '已生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 2, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '11', //装置序号ID
|
||||||
|
name: '240011', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '全部合格', //检测结果
|
||||||
|
report_State: '已生成', //报告状态
|
||||||
|
document_State: '已归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 1, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '12', //装置序号ID
|
||||||
|
name: '240012', //设备名称
|
||||||
|
dev_Type: 'PQS882B4',//设备类型
|
||||||
|
dev_Chns: 4, //设备通道数
|
||||||
|
check_Result: '全部合格', //检测结果
|
||||||
|
report_State: '已生成', //报告状态
|
||||||
|
document_State: '已归档', //归档状态
|
||||||
|
check_State:'检测完成',//检测状态
|
||||||
|
reCheck_Num: 2, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '13', //装置序号ID
|
||||||
|
name: '240013', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '14', //装置序号ID
|
||||||
|
name: '240014', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '15', //装置序号ID
|
||||||
|
name: '240013', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '16', //装置序号ID
|
||||||
|
name: '240014', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '17', //装置序号ID
|
||||||
|
name: '240017', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '18', //装置序号ID
|
||||||
|
name: '240018', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '19', //装置序号ID
|
||||||
|
name: '240019', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '20', //装置序号ID
|
||||||
|
name: '240020', //设备名称
|
||||||
|
dev_Type: 'PQS882A',//设备类型
|
||||||
|
dev_Chns: 1, //设备通道数
|
||||||
|
check_Result: '未检测', //检测结果
|
||||||
|
report_State: '未生成', //报告状态
|
||||||
|
document_State: '未归档', //归档状态
|
||||||
|
check_State:'未检测',//检测状态
|
||||||
|
reCheck_Num: 0, //复检次数
|
||||||
|
},
|
||||||
|
]
|
||||||
|
// const plan_devicedata = [
|
||||||
|
// {
|
||||||
|
// id: '1', //装置序号ID
|
||||||
|
// name: '模拟装置1', //设备名称
|
||||||
|
// dev_Type: 'PQS882A',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 0, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '2', //装置序号ID
|
||||||
|
// name: '模拟装置2', //设备名称
|
||||||
|
// dev_Type: 'PQS882B4',//设备类型
|
||||||
|
// dev_Chns: 4, //设备通道数
|
||||||
|
// check_Result: '/', //检测结果
|
||||||
|
// report_State: '未生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'未检',//检测状态
|
||||||
|
// reCheck_Num: 0, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '3', //装置序号ID
|
||||||
|
// name: '模拟装置3', //设备名称
|
||||||
|
// dev_Type: 'PQS882B4',//设备类型
|
||||||
|
// dev_Chns: 4, //设备通道数
|
||||||
|
// check_Result: '/', //检测结果
|
||||||
|
// report_State: '未生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测中',//检测状态
|
||||||
|
// reCheck_Num: 0, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '4', //装置序号ID
|
||||||
|
// name: '模拟装置4', //设备名称
|
||||||
|
// dev_Type: 'PQS882B4',//设备类型
|
||||||
|
// dev_Chns: 4, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '未生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 1, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '5', //装置序号ID
|
||||||
|
// name: '中电测试装置', //设备名称
|
||||||
|
// dev_Type: 'PMC-680M-22-22-00-115ANBC',//设备类型
|
||||||
|
// dev_Chns: 4, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '未生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 1, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '6', //装置序号ID
|
||||||
|
// name: '易司拓测试装置1', //设备名称
|
||||||
|
// dev_Type: 'E703A',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 1, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '7', //装置序号ID
|
||||||
|
// name: '易司拓测试装置2', //设备名称
|
||||||
|
// dev_Type: 'E703A',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 1, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '8', //装置序号ID
|
||||||
|
// name: '山大电力测试装置1', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 1, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '9', //装置序号ID
|
||||||
|
// name: '山大电力测试装置2', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '10', //装置序号ID
|
||||||
|
// name: '山大电力测试装置2', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '11', //装置序号ID
|
||||||
|
// name: '山大电力测试装置2', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '12', //装置序号ID
|
||||||
|
// name: '山大电力测试装置2', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '13', //装置序号ID
|
||||||
|
// name: '山大电力测试装置2', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '14', //装置序号ID
|
||||||
|
// name: '山大电力测试装置3', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: '15', //装置序号ID
|
||||||
|
// name: '山大电力测试装置4', //设备名称
|
||||||
|
// dev_Type: 'SDL-3002C',//设备类型
|
||||||
|
// dev_Chns: 1, //设备通道数
|
||||||
|
// check_Result: '不合格', //检测结果
|
||||||
|
// report_State: '已生成', //报告状态
|
||||||
|
// document_State: '未归档', //归档状态
|
||||||
|
// check_State:'检测完成',//检测状态
|
||||||
|
// reCheck_Num: 2, //复检次数
|
||||||
|
// },
|
||||||
|
// ]
|
||||||
|
|
||||||
|
export default {data,plan_devicedata}
|
||||||
39
frontend/src/api/device/device/index.ts
Normal file
39
frontend/src/api/device/device/index.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import type { Device } from '@/api/device/interface/device'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 被检设备管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取被检设备
|
||||||
|
export const getPqDevList = (params: Device.ReqPqDevParams) => {
|
||||||
|
return http.post(`/pqDev/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加被检设备
|
||||||
|
export const addPqDev = (params: Device.ResPqDev) => {
|
||||||
|
return http.post(`/pqDev/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑被检设备
|
||||||
|
export const updatePqDev = (params: Device.ResPqDev) => {
|
||||||
|
return http.post(`/pqDev/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除被检设备
|
||||||
|
export const deletePqDev = (params: string[]) => {
|
||||||
|
return http.post(`/pqDev/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//导出被检设备
|
||||||
|
export const exportPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
|
return http.download(`/pqDev/export`, params)
|
||||||
|
}
|
||||||
|
export const downloadTemplate = () => {
|
||||||
|
return http.download(`/pqDev/downloadTemplate`)
|
||||||
|
}
|
||||||
|
//导入被检设备
|
||||||
|
export const importPqDev=(params: Device.ReqPqDevParams)=>{
|
||||||
|
return http.upload(`/pqDev/import`, params)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
const data = [
|
|
||||||
{
|
|
||||||
id: 'device1',
|
|
||||||
devicename:"模拟装置1",
|
|
||||||
deviceType:"PQS882B4电能质量监测装置",
|
|
||||||
deviceChannels:"4",
|
|
||||||
Planname: "沧州220kV留古等4座变电站电能质量检测",
|
|
||||||
deviceUn: "57.74",
|
|
||||||
deviceIn: "5",
|
|
||||||
deviceCompany: "南京灿能电力自动化股份有限公司",
|
|
||||||
deviceModel: "模拟式",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'device2',
|
|
||||||
devicename:"模拟装置2",
|
|
||||||
deviceType:"PQS882A电能质量监测装置",
|
|
||||||
deviceChannels:"1",
|
|
||||||
Planname: "邯郸220kV团城站等4座站电能质量检测",
|
|
||||||
deviceUn: "57.74",
|
|
||||||
deviceIn: "5",
|
|
||||||
deviceCompany: "南京灿能电力自动化股份有限公司",
|
|
||||||
deviceModel: "模拟式",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'device3',
|
|
||||||
devicename:"模拟装置3",
|
|
||||||
deviceType:"PQS882A电能质量监测装置",
|
|
||||||
deviceChannels:"1",
|
|
||||||
Planname: "衡水冀州光伏电站配套出口工程",
|
|
||||||
deviceUn: "57.74",
|
|
||||||
deviceIn: "1",
|
|
||||||
deviceCompany: "南京灿能电力自动化股份有限公司",
|
|
||||||
deviceModel: "模拟式",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'device4',
|
|
||||||
devicename:"模拟装置4",
|
|
||||||
deviceType:"PMC-680M-22-22-00-115ANBC电能质量监测装置",
|
|
||||||
deviceChannels:"4",
|
|
||||||
Planname: "深圳市中电软件有限公司委托送检",
|
|
||||||
deviceUn: "57.74",
|
|
||||||
deviceIn: "5",
|
|
||||||
deviceCompany: "深圳中电电力技术股份有限公司",
|
|
||||||
deviceModel: "模拟式",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const plan_devicedata = [
|
|
||||||
{
|
|
||||||
id: '1', //装置序号ID
|
|
||||||
name: '设备1', //设备名称
|
|
||||||
dev_Type: 'PQS882A',//设备类型
|
|
||||||
dev_Chns: 1, //设备通道数
|
|
||||||
check_Result: '合格', //检测结果
|
|
||||||
report_State: '已生成', //报告状态
|
|
||||||
document_State: '归档', //归档状态
|
|
||||||
check_State:'检测完成',//检测状态
|
|
||||||
reCheck_Num: 0, //复检次数
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2', //装置序号ID
|
|
||||||
name: '设备2', //设备名称
|
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
|
||||||
dev_Chns: 4, //设备通道数
|
|
||||||
check_Result: '/', //检测结果
|
|
||||||
report_State: '未生成', //报告状态
|
|
||||||
document_State: '未归档', //归档状态
|
|
||||||
check_State:'未检',//检测状态
|
|
||||||
reCheck_Num: 0, //复检次数
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3', //装置序号ID
|
|
||||||
name: '设备3', //设备名称
|
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
|
||||||
dev_Chns: 4, //设备通道数
|
|
||||||
check_Result: '/', //检测结果
|
|
||||||
report_State: '未生成', //报告状态
|
|
||||||
document_State: '未归档', //归档状态
|
|
||||||
check_State:'检测中',//检测状态
|
|
||||||
reCheck_Num: 0, //复检次数
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4', //装置序号ID
|
|
||||||
name: '设备4', //设备名称
|
|
||||||
dev_Type: 'PQS882B4',//设备类型
|
|
||||||
dev_Chns: 4, //设备通道数
|
|
||||||
check_Result: '不合格', //检测结果
|
|
||||||
report_State: '未生成', //报告状态
|
|
||||||
document_State: '未归档', //归档状态
|
|
||||||
check_State:'检测完成',//检测状态
|
|
||||||
reCheck_Num: 1, //复检次数
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default {data,plan_devicedata}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type {ErrorSystem} from "./interface"
|
import type {ErrorSystem} from "@/api/device/interface/error"
|
||||||
|
|
||||||
const errordata = ref<ErrorSystem.ErrorSystemList[]>([
|
const errordata = ref<ErrorSystem.ErrorSystemList[]>([
|
||||||
{
|
{
|
||||||
34
frontend/src/api/device/error/index.ts
Normal file
34
frontend/src/api/device/error/index.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import type { ErrorSystem } from '@/api/device/interface/error'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 误差体系管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取误差体系
|
||||||
|
export const getPqErrSysList = (params: ErrorSystem.ErrorSystemList) => {
|
||||||
|
return http.post(`/pqErrSys/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据id查询误差体系
|
||||||
|
export const getPqErrSysListById = (params: ErrorSystem.ErrorSystemList) => {
|
||||||
|
return http.get(`/pqErrSys/getById?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加误差体系
|
||||||
|
export const addPqErrSys = (params: ErrorSystem.ErrorSystemList) => {
|
||||||
|
return http.post(`/pqErrSys/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑误差体系
|
||||||
|
export const updatePqErrSys = (params: ErrorSystem.ErrorSystemList) => {
|
||||||
|
return http.post(`/pqErrSys/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除误差体系
|
||||||
|
export const deletePqErrSys = (params: string[]) => {
|
||||||
|
return http.post(`/pqErrSys/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
63
frontend/src/api/device/interface/device.ts
Normal file
63
frontend/src/api/device/interface/device.ts
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import type { ReqPage,ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 被检设备模块
|
||||||
|
export namespace Device {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqPqDevParams extends ReqPage{
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?:string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResPqDev {
|
||||||
|
id: string; //装置序号ID
|
||||||
|
name: string; //设备名称
|
||||||
|
pattern: string; //设备模式 模拟 数字 比对
|
||||||
|
devType: string;//设备类型
|
||||||
|
devChns: number; //设备通道数
|
||||||
|
devVolt: number; //额定电压(V)
|
||||||
|
devCurr: number; //额定电流(A)
|
||||||
|
manufacturer: string;//生产厂家
|
||||||
|
createDate: string; //生产日期
|
||||||
|
createId: string; //出厂编号
|
||||||
|
hardwareVersion: string; //固件版本
|
||||||
|
softwareVersion: string; //软件版本
|
||||||
|
protocol:string; //通讯协议
|
||||||
|
ip: string; //IP地址
|
||||||
|
port: number; //端口号
|
||||||
|
encryptionFlag: number; //装置是否为加密版本
|
||||||
|
series?: string| null; //装置识别码(3ds加密)
|
||||||
|
devKey?: string| null; //装置秘钥(3ds加密)
|
||||||
|
sampleID?: string| null; //样品编号
|
||||||
|
arrivedDate?: string; //送样日期
|
||||||
|
cityName?: string| null; //所属地市名称
|
||||||
|
gDName?: string| null; //所属供电公司名称
|
||||||
|
subName?: string| null; //所属电站名称
|
||||||
|
checkState?: number| null; //检测状态
|
||||||
|
checkResult?: number| null; //检测结果
|
||||||
|
reportState?: number| null; //报告状态
|
||||||
|
documentState?: number| null; //归档状态
|
||||||
|
reportPath?: string| null; //报告路径
|
||||||
|
qRCode?: string| null; //设备关键信息二维码
|
||||||
|
reCheckNum: number; //复检次数
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqDevPage extends ResPage<ResPqDev> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
46
frontend/src/api/device/interface/error.ts
Normal file
46
frontend/src/api/device/interface/error.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import type { ReqPage } from "@/api/interface";
|
||||||
|
|
||||||
|
// 误差体系模块
|
||||||
|
export namespace ErrorSystem {
|
||||||
|
|
||||||
|
// 误差体系列表
|
||||||
|
export interface ErrorSystemList {
|
||||||
|
id: string;//误差体系表Id
|
||||||
|
name: string;//误差体系名称
|
||||||
|
standardName:string;//参照标准名称
|
||||||
|
standardTime:string;//标准推行时间
|
||||||
|
devLevel:string;//使用设备等级
|
||||||
|
enable:number;//状态:0-不启用 1-启用
|
||||||
|
state:number;//0-删除 1-正常
|
||||||
|
createBy?:string;//创建用户
|
||||||
|
createTime?:string;//创建时间
|
||||||
|
updateBy?:string;//修改用户
|
||||||
|
updateTime?:string;//修改时间
|
||||||
|
pqErrSysDtlsList?: ErrorSystemDetail[];//误差体系子表列表
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查看详细误差体系
|
||||||
|
export interface ErrorSystemDetail {
|
||||||
|
nextId: number;
|
||||||
|
id:string;//误差体系子表ID
|
||||||
|
errorSysId:string;//所属误差体系ID
|
||||||
|
type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段)
|
||||||
|
startValue?:number;//误差判断起始值(误差范围)
|
||||||
|
startFlag?:number;//是否包含起始值
|
||||||
|
endValue?:number;//;误差判断结束值(误差范围)
|
||||||
|
endFlag?:number;//是否包含结束值
|
||||||
|
conditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
||||||
|
maxErrorValue:number;//误差最大值
|
||||||
|
errorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查看详细误差体系
|
||||||
|
// export interface Error_detail {
|
||||||
|
// measured: string;
|
||||||
|
// deviceLevel: string;
|
||||||
|
// measurementType:string;
|
||||||
|
// condition: string;
|
||||||
|
// maxErrorValue: string;
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
|
||||||
|
|
||||||
// 被检设备模块
|
|
||||||
export namespace Device {
|
|
||||||
|
|
||||||
// 被检设备列表
|
|
||||||
export interface ResDeviceList {
|
|
||||||
id: string; //被检设备ID
|
|
||||||
deviceName: string; //检测设备名称
|
|
||||||
deviceType: string; //检测设备类型
|
|
||||||
deviceChannels: string;//设备通道数
|
|
||||||
PlanName: string; //所属计划名称
|
|
||||||
deviceUn: string; //设备额定电压
|
|
||||||
deviceIn: string; //设备额定电流
|
|
||||||
deviceCompany: string;//设备厂家
|
|
||||||
deviceModel: string; //设备模式 模拟 数字 比对
|
|
||||||
}
|
|
||||||
|
|
||||||
// 被检设备参数
|
|
||||||
export interface ReqDeviceParams extends ReqPage {
|
|
||||||
id: string; //被检设备ID
|
|
||||||
deviceName: string; //检测设备名称
|
|
||||||
deviceType: string; //检测设备类型
|
|
||||||
deviceChannels: string;//设备通道数
|
|
||||||
PlanName: string; //所属计划名称
|
|
||||||
deviceUn: string; //设备额定电压
|
|
||||||
deviceIn: string; //设备额定电流
|
|
||||||
deviceCompany: string;//设备厂家
|
|
||||||
deviceModel: string; //设备模式 模拟 数字 比对
|
|
||||||
}
|
|
||||||
|
|
||||||
// 被检设备列表
|
|
||||||
export interface DeviceList {
|
|
||||||
id: string; //装置序号ID
|
|
||||||
name: string; //设备名称
|
|
||||||
pattern?: string; //设备模式 模拟 数字 比对
|
|
||||||
dev_Type: string;//设备类型
|
|
||||||
dev_Chns: number; //设备通道数
|
|
||||||
dev_Volt?: number; //额定电压(V)
|
|
||||||
dev_Curr?: number; //额定电流(A)
|
|
||||||
manufacturer?: string;//生产厂家
|
|
||||||
createDate?: string; //生产日期
|
|
||||||
createId?: string; //出厂编号
|
|
||||||
hardware_Version?: string; //固件版本
|
|
||||||
software_Version?: string; //软件版本
|
|
||||||
iP?: string; //IP地址
|
|
||||||
port?: number; //端口号
|
|
||||||
isEncryption?: string; //装置是否为加密版本
|
|
||||||
series?: string; //装置识别码(3ds加密)
|
|
||||||
dev_Key?: string; //装置秘钥(3ds加密)
|
|
||||||
sampleID?: string; //样品编号
|
|
||||||
arrived_Date?: string; //送样日期
|
|
||||||
city_Name?: string; //所属地市名称
|
|
||||||
gD_Name?: string; //所属供电公司名称
|
|
||||||
sub_Name?: string; //所属电站名称
|
|
||||||
check_State: string; //检测状态
|
|
||||||
check_Result: string; //检测结果
|
|
||||||
report_State: string; //报告状态
|
|
||||||
document_State: string; //归档状态
|
|
||||||
reCheck_Num: number; //复检次数
|
|
||||||
state?: number; //状态
|
|
||||||
create_By?: string; //创建用户
|
|
||||||
create_Time?: string; //创建时间
|
|
||||||
update_By?: string; //更新用户
|
|
||||||
update_Time?: string; //更新时间
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
35
frontend/src/api/device/interface/monitor.ts
Normal file
35
frontend/src/api/device/interface/monitor.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import type { ReqPage,ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 被检设备模块
|
||||||
|
export namespace Monitor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqPqMonParams extends ReqPage{
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
devType?: string; // 设备名称
|
||||||
|
createTime?:string; //创建时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResPqMon {
|
||||||
|
id: string; //监测点ID
|
||||||
|
code: string; //默认与谐波系统监测点ID相同
|
||||||
|
devId: string; //所属设备ID
|
||||||
|
name: string; //所属母线
|
||||||
|
num: number; //监测点序号
|
||||||
|
pt: number; //PT变比
|
||||||
|
ct: number; //CT变比
|
||||||
|
ptType:string; //接线方式,字典表
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检设备表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResPqMonPage extends ResPage<ResPqMon> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
38
frontend/src/api/device/interface/testScript.ts
Normal file
38
frontend/src/api/device/interface/testScript.ts
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 检测脚本模块
|
||||||
|
export namespace TestScript {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqTestScriptParams extends ReqPage{
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
name: string;
|
||||||
|
type: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测脚本接口
|
||||||
|
export interface ResTestScript {
|
||||||
|
id?: string; //检测脚本ID
|
||||||
|
name: string; //检测脚本名称
|
||||||
|
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
||||||
|
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||||
|
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
|
standardName: string;//参照标准名称
|
||||||
|
standardTime: string;//标准推行时间
|
||||||
|
state:number;//
|
||||||
|
createBy?: string;
|
||||||
|
createTime?: string;
|
||||||
|
updateBy?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResTestScriptPage extends ResPage<ResTestScript> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
44
frontend/src/api/device/interface/testSource.ts
Normal file
44
frontend/src/api/device/interface/testSource.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
// 检测源模块
|
||||||
|
export namespace TestSource {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqTestSourceParams extends ReqPage{
|
||||||
|
id: string; // 装置序号id 必填
|
||||||
|
name: string;
|
||||||
|
pattern: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测源接口
|
||||||
|
export interface ResTestSource {
|
||||||
|
id: string; //检测源ID
|
||||||
|
name: string; //检测源名称(检测源类型 + 设备类型 + 数字自动生成)
|
||||||
|
pattern: string;//检测源模式(字典表Code字段,数字、模拟、比对)
|
||||||
|
type: string; //检测源类型(字典表Code字段,标准源、高精度设备)
|
||||||
|
devType: string;//检测源设备类型(字典表Code字段)
|
||||||
|
parameter?: string;//源参数(JSON字符串)
|
||||||
|
state:number;//
|
||||||
|
createBy?: string;
|
||||||
|
createTime?: string;
|
||||||
|
updateBy?: string;
|
||||||
|
updateTime?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 检测脚本查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResTestSourcePage extends ResPage<ResTestSource> {
|
||||||
|
|
||||||
|
}
|
||||||
|
export interface ParameterType{
|
||||||
|
id:string;
|
||||||
|
sourceParamType:string;
|
||||||
|
sourceParamDesc:string;
|
||||||
|
sourceParamValue:string;
|
||||||
|
sort:number;
|
||||||
|
pId:string;
|
||||||
|
children?:ParameterType[];
|
||||||
|
}
|
||||||
|
}
|
||||||
28
frontend/src/api/device/monitor/index.ts
Normal file
28
frontend/src/api/device/monitor/index.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import type { Monitor } from '@/api/device/interface/monitor'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 监测点管理模块
|
||||||
|
*/
|
||||||
|
|
||||||
|
//获取监测点
|
||||||
|
export const getPqMonList = (params: Monitor.ReqPqMonParams) => {
|
||||||
|
//return http.post(`/pqMon/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加监测点
|
||||||
|
export const addPqMon = (params: Monitor.ResPqMon) => {
|
||||||
|
//return http.post(`/pqMon/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑监测点
|
||||||
|
export const updatePqMon = (params: Monitor.ResPqMon) => {
|
||||||
|
//return http.post(`/pqMon/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除监测点
|
||||||
|
export const deletePqMon = (params: string[]) => {
|
||||||
|
//return http.post(`/pqMon/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
21
frontend/src/api/device/testScript/index.ts
Normal file
21
frontend/src/api/device/testScript/index.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import type { TestScript } from '@/api/device/interface/testScript'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测脚本管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测脚本列表
|
||||||
|
export const getPqScriptList = (params: TestScript.ReqTestScriptParams) => {
|
||||||
|
return http.post(`/pqScript/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//升级为模版
|
||||||
|
export const updatePqScript = (params: TestScript.ResTestScript) => {
|
||||||
|
return http.get(`/pqScript/upgradeToTemplate?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除检测脚本
|
||||||
|
export const deletePqScript = (params: string[]) => {
|
||||||
|
return http.post(`/pqScript/delete`, params)
|
||||||
|
}
|
||||||
31
frontend/src/api/device/testSource/index.ts
Normal file
31
frontend/src/api/device/testSource/index.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import type { ResPage } from '@/api/interface'
|
||||||
|
import type { TestSource } from '@/api/device/interface/testSource'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测源管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测源列表
|
||||||
|
export const getTestSourceList = (params: TestSource.ReqTestSourceParams) => {
|
||||||
|
return http.post(`/pqSource/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据id查询检测源
|
||||||
|
export const getTestSourceById = (params: TestSource.ResTestSource) => {
|
||||||
|
return http.get(`/pqSource/getById?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加检测源
|
||||||
|
export const addTestSource = (params: TestSource.ResTestSource) => {
|
||||||
|
return http.post(`/pqSource/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑检测源
|
||||||
|
export const updateTestSource = (params: TestSource.ResTestSource) => {
|
||||||
|
return http.post(`/pqSource/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除检测源
|
||||||
|
export const deleteTestSource = (params: string[]) => {
|
||||||
|
return http.post(`/pqSource/delete`, params)
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
// 误差体系模块
|
|
||||||
export namespace ErrorSystem {
|
|
||||||
// 误差体系列表
|
|
||||||
export interface ErrorSystemList {
|
|
||||||
id: string;//误差体系表Id
|
|
||||||
name: string;//误差体系名称
|
|
||||||
standard_Name:string;//参照标准名称
|
|
||||||
standard_Time:string;//标准推行时间
|
|
||||||
dev_Level:string;//使用设备等级
|
|
||||||
enable?:number;//状态:0-不启用 1-启用
|
|
||||||
state:number;//0-删除 1-正常
|
|
||||||
create_By?:string;//创建用户
|
|
||||||
create_Time?:string;//创建时间
|
|
||||||
update_By?:string;//修改用户
|
|
||||||
update_Time?:string;//修改时间
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 查看详细误差体系
|
|
||||||
export interface ErrorSystemDetail {
|
|
||||||
id:string;//误差体系子表ID
|
|
||||||
error_Sys_Id:string;//所属误差体系ID
|
|
||||||
type: string;//检测脚本类型,树形字典表(没有树形表则需要拆分字段)
|
|
||||||
JudgeConditionStart?:number;//误差判断起始值(误差范围)
|
|
||||||
IsContainStart?:number;//是否包含起始值
|
|
||||||
JudgeConditionEnd?:number;//误差判断结束值(误差范围)
|
|
||||||
IsContainEnd?:number;//是否包含结束值
|
|
||||||
JudgeConditionType?:string;//判断条件值类型(包括值类型,绝对值、相对值)
|
|
||||||
MaxErrorValue:number;//误差最大值
|
|
||||||
ErrorValueType:string;//误差值类型(包括值类型,绝对值、相对值1、相对值2)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查看详细误差体系
|
|
||||||
export interface Error_detail {
|
|
||||||
measured: string;
|
|
||||||
deviceLevel: string;
|
|
||||||
measurementType:string;
|
|
||||||
condition: string;
|
|
||||||
maxErrorValue: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,265 +0,0 @@
|
|||||||
import type { Function } from "./interface"
|
|
||||||
|
|
||||||
export const functionList : Function.ResFunction[] = [
|
|
||||||
{
|
|
||||||
'id': '1',
|
|
||||||
'pid':'0',
|
|
||||||
'pids':'',
|
|
||||||
'name': '检测计划',
|
|
||||||
'code':'route',
|
|
||||||
'path':'/plan/planList/index',
|
|
||||||
'icon':'',
|
|
||||||
'sort':100,
|
|
||||||
'type':0,
|
|
||||||
'remark': '检测计划描述',
|
|
||||||
'state':1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '台账管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/machine',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '台账管理描述',
|
|
||||||
state:1,
|
|
||||||
children:[{
|
|
||||||
id: '21',
|
|
||||||
pid:'11',
|
|
||||||
pids:'',
|
|
||||||
name: '检测脚本',
|
|
||||||
code:'route',
|
|
||||||
path:'/machine/testScript/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:1,
|
|
||||||
remark: '检测脚本描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '22',
|
|
||||||
pid:'22',
|
|
||||||
pids:'',
|
|
||||||
name: '被检设备',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:1,
|
|
||||||
remark: '被检设备描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '23',
|
|
||||||
pid:'23',
|
|
||||||
pids:'',
|
|
||||||
name: '误差体系',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:1,
|
|
||||||
remark: '误差体系描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '24',
|
|
||||||
pid:'24',
|
|
||||||
pids:'',
|
|
||||||
name: '检测源',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:1,
|
|
||||||
remark: '检测源描述',
|
|
||||||
state:1,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '权限管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '权限管理描述',
|
|
||||||
state:1,
|
|
||||||
children:[{
|
|
||||||
id: '31',
|
|
||||||
pid:'1',
|
|
||||||
pids:'',
|
|
||||||
name: '用户管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '用户管理描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '32',
|
|
||||||
pid:'2',
|
|
||||||
pids:'',
|
|
||||||
name: '角色管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '角色管理描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '33',
|
|
||||||
pid:'3',
|
|
||||||
pids:'',
|
|
||||||
name: '菜单管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '菜单管理描述',
|
|
||||||
state:1,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '系统配置',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '系统配置描述',
|
|
||||||
state:1,
|
|
||||||
children:[{
|
|
||||||
id: '41',
|
|
||||||
pid:'1',
|
|
||||||
pids:'',
|
|
||||||
name: '通用配置',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '通用配置描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '42',
|
|
||||||
pid:'2',
|
|
||||||
pids:'',
|
|
||||||
name: '数据字典',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '数据字典描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '43',
|
|
||||||
pid:'3',
|
|
||||||
pids:'',
|
|
||||||
name: '报告模版',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '报告模版描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '44',
|
|
||||||
pid:'4',
|
|
||||||
pids:'',
|
|
||||||
name: '版本注册',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '版本注册描述',
|
|
||||||
state:1,
|
|
||||||
},]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '5',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '日志管理',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '日志管理描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '6',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '统计分析',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '统计分析描述',
|
|
||||||
state:1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '7',
|
|
||||||
pid:'0',
|
|
||||||
pids:'',
|
|
||||||
name: '示例',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '示例描述',
|
|
||||||
state:0,
|
|
||||||
children:[{
|
|
||||||
id: '71',
|
|
||||||
pid:'1',
|
|
||||||
pids:'',
|
|
||||||
name: '普通表格',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '普通表格描述',
|
|
||||||
state:0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '71',
|
|
||||||
pid:'1',
|
|
||||||
pids:'',
|
|
||||||
name: '表格树',
|
|
||||||
code:'route',
|
|
||||||
path:'/plan/planList/index',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '表格树描述',
|
|
||||||
state:0,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import http from "@/api";
|
|
||||||
import { ADMIN as rePrefix } from "@/api/config/serviceName";
|
|
||||||
import type { Function } from "@/api/function/interface";
|
|
||||||
|
|
||||||
//获取菜单列表
|
|
||||||
export const getFunctionList = (params: Function.ReqFunctionParams) => {
|
|
||||||
return http.post(`${rePrefix}/function/list`, params);
|
|
||||||
};
|
|
||||||
|
|
||||||
//添加菜单列表
|
|
||||||
export const addFunction = (params: Function.ReqFunctionParams) => {
|
|
||||||
return http.post(`${rePrefix}/function/add`,params);
|
|
||||||
};
|
|
||||||
|
|
||||||
//删除菜单列表
|
|
||||||
export const deleteFunction = (params: { id: string[] }) => {
|
|
||||||
return http.post(`${rePrefix}/function/delete`, { data: params });
|
|
||||||
};
|
|
||||||
|
|
||||||
//编辑菜单列表
|
|
||||||
export const updateFunction = (params: Function.ReqFunctionParams) => {
|
|
||||||
return http.post(`${rePrefix}/function/update`, params);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
import axios, { AxiosInstance, AxiosError, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from 'axios'
|
||||||
import { showFullScreenLoading, tryHideFullScreenLoading } from "@/components/Loading/fullScreen";
|
import { showFullScreenLoading, tryHideFullScreenLoading } from '@/components/Loading/fullScreen'
|
||||||
import { LOGIN_URL } from "@/config";
|
import { LOGIN_URL } from '@/config'
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from 'element-plus'
|
||||||
import { ResultData } from "@/api/interface";
|
import { ResultData } from '@/api/interface'
|
||||||
import { ResultEnum } from "@/enums/httpEnum";
|
import { ResultEnum } from '@/enums/httpEnum'
|
||||||
import { checkStatus } from "./helper/checkStatus";
|
import { checkStatus } from './helper/checkStatus'
|
||||||
import { useUserStore } from "@/stores/modules/user";
|
import { useUserStore } from '@/stores/modules/user'
|
||||||
import router from "@/routers";
|
import router from '@/routers'
|
||||||
|
|
||||||
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
@@ -20,14 +20,15 @@ const config = {
|
|||||||
// 跨域时候允许携带凭证
|
// 跨域时候允许携带凭证
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
// post请求指定数据类型以及编码
|
// post请求指定数据类型以及编码
|
||||||
headers: { 'Content-Type': 'application/json;charset=utf-8' }
|
headers: { 'Content-Type': 'application/json;charset=utf-8' },
|
||||||
};
|
}
|
||||||
|
|
||||||
class RequestHttp {
|
class RequestHttp {
|
||||||
service: AxiosInstance;
|
service: AxiosInstance
|
||||||
|
|
||||||
public constructor(config: AxiosRequestConfig) {
|
public constructor(config: AxiosRequestConfig) {
|
||||||
// 创建实例
|
// 创建实例
|
||||||
this.service = axios.create(config);
|
this.service = axios.create(config)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 请求拦截器
|
* @description 请求拦截器
|
||||||
@@ -36,19 +37,19 @@ class RequestHttp {
|
|||||||
*/
|
*/
|
||||||
this.service.interceptors.request.use(
|
this.service.interceptors.request.use(
|
||||||
(config: CustomAxiosRequestConfig) => {
|
(config: CustomAxiosRequestConfig) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore()
|
||||||
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
// 当前请求不需要显示 loading,在 api 服务中通过指定的第三个参数: { loading: false } 来控制
|
||||||
config.loading ?? (config.loading = true);
|
config.loading ?? (config.loading = true)
|
||||||
config.loading && showFullScreenLoading();
|
config.loading && showFullScreenLoading()
|
||||||
if (config.headers && typeof config.headers.set === "function") {
|
if (config.headers && typeof config.headers.set === 'function') {
|
||||||
config.headers.set("x-access-token", userStore.token);
|
config.headers.set('Authorization', 'Bearer '+userStore.token)
|
||||||
}
|
}
|
||||||
return config;
|
return config
|
||||||
},
|
},
|
||||||
(error: AxiosError) => {
|
(error: AxiosError) => {
|
||||||
return Promise.reject(error);
|
return Promise.reject(error)
|
||||||
}
|
},
|
||||||
);
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 响应拦截器
|
* @description 响应拦截器
|
||||||
@@ -56,57 +57,67 @@ class RequestHttp {
|
|||||||
*/
|
*/
|
||||||
this.service.interceptors.response.use(
|
this.service.interceptors.response.use(
|
||||||
(response: AxiosResponse) => {
|
(response: AxiosResponse) => {
|
||||||
const { data } = response;
|
const { data } = response
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore()
|
||||||
tryHideFullScreenLoading();
|
tryHideFullScreenLoading()
|
||||||
// 登陆失效
|
// 登陆失效
|
||||||
if (data.code == ResultEnum.OVERDUE) {
|
if (data.code == ResultEnum.OVERDUE) {
|
||||||
userStore.setToken("");
|
userStore.setToken('')
|
||||||
router.replace(LOGIN_URL);
|
userStore.setUserInfo({name: ''})
|
||||||
ElMessage.error(data.message);
|
router.replace(LOGIN_URL)
|
||||||
return Promise.reject(data);
|
ElMessage.error(data.message)
|
||||||
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||||
ElMessage.error(data.message);
|
ElMessage.error(data.message)
|
||||||
return Promise.reject(data);
|
return Promise.reject(data)
|
||||||
}
|
}
|
||||||
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
|
||||||
return data;
|
return data
|
||||||
},
|
},
|
||||||
async (error: AxiosError) => {
|
async (error: AxiosError) => {
|
||||||
const { response } = error;
|
const { response } = error
|
||||||
tryHideFullScreenLoading();
|
tryHideFullScreenLoading()
|
||||||
// 请求超时 && 网络错误单独判断,没有 response
|
// 请求超时 && 网络错误单独判断,没有 response
|
||||||
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
if (error.message.indexOf('timeout') !== -1) ElMessage.error('请求超时!请您稍后重试')
|
||||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
if (error.message.indexOf('Network Error') !== -1) ElMessage.error('网络错误!请您稍后重试')
|
||||||
// 根据服务器响应的错误状态码,做不同的处理
|
// 根据服务器响应的错误状态码,做不同的处理
|
||||||
if (response) checkStatus(response.status);
|
if (response) checkStatus(response.status)
|
||||||
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
// 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
|
||||||
if (!window.navigator.onLine) router.replace("/500");
|
if (!window.navigator.onLine) router.replace('/500')
|
||||||
return Promise.reject(error);
|
return Promise.reject(error)
|
||||||
}
|
},
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 常用请求方法封装
|
* @description 常用请求方法封装
|
||||||
*/
|
*/
|
||||||
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
get<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||||
return this.service.get(url, { params, ..._object });
|
return this.service.get(url, { params, ..._object })
|
||||||
}
|
}
|
||||||
|
|
||||||
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
post<T>(url: string, params?: object | string, _object = {}): Promise<ResultData<T>> {
|
||||||
return this.service.post(url, params, _object);
|
return this.service.post(url, params, _object)
|
||||||
}
|
}
|
||||||
|
|
||||||
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
put<T>(url: string, params?: object, _object = {}): Promise<ResultData<T>> {
|
||||||
return this.service.put(url, params, _object);
|
return this.service.put(url, params, _object)
|
||||||
}
|
}
|
||||||
|
|
||||||
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
|
||||||
return this.service.delete(url, { params, ..._object });
|
return this.service.delete(url, { params, ..._object })
|
||||||
}
|
}
|
||||||
|
|
||||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
return this.service.post(url, params, { ..._object, responseType: 'blob' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upload(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
|
return this.service.post(url, params, { ..._object, headers: { 'Content-Type': 'multipart/form-data' } })
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new RequestHttp(config);
|
export default new RequestHttp(config)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { storeToRefs } from 'pinia';
|
||||||
/**
|
/**
|
||||||
* 该接口声明文件用来声明通用的接口定义,比如 请求参数Base、响应Base、分页等
|
* 该接口声明文件用来声明通用的接口定义,比如 请求参数Base、响应Base、分页等
|
||||||
*/
|
*/
|
||||||
@@ -44,8 +45,11 @@ export interface ResPage<T> {
|
|||||||
*/
|
*/
|
||||||
export interface Dict {
|
export interface Dict {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
name: string;
|
||||||
code: string;
|
code: string;
|
||||||
|
value?: string;
|
||||||
|
sort?:number;
|
||||||
|
algoDescribe?: string;
|
||||||
children?: Dict[];
|
children?: Dict[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"code": "A0000",
|
"code": "A0000",
|
||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
"id": 0,
|
"id": "0",
|
||||||
"name": "频率准备度检测",
|
"name": "频率准确度检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"pid": 0,
|
"pid": 0,
|
||||||
@@ -11,16 +11,22 @@
|
|||||||
"name": "额定工作条件下的检测",
|
"name": "额定工作条件下的检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":1,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-1",
|
"pid": "0-1",
|
||||||
"id": "0-1-1",
|
"id": "0-1-1",
|
||||||
"name": "输入:频率 42.5Hz..."
|
"name": "输入:频率 42.5Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":2,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-1",
|
"pid": "0-1",
|
||||||
"id": "0-1-2",
|
"id": "0-1-2",
|
||||||
"name": "输入:频率 50.0Hz..."
|
"name": "输入:频率 50.0Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":3,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-1",
|
"pid": "0-1",
|
||||||
"id": "0-1-3",
|
"id": "0-1-3",
|
||||||
"name": "输入:频率 50.05Hz..."
|
"name": "输入:频率 50.05Hz..."
|
||||||
@@ -33,16 +39,22 @@
|
|||||||
"name": "电压对频率测量的影响",
|
"name": "电压对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":4,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-2",
|
"pid": "0-2",
|
||||||
"id": "0-2-1",
|
"id": "0-2-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":5,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-2",
|
"pid": "0-2",
|
||||||
"id": "0-2-1",
|
"id": "0-2-1",
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":6,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-2",
|
"pid": "0-2",
|
||||||
"id": "0-2-2",
|
"id": "0-2-2",
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
@@ -55,6 +67,8 @@
|
|||||||
"name": "谐波对频率测量的影响",
|
"name": "谐波对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":7,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-3",
|
"pid": "0-3",
|
||||||
"id": "0-3-1",
|
"id": "0-3-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
@@ -64,7 +78,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": "1",
|
||||||
"name": "电压准确度检测",
|
"name": "电压准确度检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
@@ -73,16 +87,22 @@
|
|||||||
"name": "额定工作条件下的检测",
|
"name": "额定工作条件下的检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":8,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-1",
|
"pid": "1-1",
|
||||||
"id": "1-1-1",
|
"id": "1-1-1",
|
||||||
"name": "输入:频率 42.5Hz..."
|
"name": "输入:频率 42.5Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":9,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-1",
|
"pid": "1-1",
|
||||||
"id": "1-1-2",
|
"id": "1-1-2",
|
||||||
"name": "输入:频率 50.0Hz..."
|
"name": "输入:频率 50.0Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":10,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-1",
|
"pid": "1-1",
|
||||||
"id": "1-1-3",
|
"id": "1-1-3",
|
||||||
"name": "输入:频率 50.05Hz..."
|
"name": "输入:频率 50.05Hz..."
|
||||||
@@ -95,16 +115,22 @@
|
|||||||
"name": "电压对频率测量的影响",
|
"name": "电压对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":11,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-2",
|
"pid": "1-2",
|
||||||
"id": "1-2-1",
|
"id": "1-2-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":12,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-2",
|
"pid": "1-2",
|
||||||
"id": "1-2-1",
|
"id": "1-2-1",
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":13,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "1-2",
|
"pid": "1-2",
|
||||||
"id": "1-2-2",
|
"id": "1-2-2",
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
@@ -117,6 +143,8 @@
|
|||||||
"name": "谐波对频率测量的影响",
|
"name": "谐波对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":14,
|
||||||
|
"isChildNode":true,
|
||||||
"pid": "0-3",
|
"pid": "0-3",
|
||||||
"id": "0-3-1",
|
"id": "0-3-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
@@ -127,7 +155,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": "2",
|
||||||
"name": "谐波准确度检测",
|
"name": "谐波准确度检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
@@ -136,16 +164,19 @@
|
|||||||
"name": "额定工作条件下的检测",
|
"name": "额定工作条件下的检测",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":15,
|
||||||
"pid": "2-1",
|
"pid": "2-1",
|
||||||
"id": "2-1-1",
|
"id": "2-1-1",
|
||||||
"name": "输入:频率 42.5Hz..."
|
"name": "输入:频率 42.5Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":16,
|
||||||
"pid": "2-1",
|
"pid": "2-1",
|
||||||
"id": "2-1-2",
|
"id": "2-1-2",
|
||||||
"name": "输入:频率 50.0Hz..."
|
"name": "输入:频率 50.0Hz..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":17,
|
||||||
"pid": "2-1",
|
"pid": "2-1",
|
||||||
"id": "2-1-3",
|
"id": "2-1-3",
|
||||||
"name": "输入:频率 50.05Hz..."
|
"name": "输入:频率 50.05Hz..."
|
||||||
@@ -158,16 +189,19 @@
|
|||||||
"name": "电压对频率测量的影响",
|
"name": "电压对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":18,
|
||||||
"pid": "2-2",
|
"pid": "2-2",
|
||||||
"id": "2-2-1",
|
"id": "2-2-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
"name": "输入:频率 50.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":19,
|
||||||
"pid": "2-2",
|
"pid": "2-2",
|
||||||
"id": "2-2-1",
|
"id": "2-2-1",
|
||||||
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
"name": "输入:频率 51.05Hz Ua =10%Un..."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"scriptIdx":20,
|
||||||
"pid": "2-2",
|
"pid": "2-2",
|
||||||
"id": "2-2-2",
|
"id": "2-2-2",
|
||||||
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
"name": "输入:频率 52.05Hz Ua =10%Un..."
|
||||||
@@ -180,6 +214,7 @@
|
|||||||
"name": "谐波对频率测量的影响",
|
"name": "谐波对频率测量的影响",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
"scriptIdx":21,
|
||||||
"pid": "2-3",
|
"pid": "2-3",
|
||||||
"id": "2-3-1",
|
"id": "2-3-1",
|
||||||
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
"name": "输入:频率 50.05Hz Ua =100%Un..."
|
||||||
@@ -189,4 +224,4 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -4,41 +4,69 @@ import type { DatetimeFormatProps } from 'vue-i18n';
|
|||||||
// 检测计划模块
|
// 检测计划模块
|
||||||
export namespace Plan {
|
export namespace Plan {
|
||||||
|
|
||||||
// 检测计划列表
|
// 检测计划接口
|
||||||
export interface PlanList {
|
export interface PlanBO {
|
||||||
id: string; //检测计划ID
|
id?: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id: string; //父计划ID
|
father_Plan_Id?: string; //父计划ID
|
||||||
dataSource_Id: string; //数据源ID
|
dataSource_Id: string[]; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
script_Id: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
error_Sys_Id: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
test_State: string; //检测状态
|
||||||
report_State: string; //报告生成状态
|
report_State: string; //报告生成状态
|
||||||
result: string;//检测结果
|
result: string;//检测结果
|
||||||
state: number; //状态
|
|
||||||
create_By?: string; //创建用户
|
|
||||||
create_Time?: string;//创建时间
|
create_Time?: string;//创建时间
|
||||||
update_By?: string; //更新用户
|
|
||||||
update_Time?: string; //更新时间
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检测计划 + 分页
|
||||||
|
export interface ReqPlanParams extends ReqPage,PlanBO {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测计划 + 检测源
|
||||||
|
export interface PlanAndSourceBO extends PlanBO {
|
||||||
|
testSourceName: string;//计划所属检测源
|
||||||
|
source_Id: string[];
|
||||||
|
device_Id?: string[];
|
||||||
|
testSourceList?: string[];//临时测试
|
||||||
|
dataSource_Ids:string;
|
||||||
|
}
|
||||||
|
// // 检测计划列表
|
||||||
|
// export interface PlanList {
|
||||||
|
// id: string; //检测计划ID
|
||||||
|
// name: string; //检测计划名称
|
||||||
|
// pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
|
// father_Plan_Id: string; //父计划ID
|
||||||
|
// dataSource_Id: string; //数据源ID
|
||||||
|
// script_Id: string; //检测脚本ID
|
||||||
|
// error_Sys_Id: string;//误差体系ID
|
||||||
|
// test_State: string; //检测状态
|
||||||
|
// report_State: string; //报告生成状态
|
||||||
|
// result: string;//检测结果
|
||||||
|
// state: number; //状态
|
||||||
|
// create_By?: string; //创建用户
|
||||||
|
// create_Time?: string;//创建时间
|
||||||
|
// update_By?: string; //更新用户
|
||||||
|
// update_Time?: string; //更新时间
|
||||||
|
// }
|
||||||
|
|
||||||
// 被检设备参数
|
// // 被检设备参数
|
||||||
export interface ReqPlanParams extends ReqPage {
|
// export interface ReqPlanParams extends ReqPage {
|
||||||
id: string; //检测计划ID
|
// id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
// name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
// pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id: string; //父计划ID
|
// father_Plan_Id: string; //父计划ID
|
||||||
dataSource_Id: string; //数据源ID
|
// dataSource_Id: string; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
// script_Id: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
// error_Sys_Id: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
// test_State: string; //检测状态
|
||||||
report_State: string; //报告生成状态
|
// report_State: string; //报告生成状态
|
||||||
result: string;//检测结果
|
// result: string;//检测结果
|
||||||
state: number; //状态
|
// state: number; //状态
|
||||||
create_By?: string; //创建用户
|
// create_By?: string; //创建用户
|
||||||
create_Time?: string;//创建时间
|
// create_Time?: string;//创建时间
|
||||||
update_By?: string; //更新用户
|
// update_By?: string; //更新用户
|
||||||
update_Time?: string; //更新时间
|
// update_Time?: string; //更新时间
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
27
frontend/src/api/plan/plan.ts
Normal file
27
frontend/src/api/plan/plan.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { ResPage } from '@/api/interface'
|
||||||
|
import { Plan } from './interface'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测计划管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测计划列表
|
||||||
|
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
||||||
|
return http.post<ResPage<Plan.PlanBO>>(`/plan/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增检测计划
|
||||||
|
export const addPlan = (params: Plan.PlanBO) => {
|
||||||
|
return http.post(`/role/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑检测计划
|
||||||
|
export const editPlan = (params: Plan.PlanBO) => {
|
||||||
|
return http.post(`/role/edit`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除检测计划
|
||||||
|
export const deletePlan = (params: { id: string[] }) => {
|
||||||
|
return http.post(`/role/del`, params)
|
||||||
|
}
|
||||||
@@ -1,125 +1,451 @@
|
|||||||
import type {Plan} from "./interface"
|
import type {Plan} from "./interface"
|
||||||
|
|
||||||
const plandata = ref<Plan.PlanList[]>([
|
/**
|
||||||
{
|
* Dict 字典属性
|
||||||
'id': '1',
|
* id: 唯一标识
|
||||||
'name': '检测计划1',
|
* label: 名称
|
||||||
'pattern':'模拟式',
|
*/
|
||||||
'father_Plan_Id':'/',
|
interface Dict {
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
id: string;
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
label: string;
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
}
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '2',
|
|
||||||
'name': '检测子计划1-1',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'检测计划1',
|
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '3',
|
|
||||||
'name': '检测子计划1-2',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'检测计划1',
|
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '4',
|
|
||||||
'name': '检测计划2',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据最小值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 10650.2 - 2021',
|
|
||||||
'test_State':'检测完成',
|
|
||||||
'report_State':'部分生成',
|
|
||||||
'result':'不符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '5',
|
|
||||||
'name': '检测计划3',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
|
||||||
'script_Id':'/',
|
|
||||||
'error_Sys_Id':'/',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '6',
|
|
||||||
'name': '检测子计划4',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据CP95值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '7',
|
|
||||||
'name': '检测子计划4-1',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'检测计划4',
|
|
||||||
'dataSource_Id':'分钟统计数据CP95值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
export default plandata
|
const dictPattern: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '数字',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '模拟',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '比对',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictTestState: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '未检',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '检测中',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '检测完成',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictReportState: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '未生成',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '部分生成',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '全部生成',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictResult: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '符合',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '不符合',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部检测计划名称与ID
|
||||||
|
const testPlanDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '模拟检测计划1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '模拟检测计划2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '模拟检测计划3',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部数据源名称与ID
|
||||||
|
const testSoureDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '实时数据',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '分钟统计数据最大值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '分钟统计数据最小值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: '分钟统计数据平均值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '分钟统计数据CP95值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "6",
|
||||||
|
label: '录波数据',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部检测脚本名称与ID
|
||||||
|
const testScriptDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '国网入网检测脚本(Q/GDW 10650.4 - 2021) 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '国网入网检测脚本(Q/GDW 1650.4 - 2016) 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: 'GBT 19862 - 2016 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '北京比对检测脚本',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部误差体系名称与ID
|
||||||
|
const testErrSystDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: 'Q/GDW 1650.2- 2016',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: 'Q/GDW 10650.2 - 2021',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: 'GBT 19862 - 2016',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//父计划ID及名称
|
||||||
|
const testFatherPlanList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '检测计划1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '检测子计划2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '检测子计划1-2',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//检测源ID及名称
|
||||||
|
const sourceDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '标准源-福禄克-6100A',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '标准源-昂立-PF2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '标准源-丹迪克-DKLN1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: '标准源-博电源-PQC600A',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '高精度设备-PQV520-1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "6",
|
||||||
|
label: '高精度设备-PQV520-2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "7",
|
||||||
|
label: '高精度设备-PQV520-3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "8",
|
||||||
|
label: '高精度设备-PQV520-4',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//被检设备ID及名称
|
||||||
|
const deviceDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '模拟装置1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '模拟装置2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '模拟装置3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: '模拟装置4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '中电送检装置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "6",
|
||||||
|
label: '易司拓测试装置',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "7",
|
||||||
|
label: '山大电力测试装置1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "8",
|
||||||
|
label: '山大电力测试装置2',
|
||||||
|
},
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
const planData = ref<Plan.PlanAndSourceBO[]>([
|
||||||
|
{
|
||||||
|
'id': '1',
|
||||||
|
'name': '检测计划1',
|
||||||
|
'pattern':'1',
|
||||||
|
"source_Id" : ['1'],
|
||||||
|
"testSourceName":'标准源-福禄克-6100A',
|
||||||
|
'dataSource_Id':['1'],
|
||||||
|
'dataSource_Ids':'实时数据',
|
||||||
|
'script_Id':'1',
|
||||||
|
'error_Sys_Id':'1',
|
||||||
|
'test_State':'1',
|
||||||
|
'report_State':'1',
|
||||||
|
'result':'1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': '2',
|
||||||
|
'name': '检测计划2',
|
||||||
|
'pattern':'1',
|
||||||
|
"source_Id" : ['5','6','7','8'],
|
||||||
|
"testSourceName":'高精度设备-PQV520-1',
|
||||||
|
'father_Plan_Id':'1',
|
||||||
|
'dataSource_Id':['5'],
|
||||||
|
'dataSource_Ids':'分钟统计数据CP95值',
|
||||||
|
'script_Id':'2',
|
||||||
|
'error_Sys_Id':'2',
|
||||||
|
'test_State':'2',
|
||||||
|
'report_State':'2',
|
||||||
|
'result':'0',
|
||||||
|
"testSourceList":[
|
||||||
|
'高精度设备-PQV520-2','高精度设备-PQV520-3','高精度设备-PQV520-4'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'id': '3',
|
||||||
|
'name': '检测子计划3',
|
||||||
|
'pattern':'1',
|
||||||
|
"source_Id" : ['3'],
|
||||||
|
"testSourceName":'标准源-丹迪克-DKLN1',
|
||||||
|
'father_Plan_Id':'1',
|
||||||
|
'dataSource_Id':['1'],
|
||||||
|
'dataSource_Ids':'实时数据',
|
||||||
|
'script_Id':'3',
|
||||||
|
'error_Sys_Id':'3',
|
||||||
|
'test_State':'1',
|
||||||
|
'report_State':'1',
|
||||||
|
'result':'1',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
// const planData = ref<Plan.PlanBO[]>([
|
||||||
|
// {
|
||||||
|
// 'id': '1',
|
||||||
|
// 'name': '检测计划1',
|
||||||
|
// 'pattern':'1',
|
||||||
|
// 'dataSource_Id':'1',
|
||||||
|
// 'script_Id':'1',
|
||||||
|
// 'error_Sys_Id':'1',
|
||||||
|
// 'test_State':'1',
|
||||||
|
// 'report_State':'1',
|
||||||
|
// 'result':'1',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '2',
|
||||||
|
// 'name': '检测子计划2',
|
||||||
|
// 'pattern':'1',
|
||||||
|
// 'father_Plan_Id':'1',
|
||||||
|
// 'dataSource_Id':'2',
|
||||||
|
// 'script_Id':'2',
|
||||||
|
// 'error_Sys_Id':'2',
|
||||||
|
// 'test_State':'2',
|
||||||
|
// 'report_State':'2',
|
||||||
|
// 'result':'0',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '3',
|
||||||
|
// 'name': '检测子计划1-2',
|
||||||
|
// 'pattern':'1',
|
||||||
|
// 'father_Plan_Id':'1',
|
||||||
|
// 'dataSource_Id':'3',
|
||||||
|
// 'script_Id':'3',
|
||||||
|
// 'error_Sys_Id':'3',
|
||||||
|
// 'test_State':'1',
|
||||||
|
// 'report_State':'1',
|
||||||
|
// 'result':'1',
|
||||||
|
// },
|
||||||
|
// ])
|
||||||
|
|
||||||
|
// const plandata = ref<Plan.PlanList[]>([
|
||||||
|
// {
|
||||||
|
// 'id': '1',
|
||||||
|
// 'name': '检测计划1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '2',
|
||||||
|
// 'name': '检测子计划1-1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划1',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '3',
|
||||||
|
// 'name': '检测子计划1-2',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划1',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '4',
|
||||||
|
// 'name': '检测计划2',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最小值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 10650.2 - 2021',
|
||||||
|
// 'test_State':'检测完成',
|
||||||
|
// 'report_State':'部分生成',
|
||||||
|
// 'result':'不符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '5',
|
||||||
|
// 'name': '检测计划3',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'/',
|
||||||
|
// 'error_Sys_Id':'/',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '6',
|
||||||
|
// 'name': '检测子计划4',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据CP95值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '7',
|
||||||
|
// 'name': '检测子计划4-1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划4',
|
||||||
|
// 'dataSource_Id':'分钟统计数据CP95值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// ])
|
||||||
|
|
||||||
|
export {planData,dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,sourceDataList,deviceDataList,testSoureDataList,testScriptDataList,testErrSystDataList,testFatherPlanList}
|
||||||
@@ -2,6 +2,7 @@ import http from "@/api";
|
|||||||
|
|
||||||
//获取计划列表
|
//获取计划列表
|
||||||
export const getPlanList = (data: any) => {
|
export const getPlanList = (data: any) => {
|
||||||
|
return null;
|
||||||
return http.post<Static.planData>(
|
return http.post<Static.planData>(
|
||||||
"http://192.168.1.123:4523/m1/2573730-0-default/plan/planList/list",
|
"http://192.168.1.123:4523/m1/2573730-0-default/plan/planList/list",
|
||||||
data,
|
data,
|
||||||
|
|||||||
@@ -7,17 +7,17 @@
|
|||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"pid": 1,
|
"pid": 1,
|
||||||
"name": "检测计划1"
|
"name": "邯郸220kV团城站等4座站电能质量检测"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"pid": 1,
|
"pid": 1,
|
||||||
"name": "检测计划2"
|
"name": "衡水冀州光伏电站配套出口工程"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 6,
|
"id": 6,
|
||||||
"pid": 1,
|
"pid": 1,
|
||||||
"name": "检测计划3"
|
"name": "深圳市中电软件有限公司委托送检"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 1
|
"id": 1
|
||||||
@@ -28,17 +28,17 @@
|
|||||||
{
|
{
|
||||||
"id": 7,
|
"id": 7,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "检测计划4"
|
"name": "沧州220kV留古等4座变电站电能质量检测"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "检测计划5"
|
"name": "沧州供电公司110kV东光站等10台装置送检"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 9,
|
"id": 9,
|
||||||
"pid": 2,
|
"pid": 2,
|
||||||
"name": "检测计划6"
|
"name": "保定分布式光伏电能质量监测试点"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 2
|
"id": 2
|
||||||
@@ -49,12 +49,12 @@
|
|||||||
{
|
{
|
||||||
"id": 10,
|
"id": 10,
|
||||||
"pid": 3,
|
"pid": 3,
|
||||||
"name": "检测计划7"
|
"name": "邯郸2台安徽振兴终端送检"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 11,
|
"id": 11,
|
||||||
"pid": 3,
|
"pid": 3,
|
||||||
"name": "检测计划8"
|
"name": "北京2024现场检测"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 3
|
"id": 3
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
|
||||||
import { Role } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name 角色管理模块
|
|
||||||
*/
|
|
||||||
// 获取角色列表
|
|
||||||
export const getRoleList = (params: Role.ReqRoleParams) => {
|
|
||||||
return http.post<ResPage<Role.RoleBO>>(`/role/list`, params)
|
|
||||||
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增角色
|
|
||||||
export const addRole = (params: Role.RoleBO) => {
|
|
||||||
return http.post(`/role/add`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑角色
|
|
||||||
export const editRole = (params: Role.RoleBO) => {
|
|
||||||
return http.post(`/role/edit`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除角色
|
|
||||||
export const deleteRole = (params: { id: string[] }) => {
|
|
||||||
return http.post(`/role/del`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 编辑角色资源
|
|
||||||
export const editRoleAndPermission = (params: Role.ReqRoleAndPermission) => {
|
|
||||||
return http.post(`/role/edit_RoleAndPermission`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // 获取树形用户列表
|
|
||||||
// export const getRoleTreeList = (params: Role.ReqRoleParams) => {
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/tree/list`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export const addRole = (params: { id: string ; rolename: string;status: number; describe:string; }) => {
|
|
||||||
// return http.post(`/RoleList_Add`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 批量添加角色
|
|
||||||
// export const BatchAddRole = (params: FormData) => {
|
|
||||||
// return http.post(`${rePrefix}/role/import`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 切换角色状态
|
|
||||||
// export const changeRoleStatus = (params: { id: string; status: number }) => {
|
|
||||||
// return http.post(`${rePrefix}/role/change`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 重置用户密码
|
|
||||||
// export const resetUserPassWord = (params: { id: string }) => {
|
|
||||||
// return http.post(`${rePrefix}/role/rest_password`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 导出角色数据
|
|
||||||
// export const exportRoleInfo = (params: Role.ReqRoleParams) => {
|
|
||||||
// return http.download(`${rePrefix}/role/export`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取角色状态字典
|
|
||||||
// export const getRoleStatus = () => {
|
|
||||||
// return http.get<Role.ResStatus[]>(`${rePrefix}/role/status`)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取用户性别字典
|
|
||||||
// export const getUserGender = () => {
|
|
||||||
// return http.get<User.ResGender[]>(`${rePrefix}/user/gender`)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取角色权限列表
|
|
||||||
// export const getRoleDepartment = () => {
|
|
||||||
// return http.get<Role.ResPermissionList[]>(`${rePrefix}/role/permission`)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 获取用户角色字典
|
|
||||||
// export const getUserRole = () => {
|
|
||||||
// return http.get<User.ResRole[]>(`${rePrefix}/user/role`)
|
|
||||||
// }
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
const data = [
|
|
||||||
{
|
|
||||||
rolename:"操作员1",
|
|
||||||
id: 'operator_role',
|
|
||||||
status:1,
|
|
||||||
describe:"可以对待检设备的台账进行操作并执行检测功能",
|
|
||||||
permissionList: [
|
|
||||||
{
|
|
||||||
label: "台账管理",
|
|
||||||
key: "dataManager",
|
|
||||||
disable: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "系统配置",
|
|
||||||
key: "sysManager",
|
|
||||||
disable: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "设备检测",
|
|
||||||
key: "devTest",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
]},
|
|
||||||
{
|
|
||||||
rolename:"管理员2",
|
|
||||||
id: 'manager_role',
|
|
||||||
status:1,
|
|
||||||
describe:"可以设置检测脚本、误差体系、新增操作人员",
|
|
||||||
permissionList: [
|
|
||||||
{
|
|
||||||
label: "台账管理",
|
|
||||||
key: "dataManager",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "系统配置",
|
|
||||||
key: "sysManager",
|
|
||||||
disable: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "设备检测",
|
|
||||||
key: "devTest",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
]},
|
|
||||||
{
|
|
||||||
rolename:"超级管理员3",
|
|
||||||
id: 'superManager_role',
|
|
||||||
status:0,
|
|
||||||
describe:"可以修改程序的底层配置,例如检测指标的具体类型",
|
|
||||||
permissionList: [
|
|
||||||
{
|
|
||||||
label: "台账管理",
|
|
||||||
key: "dataManager",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "系统配置",
|
|
||||||
key: "sysManager",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "设备检测",
|
|
||||||
key: "devTest",
|
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
]},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default data
|
|
||||||
17
frontend/src/api/system/base/index.ts
Normal file
17
frontend/src/api/system/base/index.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import {type Base} from '@/api/system/base/interface'
|
||||||
|
|
||||||
|
//获取检测配置
|
||||||
|
export const getTestConfig = () => {
|
||||||
|
return http.get(`/sysTestConfig/getConfig`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//编辑检测配置
|
||||||
|
export const updateTestConfig = (params: Base.ResTestConfig) => {
|
||||||
|
return http.post(`/sysTestConfig/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
19
frontend/src/api/system/base/interface/index.ts
Normal file
19
frontend/src/api/system/base/interface/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// 检测配置表模块
|
||||||
|
export namespace Base {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测配置表查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResTestConfig {
|
||||||
|
id: string; //系统配置表Id
|
||||||
|
autoGenerate:number;//检测报告是否自动生成0 否;1是
|
||||||
|
maxTime:number;//最大复检次数,默认3次
|
||||||
|
dataRule:string;//数据处理原则,关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟字典静态数据,有后端接口后,需要删除 todo...
|
* 模拟字典静态数据,有后端接口后,需要删除 todo...
|
||||||
*/
|
*/
|
||||||
import { Dict } from '@/api/interface'
|
/**
|
||||||
|
* 模拟字典静态数据,有后端接口后,需要删除 todo...
|
||||||
|
*/
|
||||||
|
import type { Dict } from '@/api/interface'
|
||||||
|
|
||||||
const dictData: Dict[] = [
|
const dictData: Dict[] = [
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
import {type Dict} from '@/api/system/dictionary/interface'
|
import {type Dict} from '@/api/system/dictionary/interface'
|
||||||
import type {ResultData} from "@/api/interface";
|
|
||||||
|
|
||||||
//获取字典数据
|
//获取字典数据
|
||||||
export const getDictDataListByTypeId = (params: Dict.ReqDictDataParams) => {
|
export const getDictDataListByTypeId = (params: Dict.ReqDictDataParams) => {
|
||||||
@@ -26,4 +25,9 @@ export const getDicDataById = (params: string) => {
|
|||||||
return http.post('/dictData/getDicDataById', params)
|
return http.post('/dictData/getDicDataById', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//导出字典数据
|
||||||
|
export const exportDictData = (params: Dict.ReqDictDataParams) => {
|
||||||
|
return http.download(`/dictData/export`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
23
frontend/src/api/system/dictionary/dictPq/index.ts
Normal file
23
frontend/src/api/system/dictionary/dictPq/index.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
|
||||||
|
//获取字典类型
|
||||||
|
export const getDictPqList = (params: Dict.ReqDictPqParams) => {
|
||||||
|
return http.post(`/dictPq/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加字典类型
|
||||||
|
export const addDictPq = (params: Dict.ResDictPq) => {
|
||||||
|
return http.post(`/dictPq/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑字典类型
|
||||||
|
export const updateDictPq = (params: Dict.ResDictPq) => {
|
||||||
|
return http.post(`/dictPq/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除字典类型
|
||||||
|
export const deleteDictPq = (params: string[]) => {
|
||||||
|
return http.post(`/dictPq/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
24
frontend/src/api/system/dictionary/dictTree/index.ts
Normal file
24
frontend/src/api/system/dictionary/dictTree/index.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
|
||||||
|
//获取字典类型
|
||||||
|
export const getDictTreeList = (params: Dict.ResDictTree) => {
|
||||||
|
const name = params.name || '';
|
||||||
|
return http.get(`/dictTree/getTree?keyword=${name}`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加字典类型
|
||||||
|
export const addDictTree = (params: Dict.ResDictTree) => {
|
||||||
|
return http.post(`/dictTree/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑字典类型
|
||||||
|
export const updateDictTree = (params: Dict.ResDictTree) => {
|
||||||
|
return http.post(`/dictTree/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除字典类型
|
||||||
|
export const deleteDictTree = (params: Dict.ResDictTree) => {
|
||||||
|
return http.post(`/dictTree/delete?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -21,4 +21,7 @@ export const deleteDictType = (params: string[]) => {
|
|||||||
return http.post(`/dictType/delete`, params)
|
return http.post(`/dictType/delete`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//导出字典类型
|
||||||
|
export const exportDictType=(params: Dict.ReqDictTypeParams)=>{
|
||||||
|
return http.download(`/dictType/export`, params)
|
||||||
|
}
|
||||||
|
|||||||
@@ -80,4 +80,89 @@ export namespace Dict {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqDictPqParams extends ReqPage{
|
||||||
|
id: string; // 类型id 必填
|
||||||
|
name?: string; // 名称
|
||||||
|
phase?: string;//相别
|
||||||
|
dataType?: string;//数据模型(epd、pqd...)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResDictPq {
|
||||||
|
id: string;//指标字典表Id
|
||||||
|
name: string;//指标名称
|
||||||
|
phase: string;//相别
|
||||||
|
dataType: string;//数据模型(epd、pqd...)
|
||||||
|
otherName?: string ;//别名(默认与Name相同,主要是为了适配不同数据库里面字段)
|
||||||
|
showName?:string | null;//显示名称
|
||||||
|
sort:number;//排序
|
||||||
|
type?: string | null;//指标数据类型(整型、浮点型、枚举型这些的)
|
||||||
|
unit?: string | null;//单位
|
||||||
|
harmStart?:number | null;//起始次数
|
||||||
|
harmEnd?:number | null;//结束次数
|
||||||
|
classId: string ;//数据表表名
|
||||||
|
statMethod?:string;//数据统计类型(最大、最小、平均、CP95)
|
||||||
|
systemType?:string | null;//系统类别(区分用能/电能)
|
||||||
|
tranFlag?:number ;//数据是否上送(0:不上送 1:上送)
|
||||||
|
tranRule?:string | null;//上送规则 变化:“change”周期 :“ period”
|
||||||
|
eventType?:string | null;//evt的事件类别 "1"、"2";
|
||||||
|
storeFlag?:string ;//sts、di的是否存储 1:存储 0:不存 储;
|
||||||
|
curSts?:number | null;//sts、do的当前值;
|
||||||
|
ctlSts?:number;//do的是否可远程控制 1:是 0:否;
|
||||||
|
maxNum?:number ;//设置最大值
|
||||||
|
minNum?: number;//设置最小值
|
||||||
|
setValue?:string | null;//参数为enum可设置的所有值序列
|
||||||
|
strlen?:number ;//参数string可设置字符串的长度上 限
|
||||||
|
defaultValue?:string | null; //参数缺省值、告警code值
|
||||||
|
resourcesId?:string ; //报表数据来源(统计表表名)
|
||||||
|
limitName?:string | null; //限值字段名称
|
||||||
|
limitTable?:string | null;//限值表名
|
||||||
|
formula?:string ;//超标判断方式
|
||||||
|
primaryFormula?:string | null;//二次值转一次值公式
|
||||||
|
state:number;//状态:0-删除 1-正常
|
||||||
|
createBy?:string | null;//创建用户
|
||||||
|
createTime?:string | null;//创建时间
|
||||||
|
updateBy?:string | null;//更新用户
|
||||||
|
updateTime?:string | null;//更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电能质量指标字典数据表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResDictPqPage extends ResPage<ResDictPq> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树形字典数据新增、修改、根据id查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResDictTree {
|
||||||
|
id: string;//指标字典表Id
|
||||||
|
pid: string;//
|
||||||
|
pids: string;//
|
||||||
|
name:string;//
|
||||||
|
code:string;//
|
||||||
|
sort:number;//
|
||||||
|
remark?:string;//
|
||||||
|
state?:number;//'状态(字典 0正常 1停用 2删除)
|
||||||
|
createBy?:string | null;//
|
||||||
|
createTime?:string | null;//
|
||||||
|
updateBy?:string | null;//
|
||||||
|
updateTime?:string | null;//
|
||||||
|
level?:number | null;//
|
||||||
|
extend?:string | null;//对应type,不同类型可自定义配置
|
||||||
|
type?:number | null;//用于区分多种类型的字典树 0.台账对象类型 1.自定义报表指标类型
|
||||||
|
children?: ResDictTree[];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
0
frontend/src/api/system/log/index.ts
Normal file
0
frontend/src/api/system/log/index.ts
Normal file
@@ -1,4 +1,4 @@
|
|||||||
import type {Sys_Log_Audit} from "./interface"
|
import type {Sys_Log_Audit} from "./interface/log"
|
||||||
|
|
||||||
const logdata = ref<Sys_Log_Audit.Audit_LogList[]>([
|
const logdata = ref<Sys_Log_Audit.Audit_LogList[]>([
|
||||||
{
|
{
|
||||||
13
frontend/src/api/system/versionRegister/index.ts
Normal file
13
frontend/src/api/system/versionRegister/index.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import http from '@/api'
|
||||||
|
import {type VersionRegister} from '@/api/system/versionRegister/interface'
|
||||||
|
|
||||||
|
//获取有效数据配置
|
||||||
|
export const getRegRes = (params: VersionRegister.ResSys_Reg_Res) => {
|
||||||
|
return http.get(`/sysRegRes/getRegResByType?id=${params.type}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//编辑有效数据配置
|
||||||
|
export const updateRegRes = (params: VersionRegister.Sys_Reg_Res) => {
|
||||||
|
return http.post(`/sysRegRes/update`, params)
|
||||||
|
}
|
||||||
31
frontend/src/api/system/versionRegister/interface/index.ts
Normal file
31
frontend/src/api/system/versionRegister/interface/index.ts
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// 检测配置表模块
|
||||||
|
export namespace VersionRegister {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测配置表查询返回的对象
|
||||||
|
*/
|
||||||
|
export interface ResSys_Reg_Res {
|
||||||
|
id: string; //版本注册表Id
|
||||||
|
type: string; //版本类型(模拟式、数字式、比对式)
|
||||||
|
code: string; //注册码
|
||||||
|
licenseKey: string; //密钥
|
||||||
|
expireDate: string; //到期时间
|
||||||
|
waveRecord?: number;
|
||||||
|
realTime?: number;
|
||||||
|
statistics?: number;
|
||||||
|
flicker?: number;
|
||||||
|
state: number; //状态
|
||||||
|
createBy?: string| null; //创建用户
|
||||||
|
createTime?: string| null; //创建时间
|
||||||
|
updateBy?: string| null; //更新用户
|
||||||
|
updateTime?: string| null; //更新时间
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Sys_Reg_Res {
|
||||||
|
id: string;
|
||||||
|
waveRecord?: number;
|
||||||
|
realTime?: number;
|
||||||
|
statistics?: number;
|
||||||
|
flicker?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
|
||||||
|
|
||||||
// 检测脚本模块
|
|
||||||
export namespace TestScript {
|
|
||||||
|
|
||||||
// 检测脚本接口
|
|
||||||
export interface TestScriptBO {
|
|
||||||
id?: string; //检测脚本ID
|
|
||||||
name: string; //检测脚本名称
|
|
||||||
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
|
||||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
|
||||||
valueType: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
|
||||||
standardName: string;//参照标准名称
|
|
||||||
standardTime: string;//标准推行时间
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测脚本+分页
|
|
||||||
export interface ReqTestScriptParams extends ReqPage,TestScriptBO {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
|
||||||
import { TestScript } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name 检测脚本管理模块
|
|
||||||
*/
|
|
||||||
// 获取检测脚本列表
|
|
||||||
export const getTestScriptList = (params: TestScript.ReqTestScriptParams) => {
|
|
||||||
return http.post<ResPage<TestScript.TestScriptBO>>(`/testScript/list`, params)
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/testScript/list`, params)
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
|
||||||
|
|
||||||
// 检测源模块
|
|
||||||
export namespace TestSource {
|
|
||||||
|
|
||||||
// 检测源接口
|
|
||||||
export interface TestSourceBO {
|
|
||||||
id?: string; //检测源ID
|
|
||||||
name: string; //检测源名称
|
|
||||||
pattern: string;//检测源模式(字典表Code字段,数字、模拟、比对)
|
|
||||||
type: string; //检测源类型(字典表Code字段,标准源、高精度设备)
|
|
||||||
devType: string;//检测源设备类型(字典表Code字段)
|
|
||||||
parameters: string;//源参数(JSON字符串)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测源+分页
|
|
||||||
export interface ReqTestSourceParams extends ReqPage,TestSourceBO {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
|
||||||
import { TestSource } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name 检测源管理模块
|
|
||||||
*/
|
|
||||||
// 获取检测脚本列表
|
|
||||||
export const getTestSourceList = (params: TestSource.ReqTestSourceParams) => {
|
|
||||||
return http.post<ResPage<TestSource.TestSourceBO>>(`/testSource/list`, params)
|
|
||||||
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/testSource/list`, params)
|
|
||||||
}
|
|
||||||
35
frontend/src/api/user/function/index.ts
Normal file
35
frontend/src/api/user/function/index.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import http from "@/api";
|
||||||
|
import type { Function } from "@/api/user/interface/function";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 获取资源
|
||||||
|
export const getFunctionList = (params:Function.ResFunction) => {
|
||||||
|
const name = params.name || '';
|
||||||
|
return http.get<Function.ResFunction>(`/sysFunction/getTree?keyword=${name}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取资源不包括按钮
|
||||||
|
export const getFunctionListNoButton = () => {
|
||||||
|
return http.get<Function.ResFunction>(`/sysFunction/functionTreeNoButton`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//添加菜单列表
|
||||||
|
export const addFunction = (params: Function.ResFunction) => {
|
||||||
|
return http.post(`/sysFunction/add`,params);
|
||||||
|
};
|
||||||
|
|
||||||
|
//删除菜单列表
|
||||||
|
export const deleteFunction = (params: Function.ResFunction) => {
|
||||||
|
return http.post(`/sysFunction/delete?id=${params.id}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
//编辑菜单列表
|
||||||
|
export const updateFunction = (params: Function.ResFunction) => {
|
||||||
|
return http.post(`/sysFunction/update`, params);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -21,10 +21,11 @@ export namespace Function {
|
|||||||
pids?:string | null;//节点上层所有节点
|
pids?:string | null;//节点上层所有节点
|
||||||
name: string;//名称
|
name: string;//名称
|
||||||
code:string;//资源标识
|
code:string;//资源标识
|
||||||
path:string;//路径
|
path:string;//路由路径
|
||||||
icon?:string | null;//图标
|
component:string ;//组件地址
|
||||||
|
icon?:string;//图标
|
||||||
sort:number;//排序
|
sort:number;//排序
|
||||||
type:number | null;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
|
type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
|
||||||
remark?: string | null;//权限资源描述
|
remark?: string | null;//权限资源描述
|
||||||
state:number;//权限资源状态
|
state:number;//权限资源状态
|
||||||
create_By?:string | null;//创建人
|
create_By?:string | null;//创建人
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// 登录模块
|
|
||||||
import type { ReqPage } from '@/api/interface'
|
|
||||||
|
|
||||||
export namespace Login {
|
|
||||||
export interface ReqLoginForm {
|
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
export interface ResLogin {
|
|
||||||
accessToken: string;
|
|
||||||
}
|
|
||||||
export interface ResAuthButtons {
|
|
||||||
[key: string]: string[];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 用户管理模块
|
|
||||||
export namespace User {
|
|
||||||
|
|
||||||
// 用户接口
|
|
||||||
export interface UserBO {
|
|
||||||
id?: string; //用户ID,作为唯一标识
|
|
||||||
name: string; //用户名(别名)
|
|
||||||
loginName: string;//登录名
|
|
||||||
password: string; //密码
|
|
||||||
phone?: string; //手机号
|
|
||||||
email?: string; //邮箱
|
|
||||||
loginTime?: string;//最后一次登录时间
|
|
||||||
loginErrorTimes: number;//登录错误次数
|
|
||||||
lockTime?: string; //用户密码错误锁定时间
|
|
||||||
}
|
|
||||||
// 用户+分页
|
|
||||||
export interface ReqUserParams extends ReqPage,UserBO {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,33 +1,44 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
import type { ReqPage, ResPage } from '@/api/interface'
|
||||||
|
|
||||||
// 角色管理模块
|
// 角色管理模块
|
||||||
export namespace Role {
|
export namespace Role {
|
||||||
|
|
||||||
//资源接口
|
|
||||||
export interface Permission{
|
|
||||||
id: string; //资源ID
|
|
||||||
name: string; //资源名称
|
|
||||||
code: string; //资源代码
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqRoleParams extends ReqPage{
|
||||||
|
id: string; // 装置序号用户ID 必填
|
||||||
|
name?: string; //用户名(别名)
|
||||||
|
code?: string; //角色代码
|
||||||
|
}
|
||||||
//角色接口
|
//角色接口
|
||||||
export interface RoleBO {
|
export interface RoleBO {
|
||||||
id?: string; //角色类型ID
|
id: string; //角色类型ID
|
||||||
name: string; //角色类型名称
|
name: string; //角色类型名称
|
||||||
code: string; //角色代码
|
code: string; //角色代码
|
||||||
type: number; //角色类型
|
type: number; //角色类型
|
||||||
remark:string; //角色描述
|
remark?:string; //角色描述
|
||||||
|
state:number;
|
||||||
|
createBy?:string; //
|
||||||
|
createTime?: string; // 创建时间
|
||||||
|
updateBy?: string; //
|
||||||
|
updateTime?: string; // 更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
//角色+资源
|
//角色接口
|
||||||
export interface ReqRoleAndPermission extends RoleBO{
|
export interface RoleFunctionId {
|
||||||
permissionList?:Permission[]; //角色权限列表
|
id: string[]; //菜单id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResRolePage extends ResPage<RoleBO> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 角色+分页
|
|
||||||
export interface ReqRoleParams extends ReqPage,RoleBO {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
74
frontend/src/api/user/interface/user.ts
Normal file
74
frontend/src/api/user/interface/user.ts
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
// 登录模块
|
||||||
|
import type { ReqPage,ResPage } from '@/api/interface'
|
||||||
|
|
||||||
|
export namespace Login {
|
||||||
|
export interface ReqLoginForm {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
export interface ResLogin {
|
||||||
|
accessToken: string;
|
||||||
|
userInfo:{
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export interface ResAuthButtons {
|
||||||
|
[key: string]: string[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 用户管理模块
|
||||||
|
export namespace User {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户数据表格分页查询参数
|
||||||
|
*/
|
||||||
|
export interface ReqUserParams extends ReqPage{
|
||||||
|
id: string; // 装置序号用户ID 必填
|
||||||
|
name?: string; //用户名(别名)
|
||||||
|
loginTime?: string;//最后一次登录时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户接口
|
||||||
|
export interface ResUser {
|
||||||
|
id: string; //用户ID,作为唯一标识
|
||||||
|
name: string; //用户名(别名)
|
||||||
|
loginName: string;//登录名
|
||||||
|
deptId?: number;//部门ID
|
||||||
|
password: string; //密码
|
||||||
|
phone?: string; //手机号
|
||||||
|
email?: string; //邮箱
|
||||||
|
loginTime?: string;//最后一次登录时间
|
||||||
|
loginErrorTimes: number;//登录错误次数
|
||||||
|
lockTime?: string; //用户密码错误锁定时间
|
||||||
|
state:number;//0-删除;1-正常;2-锁定;3-待审核;4-休眠;5-密码过期
|
||||||
|
createBy?: string;//创建用户
|
||||||
|
createTime?: string;//创建时间
|
||||||
|
updateBy?: string;//更新用户
|
||||||
|
updateTime?: string;//更新时间
|
||||||
|
roleIds?: string[]; //
|
||||||
|
roleNames?:string[]; //
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户接口
|
||||||
|
export interface ResPassWordUser {
|
||||||
|
id: string; //用户ID,作为唯一标识
|
||||||
|
oldPassword: string; //密码
|
||||||
|
newPassword: string; //新密码
|
||||||
|
surePassword:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表格查询分页返回的对象;
|
||||||
|
*/
|
||||||
|
export interface ResUserPage extends ResPage<ResUser> {
|
||||||
|
|
||||||
|
}
|
||||||
|
// // 用户+分页
|
||||||
|
// export interface ReqUserParams extends ReqPage,UserBO {
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import { Login } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
/**
|
|
||||||
* @name 登录模块
|
|
||||||
*/
|
|
||||||
// 用户登录
|
|
||||||
export const loginApi = (params: Login.ReqLoginForm) => {
|
|
||||||
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
|
||||||
//return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
|
||||||
}
|
|
||||||
// 获取菜单列表
|
|
||||||
export const getAuthMenuListApi = () => {
|
|
||||||
return http.get<Menu.MenuOptions[]>(`${rePrefix}/menu/list`, {}, { loading: false })
|
|
||||||
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
|
||||||
}
|
|
||||||
// 获取按钮权限
|
|
||||||
export const getAuthButtonListApi = () => {
|
|
||||||
return http.get<Login.ResAuthButtons>(`${rePrefix}/auth/buttons`, {}, { loading: false })
|
|
||||||
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
|
||||||
}
|
|
||||||
// 用户退出登录
|
|
||||||
export const logoutApi = () => {
|
|
||||||
return http.post(`${rePrefix}/logout`)
|
|
||||||
}
|
|
||||||
32
frontend/src/api/user/login/index.ts
Normal file
32
frontend/src/api/user/login/index.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import type { Login } from '@/api/user/interface/user'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/system/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
import type { Dict } from '@/api/interface'
|
||||||
|
/**
|
||||||
|
* @name 登录模块
|
||||||
|
*/
|
||||||
|
// 用户登录
|
||||||
|
export const loginApi = (params: Login.ReqLoginForm) => {
|
||||||
|
return http.post<Login.ResLogin>(`${rePrefix}/login`, params, { loading: false })
|
||||||
|
// return http.post<Login.ResLogin>(`/Register1`, params, { loading: false })
|
||||||
|
}
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getAuthMenuListApi = () => {
|
||||||
|
return http.get<Menu.MenuOptions[]>(`/sysFunction/getMenu`, {}, { loading: false })
|
||||||
|
// return http.post<Menu.MenuOptions[]>(`/Register2`, {}, { loading: false })
|
||||||
|
}
|
||||||
|
// 获取按钮权限
|
||||||
|
export const getAuthButtonListApi = () => {
|
||||||
|
return http.get<Login.ResAuthButtons>(`/sysFunction/getButton`, {}, { loading: false })
|
||||||
|
// return http.post<Login.ResAuthButtons>(`/Register3`, {}, { loading: false })
|
||||||
|
}
|
||||||
|
// 用户退出登录
|
||||||
|
export const logoutApi = () => {
|
||||||
|
return http.post(`${rePrefix}/logout`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取下拉框列表
|
||||||
|
export const getDictList = () =>{
|
||||||
|
return http.get<Dict>('/dictData/dictDataCache')
|
||||||
|
}
|
||||||
|
|
||||||
46
frontend/src/api/user/role/index.ts
Normal file
46
frontend/src/api/user/role/index.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import type { Role } from '@/api/user/interface/role'
|
||||||
|
import type { Function } from '@/api/user/interface/function'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 角色管理模块
|
||||||
|
*/
|
||||||
|
// 获取角色列表
|
||||||
|
export const getRoleList = (params: Role.ReqRoleParams) => {
|
||||||
|
return http.post(`/sysRole/list`, params)
|
||||||
|
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`/RoleList_Post`, params)
|
||||||
|
// return http.post<ResPage<Role.ResRoleList>>(`${rePrefix}/role/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增角色
|
||||||
|
export const addRole = (params: Role.RoleBO) => {
|
||||||
|
return http.post(`/sysRole/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑角色
|
||||||
|
export const editRole = (params: Role.RoleBO) => {
|
||||||
|
return http.post(`/sysRole/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除角色
|
||||||
|
export const deleteRole = (params: { id: string[] }) => {
|
||||||
|
return http.post(`/sysRole/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取资源
|
||||||
|
export const getFunctionList = () => {
|
||||||
|
return http.get<Function.ResFunction>(`/sysFunction/getTree?keyword=`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//获取角色id绑定的菜单
|
||||||
|
export const getRoleFunction = (params:Role.RoleBO) => {
|
||||||
|
return http.post(`/sysFunction/getFunctionsByRoleId?id=${params.id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//角色分配菜单
|
||||||
|
export const assignFunction = (params:Role.RoleBO,param:Role.RoleFunctionId) => {
|
||||||
|
return http.post(`/sysFunction/assignFunctionByRoleId`,{ roleId: params.id,functionIds:param.id })
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
|
||||||
import { User } from './interface'
|
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @name 用户管理模块
|
|
||||||
*/
|
|
||||||
// 获取用户列表
|
|
||||||
export const getUserList = (params: User.ReqUserParams) => {
|
|
||||||
return http.post<ResPage<User.UserBO>>(`/user/list`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取树形用户列表
|
|
||||||
// export const getUserTreeList = (params: User.ReqUserParams) => {
|
|
||||||
// return http.post<ResPage<User.ResUserList>>(`${rePrefix}/user/tree/list`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 新增用户
|
|
||||||
export const addUser = (params: User.UserBO) => {
|
|
||||||
return http.post(`/user/add`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量添加用户
|
|
||||||
export const BatchAddUser = (params: FormData) => {
|
|
||||||
return http.post(`${rePrefix}/user/import`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 编辑用户
|
|
||||||
export const editUser = (params: User.UserBO) => {
|
|
||||||
return http.post(`/user/edit`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除用户
|
|
||||||
export const deleteUser = (params: { id: string[] }) => {
|
|
||||||
return http.post(`/user/delete`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 切换用户状态
|
|
||||||
// export const changeUserStatus = (params: { id: string; status: number }) => {
|
|
||||||
// return http.post(`${rePrefix}/user/change`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 重置用户密码
|
|
||||||
// export const resetUserPassWord = (params: { id: string }) => {
|
|
||||||
// return http.post(`${rePrefix}/user/rest_password`, params)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 导出用户数据
|
|
||||||
export const exportUserInfo = (params: User.ReqUserParams) => {
|
|
||||||
return http.download(`${rePrefix}/user/export`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取用户状态字典
|
|
||||||
// export const getUserStatus = () => {
|
|
||||||
// return http.get<User.ResStatus[]>(`${rePrefix}/user/status`)
|
|
||||||
// }
|
|
||||||
39
frontend/src/api/user/user/index.ts
Normal file
39
frontend/src/api/user/user/index.ts
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import type { Role } from '@/api/user/interface/role'
|
||||||
|
import type { User } from '@/api/user/interface/user'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 用户管理模块
|
||||||
|
*/
|
||||||
|
// 获取用户列表
|
||||||
|
export const getUserList = (params: User.ReqUserParams) => {
|
||||||
|
return http.post(`/sysUser/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 新增用户
|
||||||
|
export const addUser = (params: User.ResUser) => {
|
||||||
|
return http.post(`/sysUser/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑用户
|
||||||
|
export const updateUser = (params: User.ResUser) => {
|
||||||
|
return http.post(`/sysUser/update`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除用户
|
||||||
|
export const deleteUser = (params: string[] ) => {
|
||||||
|
return http.post(`/sysUser/delete`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取角色列表
|
||||||
|
export const getRoleList = () => {
|
||||||
|
return http.get<Role.RoleBO>(`/sysRole/simpleList`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改密码
|
||||||
|
export const updatePassWord = (params: User.ResPassWordUser) => {
|
||||||
|
return http.post(`/sysUser/updatePassword`,params)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
const data = [
|
|
||||||
{
|
|
||||||
'id': '623689732233728549',
|
|
||||||
'username': 'admin_A',
|
|
||||||
'password': '12345678',
|
|
||||||
'realname': '薛霞',
|
|
||||||
'status': 0,
|
|
||||||
'rolename': '管理员',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '621003764863621316',
|
|
||||||
'username': 'admin_B',
|
|
||||||
'password': '12345678',
|
|
||||||
'realname': '冯敏',
|
|
||||||
'status': 1,
|
|
||||||
'rolename': '管理员',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// 'id': '652286556713195552',
|
|
||||||
// 'username': 'operator_A',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '潘霞',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '373930342176416776',
|
|
||||||
// 'username': 'operator_B',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '郝秀英',
|
|
||||||
// 'status': 0,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '429621442453555775',
|
|
||||||
// 'username': 'operator_C',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '吕洋',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '387231964476618937',
|
|
||||||
// 'username': 'operator_D',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '江磊',
|
|
||||||
// 'status': 0,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '604013348875476647',
|
|
||||||
// 'username': 'operator_E',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '姚静',
|
|
||||||
// 'status': 0,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '028222596330483467',
|
|
||||||
// 'username': 'operator_F',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '龙艳',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '739427478368274267',
|
|
||||||
// 'username': 'operator_G',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '武涛',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127243',
|
|
||||||
// 'username': 'operator_H',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳',
|
|
||||||
// 'status': 0,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127244',
|
|
||||||
// 'username': 'operator_I',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳1',
|
|
||||||
// 'status': 0,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127245',
|
|
||||||
// 'username': 'operator_J',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳2',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127245',
|
|
||||||
// 'username': 'operator_J',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳2',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127245',
|
|
||||||
// 'username': 'operator_J',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳2',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127245',
|
|
||||||
// 'username': 'operator_J',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳2',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '448686878612127245',
|
|
||||||
// 'username': 'operator_J',
|
|
||||||
// 'password': '12345678',
|
|
||||||
// 'realname': '孙芳2',
|
|
||||||
// 'status': 1,
|
|
||||||
// 'rolename': '操作员',
|
|
||||||
// }
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
export default data
|
|
||||||
1
frontend/src/assets/icons/loading.svg
Normal file
1
frontend/src/assets/icons/loading.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1731580516863" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1484" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M469.333333 85.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#f38d0d" opacity=".8" p-id="1485"></path><path d="M469.333333 725.333333m42.666667 0l0 0q42.666667 0 42.666667 42.666667l0 128q0 42.666667-42.666667 42.666667l0 0q-42.666667 0-42.666667-42.666667l0-128q0-42.666667 42.666667-42.666667Z" fill="#f38d0d" opacity=".4" p-id="1486"></path><path d="M938.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#f38d0d" opacity=".2" p-id="1487"></path><path d="M298.666667 469.333333m0 42.666667l0 0q0 42.666667-42.666667 42.666667l-128 0q-42.666667 0-42.666667-42.666667l0 0q0-42.666667 42.666667-42.666667l128 0q42.666667 0 42.666667 42.666667Z" fill="#f38d0d" opacity=".6" p-id="1488"></path><path d="M783.530667 180.138667m30.169889 30.169889l0 0q30.169889 30.169889 0 60.339779l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339779l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#f38d0d" opacity=".1" p-id="1489"></path><path d="M330.965333 632.661333m30.16989 30.16989l0 0q30.169889 30.169889 0 60.339778l-90.509668 90.509668q-30.169889 30.169889-60.339779 0l0 0q-30.169889-30.169889 0-60.339778l90.509668-90.509668q30.169889-30.169889 60.339779 0Z" fill="#f38d0d" opacity=".5" p-id="1490"></path><path d="M843.861333 783.530667m-30.169889 30.169889l0 0q-30.169889 30.169889-60.339779 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339779 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#f38d0d" opacity=".3" p-id="1491"></path><path d="M391.338667 330.965333m-30.16989 30.16989l0 0q-30.169889 30.169889-60.339778 0l-90.509668-90.509668q-30.169889-30.169889 0-60.339779l0 0q30.169889-30.169889 60.339778 0l90.509668 90.509668q30.169889 30.169889 0 60.339779Z" fill="#f38d0d" opacity=".7" p-id="1492"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.4 KiB |
1
frontend/src/assets/icons/preTest.svg
Normal file
1
frontend/src/assets/icons/preTest.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1732514869986" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16631" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M365.631638 689.60904H222.155932c-18.512994 0-37.025989 18.512994-37.025988 37.025988s18.512994 37.025989 37.025988 37.025989h143.475706c13.884746 0 23.141243-4.628249 32.397741-18.512994s4.628249-23.141243 0-37.025989-23.141243-18.512994-32.397741-18.512994zM467.453107 527.620339c4.628249-9.256497 4.628249-23.141243 0-37.025989-4.628249-9.256497-18.512994-18.512994-32.39774-18.512994H217.527684c-13.884746 0-23.141243 4.628249-32.39774 18.512994-4.628249 9.256497-4.628249 23.141243 0 37.025989 4.628249 9.256497 18.512994 18.512994 32.39774 18.512994h217.527683c13.884746 0 27.769492-9.256497 32.39774-18.512994z" fill="#bfbfbf" p-id="16632"></path><path d="M620.185311 944.162712H171.245198c-27.769492 0-50.910734-9.256497-69.423729-27.769492-18.512994-18.512994-27.769492-41.654237-27.769492-69.423728V171.245198c0-27.769492 9.256497-50.910734 27.769492-69.423729s41.654237-27.769492 69.423729-27.769492h675.724294c27.769492 0 50.910734 9.256497 69.423728 27.769492 18.512994 18.512994 27.769492 41.654237 27.769492 69.423729v448.940113c0 18.512994 18.512994 37.025989 37.025989 37.025988s37.025989-13.884746 37.025988-37.025988V171.245198c0-46.282486-18.512994-87.936723-50.910734-120.334464C934.906215 18.512994 893.251977 0 846.969492 0H171.245198c-46.282486 0-87.936723 18.512994-120.334464 50.910734C18.512994 83.308475 0 124.962712 0 171.245198v675.724294c0 46.282486 18.512994 87.936723 50.910734 120.334463 32.39774 32.39774 74.051977 50.910734 120.334464 50.910734h448.940113c18.512994 0 37.025989-18.512994 37.025988-37.025988-4.628249-18.512994-18.512994-37.025989-37.025988-37.025989z" fill="#bfbfbf" p-id="16633"></path><path d="M837.712994 291.579661c0-18.512994-18.512994-37.025989-37.025988-37.025989H217.527684c-18.512994 0-37.025989 18.512994-37.025989 37.025989s18.512994 37.025989 37.025989 37.025989h583.159322c18.512994 0 37.025989-18.512994 37.025988-37.025989zM1008.958192 958.047458l-138.847458-138.847458c64.79548-92.564972 50.910734-222.155932-37.025988-291.579661-87.936723-74.051977-212.899435-69.423729-296.20791 13.884746-78.680226 78.680226-87.936723 208.271186-13.884746 296.207909 74.051977 87.936723 199.014689 101.821469 291.579661 37.025989l138.847458 138.847458c13.884746 13.884746 37.025989 13.884746 50.910735 0s18.512994-41.654237 4.628248-55.538983z m-212.899435-161.988701c-27.769492 27.769492-64.79548 41.654237-101.821469 41.654237-69.423729 0-129.59096-50.910734-143.475706-115.706214s23.141243-134.219209 87.936723-161.988701 138.847458-4.628249 175.873446 55.538983c37.025989 50.910734 27.769492 129.59096-18.512994 180.501695z" fill="#bfbfbf" p-id="16634"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.9 KiB |
1
frontend/src/assets/icons/守时检测.svg
Normal file
1
frontend/src/assets/icons/守时检测.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1732514910835" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="17830" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M960.24 688.95c-18.01-3.5-35.36 8.28-38.83 26.25-20.79 107.56-103.26 189.89-205.21 204.89-18.11 2.66-30.63 19.5-27.97 37.61 2.42 16.47 16.57 28.32 32.74 28.32 1.61 0 3.24-0.11 4.87-0.36 129.77-19.09 234.52-122.71 260.64-257.88 3.48-17.97-8.26-35.35-26.24-38.83z" fill="#666666" p-id="17831"></path><path d="M719.89 875.33c5.11 0 10.31-1.2 15.17-3.7 64.25-33.18 116-89.16 145.74-157.64 7.29-16.79-0.41-36.31-17.21-43.6-16.78-7.27-36.29 0.43-43.6 17.21-23.66 54.5-64.63 98.94-115.33 125.12-16.27 8.4-22.65 28.4-14.25 44.66 5.89 11.41 17.48 17.95 29.48 17.95zM312.62 540.45c-21.23-21.19-55.78-21.21-76.99 0.02L53.07 723.03c-10.29 10.29-15.97 23.96-15.97 38.52 0 14.54 5.66 28.22 15.96 38.51l104.58 104.58c10.61 10.62 24.55 15.91 38.5 15.91 13.94 0 27.88-5.3 38.51-15.91l182.57-182.57c21.23-21.23 21.23-55.77 0-77l-104.6-104.62zM196.13 849.39l-87.83-87.83 165.84-165.84 87.83 87.83-165.84 165.84zM643.92 418.3c10.29 10.29 23.97 15.97 38.53 15.97 14.54 0 28.22-5.68 38.5-15.96l182.57-182.56 0.02-0.01c21.2-21.23 21.2-55.78-0.02-76.99L798.93 54.16c-21.22-21.22-55.76-21.24-77 0L539.34 236.74c-21.2 21.23-21.2 55.78 0.02 76.99L643.92 418.3z m116.51-308.9l87.84 87.84-165.83 165.83-87.84-87.83L760.43 109.4zM596.09 714.69c-20.79-20.8-18.77-56.66 4.51-79.95l28.56-28.56c11.6-11.59 26.54-18.28 42.09-18.83 14.49-0.9 28.11 4.55 37.85 14.32 0.01 0.01 0.02 0.01 0.03 0.02l10.18 10.18c12.95 12.95 33.92 12.95 46.87 0 12.95-12.94 12.95-33.93 0-46.87L756 554.84c-0.01-0.01-0.01-0.02-0.02-0.03-0.02-0.02-0.04-0.03-0.06-0.05L623.06 421.89c-0.01-0.01-0.01-0.02-0.02-0.03-0.02-0.02-0.04-0.03-0.06-0.05l-85.92-85.92c-43.22-43.22-113.54-43.22-156.76 0l-49.99 49.99c-43.22 43.22-43.22 113.54 0 156.76l229.12 229.12a33.037 33.037 0 0 0 23.43 9.71c8.48 0 16.96-3.24 23.43-9.71 12.95-12.94 12.95-33.93 0-46.87l-10.2-10.2z m-13.8-155.39l-28.57 28.56c-15.36 15.36-25.55 33.65-31.65 52.8l-58.92-58.92c-20.79-20.8-18.77-56.66 4.51-79.95l28.56-28.56c11.6-11.59 26.54-18.28 42.09-18.83 14.33-0.82 28.09 4.55 37.85 14.32 0.01 0.01 0.02 0.01 0.03 0.02l58.83 58.83c-19.51 6.26-37.69 16.7-52.73 31.73z m-218.16-95.04c0-11.9 4.64-23.09 13.05-31.51l49.99-49.99c16.85-16.83 46.2-16.83 63.03 0l11.88 11.88c-19.51 6.25-37.69 16.69-52.72 31.73l-28.56 28.56c-15.36 15.36-25.56 33.64-31.66 52.79l-11.95-11.95c-8.43-8.41-13.06-19.61-13.06-31.51z" fill="#666666" p-id="17832"></path><path d="M723.12 632.91c-12.94-12.94-33.93-12.94-46.87 0l-49.11 49.11c-12.94 12.94-12.94 33.93 0 46.87 12.94 12.94 33.93 12.94 46.87 0l49.11-49.11c12.94-12.94 12.94-33.92 0-46.87z" fill="#666666" p-id="17833"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.8 KiB |
1
frontend/src/assets/icons/完成.svg
Normal file
1
frontend/src/assets/icons/完成.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1732514403639" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13633" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M387.018497 210.626092c17.179264 0 31.099299-13.925151 31.099299-31.099299l0-10.366092 186.597839 0 0 10.366092c0 17.175171 13.920034 31.099299 31.099299 31.099299s31.099299-13.925151 31.099299-31.099299L666.914232 96.593965c0-17.175171-13.920034-31.099299-31.099299-31.099299s-31.099299 13.925151-31.099299 31.099299l0 10.366092L418.117796 106.960057l0-10.366092c0-17.175171-13.920034-31.099299-31.099299-31.099299s-31.099299 13.925151-31.099299 31.099299l0 82.932828C355.919199 196.700941 369.83821 210.626092 387.018497 210.626092z" fill="#999999" p-id="13634"></path><path d="M400.416646 314.944995c-17.179264 0-31.099299 13.925151-31.099299 31.099299l0 30.340005c0 17.175171 13.920034 31.099299 31.099299 31.099299s31.099299-13.925151 31.099299-31.099299L431.515944 346.044294C431.516967 328.869123 417.596933 314.944995 400.416646 314.944995z" fill="#999999" p-id="13635"></path><path d="M622.416785 314.944995c-17.179264 0-31.099299 13.925151-31.099299 31.099299l0 30.340005c0 17.175171 13.920034 31.099299 31.099299 31.099299s31.099299-13.925151 31.099299-31.099299L653.516084 346.044294C653.517107 328.869123 639.597073 314.944995 622.416785 314.944995z" fill="#999999" p-id="13636"></path><path d="M511.103584 546.380018c43.773969 0 74.783217-30.18344 86.212524-48.016597 9.182127-14.33038 5.021364-33.210379-9.202593-42.569538-14.213723-9.379625-33.428344-5.385661-42.974767 8.706289-0.132006 0.197498-13.555737 19.680225-34.035164 19.680225-19.903306 0-32.29452-18.039865-33.124422-19.290345-9.151427-14.349823-28.173666-18.72855-42.650379-9.718339-14.588253 9.06547-19.072381 28.245298-10.001795 42.832528C436.493306 515.968381 467.116767 546.380018 511.103584 546.380018z" fill="#999999" p-id="13637"></path><path d="M463.633433 898.665457 266.173199 898.665457c-41.648562 0-75.532277-34.713616-75.532277-77.374228l0-574.913888c0-42.665729 33.883715-77.374228 75.532277-77.374228 17.179264 0 31.099299-13.925151 31.099299-31.099299s-13.920034-31.099299-31.099299-31.099299c-75.946716 0-137.730874 62.61406-137.730874 139.573849l0 574.913888c0 76.959789 61.784158 139.573849 137.730874 139.573849L463.633433 960.866101c17.179264 0 31.099299-13.920034 31.099299-31.099299S480.81372 898.665457 463.633433 898.665457z" fill="#999999" p-id="13638"></path><path d="M756.661256 106.803491c-17.179264 0-31.099299 13.925151-31.099299 31.099299s13.920034 31.099299 31.099299 31.099299c41.648562 0 75.532277 34.7085 75.532277 77.374228L832.193533 551.401382c0 17.175171 13.920034 31.099299 31.099299 31.099299s31.099299-13.925151 31.099299-31.099299L894.39213 246.37734C894.39213 169.417551 832.607972 106.803491 756.661256 106.803491z" fill="#999999" p-id="13639"></path><path d="M840.980663 650.76953 613.392248 885.125069l-110.711498-114.006544c-11.975752-12.325723-31.655977-12.614296-43.976584-0.647753-12.320607 11.966543-12.614296 31.655977-0.647753 43.976584l133.023666 136.981814c0.10847 0.110517 0.23843 0.183172 0.347924 0.291642 0.11154 0.11154 0.186242 0.245593 0.299829 0.356111 0.771573 0.74906 1.644453 1.311879 2.470261 1.963725 0.704035 0.556679 1.363044 1.183965 2.101871 1.671059 1.031493 0.680499 2.131547 1.187035 3.219321 1.731434 0.730641 0.366344 1.426489 0.816598 2.178619 1.121544 1.25048 0.50756 2.548032 0.823761 3.841491 1.162476 0.642636 0.167822 1.26276 0.429789 1.912559 0.555655 1.961678 0.38067 3.949962 0.581238 5.939269 0.581238s3.977591-0.200568 5.939269-0.581238c0.650823-0.12689 1.269923-0.387833 1.912559-0.555655 1.293459-0.338714 2.591011-0.654916 3.841491-1.162476 0.75213-0.304945 1.447978-0.7552 2.178619-1.121544 1.087774-0.544399 2.187829-1.050935 3.219321-1.731434 0.738827-0.487094 1.397836-1.11438 2.101871-1.671059 0.825808-0.651846 1.698688-1.215688 2.470261-1.963725 0.113587-0.110517 0.188288-0.24457 0.299829-0.356111 0.109494-0.10847 0.239454-0.181125 0.347924-0.291642l249.900583-257.331833c11.966543-12.320607 11.672854-32.011064-0.647753-43.976584C872.637664 638.160351 852.956416 638.438691 840.980663 650.76953z" fill="#999999" p-id="13640"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.3 KiB |
1
frontend/src/assets/icons/正式检测.svg
Normal file
1
frontend/src/assets/icons/正式检测.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1732515039802" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21450" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 1024C230.4 1024 0 793.6 0 512S230.4 0 512 0s512 230.4 512 512-230.4 512-512 512z m135.68-320H376.32c-12.8 0-20.48 17.92-20.48 17.92v20.48h314.88v-17.92c0-10.24-10.24-20.48-23.04-20.48zM709.12 281.6H314.88C281.6 281.6 256 307.2 256 335.36v258.56c0 28.16 25.6 53.76 58.88 53.76h135.68v17.92c0 7.68 7.68 17.92 20.48 17.92h76.8c12.8 0 20.48-7.68 20.48-17.92v-17.92h135.68c33.28 0 58.88-25.6 58.88-53.76V335.36C768 307.2 742.4 281.6 709.12 281.6zM314.88 576c-12.8 0-20.48-7.68-20.48-17.92v-222.72c0-7.68 7.68-17.92 20.48-17.92h391.68c12.8 0 20.48 7.68 20.48 17.92v222.72c0 7.68-7.68 17.92-20.48 17.92H314.88z m394.24 56.32c-7.68 0-12.8-5.12-17.92-7.68s-5.12-12.8 0-20.48c5.12-5.12 7.68-7.68 17.92-7.68 7.68 0 12.8 5.12 17.92 7.68 5.12 5.12 5.12 12.8 0 20.48-5.12 5.12-10.24 7.68-17.92 7.68z m-51.2-266.24L588.8 424.96 542.72 384c0-5.12-7.68-5.12-12.8-5.12s-12.8 5.12-12.8 7.68l-58.88 97.28-25.6-53.76c0-7.68-7.68-12.8-12.8-12.8-7.68 0-12.8 0-17.92 5.12l-58.88 53.76c-7.68 7.68-7.68 20.48 0 25.6 7.68 7.68 20.48 7.68 25.6 0l38.4-33.28 30.72 66.56c5.12 7.68 7.68 12.8 17.92 12.8 7.68 0 12.8-5.12 17.92-12.8l64-110.08 43.52 38.4c7.68 7.68 20.48 7.68 30.72 0l76.8-71.68c5.12-5.12 7.68-12.8 5.12-17.92 0-7.68-7.68-12.8-12.8-12.8-15.36-5.12-20.48 0-23.04 5.12z" p-id="21451" fill="#bfbfbf"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
1
frontend/src/assets/icons/系数校准.svg
Normal file
1
frontend/src/assets/icons/系数校准.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1732515166779" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="27890" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M418.95 374.32c-38.78 0-63.02 41.98-43.63 75.57l154.61 267.79c12.5-3.1 23.99-10.99 31.32-23.68l184.57-319.68H418.95z" fill="#cdcdcd" p-id="27891"></path><path d="M803.55 299.32H348.43c-13.81 0-25-11.19-25-25s11.19-25 25-25h455.13c13.81 0 25 11.19 25 25s-11.2 25-25.01 25z" fill="#cdcdcd" p-id="27892"></path><path d="M231.68 274.32m-57.35 0a57.35 57.35 0 1 0 114.7 0 57.35 57.35 0 1 0-114.7 0Z" fill="#cdcdcd" p-id="27893"></path><path d="M231.68 332.17c-31.9 0-57.85-25.95-57.85-57.85s25.95-57.85 57.85-57.85c31.9 0 57.85 25.95 57.85 57.85s-25.95 57.85-57.85 57.85z m0-114.7c-31.35 0-56.85 25.5-56.85 56.85s25.5 56.85 56.85 56.85 56.85-25.5 56.85-56.85-25.5-56.85-56.85-56.85z" fill="#cdcdcd" p-id="27894"></path><path d="M196.5 410.67c-2.49 0-5.03-0.38-7.53-1.17-28.53-9.01-53.09-26.5-71.03-50.6-18.32-24.6-28-53.85-28-84.59 0-78.16 63.59-141.74 141.74-141.74s141.74 63.59 141.74 141.74c0 13.81-11.19 25-25 25s-25-11.19-25-25c0-50.59-41.16-91.74-91.74-91.74s-91.74 41.16-91.74 91.74c0 40.24 25.75 75.41 64.08 87.51 13.17 4.16 20.47 18.2 16.31 31.37-3.36 10.67-13.21 17.48-23.83 17.48z" fill="#cdcdcd" p-id="27895"></path><path d="M459.27 690.78c-8.64 0-17.04-4.48-21.67-12.5L210.03 284.12c-6.9-11.96-2.81-27.25 9.15-34.15 11.96-6.9 27.25-2.81 34.15 9.15L480.9 653.27c6.9 11.96 2.81 27.25-9.15 34.15a24.846 24.846 0 0 1-12.48 3.36z" fill="#cdcdcd" p-id="27896"></path><path d="M517.62 766.88m-57.35 0a57.35 57.35 0 1 0 114.7 0 57.35 57.35 0 1 0-114.7 0Z" fill="#cdcdcd" p-id="27897"></path><path d="M517.71 824.75c-5.03 0-10.08-0.66-15.07-2-14.93-4-27.4-13.57-35.13-26.96-7.73-13.38-9.78-28.97-5.78-43.9 4-14.93 13.57-27.4 26.96-35.13 27.63-15.95 63.08-6.45 79.03 21.18 15.95 27.63 6.45 63.08-21.17 79.03-8.92 5.15-18.81 7.78-28.84 7.78z m-0.19-114.71c-9.64 0-19.4 2.45-28.33 7.61-13.15 7.59-22.56 19.85-26.49 34.52-3.93 14.67-1.91 29.99 5.68 43.14s19.85 22.56 34.52 26.49c14.67 3.93 29.99 1.91 43.14-5.68 27.15-15.67 36.48-50.51 20.81-77.66-10.52-18.23-29.67-28.42-49.33-28.42z" fill="#cdcdcd" p-id="27898"></path><path d="M517.85 908.59c-49.03 0-96.77-25.42-122.99-70.84-39.08-67.69-15.8-154.55 51.88-193.63 11.96-6.9 27.25-2.81 34.15 9.15s2.81 27.25-9.15 34.15c-43.81 25.29-58.87 81.51-33.58 125.32 16.97 29.4 47.88 45.85 79.61 45.85 15.56 0 31.31-3.95 45.72-12.27 34.85-20.12 52.43-60 43.74-99.25-2.98-13.48 5.53-26.83 19.01-29.81 13.48-2.98 26.83 5.53 29.81 19.01 6.46 29.21 3.59 59.23-8.3 86.82-12.14 28.16-32.63 51.17-59.26 66.54-22.26 12.85-46.61 18.96-70.64 18.96z" fill="#cdcdcd" p-id="27899"></path><path d="M517.59 791.88c-4.24 0-8.54-1.08-12.48-3.35-11.96-6.9-16.05-22.19-9.15-34.15l227.56-394.15c6.9-11.96 22.19-16.05 34.15-9.15 11.96 6.9 16.05 22.19 9.15 34.15L539.27 779.38c-4.63 8.02-13.04 12.5-21.68 12.5z" fill="#cdcdcd" p-id="27900"></path><path d="M803.55 271.62m-57.35 0a57.35 57.35 0 1 0 114.7 0 57.35 57.35 0 1 0-114.7 0Z" fill="#cdcdcd" p-id="27901"></path><path d="M803.45 329.46a57.47 57.47 0 0 1-28.83-7.74c-27.63-15.95-37.12-51.4-21.17-79.03 15.95-27.62 51.4-37.13 79.03-21.18 13.38 7.73 22.96 20.2 26.96 35.13s1.95 30.52-5.78 43.9c-10.71 18.55-30.2 28.92-50.21 28.92z m0.2-114.68c-19.66 0-38.81 10.2-49.33 28.42-15.67 27.15-6.34 61.99 20.81 77.66 27.15 15.67 61.99 6.34 77.66-20.81 7.59-13.15 9.61-28.47 5.68-43.14s-13.34-26.93-26.49-34.52a56.46 56.46 0 0 0-28.33-7.61z" fill="#cdcdcd" p-id="27902"></path><path d="M803.31 413.34c-24.03 0-48.37-6.11-70.63-18.96-11.96-6.9-16.05-22.19-9.15-34.15 6.9-11.96 22.19-16.05 34.15-9.15 43.81 25.29 100.03 10.23 125.32-33.58 25.29-43.81 10.23-100.03-33.58-125.32-34.85-20.12-78.18-15.4-107.82 11.74-10.18 9.32-26 8.63-35.32-1.56-9.32-10.18-8.63-26 1.56-35.32 22.06-20.2 49.5-32.72 79.34-36.22 30.46-3.56 60.63 2.68 87.25 18.05 67.69 39.08 90.96 125.94 51.88 193.62-26.23 45.42-73.97 70.85-123 70.85z" fill="#cdcdcd" p-id="27903"></path></svg>
|
||||||
|
After Width: | Height: | Size: 4.1 KiB |
@@ -27,14 +27,13 @@ const dialogVisible = ref<Boolean>(false);
|
|||||||
const dialogTitle = ref<string>("");
|
const dialogTitle = ref<string>("");
|
||||||
const openDialog = (title: string) => {
|
const openDialog = (title: string) => {
|
||||||
dialogTitle.value = title;
|
dialogTitle.value = title;
|
||||||
console.log(dialogVisible.value);
|
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
};
|
};
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openDialog,
|
openDialog,
|
||||||
});
|
});
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ const findIndex = () => {
|
|||||||
}, 0)
|
}, 0)
|
||||||
if (!find) hiddenIndex.value = -1
|
if (!find) hiddenIndex.value = -1
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// console.warn(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据覆盖 :">
|
<el-form-item v-if="parameter.showCover" label="数据覆盖 :">
|
||||||
<el-switch v-model="isCover" />
|
<el-switch v-model="isCover" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -47,6 +47,7 @@ import { ElNotification, UploadRequestOptions, UploadRawFile } from "element-plu
|
|||||||
|
|
||||||
export interface ExcelParameterProps {
|
export interface ExcelParameterProps {
|
||||||
title: string; // 标题
|
title: string; // 标题
|
||||||
|
showCover?: boolean; // 是否显示”数据覆盖“选项
|
||||||
fileSize?: number; // 上传文件的大小
|
fileSize?: number; // 上传文件的大小
|
||||||
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
fileType?: File.ExcelMimeType[]; // 上传文件的类型
|
||||||
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
tempApi?: (params: any) => Promise<any>; // 下载模板的Api
|
||||||
@@ -76,14 +77,15 @@ const acceptParams = (params: ExcelParameterProps) => {
|
|||||||
// Excel 导入模板下载
|
// Excel 导入模板下载
|
||||||
const downloadTemp = () => {
|
const downloadTemp = () => {
|
||||||
if (!parameter.value.tempApi) return;
|
if (!parameter.value.tempApi) return;
|
||||||
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`);
|
useDownload(parameter.value.tempApi, `${parameter.value.title}模板`,{},true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 文件上传
|
// 文件上传
|
||||||
const uploadExcel = async (param: UploadRequestOptions) => {
|
const uploadExcel = async (param: UploadRequestOptions) => {
|
||||||
|
debugger
|
||||||
let excelFormData = new FormData();
|
let excelFormData = new FormData();
|
||||||
excelFormData.append("file", param.file);
|
excelFormData.append("file", param.file);
|
||||||
excelFormData.append("isCover", isCover.value as unknown as Blob);
|
isCover.value && excelFormData.append("isCover", isCover.value as unknown as Blob);
|
||||||
await parameter.value.importApi!(excelFormData);
|
await parameter.value.importApi!(excelFormData);
|
||||||
parameter.value.getTableList && parameter.value.getTableList();
|
parameter.value.getTableList && parameter.value.getTableList();
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
|
|||||||
363
frontend/src/components/IpAddress/index.vue
Normal file
363
frontend/src/components/IpAddress/index.vue
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
<template>
|
||||||
|
<div :class="{ 'disabled': disabled }">
|
||||||
|
<ul class="ipAdress">
|
||||||
|
<li v-for="(item, index) in ipAddress" :key="index">
|
||||||
|
<input :ref="el => getInputRef(el, index)" v-model="item.value" type="text" class="ipInputClass"
|
||||||
|
:disabled="disabled" @input="checkIpVal(item)" @keyup="$event => turnIpPosition(item, index, $event)"
|
||||||
|
@blur="handleBlur" @mouseup="handleMouseUp(index)" />
|
||||||
|
<div></div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup name="routePage">
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
|
// 接收来自上层的数据
|
||||||
|
const props = defineProps(['value', 'disabled'])
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
const $emits = defineEmits(['update:value', 'blur'])
|
||||||
|
|
||||||
|
// 存储四个ref
|
||||||
|
const ipInputRefs = ref<HTMLInputElement[]>([]);
|
||||||
|
// 存储左右标识位
|
||||||
|
let markFlag = ref([
|
||||||
|
{
|
||||||
|
left: false,
|
||||||
|
right: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
left: false,
|
||||||
|
right: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
left: false,
|
||||||
|
right: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
left: false,
|
||||||
|
right: false
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// 更新标识
|
||||||
|
let flag = ref(false)
|
||||||
|
|
||||||
|
// 鼠标点击
|
||||||
|
const handleMouseUp = (index: any) => {
|
||||||
|
let input = ipInputRefs.value[index]
|
||||||
|
// 全为false
|
||||||
|
markFlag.value.forEach(item => {
|
||||||
|
item.left = false
|
||||||
|
item.right = false
|
||||||
|
})
|
||||||
|
// 证明在开始阶段
|
||||||
|
if (input.selectionStart == 0) {
|
||||||
|
|
||||||
|
markFlag.value[index].left = true
|
||||||
|
} else {
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
}
|
||||||
|
// 证明在结束
|
||||||
|
if (input.selectionStart == (input.value || '').length) {
|
||||||
|
markFlag.value[index].right = true
|
||||||
|
} else {
|
||||||
|
markFlag.value[index].right = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取四个input refs
|
||||||
|
const getInputRef = (el: any, index: number) => {
|
||||||
|
if (el) {
|
||||||
|
ipInputRefs.value[index] = el;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 声明IP存储类型
|
||||||
|
interface IpType {
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
// 定义要显示的四个ip
|
||||||
|
let ipAddress = ref<IpType[]>([
|
||||||
|
{
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "",
|
||||||
|
},
|
||||||
|
])
|
||||||
|
// 初始化显示数据
|
||||||
|
const initShowData = () => {
|
||||||
|
// 判断不合理行为
|
||||||
|
if (props.value === '') {
|
||||||
|
ipAddress.value.forEach(item => {
|
||||||
|
item.value = ''
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let ipList = props.value.split('.')
|
||||||
|
ipAddress.value.forEach((item: IpType, index: number) => {
|
||||||
|
item.value = ipList[index]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查ip输入
|
||||||
|
const checkIpVal = (item: any) => {
|
||||||
|
let val = item.value;
|
||||||
|
|
||||||
|
// 处理非数字
|
||||||
|
val = val.toString().replace(/[^0-9]/g, "");
|
||||||
|
val = parseInt(val, 10);
|
||||||
|
if (isNaN(val)) {
|
||||||
|
val = "";
|
||||||
|
} else {
|
||||||
|
val = val < 0 ? 0 : val;
|
||||||
|
if (val > 255) {
|
||||||
|
// 判断val是几位数
|
||||||
|
let num = (val + '').length
|
||||||
|
if (num > 3) {
|
||||||
|
val = parseInt((val + '').substring(0, 3))
|
||||||
|
} else {
|
||||||
|
val = 255
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.value = val;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断光标左右移动位置
|
||||||
|
const turnIpPosition = (item: IpType, index: number, event: any) => {
|
||||||
|
let e = event || window.event;
|
||||||
|
if (e.keyCode === 37) {
|
||||||
|
// 左箭头向左跳转,左一不做任何措施
|
||||||
|
if (index == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.currentTarget.selectionStart === 0) {
|
||||||
|
if (markFlag.value[index].left) {
|
||||||
|
handleFocus(index - 1, 'toLeft')
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
markFlag.value[index].right = false
|
||||||
|
} else {
|
||||||
|
|
||||||
|
markFlag.value[index].left = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markFlag.value[index].right = false
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
}
|
||||||
|
} else if (e.keyCode == 39) {
|
||||||
|
// 右箭头向右跳转,右一不做任何措施
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
let start = e.currentTarget.selectionStart
|
||||||
|
if (index != 3 && start === item.value.toString().length) {
|
||||||
|
if (markFlag.value[index].right) {
|
||||||
|
handleFocus(index + 1, 'toRight')
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
markFlag.value[index].right = false
|
||||||
|
} else {
|
||||||
|
markFlag.value[index].right = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markFlag.value[index].right = false
|
||||||
|
}
|
||||||
|
} else if (e.keyCode === 8) {
|
||||||
|
|
||||||
|
// 删除键把当前数据删除完毕后会跳转到前一个input,左一不做任何处理
|
||||||
|
if (index !== 0 && e.currentTarget.selectionStart === 0) {
|
||||||
|
if (markFlag.value[index].left) {
|
||||||
|
ipInputRefs.value[index - 1].focus();
|
||||||
|
markFlag.value[index].left = false
|
||||||
|
} else {
|
||||||
|
|
||||||
|
markFlag.value[index].left = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e.keyCode === 13 || e.keyCode === 32) {
|
||||||
|
|
||||||
|
// 回车键、空格键、冒号均向右跳转,右一不做任何措施
|
||||||
|
if (index !== 3) {
|
||||||
|
ipInputRefs.value[index + 1].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.keyCode === 110 || e.keyCode === 190) {
|
||||||
|
// 点 . 向右跳转,右一不做任何措施
|
||||||
|
|
||||||
|
if (item.value == '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (index !== 3) {
|
||||||
|
ipInputRefs.value[index + 1].select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (item.value.toString().length === 3) {
|
||||||
|
|
||||||
|
// 满3位,光标自动向下一个文本框.
|
||||||
|
if (index !== 3) {
|
||||||
|
//ipInputRefs.value[index + 1].setSelectionRange(0, 0)
|
||||||
|
ipInputRefs.value[index + 1].focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理聚焦
|
||||||
|
const handleFocus = (index: number, direction: string) => {
|
||||||
|
// 设置当前位置为选中状态 toRight:从左边来的
|
||||||
|
let input = ipInputRefs.value[index]
|
||||||
|
input.focus()
|
||||||
|
let value = input.value
|
||||||
|
// null 左右全部设置为true,可以直接跳转
|
||||||
|
if ((value || '').length == 0) {
|
||||||
|
markFlag.value[index].right = true
|
||||||
|
markFlag.value[index].left = true
|
||||||
|
} else {
|
||||||
|
if (direction == 'toRight') {
|
||||||
|
// 可以直接跳回
|
||||||
|
|
||||||
|
markFlag.value[index].left = true
|
||||||
|
// 设置光标为左边第一个
|
||||||
|
ipInputRefs.value[index].setSelectionRange(0, 0)
|
||||||
|
// 设置上一个的右边标识为false
|
||||||
|
markFlag.value[index - 1] && (markFlag.value[index - 1].right = false)
|
||||||
|
} else {
|
||||||
|
// 直接跳回
|
||||||
|
markFlag.value[index].right = true
|
||||||
|
// 设置后一个侧边为false
|
||||||
|
markFlag.value[index + 1] && (markFlag.value[index + 1].left = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 格式化补零方法
|
||||||
|
const formatter = (val: string) => {
|
||||||
|
let value = val.toString();
|
||||||
|
if (value.length === 2) {
|
||||||
|
value = "0" + value;
|
||||||
|
} else if (value.length === 1) {
|
||||||
|
value = "00" + value;
|
||||||
|
} else if (value.length === 0) {
|
||||||
|
value = "000";
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听数据变化,并初始化显示四个数据
|
||||||
|
watch(() => props.value, () => {
|
||||||
|
|
||||||
|
if(flag.value){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
initShowData()
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听ipAddress数据变化
|
||||||
|
watch(ipAddress, () => {
|
||||||
|
let str = "";
|
||||||
|
for (const i in ipAddress.value) {
|
||||||
|
str += formatter(ipAddress.value[i].value);
|
||||||
|
}
|
||||||
|
if (str === "000000000000") {
|
||||||
|
str = "";
|
||||||
|
} else {
|
||||||
|
str = ipAddress.value.map(item => {
|
||||||
|
if (item.value !== null) {
|
||||||
|
return item.value + ''
|
||||||
|
} else {
|
||||||
|
return '0'
|
||||||
|
}
|
||||||
|
}).join(".")
|
||||||
|
}
|
||||||
|
$emits('update:value', str)
|
||||||
|
flag.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
flag.value = false
|
||||||
|
}, 100)
|
||||||
|
}, {
|
||||||
|
deep: true
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleBlur = () => {
|
||||||
|
$emits('blur')
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
|
||||||
|
.ipAdress {
|
||||||
|
li {
|
||||||
|
.ipInputClass {
|
||||||
|
color: #c3c4cc;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipAdress {
|
||||||
|
display: flex;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
line-height: 40px;
|
||||||
|
width: 100%;
|
||||||
|
height: 35px;
|
||||||
|
padding-inline-start: 0px;
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 20px;
|
||||||
|
padding-top: 0px;
|
||||||
|
padding-bottom: 0px;;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipAdress li {
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipInputClass {
|
||||||
|
border: none;
|
||||||
|
width: 50px;
|
||||||
|
height: 23px;
|
||||||
|
text-align: center;
|
||||||
|
color: #606266;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ipAdress li div {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 12px;
|
||||||
|
right: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #b6b8bc;
|
||||||
|
width: 2px;
|
||||||
|
height: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*只需要3个div*/
|
||||||
|
.ipAdress li:last-child div {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*取消掉默认的input focus状态*/
|
||||||
|
.ipAdress input:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@@ -1,57 +1,57 @@
|
|||||||
<template>
|
<template>
|
||||||
<RenderTableColumn v-bind="column" />
|
<RenderTableColumn v-bind='column' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="tsx" name="TableColumn">
|
<script setup lang='tsx' name='TableColumn'>
|
||||||
import { ColumnProps, RenderScope, HeaderRenderScope } from "@/components/ProTable/interface";
|
import { ColumnProps, RenderScope, HeaderRenderScope } from '@/components/ProTable/interface'
|
||||||
import { filterEnum, formatValue, handleProp, handleRowAccordingToProp } from "@/utils";
|
import { filterEnum, formatValue, handleProp, handleRowAccordingToProp } from '@/utils'
|
||||||
|
|
||||||
defineProps<{ column: ColumnProps }>();
|
defineProps<{ column: ColumnProps }>()
|
||||||
|
|
||||||
const slots = useSlots();
|
const slots = useSlots()
|
||||||
|
|
||||||
const enumMap = inject("enumMap", ref(new Map()));
|
const enumMap = inject('enumMap', ref(new Map()))
|
||||||
|
|
||||||
// 渲染表格数据
|
// 渲染表格数据
|
||||||
const renderCellData = (item: ColumnProps, scope: RenderScope<any>) => {
|
const renderCellData = (item: ColumnProps, scope: RenderScope<any>) => {
|
||||||
return enumMap.value.get(item.prop) && item.isFilterEnum
|
return enumMap.value.get(item.prop) && item.isFilterEnum
|
||||||
? filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop)!, item.fieldNames)
|
? filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop)!, item.fieldNames)
|
||||||
: formatValue(handleRowAccordingToProp(scope.row, item.prop!));
|
: formatValue(handleRowAccordingToProp(scope.row, item.prop!))
|
||||||
};
|
}
|
||||||
|
|
||||||
// 获取 tag 类型
|
// 获取 tag 类型
|
||||||
const getTagType = (item: ColumnProps, scope: RenderScope<any>) => {
|
const getTagType = (item: ColumnProps, scope: RenderScope<any>) => {
|
||||||
return (
|
return (
|
||||||
filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop), item.fieldNames, "tag") || "primary"
|
filterEnum(handleRowAccordingToProp(scope.row, item.prop!), enumMap.value.get(item.prop), item.fieldNames, 'tag') || 'primary'
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
const RenderTableColumn = (item: ColumnProps) => {
|
const RenderTableColumn = (item: ColumnProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{item.isShow && (
|
{item.isShow && (
|
||||||
<el-table-column
|
<el-table-column
|
||||||
{...item}
|
{...item}
|
||||||
align={item.align ?? "center"}
|
align={item.align ?? 'center'}
|
||||||
showOverflowTooltip={item.showOverflowTooltip ?? item.prop !== "operation"}
|
showOverflowTooltip={item.showOverflowTooltip ?? item.prop !== 'operation'}
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
default: (scope: RenderScope<any>) => {
|
default: (scope: RenderScope<any>) => {
|
||||||
if (item._children) return item._children.map(child => RenderTableColumn(child));
|
if (item._children) return item._children.map(child => RenderTableColumn(child))
|
||||||
if (item.render) return item.render(scope);
|
if (item.render) return item.render(scope)
|
||||||
if (item.prop && slots[handleProp(item.prop)]) return slots[handleProp(item.prop)]!(scope);
|
if (item.prop && slots[handleProp(item.prop)]) return slots[handleProp(item.prop)]!(scope)
|
||||||
if (item.tag) return <el-tag type={getTagType(item, scope)}>{renderCellData(item, scope)}</el-tag>;
|
if (item.tag) return <el-tag type={getTagType(item, scope)}>{renderCellData(item, scope)}</el-tag>
|
||||||
return renderCellData(item, scope);
|
return renderCellData(item, scope)
|
||||||
},
|
},
|
||||||
header: (scope: HeaderRenderScope<any>) => {
|
header: (scope: HeaderRenderScope<any>) => {
|
||||||
if (item.headerRender) return item.headerRender(scope);
|
if (item.headerRender) return item.headerRender(scope)
|
||||||
if (item.prop && slots[`${handleProp(item.prop)}Header`]) return slots[`${handleProp(item.prop)}Header`]!(scope);
|
if (item.prop && slots[`${handleProp(item.prop)}Header`]) return slots[`${handleProp(item.prop)}Header`]!(scope)
|
||||||
return item.label;
|
return item.label
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -30,9 +30,10 @@
|
|||||||
|
|
||||||
<script lang='ts' setup name='SelectIcon'>
|
<script lang='ts' setup name='SelectIcon'>
|
||||||
import * as Icons from '@element-plus/icons-vue'
|
import * as Icons from '@element-plus/icons-vue'
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
interface SelectIconProps {
|
interface SelectIconProps {
|
||||||
iconValue: string;
|
iconValue: string| undefined;
|
||||||
title?: string;
|
title?: string;
|
||||||
clearable?: boolean;
|
clearable?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
@@ -82,6 +83,7 @@ const iconsList = computed((): { [key: string]: any } => {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang='scss'>
|
<style scoped lang='scss'>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-right: 10px; /* 日期选择器右侧间距 */
|
margin-right: 10px; /* 日期选择器右侧间距 */
|
||||||
width: 320px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.date-picker {
|
.date-picker {
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
>
|
>
|
||||||
<!-- 采用 v-for 动态渲染 -->
|
<!-- 采用 v-for 动态渲染 -->
|
||||||
<el-option
|
<el-option
|
||||||
v-for="unit in timeUnits"
|
v-for='unit in timeUnits'
|
||||||
:key="unit.value"
|
:key='unit.value'
|
||||||
:label="unit.label"
|
:label='unit.label'
|
||||||
:value="unit.value"
|
:value='unit.value'
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
v-model='startDate'
|
v-model='startDate'
|
||||||
type='date'
|
type='date'
|
||||||
placeholder='起始时间'
|
placeholder='起始时间'
|
||||||
@change="emitDateChange"
|
@change='emitDateChange'
|
||||||
:disabled-date="disableStartDate"
|
:disabled-date='disableStartDate'
|
||||||
:readonly="timeUnit != '自定义'"
|
:readonly="timeUnit != '自定义'"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
<el-text>~</el-text>
|
<el-text>~</el-text>
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
v-model='endDate'
|
v-model='endDate'
|
||||||
type='date'
|
type='date'
|
||||||
placeholder='结束时间'
|
placeholder='结束时间'
|
||||||
@change="emitDateChange"
|
@change='emitDateChange'
|
||||||
:disabled-date="disableEndDate"
|
:disabled-date='disableEndDate'
|
||||||
:readonly="timeUnit !== '自定义'"
|
:readonly="timeUnit !== '自定义'"
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,12 +43,12 @@
|
|||||||
class='triangle-button'
|
class='triangle-button'
|
||||||
type='primary'
|
type='primary'
|
||||||
@click='prevPeriod'
|
@click='prevPeriod'
|
||||||
@change="emitDateChange"
|
@change='emitDateChange'
|
||||||
>
|
>
|
||||||
<div class='left_triangle'></div>
|
<div class='left_triangle'></div>
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button class='triangle-button' type='primary' @click='goToCurrent' >
|
<el-button class='triangle-button' type='primary' @click='goToCurrent'>
|
||||||
当前
|
当前
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
style='width: 10px;'
|
style='width: 10px;'
|
||||||
@@ -64,187 +64,233 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script setup lang='ts'>
|
||||||
|
import { ref, onMounted, defineProps, defineEmits } from 'vue'
|
||||||
|
|
||||||
<script setup lang="ts">
|
// 定义时间单位的类型
|
||||||
import { ref ,onMounted, defineProps, defineEmits } from 'vue';
|
|
||||||
|
|
||||||
// 定义时间单位的类型
|
|
||||||
interface TimeUnit {
|
interface TimeUnit {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义组件的props,包含包括和排除的时间单位
|
// 定义组件的props,包含包括和排除的时间单位
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
include: {
|
include: {
|
||||||
type: Array as () => string[],
|
type: Array as () => string[],
|
||||||
default: () => ['日', '周', '月', '季度', '年', '自定义'],
|
default: () => ['日', '周', '月', '季度', '年', '自定义'],
|
||||||
},
|
},
|
||||||
exclude: {
|
exclude: {
|
||||||
type: Array as () => string[],
|
type: Array as () => string[],
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '日',
|
default: '月',
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
// 定义事件
|
// 定义事件
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update-dates', startDate: Date, endDate: Date): void;
|
(e: 'update-dates', startDate: string, endDate: string): void;
|
||||||
}>();
|
}>()
|
||||||
const timeUnit = ref<string>(props.default); // 默认选择
|
const timeUnit = ref<string>(props.default) // 默认选择
|
||||||
const startDate = ref<Date>(new Date()); // 起始日期
|
const startDate = ref<Date>(new Date()) // 起始日期
|
||||||
const endDate = ref<Date>(new Date()); // 结束日期
|
const endDate = ref<Date>(new Date()) // 结束日期
|
||||||
const isNextDisabled = ref<boolean>(false); // 控制下一周期按钮的禁用状态
|
const isNextDisabled = ref<boolean>(false) // 控制下一周期按钮的禁用状态
|
||||||
const today = ref<Date>(new Date()); // 当前日期
|
const today = ref<Date>(new Date()) // 当前日期
|
||||||
// 过滤出可用的时间单位
|
// 过滤出可用的时间单位
|
||||||
const timeUnits = ref<TimeUnit[]>(
|
const timeUnits = ref<TimeUnit[]>(
|
||||||
props.include.filter(unit => !props.exclude.includes(unit)).map(unit => ({
|
props.include.filter(unit => !props.exclude.includes(unit)).map(unit => ({
|
||||||
label: unit,
|
label: unit,
|
||||||
value: unit,
|
value: unit,
|
||||||
}))
|
})),
|
||||||
);
|
)
|
||||||
|
|
||||||
// 发出日期变化事件
|
// 发出日期变化事件
|
||||||
const emitDateChange = () => {
|
const emitDateChange = () => {
|
||||||
emit('update-dates', startDate.value, endDate.value);
|
emit('update-dates', formatDate(startDate.value), formatDate(endDate.value))
|
||||||
//console.log('emitDateChange', startDate.value, endDate.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 在组件挂载时更新日期范围
|
|
||||||
onMounted(() => {
|
|
||||||
updateDateRange();
|
|
||||||
});
|
|
||||||
const handleChange = (unit: string)=> {
|
|
||||||
// 根据选择的时间单位处理日期变化
|
|
||||||
if (unit !== '自定义') {
|
|
||||||
updateDateRange()
|
|
||||||
} else {
|
|
||||||
// 自定义选项逻辑
|
|
||||||
startDate.value = new Date(new Date().setDate(new Date().getDate() - 1))
|
|
||||||
endDate.value = new Date()
|
|
||||||
}
|
|
||||||
timeUnit.value = unit;
|
|
||||||
emitDateChange(); // 变化时也发出更新事件
|
|
||||||
updateNextButtonStatus()
|
|
||||||
}
|
|
||||||
const updateDateRange = () => {
|
|
||||||
|
|
||||||
// 根据选择的时间单位计算起始和结束日期
|
|
||||||
if (timeUnit.value === '日') {
|
|
||||||
startDate.value = today.value
|
|
||||||
endDate.value = today.value
|
|
||||||
} else if (timeUnit.value === '周') {
|
|
||||||
startDate.value = getStartOfWeek(today.value)
|
|
||||||
endDate.value = getEndOfWeek(today.value)
|
|
||||||
} else if (timeUnit.value === '月') {
|
|
||||||
startDate.value = new Date(today.value.getFullYear(), today.value.getMonth(), 1)
|
|
||||||
endDate.value = new Date(today.value.getFullYear(), today.value.getMonth() + 1, 0)
|
|
||||||
} else if (timeUnit.value === '季度') {
|
|
||||||
const quarter = Math.floor(today.value.getMonth() / 3)
|
|
||||||
startDate.value = new Date(today.value.getFullYear(), quarter * 3, 1)
|
|
||||||
endDate.value = new Date(today.value.getFullYear(), quarter * 3 + 3, 0)
|
|
||||||
} else if (timeUnit.value === '年') {
|
|
||||||
startDate.value = new Date(today.value.getFullYear(), 0, 1)
|
|
||||||
endDate.value = new Date(today.value.getFullYear(), 11, 31)
|
|
||||||
}
|
|
||||||
updateNextButtonStatus()
|
|
||||||
}
|
|
||||||
const getStartOfWeek =(date:Date)=> {
|
|
||||||
const startOfWeek = new Date(date)
|
|
||||||
const day = startOfWeek.getDay()
|
|
||||||
const diff = day === 0 ? -6 : 1 - day // 星期天的情况
|
|
||||||
startOfWeek.setDate(startOfWeek.getDate() + diff)
|
|
||||||
return startOfWeek
|
|
||||||
}
|
|
||||||
const getEndOfWeek =(date:Date) =>{
|
|
||||||
const endOfWeek = new Date(date)
|
|
||||||
const day = endOfWeek.getDay()
|
|
||||||
const diff = day === 0 ? 0 : 7 - day // 星期天的情况
|
|
||||||
endOfWeek.setDate(endOfWeek.getDate() + diff)
|
|
||||||
return endOfWeek
|
|
||||||
}
|
|
||||||
const prevPeriod =()=> {
|
|
||||||
const prevStartDate = new Date(startDate.value)
|
|
||||||
const prevEndDate = new Date(endDate.value)
|
|
||||||
|
|
||||||
if (timeUnit.value === '日') {
|
|
||||||
prevStartDate.setDate(prevStartDate.getDate() - 1)
|
|
||||||
prevEndDate.setDate(prevEndDate.getDate() - 1)
|
|
||||||
} else if (timeUnit.value === '周') {
|
|
||||||
prevStartDate.setDate(prevStartDate.getDate() - 7)
|
|
||||||
prevEndDate.setDate(prevEndDate.getDate() - 7)
|
|
||||||
} else if (timeUnit.value === '月') {
|
|
||||||
prevStartDate.setMonth(prevStartDate.getMonth() - 1)
|
|
||||||
prevEndDate.setMonth(prevEndDate.getMonth() - 1)
|
|
||||||
} else if (timeUnit.value === '季度') {
|
|
||||||
prevStartDate.setMonth(prevStartDate.getMonth() - 3)
|
|
||||||
prevEndDate.setMonth(prevEndDate.getMonth() - 3)
|
|
||||||
} else if (timeUnit.value === '年') {
|
|
||||||
prevStartDate.setFullYear(prevStartDate.getFullYear() - 1)
|
|
||||||
prevEndDate.setFullYear(prevEndDate.getFullYear() - 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
startDate.value = prevStartDate
|
|
||||||
endDate.value = prevEndDate
|
|
||||||
updateNextButtonStatus()
|
|
||||||
}
|
|
||||||
const goToCurrent =()=> {
|
|
||||||
if (timeUnit.value !== '自定义') {
|
|
||||||
updateDateRange() // 更新为当前选择时间单位的时间范围
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const nextPeriod = ()=> {
|
|
||||||
const nextStartDate = new Date(startDate.value)
|
|
||||||
const nextEndDate = new Date(endDate.value)
|
|
||||||
|
|
||||||
if (timeUnit.value === '日') {
|
|
||||||
nextStartDate.setDate(nextStartDate.getDate() + 1)
|
|
||||||
nextEndDate.setDate(nextEndDate.getDate() + 1)
|
|
||||||
} else if (timeUnit.value === '周') {
|
|
||||||
nextStartDate.setDate(nextStartDate.getDate() + 7)
|
|
||||||
nextEndDate.setDate(nextEndDate.getDate() + 7)
|
|
||||||
} else if (timeUnit.value === '月') {
|
|
||||||
nextStartDate.setMonth(nextStartDate.getMonth() + 1)
|
|
||||||
nextEndDate.setMonth(nextEndDate.getMonth() + 1)
|
|
||||||
} else if (timeUnit.value === '季度') {
|
|
||||||
nextStartDate.setMonth(nextStartDate.getMonth() + 3)
|
|
||||||
nextEndDate.setMonth(nextStartDate.getMonth() + 3)
|
|
||||||
} else if (timeUnit.value === '年') {
|
|
||||||
nextStartDate.setFullYear(nextStartDate.getFullYear() + 1)
|
|
||||||
nextEndDate.setFullYear(nextEndDate.getFullYear() + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
startDate.value = nextStartDate
|
|
||||||
endDate.value = nextEndDate
|
|
||||||
updateNextButtonStatus()
|
|
||||||
}
|
|
||||||
const updateNextButtonStatus =()=> {
|
|
||||||
// 更新下一个按钮的禁用状态
|
|
||||||
const maxDate = new Date() // 假设最新日期为今天
|
|
||||||
// 将 maxDate 设置为当天的开始时间
|
|
||||||
maxDate.setHours(0, 0, 0, 0);
|
|
||||||
// 将 endDate 设置为当天的开始时间并进行比较
|
|
||||||
const endDateAdjusted = new Date(endDate.value);
|
|
||||||
endDateAdjusted.setHours(0, 0, 0, 0);
|
|
||||||
// 仅比较日期部分
|
|
||||||
isNextDisabled.value = endDateAdjusted >= maxDate;
|
|
||||||
emitDateChange(); // 变化时也发出更新事件
|
|
||||||
}
|
|
||||||
|
|
||||||
// 限制开始日期不能选择超过当前日期
|
|
||||||
const disableStartDate = (date:Date)=> {
|
|
||||||
return date > today.value;
|
|
||||||
}
|
|
||||||
// 限制结束日期不能超过当前日期且必须大于开始日期
|
|
||||||
const disableEndDate = (date:Date)=> {
|
|
||||||
if (timeUnit.value !== '自定义') return false; // 如果不是自定义时间单位,则不限制
|
|
||||||
const start = new Date(startDate.value);
|
|
||||||
return date > today.value || (start && date <= start);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在组件挂载时更新日期范围
|
||||||
|
onMounted(() => {
|
||||||
|
updateDateRange()
|
||||||
|
})
|
||||||
|
const handleChange = (unit: string) => {
|
||||||
|
// 根据选择的时间单位处理日期变化
|
||||||
|
if (unit !== '自定义') {
|
||||||
|
updateDateRange()
|
||||||
|
} else {
|
||||||
|
// 自定义选项逻辑
|
||||||
|
startDate.value = new Date(new Date().setDate(new Date().getDate() - 1))
|
||||||
|
endDate.value = new Date()
|
||||||
|
}
|
||||||
|
timeUnit.value = unit
|
||||||
|
emitDateChange() // 变化时也发出更新事件
|
||||||
|
updateNextButtonStatus()
|
||||||
|
}
|
||||||
|
const updateDateRange = () => {
|
||||||
|
|
||||||
|
// 根据选择的时间单位计算起始和结束日期
|
||||||
|
if (timeUnit.value === '日') {
|
||||||
|
startDate.value = today.value
|
||||||
|
endDate.value = today.value
|
||||||
|
} else if (timeUnit.value === '周') {
|
||||||
|
startDate.value = getStartOfWeek(today.value)
|
||||||
|
endDate.value = getEndOfWeek(today.value)
|
||||||
|
|
||||||
|
} else if (timeUnit.value === '月') {
|
||||||
|
// 获取本月的开始和结束日期
|
||||||
|
startDate.value = new Date(today.value.getFullYear(), today.value.getMonth(), 1);
|
||||||
|
endDate.value = new Date(today.value.getFullYear(), today.value.getMonth() + 1, 0);
|
||||||
|
|
||||||
|
// // 确保结束日期不超过今天
|
||||||
|
// if (endDate.value > today.value) {
|
||||||
|
// endDate.value = new Date(today.value);
|
||||||
|
// endDate.value.setHours(23, 59, 59, 999); // 设置结束时间为今天的23:59:59.999
|
||||||
|
// }
|
||||||
|
|
||||||
|
} else if (timeUnit.value === '季度') {
|
||||||
|
const quarter = Math.floor(today.value.getMonth() / 3);
|
||||||
|
startDate.value = new Date(today.value.getFullYear(), quarter * 3, 1);
|
||||||
|
endDate.value = new Date(today.value.getFullYear(), quarter * 3 + 3, 0);
|
||||||
|
|
||||||
|
// // 确保结束日期不超过今天
|
||||||
|
// if (endDate.value > today.value) {
|
||||||
|
// endDate.value = new Date(today.value);
|
||||||
|
// endDate.value.setHours(23, 59, 59, 999); // 设置结束时间为今天的23:59:59.999
|
||||||
|
// }
|
||||||
|
|
||||||
|
} else if (timeUnit.value === '年') {
|
||||||
|
startDate.value = new Date(today.value.getFullYear(), 0, 1);
|
||||||
|
endDate.value = new Date(today.value.getFullYear(), 11, 31);
|
||||||
|
|
||||||
|
// // 确保结束日期不超过今天
|
||||||
|
// if (endDate.value > today.value) {
|
||||||
|
|
||||||
|
// endDate.value = new Date(today.value);
|
||||||
|
// endDate.value.setHours(23, 59, 59, 999); // 设置结束时间为今天的23:59:59.999
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
updateNextButtonStatus()
|
||||||
|
}
|
||||||
|
const getStartOfWeek = (date: Date) => {
|
||||||
|
const startOfWeek = new Date(date)
|
||||||
|
const day = startOfWeek.getDay()
|
||||||
|
const diff = day === 0 ? -6 : 1 - day // 星期天的情况
|
||||||
|
startOfWeek.setDate(startOfWeek.getDate() + diff)
|
||||||
|
return startOfWeek
|
||||||
|
}
|
||||||
|
const getEndOfWeek = (date: Date) => {
|
||||||
|
const endOfWeek = new Date(date)
|
||||||
|
const day = endOfWeek.getDay()
|
||||||
|
const diff = day === 0 ? 0 : 7 - day // 星期天的情况
|
||||||
|
endOfWeek.setDate(endOfWeek.getDate() + diff)
|
||||||
|
|
||||||
|
// 获取今天的日期
|
||||||
|
const today = new Date();
|
||||||
|
today.setHours(23, 59, 59, 999); // 设置今天的结束时间(23:59:59.999)
|
||||||
|
|
||||||
|
// 返回不超过今天的结束时间
|
||||||
|
//return endOfWeek > today ? today : endOfWeek;
|
||||||
|
return endOfWeek
|
||||||
|
}
|
||||||
|
const prevPeriod = () => {
|
||||||
|
const prevStartDate = new Date(startDate.value)
|
||||||
|
const prevEndDate = new Date(endDate.value)
|
||||||
|
|
||||||
|
if (timeUnit.value === '日') {
|
||||||
|
prevStartDate.setDate(prevStartDate.getDate() - 1)
|
||||||
|
prevEndDate.setDate(prevEndDate.getDate() - 1)
|
||||||
|
} else if (timeUnit.value === '周') {
|
||||||
|
prevStartDate.setDate(prevStartDate.getDate() - 7)
|
||||||
|
prevEndDate.setDate(prevEndDate.getDate() - 7)
|
||||||
|
} else if (timeUnit.value === '月') {
|
||||||
|
|
||||||
|
|
||||||
|
prevStartDate.setMonth(prevStartDate.getMonth() - 1)
|
||||||
|
prevEndDate.setMonth(prevEndDate.getMonth() - 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else if (timeUnit.value === '季度') {
|
||||||
|
prevStartDate.setMonth(prevStartDate.getMonth() - 3)
|
||||||
|
prevEndDate.setMonth(prevEndDate.getMonth() - 3)
|
||||||
|
} else if (timeUnit.value === '年') {
|
||||||
|
prevStartDate.setFullYear(prevStartDate.getFullYear() - 1)
|
||||||
|
prevEndDate.setFullYear(prevEndDate.getFullYear() - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
startDate.value = prevStartDate
|
||||||
|
endDate.value = prevEndDate
|
||||||
|
updateNextButtonStatus()
|
||||||
|
}
|
||||||
|
const goToCurrent = () => {
|
||||||
|
if (timeUnit.value !== '自定义') {
|
||||||
|
updateDateRange() // 更新为当前选择时间单位的时间范围
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const nextPeriod = () => {
|
||||||
|
const nextStartDate = new Date(startDate.value)
|
||||||
|
const nextEndDate = new Date(endDate.value)
|
||||||
|
|
||||||
|
if (timeUnit.value === '日') {
|
||||||
|
nextStartDate.setDate(nextStartDate.getDate() + 1)
|
||||||
|
nextEndDate.setDate(nextEndDate.getDate() + 1)
|
||||||
|
} else if (timeUnit.value === '周') {
|
||||||
|
nextStartDate.setDate(nextStartDate.getDate() + 7)
|
||||||
|
nextEndDate.setDate(nextEndDate.getDate() + 7)
|
||||||
|
} else if (timeUnit.value === '月') {
|
||||||
|
nextStartDate.setMonth(nextStartDate.getMonth() + 1)
|
||||||
|
nextEndDate.setMonth(nextEndDate.getMonth() + 1)
|
||||||
|
} else if (timeUnit.value === '季度') {
|
||||||
|
nextStartDate.setMonth(nextStartDate.getMonth() + 3)
|
||||||
|
nextEndDate.setMonth(nextStartDate.getMonth() + 3)
|
||||||
|
} else if (timeUnit.value === '年') {
|
||||||
|
nextStartDate.setFullYear(nextStartDate.getFullYear() + 1)
|
||||||
|
nextEndDate.setFullYear(nextEndDate.getFullYear() + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
startDate.value = nextStartDate
|
||||||
|
endDate.value = nextEndDate
|
||||||
|
updateNextButtonStatus()
|
||||||
|
}
|
||||||
|
const updateNextButtonStatus = () => {
|
||||||
|
|
||||||
|
// 更新下一个按钮的禁用状态
|
||||||
|
const maxDate = new Date() // 假设最新日期为今天
|
||||||
|
// 将 maxDate 设置为当天的开始时间
|
||||||
|
maxDate.setHours(0, 0, 0, 0)
|
||||||
|
// 将 endDate 设置为当天的开始时间并进行比较
|
||||||
|
const endDateAdjusted = new Date(endDate.value)
|
||||||
|
endDateAdjusted.setHours(0, 0, 0, 0)
|
||||||
|
// 仅比较日期部分
|
||||||
|
isNextDisabled.value = endDateAdjusted >= maxDate
|
||||||
|
emitDateChange() // 变化时也发出更新事件
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 限制开始日期不能选择超过当前日期
|
||||||
|
const disableStartDate = (date: Date) => {
|
||||||
|
return date > today.value
|
||||||
|
}
|
||||||
|
// 限制结束日期不能超过当前日期且必须大于开始日期
|
||||||
|
const disableEndDate = (date: Date) => {
|
||||||
|
if (timeUnit.value !== '自定义') return false // 如果不是自定义时间单位,则不限制
|
||||||
|
const start = new Date(startDate.value)
|
||||||
|
return date > today.value || (start && date <= start)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 格式化日期yyyy-mm-dd
|
||||||
|
function formatDate(date:Date) {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ const init = () => {
|
|||||||
ratio: true, //是否显示数值占比,默认不显示
|
ratio: true, //是否显示数值占比,默认不显示
|
||||||
isRing: false, //是否环形图
|
isRing: false, //是否环形图
|
||||||
isRadius: false, //是否圆角
|
isRadius: false, //是否圆角
|
||||||
isSpace: true, //是否显示间隔
|
isSpace: false, //是否显示间隔
|
||||||
isLabelLine: false, //是否显示引导线
|
isLabelLine: true, //是否显示引导线
|
||||||
...props.customData,
|
...props.customData,
|
||||||
};
|
};
|
||||||
legendData.value = {
|
legendData.value = {
|
||||||
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
icon: "roundRect", // 图例项的icon,类型包括 circle(圆形),rect(正方形),//roundRect(圆角正方形),triangle(三角形),diamond(菱形),//pin(大头针行),arrow(箭头形),none(无图例项的icon)
|
||||||
orient: "vertical", //图例排列方向
|
orient: "vertical", //图例排列方向
|
||||||
left: "right", //可选属性left,right,top,bottom,可选属性值 left,right,top,bottom,px,百分比,数值,
|
left: "right", //可选属性left,right,top,bottom,可选属性值 left,right,top,bottom,px,百分比,数值,
|
||||||
itemGap: 0, // 设置图例项之间的间隔为20
|
itemGap: 1, // 设置图例项之间的间隔为20
|
||||||
...props.legendData,
|
...props.legendData,
|
||||||
};
|
};
|
||||||
chart.value = chartsRef.value && echarts.init(chartsRef.value);
|
chart.value = chartsRef.value && echarts.init(chartsRef.value);
|
||||||
@@ -98,8 +98,18 @@ const init = () => {
|
|||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
}, 0);
|
}, 0);
|
||||||
};
|
};
|
||||||
|
const reSize = (widthValue: number,heightValue: number,silentValue: boolean) => {
|
||||||
|
if (chart.value) {
|
||||||
|
chart.value.resize({
|
||||||
|
width: widthValue,
|
||||||
|
height: heightValue,
|
||||||
|
silent: silentValue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
const resizeCharts = () => {
|
const resizeCharts = () => {
|
||||||
console.log(77777);
|
console.log(chart.value,111111);
|
||||||
|
|
||||||
if (chart.value) {
|
if (chart.value) {
|
||||||
chart.value.resize();
|
chart.value.resize();
|
||||||
}
|
}
|
||||||
@@ -128,7 +138,7 @@ watch(
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
defineExpose({ init });
|
defineExpose({ init,reSize });
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.pie {
|
.pie {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ const auth: Directive = {
|
|||||||
const { value } = binding
|
const { value } = binding
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
const currentPageRoles = authStore.authButtonListGet[authStore.routeName] ?? []
|
||||||
|
// console.log('1234',authStore.routeName)
|
||||||
|
// console.log('123',currentPageRoles)
|
||||||
if (value instanceof Array && value.length) {
|
if (value instanceof Array && value.length) {
|
||||||
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
const hasPermission = value.every(item => currentPageRoles.includes(item))
|
||||||
if (!hasPermission) el.remove()
|
if (!hasPermission) el.remove()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async function handleClick(this: any) {
|
|||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(this.copyData);
|
await navigator.clipboard.writeText(this.copyData);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("复制操作不被支持或失败: ", err);
|
|
||||||
}
|
}
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: "success",
|
type: "success",
|
||||||
|
|||||||
@@ -39,6 +39,6 @@ export const useDownload = async (
|
|||||||
document.body.removeChild(exportFile);
|
document.body.removeChild(exportFile);
|
||||||
window.URL.revokeObjectURL(blobUrl);
|
window.URL.revokeObjectURL(blobUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export const useTable = (
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
set: (newVal: any) => {
|
set: (newVal: any) => {
|
||||||
console.log("我是分页更新之后的值", newVal);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default {
|
|||||||
personalData: "Personal Data",
|
personalData: "Personal Data",
|
||||||
changePassword: "Change Password",
|
changePassword: "Change Password",
|
||||||
changeMode:"Change Mode",
|
changeMode:"Change Mode",
|
||||||
|
versionRegister:"Version Register",
|
||||||
logout: "Logout"
|
logout: "Logout"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export default {
|
|||||||
personalData: "个人信息",
|
personalData: "个人信息",
|
||||||
changePassword: "修改密码",
|
changePassword: "修改密码",
|
||||||
changeMode:"模式切换",
|
changeMode:"模式切换",
|
||||||
|
versionRegister:"版本注册",
|
||||||
logout: "退出登录"
|
logout: "退出登录"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
<el-dropdown-item @click="title = '数字式模块'"
|
<el-dropdown-item @click="title = '数字式模块'"
|
||||||
>数字式模块</el-dropdown-item
|
>数字式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item @click="title = '对比式模块'"
|
<el-dropdown-item @click="title = '比对式模块'"
|
||||||
>对比式模块</el-dropdown-item
|
>比对式模块</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,8 +38,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, reactive, computed } from "vue";
|
import { ref, reactive, computed, onMounted, watch } from "vue";
|
||||||
const title = ref("模拟式模块");
|
const title = ref("模拟式模块");
|
||||||
|
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||||
|
|
||||||
|
const modeStore = useModeStore();
|
||||||
|
watch(() => modeStore.currentMode, (newVal) => {
|
||||||
|
//console.log('当前模式:', newVal);
|
||||||
|
switch (newVal) {
|
||||||
|
case '模拟式':
|
||||||
|
title.value = '模拟式模块';
|
||||||
|
break;
|
||||||
|
case '数字式':
|
||||||
|
title.value = '数字式模块';
|
||||||
|
break;
|
||||||
|
case '比对式':
|
||||||
|
title.value = '比对式模块';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
title.value = '模拟式模块';
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "./index.scss";
|
@import "./index.scss";
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
<el-dropdown-item @click="changeMode">
|
<el-dropdown-item @click="changeMode">
|
||||||
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
<el-icon><Edit /></el-icon>{{ $t("header.changeMode") }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item @click="openDialog('versionRegisterRef')">
|
||||||
|
<el-icon><SetUp /></el-icon>{{ $t("header.versionRegister") }}
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
@@ -29,6 +32,8 @@
|
|||||||
<InfoDialog ref="infoRef"></InfoDialog>
|
<InfoDialog ref="infoRef"></InfoDialog>
|
||||||
<!-- passwordDialog -->
|
<!-- passwordDialog -->
|
||||||
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
<PasswordDialog ref="passwordRef"></PasswordDialog>
|
||||||
|
<!-- versionRegisterDialog -->
|
||||||
|
<VersionDialog ref="versionRegisterRef"></VersionDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -40,6 +45,7 @@ import { useUserStore } from "@/stores/modules/user";
|
|||||||
import { ElMessageBox, ElMessage } from "element-plus";
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
import InfoDialog from "./InfoDialog.vue";
|
import InfoDialog from "./InfoDialog.vue";
|
||||||
import PasswordDialog from "./PasswordDialog.vue";
|
import PasswordDialog from "./PasswordDialog.vue";
|
||||||
|
import VersionDialog from "@/views/system/versionRegister/index.vue";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
import { Avatar } from "@element-plus/icons-vue";
|
import { Avatar } from "@element-plus/icons-vue";
|
||||||
import AssemblySize from "./components/AssemblySize.vue";
|
import AssemblySize from "./components/AssemblySize.vue";
|
||||||
@@ -49,10 +55,15 @@ import ThemeSetting from "./components/ThemeSetting.vue";
|
|||||||
import Message from "./components/Message.vue";
|
import Message from "./components/Message.vue";
|
||||||
import Fullscreen from "./components/Fullscreen.vue";
|
import Fullscreen from "./components/Fullscreen.vue";
|
||||||
import { useAuthStore } from "@/stores/modules/auth";
|
import { useAuthStore } from "@/stores/modules/auth";
|
||||||
|
import {useDictStore} from "@/stores/modules/dict";
|
||||||
|
import { useModeStore } from "@/stores/modules/mode";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
const dictStore = useDictStore();
|
||||||
const username = computed(() => userStore.userInfo.name);
|
const username = computed(() => userStore.userInfo.name);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
|
const modeStore = useModeStore();
|
||||||
|
|
||||||
// 退出登录
|
// 退出登录
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
ElMessageBox.confirm("您是否确认退出登录?", "温馨提示", {
|
||||||
@@ -64,6 +75,9 @@ const logout = () => {
|
|||||||
await logoutApi();
|
await logoutApi();
|
||||||
// 2.清除 Token
|
// 2.清除 Token
|
||||||
userStore.setToken("");
|
userStore.setToken("");
|
||||||
|
userStore.setUserInfo({name: ""});
|
||||||
|
dictStore.setDictData([]);
|
||||||
|
modeStore.setCurrentMode('');
|
||||||
// 3.重定向到登陆页
|
// 3.重定向到登陆页
|
||||||
router.replace(LOGIN_URL);
|
router.replace(LOGIN_URL);
|
||||||
ElMessage.success("退出登录成功!");
|
ElMessage.success("退出登录成功!");
|
||||||
@@ -75,9 +89,12 @@ const logout = () => {
|
|||||||
// 打开修改密码和个人信息弹窗
|
// 打开修改密码和个人信息弹窗
|
||||||
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
const infoRef = ref<InstanceType<typeof InfoDialog> | null>(null);
|
||||||
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
const passwordRef = ref<InstanceType<typeof PasswordDialog> | null>(null);
|
||||||
|
const versionRegisterRef = ref<InstanceType<typeof VersionDialog> | null>(null);
|
||||||
|
|
||||||
const openDialog = (ref: string) => {
|
const openDialog = (ref: string) => {
|
||||||
if (ref == "infoRef") infoRef.value?.openDialog();
|
if (ref == "infoRef") infoRef.value?.openDialog();
|
||||||
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
if (ref == "passwordRef") passwordRef.value?.openDialog();
|
||||||
|
if (ref == "versionRegisterRef") versionRegisterRef.value?.openDialog();
|
||||||
};
|
};
|
||||||
//模式切换
|
//模式切换
|
||||||
const changeMode = () => {
|
const changeMode = () => {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
await initDynamicRouter()
|
await initDynamicRouter()
|
||||||
return next({ ...to, replace: true })
|
return next({ ...to, replace: true })
|
||||||
}
|
}
|
||||||
|
//console.log(to)
|
||||||
// 7.存储 routerName 做按钮权限筛选
|
// 7.存储 routerName 做按钮权限筛选
|
||||||
authStore.setRouteName(to.name as string)
|
authStore.setRouteName(to.name as string)
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ export const resetRouter = () => {
|
|||||||
* */
|
* */
|
||||||
router.onError(error => {
|
router.onError(error => {
|
||||||
NProgress.done()
|
NProgress.done()
|
||||||
console.warn('路由错误', error.message)
|
//console.warn('路由错误', error.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export const useAuthStore = defineStore({
|
|||||||
async getAuthMenuList() {
|
async getAuthMenuList() {
|
||||||
const { data } = await getAuthMenuListApi();
|
const { data } = await getAuthMenuListApi();
|
||||||
this.authMenuList = data;
|
this.authMenuList = data;
|
||||||
|
|
||||||
},
|
},
|
||||||
// Set RouteName
|
// Set RouteName
|
||||||
async setRouteName(name: string) {
|
async setRouteName(name: string) {
|
||||||
|
|||||||
@@ -1,22 +1,33 @@
|
|||||||
|
import type { Dict } from './../../api/interface/index'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import piniaPersistConfig from '@/stores/helper/persist'
|
import piniaPersistConfig from '@/stores/helper/persist'
|
||||||
import { DICT_STORE_KEY } from '@/stores/constant'
|
import { DICT_STORE_KEY } from '@/stores/constant'
|
||||||
// 模拟数据
|
// 模拟数据
|
||||||
import dictData from '@/api/system/dictData'
|
//import dictData from '@/api/system/dictData'
|
||||||
|
|
||||||
|
|
||||||
export const useDictStore = defineStore({
|
export const useDictStore = defineStore({
|
||||||
id: DICT_STORE_KEY,
|
id: DICT_STORE_KEY,
|
||||||
state: () => ({
|
state: () => ({
|
||||||
dictData,
|
dictData: [] as Dict[],
|
||||||
}),
|
}),
|
||||||
getters: {},
|
getters: {},
|
||||||
actions: {
|
actions: {
|
||||||
// 获取字典数据数组,如果为空则返回空数组
|
setDictData(data: Dict[]) {
|
||||||
getDictData(code: string) {
|
this.dictData = data
|
||||||
const dict = this.dictData.find(item => item.code === code )
|
},
|
||||||
return dict?.children || []
|
// 获取字典数据数组,如果为空则返回空数组
|
||||||
|
getDictData(code: string) {
|
||||||
|
if (!this.dictData.length) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
const dict = this.dictData.find(item => item.code === code)
|
||||||
|
return dict?.children || []
|
||||||
|
},
|
||||||
|
// 初始化获取全部字典数据并缓存
|
||||||
|
async initDictData(initData: Dict[]) {
|
||||||
|
this.dictData = initData
|
||||||
|
},
|
||||||
},
|
},
|
||||||
// 初始化获取全部字典数据并缓存
|
persist: piniaPersistConfig(DICT_STORE_KEY),
|
||||||
},
|
|
||||||
persist: piniaPersistConfig(DICT_STORE_KEY),
|
|
||||||
})
|
})
|
||||||
|
|||||||
26
frontend/src/stores/modules/mode.ts
Normal file
26
frontend/src/stores/modules/mode.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// src/stores/modules/mode.ts
|
||||||
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
// export const useModeStore = defineStore('mode', {
|
||||||
|
// state: () => ({
|
||||||
|
// currentMode: '' as string,
|
||||||
|
// }),
|
||||||
|
// actions: {
|
||||||
|
// setCurrentMode(modeName: string) {
|
||||||
|
// this.currentMode = modeName;
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
export const useModeStore = defineStore('mode', {
|
||||||
|
state: () => ({
|
||||||
|
currentMode: localStorage.getItem('currentMode') || '' as string,
|
||||||
|
}),
|
||||||
|
actions: {
|
||||||
|
setCurrentMode(modeName: string) {
|
||||||
|
this.currentMode = modeName;
|
||||||
|
localStorage.setItem('currentMode', modeName); // 保存到 localStorage
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -306,8 +306,6 @@
|
|||||||
// font-family:;
|
// font-family:;
|
||||||
|
|
||||||
.el-dialog__headerbtn {
|
.el-dialog__headerbtn {
|
||||||
top: 5px;
|
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
color: var(--el-color-white);
|
color: var(--el-color-white);
|
||||||
}
|
}
|
||||||
@@ -479,4 +477,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cn-render-buttons {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 13px;
|
||||||
|
line-height: 18px;
|
||||||
|
padding: 2px;
|
||||||
|
.icon {
|
||||||
|
font-size: 12px !important;
|
||||||
|
// color: var(--ba-bg-color-overlay) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
311
frontend/src/styles/index.ts
Normal file
311
frontend/src/styles/index.ts
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
import { isArray } from "@/utils/is";
|
||||||
|
import { FieldNamesProps } from "@/components/ProTable/interface";
|
||||||
|
|
||||||
|
const mode = import.meta.env.VITE_ROUTER_MODE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取localStorage
|
||||||
|
* @param {String} key Storage名称
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function localGet(key: string) {
|
||||||
|
const value = window.localStorage.getItem(key);
|
||||||
|
try {
|
||||||
|
return JSON.parse(window.localStorage.getItem(key) as string);
|
||||||
|
} catch (error) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 存储localStorage
|
||||||
|
* @param {String} key Storage名称
|
||||||
|
* @param {*} value Storage值
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function localSet(key: string, value: any) {
|
||||||
|
window.localStorage.setItem(key, JSON.stringify(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 清除localStorage
|
||||||
|
* @param {String} key Storage名称
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function localRemove(key: string) {
|
||||||
|
window.localStorage.removeItem(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 清除所有localStorage
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
export function localClear() {
|
||||||
|
window.localStorage.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 判断数据类型
|
||||||
|
* @param {*} val 需要判断类型的数据
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function isType(val: any) {
|
||||||
|
if (val === null) return "null";
|
||||||
|
if (typeof val !== "object") return typeof val;
|
||||||
|
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 生成唯一 uuid
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function generateUUID() {
|
||||||
|
let uuid = "";
|
||||||
|
for (let i = 0; i < 32; i++) {
|
||||||
|
let random = (Math.random() * 16) | 0;
|
||||||
|
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-";
|
||||||
|
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
|
||||||
|
}
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断两个对象是否相同
|
||||||
|
* @param {Object} a 要比较的对象一
|
||||||
|
* @param {Object} b 要比较的对象二
|
||||||
|
* @returns {Boolean} 相同返回 true,反之 false
|
||||||
|
*/
|
||||||
|
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
||||||
|
if (!a || !b) return false;
|
||||||
|
let aProps = Object.getOwnPropertyNames(a);
|
||||||
|
let bProps = Object.getOwnPropertyNames(b);
|
||||||
|
if (aProps.length != bProps.length) return false;
|
||||||
|
for (let i = 0; i < aProps.length; i++) {
|
||||||
|
let propName = aProps[i];
|
||||||
|
let propA = a[propName];
|
||||||
|
let propB = b[propName];
|
||||||
|
if (!b.hasOwnProperty(propName)) return false;
|
||||||
|
if (propA instanceof Object) {
|
||||||
|
if (!isObjectValueEqual(propA, propB)) return false;
|
||||||
|
} else if (propA !== propB) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 生成随机数
|
||||||
|
* @param {Number} min 最小值
|
||||||
|
* @param {Number} max 最大值
|
||||||
|
* @returns {Number}
|
||||||
|
*/
|
||||||
|
export function randomNum(min: number, max: number): number {
|
||||||
|
let num = Math.floor(Math.random() * (min - max) + max);
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取当前时间对应的提示语
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function getTimeState() {
|
||||||
|
let timeNow = new Date();
|
||||||
|
let hours = timeNow.getHours();
|
||||||
|
if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
|
||||||
|
if (hours >= 10 && hours <= 14) return `中午好 🌞`;
|
||||||
|
if (hours >= 14 && hours <= 18) return `下午好 🌞`;
|
||||||
|
if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
|
||||||
|
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取浏览器默认语言
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function getBrowserLang() {
|
||||||
|
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
|
||||||
|
let defaultBrowserLang = "";
|
||||||
|
if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) {
|
||||||
|
defaultBrowserLang = "zh";
|
||||||
|
} else {
|
||||||
|
defaultBrowserLang = "en";
|
||||||
|
}
|
||||||
|
return defaultBrowserLang;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取不同路由模式所对应的 url + params
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
export function getUrlWithParams() {
|
||||||
|
const url = {
|
||||||
|
hash: location.hash.substring(1),
|
||||||
|
history: location.pathname + location.search
|
||||||
|
};
|
||||||
|
return url[mode];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 使用递归扁平化菜单,方便添加动态路由
|
||||||
|
* @param {Array} menuList 菜单列表
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
|
||||||
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
||||||
|
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 isHide == true 的菜单)
|
||||||
|
* @param {Array} menuList 菜单列表
|
||||||
|
* @returns {Array}
|
||||||
|
* */
|
||||||
|
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
||||||
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
||||||
|
return newMenuList.filter(item => {
|
||||||
|
item.children?.length && (item.children = getShowMenuList(item.children));
|
||||||
|
return !item.meta?.isHide;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 使用递归找出所有面包屑存储到 pinia/vuex 中
|
||||||
|
* @param {Array} menuList 菜单列表
|
||||||
|
* @param {Array} parent 父级菜单
|
||||||
|
* @param {Object} result 处理后的结果
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
|
||||||
|
for (const item of menuList) {
|
||||||
|
result[item.path] = [...parent, item];
|
||||||
|
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
||||||
|
* @param {Array} menuList 所有菜单列表
|
||||||
|
* @param {Array} menuPathArr 菜单地址的一维数组 ['**','**']
|
||||||
|
* @returns {Array}
|
||||||
|
*/
|
||||||
|
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
|
||||||
|
for (const item of menuList) {
|
||||||
|
if (typeof item === "object" && item.path) menuPathArr.push(item.path);
|
||||||
|
if (item.children?.length) getMenuListPath(item.children, menuPathArr);
|
||||||
|
}
|
||||||
|
return menuPathArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 递归查询当前 path 所对应的菜单对象 (该函数暂未使用)
|
||||||
|
* @param {Array} menuList 菜单列表
|
||||||
|
* @param {String} path 当前访问地址
|
||||||
|
* @returns {Object | null}
|
||||||
|
*/
|
||||||
|
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
|
||||||
|
for (const item of menuList) {
|
||||||
|
if (item.path === path) return item;
|
||||||
|
if (item.children) {
|
||||||
|
const res = findMenuByPath(item.children, path);
|
||||||
|
if (res) return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 使用递归过滤需要缓存的菜单 name (该函数暂未使用)
|
||||||
|
* @param {Array} menuList 所有菜单列表
|
||||||
|
* @param {Array} keepAliveNameArr 缓存的菜单 name ['**','**']
|
||||||
|
* @returns {Array}
|
||||||
|
* */
|
||||||
|
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
|
||||||
|
menuList.forEach(item => {
|
||||||
|
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name);
|
||||||
|
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr);
|
||||||
|
});
|
||||||
|
return keepAliveNameArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 格式化表格单元格默认值 (el-table-column)
|
||||||
|
* @param {Number} row 行
|
||||||
|
* @param {Number} col 列
|
||||||
|
* @param {*} callValue 当前单元格值
|
||||||
|
* @returns {String}
|
||||||
|
* */
|
||||||
|
export function formatTableColumn(row: number, col: number, callValue: any) {
|
||||||
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
|
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
||||||
|
return callValue ?? "--";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 处理 ProTable 值为数组 || 无数据
|
||||||
|
* @param {*} callValue 需要处理的值
|
||||||
|
* @returns {String}
|
||||||
|
* */
|
||||||
|
export function formatValue(callValue: any) {
|
||||||
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
|
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
||||||
|
return callValue ?? "--";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
|
||||||
|
* @param {Object} row 当前行数据
|
||||||
|
* @param {String} prop 当前 prop
|
||||||
|
* @returns {*}
|
||||||
|
* */
|
||||||
|
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
||||||
|
if (!prop.includes(".")) return row[prop] ?? "--";
|
||||||
|
prop.split(".").forEach(item => (row = row[item] ?? "--"));
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 处理 prop,当 prop 为多级嵌套时 ==> 返回最后一级 prop
|
||||||
|
* @param {String} prop 当前 prop
|
||||||
|
* @returns {String}
|
||||||
|
* */
|
||||||
|
export function handleProp(prop: string) {
|
||||||
|
const propArr = prop.split(".");
|
||||||
|
if (propArr.length == 1) return prop;
|
||||||
|
return propArr[propArr.length - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 根据枚举列表查询当需要的数据(如果指定了 label 和 value 的 key值,会自动识别格式化)
|
||||||
|
* @param {String} callValue 当前单元格值
|
||||||
|
* @param {Array} enumData 字典列表
|
||||||
|
* @param {Array} fieldNames label && value && children 的 key 值
|
||||||
|
* @param {String} type 过滤类型(目前只有 tag)
|
||||||
|
* @returns {String}
|
||||||
|
* */
|
||||||
|
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
|
||||||
|
const value = fieldNames?.value ?? "value";
|
||||||
|
const label = fieldNames?.label ?? "label";
|
||||||
|
const children = fieldNames?.children ?? "children";
|
||||||
|
let filterData: { [key: string]: any } = {};
|
||||||
|
// 判断 enumData 是否为数组
|
||||||
|
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
|
||||||
|
// 判断是否输出的结果为 tag 类型
|
||||||
|
if (type == "tag") {
|
||||||
|
return filterData?.tagType ? filterData.tagType : "";
|
||||||
|
} else {
|
||||||
|
return filterData ? filterData[label] : "--";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 递归查找 callValue 对应的 enum 值
|
||||||
|
* */
|
||||||
|
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
||||||
|
return enumData.reduce((accumulator: any, current: any) => {
|
||||||
|
if (accumulator) return accumulator;
|
||||||
|
if (current[value] === callValue) return current;
|
||||||
|
if (current[children]) return findItemNested(current[children], callValue, value, children);
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
@@ -19,6 +19,6 @@ export const userStatus = [
|
|||||||
export const resourceType = [
|
export const resourceType = [
|
||||||
{ label: "菜单", value: 0 },
|
{ label: "菜单", value: 0 },
|
||||||
{ label: "按钮", value: 1 },
|
{ label: "按钮", value: 1 },
|
||||||
{ label: "公共资源", value: 2 }
|
{ label: "公共资源", value: 2 },
|
||||||
{ label: "服务间调用资源", value: 3 }
|
{ label: "服务间调用资源", value: 3 }
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const dialogSmall = {
|
export const dialogSmall = {
|
||||||
width:'400px',
|
width:'500px',
|
||||||
closeOnClickModal:false,
|
closeOnClickModal:false,
|
||||||
draggable:true,
|
draggable:true,
|
||||||
class:'dialog-small'
|
class:'dialog-small'
|
||||||
@@ -14,5 +14,5 @@ export const dialogBig = {
|
|||||||
width:'1200px',
|
width:'1200px',
|
||||||
closeOnClickModal:false,
|
closeOnClickModal:false,
|
||||||
draggable:true,
|
draggable:true,
|
||||||
class:'dialog-big'
|
class:'dialog-big',
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { isArray } from "@/utils/is";
|
import { isArray, isNumber } from '@/utils/is'
|
||||||
import { FieldNamesProps } from "@/components/ProTable/interface";
|
import { FieldNamesProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
const mode = import.meta.env.VITE_ROUTER_MODE;
|
const mode = import.meta.env.VITE_ROUTER_MODE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取localStorage
|
* @description 获取localStorage
|
||||||
@@ -9,12 +9,12 @@ const mode = import.meta.env.VITE_ROUTER_MODE;
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function localGet(key: string) {
|
export function localGet(key: string) {
|
||||||
const value = window.localStorage.getItem(key);
|
const value = window.localStorage.getItem(key)
|
||||||
try {
|
try {
|
||||||
return JSON.parse(window.localStorage.getItem(key) as string);
|
return JSON.parse(window.localStorage.getItem(key) as string)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return value;
|
return value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +24,7 @@ export function localGet(key: string) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localSet(key: string, value: any) {
|
export function localSet(key: string, value: any) {
|
||||||
window.localStorage.setItem(key, JSON.stringify(value));
|
window.localStorage.setItem(key, JSON.stringify(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ export function localSet(key: string, value: any) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localRemove(key: string) {
|
export function localRemove(key: string) {
|
||||||
window.localStorage.removeItem(key);
|
window.localStorage.removeItem(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ export function localRemove(key: string) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localClear() {
|
export function localClear() {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,9 +50,9 @@ export function localClear() {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function isType(val: any) {
|
export function isType(val: any) {
|
||||||
if (val === null) return "null";
|
if (val === null) return 'null'
|
||||||
if (typeof val !== "object") return typeof val;
|
if (typeof val !== 'object') return typeof val
|
||||||
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
|
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,13 +60,13 @@ export function isType(val: any) {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function generateUUID() {
|
export function generateUUID() {
|
||||||
let uuid = "";
|
let uuid = ''
|
||||||
for (let i = 0; i < 32; i++) {
|
for (let i = 0; i < 32; i++) {
|
||||||
let random = (Math.random() * 16) | 0;
|
let random = (Math.random() * 16) | 0
|
||||||
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-";
|
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += '-'
|
||||||
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
|
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16)
|
||||||
}
|
}
|
||||||
return uuid;
|
return uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,22 +76,22 @@ export function generateUUID() {
|
|||||||
* @returns {Boolean} 相同返回 true,反之 false
|
* @returns {Boolean} 相同返回 true,反之 false
|
||||||
*/
|
*/
|
||||||
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
||||||
if (!a || !b) return false;
|
if (!a || !b) return false
|
||||||
let aProps = Object.getOwnPropertyNames(a);
|
let aProps = Object.getOwnPropertyNames(a)
|
||||||
let bProps = Object.getOwnPropertyNames(b);
|
let bProps = Object.getOwnPropertyNames(b)
|
||||||
if (aProps.length != bProps.length) return false;
|
if (aProps.length != bProps.length) return false
|
||||||
for (let i = 0; i < aProps.length; i++) {
|
for (let i = 0; i < aProps.length; i++) {
|
||||||
let propName = aProps[i];
|
let propName = aProps[i]
|
||||||
let propA = a[propName];
|
let propA = a[propName]
|
||||||
let propB = b[propName];
|
let propB = b[propName]
|
||||||
if (!b.hasOwnProperty(propName)) return false;
|
if (!b.hasOwnProperty(propName)) return false
|
||||||
if (propA instanceof Object) {
|
if (propA instanceof Object) {
|
||||||
if (!isObjectValueEqual(propA, propB)) return false;
|
if (!isObjectValueEqual(propA, propB)) return false
|
||||||
} else if (propA !== propB) {
|
} else if (propA !== propB) {
|
||||||
return false;
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return true
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,8 +101,8 @@ export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]
|
|||||||
* @returns {Number}
|
* @returns {Number}
|
||||||
*/
|
*/
|
||||||
export function randomNum(min: number, max: number): number {
|
export function randomNum(min: number, max: number): number {
|
||||||
let num = Math.floor(Math.random() * (min - max) + max);
|
let num = Math.floor(Math.random() * (min - max) + max)
|
||||||
return num;
|
return num
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,13 +110,13 @@ export function randomNum(min: number, max: number): number {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function getTimeState() {
|
export function getTimeState() {
|
||||||
let timeNow = new Date();
|
let timeNow = new Date()
|
||||||
let hours = timeNow.getHours();
|
let hours = timeNow.getHours()
|
||||||
if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
|
if (hours >= 6 && hours <= 10) return `早上好 ⛅`
|
||||||
if (hours >= 10 && hours <= 14) return `中午好 🌞`;
|
if (hours >= 10 && hours <= 14) return `中午好 🌞`
|
||||||
if (hours >= 14 && hours <= 18) return `下午好 🌞`;
|
if (hours >= 14 && hours <= 18) return `下午好 🌞`
|
||||||
if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
|
if (hours >= 18 && hours <= 24) return `晚上好 🌛`
|
||||||
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
|
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,14 +124,14 @@ export function getTimeState() {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function getBrowserLang() {
|
export function getBrowserLang() {
|
||||||
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
|
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage
|
||||||
let defaultBrowserLang = "";
|
let defaultBrowserLang = ''
|
||||||
if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) {
|
if (['cn', 'zh', 'zh-cn'].includes(browserLang.toLowerCase())) {
|
||||||
defaultBrowserLang = "zh";
|
defaultBrowserLang = 'zh'
|
||||||
} else {
|
} else {
|
||||||
defaultBrowserLang = "en";
|
defaultBrowserLang = 'en'
|
||||||
}
|
}
|
||||||
return defaultBrowserLang;
|
return defaultBrowserLang
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,11 +139,11 @@ export function getBrowserLang() {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function getUrlWithParams() {
|
export function getUrlWithParams() {
|
||||||
const url = {
|
const url = {
|
||||||
hash: location.hash.substring(1),
|
hash: location.hash.substring(1),
|
||||||
history: location.pathname + location.search
|
history: location.pathname + location.search,
|
||||||
};
|
}
|
||||||
return url[mode];
|
return url[mode]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,8 +152,8 @@ export function getUrlWithParams() {
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
|
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
|
||||||
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList))
|
||||||
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]);
|
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,11 +162,11 @@ export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
* */
|
* */
|
||||||
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
||||||
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList))
|
||||||
return newMenuList.filter(item => {
|
return newMenuList.filter(item => {
|
||||||
item.children?.length && (item.children = getShowMenuList(item.children));
|
item.children?.length && (item.children = getShowMenuList(item.children))
|
||||||
return !item.meta?.isHide;
|
return !item.meta?.isHide
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -177,12 +177,12 @@ export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
|
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
result[item.path] = [...parent, item];
|
result[item.path] = [...parent, item]
|
||||||
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result);
|
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result)
|
||||||
}
|
}
|
||||||
return result;
|
return result
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
||||||
@@ -191,11 +191,11 @@ export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [],
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
|
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
if (typeof item === "object" && item.path) menuPathArr.push(item.path);
|
if (typeof item === 'object' && item.path) menuPathArr.push(item.path)
|
||||||
if (item.children?.length) getMenuListPath(item.children, menuPathArr);
|
if (item.children?.length) getMenuListPath(item.children, menuPathArr)
|
||||||
}
|
}
|
||||||
return menuPathArr;
|
return menuPathArr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,14 +205,14 @@ export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: strin
|
|||||||
* @returns {Object | null}
|
* @returns {Object | null}
|
||||||
*/
|
*/
|
||||||
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
|
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
if (item.path === path) return item;
|
if (item.path === path) return item
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
const res = findMenuByPath(item.children, path);
|
const res = findMenuByPath(item.children, path)
|
||||||
if (res) return res;
|
if (res) return res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
return null
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,11 +222,11 @@ export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
* */
|
* */
|
||||||
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
|
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
|
||||||
menuList.forEach(item => {
|
menuList.forEach(item => {
|
||||||
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name);
|
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name)
|
||||||
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr);
|
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr)
|
||||||
});
|
})
|
||||||
return keepAliveNameArr;
|
return keepAliveNameArr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,9 +237,10 @@ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNa
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function formatTableColumn(row: number, col: number, callValue: any) {
|
export function formatTableColumn(row: number, col: number, callValue: any) {
|
||||||
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
|
||||||
return callValue ?? "--";
|
if (isNumber(callValue)) return callValue
|
||||||
|
return callValue ?? "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,9 +249,10 @@ export function formatTableColumn(row: number, col: number, callValue: any) {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function formatValue(callValue: any) {
|
export function formatValue(callValue: any) {
|
||||||
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
|
||||||
return callValue ?? "--";
|
if (isNumber(callValue)) return callValue
|
||||||
|
return callValue ?? "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,9 +262,9 @@ export function formatValue(callValue: any) {
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
* */
|
* */
|
||||||
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
||||||
if (!prop.includes(".")) return row[prop] ?? "--";
|
if (!prop.includes('.')) return row[prop] ?? '/'
|
||||||
prop.split(".").forEach(item => (row = row[item] ?? "--"));
|
prop.split('.').forEach(item => (row = row[item] ?? '/'))
|
||||||
return row;
|
return row
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,9 +273,9 @@ export function handleRowAccordingToProp(row: { [key: string]: any }, prop: stri
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function handleProp(prop: string) {
|
export function handleProp(prop: string) {
|
||||||
const propArr = prop.split(".");
|
const propArr = prop.split('.')
|
||||||
if (propArr.length == 1) return prop;
|
if (propArr.length == 1) return prop
|
||||||
return propArr[propArr.length - 1];
|
return propArr[propArr.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,28 +286,28 @@ export function handleProp(prop: string) {
|
|||||||
* @param {String} type 过滤类型(目前只有 tag)
|
* @param {String} type 过滤类型(目前只有 tag)
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
|
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: 'tag') {
|
||||||
const value = fieldNames?.value ?? "value";
|
const value = fieldNames?.value ?? 'value'
|
||||||
const label = fieldNames?.label ?? "label";
|
const label = fieldNames?.label ?? 'label'
|
||||||
const children = fieldNames?.children ?? "children";
|
const children = fieldNames?.children ?? 'children'
|
||||||
let filterData: { [key: string]: any } = {};
|
let filterData: { [key: string]: any } = {}
|
||||||
// 判断 enumData 是否为数组
|
// 判断 enumData 是否为数组
|
||||||
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
|
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children)
|
||||||
// 判断是否输出的结果为 tag 类型
|
// 判断是否输出的结果为 tag 类型
|
||||||
if (type == "tag") {
|
if (type == 'tag') {
|
||||||
return filterData?.tagType ? filterData.tagType : "";
|
return filterData?.tagType ? filterData.tagType : ''
|
||||||
} else {
|
} else {
|
||||||
return filterData ? filterData[label] : "--";
|
return filterData ? filterData[label] : '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 递归查找 callValue 对应的 enum 值
|
* @description 递归查找 callValue 对应的 enum 值
|
||||||
* */
|
* */
|
||||||
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
||||||
return enumData.reduce((accumulator: any, current: any) => {
|
return enumData.reduce((accumulator: any, current: any) => {
|
||||||
if (accumulator) return accumulator;
|
if (accumulator) return accumulator
|
||||||
if (current[value] === callValue) return current;
|
if (current[value] === callValue) return current
|
||||||
if (current[children]) return findItemNested(current[children], callValue, value, children);
|
if (current[children]) return findItemNested(current[children], callValue, value, children)
|
||||||
}, null);
|
}, null)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,111 +1,220 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall">
|
<el-dialog :title="dialogTitle" :model-value="dialogVisible" @close="close" v-bind="dialogMiddle">
|
||||||
<el-form :model="formData" ref='formRuleRef' :rules='rules'>
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' >
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="上级菜单" prop="pid" :label-width="100">
|
||||||
<el-input v-model="formData.name" />
|
<el-tree-select
|
||||||
</el-form-item>
|
v-model="displayPid"
|
||||||
<el-form-item label="路径" prop="path">
|
:data="functionList"
|
||||||
<el-input v-model="formData.path" />
|
check-strictly
|
||||||
</el-form-item>
|
:render-after-expand="false"
|
||||||
<el-form-item label="排序" prop="sort">
|
show-checkbox
|
||||||
<el-input-number v-model="formData.sort" />
|
check-on-click-node
|
||||||
</el-form-item>
|
node-key="id"
|
||||||
<el-form-item label="类型" prop="type">
|
:props="defaultProps"
|
||||||
<el-select v-model="formData.type" placeholder="请选择资源类型">
|
|
||||||
<el-option
|
|
||||||
v-for="item in dictStore.getDictData('resourceType')"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.code"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述" prop="remark">
|
<el-form-item label="名称" prop="name" :label-width="100">
|
||||||
<el-input v-model="formData.remark" :rows="2" type="textarea"/>
|
<el-input v-model="formContent.name" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="编码" prop="code" :label-width="100">
|
||||||
|
<el-input v-model="formContent.code" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="图标" prop="icon" :label-width="100">
|
||||||
|
<IconSelect
|
||||||
|
v-model="formContent.icon"
|
||||||
|
:iconValue="formContent.icon"
|
||||||
|
@update:icon-value="iconValue => formContent.icon = iconValue"
|
||||||
|
placeholder="选择一个图标"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="路由地址" prop="path" :label-width="100">
|
||||||
|
<el-input v-model="formContent.path" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="组件地址" prop="component" :label-width="100">
|
||||||
|
<el-input v-model="formContent.component" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort" :label-width="100">
|
||||||
|
<el-input-number v-model="formContent.sort" :min='1' :max='999' />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label='类型' prop='type' :label-width="100">
|
||||||
|
<el-select v-model="formContent.type" clearable placeholder="请选择资源类型">
|
||||||
|
<el-option label="菜单" :value="0"></el-option>
|
||||||
|
<el-option label="按钮" :value="1"></el-option>
|
||||||
|
<!-- <el-option label="公共资源" :value="2"></el-option>
|
||||||
|
<el-option label="服务间调用资源" :value="3"></el-option> -->
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="remark" :label-width="100">
|
||||||
|
<el-input v-model="formContent.remark" :rows="2" type="textarea"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
<el-button @click="close()">取 消</el-button>
|
||||||
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
<el-button type="primary" @click="save()">确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup name="ResourceDialog">
|
<script lang="ts" setup name="ResourceDialog">
|
||||||
import { defineProps, defineEmits,watch,ref, type Ref } from 'vue';
|
import { defineProps, defineEmits,watch,ref, type Ref, computed } from 'vue';
|
||||||
import { dialogSmall } from '@/utils/elementBind'
|
import { dialogMiddle } from '@/utils/elementBind'
|
||||||
import { ElMessage, FormInstance, FormItemRule } from 'element-plus'
|
import { ElMessage, type FormInstance, type FormItemRule } from 'element-plus'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import type { Function } from "@/api/user/interface/function"
|
||||||
|
import {addFunction,updateFunction,getFunctionListNoButton} from '@/api/user/function/index'
|
||||||
|
import IconSelect from '@/components/SelectIcon/index.vue'
|
||||||
|
const value = ref()
|
||||||
|
// 树形节点配置
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'name',
|
||||||
|
value: 'id'
|
||||||
|
};
|
||||||
|
const functionList = ref<Function.ResFunction[]>([])
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const props = defineProps<{
|
// 定义弹出组件元信息
|
||||||
visible: boolean;
|
const dialogFormRef = ref()
|
||||||
dialogTitle: string;
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
formData: {
|
const titleType = ref('add')
|
||||||
id: string;//资源表Id
|
const formContent = ref<Function.ResFunction>({
|
||||||
pid:string;//节点(0为根节点)
|
id: '',//资源表Id
|
||||||
pids?:string;//节点上层所有节点
|
pid:'',//节点(0为根节点)
|
||||||
name: string;//名称
|
pids:'',//节点上层所有节点
|
||||||
code:string;//资源标识
|
name: '',//名称
|
||||||
path:string;//路径
|
code:'',//资源标识
|
||||||
icon?:string;//图标
|
path:'',//路径
|
||||||
sort:number;//排序
|
component:'',
|
||||||
type:number;//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
|
icon:undefined as string | undefined, // 图标
|
||||||
remark?: string;//权限资源描述
|
sort:100,//排序
|
||||||
state:number;//权限资源状态
|
type:0,//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
|
||||||
create_By?:string;//创建人
|
remark: '',//权限资源描述
|
||||||
create_Time?:string;//创建时间
|
state:1,//权限资源状态
|
||||||
update_By?:string;//更新人
|
})
|
||||||
update_Time?:string;//更新时间
|
return { dialogVisible, titleType, formContent }
|
||||||
};
|
}
|
||||||
}>();
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '',//资源表Id
|
||||||
|
pid:'',//节点(0为根节点)
|
||||||
|
pids:'',//节点上层所有节点
|
||||||
|
name: '',//名称
|
||||||
|
code:'',//资源标识
|
||||||
|
path:'',//路径
|
||||||
|
component:'',
|
||||||
|
icon:undefined,//图标
|
||||||
|
sort:100,//排序
|
||||||
|
type:0,//资源类型0-菜单、1-按钮、2-公共资源、3-服务间调用资源
|
||||||
|
remark:'',//权限资源描述
|
||||||
|
state:1,//权限资源状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增菜单' : '编辑菜单'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 定义规则
|
// 定义规则
|
||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
const rules : Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules : Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name :[{required:true,trigger:'blur',message:'菜单名称必填!'}],
|
name :[{required:true,trigger:'blur',message:'菜单名称必填!'}],
|
||||||
path :[{required:true,trigger:'blur',message:'菜单路径必填!'}],
|
code :[{required:true,trigger:'blur',message:'编码必填!'}]
|
||||||
type :[{required:true,trigger:'change',message:'菜单类型必选!'}]
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'update:visible', value: boolean): void;
|
|
||||||
(e: 'submit', data: any): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
//重置表单内容
|
|
||||||
//取消表单校验状态
|
|
||||||
formRuleRef.value && formRuleRef.value.resetFields()
|
|
||||||
emit('update:visible', false); // 关闭对话框
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSubmit = () => {
|
|
||||||
try {
|
|
||||||
formRuleRef.value?.validate((valid: boolean) => {
|
|
||||||
if (valid) {
|
|
||||||
// 将表单数据转为json,发送到后端
|
|
||||||
let confirmFormData = JSON.parse(JSON.stringify(props.formData))
|
|
||||||
emit('submit', props.formData); // 提交表单数据
|
|
||||||
emit('update:visible', false); // 提交后关闭对话框
|
|
||||||
} else {
|
|
||||||
ElMessage.error('表单验证失败!')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}catch (error) {
|
|
||||||
console.error('验证过程中发生错误', error)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
watch(() => formContent.value.type, (newVal) => {
|
||||||
|
if (newVal === 1) {
|
||||||
|
// 选择按钮时,路由地址和组件地址无需校验
|
||||||
|
rules.value.path = [];
|
||||||
|
rules.value.component = [];
|
||||||
|
} else {
|
||||||
|
// 其他情况下,路由地址和组件地址需要校验
|
||||||
|
rules.value.path = [{ required: true, trigger: 'blur', message: '路由地址必填!' }];
|
||||||
|
rules.value.component = [{ required: true, trigger: 'blur', message: '组件地址必填!' }];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当 props.visible 改变时,更新 formData
|
|
||||||
watch(() => props.visible, (newVal) => {
|
// 计算属性,用于控制显示的 pid
|
||||||
if (!newVal) {
|
const displayPid = computed({
|
||||||
// 这里可以重置表单数据,如果需要的话
|
get: () => {
|
||||||
|
return formContent.value.pid === '0' ? '' : formContent.value.pid;
|
||||||
|
},
|
||||||
|
set: (value) => {
|
||||||
|
formContent.value.pid = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
|
||||||
|
if (formContent.value.pid === undefined || formContent.value.pid === null || formContent.value.pid === '') {
|
||||||
|
formContent.value.pid = '0';
|
||||||
|
}
|
||||||
|
if (formContent.value.pids === undefined || formContent.value.pids === null || formContent.value.pids === '') {
|
||||||
|
formContent.value.pids = '0';
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
await updateFunction(formContent.value);
|
||||||
|
} else {
|
||||||
|
await addFunction(formContent.value);
|
||||||
|
}
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: Function.ResFunction) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
const response = await getFunctionListNoButton()
|
||||||
|
functionList.value = response.data as unknown as Function.ResFunction[]
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
if (formContent.value.pid ==='0') {
|
||||||
|
formContent.value.pid = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -3,211 +3,144 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='resourceData'
|
:request-api='getFunctionList'
|
||||||
@selection-change="handleSelectionChange"
|
:pagination="false"
|
||||||
type="selection"
|
|
||||||
>
|
>
|
||||||
|
<!-- :data='userData' -->
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader>
|
<template #tableHeader>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
|
<el-button v-auth.resource="'add'" type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!multipleSelection.length' @click="handleDelList"
|
|
||||||
>
|
|
||||||
批量删除
|
|
||||||
</el-button>
|
|
||||||
</template>
|
|
||||||
<template>
|
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button>
|
<el-button v-auth.testScript="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' @click="deleteResource(scope.row)">删除</el-button>
|
<el-button v-auth.resource="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
<!-- 新增/编辑资源对话框 -->
|
|
||||||
<ResourceDialog
|
|
||||||
:visible="dialogFormVisible"
|
|
||||||
:dialogTitle="dialogTitle"
|
|
||||||
:formData="dialogForm"
|
|
||||||
@update:visible="dialogFormVisible = $event"
|
|
||||||
@submit="submitForm"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
<ResourcePopup :refresh-table='proTable?.getTableList' ref='resourcePopup' />
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='tsx' name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import { defineComponent,ref ,reactive} from 'vue'
|
import { ref ,reactive} from 'vue'
|
||||||
import { type Resource } from '@/api/resource/interface'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import type { Function } from "@/api/user/interface/function"
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import ResourceDialog from "@/views/authority/resource/components/ResourceDialog.vue"; // 导入子组件
|
import {Back, CirclePlus, Delete, EditPen,HomeFilled} from '@element-plus/icons-vue'
|
||||||
import {CirclePlus, Delete, EditPen,HomeFilled} from '@element-plus/icons-vue'
|
|
||||||
import resourceDataList from '@/api/resource/resourceData'
|
|
||||||
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { ElMessage, ElMessageBox, inputEmits } from 'element-plus';
|
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { el } from 'element-plus/es/locale';
|
import ResourcePopup from './components/resourcePopup.vue'
|
||||||
|
import {deleteFunction,getFunctionList} from '@/api/user/function/index'
|
||||||
|
import * as Icons from '@element-plus/icons-vue'
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
let multipleSelection = ref<string[]>([]);
|
const resourcePopup = ref()
|
||||||
const resourceData = resourceDataList
|
|
||||||
const dialogFormVisible = ref(false)
|
|
||||||
const isEditMode = ref(false);
|
|
||||||
const dialogTitle = ref('新增菜单')
|
|
||||||
|
|
||||||
const dialogForm = ref<Resource.ResResourceList>({
|
|
||||||
id: '',
|
|
||||||
pid:'',
|
|
||||||
pids:'',
|
|
||||||
name: '',
|
|
||||||
code:'',
|
|
||||||
path:'',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
type:0,
|
|
||||||
remark: '',
|
|
||||||
state:1,
|
|
||||||
children:[],
|
|
||||||
});
|
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Resource.ResResourceList>[]>([
|
const columns = reactive<ColumnProps<Function.ResFunction>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '名称',
|
label: '名称',
|
||||||
minWidth: 200,
|
minWidth: 150,
|
||||||
search: { el: 'input', tooltip: '我是搜索提示' },
|
align:'left',
|
||||||
|
headerAlign: 'center',
|
||||||
|
search: { el: 'input' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'code',
|
prop: 'code',
|
||||||
label: '资源标识',
|
label: '编码',
|
||||||
minWidth: 100,
|
minWidth: 120,
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'path',
|
|
||||||
label: '路径',
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '类型',
|
label: '类型',
|
||||||
width: 150,
|
width: 100,
|
||||||
enum: dictStore.getDictData('resourceType'),
|
render: (scope) => {
|
||||||
search: { el: 'select', props: { filterable: true } },
|
const typeMap: { [key: number]: { label: string; type: string } } = {
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
0: { label: '菜单', type: 'primary' },
|
||||||
|
1: { label: '按钮', type: 'success' },
|
||||||
|
2: { label: '公共资源', type: 'info' },
|
||||||
|
3: { label: '服务间调用资源', type: 'warning' },
|
||||||
|
};
|
||||||
|
const typeInfo = typeMap[scope.row.type] || { label: '未知', type: 'danger' };
|
||||||
|
return (
|
||||||
|
<el-tag type={typeInfo.type}>{typeInfo.label}</el-tag>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'icon',
|
||||||
|
label: '图标',
|
||||||
|
minWidth: 80,
|
||||||
|
render: scope => {
|
||||||
|
const customIcons: { [key: string]: any } = Icons
|
||||||
|
const iconKey = scope.row.icon; //
|
||||||
|
if (!iconKey || !customIcons[iconKey]) {
|
||||||
|
// 如果 iconKey 为空或未定义,或者 customIcons 中找不到对应的图标,返回一个空的 <span> 标签
|
||||||
|
return <span></span>;
|
||||||
|
}
|
||||||
|
const icon = customIcons[iconKey]; // 如果找不到图标,使用默认图标
|
||||||
|
return (
|
||||||
|
<el-button icon={icon} />
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'path',
|
||||||
|
label: '路由地址',
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'component',
|
||||||
|
label: '组件地址',
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'sort',
|
||||||
|
label: '排序',
|
||||||
|
width: 70,
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
prop: 'state',
|
prop: 'state',
|
||||||
label: '权限资源状态',
|
label: '状态',
|
||||||
minWidth: 120,
|
minWidth: 70,
|
||||||
enum: dictStore.getDictData('status'),
|
|
||||||
fieldNames: { label: 'label', value: 'code' },
|
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<el-tag type={scope.row.state ? 'success' : 'danger'} > {scope.row.state ? '正常' : '禁用'} </el-tag>
|
<el-tag type={scope.row.state ? 'success' : 'danger'} > {scope.row.state ? '正常' : '禁用'} </el-tag>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right',minWidth: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right',width: 200 },
|
||||||
])
|
])
|
||||||
// 打开 drawer(新增、查看、编辑)
|
|
||||||
// 打开新增对话框
|
|
||||||
const openAddDialog = () => {
|
|
||||||
dialogForm.value = {
|
|
||||||
id: '',
|
|
||||||
pid:'',
|
|
||||||
pids:'',
|
|
||||||
name: '',
|
|
||||||
code:'',
|
|
||||||
path:'',
|
|
||||||
icon:'',
|
|
||||||
sort:100,
|
|
||||||
remark: '',
|
|
||||||
state:1,
|
|
||||||
children: [],
|
|
||||||
};
|
|
||||||
isEditMode.value = true;
|
|
||||||
dialogTitle.value = '新增菜单';
|
|
||||||
dialogFormVisible.value = true; // 打开对话框
|
|
||||||
};
|
|
||||||
// 提交表单
|
|
||||||
const submitForm = () => {
|
|
||||||
if (isEditMode.value) {
|
|
||||||
const index = resourceData.value.findIndex((resource: { id: string }) => resource.id === dialogForm.value.id);
|
|
||||||
if (index !== -1) {
|
|
||||||
dialogForm.value.update_Time = formatDate(Date.now()); // 更新为当前时间
|
|
||||||
resourceData.value[index] = { ...dialogForm.value }; // 更新资源
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
resourceData.value.push({ ...dialogForm.value ,id:Date.now().toString()}); // 新增资源
|
|
||||||
}
|
|
||||||
dialogFormVisible.value = false; // 关闭对话框
|
|
||||||
};
|
|
||||||
// 打开编辑对话框
|
|
||||||
const openEditDialog = (resource: Resource.ResResourceList) => {
|
|
||||||
dialogForm.value = { ...resource }; // 复制资源数据以便编辑
|
|
||||||
isEditMode.value = true; // 设置为编辑模式
|
|
||||||
dialogTitle.value = '编辑菜单';
|
|
||||||
dialogFormVisible.value = true; // 显示对话框
|
|
||||||
|
|
||||||
};
|
|
||||||
//选中
|
// 打开 drawer(新增、编辑)
|
||||||
// 处理选择变化
|
const openDialog = (titleType: string, row: Partial<Function.ResFunction> = {}) => {
|
||||||
const handleSelectionChange = (selection:Resource.ResResourceList[]) => {
|
resourcePopup.value?.open(titleType, row)
|
||||||
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
|
||||||
|
}
|
||||||
};
|
|
||||||
//批量删除
|
// 删除菜单信息
|
||||||
const handleDelList =()=>{
|
const handleDelete = async (params: Function.ResFunction) => {
|
||||||
ElMessageBox.confirm(
|
await useHandleData(deleteFunction, params , `删除【${params.name}】菜单`)
|
||||||
`是否删除所选菜单信息?`, // 使用模板字符串来插值
|
proTable.value?.getTableList()
|
||||||
'温馨提示',
|
}
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
// 批量删除菜单信息
|
||||||
}
|
const batchDelete = async (id: string[]) => {
|
||||||
)
|
await useHandleData(deleteFunction, { id }, '删除所选菜单信息')
|
||||||
.then(() => {
|
proTable.value?.clearSelection()
|
||||||
resourceData.value = resourceData.value.filter(item => !multipleSelection.value.includes(item.id));
|
proTable.value?.getTableList()
|
||||||
multipleSelection.value = []; // Clear selected rows
|
|
||||||
ElMessage.success("批量删除成功");
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// 删除资源
|
|
||||||
const deleteResource = (params: Resource.ResResourceList) => {
|
|
||||||
ElMessageBox.confirm(
|
|
||||||
`是否删除【${params.name}】菜单?`, // 使用模板字符串来插值
|
|
||||||
'温馨提示',
|
|
||||||
{
|
|
||||||
confirmButtonText: '确定',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(() => {
|
|
||||||
resourceData.value = resourceData.value.filter(item => item.id !== params.id); // 过滤掉被删除的资源
|
|
||||||
ElMessage({
|
|
||||||
type: 'success',
|
|
||||||
message: `删除${params.name}成功!`
|
|
||||||
})
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const formatDate = (timestamp: string|number|Date) => {
|
|
||||||
const date = new Date(timestamp);
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始
|
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
|
||||||
const hours = String(date.getHours()).padStart(2, '0');
|
|
||||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
||||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
||||||
|
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- 权限信息弹出框 -->
|
|
||||||
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
|
||||||
<div>
|
|
||||||
<el-transfer v-model="value" :data="data.permissionList" :titles="['未具备的权限', '已具备的权限']"/>
|
|
||||||
</div>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="handleCancel">取消</el-button>
|
|
||||||
<el-button type="primary" @click="handleCancel">
|
|
||||||
保存
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { Role } from '@/api/role/interface'
|
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
|
||||||
const {dialogVisible,data} = defineProps<{
|
|
||||||
dialogVisible: boolean;
|
|
||||||
title: string;
|
|
||||||
data: Role.ResRoleList;
|
|
||||||
}>()
|
|
||||||
|
|
||||||
// const leftvalue = ref<Role.Permission[]>([])
|
|
||||||
// const rightvalue = ref<Role.Permission[]>([])
|
|
||||||
|
|
||||||
// const rightvalue = computed<Role.Permission[]>({
|
|
||||||
// get(){
|
|
||||||
// return data.permissionList?.filter(item => item.disabled) || []
|
|
||||||
// },
|
|
||||||
// set: (value: Role.Permission[]) => {
|
|
||||||
// if (data.permissionList) {
|
|
||||||
// for(let i = 0;i<value.length;i++){
|
|
||||||
// for(let j = 0;j<(data.permissionList?.length);j++){
|
|
||||||
// if(value[i].key === data.permissionList[j].key)
|
|
||||||
// {
|
|
||||||
// data.permissionList[j].disabled = value[i].disabled
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
// const leftvalue = computed<Role.Permission[]>({
|
|
||||||
// get(){
|
|
||||||
// return data.permissionList?.filter(item => item.disabled === false) || []
|
|
||||||
// },
|
|
||||||
// set: (value: Role.Permission[]) => {
|
|
||||||
// if (data.permissionList) {
|
|
||||||
// for(let i = 0;i<value.length;i++){
|
|
||||||
// for(let j = 0;j<(data.permissionList?.length);j++){
|
|
||||||
// if(value[i].key === data.permissionList[j].key)
|
|
||||||
// {
|
|
||||||
// data.permissionList[j].disabled = value[i].disabled
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
|
|
||||||
const value = ref()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e:'update:visible',value:boolean):void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
emit('update:visible',false)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,40 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" :title="title" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogSmall" @close="close" >
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-form :model="data"
|
<el-form :model="formContent"
|
||||||
ref='formRuleRef'
|
ref='dialogFormRef'
|
||||||
:rules='rules'
|
:rules='rules'
|
||||||
>
|
>
|
||||||
<el-form-item label="名称" prop='name' :label-width="100">
|
<el-form-item label="名称" prop='name' :label-width="100" >
|
||||||
<el-input v-model="data.name" placeholder="请输入名称" autocomplete="off" />
|
<el-input v-model="formContent.name" placeholder="请输入名称" autocomplete="off" :disabled="rootIsEdit"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="编码" prop='code' :label-width="100">
|
<el-form-item label="编码" prop='code' :label-width="100">
|
||||||
<el-input v-model="data.code" placeholder="请输入编码" autocomplete="off" />
|
<el-input v-model="formContent.code" placeholder="请输入编码" autocomplete="off" :disabled="rootIsEdit"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label='类型' prop='type' :label-width="100">
|
||||||
<el-form-item label="类型" prop='type' :label-width="100">
|
<el-select v-model="formContent.type" clearable placeholder="请选择类型" :disabled="rootIsEdit">
|
||||||
<el-select v-model="data.type" placeholder="请选择类型" autocomplete="off">
|
<el-option label="普通角色" :value="2"></el-option>
|
||||||
<el-option
|
<el-option label="管理员角色" :value="1"></el-option>
|
||||||
v-for="item in dictStore.getDictData('roleType')"
|
<el-option label="超级管理员" :value="0" v-if="rootIsShow"></el-option>
|
||||||
:key="item.id"
|
</el-select>
|
||||||
:label="item.label"
|
</el-form-item>
|
||||||
:value="item.code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="描述" prop='remark' :label-width="100">
|
<el-form-item label="描述" prop='remark' :label-width="100">
|
||||||
<el-input v-model="data.remark" :rows="2" type="textarea" placeholder="请输入备注" autocomplete="off" />
|
<el-input v-model="formContent.remark" :rows="2" type="textarea" placeholder="请输入备注" autocomplete="off" :disabled="rootIsEdit"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="handleCancel">取消</el-button>
|
<el-button @click="close()">取消</el-button>
|
||||||
<el-button type="primary" @click="handleOK">
|
<el-button type="primary" @click="save()" :disabled="rootIsEdit">
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,95 +39,124 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { FormInstance,FormItemRule } from 'element-plus'
|
import{ ElMessage, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
import { ProTableInstance } from '@/components/ProTable/interface'
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import { ref,computed } from 'vue'
|
import { ref,computed, Ref } from 'vue'
|
||||||
import { Role } from '@/api/role/interface'
|
import { type Role } from '@/api/user/interface/role'
|
||||||
import {dialogSmall} from '@/utils/elementBind'
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import {
|
import {addRole,editRole} from '@/api/user/role'
|
||||||
addRole,
|
|
||||||
editRole,
|
|
||||||
} from '@/api/role/role'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
//超级管理员有3个下拉框,其他两个
|
||||||
|
const rootIsShow = ref(false)
|
||||||
|
//超级管理员下拉框不可编辑
|
||||||
|
const rootIsEdit = ref(false)
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<Role.RoleBO>({
|
||||||
|
id: '', //角色类型ID
|
||||||
|
name: '', //角色类型名称
|
||||||
|
code: '', //角色代码
|
||||||
|
type: 2, //角色类型
|
||||||
|
remark:'', //角色描述
|
||||||
|
state:1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
|
|
||||||
const {dialogVisible,title,data,openType,getTableList} = defineProps<{
|
|
||||||
dialogVisible:boolean;
|
// 清空formContent
|
||||||
title:string;
|
const resetFormContent = () => {
|
||||||
openType:string;
|
formContent.value = {
|
||||||
getTableList:Function;
|
id: '', //角色类型ID
|
||||||
data:{
|
name: '', //角色类型名称
|
||||||
id?: string; //角色类型ID
|
code: '', //角色代码
|
||||||
name: string; //角色类型名称
|
type: 2, //角色类型
|
||||||
code: string; //角色代码
|
remark:'', //角色描述
|
||||||
type: number;
|
state:1,
|
||||||
remark:string; //角色描述
|
|
||||||
}
|
}
|
||||||
}>();
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增角色' : '编辑角色'
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//定义规则
|
//定义规则
|
||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
//定义校验规则
|
//定义校验规则
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: '名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '名称必填!', trigger: 'blur' },
|
||||||
|
{ pattern: /^[\u4e00-\u9fa5]{1,20}$/, message: '名称为长度1-20的中文', trigger: 'blur' }],
|
||||||
code: [{ required: true, message: '编码必填!', trigger: 'blur' }],
|
code: [{ required: true, message: '编码必填!', trigger: 'blur' }],
|
||||||
|
type: { required: true, message: '类型必选!', trigger: 'change' },
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e:'update:visible',value:boolean):void;
|
// 关闭弹窗
|
||||||
}>();
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
const handleCancel = () => {
|
// 清空dialogForm中的值
|
||||||
emit('update:visible',false)
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOK = () => {
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
ElMessage.info('角色数据提交')
|
|
||||||
try {
|
try {
|
||||||
formRuleRef.value?.validate((valid: boolean) => {
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 将表单数据转为json,发送到后端
|
if (formContent.value.id) {
|
||||||
// let confirmFormData = JSON.parse(JSON.stringify(form.value))
|
await editRole(formContent.value);
|
||||||
// console.log(confirmFormData)
|
} else {
|
||||||
if(openType === "add")
|
await addRole(formContent.value);
|
||||||
{
|
}
|
||||||
addRole(data).then(res => {
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
// if(res.code === "200")
|
close()
|
||||||
// {
|
// 刷新表格
|
||||||
ElMessage.success(res.message)
|
await props.refreshTable!()
|
||||||
getTableList()
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// ElMessage.error(res.message)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
if(openType === "edit")
|
} catch (err) {
|
||||||
{
|
//error('验证过程中出现错误', err)
|
||||||
editRole(data).then(res => {
|
}
|
||||||
// if(res.code === "200")
|
|
||||||
// {
|
|
||||||
ElMessage.success(res.message)
|
|
||||||
getTableList()
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// ElMessage.error(res.message)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
emit('update:visible',false)
|
|
||||||
} else {
|
|
||||||
ElMessage.error('表单验证失败!')
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error('验证过程中发生错误', error)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: Role.RoleBO) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
|
||||||
|
if(data.type == 0){
|
||||||
|
rootIsShow.value = true
|
||||||
|
rootIsEdit.value = true
|
||||||
|
}else{
|
||||||
|
rootIsShow.value = false
|
||||||
|
rootIsEdit.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" :title="dialogTitle" v-bind="dialogMiddle" @close="close" >
|
||||||
|
<div>
|
||||||
|
<el-form :model="formContent" ref='dialogFormRef'>
|
||||||
|
<el-tree
|
||||||
|
:data="functionList"
|
||||||
|
:props="defaultProps"
|
||||||
|
node-key="id"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
show-checkbox
|
||||||
|
:default-checked-keys="checkedKeysRef"
|
||||||
|
ref="treeRef"
|
||||||
|
>
|
||||||
|
</el-tree>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="close()">取消</el-button>
|
||||||
|
<el-button type="primary" @click="save()">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import{ ElMessage, ElTree, type FormInstance,type FormItemRule } from 'element-plus'
|
||||||
|
import type { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed, type Ref, nextTick } from 'vue'
|
||||||
|
import { Role } from '@/api/user/interface/role'
|
||||||
|
import {dialogMiddle,dialogSmall} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { type Function } from '@/api/user/function/interface'
|
||||||
|
import {getRoleFunction,assignFunction} from '@/api/user/role/index'
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const treeRef = ref<InstanceType<typeof ElTree>>()
|
||||||
|
const functionList = ref<Function.ResFunction[]>([])
|
||||||
|
// 定义一个 ref 来存储已选中的 keys
|
||||||
|
const checkedKeysRef = ref<string[]>([]);
|
||||||
|
// 树形节点配置
|
||||||
|
const defaultProps = {
|
||||||
|
children: 'children',
|
||||||
|
label: 'name',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 定义弹出组件元信息
|
||||||
|
const dialogFormRef = ref()
|
||||||
|
const dialogTitle = ref('授权资源')
|
||||||
|
const { dialogVisible, formContent } = useMetaInfo()
|
||||||
|
|
||||||
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
|
||||||
|
const formContent = ref<Role.RoleBO>({
|
||||||
|
id: '', //角色类型ID
|
||||||
|
name: '', //角色类型名称
|
||||||
|
code: '', //角色代码
|
||||||
|
type: 2, //角色类型
|
||||||
|
remark:'', //角色描述
|
||||||
|
state:1,
|
||||||
|
})
|
||||||
|
return { dialogVisible, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 清空formContent
|
||||||
|
const resetFormContent = () => {
|
||||||
|
formContent.value = {
|
||||||
|
id: '', //角色类型ID
|
||||||
|
name: '', //角色类型名称
|
||||||
|
code: '', //角色代码
|
||||||
|
type: 2, //角色类型
|
||||||
|
remark:'', //角色描述
|
||||||
|
state:1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 关闭弹窗
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 清空dialogForm中的值
|
||||||
|
resetFormContent()
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存数据
|
||||||
|
const save = () => {
|
||||||
|
try {
|
||||||
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
if (formContent.value.id) {
|
||||||
|
// 获取半选中的节点 ID
|
||||||
|
const halfCheckedKeys = treeRef.value?.getHalfCheckedKeys() || [];
|
||||||
|
// 获取全选中的节点 ID
|
||||||
|
const checkedKeys = treeRef.value?.getCheckedKeys() || [];
|
||||||
|
// 将两个数组合并
|
||||||
|
const allCheckedKeys = [...halfCheckedKeys, ...checkedKeys];
|
||||||
|
|
||||||
|
// 将 checkedKeys 转换为字符串数组
|
||||||
|
const checkedKeysAsString: string[] = allCheckedKeys.map(key => String(key));
|
||||||
|
// 假设 RoleFunctionId 是一个对象,且需要 id 属性
|
||||||
|
const roleFunctionIdObject: Role.RoleFunctionId = {
|
||||||
|
id: checkedKeysAsString
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await assignFunction(formContent.value,roleFunctionIdObject);
|
||||||
|
if(result.code != 'A0000'){
|
||||||
|
ElMessage.error({ message: result.message})
|
||||||
|
}else{
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string, data: Role.RoleBO, AllFunction: Function.ResFunction[]) => {
|
||||||
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
|
// 重置树状结构
|
||||||
|
functionList.value = []
|
||||||
|
checkedKeysRef.value = []
|
||||||
|
const result = await getRoleFunction(data);
|
||||||
|
if (result.code === 'A0000') {
|
||||||
|
// 将 result.data 转换为 Function.ResFunction[] 类型
|
||||||
|
const roleFunctions = result.data as Function.ResFunction[];
|
||||||
|
// 获取 AllFunction 中所有层级的 id
|
||||||
|
const allIds = getAllIds(AllFunction);
|
||||||
|
// 匹配 roleFunctions 中的 id 并设置 checkedKeys
|
||||||
|
const checkedKeys = allIds.filter(id => roleFunctions.some(roleFunc => roleFunc.id === id));
|
||||||
|
|
||||||
|
// 过滤出叶子节点
|
||||||
|
const leafCheckedKeys = filterLeafNodes(AllFunction, checkedKeys);
|
||||||
|
|
||||||
|
// 设置 functionList 和 checkedKeys
|
||||||
|
functionList.value = AllFunction;
|
||||||
|
checkedKeysRef.value = leafCheckedKeys;
|
||||||
|
|
||||||
|
// nextTick(() => {
|
||||||
|
// // 触发一次更新,确保表单中的数据被更新
|
||||||
|
// dialogFormRef.value?.validate();
|
||||||
|
// });
|
||||||
|
} else {
|
||||||
|
ElMessage.error({ message: result.message });
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogVisible.value = true;
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data };
|
||||||
|
} else {
|
||||||
|
resetFormContent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const filterLeafNodes = (functions: Function.ResFunction[], checkedKeys: string[]): string[] => {
|
||||||
|
const leafNodes: string[] = [];
|
||||||
|
const isLeafNode = (func: Function.ResFunction) => !func.children || func.children.length === 0;
|
||||||
|
|
||||||
|
const traverse = (funcs: Function.ResFunction[]) => {
|
||||||
|
for (const func of funcs) {
|
||||||
|
if (isLeafNode(func)) {
|
||||||
|
if (checkedKeys.includes(func.id)) {
|
||||||
|
leafNodes.push(func.id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
traverse(func.children);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
traverse(functions);
|
||||||
|
return leafNodes;
|
||||||
|
};
|
||||||
|
const getAllIds = (functions: Function.ResFunction[]): string[] => {
|
||||||
|
const ids: string[] = [];
|
||||||
|
|
||||||
|
const traverse = (func: Function.ResFunction) => {
|
||||||
|
ids.push(func.id);
|
||||||
|
if (func.children && func.children.length > 0) {
|
||||||
|
func.children.forEach((child: any) => traverse(child));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
functions.forEach(func => traverse(func));
|
||||||
|
|
||||||
|
return ids;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user