Files
admin-govern/src/views/setting/dictionary/tree/index.vue

113 lines
3.5 KiB
Vue
Raw Normal View History

2024-01-24 15:42:54 +08:00
<template>
2024-01-25 16:42:56 +08:00
<div class='default-main'>
<div class='custom-table-header'>
<div style='flex: 1; font-weight: 700'>字典树列表</div>
<el-button :icon='Plus' type='primary' @click='addMenu'>新增字典类型</el-button>
</div>
<Table ref='tableRef' />
<PopupForm ref='popupFormRef'></PopupForm>
2024-01-24 15:42:54 +08:00
</div>
</template>
2024-01-25 16:42:56 +08:00
<script setup lang='ts'>
2024-01-24 15:42:54 +08:00
import { Plus } from '@element-plus/icons-vue'
import { ref, onMounted, provide } from 'vue'
import TableStore from '@/utils/tableStore'
import Table from '@/components/table/index.vue'
2024-01-25 16:42:56 +08:00
import { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { dicDelete } from '@/api/system-boot/dic'
2024-01-24 15:42:54 +08:00
defineOptions({
name: 'setting/dictionary/tree'
})
2024-01-25 16:42:56 +08:00
const popupFormRef = ref()
2024-01-24 15:42:54 +08:00
const tableStore = new TableStore({
2024-01-25 15:40:46 +08:00
url: '/system-boot/dic/dicTree',
method: 'GET',
2024-01-24 15:42:54 +08:00
column: [
2024-01-25 16:42:56 +08:00
{ title: '字典名称', field: 'name', treeNode: true, align: 'left' },
// { title: '排序', field: 'sort',width:'80' },
{ title: '编码', field: 'code' },
{ title: '描述', field: 'remark' },
{
title: '状态',
field: 'status',
width: '80',
render: 'tag',
custom: {
0: 'success',
1: 'warning',
2: 'danger'
},
replaceValue: {
0: '正常',
1: '禁用',
2: '删除'
}
},
{
title: '操作',
width: '180',
render: 'buttons',
fixed: 'right',
buttons: [
{
title: '新增',
type: 'primary',
icon: 'el-icon-Plus',
render: 'tipButton',
click: row => {
popupFormRef.value.open('新增字典类型', {
name: '',
code: '',
remark: '',
sort: 0,
type: 0,
pid: row.id,
id: ''
})
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'tipButton',
click: row => {
popupFormRef.value.open('编辑字典类型', row)
}
},
{
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除该字典类型吗?'
},
click: row => {
dicDelete(row.id).then(() => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
2024-01-26 09:08:20 +08:00
]
2024-01-24 15:42:54 +08:00
})
provide('tableStore', tableStore)
tableStore.table.params.searchState = 0
onMounted(() => {
tableStore.index()
})
2024-01-25 16:42:56 +08:00
const addMenu = () => {
popupFormRef.value.open('新增字典类型')
}
</script>