优化表格

This commit is contained in:
guanj
2026-01-14 13:30:23 +08:00
parent 63433aa6dc
commit 054d84778b
37 changed files with 1237 additions and 1142 deletions

View File

@@ -127,7 +127,7 @@ const tableStore = new TableStore({
{ field: 'path', title: '组件路径' },
{ field: 'image', title: '组件展示', render: 'image' },
{
title: '操作',
title: '操作', fixed: 'right',
render: 'buttons',
width: '150',
buttons: [

View File

@@ -1,149 +1,149 @@
<template>
<div class="dictiontary-list-detail child-router">
<TableHeader>
<template #select>
<el-form-item label="">
<el-page-header @back="$emit('close')">
<template #content>
<span class="text-large font-600 mr-3">{{ props.detail.name }}详情信息</span>
</template>
</el-page-header>
</el-form-item>
<el-form-item label="关键字筛选">
<el-input maxlength="32" show-word-limit style="width: 240px"
v-model.trim="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" />
<PopupDetailEdit ref="popupEditRef"></PopupDetailEdit>
</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 PopupDetailEdit from './popupDetailEdit.vue'
import { dictDataDelete } from '@/api/system-boot/dicData'
defineOptions({
name: 'setting/dictionary/list/detail'
})
interface Props {
detail: anyObj
}
const props = withDefaults(defineProps<Props>(), {
detail: () => {
return {}
}
})
const popupEditRef = ref()
const tableStore = new TableStore({
url: '/system-boot/dictData/getTypeIdData',
method: 'POST',
column: [
{ title: '名称', field: 'name' },
{ title: '编码', field: 'code' },
{ title: '排序', field: 'sort' },
{ title: '计算值', field: 'value' },
{ title: '事件等级', field: 'levelName' },
{ title: '算法描述', field: 'algoDescribe' },
{ title: '状态', field: 'stateName' },
{
title: '操作',
width: '180',
render: 'buttons',
fixed: 'right',
buttons: [
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
popupEditRef.value.open('编辑', {
...row,
openDescribe: props.detail.openDescribe,
openLevel: props.detail.openLevel,
typeName: props.detail.name + row.name,
typeId: props.detail.id
})
}
},
{
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除该字典类型吗?'
},
click: row => {
dictDataDelete([row.id]).then(() => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
item.stateName = item.state === 1 ? '正常' : '删除'
switch (item.level) {
case 0:
item.levelName = '普通'
break
case 1:
item.levelName = '中等'
break
case 2:
item.levelName = '严重'
break
default:
item.levelName = '未知'
break
}
for (let key in item) {
if (typeof item[key] !== 'number') {
item[key] = item[key] || '/'
}
}
})
}
})
provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
tableStore.table.params.searchState = 0
tableStore.table.params.typeId = props.detail.id
if (props.detail.openLevel !== 1) {
tableStore.table.column = tableStore.table.column.filter((item: any) => item.field !== 'levelName')
}
if (props.detail.openDescribe !== 1) {
tableStore.table.column = tableStore.table.column.filter((item: any) => item.field !== 'algoDescribe')
}
onMounted(() => {
tableStore.index()
})
const add = () => {
popupEditRef.value.open('新增', {
openLevel: props.detail.openLevel,
openDescribe: props.detail.openDescribe,
typeName: props.detail.name,
typeId: props.detail.id
})
}
</script>
<template>
<div class="dictiontary-list-detail child-router">
<TableHeader>
<template #select>
<el-form-item label="">
<el-page-header @back="$emit('close')">
<template #content>
<span class="text-large font-600 mr-3">{{ props.detail.name }}详情信息</span>
</template>
</el-page-header>
</el-form-item>
<el-form-item label="关键字筛选">
<el-input maxlength="32" show-word-limit style="width: 240px"
v-model.trim="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" />
<PopupDetailEdit ref="popupEditRef"></PopupDetailEdit>
</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 PopupDetailEdit from './popupDetailEdit.vue'
import { dictDataDelete } from '@/api/system-boot/dicData'
defineOptions({
name: 'setting/dictionary/list/detail'
})
interface Props {
detail: anyObj
}
const props = withDefaults(defineProps<Props>(), {
detail: () => {
return {}
}
})
const popupEditRef = ref()
const tableStore = new TableStore({
url: '/system-boot/dictData/getTypeIdData',
method: 'POST',
column: [
{ title: '名称', field: 'name' },
{ title: '编码', field: 'code' },
{ title: '排序', field: 'sort' },
{ title: '计算值', field: 'value' },
{ title: '事件等级', field: 'levelName' },
{ title: '算法描述', field: 'algoDescribe' },
{ title: '状态', field: 'stateName' },
{
title: '操作', fixed: 'right',
width: '180',
render: 'buttons',
buttons: [
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
click: row => {
popupEditRef.value.open('编辑', {
...row,
openDescribe: props.detail.openDescribe,
openLevel: props.detail.openLevel,
typeName: props.detail.name + row.name,
typeId: props.detail.id
})
}
},
{
title: '删除',
type: 'danger',
icon: 'el-icon-Delete',
render: 'confirmButton',
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消',
confirmButtonType: 'danger',
title: '确定删除该字典类型吗?'
},
click: row => {
dictDataDelete([row.id]).then(() => {
ElMessage.success('删除成功')
tableStore.index()
})
}
}
]
}
],
loadCallback: () => {
tableStore.table.data.forEach((item: any) => {
item.stateName = item.state === 1 ? '正常' : '删除'
switch (item.level) {
case 0:
item.levelName = '普通'
break
case 1:
item.levelName = '中等'
break
case 2:
item.levelName = '严重'
break
default:
item.levelName = '未知'
break
}
for (let key in item) {
if (typeof item[key] !== 'number') {
item[key] = item[key] || '/'
}
}
})
}
})
provide('tableStore', tableStore)
tableStore.table.params.searchValue = ''
tableStore.table.params.searchState = 0
tableStore.table.params.typeId = props.detail.id
if (props.detail.openLevel !== 1) {
tableStore.table.column = tableStore.table.column.filter((item: any) => item.field !== 'levelName')
}
if (props.detail.openDescribe !== 1) {
tableStore.table.column = tableStore.table.column.filter((item: any) => item.field !== 'algoDescribe')
}
onMounted(() => {
tableStore.index()
})
const add = () => {
popupEditRef.value.open('新增', {
openLevel: props.detail.openLevel,
openDescribe: props.detail.openDescribe,
typeName: props.detail.name,
typeId: props.detail.id
})
}
</script>

View File

@@ -1,124 +1,124 @@
<template>
<div class="default-main" style="position: relative">
<TableHeader>
<template #select>
<el-form-item label="关键字筛选">
<el-input maxlength="32" show-word-limit style="width: 240px"
v-model.trim="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>
<Detail ref="detailRef" :detail="detail" @close="detail = null" v-if="detail"></Detail>
</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 Detail from './detail.vue'
defineOptions({
name: 'system-boot/dictType/list'
})
const popupEditRef = ref()
const detail = ref<anyObj | null>(null)
const tableStore = new TableStore({
url: '/system-boot/dictType/list',
method: 'POST',
column: [
{
title: '序号', width: 80, formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ title: '名称', field: 'name' },
{ title: '编码', field: 'code' },
{ title: '开启等级', field: 'openLevelName' },
{ title: '开启算法', field: 'openDescribeName' },
{ title: '字典描述', field: 'remark' },
{ title: '创建时间', field: 'createTime', sortable: true },
{ title: '更新时间', field: 'updateTime', sortable: true},
{
title: '状态',
field: 'stateName',
width: '80',
render: 'tag',
custom: {
'正常': 'success',
'删除': 'danger'
},
},
{
title: '操作',
width: '180',
render: 'buttons',
fixed: 'right',
buttons: [
{
title: '查看',
type: 'primary',
icon: 'el-icon-ZoomIn',
render: 'basicButton',
click: row => {
detail.value = row
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
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>
<template>
<div class="default-main" style="position: relative">
<TableHeader>
<template #select>
<el-form-item label="关键字筛选">
<el-input maxlength="32" show-word-limit style="width: 240px"
v-model.trim="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>
<Detail ref="detailRef" :detail="detail" @close="detail = null" v-if="detail"></Detail>
</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 Detail from './detail.vue'
defineOptions({
name: 'system-boot/dictType/list'
})
const popupEditRef = ref()
const detail = ref<anyObj | null>(null)
const tableStore = new TableStore({
url: '/system-boot/dictType/list',
method: 'POST',
column: [
{
title: '序号', width: 80, formatter: (row: any) => {
return (tableStore.table.params.pageNum - 1) * tableStore.table.params.pageSize + row.rowIndex + 1
}
},
{ title: '名称', field: 'name' },
{ title: '编码', field: 'code' },
{ title: '开启等级', field: 'openLevelName' },
{ title: '开启算法', field: 'openDescribeName' },
{ title: '字典描述', field: 'remark' },
{ title: '创建时间', field: 'createTime', sortable: true },
{ title: '更新时间', field: 'updateTime', sortable: true},
{
title: '状态',
field: 'stateName',
width: '80',
render: 'tag',
custom: {
'正常': 'success',
'删除': 'danger'
},
},
{
title: '操作', fixed: 'right',
width: '180',
render: 'buttons',
buttons: [
{
title: '查看',
type: 'primary',
icon: 'el-icon-ZoomIn',
render: 'basicButton',
click: row => {
detail.value = row
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
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>

View File

@@ -1,113 +1,113 @@
<template>
<div class='default-main'>
<div class='custom-table-header'>
<div class="title">字典树列表</div>
<el-button :icon='Plus' type='primary' @click='addMenu'>新增字典类型</el-button>
</div>
<Table ref='tableRef' />
<PopupForm ref='popupFormRef'></PopupForm>
</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 { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { dicDelete } from '@/api/system-boot/dic'
defineOptions({
name: 'setting/dictionary/tree'
})
const popupFormRef = ref()
const tableStore = new TableStore({
showPage:false,
url: '/system-boot/dictTree/queryTree',
method: 'GET',
column: [
{ 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: 'basicButton',
click: row => {
popupFormRef.value.open('新增字典类型', {
name: '',
code: '',
remark: '',
sort: 100,
type: 0,
pid: row.id,
id: ''
})
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
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()
})
}
}
]
}
]
})
provide('tableStore', tableStore)
tableStore.table.params.searchState = 0
onMounted(() => {
tableStore.index()
})
const addMenu = () => {
popupFormRef.value.open('新增字典类型')
}
</script>
<template>
<div class='default-main'>
<div class='custom-table-header'>
<div class="title">字典树列表</div>
<el-button :icon='Plus' type='primary' @click='addMenu'>新增字典类型</el-button>
</div>
<Table ref='tableRef' />
<PopupForm ref='popupFormRef'></PopupForm>
</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 { ElMessage } from 'element-plus'
import PopupForm from './popupForm.vue'
import { dicDelete } from '@/api/system-boot/dic'
defineOptions({
name: 'setting/dictionary/tree'
})
const popupFormRef = ref()
const tableStore = new TableStore({
showPage:false,
url: '/system-boot/dictTree/queryTree',
method: 'GET',
column: [
{ 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: '操作', fixed: 'right',
width: '180',
render: 'buttons',
buttons: [
{
title: '新增',
type: 'primary',
icon: 'el-icon-Plus',
render: 'basicButton',
click: row => {
popupFormRef.value.open('新增字典类型', {
name: '',
code: '',
remark: '',
sort: 100,
type: 0,
pid: row.id,
id: ''
})
}
},
{
title: '编辑',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
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()
})
}
}
]
}
]
})
provide('tableStore', tableStore)
tableStore.table.params.searchState = 0
onMounted(() => {
tableStore.index()
})
const addMenu = () => {
popupFormRef.value.open('新增字典类型')
}
</script>