检测计划表格误差体系,检测源跳转
This commit is contained in:
@@ -58,11 +58,15 @@ const dictReportState: Dict[] = [
|
||||
const dictResult: Dict[] = [
|
||||
{
|
||||
id: "0",
|
||||
label: '符合',
|
||||
label: '不符合',
|
||||
},
|
||||
{
|
||||
id: "1",
|
||||
label: '不符合',
|
||||
label: '符合',
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
label: '/',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
<el-dialog :title="dialogTitle" v-model='dialogVisible' @close="close" v-bind="dialogBig">
|
||||
<div >
|
||||
<el-form :model="formContent" ref='dialogFormRef' :rules='rules' :disabled="tableIsDisable" label-width="auto" class="form-three">
|
||||
<!-- <el-form-item label="检测源名称" prop="name" >-->
|
||||
<!-- <el-input v-model='formContent.name' placeholder="检测源类型+设备类型+数字"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="设备类型" prop="devType" >
|
||||
<el-select v-model='formContent.devType' placeholder="请选择源型号">
|
||||
<el-option
|
||||
@@ -15,7 +12,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测源类型" prop="type">
|
||||
<el-form-item label="检测源类型" prop="type" >
|
||||
<el-select v-model='formContent.type' placeholder="请选择检测源类型">
|
||||
<el-option
|
||||
v-for="item in dictStore.getDictData('Pq_Source_Type')"
|
||||
@@ -144,7 +141,6 @@ const save = () => {
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = async (sign: string, data: TestSource.ResTestSource, currentMode: string) => {
|
||||
console.log('打开弹窗', sign, data)
|
||||
titleType.value = sign
|
||||
dialogVisible.value = true
|
||||
mode.value = currentMode
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
const proTable = ref<ProTableInstance>()
|
||||
|
||||
const getTableList = (params: any) => {
|
||||
console.log("getTableList",params)
|
||||
let newParams = JSON.parse(JSON.stringify(params))
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id//获取数据字典中对应的id
|
||||
newParams.pattern = patternId
|
||||
@@ -65,7 +66,7 @@
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
search: { el: 'input' },
|
||||
minWidth: 180,
|
||||
minWidth: 300,
|
||||
},
|
||||
{
|
||||
prop: 'devType',
|
||||
@@ -73,7 +74,7 @@
|
||||
enum: dictStore.getDictData('S_Dev_Type_'+dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.code),
|
||||
fieldNames: { label: 'name', value: 'id' },
|
||||
search: { el: 'select' },
|
||||
minWidth: 220,
|
||||
minWidth: 250,
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
|
||||
@@ -1,39 +1,53 @@
|
||||
<template>
|
||||
<div class="device-list-container" v-if="isShow">
|
||||
<el-dropdown @command="handleCommand">
|
||||
<el-dropdown>
|
||||
<el-link link type='primary' class='table-operate'>
|
||||
<div class='table-operate-text'>更多...</div>
|
||||
<div>更多...</div>
|
||||
</el-link>
|
||||
<!-- <span class="el-dropdown-link">
|
||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</span> -->
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<!-- <el-dropdown-item command="高精度设备-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-4">高精度设备-PQV-520便携式电能质量监测装置-4</el-dropdown-item> -->
|
||||
<el-dropdown-item v-for="(name, index) in props.sourceNames" :key="index" @click="handleSourceClick(index)">
|
||||
<el-link link type="primary">{{ name }}</el-link>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps<{
|
||||
isShow: boolean;
|
||||
}>();
|
||||
<script lang="ts" setup>
|
||||
|
||||
const handleCommand = (command: string | number | object) => {
|
||||
const props = defineProps({
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
},
|
||||
sourceNames: {
|
||||
type: Array as () => string[],
|
||||
},
|
||||
sourceIds: {
|
||||
type: Array as () => string[],
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'source-clicked', id: string): void;
|
||||
}>();
|
||||
|
||||
const handleSourceClick = (index: number) => {
|
||||
if (props.sourceIds && props.sourceIds[index]) {
|
||||
emit('source-clicked', props.sourceIds[index]);
|
||||
} else {
|
||||
console.log('sourceIds is undefined or the index is out of bounds');
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.example-showcase .el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: var(--el-button-text-color);
|
||||
.device-list-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-left: 10px; /* 调整这个值以达到所需的效果 */
|
||||
}
|
||||
</style>
|
||||
@@ -166,10 +166,10 @@
|
||||
const formRuleRef = ref<FormInstance>()
|
||||
const rules: Ref<Record<string, Array<FormItemRule>>> = ref({
|
||||
name: [{ required: true, message: '检测计划名称必填!', trigger: 'blur' }],
|
||||
source_Id: [{ required: true, message: '检测源必选!', trigger: 'blur' }],
|
||||
dataSource_Id: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
||||
script_Id: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
||||
error_Sys_Id: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
|
||||
sourceIds: [{ required: true, message: '检测源必选!', trigger: 'blur' }],
|
||||
datasourceIds: [{ required: true, message: '数据源必选!', trigger: 'blur' }],
|
||||
scriptId: [{ required: true, message: '检测脚本必选!', trigger: 'blur' }],
|
||||
errorSysId: [{ required: true, message: '误差体系必选!', trigger: 'blur' }],
|
||||
});
|
||||
|
||||
// 关闭弹窗
|
||||
@@ -239,11 +239,11 @@ const open = async (sign: string,
|
||||
// 重置表单
|
||||
dialogFormRef.value?.resetFields()
|
||||
|
||||
if(sign == 'add')
|
||||
if(sign == 'add')
|
||||
{
|
||||
const pqDevList_Result = await getUnboundPqDevList(data);
|
||||
pqDevList.value = pqDevList_Result.data as Device.ResPqDev[];
|
||||
}else{
|
||||
}else{//编辑时先给表单赋值(这会没接收被检设备),需要手动再给被检设备复制后整体表单赋值
|
||||
const boundPqDevList_Result = await getBoundPqDevList({ 'planId': data.id });
|
||||
const unboundPqDevList_Result = await getUnboundPqDevList(data);
|
||||
|
||||
@@ -256,8 +256,11 @@ const open = async (sign: string,
|
||||
Object.assign(formContent,{ ...data })
|
||||
}
|
||||
|
||||
|
||||
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||
pqToArray();//将对象转为数组
|
||||
}
|
||||
|
||||
function pqToArray() {
|
||||
const sourceArray1 = Array.isArray(pqSourceList.value) ? pqSourceList.value : []
|
||||
// 将 pqSource_Result 转换成 { label, value } 数组
|
||||
pqSourceArray.value = sourceArray1.map(item => ({
|
||||
label: item.name || '',
|
||||
@@ -281,7 +284,6 @@ const open = async (sign: string,
|
||||
label: item.name,
|
||||
value: item.id
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
const dataSourceType = computed(() => {
|
||||
@@ -302,6 +304,8 @@ defineExpose({ open })
|
||||
const props = defineProps<{
|
||||
refreshTable: (() => Promise<void>) | undefined;
|
||||
}>()
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
合并
|
||||
</el-button>
|
||||
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
|
||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected'>
|
||||
<el-button type='danger' :icon='Delete' plain :disabled='!scope.isSelected' @click='batchDelete(scope.selectedListIds)'>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -29,8 +29,10 @@
|
||||
<!-- 向计划导入/导出设备对话框 -->
|
||||
<PlanPopup :refresh-table='proTable?.getTableList' ref='planPopup'/>
|
||||
<!-- 查看误差体系详细信息 -->
|
||||
<ErrorStandardDialog :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
||||
|
||||
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref="errorStandardPopup"/>
|
||||
<!-- 查看检测源 -->
|
||||
<TestSourcePopup :refresh-table='proTable?.getTableList' ref="testSourcePopup"/>
|
||||
<!-- 查看设备绑定 -->
|
||||
<DevTransfer :refresh-table='proTable?.getTableList' ref='devTransferPopup'/>
|
||||
|
||||
</template>
|
||||
@@ -52,12 +54,13 @@ import { useDictStore } from '@/stores/modules/dict'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import type { Action } from 'element-plus'
|
||||
import type { ErrorSystem } from '@/api/error/interface'
|
||||
import ErrorStandardDialog from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
||||
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue' // 导入子组件
|
||||
import TestSourcePopup from '@/views/machine/testSource/components/testSourcePopup.vue' // 导入子组件
|
||||
import { type TestSource } from '@/api/device/interface/testSource'
|
||||
import { useModeStore } from '@/stores/modules/mode'; // 引入模式 store
|
||||
import { useHandleData } from '@/hooks/useHandleData'
|
||||
|
||||
import { dictTestState,dictReportState,dictResult } from '@/api/plan/planData.ts'
|
||||
import {getTestSourceById} from '@/api/device/testSource/index'
|
||||
const dictStore = useDictStore()
|
||||
const openDeviceView = ref()
|
||||
const openSourceView = ref()
|
||||
@@ -66,6 +69,7 @@ const sourceTransferVisible = ref(false)
|
||||
// ProTable 实例
|
||||
const proTable = ref<ProTableInstance>()
|
||||
const errorStandardPopup = ref()
|
||||
const testSourcePopup = ref()
|
||||
const planPopup = ref()
|
||||
const devTransferPopup = ref()
|
||||
const modeStore = useModeStore();
|
||||
@@ -89,7 +93,9 @@ const dataSourceType = computed(() => {
|
||||
default:
|
||||
return 'Datasource_Contrast'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 表格配置项
|
||||
const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
@@ -104,15 +110,28 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
{
|
||||
prop: 'sourceName',
|
||||
label: '检测源',
|
||||
minWidth: 480,
|
||||
minWidth: 400,
|
||||
render: scope => {
|
||||
const sourceNames = Array.isArray(scope.row.sourceName) ? scope.row.sourceName : [];
|
||||
const sourceIds = Array.isArray(scope.row.sourceIds) ? scope.row.sourceIds : [];
|
||||
const firstSourceName = sourceNames[0];
|
||||
const firstSourceId = sourceIds[0];
|
||||
const remainingSourceNames = sourceNames.slice(1);
|
||||
const remainingSourceIds = sourceIds.slice(1);
|
||||
|
||||
return (
|
||||
<div class='flx-flex-start'>
|
||||
<el-link type='primary' link onClick={() => showTestSource(scope.row.sourceName)}>
|
||||
{scope.row.sourceName}
|
||||
<div class='flx-flex-start'>
|
||||
{firstSourceName && (
|
||||
<el-link type='primary' link onClick={() => showTestSource(firstSourceId)}>
|
||||
{firstSourceName}
|
||||
</el-link>
|
||||
<moreButtons isShow={isVisible(scope.row)} ></moreButtons>
|
||||
</div>
|
||||
)}
|
||||
<moreButtons isShow={isVisible(scope.row)}
|
||||
sourceNames={remainingSourceNames}//长度>1时,传给更多子组件从第二位开始的名字
|
||||
sourceIds={remainingSourceIds} //长度>1时,传给更多子组件从第二位开始的id
|
||||
onSource-clicked={showTestSource}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -171,7 +190,8 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
prop: 'testState',
|
||||
label: '检测状态',
|
||||
width: 120,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
enum:dictTestState,
|
||||
search: { el:'select',props: { filterable: true }},
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
render: scope => {
|
||||
return (
|
||||
@@ -183,11 +203,12 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
prop: 'reportState',
|
||||
label: '检测报告状态',
|
||||
width: 120,
|
||||
enum:dictReportState,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
render: scope => {
|
||||
return (
|
||||
scope.row.testState === 0 ? '未生成' : scope.row.testState === 1 ? '部分生成' : '全部生成'
|
||||
scope.row.reportState === 0 ? '未生成' : scope.row.reportState === 1 ? '部分生成' : '全部生成'
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -195,110 +216,21 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
prop: 'result',
|
||||
label: '检测结果',
|
||||
width: 120,
|
||||
enum:dictResult,
|
||||
search: { el: 'select', props: { filterable: true } },
|
||||
fieldNames: { label: 'label', value: 'id' },
|
||||
render: scope => {
|
||||
return (
|
||||
scope.row.testState === 0 ? '不符合' : scope.row.testState === 1 ? '符合' : '/'
|
||||
scope.row.result === 0 ? '不符合' : scope.row.result === 1 ? '符合' : '/'
|
||||
)
|
||||
},
|
||||
},
|
||||
{ prop: 'operation', label: '操作', fixed: 'right', width: 250 },
|
||||
])
|
||||
|
||||
|
||||
|
||||
// // 表格配置项
|
||||
// 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 },
|
||||
// ])
|
||||
|
||||
const handleSourceClicked = (id: string) => {
|
||||
|
||||
};
|
||||
|
||||
function openFileDialog() {
|
||||
if (fileInput.value) {
|
||||
@@ -317,8 +249,6 @@ function isVisible(row: Plan.ReqPlan) {
|
||||
else{
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -326,8 +256,19 @@ function showData(row: string) {
|
||||
errorStandardPopup.value?.open(row, row)
|
||||
}
|
||||
|
||||
function showTestSource(row: string) {
|
||||
|
||||
async function showTestSource(row:string) {
|
||||
const patternId = dictStore.getDictData('Pattern').find(item=>item.name=== modeStore.currentMode)?.id ?? ''//获取数据字典中对应的id
|
||||
const params: TestSource.ResTestSource = {
|
||||
id: row, // 根据实际情况设
|
||||
pattern: patternId,
|
||||
type: '',
|
||||
devType: '',
|
||||
state: 0
|
||||
};
|
||||
|
||||
const result = await getTestSourceById(params);
|
||||
testSourcePopup.value?.open('view', result.data, modeStore.currentMode);
|
||||
|
||||
}
|
||||
|
||||
function showTestScript(row: string) {
|
||||
@@ -400,10 +341,17 @@ const combineClick = () => {
|
||||
|
||||
// 打开 drawer(新增、编辑)
|
||||
const openDialog = (titleType: string, row: Partial<Plan.ReqPlan> = {}) => {
|
||||
|
||||
planPopup.value?.open(titleType, row,modeStore.currentMode)
|
||||
}
|
||||
|
||||
|
||||
// 批量删除设备
|
||||
const batchDelete = async (id: string[]) => {
|
||||
await useHandleData(deletePlan, id, '删除所选检测计划')
|
||||
proTable.value?.clearSelection()
|
||||
proTable.value?.getTableList()
|
||||
}
|
||||
|
||||
// 删除检测计划
|
||||
const handleDelete = async (params: Plan.ReqPlanParams) => {
|
||||
await useHandleData(deletePlan, [params.id], `删除【${params.name}】检测计划`)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="程序激活" v-bind="dialogSmall">
|
||||
<el-form :model="formContent">
|
||||
|
||||
Reference in New Issue
Block a user