diff --git a/dvadmin-ui/src/api/system/dict/data.js b/dvadmin-ui/src/api/system/dict/data.js index d7aca89..0ec8315 100755 --- a/dvadmin-ui/src/api/system/dict/data.js +++ b/dvadmin-ui/src/api/system/dict/data.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询字典数据列表 export function listData(query) { return request({ - url: '/system/dict/data/list', + url: '/system/dict/data/', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listData(query) { // 查询字典数据详细 export function getData(dictCode) { return request({ - url: '/system/dict/data/' + dictCode, + url: '/system/dict/data/' + dictCode + '/', method: 'get' }) } @@ -20,7 +20,7 @@ export function getData(dictCode) { // 根据字典类型查询字典数据信息 export function getDicts(dictType) { return request({ - url: '/system/dict/data/type/' + dictType, + url: '/system/dict/get/type/' + dictType + '/', method: 'get' }) } @@ -28,7 +28,7 @@ export function getDicts(dictType) { // 新增字典数据 export function addData(data) { return request({ - url: '/system/dict/data', + url: '/system/dict/data' + '/', method: 'post', data: data }) @@ -37,7 +37,7 @@ export function addData(data) { // 修改字典数据 export function updateData(data) { return request({ - url: '/system/dict/data', + url: '/system/dict/data/' + data.id + '/', method: 'put', data: data }) @@ -46,7 +46,7 @@ export function updateData(data) { // 删除字典数据 export function delData(dictCode) { return request({ - url: '/system/dict/data/' + dictCode, + url: '/system/dict/data/' + dictCode + '/', method: 'delete' }) } @@ -54,8 +54,8 @@ export function delData(dictCode) { // 导出字典数据 export function exportData(query) { return request({ - url: '/system/dict/data/export', + url: '/system/dict/data/export/', method: 'get', params: query }) -} \ No newline at end of file +} diff --git a/dvadmin-ui/src/api/system/dict/type.js b/dvadmin-ui/src/api/system/dict/type.js index bc77692..052c4f2 100755 --- a/dvadmin-ui/src/api/system/dict/type.js +++ b/dvadmin-ui/src/api/system/dict/type.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询字典类型列表 export function listType(query) { return request({ - url: '/system/dict/type/list', + url: '/system/dict/type/', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listType(query) { // 查询字典类型详细 export function getType(dictId) { return request({ - url: '/system/dict/type/' + dictId, + url: '/system/dict/type/' + dictId + '/', method: 'get' }) } @@ -20,7 +20,7 @@ export function getType(dictId) { // 新增字典类型 export function addType(data) { return request({ - url: '/system/dict/type', + url: '/system/dict/type/', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addType(data) { // 修改字典类型 export function updateType(data) { return request({ - url: '/system/dict/type', + url: '/system/dict/type/' + data.id + '/', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateType(data) { // 删除字典类型 export function delType(dictId) { return request({ - url: '/system/dict/type/' + dictId, + url: '/system/dict/type/' + dictId + '/', method: 'delete' }) } @@ -66,4 +66,4 @@ export function optionselect() { url: '/system/dict/type/optionselect', method: 'get' }) -} \ No newline at end of file +} diff --git a/dvadmin-ui/src/views/system/dict/data.vue b/dvadmin-ui/src/views/system/dict/data.vue index 3101b66..3ea0704 100755 --- a/dvadmin-ui/src/views/system/dict/data.vue +++ b/dvadmin-ui/src/views/system/dict/data.vue @@ -6,14 +6,14 @@ - + - - + + - + + + + @@ -129,14 +137,21 @@ - - + + - - + + + + + + @@ -188,13 +203,13 @@ export default { // 是否显示弹出层 open: false, // 状态数据字典 - statusOptions: [], + statusOptions: [{dictLabel: '正常', dictValue: '1',}, {dictLabel: '停用', dictValue: '0',}], // 类型数据字典 typeOptions: [], // 查询参数 queryParams: { pageNum: 1, - pageSize: 10, + pageSize: 1000, dictName: undefined, dictType: undefined, status: undefined @@ -203,13 +218,13 @@ export default { form: {}, // 表单校验 rules: { - dictLabel: [ + name: [ { required: true, message: "数据标签不能为空", trigger: "blur" } ], dictValue: [ { required: true, message: "数据键值不能为空", trigger: "blur" } ], - dictSort: [ + sort: [ { required: true, message: "数据顺序不能为空", trigger: "blur" } ] } @@ -217,11 +232,12 @@ export default { }, created() { const dictId = this.$route.params && this.$route.params.dictId; + console.log(11111,this.$route.params) this.getType(dictId); this.getTypeList(); - this.getDicts("sys_normal_disable").then(response => { - this.statusOptions = response.data; - }); + // this.getDicts("sys_normal_disable").then(response => { + // this.statusOptions = response.data; + // }); }, methods: { /** 查询字典类型详细 */ @@ -235,15 +251,16 @@ export default { /** 查询字典类型列表 */ getTypeList() { listType().then(response => { - this.typeOptions = response.rows; + this.typeOptions = response.data.results; }); }, /** 查询字典数据列表 */ getList() { this.loading = true; listData(this.queryParams).then(response => { - this.dataList = response.rows; - this.total = response.total; + console.log(1212,response.data.count) + this.dataList = response.data.results; + this.total = response.data.count; this.loading = false; }); }, @@ -259,10 +276,10 @@ export default { // 表单重置 reset() { this.form = { - dictCode: undefined, - dictLabel: undefined, + id: undefined, + name: undefined, dictValue: undefined, - dictSort: 0, + sort: 0, status: "0", remark: undefined }; @@ -288,15 +305,15 @@ export default { }, // 多选框选中数据 handleSelectionChange(selection) { - this.ids = selection.map(item => item.dictCode) + this.ids = selection.map(item => item.id) this.single = selection.length!=1 this.multiple = !selection.length }, /** 修改按钮操作 */ handleUpdate(row) { this.reset(); - const dictCode = row.dictCode || this.ids - getData(dictCode).then(response => { + const id = row.id || this.ids + getData(id).then(response => { this.form = response.data; this.open = true; this.title = "修改字典数据"; @@ -306,13 +323,15 @@ export default { submitForm: function() { this.$refs["form"].validate(valid => { if (valid) { - if (this.form.dictCode != undefined) { + if (this.form.id != undefined) { updateData(this.form).then(response => { this.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { + const dictId = this.$route.params && this.$route.params.dictId; + this.form.dict_data = dictId addData(this.form).then(response => { this.msgSuccess("新增成功"); this.open = false; @@ -324,7 +343,7 @@ export default { }, /** 删除按钮操作 */ handleDelete(row) { - const dictCodes = row.dictCode || this.ids; + const dictCodes = row.id || this.ids; this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -351,4 +370,4 @@ export default { } } }; - \ No newline at end of file + diff --git a/dvadmin-ui/src/views/system/dict/index.vue b/dvadmin-ui/src/views/system/dict/index.vue index c7697e3..641d7b2 100755 --- a/dvadmin-ui/src/views/system/dict/index.vue +++ b/dvadmin-ui/src/views/system/dict/index.vue @@ -1,9 +1,9 @@