fix: 字典回显

main
wx-jincw 2 days ago
parent 4ed4cdcfc8
commit 5a608df1ea

@ -68,10 +68,8 @@ export function sysdicttypeListApi(params) {
*/ */
export function sysdicttypeTypesApi(types) { export function sysdicttypeTypesApi(types) {
return request({ return request({
url: `autogencode/sysdicttype/types`, url: `autogencode/sysdictdata/types`,
method: 'GET', method: 'POST',
params: { data: types
types,
}
}) })
} }

@ -49,7 +49,14 @@ function install() {
isRequesting = true; isRequesting = true;
// 批量获取字典 // 批量获取字典
sysdicttypeTypesApi(requesting.map(item => item.type)).then(res => { sysdicttypeTypesApi(requesting.map(item => item.type)).then(res => {
const datas = res.data || {}; const datas = {};
(res || []).forEach(item => {
if (datas[item.dictType]) {
datas[item.dictType].push(item);
} else {
datas[item.dictType] = [item];
}
});
requesting.forEach(item => { requesting.forEach(item => {
store.dispatch('dict/setDict', { key: item.type, value: datas[item.type] || [] }); store.dispatch('dict/setDict', { key: item.type, value: datas[item.type] || [] });
item.resolve(datas[item.type] || []); item.resolve(datas[item.type] || []);

@ -87,7 +87,6 @@
@click="handleClose" @click="handleClose"
>关闭</el-button> >关闭</el-button>
</el-col> --> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
@ -289,8 +288,8 @@ export default {
/** 查询字典类型详细 */ /** 查询字典类型详细 */
getType(dictId) { getType(dictId) {
getType(dictId).then(response => { getType(dictId).then(response => {
this.queryParams.dictType = response.data.dictType; this.queryParams.dictType = response.dictType;
this.defaultDictType = response.data.dictType; this.defaultDictType = response.dictType;
this.getList(); this.getList();
}); });
}, },

@ -104,7 +104,6 @@
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button> >刷新缓存</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
@ -113,7 +112,7 @@
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true"> <el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/sys/operation/dictdata/' + scope.row.dictId" class="link-type"> <router-link :to="'/operation/dictdata/' + scope.row.dictId" class="link-type">
<span>{{ scope.row.dictType }}</span> <span>{{ scope.row.dictType }}</span>
</router-link> </router-link>
</template> </template>

Loading…
Cancel
Save