字典树修改

This commit is contained in:
仲么了
2024-01-24 15:42:54 +08:00
parent bd5102da61
commit bdc5a452f3
9 changed files with 442 additions and 10 deletions

View File

@@ -0,0 +1,114 @@
<template>
<div class='default-main'>
<TableHeader>
<template #select>
<el-form-item label='过滤筛选'>
<el-input
style='width: 240px'
v-model='tableStore.table.params.searchValue'
clearable
placeholder='请输入名称或编码筛选'
/>
</el-form-item>
</template>
<template #operation>
<el-button :icon='Plus' type='primary' @click='add'>新增字典类型</el-button>
</template>
</TableHeader>
<Table ref='tableRef' />
<PopupEdit ref='popupEditRef'></PopupEdit>
</div>
</template>
<script setup lang='ts'>
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'
import TableHeader from '@/components/table/header/index.vue'
import { ElMessage } from 'element-plus'
import PopupEdit from './popupEdit.vue'
import { dictTypeDelete } from '@/api/system-boot/dictType'
import router from '@/router'
defineOptions({
name: 'setting/dictionary/list/detail'
})
const popupEditRef = ref()
const tableStore = new TableStore({
url: '/system-boot/dictType/list',
method: 'POST',
column: [
{ title: '序号', type: 'seq', width: '60' },
{ title: '名称', field: 'name' },
{ title: '编码', field: 'code' },
{ title: '开启等级', field: 'openLevelName' },
{ title: '开启算法', field: 'openDescribeName' },
{ title: '状态', field: 'stateName' },
{ title: '字典描述', field: 'remark' },
{ title: '创建时间', field: 'createTime' },
{ title: '更新时间', field: 'updateTime' },
{
title: '操作',
width: '180',
render: 'buttons',
fixed: 'right',
buttons: [
{
title: '查看',
type: 'primary',
icon: 'el-icon-ZoomIn',
render: 'tipButton',
click: row => {
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'tipButton',
click: row => {
popupEditRef.value.open('编辑字典类型', row)
}
},
{
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除该字典类型吗?'
},
click: row => {
dictTypeDelete([row.id]).then(() => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
item.stateName = item.state === 1 ? '正常' : '删除'
item.openLevelName = item.openLevel === 1 ? '开启' : '不开启'
item.openDescribeName = item.openDescribe === 1 ? '开启' : '不开启'
})
}
})
provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
tableStore.table.params.searchState = 0
onMounted(() => {
tableStore.index()
})
const add = () => {
popupEditRef.value.open('新增字典类型')
}
</script>