This commit is contained in:
Vinjor 2025-03-17 13:21:22 +08:00
parent ee699f0ec8
commit 8bb08b7e71
2 changed files with 300 additions and 0 deletions

44
src/api/base/config.js Normal file
View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询基础配置-账户配置、小程序配置的内容列表
export function listConfig(query) {
return request({
url: '/base/config/list',
method: 'get',
params: query
})
}
// 查询基础配置-账户配置、小程序配置的内容详细
export function getConfig(id) {
return request({
url: '/base/config/' + id,
method: 'get'
})
}
// 新增基础配置-账户配置、小程序配置的内容
export function addConfig(data) {
return request({
url: '/base/config',
method: 'post',
data: data
})
}
// 修改基础配置-账户配置、小程序配置的内容
export function updateConfig(data) {
return request({
url: '/base/config',
method: 'put',
data: data
})
}
// 删除基础配置-账户配置、小程序配置的内容
export function delConfig(id) {
return request({
url: '/base/config/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,256 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="唯一编码" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入唯一编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['base:config:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['base:config:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['base:config:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['base:config:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<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="id" />
<el-table-column label="唯一编码" align="center" prop="code" />
<el-table-column label="json字符串" align="center" prop="jsonStr" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:config:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:config:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改基础配置-账户配置小程序配置的内容对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="唯一编码" prop="code">
<el-input v-model="form.code" placeholder="请输入唯一编码" />
</el-form-item>
<el-form-item label="json字符串" prop="jsonStr">
<el-input v-model="form.jsonStr" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig } from "@/api/base/config";
export default {
name: "Config",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// -
configList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
jsonStr: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询基础配置-账户配置、小程序配置的内容列表 */
getList() {
this.loading = true;
listConfig(this.queryParams).then(response => {
this.configList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
code: null,
jsonStr: null,
creator: null,
createTime: null,
updater: null,
updateTime: null,
delFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加基础配置-账户配置、小程序配置的内容";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改基础配置-账户配置、小程序配置的内容";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除基础配置-账户配置、小程序配置的内容编号为"' + ids + '"的数据项?').then(function() {
return delConfig(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('base/config/export', {
...this.queryParams
}, `config_${new Date().getTime()}.xlsx`)
}
}
};
</script>