From f5fbcb54d7539f0dd0bf01d8c4cdbdfb23ba0a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 14 Dec 2021 22:00:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=9A=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wwwroot/CodeGenTemplate/TplVue.txt | 2 +- ZR.Vue/src/api/system/dict/data.js | 25 +++++++++---------- ZR.Vue/src/main.js | 3 +-- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt index 0c637b2..c643c81 100644 --- a/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt +++ b/ZR.Admin.WebApi/wwwroot/CodeGenTemplate/TplVue.txt @@ -158,7 +158,7 @@ $end $end ]; $if(index > 0) - this.getMoreDicts(dictParams).then((response) => { + this.getDicts(dictParams).then((response) => { response.data.forEach((element) => { this[element.columnName] = element.list; }); diff --git a/ZR.Vue/src/api/system/dict/data.js b/ZR.Vue/src/api/system/dict/data.js index fb9dfc0..0351dd6 100644 --- a/ZR.Vue/src/api/system/dict/data.js +++ b/ZR.Vue/src/api/system/dict/data.js @@ -19,19 +19,18 @@ export function getData(dictCode) { // 根据字典类型查询字典数据信息 export function getDicts(dictType) { - return request({ - url: '/system/dict/data/type/' + dictType, - method: 'get' - }) -} - -// 根据多个字典类型查询字典数据信息 -export function getMoreDicts(dictType) { - return request({ - url: '/system/dict/data/types', - data: dictType , - method: 'post' - }) + if (typeof (dictType) === "object") { + return request({ + url: '/system/dict/data/types', + data: dictType, + method: 'post' + }) + } else { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) + } } // 新增字典数据 diff --git a/ZR.Vue/src/main.js b/ZR.Vue/src/main.js index 4816400..9ccbc54 100644 --- a/ZR.Vue/src/main.js +++ b/ZR.Vue/src/main.js @@ -14,7 +14,7 @@ import permission from './directive/permission' import './assets/icons' // icon 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 { 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.getMoreDicts = getMoreDicts Vue.prototype.getConfigKey = getConfigKey Vue.prototype.parseTime = parseTime Vue.prototype.resetForm = resetForm