增加检测计划功能
This commit is contained in:
@@ -4,41 +4,60 @@ import type { DatetimeFormatProps } from 'vue-i18n';
|
|||||||
// 检测计划模块
|
// 检测计划模块
|
||||||
export namespace Plan {
|
export namespace Plan {
|
||||||
|
|
||||||
// 检测计划列表
|
// 检测计划接口
|
||||||
export interface PlanList {
|
export interface PlanBO {
|
||||||
id: string; //检测计划ID
|
id?: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id: string; //父计划ID
|
father_Plan_Id?: string; //父计划ID
|
||||||
dataSource_Id: string; //数据源ID
|
dataSource_Id: string; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
script_Id: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
error_Sys_Id: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
test_State: string; //检测状态
|
||||||
report_State: string; //报告生成状态
|
report_State: string; //报告生成状态
|
||||||
result: string;//检测结果
|
result: string;//检测结果
|
||||||
state: number; //状态
|
|
||||||
create_By?: string; //创建用户
|
|
||||||
create_Time?: string;//创建时间
|
create_Time?: string;//创建时间
|
||||||
update_By?: string; //更新用户
|
|
||||||
update_Time?: string; //更新时间
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检测计划 + 分页
|
||||||
|
export interface ReqPlanParams extends ReqPage,PlanBO {
|
||||||
|
|
||||||
|
}
|
||||||
|
// // 检测计划列表
|
||||||
|
// export interface PlanList {
|
||||||
|
// id: string; //检测计划ID
|
||||||
|
// name: string; //检测计划名称
|
||||||
|
// pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
|
// father_Plan_Id: string; //父计划ID
|
||||||
|
// dataSource_Id: string; //数据源ID
|
||||||
|
// script_Id: string; //检测脚本ID
|
||||||
|
// error_Sys_Id: string;//误差体系ID
|
||||||
|
// test_State: string; //检测状态
|
||||||
|
// report_State: string; //报告生成状态
|
||||||
|
// result: string;//检测结果
|
||||||
|
// state: number; //状态
|
||||||
|
// create_By?: string; //创建用户
|
||||||
|
// create_Time?: string;//创建时间
|
||||||
|
// update_By?: string; //更新用户
|
||||||
|
// update_Time?: string; //更新时间
|
||||||
|
// }
|
||||||
|
|
||||||
// 被检设备参数
|
// // 被检设备参数
|
||||||
export interface ReqPlanParams extends ReqPage {
|
// export interface ReqPlanParams extends ReqPage {
|
||||||
id: string; //检测计划ID
|
// id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
// name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
// pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id: string; //父计划ID
|
// father_Plan_Id: string; //父计划ID
|
||||||
dataSource_Id: string; //数据源ID
|
// dataSource_Id: string; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
// script_Id: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
// error_Sys_Id: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
// test_State: string; //检测状态
|
||||||
report_State: string; //报告生成状态
|
// report_State: string; //报告生成状态
|
||||||
result: string;//检测结果
|
// result: string;//检测结果
|
||||||
state: number; //状态
|
// state: number; //状态
|
||||||
create_By?: string; //创建用户
|
// create_By?: string; //创建用户
|
||||||
create_Time?: string;//创建时间
|
// create_Time?: string;//创建时间
|
||||||
update_By?: string; //更新用户
|
// update_By?: string; //更新用户
|
||||||
update_Time?: string; //更新时间
|
// update_Time?: string; //更新时间
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
27
frontend/src/api/plan/plan.ts
Normal file
27
frontend/src/api/plan/plan.ts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { ResPage } from '@/api/interface'
|
||||||
|
import { Plan } from './interface'
|
||||||
|
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
||||||
|
import http from '@/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name 检测计划管理模块
|
||||||
|
*/
|
||||||
|
// 获取检测计划列表
|
||||||
|
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
||||||
|
return http.post<ResPage<Plan.PlanBO>>(`/plan/list`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增检测计划
|
||||||
|
export const addPlan = (params: Plan.PlanBO) => {
|
||||||
|
return http.post(`/role/add`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑检测计划
|
||||||
|
export const editPlan = (params: Plan.PlanBO) => {
|
||||||
|
return http.post(`/role/edit`, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除检测计划
|
||||||
|
export const deletePlan = (params: { id: string[] }) => {
|
||||||
|
return http.post(`/role/del`, params)
|
||||||
|
}
|
||||||
@@ -1,125 +1,313 @@
|
|||||||
import type {Plan} from "./interface"
|
import type {Plan} from "./interface"
|
||||||
|
|
||||||
const plandata = ref<Plan.PlanList[]>([
|
/**
|
||||||
|
* Dict 字典属性
|
||||||
|
* id: 唯一标识
|
||||||
|
* label: 名称
|
||||||
|
*/
|
||||||
|
interface Dict {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dictPattern: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '数字',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '模拟',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '比对',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictTestState: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '未检',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '检测中',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '检测完成',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictReportState: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '未生成',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '部分生成',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '全部生成',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const dictResult: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "0",
|
||||||
|
label: '符合',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '不符合',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部检测计划名称与ID
|
||||||
|
const testPlanDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '模拟检测计划1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '模拟检测计划2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '模拟检测计划3',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部数据源名称与ID
|
||||||
|
const testSoureDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '实时数据',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '分钟统计数据最大值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '分钟统计数据最小值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: '分钟统计数据平均值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '分钟统计数据CP95值',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "6",
|
||||||
|
label: '录波数据',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部检测脚本名称与ID
|
||||||
|
const testScriptDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: '国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: '国网入网检测脚本(Q/GDW 10650.4 - 2021) 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: '国网入网检测脚本(Q/GDW 1650.4 - 2016) 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "4",
|
||||||
|
label: 'GBT 19862 - 2016 模拟式',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "5",
|
||||||
|
label: '北京比对检测脚本',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
//全部误差体系名称与ID
|
||||||
|
const testErrSystDataList: Dict[] = [
|
||||||
|
{
|
||||||
|
id: "1",
|
||||||
|
label: 'Q/GDW 1650.2- 2016',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "2",
|
||||||
|
label: 'Q/GDW 10650.2 - 2021',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "3",
|
||||||
|
label: 'GBT 19862 - 2016',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const planData = ref<Plan.PlanBO[]>([
|
||||||
|
{
|
||||||
|
'id': '1',
|
||||||
|
'name': '检测计划1',
|
||||||
|
'pattern':'1',
|
||||||
|
'dataSource_Id':'1',
|
||||||
|
'script_Id':'1',
|
||||||
|
'error_Sys_Id':'1',
|
||||||
|
'test_State':'1',
|
||||||
|
'report_State':'1',
|
||||||
|
'result':'1',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'id': '1',
|
'id': '2',
|
||||||
'name': '检测计划1',
|
'name': '检测子计划2',
|
||||||
'pattern':'模拟式',
|
'pattern':'1',
|
||||||
'father_Plan_Id':'/',
|
'father_Plan_Id':'1',
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
'dataSource_Id':'2',
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
'script_Id':'2',
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
'error_Sys_Id':'2',
|
||||||
'test_State':'未检',
|
'test_State':'2',
|
||||||
'report_State':'未生成',
|
'report_State':'2',
|
||||||
'result':'符合',
|
'result':'2',
|
||||||
'state': 1,
|
},
|
||||||
'create_By':'',
|
{
|
||||||
'create_Time':'',
|
'id': '3',
|
||||||
'update_By':'',
|
'name': '检测子计划1-2',
|
||||||
'update_Time':'',
|
'pattern':'1',
|
||||||
},
|
'father_Plan_Id':'1',
|
||||||
{
|
'dataSource_Id':'3',
|
||||||
'id': '2',
|
'script_Id':'3',
|
||||||
'name': '检测子计划1-1',
|
'error_Sys_Id':'3',
|
||||||
'pattern':'模拟式',
|
'test_State':'3',
|
||||||
'father_Plan_Id':'检测计划1',
|
'report_State':'3',
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
'result':'3',
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
},
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '3',
|
|
||||||
'name': '检测子计划1-2',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'检测计划1',
|
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '4',
|
|
||||||
'name': '检测计划2',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据最小值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 10650.2 - 2021',
|
|
||||||
'test_State':'检测完成',
|
|
||||||
'report_State':'部分生成',
|
|
||||||
'result':'不符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '5',
|
|
||||||
'name': '检测计划3',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据最大值',
|
|
||||||
'script_Id':'/',
|
|
||||||
'error_Sys_Id':'/',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '6',
|
|
||||||
'name': '检测子计划4',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'/',
|
|
||||||
'dataSource_Id':'分钟统计数据CP95值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'id': '7',
|
|
||||||
'name': '检测子计划4-1',
|
|
||||||
'pattern':'模拟式',
|
|
||||||
'father_Plan_Id':'检测计划4',
|
|
||||||
'dataSource_Id':'分钟统计数据CP95值',
|
|
||||||
'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
|
||||||
'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
|
||||||
'test_State':'未检',
|
|
||||||
'report_State':'未生成',
|
|
||||||
'result':'符合',
|
|
||||||
'state': 1,
|
|
||||||
'create_By':'',
|
|
||||||
'create_Time':'',
|
|
||||||
'update_By':'',
|
|
||||||
'update_Time':'',
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
|
|
||||||
export default plandata
|
// const plandata = ref<Plan.PlanList[]>([
|
||||||
|
// {
|
||||||
|
// 'id': '1',
|
||||||
|
// 'name': '检测计划1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '2',
|
||||||
|
// 'name': '检测子计划1-1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划1',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '3',
|
||||||
|
// 'name': '检测子计划1-2',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划1',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '4',
|
||||||
|
// 'name': '检测计划2',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最小值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 10650.2 - 2021',
|
||||||
|
// 'test_State':'检测完成',
|
||||||
|
// 'report_State':'部分生成',
|
||||||
|
// 'result':'不符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '5',
|
||||||
|
// 'name': '检测计划3',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据最大值',
|
||||||
|
// 'script_Id':'/',
|
||||||
|
// 'error_Sys_Id':'/',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '6',
|
||||||
|
// 'name': '检测子计划4',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'/',
|
||||||
|
// 'dataSource_Id':'分钟统计数据CP95值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 'id': '7',
|
||||||
|
// 'name': '检测子计划4-1',
|
||||||
|
// 'pattern':'模拟式',
|
||||||
|
// 'father_Plan_Id':'检测计划4',
|
||||||
|
// 'dataSource_Id':'分钟统计数据CP95值',
|
||||||
|
// 'script_Id':'国网入网检测脚本(单影响量-模拟式)',
|
||||||
|
// 'error_Sys_Id':'Q/GDW 1650.2- 2016',
|
||||||
|
// 'test_State':'未检',
|
||||||
|
// 'report_State':'未生成',
|
||||||
|
// 'result':'符合',
|
||||||
|
// 'state': 1,
|
||||||
|
// 'create_By':'',
|
||||||
|
// 'create_Time':'',
|
||||||
|
// 'update_By':'',
|
||||||
|
// 'update_Time':'',
|
||||||
|
// },
|
||||||
|
// ])
|
||||||
|
|
||||||
|
export {planData,dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
:title='title'
|
:title='title'
|
||||||
:width='width'
|
:width='width'
|
||||||
:modal='false'>
|
:modal='false'>
|
||||||
<div class='table-box'>
|
<div class='table-box'>
|
||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
@@ -16,20 +16,29 @@
|
|||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader>
|
<template #tableHeader="scope">
|
||||||
<el-button type='primary' :icon='Download' >导入设备</el-button>
|
<el-tooltip content="通过文件导入设备" placement="top">
|
||||||
<el-button type='primary' :icon='Download' >下载报告</el-button>
|
<el-button type='primary' :icon='Download' tooltip >导入设备</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!multipleSelection.length'>
|
</el-tooltip>
|
||||||
批量删除
|
<el-tooltip content="通过设备列表导入设备" placement="top">
|
||||||
|
<el-button type='primary' :icon='Download' tooltip @click="showDeviceSelectOpen">筛选设备</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="把设备列表导出成文件" placement="top" :disabled='!scope.isSelected'>
|
||||||
|
<el-button type='primary' :icon='Download' tooltip >导出设备</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
|
批量移除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<!-- <el-button type='primary' :icon='Download' >下载报告</el-button> -->
|
||||||
<!-- 表格操作 -->
|
<!-- 表格操作 -->
|
||||||
<template #operation>
|
<template #operation='scope'>
|
||||||
<el-button type='primary' link :icon='View'>查看</el-button>
|
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||||
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
<el-button type='primary' link :icon='Delete' >移除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
</div>
|
</div>
|
||||||
|
<DeviceSelectOpen :width='width' :height='height' ref='openDeviceSelectView' />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang='tsx'>
|
<script setup lang='tsx'>
|
||||||
@@ -39,13 +48,17 @@
|
|||||||
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 deviceDataList from '@/api/device/deviceData'
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
|
import DeviceSelectOpen from '@/views/plan/planList/components/devSelectPopup.vue'
|
||||||
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
|
|
||||||
|
//const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
const deviceData = deviceDataList.plan_devicedata
|
const deviceData = deviceDataList.plan_devicedata
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
const openDeviceSelectView = ref()
|
||||||
let multipleSelection = ref<string[]>([])
|
let multipleSelection = ref<string[]>([])
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Device.DeviceList>[]>([
|
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
@@ -108,9 +121,13 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
//选中
|
|
||||||
|
|
||||||
|
const showDeviceSelectOpen = () => {
|
||||||
|
openDeviceSelectView.value.open('设备筛选列表')
|
||||||
|
}
|
||||||
// 处理选择变化
|
// 处理选择变化
|
||||||
const handleSelectionChange = (selection:Device.DeviceList[]) => {
|
const handleSelectionChange = (selection:Device.ResPqDev[]) => {
|
||||||
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
||||||
|
|
||||||
};
|
};
|
||||||
142
frontend/src/views/plan/planList/components/devSelectPopup.vue
Normal file
142
frontend/src/views/plan/planList/components/devSelectPopup.vue
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog class='table-box'
|
||||||
|
v-model='dialogVisible'
|
||||||
|
top='114px'
|
||||||
|
:style="{height:height,maxHeight:height,overflow:'hidden'}"
|
||||||
|
:title='title'
|
||||||
|
:width='width'
|
||||||
|
:modal='false'>
|
||||||
|
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='deviceData'
|
||||||
|
type='selection'
|
||||||
|
>
|
||||||
|
<!-- :requestApi="getRoleList" -->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { Device } from '@/api/device/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getPqDevList,
|
||||||
|
} from '@/api/device/device'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
const deviceData = deviceDataList.data
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ type: 1 })
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果你想在请求之前对当前请求参数做一些操作,可以自定义如下函数: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 getPqDevList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'deviceName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceType',
|
||||||
|
label: '类型',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceChannels',
|
||||||
|
label: '设备通道数',
|
||||||
|
minWidth: 120,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'PlanName',
|
||||||
|
label: '所属计划',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceUn',
|
||||||
|
label: '额定电压(V)',
|
||||||
|
minWidth: 130,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceIn',
|
||||||
|
label: '额定电流(A)',
|
||||||
|
minWidth: 130,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'deviceCompany',
|
||||||
|
label: '制作厂商',
|
||||||
|
minWidth: 280,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const exportClick = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
const open = (textTitle: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
title.value = textTitle
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '744px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="dialogTitle" :model-value="visible" @close="handleCancel" v-bind="dialogSmall">
|
<!-- 基础信息弹出框 -->
|
||||||
|
<el-dialog :model-value="visible" :title="dialogTitle" v-bind="dialogSmall" @close="handleCancel" width="500" draggable>
|
||||||
|
<div>
|
||||||
<el-form :model="formData" ref='formRuleRef' :rules='rules'>
|
<el-form :model="formData" ref='formRuleRef' :rules='rules'>
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name" :label-width="100">
|
||||||
<el-input v-model="formData.name" :disabled="isReadOnly"/>
|
<el-input v-model="formData.name" placeholder="请输入名称" autocomplete="off" :disabled="isReadOnly"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="父计划" prop="type">
|
<el-form-item label="父计划" prop="father_Plan_Id" :label-width="100">
|
||||||
<el-select v-model="formData.father_Plan_Id" placeholder="请选择父计划" :disabled="isReadOnly">
|
<el-select v-model="formData.father_Plan_Id" placeholder="请选择父计划" autocomplete="off" :disabled="isReadOnly" @change="fatherPlanChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in fatherPlanList"
|
v-for="plan in fatherPlanList"
|
||||||
:key="plan.value"
|
:key="plan.value"
|
||||||
@@ -13,37 +15,40 @@
|
|||||||
:value="plan.value">
|
:value="plan.value">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item> <el-form-item label="数据源" prop="type">
|
</el-form-item>
|
||||||
<el-select v-model="formData.dataSource_Id" placeholder="请选择数据源" :disabled="isReadOnly">
|
<el-form-item label="数据源" prop="dataSource_Id" :label-width="100">
|
||||||
|
<el-select v-model="formData.dataSource_Id" placeholder="请选择数据源" autocomplete="off" :disabled="isReadOnly">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in sourceList"
|
v-for="plan in testSoureDataList"
|
||||||
:key="plan.value"
|
:key="plan.id"
|
||||||
:label="plan.label"
|
:label="plan.label"
|
||||||
:value="plan.value">
|
:value="plan.id">
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item> <el-form-item label="检测脚本" prop="type">
|
|
||||||
<el-select v-model="formData.script_Id" placeholder="请选择检测脚本" :disabled="isReadOnly">
|
|
||||||
<el-option
|
|
||||||
v-for="plan in scriptList"
|
|
||||||
:key="plan.value"
|
|
||||||
:label="plan.label"
|
|
||||||
:value="plan.value">
|
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系" prop="type" >
|
<el-form-item label="检测脚本" prop="script_Id" :label-width="100">
|
||||||
<el-select v-model="formData.error_Sys_Id" placeholder="请选择误差体系" :disabled="isReadOnly">
|
<el-select v-model="formData.script_Id" placeholder="请选择检测脚本" autocomplete="off" :disabled="isReadOnly">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in errorList"
|
v-for="plan in testScriptDataList"
|
||||||
:key="plan.value"
|
:key="plan.id"
|
||||||
:label="plan.label"
|
:label="plan.label"
|
||||||
:value="plan.value">
|
:value="plan.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="误差体系" prop="error_Sys_Id" :label-width="100">
|
||||||
|
<el-select v-model="formData.error_Sys_Id" placeholder="请选择误差体系" autocomplete="off" :disabled="isReadOnly">
|
||||||
|
<el-option
|
||||||
|
v-for="plan in testErrSystDataList"
|
||||||
|
:key="plan.id"
|
||||||
|
:label="plan.label"
|
||||||
|
:value="plan.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
<el-button @click="handleCancel">取 消</el-button>
|
||||||
@@ -57,6 +62,8 @@
|
|||||||
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
||||||
import { dialogSmall} from '@/utils/elementBind'
|
import { dialogSmall} from '@/utils/elementBind'
|
||||||
|
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData} from '@/api/plan/planData'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
dialogTitle: string;
|
dialogTitle: string;
|
||||||
@@ -112,7 +119,11 @@ const emit = defineEmits<{
|
|||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||||
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
|
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
|
||||||
father_Plan_Id: [{ required: true, message: '参照标准名称必填!', trigger: 'change' }],
|
dataSource_Id: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
||||||
|
script_Id: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
||||||
|
error_Sys_Id: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
|
||||||
|
// name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
|
||||||
|
// father_Plan_Id: [{ required: true, message: '参照标准名称必填!', trigger: 'change' }],
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -137,7 +148,7 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ElMessage.error('表单验证失败!')
|
ElMessage.error('请填选必填项!')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
107
frontend/src/views/plan/planList/components/sourcePopup.vue
Normal file
107
frontend/src/views/plan/planList/components/sourcePopup.vue
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<!--单列-->
|
||||||
|
<template>
|
||||||
|
<el-dialog class='table-box'
|
||||||
|
v-model='dialogVisible'
|
||||||
|
top='114px'
|
||||||
|
:style="{height:height,maxHeight:height,overflow:'hidden'}"
|
||||||
|
:title='title'
|
||||||
|
:width='width'
|
||||||
|
:modal='false'>
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='SourceData'
|
||||||
|
type='selection'
|
||||||
|
>
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader="scope">
|
||||||
|
<el-tooltip content="通过检测源列表导入检测源" placement="top">
|
||||||
|
<el-button type='primary' :icon='Download' tooltip @click="showSourceSelectOpen">筛选检测源</el-button>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
|
批量移除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- <el-button type='primary' :icon='Download' >下载报告</el-button> -->
|
||||||
|
<!-- 表格操作 -->
|
||||||
|
<template #operation='scope'>
|
||||||
|
<el-button type='primary' link :icon='View' >查看</el-button>
|
||||||
|
<el-button type='primary' link :icon='Delete' >移除</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
<SourceSelectOpen :width='width' :height='height' ref='openSourceSelectView' />
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang='tsx'>
|
||||||
|
import { Delete, View ,Upload,Download} from '@element-plus/icons-vue'
|
||||||
|
import { reactive,ref } from 'vue'
|
||||||
|
import type { TestSource } from '@/api/testSource/interface'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import { type ProTableInstance, type ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
import sourceDataList from '@/api/testSource/testSourceData'
|
||||||
|
import SourceSelectOpen from '@/views/plan/planList/components/sourceSelectPopup.vue'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
|
||||||
|
const SourceData = sourceDataList
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const openSourceSelectView = ref()
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<TestSource.TestSourceBO>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'testSourceName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceType',
|
||||||
|
label: '设备类型',
|
||||||
|
// enum: dictStore.getDictData('testSourceDevType'),
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 220,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceModel',
|
||||||
|
label: '源类型',
|
||||||
|
// enum: dictStore.getDictData('testSourceType'),
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 330 },
|
||||||
|
])
|
||||||
|
|
||||||
|
const open = (textTitle: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
title.value = textTitle
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '744px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const showSourceSelectOpen = () => {
|
||||||
|
openSourceSelectView.value.open('检测源筛选列表')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog class='table-box'
|
||||||
|
v-model='dialogVisible'
|
||||||
|
top='114px'
|
||||||
|
:style="{height:height,maxHeight:height,overflow:'hidden'}"
|
||||||
|
:title='title'
|
||||||
|
:width='width'
|
||||||
|
:modal='false'>
|
||||||
|
|
||||||
|
<div class='table-box'>
|
||||||
|
<ProTable
|
||||||
|
ref='proTable'
|
||||||
|
:columns='columns'
|
||||||
|
:data='testSourceData'
|
||||||
|
type='selection'
|
||||||
|
>
|
||||||
|
<!-- :request-api="getTableList" 如果要显示静态数据,就切换该配置-->
|
||||||
|
<!-- 表格 header 按钮 -->
|
||||||
|
<template #tableHeader='scope'>
|
||||||
|
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
|
||||||
|
</template>
|
||||||
|
</ProTable>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang='tsx' name='useRole'>
|
||||||
|
import { TestSource } from '@/api/testSource/interface'
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
|
import ImportExcel from '@/components/ImportExcel/index.vue'
|
||||||
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
|
import { CirclePlus, Delete, EditPen, Share, Download, Upload, View, Refresh } from '@element-plus/icons-vue'
|
||||||
|
import testSourceDataList from '@/api/testSource/testSourceData'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import {
|
||||||
|
getTestSourceList,
|
||||||
|
} from '@/api/testSource/testSource'
|
||||||
|
|
||||||
|
const dictStore = useDictStore()
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const title = ref('')
|
||||||
|
const testSourceData = testSourceDataList
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
|
||||||
|
// 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
|
||||||
|
const initParam = reactive({ pattern: 1 })//表示当前用户选择的是模拟式测试,后期要读取pinia中的数据 TODO...
|
||||||
|
|
||||||
|
// dataCallback 是对于返回的表格数据做处理,如果你后台返回的数据不是 list && total 这些字段,可以在这里进行处理成这些字段
|
||||||
|
// 或者直接去 hooks/useTable.ts 文件中把字段改为你后端对应的就行
|
||||||
|
const dataCallback = (data: any) => {
|
||||||
|
return {
|
||||||
|
list: data.list,
|
||||||
|
total: data.total,
|
||||||
|
pageNum: data.pageNum,
|
||||||
|
pageSize: 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 getTestSourceList(newParams)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页面按钮权限(按钮权限既可以使用 hooks,也可以直接使用 v-auth 指令,指令适合直接绑定在按钮上,hooks 适合根据按钮权限显示不同的内容)
|
||||||
|
const { BUTTONS } = useAuthButtons()
|
||||||
|
|
||||||
|
// 表格配置项
|
||||||
|
const columns = reactive<ColumnProps<TestSource.TestSourceBO>[]>([
|
||||||
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
{
|
||||||
|
prop: 'testSourceName',
|
||||||
|
label: '名称',
|
||||||
|
search: { el: 'input' },
|
||||||
|
minWidth: 180,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceType',
|
||||||
|
label: '设备类型',
|
||||||
|
// enum: dictStore.getDictData('testSourceDevType'),
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 220,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'testSourceModel',
|
||||||
|
label: '源类型',
|
||||||
|
// enum: dictStore.getDictData('testSourceType'),
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
search: { el: 'select' },
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
const exportClick = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
const open = (textTitle: string) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
title.value = textTitle
|
||||||
|
}
|
||||||
|
defineExpose({ open })
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '800px',
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: '744px',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -7,26 +7,27 @@
|
|||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='Download' >导入</el-button>
|
<el-button type='primary' :icon='Download' @click="importClick">导入</el-button>
|
||||||
<el-button type='primary' :icon='CirclePlus' >合并</el-button>
|
<el-button type='primary' :icon='CirclePlus' :disabled='!(scope.selectedList.length > 1)' @click="combineClick">合并</el-button>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
|
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
|
||||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||||
批量删除
|
批量删除
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<input type="file" style="display: none" ref="fileInput" @change="handleFiles">
|
||||||
</template>
|
</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'>导出</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>
|
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
||||||
<el-button type='primary' link :icon='List' @click="showDeviceOpen(scope.row)">设备</el-button>
|
<el-button type='primary' link :icon='List' @click="showDeviceOpen(scope.row)">所属设备</el-button>
|
||||||
<el-button type='primary' link :icon='List' @click="showtestSourceOpen(scope.row)">检测源</el-button>
|
<el-button type='primary' link :icon='List' @click="showtestSourceOpen(scope.row)">所属检测源</el-button>
|
||||||
</template>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
<!-- 新增/编辑误差体系对话框 -->
|
<!-- 向计划导入/导出设备对话框 -->
|
||||||
<PlanDialog
|
<planPopup
|
||||||
:visible="dialogFormVisible"
|
:visible="dialogFormVisible"
|
||||||
:formData="dialogForm"
|
:formData="dialogForm"
|
||||||
:dialogTitle="dialogTitle"
|
:dialogTitle="dialogTitle"
|
||||||
@@ -35,31 +36,44 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<open :width='viewWidth' :height='viewHeight' ref='openView' />
|
<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="ts" name='useProTable'>
|
||||||
import ProTable from '@/components/ProTable/index.vue'
|
import ProTable from '@/components/ProTable/index.vue'
|
||||||
import type { ColumnProps } from '@/components/ProTable/interface'
|
import TimeControl from '@/components/TimeControl/index.vue'
|
||||||
|
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} from '@element-plus/icons-vue'
|
||||||
import planDataList from '@/api/plan/planData'
|
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData} from '@/api/plan/planData'
|
||||||
import { reactive,ref } from 'vue'
|
import { reactive,ref } from 'vue'
|
||||||
import type { Plan } from '@/api/plan/interface'
|
import type { Plan } from '@/api/plan/interface'
|
||||||
import PlanDialog from "@/views/plan/planList/components/PlanDialog.vue"; // 导入子组件
|
import planPopup from "@/views/plan/planList/components/planPopup.vue"; // 导入子组件
|
||||||
import Open from '@/views/plan/planList/components/PlanOpen.vue'
|
import DeviceOpen from '@/views/plan/planList/components/devPopup.vue'
|
||||||
|
import SourceOpen from '@/views/plan/planList/components/sourcePopup.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 type { Action } from 'element-plus'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
// 定义包含和排除的单位
|
||||||
|
const includedUnits = ['日', '周', '月', '自定义']; // 可以根据需要包含的单位
|
||||||
|
const excludedUnits = ['季度','年']; // 要排除的单位
|
||||||
|
const defaultUnits = '日'; // 默认的单位
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
const openView = ref()
|
const openDeviceView = ref()
|
||||||
const planData = planDataList
|
const openSourceView = ref()
|
||||||
|
// ProTable 实例
|
||||||
|
const proTable = ref<ProTableInstance>()
|
||||||
|
// 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.PlanList>({
|
const dialogForm = ref<Plan.PlanBO>({
|
||||||
id: '',
|
id: '' ,
|
||||||
name: '',
|
name: '',
|
||||||
pattern:'',
|
pattern:'',
|
||||||
father_Plan_Id:'',
|
father_Plan_Id:'',
|
||||||
@@ -68,7 +82,6 @@ const dialogForm = ref<Plan.PlanList>({
|
|||||||
error_Sys_Id:'',
|
error_Sys_Id:'',
|
||||||
test_State: '',
|
test_State: '',
|
||||||
report_State: '',
|
report_State: '',
|
||||||
state:0,
|
|
||||||
result:'',
|
result:'',
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +89,7 @@ const dialogForm = ref<Plan.PlanList>({
|
|||||||
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Plan.PlanList>[]>([
|
const columns = reactive<ColumnProps<Plan.PlanBO>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{
|
{
|
||||||
prop: 'name',
|
prop: 'name',
|
||||||
@@ -87,16 +100,22 @@ const columns = reactive<ColumnProps<Plan.PlanList>[]>([
|
|||||||
prop: 'dataSource_Id',
|
prop: 'dataSource_Id',
|
||||||
label: '数据源名称',
|
label: '数据源名称',
|
||||||
width: 200,
|
width: 200,
|
||||||
|
enum: testSoureDataList,
|
||||||
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'script_Id',
|
prop: 'script_Id',
|
||||||
label: '检测脚本',
|
label: '检测脚本',
|
||||||
width: 300,
|
width: 300,
|
||||||
|
enum: testScriptDataList,
|
||||||
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'error_Sys_Id',
|
prop: 'error_Sys_Id',
|
||||||
label: '误差体系',
|
label: '误差体系',
|
||||||
width: 200,
|
width: 200,
|
||||||
|
enum: testErrSystDataList,
|
||||||
|
fieldNames: { label: 'label', value: 'id' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'test_State',
|
prop: 'test_State',
|
||||||
@@ -130,8 +149,77 @@ const columns = reactive<ColumnProps<Plan.PlanList>[]>([
|
|||||||
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 500, },
|
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 500, },
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const fileInput = ref<HTMLInputElement | null>(null); // 声明 fileInput
|
||||||
|
function openFileDialog() {
|
||||||
|
if (fileInput.value) {
|
||||||
|
fileInput.value.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFiles(event: Event) {
|
||||||
|
const target = event.target as HTMLInputElement;
|
||||||
|
const files = target.files;
|
||||||
|
if (files && files.length > 0) {
|
||||||
|
// 处理文件
|
||||||
|
console.log(files);
|
||||||
|
ElMessageBox.confirm(
|
||||||
|
'导入的数据与当前数据有冲突,请选择以哪个数据为主进行覆盖',
|
||||||
|
'数据冲突',
|
||||||
|
{
|
||||||
|
distinguishCancelAndClose: true,
|
||||||
|
confirmButtonText: '以导入数据为主覆盖',
|
||||||
|
cancelButtonText: '以当前数据为主覆盖',
|
||||||
|
type: 'warning',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message: '以导入数据为主完成数据覆盖',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((action: Action) => {
|
||||||
|
ElMessage({
|
||||||
|
type: 'info',
|
||||||
|
message:
|
||||||
|
action === 'cancel'
|
||||||
|
? '以当前数据为主完成数据覆盖'
|
||||||
|
: '取消本次导入操作',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 点击导入按钮
|
||||||
|
const importClick = () => {
|
||||||
|
openFileDialog()
|
||||||
|
}
|
||||||
|
// 点击导出按钮
|
||||||
|
const exportClick = () => {
|
||||||
|
openFileDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 点击合并按钮
|
||||||
|
const combineClick = () => {
|
||||||
|
ElMessageBox.prompt(
|
||||||
|
'请输入合并后的计划名称',
|
||||||
|
'检测计划合并',
|
||||||
|
{
|
||||||
|
confirmButtonText: 'OK',
|
||||||
|
cancelButtonText: 'Cancel',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(({ value }) => {
|
||||||
|
console.log(`合并后的计划名为:`,value)
|
||||||
|
proTable.value?.clearSelection()
|
||||||
|
proTable.value?.getTableList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 打开编辑对话框
|
// 打开编辑对话框
|
||||||
const openEditDialog = (planSystem: Plan.PlanList) => {
|
const openEditDialog = (planSystem: Plan.PlanBO) => {
|
||||||
dialogForm.value = {...planSystem};
|
dialogForm.value = {...planSystem};
|
||||||
dialogTitle.value = '编辑检测计划';
|
dialogTitle.value = '编辑检测计划';
|
||||||
isReadOnly.value = false;
|
isReadOnly.value = false;
|
||||||
@@ -150,7 +238,6 @@ const openAddDialog = () => {
|
|||||||
error_Sys_Id:'',
|
error_Sys_Id:'',
|
||||||
test_State: '',
|
test_State: '',
|
||||||
report_State: '',
|
report_State: '',
|
||||||
state:0,
|
|
||||||
result:'',
|
result:'',
|
||||||
};
|
};
|
||||||
dialogTitle.value = '新增检测计划';
|
dialogTitle.value = '新增检测计划';
|
||||||
@@ -158,21 +245,22 @@ const openAddDialog = () => {
|
|||||||
dialogFormVisible.value = true; // 打开对话框
|
dialogFormVisible.value = true; // 打开对话框
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRowClick = (planSystem: Plan.PlanList) =>{
|
const handleRowClick = (planSystem: Plan.PlanBO) =>{
|
||||||
dialogForm.value = {...planSystem};
|
dialogForm.value = {...planSystem};
|
||||||
dialogTitle.value = '查看检测计划';
|
dialogTitle.value = '查看检测计划';
|
||||||
isReadOnly.value = true;
|
isReadOnly.value = true;
|
||||||
dialogFormVisible.value = true; // 打开对话框
|
dialogFormVisible.value = true; // 打开对话框
|
||||||
}
|
}
|
||||||
|
|
||||||
const showDeviceOpen = (planSystem: Plan.PlanList) => {
|
const showDeviceOpen = (planSystem: Plan.PlanBO) => {
|
||||||
openView.value.open('设备列表')
|
openDeviceView.value.open('计划设备列表')
|
||||||
}
|
}
|
||||||
|
|
||||||
const showtestSourceOpen=(planSystem: Plan.PlanList)=>{
|
const showtestSourceOpen=(planSystem: Plan.PlanBO)=>{
|
||||||
router.push({
|
openSourceView.value.open('计划检测源列表')
|
||||||
path: "/machine/testSource",
|
// router.push({
|
||||||
});
|
// path: "/machine/testSource",
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user