|
@@ -16,13 +16,13 @@
|
|
|
<el-table-column prop="name" label="名称" min-width="120" show-overflow-tooltip />
|
|
|
<el-table-column prop="code" label="编码" width="80" show-overflow-tooltip />
|
|
|
<el-table-column prop="value" label="值" width="80" show-overflow-tooltip />
|
|
|
- <el-table-column label="状态" width="80" align="center" show-overflow-tooltip>
|
|
|
+ <el-table-column label="状态" width="70" align="center" show-overflow-tooltip>
|
|
|
<template #default="{ row }">
|
|
|
<el-tag type="success" v-if="row.enabled">启用</el-tag>
|
|
|
<el-tag type="danger" v-else>禁用</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="160" fixed="right" header-align="center" align="center">
|
|
|
+ <el-table-column label="操作" width="140" fixed="right" header-align="center" align="center">
|
|
|
<template #default="{ row }">
|
|
|
<el-button icon="ele-EditPen" size="small" text type="primary" @click="onEdit(row)">编辑</el-button>
|
|
|
<el-button icon="ele-Delete" size="small" text type="danger" @click="onDelete(row)">删除</el-button>
|
|
@@ -49,7 +49,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref, reactive, onMounted, getCurrentInstance, onUnmounted } from 'vue'
|
|
|
-import { DictionaryListOutput, PageInputDictionaryGetPageDto } from '/@/api/admin/data-contracts'
|
|
|
+import { DictionaryListOutput, PageInputDictionaryGetPageDto, DictionaryTypeListOutput } from '/@/api/admin/data-contracts'
|
|
|
import { Dictionary as DictionaryApi } from '/@/api/admin/Dictionary'
|
|
|
import DictionaryForm from './components/dictionary-form.vue'
|
|
|
import eventBus from '/@/utils/mitt'
|
|
@@ -63,31 +63,31 @@ const state = reactive({
|
|
|
dictionaryFormTitle: '',
|
|
|
filterModel: {
|
|
|
name: '',
|
|
|
+ dictionaryTypeId: 0,
|
|
|
},
|
|
|
total: 0,
|
|
|
pageInput: {
|
|
|
currentPage: 1,
|
|
|
pageSize: 20,
|
|
|
- filter: {
|
|
|
- name: null,
|
|
|
- },
|
|
|
} as PageInputDictionaryGetPageDto,
|
|
|
dictionaryListData: [] as Array<DictionaryListOutput>,
|
|
|
})
|
|
|
|
|
|
onMounted(() => {
|
|
|
- onQuery()
|
|
|
- eventBus.on('refreshDict', onQuery)
|
|
|
+ eventBus.on('refreshDict', (data: DictionaryTypeListOutput) => {
|
|
|
+ state.filterModel.dictionaryTypeId = data.id as number
|
|
|
+ onQuery()
|
|
|
+ })
|
|
|
})
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
- eventBus.off('refreshDict', onQuery)
|
|
|
+ eventBus.off('refreshDict')
|
|
|
})
|
|
|
|
|
|
const onQuery = async () => {
|
|
|
state.loading = true
|
|
|
+ state.pageInput.filter = state.filterModel
|
|
|
const res = await new DictionaryApi().getPage(state.pageInput)
|
|
|
-
|
|
|
state.dictionaryListData = res?.data?.list ?? []
|
|
|
state.total = res.data?.total ?? 0
|
|
|
state.loading = false
|