检测计划
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -2,6 +2,7 @@
|
|||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"Chns",
|
"Chns",
|
||||||
"Combox",
|
"Combox",
|
||||||
|
"Datasource",
|
||||||
"daterange",
|
"daterange",
|
||||||
"devicedata",
|
"devicedata",
|
||||||
"errordata",
|
"errordata",
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ export namespace Device {
|
|||||||
*/
|
*/
|
||||||
export interface ReqPqDevParams extends ReqPage{
|
export interface ReqPqDevParams extends ReqPage{
|
||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
|
name: string; //设备名称
|
||||||
devType?: string; // 设备名称
|
devType?: string; // 设备名称
|
||||||
createTime?:string; //创建时间
|
createTime?:string; //创建时间
|
||||||
|
pattern:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +48,10 @@ export namespace Device {
|
|||||||
reportPath?: string| null; //报告路径
|
reportPath?: string| null; //报告路径
|
||||||
qRCode?: string| null; //设备关键信息二维码
|
qRCode?: string| null; //设备关键信息二维码
|
||||||
reCheckNum: number; //复检次数
|
reCheckNum: number; //复检次数
|
||||||
|
planId?:string;//检测计划Id
|
||||||
|
TimeCheckResult?:number;//守时检测结果(0:不符合1:符合)
|
||||||
|
FactorFlag?:number;//是否支持系数校准(0:不支持,1:支持)
|
||||||
|
FactorCheckResult?: number;//系数校准结果(0:不符合1:符合)
|
||||||
state: number; //状态
|
state: number; //状态
|
||||||
createBy?: string| null; //创建用户
|
createBy?: string| null; //创建用户
|
||||||
createTime?: string| null; //创建时间
|
createTime?: string| null; //创建时间
|
||||||
|
|||||||
@@ -11,13 +11,14 @@ export namespace TestScript {
|
|||||||
id: string; // 装置序号id 必填
|
id: string; // 装置序号id 必填
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
pattern:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测脚本接口
|
// 检测脚本接口
|
||||||
export interface ResTestScript {
|
export interface ResTestScript {
|
||||||
id?: string; //检测脚本ID
|
id?: string; //检测脚本ID
|
||||||
name: string; //检测脚本名称
|
name: string; //检测脚本名称
|
||||||
type: string; //检测脚本类型(字典表Code字段,脚本还是模板)
|
type: string; //设定0为脚本,1为模板
|
||||||
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
pattern: string;//检测脚本模式(字典表Code字段,数字、模拟、比对)
|
||||||
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
valueType?: string;//脚本值类型(字典表Code字段,相对值脚本、绝对值脚本、无)
|
||||||
standardName: string;//参照标准名称
|
standardName: string;//参照标准名称
|
||||||
|
|||||||
@@ -1,72 +1,44 @@
|
|||||||
import type { ReqPage } from '@/api/interface'
|
import type { ReqPage } from '@/api/interface'
|
||||||
import type { DatetimeFormatProps } from 'vue-i18n';
|
|
||||||
|
|
||||||
// 检测计划模块
|
// 检测计划模块
|
||||||
export namespace Plan {
|
export namespace Plan {
|
||||||
|
|
||||||
// 检测计划接口
|
// 检测计划接口
|
||||||
export interface PlanBO {
|
export interface ResPlan {
|
||||||
id?: string; //检测计划ID
|
id: string; //检测计划ID
|
||||||
name: string; //检测计划名称
|
name: string; //检测计划名称
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
pattern: string; //模式,字典表(数字、模拟、比对)
|
||||||
father_Plan_Id?: string; //父计划ID
|
fatherPlanId?: string; //父计划ID
|
||||||
dataSource_Id: string[]; //数据源ID
|
dataSourceId: string; //数据源ID
|
||||||
script_Id: string; //检测脚本ID
|
scriptId: string; //检测脚本ID
|
||||||
error_Sys_Id: string;//误差体系ID
|
errorSysId: string;//误差体系ID
|
||||||
test_State: string; //检测状态
|
timeCheck:number;//守时检测:0否,1。是
|
||||||
report_State: string; //报告生成状态
|
testState: number; //检测状态:0:未检、1:检测中、2:检测完成,默认为 0
|
||||||
result: string;//检测结果
|
reportState: number; //报告生成状态:0:未生成、1:部分生成、2:全部生成,默认为 0
|
||||||
create_Time?: string;//创建时间
|
result: number;//检测结果:0:不符合、1:符合、2:/,默认为 2
|
||||||
|
code:number; //自动生成,用于生成数据表后缀
|
||||||
|
state: number;//;状态:0-删除 1-正常
|
||||||
|
createBy?:string; //创建用户
|
||||||
|
createTime?:string; //创建时间
|
||||||
|
updateBy?:string; //更新用户
|
||||||
|
updateTime?:string; //更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 分页
|
// 检测计划 + 分页
|
||||||
export interface ReqPlanParams extends ReqPage,PlanBO {
|
export interface ReqPlanParams extends ReqPage,ResPlan {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测计划 + 检测源
|
|
||||||
export interface PlanAndSourceBO extends PlanBO {
|
export interface ReqPlan extends ResPlan {
|
||||||
testSourceName: string;//计划所属检测源
|
datasourceIds:string;
|
||||||
source_Id: string[];
|
sourceIds: string[];
|
||||||
device_Id?: string[];
|
planId:string;
|
||||||
testSourceList?: string[];//临时测试
|
scriptName: string ;
|
||||||
dataSource_Ids:string;
|
errorSysName: string;
|
||||||
|
sourceName: string ;
|
||||||
|
devIds:string[];
|
||||||
}
|
}
|
||||||
// // 检测计划列表
|
|
||||||
// export interface PlanList {
|
|
||||||
// id: string; //检测计划ID
|
|
||||||
// name: string; //检测计划名称
|
|
||||||
// pattern: string; //模式,字典表(数字、模拟、比对)
|
|
||||||
// father_Plan_Id: string; //父计划ID
|
|
||||||
// dataSource_Id: string; //数据源ID
|
|
||||||
// script_Id: string; //检测脚本ID
|
|
||||||
// error_Sys_Id: string;//误差体系ID
|
|
||||||
// test_State: string; //检测状态
|
|
||||||
// report_State: string; //报告生成状态
|
|
||||||
// result: string;//检测结果
|
|
||||||
// state: number; //状态
|
|
||||||
// create_By?: string; //创建用户
|
|
||||||
// create_Time?: string;//创建时间
|
|
||||||
// update_By?: string; //更新用户
|
|
||||||
// update_Time?: string; //更新时间
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 被检设备参数
|
|
||||||
// export interface ReqPlanParams extends ReqPage {
|
|
||||||
// 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; //更新时间
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,60 @@
|
|||||||
import { ResPage } from '@/api/interface'
|
import type { ResPage } from '@/api/interface'
|
||||||
import { Plan } from './interface'
|
import type { Plan } from './interface'
|
||||||
import { ADMIN as rePrefix } from '@/api/config/serviceName'
|
|
||||||
import http from '@/api'
|
import http from '@/api'
|
||||||
|
import type { TestSource } from '../device/interface/testSource'
|
||||||
|
import type { TestScript } from '../device/interface/testScript'
|
||||||
|
import type { ErrorSystem } from '../device/interface/error'
|
||||||
|
import type { Device } from '../device/interface/device'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name 检测计划管理模块
|
* @name 检测计划管理模块
|
||||||
*/
|
*/
|
||||||
// 获取检测计划列表
|
// 获取检测计划列表
|
||||||
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
export const getPlanList = (params: Plan.ReqPlanParams) => {
|
||||||
return http.post<ResPage<Plan.PlanBO>>(`/plan/list`, params)
|
return http.post(`/adPlan/list`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增检测计划
|
// 新增检测计划
|
||||||
export const addPlan = (params: Plan.PlanBO) => {
|
export const addPlan = (params: Plan.ResPlan) => {
|
||||||
return http.post(`/role/add`, params)
|
return http.post(`/adPlan/add`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 编辑检测计划
|
// 编辑检测计划
|
||||||
export const editPlan = (params: Plan.PlanBO) => {
|
export const updatePlan = (params: Plan.ResPlan) => {
|
||||||
return http.post(`/role/edit`, params)
|
return http.post(`/adPlan/update`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除检测计划
|
// 删除检测计划
|
||||||
export const deletePlan = (params: { id: string[] }) => {
|
export const deletePlan = (params: { id: string[] }) => {
|
||||||
return http.post(`/role/del`, params)
|
return http.post(`/adPlan/delete`, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取指定模式下所有检测源
|
||||||
|
export const getTestSourceList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqSource/getAll?patternId=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取指定模式下所有检测脚本
|
||||||
|
export const getPqScriptList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqScript/getAll?patternId=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取所有误差体系
|
||||||
|
export const getPqErrSysList = () => {
|
||||||
|
return http.get<ErrorSystem.ErrorSystemList>(`/pqErrSys/getAll`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取指定模式下所有未绑定的设备
|
||||||
|
export const getUnboundPqDevList = (params: Plan.ReqPlan) => {
|
||||||
|
return http.get(`/pqDev/listUnbound?pattern=${params.pattern}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据检测计划id查询出所有已绑定的设备
|
||||||
|
export const getBoundPqDevList = (params: any) => {
|
||||||
|
return http.post(`/pqDev/listBoundByPlanId`,params)
|
||||||
|
}
|
||||||
|
|
||||||
|
//检测计划绑定设备
|
||||||
|
export const BindPqDevList = (params: any) => {
|
||||||
|
return http.post(`/adPlan/bindDev`,params)
|
||||||
|
}
|
||||||
@@ -806,7 +806,7 @@ function tableHeaderInit(val: number) {
|
|||||||
tableKey.value += 1;
|
tableKey.value += 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log("test",columns);
|
//console.log("test",columns);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ const handleCheckFunction = (val: any) => {
|
|||||||
const resizeObserver = new ResizeObserver(entries => {
|
const resizeObserver = new ResizeObserver(entries => {
|
||||||
for (let entry of entries) {
|
for (let entry of entries) {
|
||||||
chartsWidth.value = entry.contentRect.width;
|
chartsWidth.value = entry.contentRect.width;
|
||||||
console.log('Charts Info Width:', chartsWidth.value);
|
//console.log('Charts Info Width:', chartsWidth.value);
|
||||||
|
|
||||||
pieRef1.value.reSize(chartsWidth.value * 0.95,180,true);
|
pieRef1.value.reSize(chartsWidth.value * 0.95,180,true);
|
||||||
pieRef2.value.reSize(chartsWidth.value * 0.95,180,true);
|
pieRef2.value.reSize(chartsWidth.value * 0.95,180,true);
|
||||||
|
|||||||
@@ -142,14 +142,16 @@ const openDialog = (titleType: string, row: Partial<Device.ResPqDev> = {}) => {
|
|||||||
|
|
||||||
// 批量删除设备
|
// 批量删除设备
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deletePqDev, id, '删除所选设备')
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||||
|
await useHandleData(deletePqDev, {'ids':id,'pattern': patternId} , '删除所选设备')
|
||||||
proTable.value?.clearSelection()
|
proTable.value?.clearSelection()
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除设备
|
// 删除设备
|
||||||
const handleDelete = async (params: Device.ResPqDev) => {
|
const handleDelete = async (params: Device.ResPqDev) => {
|
||||||
await useHandleData(deletePqDev, [params.id], `删除【${params.name}】设备`)
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
|
await useHandleData(deletePqDev, {'ids': [params.id] ,'pattern': patternId}, `删除【${params.name}】设备`)
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='useRole'>
|
<script setup lang='tsx' name='useRole'>
|
||||||
import { Device } from '@/api/device/interface/device.ts';
|
import { type Device } from '@/api/device/interface/device.ts';
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
import { useAuthButtons } from '@/hooks/useAuthButtons'
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 权限信息弹出框 -->
|
<!-- 权限信息弹出框 -->
|
||||||
<el-dialog :model-value="dialogVisible" title="设备绑定" v-bind="dialogBig" @close="handleCancel" width="600" draggable>
|
<el-dialog title="设备绑定" v-model='dialogVisible' @close="close" v-bind="dialogBig" 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="allData"
|
||||||
:titles="['未绑定设备', '已绑定设备']">
|
:titles="['未绑定设备', '已绑定设备']">
|
||||||
<template #default="{ option }">
|
<template #default="{ option }">
|
||||||
<el-tooltip :content="option.tips" placement="top" :show-after=1000>
|
<el-tooltip :content="option.tips" placement="top" :show-after=1000>
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="handleCancel">取消</el-button>
|
<el-button @click="close()">取消</el-button>
|
||||||
<el-button type="primary" @click="handleCancel">
|
<el-button type="primary" @click="save()">
|
||||||
保存
|
保存
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,94 +28,68 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import type { Device } from '@/api/device/interface'
|
import type { Device } from '@/api/device/interface'
|
||||||
import deviceDataList from '@/api/device/deviceData'
|
import deviceDataList from '@/api/device/deviceData'
|
||||||
import { dialogBig } from '@/utils/elementBind'
|
import { dialogBig } from '@/utils/elementBind'
|
||||||
|
import { getUnboundPqDevList,getBoundPqDevList,BindPqDevList } from '@/api/plan/plan.ts'
|
||||||
const {dialogVisible} = defineProps<{
|
import { type Plan } from '@/api/plan/interface'
|
||||||
dialogVisible: boolean;
|
import { ElMessage } from 'element-plus'
|
||||||
}>()
|
const unboundPqDevList=ref<Device.ReqPqDevParams[]>([])//指定模式下所有未绑定的设备
|
||||||
|
const boundPqDevList=ref<Device.ReqPqDevParams[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||||
interface Option {
|
const dialogVisible = ref(false)
|
||||||
key: number
|
const planData = ref<Plan.ReqPlan | null>(null) // 新增状态管理
|
||||||
label: string
|
|
||||||
initial: string
|
const value = ref<string[]>([])
|
||||||
tips: string
|
const generateData = () => {
|
||||||
}
|
const unboundData = unboundPqDevList.value.map((i: Device.ReqPqDevParams) => ({
|
||||||
|
key: i.id,
|
||||||
const generateData = () => {
|
label: i.name,
|
||||||
const data: Option[] = []
|
tips: i.description
|
||||||
const states = [
|
}))
|
||||||
'240001',
|
const boundData = boundPqDevList.value.map((i: Device.ReqPqDevParams) => ({
|
||||||
'240002',
|
key: i.id,
|
||||||
'240003',
|
label: i.name,
|
||||||
'240004',
|
tips: i.description
|
||||||
'240005',
|
}))
|
||||||
'240006',
|
return [...unboundData, ...boundData]
|
||||||
'240007',
|
|
||||||
'240008',
|
|
||||||
'240009',
|
|
||||||
'240010',
|
|
||||||
'240011',
|
|
||||||
'240012',
|
|
||||||
'240013',
|
|
||||||
'240014',
|
|
||||||
]
|
|
||||||
const initials = ['CA', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT', 'GT', 'IL', 'MD', 'TX', 'FL', 'CO', 'CT', 'GT']
|
|
||||||
states.forEach((city, index) => {
|
|
||||||
|
|
||||||
data.push({
|
|
||||||
label: city,
|
|
||||||
key: index,
|
|
||||||
initial: initials[index],
|
|
||||||
tips:"PQS882A 192.16.1.136",
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return data
|
|
||||||
}
|
|
||||||
const generateValue = () => {
|
|
||||||
const data: number[] = []
|
|
||||||
const states = [
|
|
||||||
'240001',
|
|
||||||
'240002',
|
|
||||||
]
|
|
||||||
const initials = ['AB', 'CD']
|
|
||||||
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({
|
const allData = computed(() => generateData())
|
||||||
// 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: string, item: { label?: string }) => {
|
||||||
|
return item.label?.toLowerCase().includes(query.toLowerCase()) ?? false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (data: Plan.ReqPlan,) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
planData.value = data
|
||||||
|
|
||||||
|
const pqDevList_Result1 = await getUnboundPqDevList(data);
|
||||||
|
unboundPqDevList.value = pqDevList_Result1.data as Device.ReqPqDevParams[];
|
||||||
|
|
||||||
|
const pqDevList_Result2 = await getBoundPqDevList({'planId': data.id});
|
||||||
|
boundPqDevList.value = pqDevList_Result2.data as Device.ReqPqDevParams[];
|
||||||
|
|
||||||
|
value.value = boundPqDevList.value.map((i: { id: { toString: () => any } }) => i.id.toString());
|
||||||
|
}
|
||||||
|
const close = () => {
|
||||||
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
const filterMethod = (query, item) => {
|
|
||||||
return item.label.toLowerCase().includes(query.toLowerCase())
|
const save = async () => {
|
||||||
|
if (planData.value) {
|
||||||
|
await BindPqDevList({ 'planId': planData.value.id,'pqDevIds': value.value })
|
||||||
|
ElMessage.success({ message: `设备绑定保存成功成功!` })
|
||||||
}
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
@@ -1,57 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="device-list-container" v-if="isShow">
|
<div class="device-list-container" v-if="isShow">
|
||||||
|
|
||||||
<el-dropdown @command="handleCommand">
|
<el-dropdown @command="handleCommand">
|
||||||
<el-button link type='primary' class='table-operate'>
|
<el-link link type='primary' class='table-operate'>
|
||||||
<div class='table-operate-text'>更多...</div>
|
<div class='table-operate-text'>更多...</div>
|
||||||
</el-button>
|
</el-link>
|
||||||
<!-- <span class="el-dropdown-link">
|
<!-- <span class="el-dropdown-link">
|
||||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||||
</span> -->
|
</span> -->
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item command="高精度设备-PQV520-2">高精度设备-PQV-520便携式电能质量监测装置-2</el-dropdown-item>
|
<!-- <el-dropdown-item command="高精度设备-PQV520-2">高精度设备-PQV-520便携式电能质量监测装置-2</el-dropdown-item>
|
||||||
<el-dropdown-item command="高精度设备-PQV520-3">高精度设备-PQV-520便携式电能质量监测装置-3</el-dropdown-item>
|
<el-dropdown-item command="高精度设备-PQV520-3">高精度设备-PQV-520便携式电能质量监测装置-3</el-dropdown-item>
|
||||||
<el-dropdown-item command="高精度设备-PQV520-4">高精度设备-PQV-520便携式电能质量监测装置-4</el-dropdown-item>
|
<el-dropdown-item command="高精度设备-PQV520-4">高精度设备-PQV-520便携式电能质量监测装置-4</el-dropdown-item> -->
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
|
||||||
<!-- 查看误差体系详细信息 -->
|
|
||||||
<ErrorStandardDialog
|
|
||||||
:visible='detail_dialogFormVisible'
|
|
||||||
:formData='detail_dialogForm'
|
|
||||||
:dialogTitle='detail_dialogTitle'
|
|
||||||
@update:visible='detail_dialogFormVisible = $event'
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
import { ArrowDown } from '@element-plus/icons-vue'
|
|
||||||
import ErrorStandardDialog from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
|
||||||
import type { ErrorSystem } from '@/api/error/interface'
|
|
||||||
|
|
||||||
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 props = defineProps<{
|
const props = defineProps<{
|
||||||
isShow: boolean;
|
isShow: boolean;
|
||||||
}>();
|
}>();
|
||||||
//console.log(props.isShow,1111)
|
|
||||||
const handleCommand = (command: string | number | object) => {
|
const handleCommand = (command: string | number | object) => {
|
||||||
detail_dialogTitle.value = command as string;
|
|
||||||
detail_dialogFormVisible.value = true // 显示对话框
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -1,150 +1,163 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 基础信息弹出框 -->
|
<!-- 基础信息弹出框 -->
|
||||||
<el-dialog :model-value="visible" :title="dialogTitle" v-bind="dialogSmall" @close="handleCancel" draggable>
|
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogSmall">
|
||||||
<div>
|
<div>
|
||||||
<el-form :model="formData" ref='formRuleRef' :rules='rules'>
|
<el-form :model="formContent" ref='dialogFormRef' :rules='rules'>
|
||||||
<el-form-item label="名称" prop="name" :label-width="100">
|
<el-form-item label="名称" prop="name" :label-width="100">
|
||||||
<el-input v-model="formData.name" placeholder="请输入名称" autocomplete="off" :disabled="isReadOnly"/>
|
<el-input v-model="formContent.name" placeholder="请输入名称" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="父计划" prop="father_Plan_Id" :label-width="100">
|
<el-form-item label='检测源' prop='sourceIds' :label-width='100'>
|
||||||
<el-select v-model="formData.father_Plan_Id" placeholder="请选择父计划" autocomplete="off" :disabled="isReadOnly" @change="fatherPlanChange">
|
<el-select v-model="formContent.sourceIds" multiple collapse-tags placeholder="请选择检测源">
|
||||||
<el-option
|
|
||||||
v-for="plan in testFatherPlanList"
|
|
||||||
:key="plan.id"
|
|
||||||
:label="plan.label"
|
|
||||||
:value="plan.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label='检测源' prop='source_Id' :label-width='100'>
|
|
||||||
<el-select v-model="formData.source_Id" multiple collapse-tags placeholder="请选择检测源">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in sourceDataList"
|
v-for="(option, index) in pqSourceArray"
|
||||||
:key="plan.id"
|
:key="index"
|
||||||
:label="plan.label"
|
:label="option.label"
|
||||||
:value="plan.id"
|
:value="option.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据源" prop="dataSource_Id" :label-width="100">
|
<el-form-item label="数据源" prop="datasourceIds" :label-width="100">
|
||||||
<el-select v-model="formData.dataSource_Id" multiple collapse-tags placeholder="请选择数据源" autocomplete="off" :disabled="isReadOnly">
|
<el-select v-model="formContent.datasourceIds" multiple collapse-tags placeholder="请选择数据源" autocomplete="off" >
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in testSoureDataList"
|
v-for="item in dictStore.getDictData(dataSourceType)"
|
||||||
:key="plan.id"
|
:key="item.id"
|
||||||
:label="plan.label"
|
:label="item.name"
|
||||||
:value="plan.id">
|
:value="item.value || ''"
|
||||||
</el-option>
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检测脚本" prop="scriptId" :label-width="100">
|
||||||
|
<el-select v-model="formContent.scriptId" placeholder="请选择检测脚本" autocomplete="off" >
|
||||||
|
<el-option
|
||||||
|
v-for="(option, index) in pqScriptArray"
|
||||||
|
:key="index"
|
||||||
|
:label="option.label"
|
||||||
|
:value="option.value"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="检测脚本" prop="script_Id" :label-width="100">
|
<el-form-item label="误差体系" prop="errorSysId" :label-width="100">
|
||||||
<el-select v-model="formData.script_Id" placeholder="请选择检测脚本" autocomplete="off" :disabled="isReadOnly">
|
<el-select v-model="formContent.errorSysId" placeholder="请选择误差体系" autocomplete="off">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in testScriptDataList"
|
v-for="(option, index) in pqErrorArray"
|
||||||
:key="plan.id"
|
:key="index"
|
||||||
:label="plan.label"
|
:label="option.label"
|
||||||
:value="plan.id">
|
:value="option.value"
|
||||||
</el-option>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="误差体系" prop="error_Sys_Id" :label-width="100">
|
<el-form-item label='被检设备' :label-width='100' prop='devIds'>
|
||||||
<el-select v-model="formData.error_Sys_Id" placeholder="请选择误差体系" autocomplete="off" :disabled="isReadOnly">
|
<el-select v-model="formContent.devIds" multiple collapse-tags placeholder="请选择被检设备">
|
||||||
<el-option
|
|
||||||
v-for="plan in testErrSystDataList"
|
|
||||||
:key="plan.id"
|
|
||||||
:label="plan.label"
|
|
||||||
:value="plan.id">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label='被检设备' :label-width='100' prop='device_Id'>
|
|
||||||
<el-select v-model="formData.device_Id" multiple collapse-tags placeholder="请选择被检设备">
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="plan in deviceDataList"
|
v-for="(option, index) in pqDevArray"
|
||||||
:key="plan.id"
|
:key="index"
|
||||||
:label="plan.label"
|
:label="option.label"
|
||||||
:value="plan.id"
|
:value="option.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label='检测功能' :label-width='100' prop='device_Id'>
|
<el-form-item label="守时检测" :label-width="100" prop='timeCheck'>
|
||||||
<el-checkbox v-model="checked1" label="守时检测" size="large" />
|
<el-radio-group v-model="formContent.timeCheck" >
|
||||||
</el-form-item> -->
|
<el-radio :value="1">是</el-radio>
|
||||||
<el-form-item label="守时检测" :label-width="100">
|
<el-radio :value="0">否</el-radio>
|
||||||
<el-radio-group v-model="timeFlag" >
|
|
||||||
<el-radio value="1">是</el-radio>
|
|
||||||
<el-radio value="0">否</el-radio>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="handleCancel">取 消</el-button>
|
<el-button @click='close()'>取 消</el-button>
|
||||||
<el-button type="primary" @click="handleSubmit" :disabled="isReadOnly">确 定</el-button>
|
<el-button type="primary" @click='save()' >确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import{ElMessage, FormInstance,FormItemRule}from'element-plus'
|
import{ElMessage, type FormInstance,type FormItemRule}from'element-plus'
|
||||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
import { defineProps, defineEmits, reactive,watch,ref, type Ref, computed } from 'vue';
|
||||||
import { dialogSmall} from '@/utils/elementBind'
|
import { dialogSmall} from '@/utils/elementBind'
|
||||||
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,sourceDataList,deviceDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData,testFatherPlanList} from '@/api/plan/planData'
|
import { type Plan } from '@/api/plan/interface';
|
||||||
|
import { addPlan, updatePlan,getUnboundPqDevList,getBoundPqDevList,getPqErrSysList,getPqScriptList,getTestSourceList } from '@/api/plan/plan.ts'
|
||||||
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
|
import { type TestSource } from '@/api/device/interface/testSource';
|
||||||
|
import { type TestScript } from '@/api/device/interface/testScript';
|
||||||
|
import { type ErrorSystem } from '@/api/device/interface/error';
|
||||||
|
import { type Device } from '@/api/device/interface/device';
|
||||||
|
|
||||||
const props = defineProps<{
|
const dictStore = useDictStore()
|
||||||
visible: boolean;
|
// 定义弹出组件元信息
|
||||||
dialogTitle: string;
|
const dialogFormRef = ref()
|
||||||
isReadOnly: boolean,
|
const mode = ref()
|
||||||
formData: {
|
const pqSourceList=ref<TestSource.ResTestSource[]>([])//获取指定模式下所有检测源
|
||||||
id:string;
|
const pqScriptList=ref<TestScript.ResTestScript[]>([])//获取指定模式下所有检测源
|
||||||
name: string;
|
const pqErrSysList=ref<ErrorSystem.ErrorSystemList[]>([])//获取指定模式下所有检测源
|
||||||
pattern: string; //模式,字典表(数字、模拟、比对)
|
|
||||||
father_Plan_Id: string; //父计划ID
|
|
||||||
source_Id: string;//检测源ID
|
|
||||||
dataSource_Id: string; //数据源ID
|
|
||||||
script_Id: string; //检测脚本ID
|
|
||||||
error_Sys_Id: string;//误差体系ID
|
|
||||||
device_Id: string;//被检设备ID
|
|
||||||
test_State: string; //检测状态
|
|
||||||
report_State: string; //报告生成状态
|
|
||||||
result: string;//检测结果
|
|
||||||
state: number; //状态
|
|
||||||
|
|
||||||
};
|
|
||||||
}>();
|
|
||||||
const checked1 = ref(false)
|
|
||||||
const timeFlag = ref('0')
|
|
||||||
const fatherPlanList = [
|
|
||||||
{ label: '/', value: 'type0' },
|
|
||||||
{ label: '检测计划1', value: 'type1' },
|
|
||||||
{ label: '检测计划2', value: 'type2' },
|
|
||||||
{ label: '检测计划3', value: 'type3' },
|
|
||||||
{ label: '检测计划4', value: 'type4' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const sourceList = [
|
const pqSourceArray = ref<{ label: string; value: string; }[]>()
|
||||||
{ label: '分钟统计数据最大值', value: 'type0' },
|
const pqScriptArray = ref<{ label: string; value: string; }[]>()
|
||||||
{ label: '分钟统计数据最大值', value: 'type1' },
|
const pqErrorArray = ref<{ label: string; value: string; }[]>()
|
||||||
{ label: '分钟统计数据CP95值', value: 'type2' },
|
const pqDevArray = ref<{ label: string; value: string; }[]>()
|
||||||
];
|
function useMetaInfo() {
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const titleType = ref('add')
|
||||||
|
const formContent = ref<Plan.ReqPlan>({
|
||||||
|
id:'',
|
||||||
|
planId:'',
|
||||||
|
name: '',
|
||||||
|
pattern: mode.value,
|
||||||
|
fatherPlanId: '',
|
||||||
|
dataSourceId: '',
|
||||||
|
scriptId: '',
|
||||||
|
errorSysId: '',
|
||||||
|
timeCheck:0,
|
||||||
|
testState: 0,
|
||||||
|
reportState: 0,
|
||||||
|
result: 2,
|
||||||
|
code:1,
|
||||||
|
state:1,
|
||||||
|
scriptName:'',
|
||||||
|
errorSysName:'',
|
||||||
|
sourceName:'',
|
||||||
|
devIds:[],
|
||||||
|
sourceIds:[],
|
||||||
|
datasourceIds:'',
|
||||||
|
})
|
||||||
|
return { dialogVisible, titleType, formContent }
|
||||||
|
}
|
||||||
|
|
||||||
const scriptList = [
|
const { dialogVisible, titleType, formContent } = useMetaInfo()
|
||||||
{ label: '/', value: 'type0' },
|
|
||||||
{ label: '国网入网检测脚本(单影响量-模拟式)', value: 'type1' },
|
|
||||||
{ label: '国网入网检测脚本(Q/GDW 10650.4 - 2021) 数字式', value: 'type1' },
|
|
||||||
];
|
|
||||||
|
|
||||||
const errorList = [
|
// 清空formContent
|
||||||
{ label: 'Q/GDW 1650.2- 2016', value: 'type0' },
|
const resetFormContent = () => {
|
||||||
{ label: 'Q/GDW 10650.2 - 2021', value: 'type1' },
|
formContent.value = {
|
||||||
];
|
id:'',
|
||||||
|
planId:'',
|
||||||
|
name: '',
|
||||||
|
pattern: mode.value,
|
||||||
|
fatherPlanId: '',
|
||||||
|
dataSourceId: '',
|
||||||
|
scriptId: '',
|
||||||
|
errorSysId: '',
|
||||||
|
timeCheck:0,
|
||||||
|
testState: 0,
|
||||||
|
reportState: 0,
|
||||||
|
result: 2,
|
||||||
|
code:1,
|
||||||
|
state:1,
|
||||||
|
scriptName:'',
|
||||||
|
errorSysName:'',
|
||||||
|
sourceName:'',
|
||||||
|
devIds:[],
|
||||||
|
sourceIds:[],
|
||||||
|
datasourceIds:'',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dialogTitle = computed(() => {
|
||||||
|
return titleType.value === 'add' ? '新增检测计划' : '编辑检测计划'
|
||||||
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'update:visible', value: boolean): void;
|
|
||||||
(e: 'submit', data: any): void;
|
|
||||||
}>();
|
|
||||||
|
|
||||||
// 定义规则
|
// 定义规则
|
||||||
const formRuleRef = ref<FormInstance>()
|
const formRuleRef = ref<FormInstance>()
|
||||||
@@ -154,47 +167,150 @@ const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
|||||||
dataSource_Id: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
dataSource_Id: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
||||||
script_Id: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
script_Id: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
||||||
error_Sys_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' }],
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCancel = () => {
|
// 关闭弹窗
|
||||||
//重置表单内容
|
const close = () => {
|
||||||
//取消表单校验状态
|
dialogVisible.value = false
|
||||||
formRuleRef.value && formRuleRef.value.resetFields()
|
// 清空dialogForm中的值
|
||||||
emit('update:visible', false); // 关闭对话框
|
resetFormContent()
|
||||||
};
|
// 重置表单
|
||||||
|
dialogFormRef.value?.resetFields()
|
||||||
const handleSubmit = () => {
|
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
formRuleRef.value?.validate((valid: boolean) => {
|
// 保存数据
|
||||||
if (valid)
|
const save = () => {
|
||||||
{
|
try {
|
||||||
// 将表单数据转为json,发送到后端
|
dialogFormRef.value?.validate(async (valid: boolean) => {
|
||||||
let confirmFormData = JSON.parse(JSON.stringify(props.formData));
|
if (valid) {
|
||||||
//console.log(confirmFormData)
|
if (formContent.value.id) {
|
||||||
emit('submit', props.formData); // 提交表单数据
|
await updatePlan(formContent.value);
|
||||||
emit('update:visible', false); // 提交后关闭对话框
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
}
|
} else {
|
||||||
else
|
// 新增需要把设备模式转成字典ID
|
||||||
{
|
const patternItem = dictStore.getDictData('Pattern').find(item => item.name === formContent.value.pattern);
|
||||||
ElMessage.error('请填选必填项!')
|
if (patternItem) {
|
||||||
}
|
formContent.value.pattern = patternItem.id;
|
||||||
|
}
|
||||||
|
await addPlan(formContent.value);
|
||||||
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
|
}
|
||||||
|
close()
|
||||||
|
// 刷新表格
|
||||||
|
await props.refreshTable!()
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
console.error('验证过程中发生错误', error)
|
console.error('验证过程中出现错误', err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 打开弹窗,可能是新增,也可能是编辑
|
||||||
|
const open = async (sign: string,
|
||||||
|
data: Plan.ReqPlan,
|
||||||
|
currentMode: string,) => {
|
||||||
|
|
||||||
|
let pqDevList=ref<Device.ResPqDev[]>([])//获取指定模式下所有检测源
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//处理异步调用
|
||||||
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== currentMode)?.id ?? ''
|
||||||
|
data.pattern = patternId
|
||||||
|
|
||||||
|
|
||||||
|
const pqSource_Result = await getTestSourceList(data);
|
||||||
|
pqSourceList.value = pqSource_Result.data as TestSource.ResTestSource[];
|
||||||
|
const PqScript_Result = await getPqScriptList(data);
|
||||||
|
pqScriptList.value = PqScript_Result.data as TestScript.ResTestScript[];
|
||||||
|
const PqErrSys_Result = await getPqErrSysList();
|
||||||
|
pqErrSysList.value = PqErrSys_Result.data as unknown as ErrorSystem.ErrorSystemList[];
|
||||||
|
|
||||||
|
if(sign == 'add')
|
||||||
|
{
|
||||||
|
const pqDevList_Result = await getUnboundPqDevList(data);
|
||||||
|
pqDevList.value = pqDevList_Result.data as Device.ResPqDev[];
|
||||||
|
}else{
|
||||||
|
const boundPqDevList_Result = await getBoundPqDevList({ 'planId': data.id });
|
||||||
|
const unboundPqDevList_Result = await getUnboundPqDevList(data);
|
||||||
|
|
||||||
|
const boundData = Array.isArray(boundPqDevList_Result.data) ? boundPqDevList_Result.data : [];
|
||||||
|
const unboundData = Array.isArray(unboundPqDevList_Result.data) ? unboundPqDevList_Result.data : [];
|
||||||
|
|
||||||
|
pqDevList.value = [...boundData,...unboundData] as Device.ResPqDev[];
|
||||||
|
|
||||||
|
pqDevArray.value = pqDevList.value.map(i => ({
|
||||||
|
label: i.name,
|
||||||
|
value: i.id
|
||||||
|
})); // 设置已绑定设备为默认选中
|
||||||
|
|
||||||
|
|
||||||
|
formContent.value.devIds = boundData.map(i => i.id)// 已绑定设备id集合
|
||||||
|
console.log('123',formContent.value.devIds)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(formContent.value)
|
||||||
|
|
||||||
|
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||||
|
// 将 pqSource_Result 转换成 { label, value } 数组
|
||||||
|
pqSourceArray.value = sourceArray1.map(item => ({
|
||||||
|
label: item.name || '',
|
||||||
|
value: item.id
|
||||||
|
}));
|
||||||
|
|
||||||
|
const sourceArray2 = Array.isArray(pqScriptList.value ) ? pqScriptList.value : []
|
||||||
|
pqScriptArray.value = sourceArray2.map(item => ({
|
||||||
|
label: item.name || '',
|
||||||
|
value: item.id || ''
|
||||||
|
}));
|
||||||
|
|
||||||
|
const sourceArray3 = Array.isArray(pqErrSysList.value) ? pqErrSysList.value : []
|
||||||
|
pqErrorArray.value = sourceArray3.map(item => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id
|
||||||
|
}));
|
||||||
|
|
||||||
|
// const sourceArray4 = Array.isArray(pqDevList.value) ? pqDevList.value : []
|
||||||
|
// pqDevArray.value = sourceArray4.map(item => ({
|
||||||
|
// label: item.name,
|
||||||
|
// value: item.id
|
||||||
|
// }))
|
||||||
|
|
||||||
|
mode.value = currentMode
|
||||||
|
titleType.value = sign
|
||||||
|
dialogVisible.value = true
|
||||||
|
if (data.id) {
|
||||||
|
formContent.value = { ...data }
|
||||||
|
} else {
|
||||||
|
resetFormContent()
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
// 重置表单
|
||||||
// 当 props.visible 改变时,更新 formData
|
dialogFormRef.value?.resetFields()
|
||||||
watch(() => props.visible, (newVal) => {
|
}
|
||||||
if (!newVal) {
|
|
||||||
// 这里可以重置表单数据,如果需要的话
|
const dataSourceType = computed(() => {
|
||||||
|
switch (mode.value) {
|
||||||
}
|
case '模拟式':
|
||||||
});
|
return 'Datasource_Simulate'
|
||||||
|
case '数字式':
|
||||||
|
return 'Datasource_Digital'
|
||||||
|
default:
|
||||||
|
return 'Datasource_Contrast'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 对外映射
|
||||||
|
defineExpose({ open })
|
||||||
|
const props = defineProps<{
|
||||||
|
refreshTable: (() => Promise<void>) | undefined;
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
:data='testSourceData'
|
:data='testSourceData'
|
||||||
type='selection'
|
type='selection'
|
||||||
>
|
>
|
||||||
<!-- :request-api="getTableList" 如果要显示静态数据,就切换该配置-->
|
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
|
<el-button type='primary' :icon='Download' plain :disabled='!scope.isSelected' @click="exportClick">移入检测计划</el-button>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ProTable
|
<ProTable
|
||||||
ref='proTable'
|
ref='proTable'
|
||||||
:columns='columns'
|
:columns='columns'
|
||||||
:data='planData'
|
:request-api='getTableList'
|
||||||
>
|
>
|
||||||
<!-- 表格 header 按钮 -->
|
<!-- 表格 header 按钮 -->
|
||||||
<template #tableHeader='scope'>
|
<template #tableHeader='scope'>
|
||||||
@@ -12,99 +12,40 @@
|
|||||||
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
<el-button type='primary' :icon='ScaleToOriginal' :disabled='!(scope.selectedList.length > 1)' @click='combineClick'>
|
||||||
合并
|
合并
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type='primary' :icon='CirclePlus' @click='openAddDialog'>新增</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'>
|
||||||
删除
|
删除
|
||||||
</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='EditPen' @click="openDialog('edit',scope.row)">编辑</el-button>
|
||||||
<!-- <el-button type='primary' link :icon='Upload' @click='exportClick'>导出</el-button> -->
|
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||||||
<el-button type='primary' link :icon='EditPen' @click='openEditDialog(scope.row)'>编辑</el-button>
|
|
||||||
<el-button type='primary' link :icon='Delete' @click='openEditDialog(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='showDeviceOpen(scope.row)'>设备绑定</el-button>
|
||||||
<!-- <div class='cn-render-buttons'>
|
|
||||||
<el-dropdown trigger='click'>
|
|
||||||
<el-button link type='primary' class='table-operate'>
|
|
||||||
<div class='table-operate-text'>更多</div>
|
|
||||||
</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>
|
</template>
|
||||||
</ProTable>
|
</ProTable>
|
||||||
|
|
||||||
<!-- 向计划导入/导出设备对话框 -->
|
|
||||||
<planPopup
|
|
||||||
:visible="dialogFormVisible"
|
|
||||||
:formData="dialogForm"
|
|
||||||
:dialogTitle="dialogTitle"
|
|
||||||
:is-read-only="isReadOnly"
|
|
||||||
@update:visible="dialogFormVisible = $event"
|
|
||||||
|
|
||||||
/>
|
|
||||||
<!-- 查看误差体系详细信息 -->
|
|
||||||
<ErrorStandardDialog
|
|
||||||
:visible='detail_dialogFormVisible'
|
|
||||||
:formData='detail_dialogForm'
|
|
||||||
:dialogTitle='detail_dialogTitle'
|
|
||||||
@update:visible='detail_dialogFormVisible = $event'
|
|
||||||
ref="errorStandardPopup"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- <TestSourcePopup :refresh-table='proTable?.getTableList' ref='testSourcePopup' /> -->
|
|
||||||
</div>
|
</div>
|
||||||
<devTransfer
|
|
||||||
:dialogVisible=devTransferVisible
|
<!-- 向计划导入/导出设备对话框 -->
|
||||||
@update:visible='devTransferVisible = $event'
|
<PlanPopup :refresh-table='proTable?.getTableList' ref='planPopup'/>
|
||||||
/>
|
<!-- 查看误差体系详细信息 -->
|
||||||
<sourceTransfer
|
<ErrorStandardDialog :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
||||||
:dialogVisible=sourceTransferVisible
|
|
||||||
@update:visible='sourceTransferVisible = $event'
|
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/>
|
||||||
/>
|
|
||||||
<DeviceOpen :width='viewWidth' :height='viewHeight' ref='openDeviceView' />
|
|
||||||
<SourceOpen :width='viewWidth' :height='viewHeight' ref='openSourceView' />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' 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 type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
import { ScaleToOriginal, CirclePlus, Delete, EditPen, View, Upload, Download, List, Tools } from '@element-plus/icons-vue'
|
||||||
import {
|
import {getPlanList,deletePlan } from '@/api/plan/plan.ts'
|
||||||
dictPattern,
|
import { computed, onMounted, reactive, ref } from 'vue'
|
||||||
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 moreButtons from './components/moreButtons.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'
|
||||||
@@ -113,60 +54,45 @@ import type { Action } from 'element-plus'
|
|||||||
import type { ErrorSystem } from '@/api/error/interface'
|
import type { ErrorSystem } from '@/api/error/interface'
|
||||||
import ErrorStandardDialog from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
import ErrorStandardDialog from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
||||||
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
||||||
import { type TestSource } from '@/api/device/interface/testSource'
|
import { type TestSource } from '@/api/device/interface/testSource'
|
||||||
|
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||||
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
// 定义包含和排除的单位
|
|
||||||
const includedUnits = ['日', '周', '月', '自定义'] // 可以根据需要包含的单位
|
|
||||||
const excludedUnits = ['季度', '年'] // 要排除的单位
|
|
||||||
const defaultUnits = '日' // 默认的单位
|
|
||||||
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)
|
const sourceTransferVisible = ref(false)
|
||||||
// ProTable 实例
|
// ProTable 实例
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
// const planData = planData
|
const errorStandardPopup = ref()
|
||||||
const dialogFormVisible = ref(false)
|
const planPopup = ref()
|
||||||
const dialogTitle = ref('')
|
const devTransferPopup = ref()
|
||||||
const isReadOnly = ref(false)
|
const modeStore = useModeStore();
|
||||||
const router = useRouter()
|
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
|
||||||
|
|
||||||
const dialogForm = ref<Plan.PlanBO>({
|
const getTableList = async(params: any) => {
|
||||||
id: '',
|
let newParams = JSON.parse(JSON.stringify(params))
|
||||||
name: '',
|
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||||
pattern: '',
|
newParams.pattern = patternId
|
||||||
father_Plan_Id: '',
|
|
||||||
dataSource_Id: '',
|
return getPlanList(newParams)
|
||||||
script_Id: '',
|
}
|
||||||
error_Sys_Id: '',
|
|
||||||
test_State: '',
|
|
||||||
report_State: '',
|
|
||||||
result: '',
|
|
||||||
|
|
||||||
|
|
||||||
})
|
const dataSourceType = computed(() => {
|
||||||
|
switch (modeStore.currentMode) {
|
||||||
const detail_dialogFormVisible = ref(false)
|
case '模拟式':
|
||||||
const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系')
|
return 'Datasource_Simulate'
|
||||||
const detail_dialogForm = ref<ErrorSystem.Error_detail>({
|
case '数字式':
|
||||||
measured: '',//被测量
|
return 'Datasource_Digital'
|
||||||
deviceLevel: '',//检测装置级别
|
default:
|
||||||
measurementType: '',
|
return 'Datasource_Contrast'
|
||||||
condition: '',//测量条件
|
}
|
||||||
maxErrorValue: '',//最大误差
|
})
|
||||||
})
|
|
||||||
|
|
||||||
// <el-button
|
|
||||||
// v-for="(button, index) in scope.row.testSourceList"
|
|
||||||
// :key="index"
|
|
||||||
// @click="handleClick(button)"
|
|
||||||
// >
|
|
||||||
// {{ button.text }}
|
|
||||||
// </el-button>
|
|
||||||
|
|
||||||
// 表格配置项
|
// 表格配置项
|
||||||
const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
|
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||||
{ 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: '序号' },
|
||||||
{
|
{
|
||||||
@@ -176,96 +102,204 @@ const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
|
|||||||
search: { el: 'input' },
|
search: { el: 'input' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'testSourceName',
|
prop: 'sourceName',
|
||||||
label: '检测源',
|
label: '检测源',
|
||||||
width: 375,
|
minWidth: 480,
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<div class='flx-flex-start'>
|
<div class='flx-flex-start'>
|
||||||
<el-button type='primary' link onClick={() => showTestSource(scope.row.testSourceName)}>
|
<el-link type='primary' link onClick={() => showTestSource(scope.row.sourceName)}>
|
||||||
{scope.row.testSourceName}
|
{scope.row.sourceName}
|
||||||
</el-button>
|
</el-link>
|
||||||
<moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
<moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'script_Id',
|
prop: 'scriptId',
|
||||||
label: '检测脚本',
|
label: '检测脚本',
|
||||||
width: 360,
|
width: 360,
|
||||||
enum: testScriptDataList,
|
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
|
||||||
render: scope => {
|
render: scope => {
|
||||||
return (
|
return (
|
||||||
<el-button type='primary' link onClick={() => showTestScript(scope.row.script_Id)}>
|
<el-link type='primary' link onClick={() => showTestScript(scope.row.scriptId)}>
|
||||||
{getScriptName(scope.row.script_Id)}
|
{scope.row.scriptName}
|
||||||
</el-button>
|
</el-link>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'error_Sys_Id',
|
prop: 'errorSysId',
|
||||||
label: '误差体系',
|
label: '误差体系',
|
||||||
width: 200,
|
width: 200,
|
||||||
enum: testErrSystDataList,
|
|
||||||
fieldNames: { label: 'label', value: 'id' },
|
|
||||||
render: scope => {
|
render: scope => {
|
||||||
const errSysName = getErrSysName(scope.row.error_Sys_Id)
|
|
||||||
return (
|
return (
|
||||||
<el-button type='primary' link onClick={() => showData(errSysName || '')}>
|
<el-link type='primary' link onClick={() => showData(scope.row.errorSysId || '')}>
|
||||||
{errSysName}
|
{scope.row.errorSysName}
|
||||||
</el-button>
|
</el-link>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'dataSource_Ids',
|
prop: 'datasourceIds',
|
||||||
label: '数据源',
|
label: '数据源',
|
||||||
width: 120,
|
enum: dictStore.getDictData(dataSourceType.value),
|
||||||
// enum: testSoureDataList,
|
fieldNames: { label: 'name', value: 'value' },
|
||||||
// fieldNames: { label: 'label', value: 'id' },
|
minWidth: 250,
|
||||||
|
render: (scope) => {
|
||||||
|
const codes = scope.row.datasourceIds // 获取当前行的 datasourceIds 字段
|
||||||
|
if (!codes) {
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
// 确保 codes 是一个字符串
|
||||||
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
||||||
|
const codeArray = codeString.split(',')
|
||||||
|
if (codeArray.length > 1) {
|
||||||
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
||||||
|
const names = codeArray.map(code => {
|
||||||
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.value === code)
|
||||||
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
||||||
|
})
|
||||||
|
return names.join(', ') // 用逗号连接所有的 name
|
||||||
|
}
|
||||||
|
// 查找单个 code 对应的 name
|
||||||
|
const dictItem = dictStore.getDictData(dataSourceType.value).find(item => item.value === codeArray[0])
|
||||||
|
return dictItem ? dictItem.name : '/' // 如果找到匹配的项,返回对应的 name
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'test_State',
|
prop: 'testState',
|
||||||
label: '检测状态',
|
label: '检测状态',
|
||||||
width: 120,
|
width: 120,
|
||||||
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' },
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
scope.row.testState === 0 ? '未检' : scope.row.testState === 1 ? '检测中' : '检测完成'
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'report_State',
|
prop: 'reportState',
|
||||||
label: '检测报告状态',
|
label: '检测报告状态',
|
||||||
width: 120,
|
width: 120,
|
||||||
enum: dictReportState,
|
|
||||||
// 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' },
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
scope.row.testState === 0 ? '未生成' : scope.row.testState === 1 ? '部分生成' : '全部生成'
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'result',
|
prop: 'result',
|
||||||
label: '检测结果',
|
label: '检测结果',
|
||||||
width: 120,
|
width: 120,
|
||||||
enum: dictResult,
|
|
||||||
// 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' },
|
||||||
|
render: scope => {
|
||||||
|
return (
|
||||||
|
scope.row.testState === 0 ? '不符合' : scope.row.testState === 1 ? '符合' : '/'
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||||
])
|
])
|
||||||
|
|
||||||
function getScriptName(id: string) {
|
|
||||||
return testScriptDataList.find(item => item.id == id)?.label
|
|
||||||
}
|
|
||||||
|
|
||||||
function getErrSysName(id: string) {
|
|
||||||
|
|
||||||
return testErrSystDataList.find(item => item.id == id)?.label
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileInput = ref<HTMLInputElement | null>(null) // 声明 fileInput
|
// // 表格配置项
|
||||||
|
// const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
|
||||||
|
// { type: 'selection', fixed: 'left', width: 70 },
|
||||||
|
// { type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
|
// {
|
||||||
|
// prop: 'name',
|
||||||
|
// label: '名称',
|
||||||
|
// width: 220,
|
||||||
|
// search: { el: 'input' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'testSourceName',
|
||||||
|
// label: '检测源',
|
||||||
|
// width: 375,
|
||||||
|
// render: scope => {
|
||||||
|
// return (
|
||||||
|
// <div class='flx-flex-start'>
|
||||||
|
// <el-link type='primary' link onClick={() => showTestSource(scope.row.testSourceName)}>
|
||||||
|
// {scope.row.testSourceName}
|
||||||
|
// </el-link>
|
||||||
|
// <moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
||||||
|
// </div>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'script_Id',
|
||||||
|
// label: '检测脚本',
|
||||||
|
// width: 360,
|
||||||
|
// enum: testScriptDataList,
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
// render: scope => {
|
||||||
|
// return (
|
||||||
|
// <el-link type='primary' link onClick={() => showTestScript(scope.row.script_Id)}>
|
||||||
|
// {getScriptName(scope.row.script_Id)}
|
||||||
|
// </el-link>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// 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-link type='primary' link onClick={() => showData(errSysName || '')}>
|
||||||
|
// {errSysName}
|
||||||
|
// </el-link>
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'dataSource_Ids',
|
||||||
|
// label: '数据源',
|
||||||
|
// width: 120,
|
||||||
|
// // enum: testSoureDataList,
|
||||||
|
// // fieldNames: { label: 'label', value: 'id' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'test_State',
|
||||||
|
// label: '检测状态',
|
||||||
|
// width: 120,
|
||||||
|
// enum: dictTestState,
|
||||||
|
// // enum: dictStore.getDictData('planTestState'),
|
||||||
|
// search: { el: 'select', props: { filterable: true } },
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'report_State',
|
||||||
|
// label: '检测报告状态',
|
||||||
|
// width: 120,
|
||||||
|
// enum: dictReportState,
|
||||||
|
// // enum: dictStore.getDictData('planReportState'),
|
||||||
|
// search: { el: 'select', props: { filterable: true } },
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// prop: 'result',
|
||||||
|
// label: '检测结果',
|
||||||
|
// width: 120,
|
||||||
|
// enum: dictResult,
|
||||||
|
// // enum: dictStore.getDictData('planResult'),
|
||||||
|
// search: { el: 'select', props: { filterable: true } },
|
||||||
|
// fieldNames: { label: 'label', value: 'id' },
|
||||||
|
// },
|
||||||
|
// { prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||||
|
// ])
|
||||||
|
|
||||||
|
|
||||||
function openFileDialog() {
|
function openFileDialog() {
|
||||||
if (fileInput.value) {
|
if (fileInput.value) {
|
||||||
fileInput.value.click()
|
fileInput.value.click()
|
||||||
@@ -273,36 +307,34 @@ function openFileDialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function isVisible(row: Plan.PlanAndSourceBO) {
|
function isVisible(row: Plan.ReqPlan) {
|
||||||
|
if(!row.hasOwnProperty('sourceName') || !Array.isArray(row.sourceName)){
|
||||||
//console.log(row)
|
|
||||||
if(!row.hasOwnProperty('testSourceList') || !Array.isArray(row.testSourceList))
|
|
||||||
return false
|
return false
|
||||||
else if(row.testSourceList.length <= 1)
|
}
|
||||||
|
else if(row.sourceName.length <= 1){
|
||||||
return false
|
return false
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const errorStandardPopup = ref()
|
|
||||||
function showData(row: string) {
|
function showData(row: string) {
|
||||||
|
|
||||||
errorStandardPopup.value?.open(row, row)
|
errorStandardPopup.value?.open(row, row)
|
||||||
// router.push({
|
|
||||||
// path: "/machine/device",
|
|
||||||
// query: { id: row }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
const testSourcePopup = ref()
|
|
||||||
function showTestSource(row: string) {
|
function showTestSource(row: string) {
|
||||||
//testSourcePopup.value?.open('view', row,'模拟式')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showTestScript(row: string) {
|
function showTestScript(row: string) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@@ -363,52 +395,25 @@ const combineClick = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开编辑对话框
|
|
||||||
const openEditDialog = (planSystem: Plan.PlanBO) => {
|
|
||||||
dialogForm.value = { ...planSystem }
|
|
||||||
dialogTitle.value = '编辑检测计划'
|
// 打开 drawer(新增、编辑)
|
||||||
isReadOnly.value = false
|
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
dialogFormVisible.value = true // 打开对话框
|
|
||||||
|
planPopup.value?.open(titleType, row,modeStore.currentMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
const openAddDialog = () => {
|
// 删除检测计划
|
||||||
|
const handleDelete = async (params: Plan.ReqPlanParams) => {
|
||||||
dialogForm.value = {
|
await useHandleData(deletePlan, [params.id], `删除【${params.name}】检测计划`)
|
||||||
id: '',
|
proTable.value?.getTableList()
|
||||||
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) => {
|
const showDeviceOpen = (row: Partial<Plan.ReqPlan> = {}) => {
|
||||||
dialogForm.value = { ...planSystem }
|
devTransferPopup.value.open(row)
|
||||||
dialogTitle.value = '查看检测计划'
|
|
||||||
isReadOnly.value = true
|
|
||||||
dialogFormVisible.value = true // 打开对话框
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showDeviceOpen = (planSystem: Plan.PlanBO) => {
|
|
||||||
devTransferVisible.value = true
|
|
||||||
//openDeviceView.value.open('计划设备列表')
|
|
||||||
}
|
|
||||||
|
|
||||||
const showtestSourceOpen = (planSystem: Plan.PlanBO) => {
|
|
||||||
sourceTransferVisible.value = true
|
|
||||||
// openSourceView.value.open('计划检测源列表')
|
|
||||||
// router.push({
|
|
||||||
// path: "/machine/testSource",
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label='复检最大次数' prop='maxTime' :label-width="110">
|
<el-form-item label='检测最大次数' prop='maxTime' :label-width="110">
|
||||||
<el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' />
|
<el-input-number v-model='TestConfigForm.maxTime' :min='1' :max='999' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
Reference in New Issue
Block a user