This commit is contained in:
sjl
2024-11-11 15:40:49 +08:00
parent f05369556c
commit 0797ea046f
13 changed files with 97 additions and 70 deletions

View File

@@ -4,13 +4,14 @@
ref='proTable'
:columns='columns'
:request-api='getDictTreeList'
:pagination="false"
>
<template #tableHeader>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
</template>
<template #operation='scope'>
<el-button type='primary' :icon='CirclePlus' @click="openDialog('add')">新增</el-button>
<el-button type='primary' link :icon='CirclePlus' @click="openDialog('add',scope.row)">新增</el-button>
<el-button type='primary' link :icon='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
</template>
@@ -41,42 +42,49 @@
{
prop: 'name',
label: '字典名称',
width: 180,
},
{
prop: 'code',
label: '编码',
width: 180,
},
{
prop: 'remark',
label: '描述',
width: 180,
},
{
prop: 'status',
prop: 'state',
label: '状态',
width: 180,
minWidth:30,
enum: dictStore.getDictData('state'),
fieldNames: { label: 'label', value: 'code' },
render: scope => {
return (
<el-tag type={scope.row.state === 0 ? 'success' : (scope.row.state === 1 ? 'warning' : 'danger')}>
{scope.row.state === 0 ? '正常' : (scope.row.state === 1 ? '停用' : '删除')}
</el-tag>
)
},
},
{
prop: 'operation',
label: '操作',
fixed: 'right',
minWidth: 200,
},
])
// 打开 drawer(新增、编辑)
const openDialog = (titleType: string, row: Partial<Dict.ResDictTree> = {}) => {
treePopup.value?.open(titleType, row)
}
// 删除字典类型
const handleDelete = async (params: Dict.ResDictTree) => {
await useHandleData(deleteDictTree, [params.id], `删除【${params.name}】树形字典类型`)
console.log(params)
await useHandleData(deleteDictTree, params, `删除【${params.name}】树形字典类型`)
proTable.value?.getTableList()
}