提交
This commit is contained in:
1 parent
dc31968204
commit
27ac28b8f5
58 files changed
+5960
-4960
No files matched your search
@@ -204,95 +204,159 @@
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
:title="viewRow?.dictName || '字典详情'"
|
||||
width="900px"
|
||||
:icon="Collection"
|
||||
:meta="`字典类型编码:${viewRow?.dictType || ''}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
|
||||
:sections="viewSections"
|
||||
/>
|
||||
>
|
||||
<template #append>
|
||||
<div class="view-section dict-view-data-section">
|
||||
<h3>字典数据</h3>
|
||||
<div class="list-body list-wrap dict-view-table-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="viewDictDataList"
|
||||
v-loading="viewDictDataLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
empty-text="暂无字典数据"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dictLabel"
|
||||
label="数据标签"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dictValue"
|
||||
label="数据值"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</section>
|
||||
|
||||
<el-dialog
|
||||
v-model="dictDataDialogVisible"
|
||||
:title="`${currentDictType.dictName} - 字典数据配置`"
|
||||
width="900px"
|
||||
class="dialog-form-layout"
|
||||
class="dialog-form-layout dict-data-config-dialog"
|
||||
align-center
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div style="margin-bottom: 12px">
|
||||
<el-button class="btn-main" type="primary" @click="handleAddDictData">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增数据
|
||||
</el-button>
|
||||
<div class="dict-data-dialog-head">
|
||||
<span class="muted">字典类型编码:{{ currentDictType.dictType }}</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="dictDataTableData"
|
||||
v-loading="dictDataLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column type="index" label="#" width="50" align="center" />
|
||||
<el-table-column
|
||||
prop="dictLabel"
|
||||
label="数据标签"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dictValue"
|
||||
label="数据值"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="160"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
<div class="list-toolbar dict-data-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<el-button class="btn-main" type="primary" @click="handleAddDictData">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增数据
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-body list-wrap dict-data-table-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="dictDataTableData"
|
||||
v-loading="dictDataLoading"
|
||||
stripe
|
||||
row-key="id"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
class="btn-op-item primary"
|
||||
@click="handleEditDictData(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDeleteDictData(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar" style="margin-top: 12px">
|
||||
<el-pagination
|
||||
:current-page="dictDataPagination.page"
|
||||
:page-size="dictDataPagination.pageSize"
|
||||
:total="dictDataPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(dictDataPagination.page = 1),
|
||||
(dictDataPagination.pageSize = val),
|
||||
loadDictData()
|
||||
)
|
||||
"
|
||||
@current-change="
|
||||
(val) => ((dictDataPagination.page = val), loadDictData())
|
||||
"
|
||||
/>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
width="68"
|
||||
align="center"
|
||||
header-align="center"
|
||||
:index="
|
||||
(index) =>
|
||||
(dictDataPagination.page - 1) * dictDataPagination.pageSize + index + 1
|
||||
"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dictLabel"
|
||||
label="数据标签"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dictValue"
|
||||
label="数据值"
|
||||
min-width="120"
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="remark"
|
||||
label="备注"
|
||||
min-width="150"
|
||||
show-overflow-tooltip
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="260"
|
||||
fixed="right"
|
||||
align="center"
|
||||
header-align="center"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
class="btn-op-item primary"
|
||||
@click="handleEditDictData(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button class="btn-op-item" @click="handleDeleteDictData(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="dictDataPagination.page"
|
||||
:page-size="dictDataPagination.pageSize"
|
||||
:total="dictDataPagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val) => (
|
||||
(dictDataPagination.page = 1),
|
||||
(dictDataPagination.pageSize = val),
|
||||
loadDictData()
|
||||
)
|
||||
"
|
||||
@current-change="
|
||||
(val) => ((dictDataPagination.page = val), loadDictData())
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
@@ -385,6 +449,7 @@
|
||||
const viewVisible = ref(false)
|
||||
const viewRow = ref<Api.Dict.DictTypeItem | null>(null)
|
||||
const viewDictDataList = ref<Api.Dict.DictDataItem[]>([])
|
||||
const viewDictDataLoading = ref(false)
|
||||
|
||||
const formData = reactive({
|
||||
dictName: '',
|
||||
@@ -436,35 +501,23 @@
|
||||
editingId.value = null
|
||||
}
|
||||
|
||||
const viewSections = computed(() => {
|
||||
const sections: any[] = [
|
||||
{
|
||||
title: '基本信息',
|
||||
fields: [
|
||||
{ label: '字典名称', value: viewRow.value?.dictName },
|
||||
{ label: '字典类型编码', value: viewRow.value?.dictType },
|
||||
{ label: '备注', value: viewRow.value?.remark, span: true },
|
||||
{ label: '创建时间', value: viewRow.value?.createTime }
|
||||
]
|
||||
}
|
||||
]
|
||||
if (viewDictDataList.value.length > 0) {
|
||||
sections.push({
|
||||
title: '字典数据',
|
||||
fields: viewDictDataList.value.map((item) => ({
|
||||
label: item.dictLabel || '',
|
||||
value: item.dictValue || '',
|
||||
span: false
|
||||
}))
|
||||
})
|
||||
const viewSections = computed(() => [
|
||||
{
|
||||
title: '基本信息',
|
||||
fields: [
|
||||
{ label: '字典名称', value: viewRow.value?.dictName },
|
||||
{ label: '字典类型编码', value: viewRow.value?.dictType },
|
||||
{ label: '备注', value: viewRow.value?.remark, span: true },
|
||||
{ label: '创建时间', value: viewRow.value?.createTime }
|
||||
]
|
||||
}
|
||||
return sections
|
||||
})
|
||||
])
|
||||
|
||||
async function handleView(row: Api.Dict.DictTypeItem) {
|
||||
viewRow.value = { ...row }
|
||||
viewDictDataList.value = []
|
||||
viewVisible.value = true
|
||||
viewDictDataLoading.value = true
|
||||
try {
|
||||
const res = await fetchDictDataList({
|
||||
page: 1,
|
||||
@@ -474,6 +527,8 @@
|
||||
viewDictDataList.value = res.list || []
|
||||
} catch (e) {
|
||||
console.error('加载字典数据失败:', e)
|
||||
} finally {
|
||||
viewDictDataLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,6 +723,41 @@
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.dict-view-data-section {
|
||||
padding: 18px 22px;
|
||||
border-bottom: none;
|
||||
|
||||
h3 {
|
||||
margin: 0 0 14px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
border-left: 3px solid #10b981;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.dict-view-table-wrap {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.dict-data-dialog-head {
|
||||
margin-bottom: 12px;
|
||||
|
||||
.muted {
|
||||
font-size: 13px;
|
||||
color: var(--mint-text-muted);
|
||||
}
|
||||
}
|
||||
|
||||
.dict-data-toolbar {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.dict-data-table-wrap {
|
||||
padding-top: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user