检测计划表格误差体系,检测源跳转
This commit is contained in:
@@ -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}】检测计划`)
|
||||
|
||||
Reference in New Issue
Block a user