china
2023-05-11 c7bc3eb18e1fda4254ca0195e2133d2ed978de11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<template>
    <div class="app-container">
      <el-card shadow="never" class="box-card filter-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>
</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>