配置管理增删改查

This commit is contained in:
陈淳
2022-09-23 18:46:37 +08:00
parent 261d9fcd79
commit 9149d6de9a
11 changed files with 217 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ import request from '@/utils/request'
// 查询参数列表
export function listConfig(query) {
return request({
url: '/system/config/list',
url: '/config/pageList',
method: 'get',
params: query
})
@@ -12,7 +12,7 @@ export function listConfig(query) {
// 查询参数详细
export function getConfig(configId) {
return request({
url: '/system/config/' + configId,
url: '/config/getById/' + configId,
method: 'get'
})
}
@@ -28,7 +28,7 @@ export function getConfigKey(configKey) {
// 新增参数配置
export function addConfig(data) {
return request({
url: '/system/config',
url: '/config/add',
method: 'post',
data: data
})
@@ -37,7 +37,7 @@ export function addConfig(data) {
// 修改参数配置
export function updateConfig(data) {
return request({
url: '/system/config',
url: '/config/update',
method: 'put',
data: data
})
@@ -45,9 +45,15 @@ export function updateConfig(data) {
// 删除参数配置
export function delConfig(configId) {
if("string"==typeof(configId))
{
configId=[configId];
}
return request({
url: '/system/config/' + configId,
method: 'delete'
url: '/config/delList',
method: 'delete',
data:configId
})
}

View File

@@ -98,7 +98,7 @@
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="参数主键" align="center" prop="configId" />
<el-table-column label="参数主键" align="center" prop="id" />
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
<el-table-column label="参数键值" align="center" prop="configValue" />
@@ -213,8 +213,8 @@ const { queryParams, form, rules } = toRefs(data);
function getList() {
loading.value = true;
listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
configList.value = response.rows;
total.value = response.total;
configList.value = response.data.data;
total.value = response.data.total;
loading.value = false;
});
}
@@ -226,12 +226,13 @@ function cancel() {
/** 表单重置 */
function reset() {
form.value = {
configId: undefined,
id: undefined,
configName: undefined,
configKey: undefined,
configValue: undefined,
configType: "Y",
remark: undefined
remark: undefined,
isDeleted: false
};
proxy.resetForm("configRef");
}
@@ -248,7 +249,7 @@ function resetQuery() {
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.configId);
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
@@ -261,7 +262,7 @@ function handleAdd() {
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const configId = row.configId || ids.value;
const configId = row.id || ids.value;
getConfig(configId).then(response => {
form.value = response.data;
open.value = true;
@@ -272,7 +273,7 @@ function handleUpdate(row) {
function submitForm() {
proxy.$refs["configRef"].validate(valid => {
if (valid) {
if (form.value.configId != undefined) {
if (form.value.id != undefined) {
updateConfig(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
@@ -290,7 +291,7 @@ function submitForm() {
}
/** 删除按钮操作 */
function handleDelete(row) {
const configIds = row.configId || ids.value;
const configIds = row.id || ids.value;
proxy.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?').then(function () {
return delConfig(configIds);
}).then(() => {