<template>
|
<div class="app-main">
|
<div class="base-container">
|
<el-card shadow="never" class="box-card">
|
<!--搜索条件-->
|
<div class="filter-container">
|
<el-form :inline="true" :model="filterFrom" size="small">
|
<el-form-item label="参数名称">
|
<el-input v-model="filterFrom.configName" placeholder="请输入'参数名称'" clearable />
|
</el-form-item>
|
<el-form-item label="参数标识">
|
<el-input v-model="filterFrom.configKey" placeholder="请输入'参数KEY'" clearable />
|
</el-form-item>
|
<!-- <el-form-item label="发起时间">-->
|
<!-- <el-date-picker v-model="filterFrom.startTime" type="date" placeholder="选择开始日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 177px" />-->
|
<!-- - <el-date-picker v-model="filterFrom.finishTime" style="width: 177px" type="date" placeholder="选择结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />-->
|
<!-- </el-form-item>-->
|
<el-form-item label="系统内置">
|
<el-select v-model="filterFrom.configType" placeholder="系统内置" clearable>
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<my-button-v2 site="filter" name="搜索" @click="search(1)" />
|
<my-button-v2 site="filter" name="重置" @click="reset()" />
|
</el-form-item>
|
</el-form>
|
</div>
|
</el-card>
|
<!--列表-->
|
<my-table-v3 ref="myTable" :filter="filterFrom" :table="table" />
|
<!--添加/编辑弹窗-->
|
<edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show=false" @search="search" />
|
</div>
|
|
</div>
|
</template>
|
|
<script>
|
import {listConfig, refreshCache} from "@/api/system/config";
|
import myTableV3 from '@/views/components/myTableV3';
|
import myButtonV2 from '@/views/components/myButtonV2'
|
import edit from './edit'
|
|
export default {
|
components: {myTableV3, myButtonV2, edit},
|
name: "Config",
|
dicts: ['sys_yes_no'],
|
data() {
|
return {
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 日期范围
|
dateRange: [],
|
// 表单参数
|
// form: {},
|
// 表单校验
|
|
/** 搜索条件*/
|
filterFrom: {
|
configName: null,
|
configKey: null,
|
configType: null
|
},
|
|
table: {
|
showIndex: true, // 是否显示序号
|
expand: false, // 是否显示详情数据
|
checkBox: false, // 是否显示复选框
|
url: globalConf.baseUrl + '/system/config/list', // 请求地址
|
// 工具条
|
tools: {
|
columnsCtrl: {// 列控制按钮
|
show: true
|
},
|
generalExport: {// 通用导出按钮
|
show: false
|
},
|
custom: [ // 自定义工具条按钮
|
{
|
name: '刷新缓存',
|
checkPermission: 'system:config:remove',
|
myType: 'danger',
|
mySize: 'mini',
|
click: ()=> {
|
this.handleRefreshCache();
|
}
|
},
|
{
|
name: '导出参数',
|
click: ()=> {
|
|
}
|
}
|
]
|
},
|
columns: [
|
{ title: 'KEY', field: 'config_key', align: 'left', width: 190 },
|
{ title: 'VALUE', field: 'config_value', align: 'left', width: 200 },
|
{ title: '描述', field: 'config_name', align: 'left', width: 240 },
|
{ title: '内置', field: 'config_type', align: 'left', width: 60, formatter: row => {
|
let title = '';
|
switch (row.config_type) {
|
case 'Y':
|
title = '是'
|
break
|
case 'N':
|
title = '否'
|
break
|
}
|
return { value: title, type: 'primary' }
|
}
|
},
|
{ title: '创建时间', field: 'create_time', align: 'left', width: 170 },
|
{ title: '备注', field: 'remark', align: 'left', width: 260 }
|
],
|
// 操作信息
|
operation: {
|
show: true, // 显示操作列
|
width: '100', // 列宽
|
attr: [
|
{
|
title: '编辑',
|
checkPermission: 'system:config:edit',
|
events: row => {
|
this.handleUpdate(row)
|
}
|
}
|
]
|
},
|
paging: {
|
show: true, // 显示分页
|
// 分页信息
|
page: {
|
small: false,
|
pageNum: 1,
|
pageSize: platformPageSize,
|
total: 0
|
}
|
}
|
},
|
|
// 添加&编辑窗口
|
editSetting: {
|
id: null,
|
title: '',
|
show: false
|
}
|
};
|
},
|
|
created() {
|
// this.getList();
|
// console.log(dict);
|
},
|
methods: {
|
// 查询table列表
|
search(pageNum) {
|
if (pageNum != undefined) {
|
this.$refs.myTable.search({ pageNum: pageNum })
|
} else {
|
this.$refs.myTable.search()
|
}
|
},
|
// 表单重置
|
reset() {
|
this.filterFrom = {
|
configName: null,
|
configKey: null,
|
configType: null
|
}
|
this.search(1)
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "添加参数";
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.configId)
|
this.single = selection.length!=1
|
this.multiple = !selection.length
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.editSetting.id = row.config_id
|
this.editSetting.title = "编辑参数"
|
this.editSetting.show = true
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('system/config/export', {
|
...this.queryParams
|
}, `config_${new Date().getTime()}.xlsx`)
|
},
|
/** 刷新缓存按钮操作 */
|
handleRefreshCache() {
|
this.$confirm('确认刷新缓存?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(()=> {
|
refreshCache().then(() => {
|
this.$modal.msgSuccess("刷新成功");
|
});
|
})
|
}
|
}
|
};
|
</script>
|