From 149bac33d6043c2b1ca3a7a68a427d872a586f5d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 25 Apr 2025 13:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E5=85=B8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E6=B3=95getDicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/system/dict/data.js | 52 +++++++++++++++++++++++++++++++++++ api/system/dict/type.js | 60 +++++++++++++++++++++++++++++++++++++++++ main.js | 3 +++ 3 files changed, 115 insertions(+) create mode 100644 api/system/dict/data.js create mode 100644 api/system/dict/type.js diff --git a/api/system/dict/data.js b/api/system/dict/data.js new file mode 100644 index 0000000..6c9eb79 --- /dev/null +++ b/api/system/dict/data.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询字典数据列表 +export function listData(query) { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }) +} + +// 查询字典数据详细 +export function getData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }) +} + +// 根据字典类型查询字典数据信息 +export function getDicts(dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} + +// 新增字典数据 +export function addData(data) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateData(data) { + return request({ + url: '/system/dict/data', + method: 'put', + data: data + }) +} + +// 删除字典数据 +export function delData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'delete' + }) +} diff --git a/api/system/dict/type.js b/api/system/dict/type.js new file mode 100644 index 0000000..a0254ba --- /dev/null +++ b/api/system/dict/type.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询字典类型列表 +export function listType(query) { + return request({ + url: '/system/dict/type/list', + method: 'get', + params: query + }) +} + +// 查询字典类型详细 +export function getType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'get' + }) +} + +// 新增字典类型 +export function addType(data) { + return request({ + url: '/system/dict/type', + method: 'post', + data: data + }) +} + +// 修改字典类型 +export function updateType(data) { + return request({ + url: '/system/dict/type', + method: 'put', + data: data + }) +} + +// 删除字典类型 +export function delType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'delete' + }) +} + +// 刷新字典缓存 +export function refreshCache() { + return request({ + url: '/system/dict/type/refreshCache', + method: 'delete' + }) +} + +// 获取字典选择框列表 +export function optionselect() { + return request({ + url: '/system/dict/type/optionselect', + method: 'get' + }) +} diff --git a/main.js b/main.js index e742834..d4c4b15 100644 --- a/main.js +++ b/main.js @@ -3,10 +3,13 @@ import App from './App' import store from './store' // store import plugins from './plugins' // plugins import './permission' // permission +import { getDicts } from "@/api/system/dict/data" + Vue.use(plugins) Vue.config.productionTip = false Vue.prototype.$store = store +Vue.prototype.getDicts = getDicts App.mpType = 'app'