85 lines
2.4 KiB
Vue
85 lines
2.4 KiB
Vue
|
|
<template>
|
||
|
|
<div class='table-box' ref='popupBaseView'>
|
||
|
|
<ProTable
|
||
|
|
ref='proTable'
|
||
|
|
:columns='columns'
|
||
|
|
:request-api='getDictTreeList'
|
||
|
|
>
|
||
|
|
<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='EditPen' @click="openDialog('edit', scope.row)">编辑</el-button>
|
||
|
|
<el-button type='primary' link :icon='Delete' @click='handleDelete(scope.row)'>删除</el-button>
|
||
|
|
</template>
|
||
|
|
</ProTable>
|
||
|
|
</div>
|
||
|
|
<TreePopup :refresh-table='proTable?.getTableList' ref='treePopup'/>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup lang='tsx' name='dict'>
|
||
|
|
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue'
|
||
|
|
import {type Dict} from '@/api/system/dictionary/interface'
|
||
|
|
import type { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||
|
|
import TreePopup from '@/views/system/dictionary/dictTree/components/treePopup.vue'
|
||
|
|
import {useDictStore} from '@/stores/modules/dict'
|
||
|
|
import {useHandleData} from '@/hooks/useHandleData'
|
||
|
|
import {
|
||
|
|
getDictTreeList,
|
||
|
|
deleteDictTree,
|
||
|
|
} from '@/api/system/dictionary/dictTree'
|
||
|
|
import { reactive, ref } from 'vue'
|
||
|
|
|
||
|
|
const dictStore = useDictStore()
|
||
|
|
|
||
|
|
const proTable = ref<ProTableInstance>()
|
||
|
|
const treePopup = ref()
|
||
|
|
|
||
|
|
const columns = reactive<ColumnProps<Dict.ResDictTree>[]>([
|
||
|
|
{
|
||
|
|
prop: 'name',
|
||
|
|
label: '字典名称',
|
||
|
|
width: 180,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
prop: 'code',
|
||
|
|
label: '编码',
|
||
|
|
width: 180,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
prop: 'remark',
|
||
|
|
label: '描述',
|
||
|
|
width: 180,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
prop: 'status',
|
||
|
|
label: '状态',
|
||
|
|
width: 180,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
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}】树形字典类型`)
|
||
|
|
proTable.value?.getTableList()
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
</script>
|
||
|
|
|