2024-10-23 19:30:11 +08:00
|
|
|
<template>
|
|
|
|
|
<div class='table-box'>
|
|
|
|
|
<ProTable
|
|
|
|
|
ref='proTable'
|
|
|
|
|
:columns='columns'
|
|
|
|
|
:data='errorData'
|
|
|
|
|
type='selection'
|
2024-10-24 12:28:12 +08:00
|
|
|
@selection-change="handleSelectionChange"
|
2024-10-23 19:30:11 +08:00
|
|
|
>
|
|
|
|
|
<!-- 表格 header 按钮 -->
|
|
|
|
|
<template #tableHeader>
|
2024-10-24 12:28:12 +08:00
|
|
|
<el-button type='primary' :icon='CirclePlus' @click="openAddDialog">新增</el-button>
|
|
|
|
|
<el-button type='danger' :icon='Delete' plain :disabled='!multipleSelection.length'
|
2024-10-23 19:30:11 +08:00
|
|
|
>
|
2024-10-24 12:28:12 +08:00
|
|
|
批量删除
|
2024-10-23 19:30:11 +08:00
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- 表格操作 -->
|
|
|
|
|
<template #operation='scope'>
|
2024-10-24 09:38:12 +08:00
|
|
|
<el-button type='primary' link :icon='View' @click="handleRowClick(scope.row)">查看</el-button>
|
2024-10-23 19:30:11 +08:00
|
|
|
<el-button type='primary' link :icon='EditPen' @click="openEditDialog(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button type='primary' link :icon='Delete' >删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</ProTable>
|
|
|
|
|
|
2024-10-24 09:38:12 +08:00
|
|
|
<!-- 新增/编辑误差体系对话框 -->
|
|
|
|
|
<ErrorSystemDialog
|
2024-10-23 19:30:11 +08:00
|
|
|
:visible="dialogFormVisible"
|
|
|
|
|
:formData="dialogForm"
|
|
|
|
|
:dialogTitle="dialogTitle"
|
|
|
|
|
@update:visible="dialogFormVisible = $event"
|
|
|
|
|
/>
|
2024-10-24 09:38:12 +08:00
|
|
|
|
|
|
|
|
<!-- 查看误差体系详细信息 -->
|
|
|
|
|
<ErrorStandardDialog
|
|
|
|
|
:visible="detail_dialogFormVisible"
|
|
|
|
|
:formData="detail_dialogForm"
|
|
|
|
|
:dialogTitle="detail_dialogTitle"
|
|
|
|
|
@update:visible="detail_dialogFormVisible = $event"
|
|
|
|
|
/>
|
2024-10-23 19:30:11 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts" name='useProTable'>
|
|
|
|
|
import ProTable from '@/components/ProTable/index.vue'
|
|
|
|
|
import type { ColumnProps } from '@/components/ProTable/interface'
|
|
|
|
|
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
|
|
|
|
|
import errorDataList from '@/api/error/errorData'
|
|
|
|
|
import { reactive,ref } from 'vue'
|
|
|
|
|
import type { ErrorSystem } from '@/api/error/interface'
|
2024-10-24 09:38:12 +08:00
|
|
|
import ErrorSystemDialog from "@/views/machine/errorSystem/components/ErrorSystemDialog.vue"; // 导入子组件
|
|
|
|
|
import ErrorStandardDialog from "@/views/machine/errorSystem/components/ErrorStandardDialog.vue"; // 导入子组件
|
2024-10-30 15:19:47 +08:00
|
|
|
import { useDictStore } from '@/stores/modules/dict'
|
|
|
|
|
const dictStore = useDictStore()
|
2024-10-23 19:30:11 +08:00
|
|
|
let multipleSelection = ref<string[]>([])
|
2024-10-24 09:38:12 +08:00
|
|
|
const errorData = errorDataList.errordata
|
2024-10-23 19:30:11 +08:00
|
|
|
const dialogFormVisible = ref(false)
|
|
|
|
|
const dialogTitle = ref('新增误差体系')
|
|
|
|
|
const dialogForm = ref<ErrorSystem.ErrorSystemList>({
|
2024-10-30 15:19:47 +08:00
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
standard_Name:'',
|
|
|
|
|
standard_Time:'',
|
|
|
|
|
dev_Level:'',
|
|
|
|
|
enable:1,
|
|
|
|
|
state:1,
|
2024-10-24 09:38:12 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const detail_dialogFormVisible = ref(false)
|
|
|
|
|
const detail_dialogTitle = ref('Q/GDW 10650.2-2021 误差体系')
|
2024-10-30 15:19:47 +08:00
|
|
|
const detail_dialogForm = ref<ErrorSystem.Error_detail>({
|
2024-10-24 09:38:12 +08:00
|
|
|
measured: '',//被测量
|
|
|
|
|
deviceLevel: '',//检测装置级别
|
2024-10-30 15:19:47 +08:00
|
|
|
measurementType:'',
|
2024-10-24 09:38:12 +08:00
|
|
|
condition: '',//测量条件
|
|
|
|
|
maxErrorValue: '',//最大误差
|
2024-10-23 19:30:11 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 表格配置项
|
2024-10-30 15:19:47 +08:00
|
|
|
const columns = ref<ColumnProps<ErrorSystem.ErrorSystemList>[]>([
|
2024-10-28 08:39:09 +08:00
|
|
|
{ type: 'selection', fixed: 'left', width: 70 },
|
2024-10-23 19:30:11 +08:00
|
|
|
{
|
|
|
|
|
prop: 'id',
|
|
|
|
|
label: '序号',
|
2024-10-28 08:39:09 +08:00
|
|
|
width: 70,
|
2024-10-23 19:30:11 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'name',
|
|
|
|
|
label: '误差体系名称',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-10-30 19:07:41 +08:00
|
|
|
prop: 'standard_Name',
|
2024-10-30 15:19:47 +08:00
|
|
|
label: '参照标准名称',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'standard_Time',
|
2024-10-23 19:30:11 +08:00
|
|
|
label: '标准实施年份',
|
2024-10-24 12:28:12 +08:00
|
|
|
width: 200,
|
2024-10-23 19:30:11 +08:00
|
|
|
search: { el: 'input' },
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-10-30 15:19:47 +08:00
|
|
|
prop: 'dev_Level',
|
2024-10-23 19:30:11 +08:00
|
|
|
label: '适用设备等级',
|
2024-10-30 15:19:47 +08:00
|
|
|
width: 120,
|
2024-10-30 19:07:41 +08:00
|
|
|
enum: dictStore.getDictData('errorLevel'),
|
2024-10-23 19:30:11 +08:00
|
|
|
search: { el: 'select', props: { filterable: true } },
|
2024-10-30 19:07:41 +08:00
|
|
|
fieldNames: { label: 'label', value: 'code' },
|
2024-10-23 19:30:11 +08:00
|
|
|
},
|
2024-10-30 15:19:47 +08:00
|
|
|
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 300,},
|
2024-10-23 19:30:11 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// 打开编辑对话框
|
2024-10-24 09:38:12 +08:00
|
|
|
const openEditDialog = (errorSystem: ErrorSystem.ErrorSystemList) => {
|
2024-10-30 15:19:47 +08:00
|
|
|
errorSystem.standard_Time ='2024'
|
2024-10-24 09:38:12 +08:00
|
|
|
dialogForm.value = {...errorSystem};
|
|
|
|
|
dialogTitle.value = '编辑误差体系';
|
|
|
|
|
dialogFormVisible.value = true; // 打开对话框
|
2024-10-23 19:30:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const openAddDialog = () => {
|
|
|
|
|
dialogForm.value = {
|
2024-10-30 15:19:47 +08:00
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
standard_Name:'',
|
|
|
|
|
standard_Time:'',
|
|
|
|
|
dev_Level:'',
|
2024-10-30 19:07:41 +08:00
|
|
|
|
|
|
|
|
state:0,
|
2024-10-23 19:30:11 +08:00
|
|
|
};
|
2024-10-24 09:38:12 +08:00
|
|
|
dialogTitle.value = '新增误差体系';
|
2024-10-23 19:30:11 +08:00
|
|
|
dialogFormVisible.value = true; // 打开对话框
|
|
|
|
|
};
|
|
|
|
|
|
2024-10-24 12:28:12 +08:00
|
|
|
//选中
|
|
|
|
|
// 处理选择变化
|
|
|
|
|
const handleSelectionChange = (selection:ErrorSystem.ErrorSystemList[]) => {
|
|
|
|
|
multipleSelection.value = selection.map(row => row.id); // 更新选中的行
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2024-10-24 09:38:12 +08:00
|
|
|
const handleRowClick = (errorSystem: ErrorSystem.ErrorSystemList) =>{
|
|
|
|
|
detail_dialogTitle.value = errorSystem.name;
|
|
|
|
|
detail_dialogFormVisible.value = true; // 显示对话框
|
2024-10-23 19:30:11 +08:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|