将前端 config 从 system 迁移到 infra 模块,并进行改名~

This commit is contained in:
YunaiV 2021-01-22 01:31:10 +08:00
parent b005e062bb
commit 092ec983a3
3 changed files with 324 additions and 324 deletions

View File

@ -15,7 +15,7 @@ import permission from './directive/permission'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
import { getDicts } from "@/api/system/dict/data"; import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config"; import { getConfigKey } from "@/api/infra/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, downloadExcel } from "@/utils/ruoyi"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, downloadExcel } from "@/utils/ruoyi";
import Pagination from "@/components/Pagination"; import Pagination from "@/components/Pagination";
// 自定义表格工具扩展 // 自定义表格工具扩展

View File

@ -1,323 +1,323 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="参数名称" prop="name"> <el-form-item label="参数名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
placeholder="请输入参数名称" placeholder="请输入参数名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="参数键名" prop="key"> <el-form-item label="参数键名" prop="key">
<el-input <el-input
v-model="queryParams.key" v-model="queryParams.key"
placeholder="请输入参数键名" placeholder="请输入参数键名"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="系统内置" prop="type"> <el-form-item label="系统内置" prop="type">
<el-select v-model="queryParams.type" placeholder="系统内置" clearable size="small"> <el-select v-model="queryParams.type" placeholder="系统内置" clearable size="small">
<el-option <el-option
v-for="dict in this.getDictDatas(DICT_TYPE.SYS_CONFIG_TYPE)" v-for="dict in this.getDictDatas(DICT_TYPE.SYS_CONFIG_TYPE)"
:key="parseInt(dict.value)" :key="parseInt(dict.value)"
:label="dict.label" :label="dict.label"
:value="parseInt(dict.value)" :value="parseInt(dict.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间"> <el-form-item label="创建时间">
<el-date-picker <el-date-picker
v-model="dateRange" v-model="dateRange"
size="small" size="small"
style="width: 240px" style="width: 240px"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="daterange" type="daterange"
range-separator="-" range-separator="-"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:config:add']" v-hasPermi="['infra:config:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:config:export']" v-hasPermi="['infra:config:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="configList"> <el-table v-loading="loading" :data="configList">
<el-table-column label="参数主键" align="center" prop="id" /> <el-table-column label="参数主键" align="center" prop="id" />
<el-table-column label="参数分组" align="center" prop="group" /> <el-table-column label="参数分组" align="center" prop="group" />
<el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" /> <el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="参数键名" align="center" prop="key" :show-overflow-tooltip="true" /> <el-table-column label="参数键名" align="center" prop="key" :show-overflow-tooltip="true" />
<el-table-column label="参数键值" align="center" prop="value" /> <el-table-column label="参数键值" align="center" prop="value" />
<el-table-column label="系统内置" align="center" prop="type"> <el-table-column label="系统内置" align="center" prop="type">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_CONFIG_TYPE, scope.row.type) }}</span> <span>{{ getDictDataLabel(DICT_TYPE.SYS_CONFIG_TYPE, scope.row.type) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否敏感" align="center" prop="sensitive"> <el-table-column label="是否敏感" align="center" prop="sensitive">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.sensitive ? '是' : '否' }}</span> <span>{{ scope.row.sensitive ? '是' : '否' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:config:edit']" v-hasPermi="['infra:config:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:config:remove']" v-hasPermi="['infra:config:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="参数分组" prop="group"> <el-form-item label="参数分组" prop="group">
<el-input v-model="form.group" placeholder="请输入参数分组" /> <el-input v-model="form.group" placeholder="请输入参数分组" />
</el-form-item> </el-form-item>
<el-form-item label="参数名称" prop="name"> <el-form-item label="参数名称" prop="name">
<el-input v-model="form.name" placeholder="请输入参数名称" /> <el-input v-model="form.name" placeholder="请输入参数名称" />
</el-form-item> </el-form-item>
<el-form-item label="参数键名" prop="key"> <el-form-item label="参数键名" prop="key">
<el-input v-model="form.key" placeholder="请输入参数键名" /> <el-input v-model="form.key" placeholder="请输入参数键名" />
</el-form-item> </el-form-item>
<el-form-item label="参数键值" prop="value"> <el-form-item label="参数键值" prop="value">
<el-input v-model="form.value" placeholder="请输入参数键值" /> <el-input v-model="form.value" placeholder="请输入参数键值" />
</el-form-item> </el-form-item>
<el-form-item label="是否敏感" prop="type"> <el-form-item label="是否敏感" prop="type">
<el-radio-group v-model="form.sensitive"> <el-radio-group v-model="form.sensitive">
<el-radio :key="true" :label="true"></el-radio> <el-radio :key="true" :label="true"></el-radio>
<el-radio :key="false" :label="false"></el-radio> <el-radio :key="false" :label="false"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/system/config"; import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/infra/config";
export default { export default {
name: "Config", name: "Config",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
configList: [], configList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
typeOptions: [], typeOptions: [],
// //
dateRange: [], dateRange: [],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
name: undefined, name: undefined,
key: undefined, key: undefined,
type: undefined type: undefined
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
group: [ group: [
{ required: true, message: "参数分组不能为空", trigger: "blur" } { required: true, message: "参数分组不能为空", trigger: "blur" }
], ],
name: [ name: [
{ required: true, message: "参数名称不能为空", trigger: "blur" } { required: true, message: "参数名称不能为空", trigger: "blur" }
], ],
key: [ key: [
{ required: true, message: "参数键名不能为空", trigger: "blur" } { required: true, message: "参数键名不能为空", trigger: "blur" }
], ],
value: [ value: [
{ required: true, message: "参数键值不能为空", trigger: "blur" } { required: true, message: "参数键值不能为空", trigger: "blur" }
] ]
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listConfig(this.addDateRange(this.queryParams, [ listConfig(this.addDateRange(this.queryParams, [
this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined,
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
])).then(response => { ])).then(response => {
this.configList = response.data.list; this.configList = response.data.list;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
} }
); );
}, },
// //
typeFormat(row, column) { typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.type); return this.selectDictLabel(this.typeOptions, row.type);
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
// //
reset() { reset() {
this.form = { this.form = {
id: undefined, id: undefined,
name: undefined, name: undefined,
key: undefined, key: undefined,
value: undefined, value: undefined,
remark: undefined remark: undefined
}; };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.dateRange = []; this.dateRange = [];
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加参数"; this.title = "添加参数";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getConfig(id).then(response => { getConfig(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改参数"; this.title = "修改参数";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id !== undefined) { if (this.form.id !== undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} }
} }
}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$confirm('是否确认删除参数编号为"' + ids + '"的数据项?', "警告", { this.$confirm('是否确认删除参数编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function() {
return delConfig(ids); return delConfig(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.addDateRange(this.queryParams, [ const queryParams = this.addDateRange(this.queryParams, [
this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined,
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
]); ]);
this.$confirm('是否确认导出所有参数数据项?', "警告", { this.$confirm('是否确认导出所有参数数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function() {
return exportConfig(queryParams); return exportConfig(queryParams);
}).then(response => { }).then(response => {
this.downloadExcel(response, '参数配置.xls'); this.downloadExcel(response, '参数配置.xls');
}) })
}, },
} }
}; };
</script> </script>