Files
pqs-9100_client/frontend/src/views/machine/errorSystem/index.vue

103 lines
3.5 KiB
Vue
Raw Normal View History

2024-10-23 19:30:11 +08:00
<template>
<div class='table-box'>
<ProTable
ref='proTable'
:columns='columns'
2024-11-26 15:41:20 +08:00
:request-api='getPqErrSysList'
2024-10-23 19:30:11 +08:00
>
<!-- 表格 header 按钮 -->
2024-11-26 15:41:20 +08:00
<template #tableHeader='scope'>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button v-auth.device="'delete'" type='danger' :icon='Delete' plain :disabled='!scope.isSelected'
@click='batchDelete(scope.selectedListIds)'>
2024-12-04 20:00:04 +08:00
删除
2024-11-26 15:41:20 +08:00
</el-button>
2024-10-23 19:30:11 +08:00
</template>
<!-- 表格操作 -->
<template #operation='scope'>
2024-12-04 19:54:56 +08:00
<el-button v-auth.device="'view'" type='primary' link :icon='View' @click="openDialog('view', scope.row)">查看</el-button>
<el-button v-auth.device="'edit'" type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
<el-button v-auth.device="'delete'" type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
2024-10-23 19:30:11 +08:00
</template>
</ProTable>
</div>
2024-11-26 15:41:20 +08:00
<ErrorSystemPopup :refresh-table='proTable?.getTableList' ref='errorSystemPopup' />
<ErrorStandardPopup :refresh-table='proTable?.getTableList' ref='errorStandardPopup' />
2024-10-23 19:30:11 +08:00
</template>
<script setup lang="ts" name='useProTable'>
import ProTable from '@/components/ProTable/index.vue'
2024-11-26 15:41:20 +08:00
import type { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
2024-10-23 19:30:11 +08:00
import { CirclePlus, Delete,EditPen,View} from '@element-plus/icons-vue'
import { reactive,ref } from 'vue'
2024-11-26 15:41:20 +08:00
import { useHandleData } from '@/hooks/useHandleData'
import ErrorSystemPopup from '@/views/machine/errorSystem/components/errorSystemPopup.vue'
import ErrorStandardPopup from '@/views/machine/errorSystem/components/errorStandardPopup.vue'
2024-11-18 09:02:57 +08:00
import type { ErrorSystem } from '@/api/device/interface/error'
2024-10-30 15:19:47 +08:00
import { useDictStore } from '@/stores/modules/dict'
2024-11-26 15:41:20 +08:00
import { getPqErrSysList, deletePqErrSys} from '@/api/device/error/index'
2024-10-30 15:19:47 +08:00
const dictStore = useDictStore()
2024-11-26 15:41:20 +08:00
// ProTable 实例
const proTable = ref<ProTableInstance>()
const errorSystemPopup = ref()
const errorStandardPopup = ref()
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-11-26 15:41:20 +08:00
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
2024-10-23 19:30:11 +08:00
{
prop: 'name',
label: '误差体系名称',
},
{
2024-11-26 15:41:20 +08:00
prop: 'standardName',
2024-10-30 15:19:47 +08:00
label: '参照标准名称',
},
{
2024-11-26 15:41:20 +08:00
prop: 'standardTime',
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-11-26 15:41:20 +08:00
prop: 'devLevel',
2024-10-23 19:30:11 +08:00
label: '适用设备等级',
2024-10-30 15:19:47 +08:00
width: 120,
2024-11-26 15:41:20 +08:00
enum: dictStore.getDictData('Dev_Level'),
2024-10-23 19:30:11 +08:00
search: { el: 'select', props: { filterable: true } },
2024-11-26 15:41:20 +08:00
fieldNames: { label: 'name', value: 'id' },
2024-10-23 19:30:11 +08:00
},
2024-11-14 18:26:34 +08:00
{ prop: 'operation', label: '操作', fixed: 'right' ,width: 250,},
2024-10-23 19:30:11 +08:00
])
2024-11-26 15:41:20 +08:00
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<ErrorSystem.ErrorSystemList> = {}) => {
2024-12-03 09:50:15 +08:00
if(titleType == 'view'){
2024-12-04 19:54:56 +08:00
//errorStandardPopup.value?.open(row.name, row)
2024-12-03 09:50:15 +08:00
}else{
2024-12-04 19:54:56 +08:00
//errorSystemPopup.value?.open(titleType, row)
2024-12-03 09:50:15 +08:00
}
2024-11-26 15:41:20 +08:00
}
2024-10-23 19:30:11 +08:00
2024-10-24 12:28:12 +08:00
2024-11-26 15:41:20 +08:00
// 批量删除设备
const batchDelete = async (id: string[]) => {
await useHandleData(deletePqErrSys, id, '删除所选误差体系')
proTable.value?.clearSelection()
proTable.value?.getTableList()
}
2024-10-24 12:28:12 +08:00
2024-11-26 15:41:20 +08:00
// 删除设备
const handleDelete = async (params: ErrorSystem.ErrorSystemList) => {
await useHandleData(deletePqErrSys, [params.id], `删除【${params.name}】误差体系`)
proTable.value?.getTableList()
2024-10-23 19:30:11 +08:00
}
2024-11-26 15:41:20 +08:00
2024-10-23 19:30:11 +08:00
</script>
<style scoped>
</style>