Commit 092ec983a3ee195662f1f5cc4f0d196bae8ac3a6
1 parent
b005e062
将前端 config 从 system 迁移到 infra 模块,并进行改名~
Showing
3 changed files
with
324 additions
and
324 deletions
ruoyi-ui/src/api/system/config.js renamed to ruoyi-ui/src/api/infra/config.js
ruoyi-ui/src/main.js
| @@ -15,7 +15,7 @@ import permission from './directive/permission' | @@ -15,7 +15,7 @@ import permission from './directive/permission' | ||
| 15 | import './assets/icons' // icon | 15 | import './assets/icons' // icon |
| 16 | import './permission' // permission control | 16 | import './permission' // permission control |
| 17 | import { getDicts } from "@/api/system/dict/data"; | 17 | import { getDicts } from "@/api/system/dict/data"; |
| 18 | -import { getConfigKey } from "@/api/system/config"; | 18 | +import { getConfigKey } from "@/api/infra/config"; |
| 19 | import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, downloadExcel } from "@/utils/ruoyi"; | 19 | import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree, downloadExcel } from "@/utils/ruoyi"; |
| 20 | import Pagination from "@/components/Pagination"; | 20 | import Pagination from "@/components/Pagination"; |
| 21 | // 自定义表格工具扩展 | 21 | // 自定义表格工具扩展 |
ruoyi-ui/src/views/system/config/index.vue renamed to ruoyi-ui/src/views/infra/config/index.vue
| 1 | -<template> | ||
| 2 | - <div class="app-container"> | ||
| 3 | - <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 4 | - <el-form-item label="参数名称" prop="name"> | ||
| 5 | - <el-input | ||
| 6 | - v-model="queryParams.name" | ||
| 7 | - placeholder="请输入参数名称" | ||
| 8 | - clearable | ||
| 9 | - size="small" | ||
| 10 | - style="width: 240px" | ||
| 11 | - @keyup.enter.native="handleQuery" | ||
| 12 | - /> | ||
| 13 | - </el-form-item> | ||
| 14 | - <el-form-item label="参数键名" prop="key"> | ||
| 15 | - <el-input | ||
| 16 | - v-model="queryParams.key" | ||
| 17 | - placeholder="请输入参数键名" | ||
| 18 | - clearable | ||
| 19 | - size="small" | ||
| 20 | - style="width: 240px" | ||
| 21 | - @keyup.enter.native="handleQuery" | ||
| 22 | - /> | ||
| 23 | - </el-form-item> | ||
| 24 | - <el-form-item label="系统内置" prop="type"> | ||
| 25 | - <el-select v-model="queryParams.type" placeholder="系统内置" clearable size="small"> | ||
| 26 | - <el-option | ||
| 27 | - v-for="dict in this.getDictDatas(DICT_TYPE.SYS_CONFIG_TYPE)" | ||
| 28 | - :key="parseInt(dict.value)" | ||
| 29 | - :label="dict.label" | ||
| 30 | - :value="parseInt(dict.value)" | ||
| 31 | - /> | ||
| 32 | - </el-select> | ||
| 33 | - </el-form-item> | ||
| 34 | - <el-form-item label="创建时间"> | ||
| 35 | - <el-date-picker | ||
| 36 | - v-model="dateRange" | ||
| 37 | - size="small" | ||
| 38 | - style="width: 240px" | ||
| 39 | - value-format="yyyy-MM-dd" | ||
| 40 | - type="daterange" | ||
| 41 | - range-separator="-" | ||
| 42 | - start-placeholder="开始日期" | ||
| 43 | - end-placeholder="结束日期" | ||
| 44 | - ></el-date-picker> | ||
| 45 | - </el-form-item> | ||
| 46 | - <el-form-item> | ||
| 47 | - <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||
| 48 | - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||
| 49 | - </el-form-item> | ||
| 50 | - </el-form> | ||
| 51 | - | ||
| 52 | - <el-row :gutter="10" class="mb8"> | ||
| 53 | - <el-col :span="1.5"> | ||
| 54 | - <el-button | ||
| 55 | - type="primary" | ||
| 56 | - icon="el-icon-plus" | ||
| 57 | - size="mini" | ||
| 58 | - @click="handleAdd" | ||
| 59 | - v-hasPermi="['system:config:add']" | ||
| 60 | - >新增</el-button> | ||
| 61 | - </el-col> | ||
| 62 | - <el-col :span="1.5"> | ||
| 63 | - <el-button | ||
| 64 | - type="warning" | ||
| 65 | - icon="el-icon-download" | ||
| 66 | - size="mini" | ||
| 67 | - @click="handleExport" | ||
| 68 | - v-hasPermi="['system:config:export']" | ||
| 69 | - >导出</el-button> | ||
| 70 | - </el-col> | ||
| 71 | - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 72 | - </el-row> | ||
| 73 | - | ||
| 74 | - <el-table v-loading="loading" :data="configList"> | ||
| 75 | - <el-table-column label="参数主键" align="center" prop="id" /> | ||
| 76 | - <el-table-column label="参数分组" align="center" prop="group" /> | ||
| 77 | - <el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" /> | ||
| 78 | - <el-table-column label="参数键名" align="center" prop="key" :show-overflow-tooltip="true" /> | ||
| 79 | - <el-table-column label="参数键值" align="center" prop="value" /> | ||
| 80 | - <el-table-column label="系统内置" align="center" prop="type"> | ||
| 81 | - <template slot-scope="scope"> | ||
| 82 | - <span>{{ getDictDataLabel(DICT_TYPE.SYS_CONFIG_TYPE, scope.row.type) }}</span> | ||
| 83 | - </template> | ||
| 84 | - </el-table-column> | ||
| 85 | - <el-table-column label="是否敏感" align="center" prop="sensitive"> | ||
| 86 | - <template slot-scope="scope"> | ||
| 87 | - <span>{{ scope.row.sensitive ? '是' : '否' }}</span> | ||
| 88 | - </template> | ||
| 89 | - </el-table-column> | ||
| 90 | - <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> | ||
| 91 | - <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 92 | - <template slot-scope="scope"> | ||
| 93 | - <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 94 | - </template> | ||
| 95 | - </el-table-column> | ||
| 96 | - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 97 | - <template slot-scope="scope"> | ||
| 98 | - <el-button | ||
| 99 | - size="mini" | ||
| 100 | - type="text" | ||
| 101 | - icon="el-icon-edit" | ||
| 102 | - @click="handleUpdate(scope.row)" | ||
| 103 | - v-hasPermi="['system:config:edit']" | ||
| 104 | - >修改</el-button> | ||
| 105 | - <el-button | ||
| 106 | - size="mini" | ||
| 107 | - type="text" | ||
| 108 | - icon="el-icon-delete" | ||
| 109 | - @click="handleDelete(scope.row)" | ||
| 110 | - v-hasPermi="['system:config:remove']" | ||
| 111 | - >删除</el-button> | ||
| 112 | - </template> | ||
| 113 | - </el-table-column> | ||
| 114 | - </el-table> | ||
| 115 | - | ||
| 116 | - <pagination | ||
| 117 | - v-show="total>0" | ||
| 118 | - :total="total" | ||
| 119 | - :page.sync="queryParams.pageNo" | ||
| 120 | - :limit.sync="queryParams.pageSize" | ||
| 121 | - @pagination="getList" | ||
| 122 | - /> | ||
| 123 | - | ||
| 124 | - <!-- 添加或修改参数配置对话框 --> | ||
| 125 | - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 126 | - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||
| 127 | - <el-form-item label="参数分组" prop="group"> | ||
| 128 | - <el-input v-model="form.group" placeholder="请输入参数分组" /> | ||
| 129 | - </el-form-item> | ||
| 130 | - <el-form-item label="参数名称" prop="name"> | ||
| 131 | - <el-input v-model="form.name" placeholder="请输入参数名称" /> | ||
| 132 | - </el-form-item> | ||
| 133 | - <el-form-item label="参数键名" prop="key"> | ||
| 134 | - <el-input v-model="form.key" placeholder="请输入参数键名" /> | ||
| 135 | - </el-form-item> | ||
| 136 | - <el-form-item label="参数键值" prop="value"> | ||
| 137 | - <el-input v-model="form.value" placeholder="请输入参数键值" /> | ||
| 138 | - </el-form-item> | ||
| 139 | - <el-form-item label="是否敏感" prop="type"> | ||
| 140 | - <el-radio-group v-model="form.sensitive"> | ||
| 141 | - <el-radio :key="true" :label="true">是</el-radio> | ||
| 142 | - <el-radio :key="false" :label="false">否</el-radio> | ||
| 143 | - </el-radio-group> | ||
| 144 | - </el-form-item> | ||
| 145 | - <el-form-item label="备注" prop="remark"> | ||
| 146 | - <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> | ||
| 147 | - </el-form-item> | ||
| 148 | - </el-form> | ||
| 149 | - <div slot="footer" class="dialog-footer"> | ||
| 150 | - <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 151 | - <el-button @click="cancel">取 消</el-button> | ||
| 152 | - </div> | ||
| 153 | - </el-dialog> | ||
| 154 | - </div> | ||
| 155 | -</template> | ||
| 156 | - | ||
| 157 | -<script> | ||
| 158 | -import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/system/config"; | ||
| 159 | - | ||
| 160 | -export default { | ||
| 161 | - name: "Config", | ||
| 162 | - data() { | ||
| 163 | - return { | ||
| 164 | - // 遮罩层 | ||
| 165 | - loading: true, | ||
| 166 | - // 显示搜索条件 | ||
| 167 | - showSearch: true, | ||
| 168 | - // 总条数 | ||
| 169 | - total: 0, | ||
| 170 | - // 参数表格数据 | ||
| 171 | - configList: [], | ||
| 172 | - // 弹出层标题 | ||
| 173 | - title: "", | ||
| 174 | - // 是否显示弹出层 | ||
| 175 | - open: false, | ||
| 176 | - // 类型数据字典 | ||
| 177 | - typeOptions: [], | ||
| 178 | - // 日期范围 | ||
| 179 | - dateRange: [], | ||
| 180 | - // 查询参数 | ||
| 181 | - queryParams: { | ||
| 182 | - pageNo: 1, | ||
| 183 | - pageSize: 10, | ||
| 184 | - name: undefined, | ||
| 185 | - key: undefined, | ||
| 186 | - type: undefined | ||
| 187 | - }, | ||
| 188 | - // 表单参数 | ||
| 189 | - form: {}, | ||
| 190 | - // 表单校验 | ||
| 191 | - rules: { | ||
| 192 | - group: [ | ||
| 193 | - { required: true, message: "参数分组不能为空", trigger: "blur" } | ||
| 194 | - ], | ||
| 195 | - name: [ | ||
| 196 | - { required: true, message: "参数名称不能为空", trigger: "blur" } | ||
| 197 | - ], | ||
| 198 | - key: [ | ||
| 199 | - { required: true, message: "参数键名不能为空", trigger: "blur" } | ||
| 200 | - ], | ||
| 201 | - value: [ | ||
| 202 | - { required: true, message: "参数键值不能为空", trigger: "blur" } | ||
| 203 | - ] | ||
| 204 | - } | ||
| 205 | - }; | ||
| 206 | - }, | ||
| 207 | - created() { | ||
| 208 | - this.getList(); | ||
| 209 | - }, | ||
| 210 | - methods: { | ||
| 211 | - /** 查询参数列表 */ | ||
| 212 | - getList() { | ||
| 213 | - this.loading = true; | ||
| 214 | - listConfig(this.addDateRange(this.queryParams, [ | ||
| 215 | - this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, | ||
| 216 | - this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, | ||
| 217 | - ])).then(response => { | ||
| 218 | - this.configList = response.data.list; | ||
| 219 | - this.total = response.data.total; | ||
| 220 | - this.loading = false; | ||
| 221 | - } | ||
| 222 | - ); | ||
| 223 | - }, | ||
| 224 | - // 参数系统内置字典翻译 | ||
| 225 | - typeFormat(row, column) { | ||
| 226 | - return this.selectDictLabel(this.typeOptions, row.type); | ||
| 227 | - }, | ||
| 228 | - // 取消按钮 | ||
| 229 | - cancel() { | ||
| 230 | - this.open = false; | ||
| 231 | - this.reset(); | ||
| 232 | - }, | ||
| 233 | - // 表单重置 | ||
| 234 | - reset() { | ||
| 235 | - this.form = { | ||
| 236 | - id: undefined, | ||
| 237 | - name: undefined, | ||
| 238 | - key: undefined, | ||
| 239 | - value: undefined, | ||
| 240 | - remark: undefined | ||
| 241 | - }; | ||
| 242 | - this.resetForm("form"); | ||
| 243 | - }, | ||
| 244 | - /** 搜索按钮操作 */ | ||
| 245 | - handleQuery() { | ||
| 246 | - this.queryParams.pageNo = 1; | ||
| 247 | - this.getList(); | ||
| 248 | - }, | ||
| 249 | - /** 重置按钮操作 */ | ||
| 250 | - resetQuery() { | ||
| 251 | - this.dateRange = []; | ||
| 252 | - this.resetForm("queryForm"); | ||
| 253 | - this.handleQuery(); | ||
| 254 | - }, | ||
| 255 | - /** 新增按钮操作 */ | ||
| 256 | - handleAdd() { | ||
| 257 | - this.reset(); | ||
| 258 | - this.open = true; | ||
| 259 | - this.title = "添加参数"; | ||
| 260 | - }, | ||
| 261 | - /** 修改按钮操作 */ | ||
| 262 | - handleUpdate(row) { | ||
| 263 | - this.reset(); | ||
| 264 | - const id = row.id || this.ids | ||
| 265 | - getConfig(id).then(response => { | ||
| 266 | - this.form = response.data; | ||
| 267 | - this.open = true; | ||
| 268 | - this.title = "修改参数"; | ||
| 269 | - }); | ||
| 270 | - }, | ||
| 271 | - /** 提交按钮 */ | ||
| 272 | - submitForm: function() { | ||
| 273 | - this.$refs["form"].validate(valid => { | ||
| 274 | - if (valid) { | ||
| 275 | - if (this.form.id !== undefined) { | ||
| 276 | - updateConfig(this.form).then(response => { | ||
| 277 | - this.msgSuccess("修改成功"); | ||
| 278 | - this.open = false; | ||
| 279 | - this.getList(); | ||
| 280 | - }); | ||
| 281 | - } else { | ||
| 282 | - addConfig(this.form).then(response => { | ||
| 283 | - this.msgSuccess("新增成功"); | ||
| 284 | - this.open = false; | ||
| 285 | - this.getList(); | ||
| 286 | - }); | ||
| 287 | - } | ||
| 288 | - } | ||
| 289 | - }); | ||
| 290 | - }, | ||
| 291 | - /** 删除按钮操作 */ | ||
| 292 | - handleDelete(row) { | ||
| 293 | - const ids = row.id || this.ids; | ||
| 294 | - this.$confirm('是否确认删除参数编号为"' + ids + '"的数据项?', "警告", { | ||
| 295 | - confirmButtonText: "确定", | ||
| 296 | - cancelButtonText: "取消", | ||
| 297 | - type: "warning" | ||
| 298 | - }).then(function() { | ||
| 299 | - return delConfig(ids); | ||
| 300 | - }).then(() => { | ||
| 301 | - this.getList(); | ||
| 302 | - this.msgSuccess("删除成功"); | ||
| 303 | - }) | ||
| 304 | - }, | ||
| 305 | - /** 导出按钮操作 */ | ||
| 306 | - handleExport() { | ||
| 307 | - const queryParams = this.addDateRange(this.queryParams, [ | ||
| 308 | - this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, | ||
| 309 | - this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, | ||
| 310 | - ]); | ||
| 311 | - this.$confirm('是否确认导出所有参数数据项?', "警告", { | ||
| 312 | - confirmButtonText: "确定", | ||
| 313 | - cancelButtonText: "取消", | ||
| 314 | - type: "warning" | ||
| 315 | - }).then(function() { | ||
| 316 | - return exportConfig(queryParams); | ||
| 317 | - }).then(response => { | ||
| 318 | - this.downloadExcel(response, '参数配置.xls'); | ||
| 319 | - }) | ||
| 320 | - }, | ||
| 321 | - } | ||
| 322 | -}; | ||
| 323 | -</script> | 1 | +<template> |
| 2 | + <div class="app-container"> | ||
| 3 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 4 | + <el-form-item label="参数名称" prop="name"> | ||
| 5 | + <el-input | ||
| 6 | + v-model="queryParams.name" | ||
| 7 | + placeholder="请输入参数名称" | ||
| 8 | + clearable | ||
| 9 | + size="small" | ||
| 10 | + style="width: 240px" | ||
| 11 | + @keyup.enter.native="handleQuery" | ||
| 12 | + /> | ||
| 13 | + </el-form-item> | ||
| 14 | + <el-form-item label="参数键名" prop="key"> | ||
| 15 | + <el-input | ||
| 16 | + v-model="queryParams.key" | ||
| 17 | + placeholder="请输入参数键名" | ||
| 18 | + clearable | ||
| 19 | + size="small" | ||
| 20 | + style="width: 240px" | ||
| 21 | + @keyup.enter.native="handleQuery" | ||
| 22 | + /> | ||
| 23 | + </el-form-item> | ||
| 24 | + <el-form-item label="系统内置" prop="type"> | ||
| 25 | + <el-select v-model="queryParams.type" placeholder="系统内置" clearable size="small"> | ||
| 26 | + <el-option | ||
| 27 | + v-for="dict in this.getDictDatas(DICT_TYPE.SYS_CONFIG_TYPE)" | ||
| 28 | + :key="parseInt(dict.value)" | ||
| 29 | + :label="dict.label" | ||
| 30 | + :value="parseInt(dict.value)" | ||
| 31 | + /> | ||
| 32 | + </el-select> | ||
| 33 | + </el-form-item> | ||
| 34 | + <el-form-item label="创建时间"> | ||
| 35 | + <el-date-picker | ||
| 36 | + v-model="dateRange" | ||
| 37 | + size="small" | ||
| 38 | + style="width: 240px" | ||
| 39 | + value-format="yyyy-MM-dd" | ||
| 40 | + type="daterange" | ||
| 41 | + range-separator="-" | ||
| 42 | + start-placeholder="开始日期" | ||
| 43 | + end-placeholder="结束日期" | ||
| 44 | + ></el-date-picker> | ||
| 45 | + </el-form-item> | ||
| 46 | + <el-form-item> | ||
| 47 | + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||
| 48 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||
| 49 | + </el-form-item> | ||
| 50 | + </el-form> | ||
| 51 | + | ||
| 52 | + <el-row :gutter="10" class="mb8"> | ||
| 53 | + <el-col :span="1.5"> | ||
| 54 | + <el-button | ||
| 55 | + type="primary" | ||
| 56 | + icon="el-icon-plus" | ||
| 57 | + size="mini" | ||
| 58 | + @click="handleAdd" | ||
| 59 | + v-hasPermi="['infra:config:add']" | ||
| 60 | + >新增</el-button> | ||
| 61 | + </el-col> | ||
| 62 | + <el-col :span="1.5"> | ||
| 63 | + <el-button | ||
| 64 | + type="warning" | ||
| 65 | + icon="el-icon-download" | ||
| 66 | + size="mini" | ||
| 67 | + @click="handleExport" | ||
| 68 | + v-hasPermi="['infra:config:export']" | ||
| 69 | + >导出</el-button> | ||
| 70 | + </el-col> | ||
| 71 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 72 | + </el-row> | ||
| 73 | + | ||
| 74 | + <el-table v-loading="loading" :data="configList"> | ||
| 75 | + <el-table-column label="参数主键" align="center" prop="id" /> | ||
| 76 | + <el-table-column label="参数分组" align="center" prop="group" /> | ||
| 77 | + <el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" /> | ||
| 78 | + <el-table-column label="参数键名" align="center" prop="key" :show-overflow-tooltip="true" /> | ||
| 79 | + <el-table-column label="参数键值" align="center" prop="value" /> | ||
| 80 | + <el-table-column label="系统内置" align="center" prop="type"> | ||
| 81 | + <template slot-scope="scope"> | ||
| 82 | + <span>{{ getDictDataLabel(DICT_TYPE.SYS_CONFIG_TYPE, scope.row.type) }}</span> | ||
| 83 | + </template> | ||
| 84 | + </el-table-column> | ||
| 85 | + <el-table-column label="是否敏感" align="center" prop="sensitive"> | ||
| 86 | + <template slot-scope="scope"> | ||
| 87 | + <span>{{ scope.row.sensitive ? '是' : '否' }}</span> | ||
| 88 | + </template> | ||
| 89 | + </el-table-column> | ||
| 90 | + <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> | ||
| 91 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | ||
| 92 | + <template slot-scope="scope"> | ||
| 93 | + <span>{{ parseTime(scope.row.createTime) }}</span> | ||
| 94 | + </template> | ||
| 95 | + </el-table-column> | ||
| 96 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 97 | + <template slot-scope="scope"> | ||
| 98 | + <el-button | ||
| 99 | + size="mini" | ||
| 100 | + type="text" | ||
| 101 | + icon="el-icon-edit" | ||
| 102 | + @click="handleUpdate(scope.row)" | ||
| 103 | + v-hasPermi="['infra:config:edit']" | ||
| 104 | + >修改</el-button> | ||
| 105 | + <el-button | ||
| 106 | + size="mini" | ||
| 107 | + type="text" | ||
| 108 | + icon="el-icon-delete" | ||
| 109 | + @click="handleDelete(scope.row)" | ||
| 110 | + v-hasPermi="['infra:config:remove']" | ||
| 111 | + >删除</el-button> | ||
| 112 | + </template> | ||
| 113 | + </el-table-column> | ||
| 114 | + </el-table> | ||
| 115 | + | ||
| 116 | + <pagination | ||
| 117 | + v-show="total>0" | ||
| 118 | + :total="total" | ||
| 119 | + :page.sync="queryParams.pageNo" | ||
| 120 | + :limit.sync="queryParams.pageSize" | ||
| 121 | + @pagination="getList" | ||
| 122 | + /> | ||
| 123 | + | ||
| 124 | + <!-- 添加或修改参数配置对话框 --> | ||
| 125 | + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | ||
| 126 | + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> | ||
| 127 | + <el-form-item label="参数分组" prop="group"> | ||
| 128 | + <el-input v-model="form.group" placeholder="请输入参数分组" /> | ||
| 129 | + </el-form-item> | ||
| 130 | + <el-form-item label="参数名称" prop="name"> | ||
| 131 | + <el-input v-model="form.name" placeholder="请输入参数名称" /> | ||
| 132 | + </el-form-item> | ||
| 133 | + <el-form-item label="参数键名" prop="key"> | ||
| 134 | + <el-input v-model="form.key" placeholder="请输入参数键名" /> | ||
| 135 | + </el-form-item> | ||
| 136 | + <el-form-item label="参数键值" prop="value"> | ||
| 137 | + <el-input v-model="form.value" placeholder="请输入参数键值" /> | ||
| 138 | + </el-form-item> | ||
| 139 | + <el-form-item label="是否敏感" prop="type"> | ||
| 140 | + <el-radio-group v-model="form.sensitive"> | ||
| 141 | + <el-radio :key="true" :label="true">是</el-radio> | ||
| 142 | + <el-radio :key="false" :label="false">否</el-radio> | ||
| 143 | + </el-radio-group> | ||
| 144 | + </el-form-item> | ||
| 145 | + <el-form-item label="备注" prop="remark"> | ||
| 146 | + <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> | ||
| 147 | + </el-form-item> | ||
| 148 | + </el-form> | ||
| 149 | + <div slot="footer" class="dialog-footer"> | ||
| 150 | + <el-button type="primary" @click="submitForm">确 定</el-button> | ||
| 151 | + <el-button @click="cancel">取 消</el-button> | ||
| 152 | + </div> | ||
| 153 | + </el-dialog> | ||
| 154 | + </div> | ||
| 155 | +</template> | ||
| 156 | + | ||
| 157 | +<script> | ||
| 158 | +import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/infra/config"; | ||
| 159 | + | ||
| 160 | +export default { | ||
| 161 | + name: "Config", | ||
| 162 | + data() { | ||
| 163 | + return { | ||
| 164 | + // 遮罩层 | ||
| 165 | + loading: true, | ||
| 166 | + // 显示搜索条件 | ||
| 167 | + showSearch: true, | ||
| 168 | + // 总条数 | ||
| 169 | + total: 0, | ||
| 170 | + // 参数表格数据 | ||
| 171 | + configList: [], | ||
| 172 | + // 弹出层标题 | ||
| 173 | + title: "", | ||
| 174 | + // 是否显示弹出层 | ||
| 175 | + open: false, | ||
| 176 | + // 类型数据字典 | ||
| 177 | + typeOptions: [], | ||
| 178 | + // 日期范围 | ||
| 179 | + dateRange: [], | ||
| 180 | + // 查询参数 | ||
| 181 | + queryParams: { | ||
| 182 | + pageNo: 1, | ||
| 183 | + pageSize: 10, | ||
| 184 | + name: undefined, | ||
| 185 | + key: undefined, | ||
| 186 | + type: undefined | ||
| 187 | + }, | ||
| 188 | + // 表单参数 | ||
| 189 | + form: {}, | ||
| 190 | + // 表单校验 | ||
| 191 | + rules: { | ||
| 192 | + group: [ | ||
| 193 | + { required: true, message: "参数分组不能为空", trigger: "blur" } | ||
| 194 | + ], | ||
| 195 | + name: [ | ||
| 196 | + { required: true, message: "参数名称不能为空", trigger: "blur" } | ||
| 197 | + ], | ||
| 198 | + key: [ | ||
| 199 | + { required: true, message: "参数键名不能为空", trigger: "blur" } | ||
| 200 | + ], | ||
| 201 | + value: [ | ||
| 202 | + { required: true, message: "参数键值不能为空", trigger: "blur" } | ||
| 203 | + ] | ||
| 204 | + } | ||
| 205 | + }; | ||
| 206 | + }, | ||
| 207 | + created() { | ||
| 208 | + this.getList(); | ||
| 209 | + }, | ||
| 210 | + methods: { | ||
| 211 | + /** 查询参数列表 */ | ||
| 212 | + getList() { | ||
| 213 | + this.loading = true; | ||
| 214 | + listConfig(this.addDateRange(this.queryParams, [ | ||
| 215 | + this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, | ||
| 216 | + this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, | ||
| 217 | + ])).then(response => { | ||
| 218 | + this.configList = response.data.list; | ||
| 219 | + this.total = response.data.total; | ||
| 220 | + this.loading = false; | ||
| 221 | + } | ||
| 222 | + ); | ||
| 223 | + }, | ||
| 224 | + // 参数系统内置字典翻译 | ||
| 225 | + typeFormat(row, column) { | ||
| 226 | + return this.selectDictLabel(this.typeOptions, row.type); | ||
| 227 | + }, | ||
| 228 | + // 取消按钮 | ||
| 229 | + cancel() { | ||
| 230 | + this.open = false; | ||
| 231 | + this.reset(); | ||
| 232 | + }, | ||
| 233 | + // 表单重置 | ||
| 234 | + reset() { | ||
| 235 | + this.form = { | ||
| 236 | + id: undefined, | ||
| 237 | + name: undefined, | ||
| 238 | + key: undefined, | ||
| 239 | + value: undefined, | ||
| 240 | + remark: undefined | ||
| 241 | + }; | ||
| 242 | + this.resetForm("form"); | ||
| 243 | + }, | ||
| 244 | + /** 搜索按钮操作 */ | ||
| 245 | + handleQuery() { | ||
| 246 | + this.queryParams.pageNo = 1; | ||
| 247 | + this.getList(); | ||
| 248 | + }, | ||
| 249 | + /** 重置按钮操作 */ | ||
| 250 | + resetQuery() { | ||
| 251 | + this.dateRange = []; | ||
| 252 | + this.resetForm("queryForm"); | ||
| 253 | + this.handleQuery(); | ||
| 254 | + }, | ||
| 255 | + /** 新增按钮操作 */ | ||
| 256 | + handleAdd() { | ||
| 257 | + this.reset(); | ||
| 258 | + this.open = true; | ||
| 259 | + this.title = "添加参数"; | ||
| 260 | + }, | ||
| 261 | + /** 修改按钮操作 */ | ||
| 262 | + handleUpdate(row) { | ||
| 263 | + this.reset(); | ||
| 264 | + const id = row.id || this.ids | ||
| 265 | + getConfig(id).then(response => { | ||
| 266 | + this.form = response.data; | ||
| 267 | + this.open = true; | ||
| 268 | + this.title = "修改参数"; | ||
| 269 | + }); | ||
| 270 | + }, | ||
| 271 | + /** 提交按钮 */ | ||
| 272 | + submitForm: function() { | ||
| 273 | + this.$refs["form"].validate(valid => { | ||
| 274 | + if (valid) { | ||
| 275 | + if (this.form.id !== undefined) { | ||
| 276 | + updateConfig(this.form).then(response => { | ||
| 277 | + this.msgSuccess("修改成功"); | ||
| 278 | + this.open = false; | ||
| 279 | + this.getList(); | ||
| 280 | + }); | ||
| 281 | + } else { | ||
| 282 | + addConfig(this.form).then(response => { | ||
| 283 | + this.msgSuccess("新增成功"); | ||
| 284 | + this.open = false; | ||
| 285 | + this.getList(); | ||
| 286 | + }); | ||
| 287 | + } | ||
| 288 | + } | ||
| 289 | + }); | ||
| 290 | + }, | ||
| 291 | + /** 删除按钮操作 */ | ||
| 292 | + handleDelete(row) { | ||
| 293 | + const ids = row.id || this.ids; | ||
| 294 | + this.$confirm('是否确认删除参数编号为"' + ids + '"的数据项?', "警告", { | ||
| 295 | + confirmButtonText: "确定", | ||
| 296 | + cancelButtonText: "取消", | ||
| 297 | + type: "warning" | ||
| 298 | + }).then(function() { | ||
| 299 | + return delConfig(ids); | ||
| 300 | + }).then(() => { | ||
| 301 | + this.getList(); | ||
| 302 | + this.msgSuccess("删除成功"); | ||
| 303 | + }) | ||
| 304 | + }, | ||
| 305 | + /** 导出按钮操作 */ | ||
| 306 | + handleExport() { | ||
| 307 | + const queryParams = this.addDateRange(this.queryParams, [ | ||
| 308 | + this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined, | ||
| 309 | + this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined, | ||
| 310 | + ]); | ||
| 311 | + this.$confirm('是否确认导出所有参数数据项?', "警告", { | ||
| 312 | + confirmButtonText: "确定", | ||
| 313 | + cancelButtonText: "取消", | ||
| 314 | + type: "warning" | ||
| 315 | + }).then(function() { | ||
| 316 | + return exportConfig(queryParams); | ||
| 317 | + }).then(response => { | ||
| 318 | + this.downloadExcel(response, '参数配置.xls'); | ||
| 319 | + }) | ||
| 320 | + }, | ||
| 321 | + } | ||
| 322 | +}; | ||
| 323 | +</script> |