Commit 3bb08ee1 authored by 张伯涛's avatar 张伯涛

本地路由,字典类型接口调节

parent 5ed9bdeb
import request from '@/utils/request' import request from '@/utils/request'
import Qs from 'qs'
// 查询字典数据列表 // 查询字典数据列表
export function listData(query) { export function listData(query) {
return request({ return request({
url: '/authority/system/dict/data/list', url: '/system/dict/data/list',
method: 'get', method: 'get',
params: query params: query
}) })
...@@ -12,7 +13,7 @@ export function listData(query) { ...@@ -12,7 +13,7 @@ export function listData(query) {
// 查询字典数据详细 // 查询字典数据详细
export function getData(dictCode) { export function getData(dictCode) {
return request({ return request({
url: '/authority/system/dict/data/' + dictCode, url: '/system/dict/data/detail/' + dictCode,
method: 'get' method: 'get'
}) })
} }
...@@ -28,15 +29,16 @@ export function getDicts(dictType) { ...@@ -28,15 +29,16 @@ export function getDicts(dictType) {
// 查询字典类型 // 查询字典类型
export function checkDictLabelUnique(dictLabel) { export function checkDictLabelUnique(dictLabel) {
return request({ return request({
url: '/authority/system/dict/data/checkDictLabelUnique?dictLabel=' + dictLabel, url: '/system/dict/data/checkDictLabelUnique?dictLabel=' + dictLabel,
method: 'get' method: 'get'
}) })
} }
// 新增字典数据 // 新增字典数据
export function addData(data) { export function addData(data) {
data = Qs.stringify(data)
return request({ return request({
url: '/authority/system/dict/data/', url: '/system/dict/data/add',
method: 'post', method: 'post',
data: data data: data
}) })
...@@ -44,8 +46,10 @@ export function addData(data) { ...@@ -44,8 +46,10 @@ export function addData(data) {
// 修改字典数据 // 修改字典数据
export function updateData(data) { export function updateData(data) {
const businessId = data.businessId
data = Qs.stringify(data)
return request({ return request({
url: '/authority/system/dict/data/', url: '/system/dict/data/update/' + businessId,
method: 'put', method: 'put',
data: data data: data
}) })
...@@ -54,7 +58,7 @@ export function updateData(data) { ...@@ -54,7 +58,7 @@ export function updateData(data) {
// 删除字典数据 // 删除字典数据
export function delData(dictCode) { export function delData(dictCode) {
return request({ return request({
url: '/authority/system/dict/data/' + dictCode, url: '/system/dict/data/deleteLogical/' + dictCode,
method: 'delete' method: 'delete'
}) })
} }
...@@ -62,8 +66,9 @@ export function delData(dictCode) { ...@@ -62,8 +66,9 @@ export function delData(dictCode) {
// 导出字典数据 // 导出字典数据
export function exportData(query) { export function exportData(query) {
return request({ return request({
url: '/authority/system/dict/data/export', url: '/system/dict/data/export' + query.dictType,
method: 'get', method: 'get',
params: query params: query,
responseType: 'blob'
}) })
} }
...@@ -92,6 +92,19 @@ export const constantRoutes = [ ...@@ -92,6 +92,19 @@ export const constantRoutes = [
name: 'welcome', name: 'welcome',
hidden: true, hidden: true,
meta: { title: '欢迎', icon: 'dashboard' } meta: { title: '欢迎', icon: 'dashboard' }
},
{
path: '/dict',
component: Layout,
hidden: true,
children: [
{
path: 'type/data/:dictId(\\d+)',
component: (resolve) => require(['@/views/system/dict/data'], resolve),
name: 'Data',
meta: { title: '字典数据', icon: '' }
}
]
} }
// { // {
// path: '/old', // path: '/old',
......
...@@ -6,24 +6,24 @@ ...@@ -6,24 +6,24 @@
<el-select v-model="queryParams.dictType" placeholder="请选择字典名称" clearable size="small"> <el-select v-model="queryParams.dictType" placeholder="请选择字典名称" clearable size="small">
<el-option <el-option
v-for="item in typeOptions" v-for="item in typeOptions"
:key="item.dictId" :key="item.businessId"
:label="item.dictName" :label="item.dictName"
:value="item.dictType" :value="item.dictType"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="参数标签" prop="dictLabel"> <el-form-item label="字典标签" prop="dictLabel">
<el-input <el-input
v-model="queryParams.dictLabel" v-model="queryParams.dictLabel"
placeholder="请输入参数标签" placeholder="请输入字典标签"
clearable clearable
:maxlength="30" :maxlength="30"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="参数状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择参数状态" clearable size="small"> <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
<el-option <el-option
v-for="dict in statusOptions" v-for="dict in statusOptions"
:key="dict.dictValue" :key="dict.dictValue"
...@@ -259,11 +259,11 @@ export default { ...@@ -259,11 +259,11 @@ export default {
} }
}, },
created() { created() {
const dictId = this.$route.query && this.$route.query.dictId const dictId = this.$route.params && this.$route.params.dictId
this.getType(dictId) this.getType(dictId)
this.getTypeList() this.getTypeList()
this.getDicts(dictCons['NORMAL_DISABLE']).then(response => { this.getDicts(dictCons['NORMAL_DISABLE']).then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}) })
}, },
methods: { methods: {
......
...@@ -482,7 +482,7 @@ export default { ...@@ -482,7 +482,7 @@ export default {
this.manageLoading = true this.manageLoading = true
const temp = Object.assign({}, this.form) const temp = Object.assign({}, this.form)
if (!temp.parentId) { temp.dataId = '' } if (!temp.parentId) { temp.dataId = '' }
if (this.title === 'update') { if (this.title === '修改字典类型') {
updateType(temp).then(response => { updateType(temp).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ this.$message({
...@@ -512,20 +512,17 @@ export default { ...@@ -512,20 +512,17 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const businessIds = row.businessId const dictIds = row.businessId || this.ids
this.$confirm('所选择数据被删除后不可再恢复,是否继续?', '提示', { this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
return delType(businessIds) return delType(dictIds)
}).then(() => { }).then(() => {
this.getList() this.getList()
this.$message({ this.msgSuccess('删除成功')
message: '删除成功', })
type: 'success'
})
}).catch(function() {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment