diff --git a/src/views/applicationManagement/employRule/index.vue b/src/views/applicationManagement/employRule/index.vue index b949395..af86348 100644 --- a/src/views/applicationManagement/employRule/index.vue +++ b/src/views/applicationManagement/employRule/index.vue @@ -239,8 +239,10 @@ export default { key: '操作', isRedraw: true, render: (h, params) => { - return h('div', [ - // 查看详情按钮 + const buttons = [] + + // 所有状态都显示查看详情按钮 + buttons.push( h( 'el-button', { @@ -254,38 +256,45 @@ export default { on: { click: () => this.handleView(params.row) } }, '' - ), - // 编辑按钮 - h( - 'el-button', - { - props: { - type: 'text', - size: 'mini', - icon: 'el-icon-edit-outline', - title: '编辑' + ) + ) + + // 规则状态为"停用"(ruleStatus === 1)时显示编辑和删除按钮 + if (params.row.ruleStatus === 1) { + buttons.push( + h( + 'el-button', + { + props: { + type: 'text', + size: 'mini', + icon: 'el-icon-edit-outline', + title: '编辑' + }, + class: 'normal-button', + on: { click: () => this.handleEdit(params.row) } }, - class: 'normal-button', - on: { click: () => this.handleEdit(params.row) } - }, - '' - ), - // 删除按钮 - h( - 'el-button', - { - props: { - type: 'text', - size: 'mini', - style: 'color: #F56C6C', - icon: 'el-icon-delete', - title: '删除' + '' + ), + h( + 'el-button', + { + props: { + type: 'text', + size: 'mini', + style: 'color: #F56C6C', + icon: 'el-icon-delete', + title: '删除' + }, + on: { click: () => this.handleDelete(params.row) } }, - on: { click: () => this.handleDelete(params.row) } - }, - '' - ), - // 启用/停用按钮(根据当前状态显示不同图标) + '' + ) + ) + } + + // 显示启用/停用按钮(根据当前状态显示不同图标) + buttons.push( h( 'el-button', { @@ -296,13 +305,15 @@ export default { params.row.ruleStatus === 0 ? 'el-icon-remove-outline' : 'el-icon-circle-check', - title: params.row.ruleStatus === 0 ? '启用' : '停用' + title: params.row.ruleStatus === 0 ? '停用' : '启用' }, on: { click: () => this.handleToggleStatus(params.row) } }, '' ) - ]) + ) + + return h('div', buttons) } } ] @@ -470,7 +481,7 @@ export default { // 1 停用 0 启用 // 启用的数据能停用,停用的数据反之 const newStatus = row.ruleStatus === 1 ? 'enable' : 'disabled' - const statusText = row.ruleStatus === 0 ? '停用' : '启用' + const statusText = row.ruleStatus === 1 ? '启用' : '停用' this.$messageBox( () => {