解决冲突 frontend/src/api/index.ts
This commit is contained in:
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);
|
||||||
@@ -20,5 +20,5 @@ VITE_API_URL=/api
|
|||||||
# 开发环境跨域代理,支持配置多个
|
# 开发环境跨域代理,支持配置多个
|
||||||
|
|
||||||
VITE_PROXY=[["/api","http://192.168.1.124: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/"]]张文
|
||||||
|
|||||||
@@ -108,15 +108,6 @@ class RequestHttp {
|
|||||||
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" });
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description 批量导入专用请求方法
|
|
||||||
*/
|
|
||||||
batchImport<T>(url: string, formData: FormData, _object = {}): Promise<ResultData<T>> {
|
|
||||||
return this.service.post(url, formData, {
|
|
||||||
..._object,
|
|
||||||
headers: { 'Content-Type': 'multipart/form-data' }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"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..."
|
||||||
@@ -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..."
|
||||||
@@ -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..."
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export namespace Plan {
|
|||||||
// 检测计划 + 检测源
|
// 检测计划 + 检测源
|
||||||
export interface PlanAndSourceBO extends PlanBO {
|
export interface PlanAndSourceBO extends PlanBO {
|
||||||
testSourceName: string;//计划所属检测源
|
testSourceName: string;//计划所属检测源
|
||||||
|
testSourceList?: string[];//临时测试
|
||||||
}
|
}
|
||||||
// // 检测计划列表
|
// // 检测计划列表
|
||||||
// export interface PlanList {
|
// export interface PlanList {
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ const planData = ref<Plan.PlanAndSourceBO[]>([
|
|||||||
'test_State':'1',
|
'test_State':'1',
|
||||||
'report_State':'1',
|
'report_State':'1',
|
||||||
'result':'1',
|
'result':'1',
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '2',
|
'id': '2',
|
||||||
@@ -191,6 +192,9 @@ const planData = ref<Plan.PlanAndSourceBO[]>([
|
|||||||
'test_State':'2',
|
'test_State':'2',
|
||||||
'report_State':'2',
|
'report_State':'2',
|
||||||
'result':'0',
|
'result':'0',
|
||||||
|
"testSourceList":[
|
||||||
|
'高精度设备-PQV520-1','高精度设备-PQV520-2',
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'id': '3',
|
'id': '3',
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { isArray } from "@/utils/is";
|
import { isArray } 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,9 @@ 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 ?? "--";
|
return (callValue && callValue.length > 0) ? callValue : '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,9 +248,9 @@ 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 ?? "--";
|
return (callValue && callValue.length > 0) ? callValue : '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,9 +260,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 +271,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 +284,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)
|
||||||
}
|
}
|
||||||
|
|||||||
136
frontend/src/views/home/components/changeErrSysPopup.vue
Normal file
136
frontend/src/views/home/components/changeErrSysPopup.vue
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" title="误差体系编辑" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||||
|
<div>
|
||||||
|
<el-form :model="data"
|
||||||
|
ref='formRuleRef'
|
||||||
|
:rules='rules'
|
||||||
|
>
|
||||||
|
<el-form-item label="设备名称" prop='name' :label-width="100">
|
||||||
|
<el-input v-model="data.name" placeholder="请输入名称" autocomplete="off" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="选择误差体系" prop='type' :label-width="100">
|
||||||
|
<el-select v-model="data.type" placeholder="请选择误差体系" autocomplete="off">
|
||||||
|
<el-option
|
||||||
|
v-for="item in dictStore.getDictData('roleType')"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.code"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-button type="primary" @click="handleOK">
|
||||||
|
生成报告
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- <el-form-item label="描述" prop='remark' :label-width="100">
|
||||||
|
<el-input v-model="data.remark" :rows="2" type="textarea" placeholder="请输入备注" autocomplete="off" />
|
||||||
|
</el-form-item> -->
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="handleCancel">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleOK">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { FormInstance,FormItemRule } from 'element-plus'
|
||||||
|
import { ProTableInstance } from '@/components/ProTable/interface'
|
||||||
|
import { ref,computed } from 'vue'
|
||||||
|
import { Role } from '@/api/role/interface'
|
||||||
|
import {dialogSmall} from '@/utils/elementBind'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
addRole,
|
||||||
|
editRole,
|
||||||
|
} from '@/api/role/role'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const {dialogVisible,title,data,openType,getTableList} = defineProps<{
|
||||||
|
dialogVisible:boolean;
|
||||||
|
title:string;
|
||||||
|
openType:string;
|
||||||
|
getTableList:Function;
|
||||||
|
data:{
|
||||||
|
id?: string; //角色类型ID
|
||||||
|
name: string; //角色类型名称
|
||||||
|
code: string; //角色代码
|
||||||
|
type: number;
|
||||||
|
remark:string; //角色描述
|
||||||
|
}
|
||||||
|
}>();
|
||||||
|
|
||||||
|
|
||||||
|
//定义规则
|
||||||
|
const formRuleRef = ref<FormInstance>()
|
||||||
|
//定义校验规则
|
||||||
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
|
name: [{ required: true, message: '名称必填!', trigger: 'blur' }],
|
||||||
|
code: [{ required: true, message: '编码必填!', trigger: 'blur' }],
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e:'update:visible',value:boolean):void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
emit('update:visible',false)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleOK = () => {
|
||||||
|
|
||||||
|
ElMessage.info('角色数据提交')
|
||||||
|
try {
|
||||||
|
formRuleRef.value?.validate((valid: boolean) => {
|
||||||
|
if (valid) {
|
||||||
|
// 将表单数据转为json,发送到后端
|
||||||
|
// let confirmFormData = JSON.parse(JSON.stringify(form.value))
|
||||||
|
// console.log(confirmFormData)
|
||||||
|
if(openType === "add")
|
||||||
|
{
|
||||||
|
addRole(data).then(res => {
|
||||||
|
// if(res.code === "200")
|
||||||
|
// {
|
||||||
|
ElMessage.success(res.message)
|
||||||
|
getTableList()
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// ElMessage.error(res.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if(openType === "edit")
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -55,13 +55,13 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
@click="handleTest"
|
@click="handleTest"
|
||||||
v-if="form.activeTabs === 0"
|
v-if="form.activeTabs === 0"
|
||||||
>启动自动检测</el-button
|
>自动检测</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="handleTest"
|
@click="handleTest"
|
||||||
v-if="form.activeTabs === 1"
|
v-if="form.activeTabs === 0"
|
||||||
>启动手动检测</el-button
|
>手动检测</el-button
|
||||||
>
|
>
|
||||||
<el-button type="primary" v-if="form.activeTabs === 2"
|
<el-button type="primary" v-if="form.activeTabs === 2"
|
||||||
>不合格项复检</el-button
|
>不合格项复检</el-button
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<el-button type="primary" v-if="form.activeTabs === 3"
|
<el-button type="primary" v-if="form.activeTabs === 3"
|
||||||
>批量生成报告</el-button
|
>报告批量生成</el-button
|
||||||
>
|
>
|
||||||
|
|
||||||
<el-button type="primary" v-if="form.activeTabs === 4"
|
<el-button type="primary" v-if="form.activeTabs === 4"
|
||||||
@@ -81,29 +81,31 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<!-- <template #operation="scope">
|
<template #operation="scope">
|
||||||
<el-button
|
<el-button
|
||||||
dictType="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
:icon="View"
|
:icon="View"
|
||||||
@click="openDrawer('查看', scope.row)"
|
@click="openDrawer('报告查看', scope.row)"
|
||||||
>查看</el-button
|
v-if="form.activeTabs === 3"
|
||||||
|
>报告查看</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<el-button
|
||||||
dictType="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
:icon="EditPen"
|
:icon="EditPen"
|
||||||
@click="openDrawer('编辑', scope.row)"
|
@click="openDrawer('误差体系编辑', scope.row)"
|
||||||
>导出</el-button
|
v-if="form.activeTabs === 5"
|
||||||
|
>误差体系编辑</el-button
|
||||||
>
|
>
|
||||||
<el-button
|
<!-- <el-button
|
||||||
dictType="primary"
|
dictType="primary"
|
||||||
link
|
link
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
@click="deleteAccount(scope.row)"
|
@click="deleteAccount(scope.row)"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
> -->
|
||||||
</template> -->
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -116,7 +118,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
|||||||
import ProTable from "@/components/ProTable/index.vue";
|
import ProTable from "@/components/ProTable/index.vue";
|
||||||
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
import {
|
import {
|
||||||
Search,
|
Search,View,EditPen
|
||||||
} from "@element-plus/icons-vue";
|
} from "@element-plus/icons-vue";
|
||||||
import { getPlanList } from "@/api/plan/planList";
|
import { getPlanList } from "@/api/plan/planList";
|
||||||
import deviceDataList from '@/api/device/deviceData'
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
@@ -129,7 +131,7 @@ const tableHeight = ref(0);
|
|||||||
console.log(window.innerHeight, "+++++++++");
|
console.log(window.innerHeight, "+++++++++");
|
||||||
tableHeight.value = window.innerHeight - 630;
|
tableHeight.value = window.innerHeight - 630;
|
||||||
const deviceData = deviceDataList.plan_devicedata
|
const deviceData = deviceDataList.plan_devicedata
|
||||||
|
const operationShow = ref(false);
|
||||||
//下拉框数据
|
//下拉框数据
|
||||||
//检测状态数据
|
//检测状态数据
|
||||||
let checkStatusList = reactive([
|
let checkStatusList = reactive([
|
||||||
@@ -305,29 +307,29 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'reCheck_Num',
|
prop: 'reCheck_Num',
|
||||||
label: '复检次数',
|
label: '复检次数',
|
||||||
minWidth: 70,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'report_State',
|
prop: 'report_State',
|
||||||
label: '报告状态',
|
label: '报告状态',
|
||||||
minWidth: 130,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'check_Result',
|
prop: 'check_Result',
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
minWidth: 130,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'check_State',
|
prop: 'check_State',
|
||||||
label: '检测状态',
|
label: '检测状态',
|
||||||
minWidth: 130,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'document_State',
|
prop: 'document_State',
|
||||||
label: '归档状态',
|
label: '归档状态',
|
||||||
minWidth: 130,
|
minWidth: 100,
|
||||||
},
|
},
|
||||||
// { prop: 'operation', label: '操作', fixed: 'right', minWidth: 200 },
|
{ prop: 'operation', label: '操作', fixed: 'right', minWidth: 150 ,isShow: operationShow},
|
||||||
])
|
])
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
@@ -567,36 +569,41 @@ function tableHeaderInit(val: number) {
|
|||||||
form.value.checkResult = 0;//检测结果默认为未出结果
|
form.value.checkResult = 0;//检测结果默认为未出结果
|
||||||
disableCheckStatus("检测中")
|
disableCheckStatus("检测中")
|
||||||
disableCheckStatus("归档")
|
disableCheckStatus("归档")
|
||||||
|
operationShow.value = false;
|
||||||
break;
|
break;
|
||||||
case 2://设备复检
|
case 2://设备复检
|
||||||
form.value.checkStatus = 2;//检测状态默认为检测完成
|
form.value.checkStatus = 2;//检测状态默认为检测完成
|
||||||
form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告
|
form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告
|
||||||
form.value.checkResult = 1;//检测结果默认为不合格
|
form.value.checkResult = 1;//检测结果默认为不合格
|
||||||
disableCheckStatus("未检")
|
disableCheckStatus("未检测")
|
||||||
disableCheckStatus("检测中")
|
disableCheckStatus("检测中")
|
||||||
disableCheckStatus("归档")
|
disableCheckStatus("归档")
|
||||||
disablecheckResultList("未出结果")
|
disablecheckResultList("未出结果")
|
||||||
|
operationShow.value = false;
|
||||||
break;
|
break;
|
||||||
case 3://报告生成
|
case 3://报告生成
|
||||||
form.value.checkStatus = 2;//检测状态默认为检测完成
|
form.value.checkStatus = 2;//检测状态默认为检测完成
|
||||||
form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告
|
form.value.checkReportStatus = 0;//检测报告状态默认为未生成报告
|
||||||
form.value.checkResult = 2;//检测结果默认为合格
|
form.value.checkResult = 2;//检测结果默认为合格
|
||||||
disableCheckStatus("未检")
|
disableCheckStatus("未检测")
|
||||||
disableCheckStatus("检测中")
|
disableCheckStatus("检测中")
|
||||||
disableCheckStatus("归档")
|
disableCheckStatus("归档")
|
||||||
disablecheckResultList("未出结果")
|
disablecheckResultList("未出结果")
|
||||||
|
operationShow.value = true;
|
||||||
break;
|
break;
|
||||||
case 4://设备归档
|
case 4://设备归档
|
||||||
form.value.checkStatus = 2;//检测状态默认为检测完成
|
form.value.checkStatus = 2;//检测状态默认为检测完成
|
||||||
form.value.checkReportStatus = 1;//检测报告状态默认为已生成报告
|
form.value.checkReportStatus = 1;//检测报告状态默认为已生成报告
|
||||||
form.value.checkResult = 2;//检测结果默认为合格
|
form.value.checkResult = 2;//检测结果默认为合格
|
||||||
disableCheckStatus("未检")
|
disableCheckStatus("未检测")
|
||||||
disableCheckStatus("检测中")
|
disableCheckStatus("检测中")
|
||||||
disableCheckStatus("归档")
|
disableCheckStatus("归档")
|
||||||
disableCheckReportStatus("未生成报告")
|
disableCheckReportStatus("未生成报告")
|
||||||
disablecheckResultList("未出结果")
|
disablecheckResultList("未出结果")
|
||||||
|
operationShow.value = false;
|
||||||
break;
|
break;
|
||||||
case 5://报告浏览
|
case 5://设备浏览
|
||||||
|
operationShow.value = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -656,6 +663,16 @@ const handleTest = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 打开 drawer(新增、查看、编辑)
|
||||||
|
const openDrawer = (title: string, row: any) => {
|
||||||
|
if (title === '报告查看')
|
||||||
|
console.log(title);
|
||||||
|
|
||||||
|
else if (title === '误差体系编辑')
|
||||||
|
console.log(title);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(proTable.value?.tableData);
|
console.log(proTable.value?.tableData);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import { Menu, Platform } from '@element-plus/icons-vue'
|
import { Menu, Platform, CircleCheck,Loading } from '@element-plus/icons-vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -53,6 +53,9 @@ const getTreeData = (val: any) => {
|
|||||||
}
|
}
|
||||||
const filterText = ref('')
|
const filterText = ref('')
|
||||||
const treeRef = ref()
|
const treeRef = ref()
|
||||||
|
const {updateSelectedTreeNode} = defineProps<{
|
||||||
|
updateSelectedTreeNode:Function;
|
||||||
|
}>();
|
||||||
watch(
|
watch(
|
||||||
() => searchForm.value.planName,
|
() => searchForm.value.planName,
|
||||||
(val) => {
|
(val) => {
|
||||||
@@ -64,6 +67,7 @@ watch(
|
|||||||
)
|
)
|
||||||
const handleNodeClick = (data) => {
|
const handleNodeClick = (data) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
updateSelectedTreeNode()
|
||||||
}
|
}
|
||||||
const filterNode = (value: string, data) => {
|
const filterNode = (value: string, data) => {
|
||||||
if (!value) return true
|
if (!value) return true
|
||||||
@@ -110,12 +114,10 @@ defineExpose({ getTreeData })
|
|||||||
.tree_container {
|
.tree_container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
width: 100%;
|
|
||||||
overflow-x: auto;
|
|
||||||
|
|
||||||
.el-tree {
|
.el-tree {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
// width: 2000px;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="static">
|
<div class="static">
|
||||||
<div class="left_tree">
|
<div class="left_tree">
|
||||||
<tree ref="treeRef" />
|
<tree ref="treeRef" :updateSelectedTreeNode="getPieData || (() => {})"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- <span class="new_span">测试scss颜色</span> -->
|
<!-- <span class="new_span">测试scss颜色</span> -->
|
||||||
<div class="right_container">
|
<div class="right_container">
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"
|
"
|
||||||
v-for="(item, index) in tabsList"
|
v-for="(item, index) in tabsList"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="handleCheckFunction(index)"
|
@click="handleCheckFunction(item.value)"
|
||||||
>
|
>
|
||||||
<div class="item_img">
|
<div class="item_img">
|
||||||
<img :src="item.img" alt="" />
|
<img :src="item.img" alt="" />
|
||||||
@@ -25,61 +25,82 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 饼图 -->
|
|
||||||
<div class="container_charts">
|
<!-- <el-collapse v-model="activeNames" @change="handleChange">
|
||||||
<div class="charts_info">
|
<el-collapse-item title="检测进度展示" name="1"> -->
|
||||||
<pie
|
|
||||||
:customData="{
|
<!-- 饼图 -->
|
||||||
title: '检测状态',
|
<div class="container_charts">
|
||||||
textAlign: 'right',
|
<div class="charts_info">
|
||||||
}"
|
<pie
|
||||||
:legendData="{
|
:customData="{
|
||||||
icon: 'circle',
|
title: '检测状态',
|
||||||
left: 'left',
|
textAlign: 'right',
|
||||||
}"
|
}"
|
||||||
:chartsData="chartsData1"
|
:legendData="{
|
||||||
ref="pieRef1"
|
icon: 'circle',
|
||||||
></pie>
|
left: 'left',
|
||||||
</div>
|
}"
|
||||||
<div class="charts_info">
|
:chartsData="chartsData1"
|
||||||
<pie
|
ref="pieRef1"
|
||||||
:customData="{
|
></pie>
|
||||||
title: '检测结果',
|
</div>
|
||||||
textAlign: 'right',
|
<div class="charts_info">
|
||||||
}"
|
<pie
|
||||||
:legendData="{
|
:customData="{
|
||||||
icon: 'circle',
|
title: '检测结果',
|
||||||
left: 'left',
|
textAlign: 'right',
|
||||||
}"
|
}"
|
||||||
:chartsData="chartsData2"
|
:legendData="{
|
||||||
ref="pieRef2"
|
icon: 'circle',
|
||||||
></pie>
|
left: 'left',
|
||||||
</div>
|
}"
|
||||||
<div class="charts_info">
|
:chartsData="chartsData2"
|
||||||
<pie
|
ref="pieRef2"
|
||||||
:customData="{
|
></pie>
|
||||||
title: '报告状态',
|
</div>
|
||||||
textAlign: 'right',
|
<div class="charts_info">
|
||||||
label: {
|
<pie
|
||||||
normal: {
|
:customData="{
|
||||||
position: 'inner',
|
title: '报告状态',
|
||||||
|
textAlign: 'right',
|
||||||
|
label: {
|
||||||
|
normal: {
|
||||||
|
position: 'inner',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}"
|
||||||
}"
|
:legendData="{
|
||||||
:legendData="{
|
icon: 'circle',
|
||||||
icon: 'circle',
|
left: 'left',
|
||||||
left: 'left',
|
}"
|
||||||
}"
|
:chartsData="chartsData3"
|
||||||
:chartsData="chartsData3"
|
ref="pieRef3"
|
||||||
ref="pieRef3"
|
></pie>
|
||||||
></pie>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
<!-- </el-collapse-item>
|
||||||
|
</el-collapse> -->
|
||||||
|
|
||||||
|
<el-tabs type="border-card" @tab-change="handleTabsChange" v-model="editableTabsValue">
|
||||||
|
<el-tab-pane :label="tabLabel1">
|
||||||
<!-- 列表数据 -->
|
<!-- 列表数据 -->
|
||||||
<div class="container_table">
|
<div class="container_table">
|
||||||
<Table ref="tableRef"></Table>
|
<Table ref="tableRef1"></Table>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="已检设备" v-if="tabShow">
|
||||||
|
<!-- 列表数据 -->
|
||||||
|
<div class="container_table">
|
||||||
|
<Table ref="tableRef2"></Table>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -100,25 +121,32 @@ const form: any = ref({
|
|||||||
manufacturer: 0, //制造厂商
|
manufacturer: 0, //制造厂商
|
||||||
});
|
});
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const activeNames = ref(['2'])
|
||||||
|
const tabShow= ref(false);
|
||||||
|
const tabLabel1 = ref('自动检测')
|
||||||
|
const editableTabsValue = ref('0')
|
||||||
|
const handleChange = (val: string[]) => {
|
||||||
|
console.log(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleTabsChange = (val) => {
|
||||||
|
form.value.activeTabs = 0;
|
||||||
|
form.value.activeTabs = 3;
|
||||||
|
console.log(val)
|
||||||
|
}
|
||||||
localStorage.setItem("color", "red");
|
localStorage.setItem("color", "red");
|
||||||
//功能选择数据
|
//功能选择数据
|
||||||
const tabsList = ref([
|
const tabsList = ref([
|
||||||
{
|
{
|
||||||
label: "自动检测",
|
label: "设备检测",
|
||||||
value: 0,
|
value: 0,
|
||||||
img: "/src/assets/images/plan/static/1.svg",
|
img: "/src/assets/images/plan/static/1.svg",
|
||||||
checked: true,
|
checked: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "手动检测",
|
|
||||||
value: 1,
|
|
||||||
img: "/src/assets/images/plan/static/2.svg",
|
|
||||||
checked: false,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "设备复检",
|
label: "设备复检",
|
||||||
value: 2,
|
value: 2,
|
||||||
img: "/src/assets/images/plan/static/6.svg",
|
img: "/src/assets/images/plan/static/2.svg",
|
||||||
checked: false,
|
checked: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -133,21 +161,65 @@ const tabsList = ref([
|
|||||||
img: "/src/assets/images/plan/static/4.svg",
|
img: "/src/assets/images/plan/static/4.svg",
|
||||||
checked: false,
|
checked: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "设备浏览",
|
|
||||||
value: 5,
|
|
||||||
img: "/src/assets/images/plan/static/5.svg",
|
|
||||||
checked: false,
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
// const tabsList = ref([
|
||||||
|
// {
|
||||||
|
// label: "自动检测",
|
||||||
|
// value: 0,
|
||||||
|
// img: "/src/assets/images/plan/static/1.svg",
|
||||||
|
// checked: true,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "手动检测",
|
||||||
|
// value: 1,
|
||||||
|
// img: "/src/assets/images/plan/static/2.svg",
|
||||||
|
// checked: false,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "设备复检",
|
||||||
|
// value: 2,
|
||||||
|
// img: "/src/assets/images/plan/static/6.svg",
|
||||||
|
// checked: false,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "报告生成",
|
||||||
|
// value: 3,
|
||||||
|
// img: "/src/assets/images/plan/static/3.svg",
|
||||||
|
// checked: false,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "设备归档",
|
||||||
|
// value: 4,
|
||||||
|
// img: "/src/assets/images/plan/static/4.svg",
|
||||||
|
// checked: false,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "设备浏览",
|
||||||
|
// value: 5,
|
||||||
|
// img: "/src/assets/images/plan/static/5.svg",
|
||||||
|
// checked: false,
|
||||||
|
// },
|
||||||
|
// ]);
|
||||||
form.value.activeTabs = tabsList.value[0].value;
|
form.value.activeTabs = tabsList.value[0].value;
|
||||||
const tableRef = ref();
|
const tableRef1 = ref();
|
||||||
|
const tableRef2 = ref();
|
||||||
watch(
|
watch(
|
||||||
() => form.value,
|
() => form.value,
|
||||||
(val, oldVal) => {
|
(val, oldVal) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
tableRef.value && tableRef.value.changeActiveTabs(form.value.activeTabs);
|
tableRef1.value && tableRef1.value.changeActiveTabs(form.value.activeTabs);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
deep: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
watch(
|
||||||
|
() => form.value,
|
||||||
|
(val, oldVal) => {
|
||||||
|
if (val) {
|
||||||
|
tableRef2.value && tableRef2.value.changeActiveTabs(form.value.activeTabs);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -155,7 +227,6 @@ watch(
|
|||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const pieRef1 = ref(),
|
const pieRef1 = ref(),
|
||||||
pieRef2 = ref(),
|
pieRef2 = ref(),
|
||||||
pieRef3 = ref();
|
pieRef3 = ref();
|
||||||
@@ -208,15 +279,37 @@ const planDetail = () => {
|
|||||||
};
|
};
|
||||||
//功能选择css切换
|
//功能选择css切换
|
||||||
const handleCheckFunction = (val: any) => {
|
const handleCheckFunction = (val: any) => {
|
||||||
console.log("test1",val);
|
console.log("test",val);
|
||||||
|
editableTabsValue.value = '0';
|
||||||
tabsList.value.map((item: any, index: any) => {
|
tabsList.value.map((item: any, index: any) => {
|
||||||
if (val == index) {
|
if (val == item.value) {
|
||||||
item.checked = true;
|
item.checked = true;
|
||||||
} else {
|
} else {
|
||||||
item.checked = false;
|
item.checked = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tabShow.value = false;
|
||||||
|
|
||||||
|
switch (val) {
|
||||||
|
case 0://自动检测
|
||||||
|
tabLabel1.value = "自动检测";
|
||||||
|
break;
|
||||||
|
case 1://手动检测
|
||||||
|
tabLabel1.value = "手动检测";
|
||||||
|
break;
|
||||||
|
case 2://设备复检
|
||||||
|
tabLabel1.value = "设备复检";
|
||||||
|
break;
|
||||||
|
case 3://报告生成
|
||||||
|
tabLabel1.value = "未检设备";
|
||||||
|
tabShow.value = true;
|
||||||
|
break;
|
||||||
|
case 4://设备归档
|
||||||
|
tabLabel1.value = "设备归档";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
form.value.activeTabs = val;
|
form.value.activeTabs = val;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -268,11 +361,11 @@ onMounted(() => {
|
|||||||
.function_item {
|
.function_item {
|
||||||
flex: none;
|
flex: none;
|
||||||
width: 6%;
|
width: 6%;
|
||||||
height: 70px;
|
height: 50px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: row;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: #607eab;
|
background-color: #607eab;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
@@ -286,7 +379,7 @@ onMounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
margin-right: 5px;
|
||||||
img {
|
img {
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: auto;
|
height: auto;
|
||||||
@@ -331,9 +424,29 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-collapse {
|
||||||
|
width: 100% !important;
|
||||||
|
// min-height: 200px !important;
|
||||||
|
height:auto;
|
||||||
|
background-color: #eee;
|
||||||
|
// display: flex;
|
||||||
|
// justify-content: space-between;
|
||||||
|
// padding-left: 2ch;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-collapse-item{
|
||||||
|
width: 100% !important;
|
||||||
|
// min-height: 200px !important;
|
||||||
|
height:100% !important;
|
||||||
|
background-color: #eee;
|
||||||
|
// display: flex !important;
|
||||||
|
}
|
||||||
|
|
||||||
.container_charts {
|
.container_charts {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 200px !important;
|
min-height: 180px !important;
|
||||||
|
// height:100%;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -348,10 +461,15 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tabs{
|
||||||
|
width: 100% !important;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.container_table {
|
.container_table {
|
||||||
// width: 100%;
|
// width: 100%;
|
||||||
flex: 1 !important;
|
flex: 1 !important;
|
||||||
height: calc(100vh - 360px);
|
height: calc(100vh - 360px - 155px);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
// display: none;
|
// display: none;
|
||||||
|
|||||||
276
frontend/src/views/plan/autoTest/components/ShowDataPopup.vue
Normal file
276
frontend/src/views/plan/autoTest/components/ShowDataPopup.vue
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="数据查询"
|
||||||
|
v-model='dialogVisible'
|
||||||
|
v-bind="dialogBig"
|
||||||
|
draggable
|
||||||
|
>
|
||||||
|
<div class='table-box'>
|
||||||
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="检测结果">
|
||||||
|
<!-- 列表数据 -->
|
||||||
|
<div class="container_table1">
|
||||||
|
<ProTable
|
||||||
|
ref='proTable1'
|
||||||
|
:columns='columns1'
|
||||||
|
:data="testResultDatas"
|
||||||
|
:toolButton="false"
|
||||||
|
>
|
||||||
|
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="原始数据">
|
||||||
|
<!-- 列表数据 -->
|
||||||
|
<div class="container_table2">
|
||||||
|
<ProTable
|
||||||
|
ref='proTable2'
|
||||||
|
:columns='columns2'
|
||||||
|
:data="testDatas"
|
||||||
|
:toolButton="false"
|
||||||
|
>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { Role } from '@/api/role/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import rolePopup from './components/rolePopup.vue'
|
||||||
|
import permissionUnit from './components/permissionUnit.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import {dialogBig,dialogMiddle,dialogSmall} from '@/utils/elementBind'
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getRoleList,
|
||||||
|
deleteRole,
|
||||||
|
} from '@/api/role/role'
|
||||||
|
import { deleteUser } from '@/api/user/user'
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
|
||||||
|
const open = () => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable1 = ref<ProTableInstance>()
|
||||||
|
const proTable2 = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
records: data.list,
|
||||||
|
total: data.total,
|
||||||
|
current: data.pageNum,
|
||||||
|
size: data.pageSize,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数:params 为当前所有的请求参数(包括分页),最后返回请求列表接口
|
||||||
|
// 默认不做操作就直接在 ProTable 组件上绑定 :requestApi="getUserList"
|
||||||
|
const getTableList = (params: any) => {
|
||||||
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
|
newParams.createTime && (newParams.startTime = newParams.createTime[0])
|
||||||
|
newParams.createTime && (newParams.endTime = newParams.createTime[1])
|
||||||
|
delete newParams.createTime
|
||||||
|
return getRoleList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
interface TestResultData {
|
||||||
|
standardData: number,//标准值
|
||||||
|
testedData: number,//被检值
|
||||||
|
errorData: number,//误差值
|
||||||
|
errorValue: number,//误差允许值
|
||||||
|
testResult: string,//检测结果(合格、不合格、无法比较)
|
||||||
|
}
|
||||||
|
interface TestData {
|
||||||
|
dataTime: string,//数据时间(合格、不合格、无法比较)
|
||||||
|
standardData: number,//标准值
|
||||||
|
testedData: number,//被检值
|
||||||
|
}
|
||||||
|
//检测结果数组
|
||||||
|
const testResultDatas = [
|
||||||
|
{
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
errorData: 0.01,//误差值
|
||||||
|
errorValue: 0.05774,//误差允许值
|
||||||
|
testResult: "合格",//检测结果(合格、不合格、无法比较)
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
//原始数据数组
|
||||||
|
const testDatas = [
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:00",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:03",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:06",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:09",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:12",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:15",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:18",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:21",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:24",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:27",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:30",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:33",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:36",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:39",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:42",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:45",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:48",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:51",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:54",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataTime: "2024-11-11 14:05:57",//检测数据时间
|
||||||
|
standardData: 57.74,//标准值
|
||||||
|
testedData: 57.73,//被检值
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns1 = reactive<ColumnProps<TestResultData>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'standardData',
|
||||||
|
label: '标准值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testedData',
|
||||||
|
label: '被检值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'errorData',
|
||||||
|
label: '误差值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'errorValue',
|
||||||
|
label: '误差允许值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testResult',
|
||||||
|
label: '检测结果',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns2 = reactive<ColumnProps<TestData>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'dataTime',
|
||||||
|
label: '数据时间',
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'standardData',
|
||||||
|
label: '标准值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testedData',
|
||||||
|
label: '被检值',
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="plan_tree">
|
<div class="plan_tree">
|
||||||
<div class="search_view">
|
<!-- <div class="search_view">
|
||||||
<el-input
|
<el-input
|
||||||
placeholder="请输入计划名称"
|
placeholder="请输入计划名称"
|
||||||
v-model="searchForm.planName"
|
v-model="searchForm.planName"
|
||||||
></el-input>
|
></el-input>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="tree_container">
|
<div class="tree_container">
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="data"
|
:data="data"
|
||||||
@@ -19,12 +19,14 @@
|
|||||||
@node-click="handleNodeClick"
|
@node-click="handleNodeClick"
|
||||||
@check-change="changeSelect"
|
@check-change="changeSelect"
|
||||||
>
|
>
|
||||||
|
<!-- scriptIdx -->
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<span
|
<span
|
||||||
class="custom-tree-node"
|
class="custom-tree-node"
|
||||||
style="display: flex; align-items: center"
|
style="display: flex; align-items: center"
|
||||||
>
|
>
|
||||||
<!-- <Platform v-if="!data.pid" style="width:18px;height: 18px;margin-right:8px;" :style="{color:node.label=='未检测'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}"/> -->
|
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/>
|
||||||
|
<Loading v-if="data.isChildNode && data.scriptIdx === currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#E6A23C;"/>
|
||||||
<span>{{ node.label }}</span>
|
<span>{{ node.label }}</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, defineExpose, watch } from "vue";
|
import { ref, onMounted, defineExpose, watch } from "vue";
|
||||||
import { Menu, Platform } from "@element-plus/icons-vue";
|
import { Menu, Platform, CircleCheck,Loading } from "@element-plus/icons-vue";
|
||||||
const emit = defineEmits(["jump"]);
|
const emit = defineEmits(["jump"]);
|
||||||
const data: any = ref([]);
|
const data: any = ref([]);
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
@@ -55,6 +57,17 @@ const getTreeData = (val: any) => {
|
|||||||
};
|
};
|
||||||
const filterText = ref("");
|
const filterText = ref("");
|
||||||
const treeRef = ref();
|
const treeRef = ref();
|
||||||
|
const currentIndex = ref(0);
|
||||||
|
|
||||||
|
const timer = setInterval(() => {
|
||||||
|
currentIndex.value++;
|
||||||
|
if (currentIndex.value > 14)
|
||||||
|
currentIndex.value = 0;
|
||||||
|
console.log(currentIndex.value);
|
||||||
|
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => searchForm.value.planName,
|
() => searchForm.value.planName,
|
||||||
(val) => {
|
(val) => {
|
||||||
|
|||||||
@@ -1,7 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 自动检测页面 -->
|
<!-- 自动检测页面 -->
|
||||||
<div class="test">
|
<div class="test">
|
||||||
<div class="test_left">
|
<!-- 顶部筛选条件&返回按钮 -->
|
||||||
|
<!-- {{ printText }} -->
|
||||||
|
<div class="test_top">
|
||||||
|
<!-- style="pointer-events: none" -->
|
||||||
|
<el-checkbox
|
||||||
|
v-for="(item, index) in detectionOptions"
|
||||||
|
v-model="item.selected"
|
||||||
|
:key="index"
|
||||||
|
:label="item.name"
|
||||||
|
></el-checkbox
|
||||||
|
>
|
||||||
|
<el-button type="primary" @click="handlePreTest">预检测</el-button>
|
||||||
|
<el-button type="primary" @click="handleAutoTest">正式检测</el-button>
|
||||||
|
<el-button type="primary" @click="handleBackDeviceList"
|
||||||
|
>返回首页</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="test_bot">
|
||||||
|
<div class="test_left">
|
||||||
<Tree ref="treeRef"></Tree>
|
<Tree ref="treeRef"></Tree>
|
||||||
</div>
|
</div>
|
||||||
<div class="test_right">
|
<div class="test_right">
|
||||||
@@ -24,6 +42,23 @@
|
|||||||
/>
|
/>
|
||||||
<div class="test_button">
|
<div class="test_button">
|
||||||
<el-button
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
v-if="!isPause"
|
||||||
|
:icon="VideoPause"
|
||||||
|
@click="handlePauseTest"
|
||||||
|
>暂停检测</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
v-if="isPause"
|
||||||
|
:icon="Refresh"
|
||||||
|
@click="handlePauseTest"
|
||||||
|
>继续检测</el-button
|
||||||
|
>
|
||||||
|
<el-button type="danger" :icon="Close" @click="handleFinishTest"
|
||||||
|
>停止检测</el-button
|
||||||
|
>
|
||||||
|
<!-- <el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
v-if="!isPause"
|
v-if="!isPause"
|
||||||
:icon="Close"
|
:icon="Close"
|
||||||
@@ -39,10 +74,10 @@
|
|||||||
>
|
>
|
||||||
<el-button type="primary" :icon="Check" @click="handleFinishTest"
|
<el-button type="primary" :icon="Check" @click="handleFinishTest"
|
||||||
>完成检测</el-button
|
>完成检测</el-button
|
||||||
>
|
> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-descriptions-item width="0px" label="上送数据总数">
|
<!-- <el-descriptions-item width="0px" label="上送数据总数">
|
||||||
{{ num }}
|
{{ num }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item width="0px" label="已上送数据数">
|
<el-descriptions-item width="0px" label="已上送数据数">
|
||||||
@@ -50,13 +85,13 @@
|
|||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item width="0px" label="待上送数据数">
|
<el-descriptions-item width="0px" label="待上送数据数">
|
||||||
{{ num2 }}
|
{{ num2 }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item> -->
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
<!-- 右侧列表 -->
|
<!-- 右侧列表 -->
|
||||||
<div class="right_table">
|
<div class="right_table">
|
||||||
<!-- 模拟列表样式 -->
|
<!-- 模拟列表样式 -->
|
||||||
<!-- 表头设备 -->
|
<!-- 表头设备 -->
|
||||||
<div class="table_left">
|
<div class="table_left" v-if="false">
|
||||||
<p>测试项目</p>
|
<p>测试项目</p>
|
||||||
<div v-for="(item, index) in deviceTestList" :key="index">
|
<div v-for="(item, index) in deviceTestList" :key="index">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
@@ -74,9 +109,18 @@
|
|||||||
v-for="(item, index) in deviceTestList"
|
v-for="(item, index) in deviceTestList"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<p v-for="(vv, vvs) in item.children" :key="vvs">
|
<!-- <p v-for="(vv, vvs) in item.children" :key="vvs">
|
||||||
{{ vv.status }}
|
{{ vv.status }}
|
||||||
</p>
|
</p> -->
|
||||||
|
<el-button
|
||||||
|
v-for="(vv, vvs) in item.children"
|
||||||
|
:key="vvs"
|
||||||
|
:type="vv.type"
|
||||||
|
text
|
||||||
|
@click="handleClick(item,index,vvs)"
|
||||||
|
>
|
||||||
|
{{ vv.label }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -98,7 +142,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 右侧状态加载 -->
|
<!-- 右侧状态加载 -->
|
||||||
<div class="right_status" ref="statusRef">
|
<div class="right_status" ref="statusRef">
|
||||||
<p v-for="(item, index) in statusList" :key="index">
|
<!-- ,fontSize:index%5===0?'16px':'14px' -->
|
||||||
|
<p v-for="(item, index) in statusList" :key="index" :style="{color:index%5===0?'#F56C6C':'var(--el-text-color-regular)'}">
|
||||||
输入:{{ item.remark }} -{{
|
输入:{{ item.remark }} -{{
|
||||||
item.status == 0 ? "输出完毕" : "输入中,请稍后!"
|
item.status == 0 ? "输出完毕" : "输入中,请稍后!"
|
||||||
}}<br />
|
}}<br />
|
||||||
@@ -106,7 +151,10 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<ShowDataPopup ref='showDataPopup'/>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, reactive, nextTick } from "vue";
|
import { ref, onMounted, reactive, nextTick } from "vue";
|
||||||
@@ -116,6 +164,7 @@ import ProTable from "@/components/ProTable/index.vue";
|
|||||||
import { useTransition } from "@vueuse/core";
|
import { useTransition } from "@vueuse/core";
|
||||||
import { getPlanList } from "@/api/plan/planList";
|
import { getPlanList } from "@/api/plan/planList";
|
||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
import ShowDataPopup from './components/ShowDataPopup.vue'
|
||||||
import {
|
import {
|
||||||
CirclePlus,
|
CirclePlus,
|
||||||
Delete,
|
Delete,
|
||||||
@@ -128,8 +177,136 @@ import {
|
|||||||
Refresh,
|
Refresh,
|
||||||
Search,
|
Search,
|
||||||
Close,
|
Close,
|
||||||
|
VideoPause,
|
||||||
} from "@element-plus/icons-vue";
|
} from "@element-plus/icons-vue";
|
||||||
const treeRef = ref<any>();
|
const treeRef = ref<any>();
|
||||||
|
const PopupVisible = ref(false)
|
||||||
|
const showDataPopup = ref()
|
||||||
|
|
||||||
|
//定义与预检测配置数组
|
||||||
|
const detectionOptions = ref([
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: "标准源通讯检测",//判断源通讯是否正常
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
name: "协议校验",//ICD报告触发测试
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
name: "相序校验",//判断装置的接线是否正确
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 4,
|
||||||
|
name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 5,
|
||||||
|
name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
||||||
|
selected: true,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// id: 6,
|
||||||
|
// name: "实时数据比对",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 7,
|
||||||
|
// name: "录波数据比对",
|
||||||
|
// },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const leftDeviceData = ref<any>([
|
||||||
|
// {
|
||||||
|
// id: 0,
|
||||||
|
// name: "设备1-预检测",
|
||||||
|
// status: 0,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 1,
|
||||||
|
// name: "设备2-预检测",
|
||||||
|
// status: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 2,
|
||||||
|
// name: "设备3-预检测",
|
||||||
|
// status: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 3,
|
||||||
|
// name: "设备4-预检测",
|
||||||
|
// status: 0,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 4,
|
||||||
|
// name: "设备5-预检测",
|
||||||
|
// status: 1,
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// id: 5,
|
||||||
|
// name: "设备6-预检测",
|
||||||
|
// status: 0,
|
||||||
|
// },
|
||||||
|
]);
|
||||||
|
const initLeftDeviceData = () => {
|
||||||
|
leftDeviceData.value.map((item, index) => {
|
||||||
|
// handlePrintText(item.name, index);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 点击数据结果
|
||||||
|
const handleClick = (item,index,vvs) => {
|
||||||
|
//const data = "检测脚本为:"+item.name+";被检设备为:"+item.children.value.devID+";被检通道序号为:"+ item.children.monitorIndex;
|
||||||
|
console.log(vvs,index,item.name,item.children)
|
||||||
|
PopupVisible.value = true
|
||||||
|
showDataPopup.value.open()
|
||||||
|
};
|
||||||
|
//启动预检测
|
||||||
|
const handlePreTest = () => {
|
||||||
|
ElMessage.success("启动预检测");
|
||||||
|
let count = 0;
|
||||||
|
if (timer) {
|
||||||
|
clearInterval(timer);
|
||||||
|
count = 0;
|
||||||
|
leftDeviceData.value = [];
|
||||||
|
}
|
||||||
|
if (count == 5) {
|
||||||
|
count = 0;
|
||||||
|
} else {
|
||||||
|
timer = setInterval(async () => {
|
||||||
|
count++;
|
||||||
|
if (count > 15) return;
|
||||||
|
await nextTick(() => {
|
||||||
|
leftDeviceData.value.push({
|
||||||
|
id: count,
|
||||||
|
name: "设备" + count + "预检测",
|
||||||
|
status: count % 2 == 0 ? 0 : 1,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//进入检测流程
|
||||||
|
const handleAutoTest = () => {
|
||||||
|
router.push({
|
||||||
|
path: "/plan/autoTest",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
//返回设备列表
|
||||||
|
const handleBackDeviceList = () => {
|
||||||
|
router.push({
|
||||||
|
path: "/plan/home/index",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
const columns = reactive<ColumnProps<User.ResUserList>[]>([
|
||||||
{ type: "selection", fixed: "left", width: 70 },
|
{ type: "selection", fixed: "left", width: 70 },
|
||||||
@@ -283,22 +460,22 @@ const getTableList = (params: any) => {
|
|||||||
const percentage = ref(0);
|
const percentage = ref(0);
|
||||||
|
|
||||||
const customColors = [
|
const customColors = [
|
||||||
{ color: "red", percentage: 0 },
|
// { color: "red", percentage: 0 },
|
||||||
{ color: "red", percentage: 10 },
|
// { color: "red", percentage: 10 },
|
||||||
{ color: "red", percentage: 20 },
|
// { color: "red", percentage: 20 },
|
||||||
{ color: "red", percentage: 30 }, //红
|
// { color: "red", percentage: 30 }, //红
|
||||||
{ color: "red", percentage: 40 },
|
// { color: "red", percentage: 40 },
|
||||||
{ color: "#e6a23c", percentage: 50 },
|
// { color: "#e6a23c", percentage: 50 },
|
||||||
{ color: "#e6a23c", percentage: 60 },
|
// { color: "#e6a23c", percentage: 60 },
|
||||||
{ color: "#e6a23c", percentage: 70 }, //黄
|
// { color: "#e6a23c", percentage: 70 }, //黄
|
||||||
{ color: "#e6a23c", percentage: 80 }, //1989fa
|
// { color: "#e6a23c", percentage: 80 }, //1989fa
|
||||||
{ color: "#e6a23c", percentage: 90 }, //1989fa
|
// { color: "#e6a23c", percentage: 90 }, //1989fa
|
||||||
{ color: "#5cb87a", percentage: 100 }, //绿
|
{ color: "#5cb87a", percentage: 100 }, //绿
|
||||||
];
|
];
|
||||||
//加载进度条
|
//加载进度条
|
||||||
const refreshProgress = () => {
|
const refreshProgress = () => {
|
||||||
if (percentage.value < 100) {
|
if (percentage.value < 100) {
|
||||||
percentage.value += 10;
|
percentage.value += 1;
|
||||||
num1.value += 1001;
|
num1.value += 1001;
|
||||||
num2.value -= 1001;
|
num2.value -= 1001;
|
||||||
} else {
|
} else {
|
||||||
@@ -323,21 +500,37 @@ const deviceData = ref([
|
|||||||
id: 0,
|
id: 0,
|
||||||
name: "设备1通道1",
|
name: "设备1通道1",
|
||||||
status: Math.floor(Math.random() * 4),
|
status: Math.floor(Math.random() * 4),
|
||||||
|
type:"info",
|
||||||
|
label:"/",
|
||||||
|
devID:"dev1",
|
||||||
|
monitorIndex:1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
name: "设备2通道2",
|
name: "设备1通道2",
|
||||||
status: Math.floor(Math.random() * 4),
|
status: Math.floor(Math.random() * 4),
|
||||||
|
type:"success",
|
||||||
|
label:"√",
|
||||||
|
devID:"dev1",
|
||||||
|
monitorIndex:2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: "设备3通道3",
|
name: "设备2通道1",
|
||||||
status: Math.floor(Math.random() * 4),
|
status: Math.floor(Math.random() * 4),
|
||||||
|
type:"danger",
|
||||||
|
label:"×",
|
||||||
|
devID:"dev2",
|
||||||
|
monitorIndex:1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
name: "设备4通道4",
|
name: "设备3通道1",
|
||||||
status: Math.floor(Math.random() * 4),
|
status: Math.floor(Math.random() * 4),
|
||||||
|
type:"success",
|
||||||
|
label:"√",
|
||||||
|
devID:"dev3",
|
||||||
|
monitorIndex:1,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const interValTest = () => {
|
const interValTest = () => {
|
||||||
@@ -348,6 +541,8 @@ const interValTest = () => {
|
|||||||
children: deviceData.value,
|
children: deviceData.value,
|
||||||
// status: Math.floor(Math.random() * 4),
|
// status: Math.floor(Math.random() * 4),
|
||||||
});
|
});
|
||||||
|
// console.log(deviceTestList.value,11111);
|
||||||
|
|
||||||
refreshProgress();
|
refreshProgress();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
statusTimer.value = setInterval(() => {
|
statusTimer.value = setInterval(() => {
|
||||||
@@ -431,7 +626,31 @@ onMounted(() => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.test_top {
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
display: flex;
|
||||||
|
background-color: #fff;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 0 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
.el-button {
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.test_bot {
|
||||||
|
flex: 1;
|
||||||
|
margin-top: 10px;
|
||||||
|
display: flex;
|
||||||
|
height: calc(100vh - 240px);
|
||||||
.test_left {
|
.test_left {
|
||||||
max-width: 300px;
|
max-width: 300px;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
@@ -484,11 +703,13 @@ onMounted(() => {
|
|||||||
.right_device_title {
|
.right_device_title {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: center;
|
||||||
|
|
||||||
// overflow-x: auto !important;
|
// overflow-x: auto !important;
|
||||||
p {
|
p {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
// max-width: 150px;
|
// max-width: 150px;
|
||||||
|
text-align: center;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@@ -503,7 +724,7 @@ onMounted(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
p {
|
.el-button {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
// max-width: 150px;
|
// max-width: 150px;
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
@@ -534,6 +755,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .header-button-lf {
|
::v-deep .header-button-lf {
|
||||||
|
|||||||
@@ -1,13 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 权限信息弹出框 -->
|
<!-- 权限信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" title="编辑计划所属设备" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
<el-dialog :model-value="dialogVisible" title="设备绑定" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
||||||
<div>
|
<div>
|
||||||
<el-transfer v-model="value"
|
<el-transfer v-model="value"
|
||||||
filterable
|
filterable
|
||||||
:filter-method="filterMethod"
|
:filter-method="filterMethod"
|
||||||
filter-placeholder="请输入内容搜索"
|
filter-placeholder="请输入内容搜索"
|
||||||
:data="data"
|
:data="data"
|
||||||
:titles="['未绑定设备', '计划所属设备']"/>
|
:titles="['未绑定设备', '已绑定设备']">
|
||||||
|
<template #default="{ option }">
|
||||||
|
<el-tooltip :content="option.tips" placement="top" :show-after=1000>
|
||||||
|
<span>{{ option.label }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-transfer>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -34,6 +41,7 @@
|
|||||||
key: number
|
key: number
|
||||||
label: string
|
label: string
|
||||||
initial: string
|
initial: string
|
||||||
|
tips: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateData = () => {
|
const generateData = () => {
|
||||||
@@ -47,14 +55,21 @@
|
|||||||
'易司拓测试装置',
|
'易司拓测试装置',
|
||||||
'山大电力测试装置1',
|
'山大电力测试装置1',
|
||||||
'山大电力测试装置2',
|
'山大电力测试装置2',
|
||||||
|
'滚动条测试1',
|
||||||
|
'滚动条测试2',
|
||||||
|
'滚动条测试3',
|
||||||
|
'滚动条测试4',
|
||||||
|
'滚动条测试5',
|
||||||
|
'滚动条测试6',
|
||||||
]
|
]
|
||||||
const initials = ['CA', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT', 'GT']
|
const initials = ['CA', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT', 'GT', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT', 'GT']
|
||||||
states.forEach((city, index) => {
|
states.forEach((city, index) => {
|
||||||
|
|
||||||
data.push({
|
data.push({
|
||||||
label: city,
|
label: city,
|
||||||
key: index,
|
key: index,
|
||||||
initial: initials[index],
|
initial: initials[index],
|
||||||
|
tips:"PQS882A 192.16.1.136",
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
|
|||||||
119
frontend/src/views/plan/planList/components/sourceTransfer.vue
Normal file
119
frontend/src/views/plan/planList/components/sourceTransfer.vue
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 权限信息弹出框 -->
|
||||||
|
<el-dialog :model-value="dialogVisible" title="检测源绑定" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
||||||
|
<div>
|
||||||
|
<el-transfer v-model="value"
|
||||||
|
class="custom-transfer"
|
||||||
|
filterable
|
||||||
|
:filter-method="filterMethod"
|
||||||
|
filter-placeholder="请输入内容搜索"
|
||||||
|
:data="data"
|
||||||
|
:titles="['未绑定检测源', '已绑定检测源']">
|
||||||
|
<template #default="{ option }">
|
||||||
|
<el-tooltip :content="option.tips" placement="top" :show-after=1000>
|
||||||
|
<span>{{ option.label }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
|
</el-transfer>
|
||||||
|
</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 type { Device } from '@/api/device/interface'
|
||||||
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
|
||||||
|
const {dialogVisible} = defineProps<{
|
||||||
|
dialogVisible: boolean;
|
||||||
|
}>()
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
key: number
|
||||||
|
label: string
|
||||||
|
initial: string
|
||||||
|
tips: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const generateData = () => {
|
||||||
|
const data: Option[] = []
|
||||||
|
const states = [
|
||||||
|
'标准源-福禄克-6100A',
|
||||||
|
'标准源-昂立-PF2',
|
||||||
|
'标准源-丹迪克-DKLN1',
|
||||||
|
'标准源-博电源-PQC600A',
|
||||||
|
'高精度设备-PQV520-1',
|
||||||
|
'高精度设备-PQV520-2',
|
||||||
|
]
|
||||||
|
const initials = ['FLUKE.6100A', 'ANGLI-FP2', 'DKLN-1', 'PQC600A', 'PQV520-1', 'PQV520-2']
|
||||||
|
states.forEach((city, index) => {
|
||||||
|
|
||||||
|
data.push({
|
||||||
|
label: city,
|
||||||
|
key: index,
|
||||||
|
initial: initials[index],
|
||||||
|
tips:"IP:192.16.1.124",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
const generateValue = () => {
|
||||||
|
const data: number[] = []
|
||||||
|
const states = [
|
||||||
|
'高精度设备-PQV520-1',
|
||||||
|
'高精度设备-PQV520-2',
|
||||||
|
]
|
||||||
|
const initials = ['PQV520-1', 'PQV520-2']
|
||||||
|
states.forEach((city, index) => {
|
||||||
|
const key = states.indexOf(city)
|
||||||
|
if (key !== -1) {
|
||||||
|
data.push(key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
// const generateValue = () => {
|
||||||
|
// const data: Option[] = []
|
||||||
|
// const states = [
|
||||||
|
// '山大电力测试装置1',
|
||||||
|
// '山大电力测试装置2',
|
||||||
|
// ]
|
||||||
|
// const initials = ['AB', 'CD']
|
||||||
|
// states.forEach((city, index) => {
|
||||||
|
|
||||||
|
// data.push({
|
||||||
|
// label: city,
|
||||||
|
// key: index,
|
||||||
|
// initial: initials[index],
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
// return data
|
||||||
|
// }
|
||||||
|
const data = ref<Option[]>(generateData())
|
||||||
|
const value = ref<number[]>(generateValue())
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e:'update:visible',value:boolean):void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const handleCancel = () => {
|
||||||
|
emit('update:visible',false)
|
||||||
|
}
|
||||||
|
const filterMethod = (query, item) => {
|
||||||
|
return item.label.toLowerCase().includes(query.toLowerCase())
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.custom-transfer .el-transfer-panel{
|
||||||
|
overflow-x: auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
31
frontend/src/views/plan/planList/components/temp.vue
Normal file
31
frontend/src/views/plan/planList/components/temp.vue
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<el-dropdown @command="handleCommand">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||||
|
</span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item command="a">高精度设备-PQV520-2</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="b">高精度设备-PQV520-3</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="c">高精度设备-PQV520-4</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ElMessage } from 'element-plus'
|
||||||
|
import { ArrowDown } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
|
const handleCommand = (command: string | number | object) => {
|
||||||
|
ElMessage(`click on item ${command}`)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.example-showcase .el-dropdown-link {
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--el-button-text-color);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,170 +1,250 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box' ref='popupBaseView'>
|
<div class='table-box' ref='popupBaseView'>
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='planData'
|
:data='planData'
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='Download' @click="importClick">导入</el-button>
|
<el-button type='primary' :icon='Download' @click='importClick'>导入</el-button>
|
||||||
<el-button type='primary' :icon='CirclePlus' :disabled='!(scope.selectedList.length > 1)' @click="combineClick">合并</el-button>
|
<el-button type='primary' :icon='CirclePlus' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
|
合并
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
</el-button>
|
||||||
批量删除
|
<el-button type='primary' :icon='CirclePlus' @click='openAddDialog'>新增</el-button>
|
||||||
</el-button>
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
<input type="file" style="display: none" ref="fileInput" @change="handleFiles">
|
批量删除
|
||||||
</template>
|
</el-button>
|
||||||
|
<input type='file' style='display: none' ref='fileInput' @change='handleFiles'>
|
||||||
|
</template>
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation='scope'>
|
<template #operation='scope'>
|
||||||
<!-- <el-button type='primary' link :icon='View' @click="handleRowClick(scope.row)">查看</el-button> -->
|
<!-- <el-button type='primary' link :icon='View' @click="handleRowClick(scope.row)">查看</el-button> -->
|
||||||
<el-button type='primary' link :icon='Upload' @click="exportClick">导出</el-button>
|
<el-button type='primary' link :icon='Upload' @click='exportClick'>导出</el-button>
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button>
|
<el-button type='primary' link :icon='EditPen' @click='openEditDialog(scope.row)'>编辑</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
<div class='cn-render-buttons'>
|
||||||
<el-button type='primary' link :icon='List' @click="showDeviceOpen(scope.row)">所属设备</el-button>
|
<el-dropdown trigger='click'>
|
||||||
<el-button type='primary' link :icon='List' @click="showtestSourceOpen(scope.row)">所属检测源</el-button>
|
<el-button link type='primary' class='table-operate'>
|
||||||
</template>
|
<div class='table-operate-text'>更多</div>
|
||||||
</ProTable>
|
</el-button>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item :style="{color: 'var(--el-color-danger)'}" :icon='Delete'>
|
||||||
|
删除
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item :icon='List' @click='showDeviceOpen(scope.row)'>
|
||||||
|
设备绑定
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item :icon='Tools' @click='showtestSourceOpen(scope.row)'>
|
||||||
|
检测源绑定
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
|
||||||
<!-- 向计划导入/导出设备对话框 -->
|
@update:visible="dialogFormVisible = $event"/>
|
||||||
<planPopup
|
|
||||||
:visible="dialogFormVisible"
|
<!-- 查看误差体系详细信息 -->
|
||||||
:formData="dialogForm"
|
<ErrorStandardDialog
|
||||||
:dialogTitle="dialogTitle"
|
:visible='detail_dialogFormVisible'
|
||||||
:is-read-only="isReadOnly"
|
:formData='detail_dialogForm'
|
||||||
@update:visible="dialogFormVisible = $event"
|
:dialogTitle='detail_dialogTitle'
|
||||||
|
@update:visible='detail_dialogFormVisible = $event'
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
<devTransfer
|
||||||
<devTransfer
|
:dialogVisible=devTransferVisible
|
||||||
:dialogVisible=devTransferVisible
|
@update:visible='devTransferVisible = $event'
|
||||||
@update:visible='devTransferVisible = $event'
|
|
||||||
/>
|
/>
|
||||||
<DeviceOpen :width='viewWidth' :height='viewHeight' ref='openDeviceView' />
|
<sourceTransfer
|
||||||
<SourceOpen :width='viewWidth' :height='viewHeight' ref='openSourceView' />
|
:dialogVisible=sourceTransferVisible
|
||||||
|
@update:visible='sourceTransferVisible = $event'
|
||||||
|
/>
|
||||||
|
<DeviceOpen :width='viewWidth' :height='viewHeight' ref='openDeviceView' />
|
||||||
|
<SourceOpen :width='viewWidth' :height='viewHeight' ref='openSourceView' />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name='useProTable'>
|
<script setup lang='tsx' name='useProTable'>
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import TimeControl from '@/components/TimeControl/index.vue'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
import type { ProTableInstance,ColumnProps } from '@/components/ProTable/interface'
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { CirclePlus, Delete,EditPen,View,Upload,Download,List} from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
||||||
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData,testFatherPlanList} from '@/api/plan/planData'
|
import {
|
||||||
import { reactive,ref } from 'vue'
|
dictPattern,
|
||||||
|
dictTestState,
|
||||||
|
dictReportState,
|
||||||
|
dictResult,
|
||||||
|
testPlanDataList,
|
||||||
|
testSoureDataList,
|
||||||
|
testScriptDataList,
|
||||||
|
testErrSystDataList,
|
||||||
|
planData,
|
||||||
|
testFatherPlanList,
|
||||||
|
} from '@/api/plan/planData'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import planPopup from "@/views/plan/planList/components/planPopup.vue"; // 导入子组件
|
import planPopup from '@/views/plan/planList/components/planPopup.vue' // 导入子组件
|
||||||
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
||||||
import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue'
|
import SourceOpen from '@/views/plan/planList/components/sourcePopup.vue'
|
||||||
|
import temp from './components/temp.vue'
|
||||||
import devTransfer from './components/devTransfer.vue'
|
import devTransfer from './components/devTransfer.vue'
|
||||||
|
import sourceTransfer from './components/sourceTransfer.vue'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from 'vue-router'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import type { Action } from 'element-plus'
|
import type { Action } from 'element-plus'
|
||||||
|
import type { ErrorSystem } from '@/api/error/interface'
|
||||||
|
import ErrorStandardDialog from '@/views/machine/errorSystem/components/ErrorStandardDialog.vue' // 导入子组件
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// 定义包含和排除的单位
|
// 定义包含和排除的单位
|
||||||
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
const includedUnits = ['日', '周', '月', '自定义'] // 可以根据需要包含的单位
|
||||||
const excludedUnits = ['季度','年']; // 要排除的单位
|
const excludedUnits = ['季度', '年'] // 要排除的单位
|
||||||
const defaultUnits = '日'; // 默认的单位
|
const defaultUnits = '日' // 默认的单位
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
const openDeviceView = ref()
|
const openDeviceView = ref()
|
||||||
const openSourceView = ref()
|
const openSourceView = ref()
|
||||||
const devTransferVisible = ref(false)
|
const devTransferVisible = ref(false)
|
||||||
|
const sourceTransferVisible = ref(false)
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
// const planData = planData
|
// const planData = planData
|
||||||
const dialogFormVisible = ref(false)
|
const dialogFormVisible = ref(false)
|
||||||
const dialogTitle = ref('')
|
const dialogTitle = ref('')
|
||||||
const isReadOnly = ref(false)
|
const isReadOnly = ref(false)
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
const dialogForm = ref<Plan.PlanBO>({
|
const dialogForm = ref<Plan.PlanBO>({
|
||||||
id: '' ,
|
id: '',
|
||||||
name: '',
|
name: '',
|
||||||
pattern:'',
|
pattern: '',
|
||||||
father_Plan_Id:'',
|
father_Plan_Id: '',
|
||||||
dataSource_Id:'',
|
dataSource_Id: '',
|
||||||
script_Id:'',
|
script_Id: '',
|
||||||
error_Sys_Id:'',
|
error_Sys_Id: '',
|
||||||
test_State: '',
|
test_State: '',
|
||||||
report_State: '',
|
report_State: '',
|
||||||
result:'',
|
result: '',
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
const detail_dialogFormVisible = ref(false)
|
||||||
|
const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系')
|
||||||
|
const detail_dialogForm = ref<ErrorSystem.Error_detail>({
|
||||||
|
measured: '',//被测量
|
||||||
|
deviceLevel: '',//检测装置级别
|
||||||
|
measurementType: '',
|
||||||
|
condition: '',//测量条件
|
||||||
|
maxErrorValue: '',//最大误差
|
||||||
|
})
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Plan.PlanBO>[]>([
|
const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
label: '检测计划名称',
|
label: '检测计划名称',
|
||||||
width: 200,
|
width: 200,
|
||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'testSourceName',
|
prop: 'testSourceName',
|
||||||
label: '检测源名称',
|
label: '检测源名称',
|
||||||
width: 200,
|
width: 300,
|
||||||
},
|
render: scope => {
|
||||||
{
|
return (
|
||||||
prop: 'script_Id',
|
// <el-button
|
||||||
label: '检测脚本',
|
// v-for="(button, index) in scope.row.testSourceList"
|
||||||
width: 300,
|
// :key="index"
|
||||||
enum: testScriptDataList,
|
// @click="handleClick(button)"
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
// >
|
||||||
},
|
// {{ button.text }}
|
||||||
{
|
// </el-button>
|
||||||
prop: 'error_Sys_Id',
|
<div class='flx-flex-start'>
|
||||||
label: '误差体系',
|
<el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}>
|
||||||
width: 200,
|
{scope.row.testSourceName}
|
||||||
enum: testErrSystDataList,
|
</el-button>
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
<temp></temp>
|
||||||
},
|
</div>
|
||||||
{
|
|
||||||
prop: 'dataSource_Id',
|
)
|
||||||
label: '数据源名称',
|
},
|
||||||
width: 200,
|
},
|
||||||
enum: testSoureDataList,
|
{
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
prop: 'script_Id',
|
||||||
},
|
label: '检测脚本',
|
||||||
{
|
width: 300,
|
||||||
prop: 'test_State',
|
enum: testScriptDataList,
|
||||||
label: '检测状态',
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
width: 100,
|
render: scope => {
|
||||||
enum: dictTestState,
|
return (
|
||||||
// enum: dictStore.getDictData('planTestState'),
|
<el-button type='primary' link onClick={() => showData(scope.row.script_Id)}>
|
||||||
|
{getScriptName(scope.row.script_Id)}
|
||||||
|
</el-button>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'error_Sys_Id',
|
||||||
|
label: '误差体系',
|
||||||
|
width: 200,
|
||||||
|
enum: testErrSystDataList,
|
||||||
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
|
render: scope => {
|
||||||
|
const errSysName = getErrSysName(scope.row.error_Sys_Id)
|
||||||
|
return (
|
||||||
|
<el-button type='primary' link onClick={() => showData(errSysName || '')}>
|
||||||
|
{errSysName}
|
||||||
|
</el-button>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'dataSource_Id',
|
||||||
|
label: '数据源名称',
|
||||||
|
width: 200,
|
||||||
|
enum: testSoureDataList,
|
||||||
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'test_State',
|
||||||
|
label: '检测状态',
|
||||||
|
width: 100,
|
||||||
|
enum: dictTestState,
|
||||||
|
// enum: dictStore.getDictData('planTestState'),
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'report_State',
|
prop: 'report_State',
|
||||||
label: '检测报告状态',
|
label: '检测报告状态',
|
||||||
width: 150,
|
width: 150,
|
||||||
enum: dictReportState,
|
enum: dictReportState,
|
||||||
// enum: dictStore.getDictData('planReportState'),
|
// enum: dictStore.getDictData('planReportState'),
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'result',
|
prop: 'result',
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
width: 100,
|
width: 100,
|
||||||
enum: dictResult,
|
enum: dictResult,
|
||||||
// enum: dictStore.getDictData('planResult'),
|
// enum: dictStore.getDictData('planResult'),
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'father_Plan_Id',
|
prop: 'father_Plan_Id',
|
||||||
label: '父节点',
|
label: '父节点',
|
||||||
width: 200,
|
width: 200,
|
||||||
enum: testFatherPlanList,
|
enum: testFatherPlanList,
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// prop: 'create_Time',
|
// prop: 'create_Time',
|
||||||
// label: '记录时间',
|
// label: '记录时间',
|
||||||
@@ -179,50 +259,69 @@ const columns = reactive<ColumnProps<Plan.PlanBO>[]>([
|
|||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 450, },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||||
])
|
])
|
||||||
|
|
||||||
|
function getScriptName(id: string) {
|
||||||
|
return testScriptDataList.find(item => item.id == id)?.label
|
||||||
|
}
|
||||||
|
|
||||||
const fileInput = ref<HTMLInputElement | null>(null); // 声明 fileInput
|
function getErrSysName(id: string) {
|
||||||
function openFileDialog() {
|
return testErrSystDataList.find(item => item.id == id)?.label
|
||||||
|
}
|
||||||
|
|
||||||
|
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
|
||||||
|
function openFileDialog() {
|
||||||
if (fileInput.value) {
|
if (fileInput.value) {
|
||||||
fileInput.value.click();
|
fileInput.value.click()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showData(row: string) {
|
||||||
|
|
||||||
|
detail_dialogTitle.value = row
|
||||||
|
detail_dialogFormVisible.value = true // 显示对话框
|
||||||
|
|
||||||
|
// router.push({
|
||||||
|
// path: "/machine/device",
|
||||||
|
// query: { id: row }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
function handleFiles(event: Event) {
|
function handleFiles(event: Event) {
|
||||||
const target = event.target as HTMLInputElement;
|
const target = event.target as HTMLInputElement
|
||||||
const files = target.files;
|
const files = target.files
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
// 处理文件
|
// 处理文件
|
||||||
console.log(files);
|
console.log(files)
|
||||||
ElMessageBox.confirm(
|
ElMessageBox.confirm(
|
||||||
'导入的数据与当前数据有冲突,请选择以哪个数据为主进行覆盖',
|
'导入的数据与当前数据有冲突,请选择以哪个数据为主进行覆盖',
|
||||||
'数据冲突',
|
'数据冲突',
|
||||||
{
|
{
|
||||||
distinguishCancelAndClose: true,
|
distinguishCancelAndClose: true,
|
||||||
confirmButtonText: '以导入数据为主覆盖',
|
confirmButtonText: '以导入数据为主覆盖',
|
||||||
cancelButtonText: '以当前数据为主覆盖',
|
cancelButtonText: '以当前数据为主覆盖',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '以导入数据为主完成数据覆盖',
|
message: '以导入数据为主完成数据覆盖',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((action: Action) => {
|
.catch((action: Action) => {
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message:
|
message:
|
||||||
action === 'cancel'
|
action === 'cancel'
|
||||||
? '以当前数据为主完成数据覆盖'
|
? '以当前数据为主完成数据覆盖'
|
||||||
: '取消本次导入操作',
|
: '取消本次导入操作',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击导入按钮
|
// 点击导入按钮
|
||||||
const importClick = () => {
|
const importClick = () => {
|
||||||
openFileDialog()
|
openFileDialog()
|
||||||
@@ -235,61 +334,62 @@ const exportClick = () => {
|
|||||||
// 点击合并按钮
|
// 点击合并按钮
|
||||||
const combineClick = () => {
|
const combineClick = () => {
|
||||||
ElMessageBox.prompt(
|
ElMessageBox.prompt(
|
||||||
'请输入合并后的计划名称',
|
'请输入合并后的计划名称',
|
||||||
'检测计划合并',
|
'检测计划合并',
|
||||||
{
|
{
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ value }) => {
|
.then(({ value }) => {
|
||||||
console.log(`合并后的计划名为:`,value)
|
console.log(`合并后的计划名为:`, value)
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开编辑对话框
|
// 打开编辑对话框
|
||||||
const openEditDialog = (planSystem: Plan.PlanBO) => {
|
const openEditDialog = (planSystem: Plan.PlanBO) => {
|
||||||
dialogForm.value = {...planSystem};
|
dialogForm.value = { ...planSystem }
|
||||||
dialogTitle.value = '编辑检测计划';
|
dialogTitle.value = '编辑检测计划'
|
||||||
isReadOnly.value = false;
|
isReadOnly.value = false
|
||||||
dialogFormVisible.value = true; // 打开对话框
|
dialogFormVisible.value = true // 打开对话框
|
||||||
};
|
}
|
||||||
|
|
||||||
const openAddDialog = () => {
|
const openAddDialog = () => {
|
||||||
|
|
||||||
dialogForm.value = {
|
|
||||||
id: '',
|
|
||||||
name: '',
|
|
||||||
pattern:'',
|
|
||||||
father_Plan_Id:'',
|
|
||||||
dataSource_Id:'',
|
|
||||||
script_Id:'',
|
|
||||||
error_Sys_Id:'',
|
|
||||||
test_State: '',
|
|
||||||
report_State: '',
|
|
||||||
result:'',
|
|
||||||
};
|
|
||||||
dialogTitle.value = '新增检测计划';
|
|
||||||
isReadOnly.value = false;
|
|
||||||
dialogFormVisible.value = true; // 打开对话框
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRowClick = (planSystem: Plan.PlanBO) =>{
|
dialogForm.value = {
|
||||||
dialogForm.value = {...planSystem};
|
id: '',
|
||||||
dialogTitle.value = '查看检测计划';
|
name: '',
|
||||||
isReadOnly.value = true;
|
pattern: '',
|
||||||
dialogFormVisible.value = true; // 打开对话框
|
father_Plan_Id: '',
|
||||||
|
dataSource_Id: '',
|
||||||
|
script_Id: '',
|
||||||
|
error_Sys_Id: '',
|
||||||
|
test_State: '',
|
||||||
|
report_State: '',
|
||||||
|
result: '',
|
||||||
|
}
|
||||||
|
dialogTitle.value = '新增检测计划'
|
||||||
|
isReadOnly.value = false
|
||||||
|
dialogFormVisible.value = true // 打开对话框
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRowClick = (planSystem: Plan.PlanBO) => {
|
||||||
|
dialogForm.value = { ...planSystem }
|
||||||
|
dialogTitle.value = '查看检测计划'
|
||||||
|
isReadOnly.value = true
|
||||||
|
dialogFormVisible.value = true // 打开对话框
|
||||||
}
|
}
|
||||||
|
|
||||||
const showDeviceOpen = (planSystem: Plan.PlanBO) => {
|
const showDeviceOpen = (planSystem: Plan.PlanBO) => {
|
||||||
devTransferVisible.value = true;
|
devTransferVisible.value = true
|
||||||
//openDeviceView.value.open('计划设备列表')
|
//openDeviceView.value.open('计划设备列表')
|
||||||
}
|
}
|
||||||
|
|
||||||
const showtestSourceOpen=(planSystem: Plan.PlanBO)=>{
|
const showtestSourceOpen = (planSystem: Plan.PlanBO) => {
|
||||||
openSourceView.value.open('计划检测源列表')
|
sourceTransferVisible.value = true
|
||||||
|
// openSourceView.value.open('计划检测源列表')
|
||||||
// router.push({
|
// router.push({
|
||||||
// path: "/machine/testSource",
|
// path: "/machine/testSource",
|
||||||
// });
|
// });
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
>{{ item.name }}</el-checkbox
|
>{{ item.name }}</el-checkbox
|
||||||
>
|
>
|
||||||
<el-button type="primary" @click="handlePreTest">启动预检测</el-button>
|
<el-button type="primary" @click="handlePreTest">启动预检测</el-button>
|
||||||
<el-button type="primary" @click="handleBackDeviceList"
|
|
||||||
>返回设备列表</el-button
|
|
||||||
>
|
|
||||||
<el-button type="primary" @click="handleAutoTest">进入检测流程</el-button>
|
<el-button type="primary" @click="handleAutoTest">进入检测流程</el-button>
|
||||||
|
<el-button type="primary" @click="handleBackDeviceList"
|
||||||
|
>返回检测首页</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="test_bot">
|
<div class="test_bot">
|
||||||
<div class="bot_left">
|
<div class="bot_left">
|
||||||
@@ -158,7 +158,7 @@ const handlePreTest = () => {
|
|||||||
} else {
|
} else {
|
||||||
timer = setInterval(async () => {
|
timer = setInterval(async () => {
|
||||||
count++;
|
count++;
|
||||||
if (count > 5) return;
|
if (count > 15) return;
|
||||||
await nextTick(() => {
|
await nextTick(() => {
|
||||||
leftDeviceData.value.push({
|
leftDeviceData.value.push({
|
||||||
id: count,
|
id: count,
|
||||||
@@ -178,7 +178,7 @@ const handleAutoTest = () => {
|
|||||||
//返回设备列表
|
//返回设备列表
|
||||||
const handleBackDeviceList = () => {
|
const handleBackDeviceList = () => {
|
||||||
router.push({
|
router.push({
|
||||||
path: "/plan/singlePlanList",
|
path: "/plan/home/index",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//左侧数据
|
//左侧数据
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
||||||
|
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
||||||
<el-divider >基础数据</el-divider>
|
<el-divider >基础数据</el-divider>
|
||||||
<el-form-item label='数据模型' :label-width='140' prop='dataType'>
|
<el-form-item label='数据模型' :label-width='140' prop='dataType'>
|
||||||
@@ -167,7 +166,6 @@
|
|||||||
import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq'
|
import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq'
|
||||||
import { computed, type Ref, ref } from 'vue';
|
import { computed, type Ref, ref } from 'vue';
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { el } from 'element-plus/es/locale';
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const selectedStatMethods = ref<string[]>([])
|
const selectedStatMethods = ref<string[]>([])
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
@@ -230,26 +228,13 @@ import { el } from 'element-plus/es/locale';
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
formContent.value.statMethod = selectedStatMethods.value.join(',')
|
formContent.value.statMethod = selectedStatMethods.value.join(',')
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
const result = await updateDictPq(formContent.value);
|
await updateDictPq(formContent.value);
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
if(result.code != 'A0000'){
|
|
||||||
ElMessage.error({ message: result.message})
|
|
||||||
}else{
|
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const result = await addDictPq(formContent.value);
|
const result = await addDictPq(formContent.value);
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
if(result.code != 'A0000'){
|
|
||||||
ElMessage.error({ message: result.message})
|
|
||||||
}else{
|
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
|
||||||
|
|
||||||
close()
|
close()
|
||||||
// 刷新表格
|
// 刷新表格
|
||||||
await props.refreshTable!()
|
await props.refreshTable!()
|
||||||
@@ -264,7 +249,6 @@ import { el } from 'element-plus/es/locale';
|
|||||||
const open = (sign: string, data: Dict.ResDictPq) => {
|
const open = (sign: string, data: Dict.ResDictPq) => {
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
//console.log(dictStore)
|
|
||||||
selectedStatMethods.value = data.statMethod ? data.statMethod.split(',') : []
|
selectedStatMethods.value = data.statMethod ? data.statMethod.split(',') : []
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
|
|||||||
@@ -1,207 +1,178 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class='table-box' ref='popupBaseView'>
|
<div class='table-box' ref='popupBaseView'>
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:request-api='getDictPqList'
|
:request-api='getDictPqList'
|
||||||
>
|
>
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
|
||||||
@click='batchDelete(scope.selectedListIds)'>
|
@click='batchDelete(scope.selectedListIds)'>
|
||||||
批量删除
|
批量删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #operation='scope'>
|
|
||||||
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</ProTable>
|
|
||||||
</div>
|
|
||||||
<PqPopup :refresh-table='proTable?.getTableList' ref='pqPopup'/>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang='tsx' name='dict'>
|
|
||||||
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue'
|
|
||||||
import {type Dict} from '@/api/system/dictionary/interface'
|
|
||||||
import {ProTableInstance, ColumnProps} from '@/components/ProTable/interface'
|
|
||||||
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
|
||||||
import {useDictStore} from '@/stores/modules/dict'
|
|
||||||
import {useHandleData} from '@/hooks/useHandleData'
|
|
||||||
import {
|
|
||||||
getDictPqList,
|
|
||||||
deleteDictPq,
|
|
||||||
} from '@/api/system/dictionary/dictPq'
|
|
||||||
import { reactive, ref } from 'vue'
|
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<PqPopup :refresh-table='proTable?.getTableList' ref='pqPopup' />
|
||||||
|
</template>
|
||||||
|
|
||||||
const proTable = ref<ProTableInstance>()
|
<script setup lang='tsx' name='dict'>
|
||||||
const pqPopup = ref()
|
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
|
||||||
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import {
|
||||||
|
getDictPqList,
|
||||||
|
deleteDictPq,
|
||||||
|
} from '@/api/system/dictionary/dictPq'
|
||||||
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
const pqPopup = ref()
|
||||||
|
|
||||||
const columns = reactive<ColumnProps<Dict.ResDictPq>[]>([
|
const columns = reactive<ColumnProps<Dict.ResDictPq>[]>([
|
||||||
{type: 'selection', fixed: 'left', width: 70},
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{type: 'index', fixed: 'left', width: 70, label: '序号'},
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
{
|
{
|
||||||
prop: 'dataType',
|
prop: 'dataType',
|
||||||
label: '数据模型',
|
label: '数据模型',
|
||||||
width: 180,
|
width: 180,
|
||||||
enum: dictStore.getDictData('Cs_Data_Type'),
|
enum: dictStore.getDictData('Cs_Data_Type'),
|
||||||
search: { el: 'select', props: { filterable: true } },
|
search: { el: 'select', props: { filterable: true } },
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'name',
|
|
||||||
label: '指标名称',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'input',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'otherName',
|
|
||||||
label: '别名',
|
|
||||||
minWidth: 300,
|
|
||||||
search: {
|
|
||||||
el: 'input',
|
|
||||||
},
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.otherName;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'showName',
|
|
||||||
label: '显示名称',
|
|
||||||
width: 180,
|
|
||||||
search: {
|
|
||||||
el: 'input',
|
|
||||||
},
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.showName;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'phase',
|
|
||||||
label: '相别',
|
|
||||||
width: 180,
|
|
||||||
enum: dictStore.getDictData('phase'),
|
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'unit',
|
|
||||||
label: '单位',
|
|
||||||
width: 180,
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.unit;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'type',
|
|
||||||
label: '指标数据类型',
|
|
||||||
width: 180,
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.type;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'harmStart',
|
|
||||||
label: '数据谐波次数',
|
|
||||||
width: 180,
|
|
||||||
render: (scope) => {
|
|
||||||
return (scope.row.harmStart && scope.row.harmEnd)
|
|
||||||
? `${scope.row.harmStart}-${scope.row.harmEnd}`
|
|
||||||
: '/'; // 如果 harmStart 或 harmEnd 为空,返回 '/'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'statMethod',
|
|
||||||
label: '数据统计类型',
|
|
||||||
width: 250,
|
|
||||||
enum: dictStore.getDictData('Stat_Method'),
|
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
|
||||||
render: (scope) => {
|
|
||||||
// 假设 statMethod 是一个数组,包含多个 'code' 值
|
|
||||||
const codes = scope.row.statMethod; // 获取当前行的 statMethod 字段
|
|
||||||
//console.log('codes',codes)
|
|
||||||
if (!codes) {
|
|
||||||
return '/'; // 如果 statMethod 为 undefined 或 null,返回 '/'
|
|
||||||
}
|
|
||||||
// 确保 codes 是一个字符串
|
|
||||||
const codeString = Array.isArray(codes) ? codes.join(',') : codes;
|
|
||||||
const codeArray = codeString.split(',');
|
|
||||||
if (codeArray.length > 1) {
|
|
||||||
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
|
||||||
//console.log('codeArray',codeArray)
|
|
||||||
const names = codeArray.map(code => {
|
|
||||||
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === code);
|
|
||||||
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
|
|
||||||
});
|
|
||||||
//console.log('names',names)
|
|
||||||
return names.join(', '); // 用逗号连接所有的 name
|
|
||||||
}
|
|
||||||
// 查找单个 code 对应的 name
|
|
||||||
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === codeArray[0]);
|
|
||||||
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
prop: 'name',
|
||||||
prop: 'classId',
|
label: '指标名称',
|
||||||
label: '数据表表名',
|
width: 180,
|
||||||
width: 180,
|
search: {
|
||||||
enum: dictStore.getDictData('Data'),
|
el: 'input',
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
prop: 'resourcesId',
|
{
|
||||||
label: '报表数据来源',
|
prop: 'otherName',
|
||||||
width: 180,
|
label: '别名',
|
||||||
enum: dictStore.getDictData('Data_Day'),
|
minWidth: 300,
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
search: {
|
||||||
render: (scope) => {
|
el: 'input',
|
||||||
const codes = scope.row.resourcesId;
|
}
|
||||||
return codes || '/';
|
},
|
||||||
|
{
|
||||||
|
prop: 'showName',
|
||||||
|
label: '显示名称',
|
||||||
|
width: 180,
|
||||||
|
search: {
|
||||||
|
el: 'input',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'phase',
|
||||||
|
label: '相别',
|
||||||
|
width: 180,
|
||||||
|
enum: dictStore.getDictData('phase'),
|
||||||
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'unit',
|
||||||
|
label: '单位',
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'type',
|
||||||
|
label: '指标数据类型',
|
||||||
|
width: 180
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'harmStart',
|
||||||
|
label: '数据谐波次数',
|
||||||
|
width: 180,
|
||||||
|
render: (scope) => {
|
||||||
|
return (scope.row.harmStart && scope.row.harmEnd)
|
||||||
|
? `${scope.row.harmStart}-${scope.row.harmEnd}`
|
||||||
|
: '/' // 如果 harmStart 或 harmEnd 为空,返回 '/'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'statMethod',
|
||||||
|
label: '数据统计类型',
|
||||||
|
width: 250,
|
||||||
|
enum: dictStore.getDictData('Stat_Method'),
|
||||||
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
|
render: (scope) => {
|
||||||
|
// 假设 statMethod 是一个数组,包含多个 'code' 值
|
||||||
|
const codes = scope.row.statMethod // 获取当前行的 statMethod 字段
|
||||||
|
if (!codes) {
|
||||||
|
return '/'
|
||||||
}
|
}
|
||||||
|
// 确保 codes 是一个字符串
|
||||||
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
||||||
|
const codeArray = codeString.split(',')
|
||||||
|
if (codeArray.length > 1) {
|
||||||
|
console.log('多个 code', codeString)
|
||||||
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
||||||
|
const names = codeArray.map(code => {
|
||||||
|
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === code)
|
||||||
|
return dictItem ? dictItem.name : '' // 如果找到匹配的项,返回对应的 name
|
||||||
|
})
|
||||||
|
return names.join(', ') // 用逗号连接所有的 name
|
||||||
|
}
|
||||||
|
// 查找单个 code 对应的 name
|
||||||
|
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === codeArray[0])
|
||||||
|
return dictItem ? dictItem.name : '' // 如果找到匹配的项,返回对应的 name
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
prop: 'operation',
|
{
|
||||||
label: '操作',
|
prop: 'classId',
|
||||||
fixed: 'right',
|
label: '数据表表名',
|
||||||
minWidth: 200,
|
width: 180,
|
||||||
},
|
enum: dictStore.getDictData('Data'),
|
||||||
])
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
|
|
||||||
|
|
||||||
// 打开 drawer(新增、编辑)
|
|
||||||
const openDialog = (titleType: string, row: Partial<Dict.ResDictPq> = {}) => {
|
|
||||||
pqPopup.value?.open(titleType, row)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除字典类型
|
|
||||||
const batchDelete = async (id: string[]) => {
|
|
||||||
await useHandleData(deleteDictPq, id, '删除所选字典类型')
|
|
||||||
proTable.value?.clearSelection()
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除字典类型
|
|
||||||
const handleDelete = async (params: Dict.ResDictPq) => {
|
|
||||||
await useHandleData(deleteDictPq, [params.id], `删除【${params.name}】指标字典类型`)
|
|
||||||
proTable.value?.getTableList()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
</script>
|
{
|
||||||
|
prop: 'resourcesId',
|
||||||
|
label: '报表数据来源',
|
||||||
|
width: 180,
|
||||||
|
enum: dictStore.getDictData('Data_Day'),
|
||||||
|
fieldNames: { label: 'name', value: 'code' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'operation',
|
||||||
|
label: '操作',
|
||||||
|
fixed: 'right',
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
// 打开 drawer(新增、编辑)
|
||||||
|
const openDialog = (titleType: string, row: Partial<Dict.ResDictPq> = {}) => {
|
||||||
|
pqPopup.value?.open(titleType, row)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除字典类型
|
||||||
|
const batchDelete = async (id: string[]) => {
|
||||||
|
await useHandleData(deleteDictPq, id, '删除所选字典类型')
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除字典类型
|
||||||
|
const handleDelete = async (params: Dict.ResDictPq) => {
|
||||||
|
await useHandleData(deleteDictPq, [params.id], `删除【${params.name}】指标字典类型`)
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
<el-input v-model='formContent.code' placeholder='请输入' autocomplete='off' />
|
<el-input v-model='formContent.code' placeholder='请输入' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开启等级" :label-width="100">
|
<el-form-item label="开启等级" :label-width="100">
|
||||||
<el-radio-group v-model="formContent.openLevel" size="medium">
|
<el-radio-group v-model="formContent.openLevel" >
|
||||||
<el-radio-button label="开启" :value="1"></el-radio-button>
|
<el-radio-button label="开启" :value="1"></el-radio-button>
|
||||||
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开启描述" :label-width="100">
|
<el-form-item label="开启描述" :label-width="100">
|
||||||
<el-radio-group v-model="formContent.openDescribe" size="medium">
|
<el-radio-group v-model="formContent.openDescribe" >
|
||||||
<el-radio-button label="开启" :value="1"></el-radio-button>
|
<el-radio-button label="开启" :value="1"></el-radio-button>
|
||||||
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
|||||||
@@ -30,13 +30,11 @@ import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons
|
|||||||
import { Dict } from '@/api/system/dictionary/interface'
|
import { Dict } from '@/api/system/dictionary/interface'
|
||||||
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
|
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
@@ -57,7 +55,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'code',
|
prop: 'code',
|
||||||
label: '类型编码',
|
label: '类型编码',
|
||||||
minWidth: 200,
|
minWidth: 220,
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
},
|
||||||
@@ -65,7 +63,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: '描述',
|
label: '描述',
|
||||||
minWidth: 300,
|
minWidth: 250,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'sort',
|
prop: 'sort',
|
||||||
@@ -81,7 +79,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
minWidth: 300,
|
minWidth: 250,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user