fix: 字典回显

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

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

@ -49,7 +49,14 @@ function install() {
isRequesting = true;
// 批量获取字典
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 => {
store.dispatch('dict/setDict', { key: item.type, value: datas[item.type] || [] });
item.resolve(datas[item.type] || []);

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

@ -104,7 +104,6 @@
v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<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" :show-overflow-tooltip="true">
<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>
</router-link>
</template>

Loading…
Cancel
Save