|
|
@@ -1,32 +1,48 @@
|
|
|
<template>
|
|
|
<div class="config-container">
|
|
|
<vab-query-form>
|
|
|
+ <vab-query-form-top-panel>
|
|
|
+ <el-form ref="queryForm" :inline="true" :model="queryForm" @submit.native.prevent>
|
|
|
+ <el-form-item label="参数名称" prop="configName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryForm.configName"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入参数名称"
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="queryData" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="参数键名" prop="configKey">
|
|
|
+ <el-input
|
|
|
+ v-model="queryForm.configKey"
|
|
|
+ clearable
|
|
|
+ placeholder="请输入参数键名"
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="queryData" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="系统内置" prop="configType">
|
|
|
+ <el-select v-model="queryForm.configType" clearable placeholder="系统内置" size="small">
|
|
|
+ <el-option v-for="dict in typeOptions.values" :key="dict.key" :label="dict.value" :value="dict.key" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" type="primary" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </vab-query-form-top-panel>
|
|
|
<vab-query-form-left-panel :span="12">
|
|
|
<el-button icon="el-icon-plus" type="primary" @click="handleEdit">添加</el-button>
|
|
|
- <el-button icon="el-icon-delete" type="danger" @click="handleDelete">批量删除</el-button>
|
|
|
+ <el-button icon="el-icon-delete" type="danger" @click="handleDelete">删除</el-button>
|
|
|
</vab-query-form-left-panel>
|
|
|
<vab-query-form-right-panel :span="12">
|
|
|
- <el-popover popper-class="custom-table-checkbox" trigger="hover">
|
|
|
- <el-checkbox-group v-model="checkList">
|
|
|
- <vab-draggable v-bind="dragOptions" :list="columns">
|
|
|
- <div v-for="(item, index) in columns" :key="item + index">
|
|
|
- <vab-icon icon="drag-drop-line" />
|
|
|
- <el-checkbox :disabled="item.disableCheck === true" :label="item.label" />
|
|
|
- </div>
|
|
|
- </vab-draggable>
|
|
|
- </el-checkbox-group>
|
|
|
- <template #reference>
|
|
|
- <el-button icon="el-icon-setting" style="margin: 0 0 10px 0 !important" type="primary">
|
|
|
- 可拖拽列设置
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
+ <table-tool :check-list.sync="checkList" :columns="columns" />
|
|
|
</vab-query-form-right-panel>
|
|
|
</vab-query-form>
|
|
|
|
|
|
<el-table
|
|
|
+ :key="uuid"
|
|
|
v-loading="listLoading"
|
|
|
- border
|
|
|
:data="list"
|
|
|
:height="$baseTableHeight(1)"
|
|
|
@selection-change="setSelectRows">
|
|
|
@@ -35,6 +51,7 @@
|
|
|
v-for="(item, index) in finallyColumns"
|
|
|
:key="index"
|
|
|
align="center"
|
|
|
+ :formatter="item.formatter"
|
|
|
:label="item.label"
|
|
|
:prop="item.prop"
|
|
|
:sortable="item.sortable"
|
|
|
@@ -60,63 +77,49 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { getList, doDelete } from '@/api/system/config'
|
|
|
+ import configApi from '@/api/system/config'
|
|
|
import Edit from './components/ConfigEdit'
|
|
|
- import VabDraggable from 'vuedraggable'
|
|
|
+ import TableTool from '@/components/table/TableTool'
|
|
|
+ import { getUUID } from '@/utils'
|
|
|
|
|
|
export default {
|
|
|
name: 'Config',
|
|
|
- components: { Edit, VabDraggable },
|
|
|
+ components: { Edit, TableTool },
|
|
|
data() {
|
|
|
return {
|
|
|
+ uuid: '',
|
|
|
checkList: [],
|
|
|
columns: [
|
|
|
{
|
|
|
prop: 'id',
|
|
|
label: '参数主键',
|
|
|
- type: 'int',
|
|
|
width: 'auto',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'config_name',
|
|
|
+ prop: 'configName',
|
|
|
label: '参数名称',
|
|
|
- type: 'varchar',
|
|
|
width: 'auto',
|
|
|
+ disableCheck: true,
|
|
|
},
|
|
|
{
|
|
|
- prop: 'config_key',
|
|
|
+ prop: 'configKey',
|
|
|
label: '参数键名',
|
|
|
- type: 'varchar',
|
|
|
width: 'auto',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'config_value',
|
|
|
+ prop: 'configValue',
|
|
|
label: '参数键值',
|
|
|
- type: 'varchar',
|
|
|
width: 'auto',
|
|
|
},
|
|
|
{
|
|
|
- prop: 'config_type',
|
|
|
+ prop: 'configType',
|
|
|
label: '系统内置',
|
|
|
- type: 'varchar',
|
|
|
width: 'auto',
|
|
|
+ formatter: this.typeFormat,
|
|
|
},
|
|
|
{
|
|
|
prop: 'remark',
|
|
|
label: '备注',
|
|
|
- type: 'text',
|
|
|
- width: 'auto',
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'created_name',
|
|
|
- label: '创建人',
|
|
|
- type: 'varchar',
|
|
|
- width: 'auto',
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'created_time',
|
|
|
- label: '创建时间',
|
|
|
- type: 'datetime',
|
|
|
width: 'auto',
|
|
|
},
|
|
|
],
|
|
|
@@ -128,28 +131,32 @@
|
|
|
queryForm: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
- title: '',
|
|
|
+ configName: '',
|
|
|
+ configKey: '',
|
|
|
+ configType: '',
|
|
|
},
|
|
|
+ typeOptions: [],
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- dragOptions() {
|
|
|
- return {
|
|
|
- animation: 600,
|
|
|
- group: 'description',
|
|
|
- }
|
|
|
- },
|
|
|
finallyColumns() {
|
|
|
return this.columns.filter((item) => this.checkList.includes(item.label))
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- for (const elem of this.columns) {
|
|
|
- this.checkList.push(elem.label)
|
|
|
- }
|
|
|
- // this.fetchData()
|
|
|
+ this.getDicts('sys_yes_no').then((response) => {
|
|
|
+ this.typeOptions = response.data.values || []
|
|
|
+ this.uuid = getUUID()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 参数系统内置字典翻译
|
|
|
+ typeFormat(row) {
|
|
|
+ return this.selectDictLabel(this.typeOptions, row.configType)
|
|
|
+ },
|
|
|
setSelectRows(val) {
|
|
|
this.selectRows = val
|
|
|
},
|
|
|
@@ -163,15 +170,15 @@
|
|
|
handleDelete(row) {
|
|
|
if (row.id) {
|
|
|
this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
- const { msg } = await doDelete({ ids: row.id })
|
|
|
+ const { msg } = await configApi.doDelete({ ids: [row.id] })
|
|
|
this.$baseMessage(msg, 'success')
|
|
|
await this.fetchData()
|
|
|
})
|
|
|
} else {
|
|
|
if (this.selectRows.length > 0) {
|
|
|
- const ids = this.selectRows.map((item) => item.id).join()
|
|
|
+ const ids = this.selectRows.map((item) => item.id)
|
|
|
this.$baseConfirm('你确定要删除选中项吗', null, async () => {
|
|
|
- const { msg } = await doDelete({ ids })
|
|
|
+ const { msg } = await configApi.doDelete({ ids })
|
|
|
this.$baseMessage(msg, 'success')
|
|
|
await this.fetchData()
|
|
|
})
|
|
|
@@ -193,9 +200,14 @@
|
|
|
this.queryForm.pageNum = 1
|
|
|
this.fetchData()
|
|
|
},
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
async fetchData() {
|
|
|
this.listLoading = true
|
|
|
- const { data } = await getList(this.queryForm)
|
|
|
+ const { data } = await configApi.getList(this.queryForm)
|
|
|
const { list, total } = data
|
|
|
this.list = list
|
|
|
this.total = total
|