优化多个字典数据查询

This commit is contained in:
不做码农 2021-12-14 22:00:38 +08:00
parent f7edb87207
commit f5fbcb54d7
3 changed files with 14 additions and 16 deletions

View File

@ -158,7 +158,7 @@ $end
$end $end
]; ];
$if(index > 0) $if(index > 0)
this.getMoreDicts(dictParams).then((response) => { this.getDicts(dictParams).then((response) => {
response.data.forEach((element) => { response.data.forEach((element) => {
this[element.columnName] = element.list; this[element.columnName] = element.list;
}); });

View File

@ -19,19 +19,18 @@ export function getData(dictCode) {
// 根据字典类型查询字典数据信息 // 根据字典类型查询字典数据信息
export function getDicts(dictType) { export function getDicts(dictType) {
return request({ if (typeof (dictType) === "object") {
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
// 根据多个字典类型查询字典数据信息
export function getMoreDicts(dictType) {
return request({ return request({
url: '/system/dict/data/types', url: '/system/dict/data/types',
data: dictType, data: dictType,
method: 'post' method: 'post'
}) })
} else {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
})
}
} }
// 新增字典数据 // 新增字典数据

View File

@ -14,7 +14,7 @@ import permission from './directive/permission'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
import { getDicts, getMoreDicts} from "@/api/system/dict/data"; import { getDicts} from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config"; import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, addDateRange2, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi"; import { parseTime, resetForm, addDateRange, addDateRange2, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
//分页组件 //分页组件
@ -34,7 +34,6 @@ import UploadFile from '@/components/FileUpload/index';
// 全局方法挂载 // 全局方法挂载
Vue.prototype.getDicts = getDicts Vue.prototype.getDicts = getDicts
Vue.prototype.getMoreDicts = getMoreDicts
Vue.prototype.getConfigKey = getConfigKey Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm Vue.prototype.resetForm = resetForm