|
|
@@ -0,0 +1,278 @@
|
|
|
+<template>
|
|
|
+ <div class="ele-body">
|
|
|
+ <el-card shadow="never">
|
|
|
+ <!-- 搜索表单 -->
|
|
|
+ <search @search="reload"/>
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ :selection.sync="selection"
|
|
|
+ height="calc(100vh - 385px)"
|
|
|
+ row-key="id"
|
|
|
+ cache-key="systemUserTable"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="openEdit('add')"
|
|
|
+ v-if="$hasPermission('sys:parameter:save')"
|
|
|
+ >
|
|
|
+ 新建
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="removeBatch"
|
|
|
+ v-if="$hasPermission('sys:parameter:delete')"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ <!-- <el-button
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-upload2"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="openImport"
|
|
|
+ >
|
|
|
+ 导入
|
|
|
+ </el-button> -->
|
|
|
+ </template>
|
|
|
+ <!-- 用户名列 -->
|
|
|
+ <!-- <template v-slot:nickname="{ row }">
|
|
|
+ <router-link :to="'/system/user/details?id=' + row.userId">
|
|
|
+ {{ row.nickname }}
|
|
|
+ </router-link>
|
|
|
+ </template> -->
|
|
|
+ <!-- 角色列 -->
|
|
|
+ <template v-slot:roleList="{ row }">
|
|
|
+ <el-tag
|
|
|
+ v-for="item in row.roleList"
|
|
|
+ :key="item.id"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ :disable-transitions="true"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ <!-- 状态列 -->
|
|
|
+ <template v-slot:enable="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-if="$hasPermission('sys:parameter:update')"
|
|
|
+ v-model="row.enable"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ :active-value="0"
|
|
|
+ :inactive-value="1"
|
|
|
+ @change="changeEnable(row)"
|
|
|
+ >
|
|
|
+ </el-switch>
|
|
|
+ <span v-else>{{ row.enable ? '开启' : '停用' }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 操作列 -->
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="openEdit('edit',row.id)"
|
|
|
+ >
|
|
|
+ 修改
|
|
|
+ </el-link>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="openEdit('view',row.id)"
|
|
|
+ >
|
|
|
+ 详情
|
|
|
+ </el-link>
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除吗?"
|
|
|
+ @confirm="remove(row)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-card>
|
|
|
+ <add-or-edit-dialog v-if="addOrEditDialogFlag" :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
|
|
|
+ ref="addOrEditDialogRef" @reload="reload"></add-or-edit-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+
|
|
|
+import {parameterPageList, removeParameterAPI, updateParameterAPI} from "@/api/system/parmasManage";
|
|
|
+import addOrEditDialog from './addOrEditDialog.vue'
|
|
|
+import search from './search.vue'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ components: {
|
|
|
+ addOrEditDialog,
|
|
|
+ search
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 表格列配置
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left',
|
|
|
+ label: '序号'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'moduleName',
|
|
|
+ label: '模块名称',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '名称',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'value',
|
|
|
+ label: '参数值',
|
|
|
+ // sortable: 'custom',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'enable',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ // sortable: 'custom',
|
|
|
+ width: 80,
|
|
|
+ resizable: false,
|
|
|
+ slot: 'enable',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 280,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 表格选中数据
|
|
|
+ selection: [],
|
|
|
+ addOrEditDialogFlag: null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({page, limit, where, order}) {
|
|
|
+ return parameterPageList({...where, ...order, pageNum: page, size: limit});
|
|
|
+ },
|
|
|
+
|
|
|
+ async changeEnable(row) {
|
|
|
+ let params = {...row};
|
|
|
+ const res = await updateParameterAPI(params);
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '修改成功',
|
|
|
+ customClass: 'ele-message-border'
|
|
|
+ });
|
|
|
+ //this.reload();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({page: 1, where: where});
|
|
|
+ },
|
|
|
+ /* 打开编辑弹窗 */
|
|
|
+ openEdit(type, id) {
|
|
|
+ this.addOrEditDialogFlag = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addOrEditDialogRef.init(type, id)
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ /* 删除 */
|
|
|
+ async remove(row) {
|
|
|
+ await removeParameterAPI([row.id])
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
+ /* 批量删除 */
|
|
|
+ removeBatch() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message.error('请至少选择一条数据');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$confirm('确定要删除选中的数据吗?', '提示', {
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const loading = this.$loading({lock: true});
|
|
|
+ removeParameterAPI(this.selection.map((d) => d.id))
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.reload();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|