Commit 501789fd by ningjihai

启用禁用

parent 557a88b0
......@@ -120,3 +120,11 @@ export function remove(data) {
data: data
})
}
export function disableOrEnable(data) {
return request({
url: '/core/desensitizationStrategy/disableOrEnable',
method: 'post',
data: data
})
}
......@@ -11,7 +11,8 @@ import StrategyAddDialog from './modules/StrategyAddDialog.vue' // 统一对话
import {
getTableList,
queryAll,
remove
remove,
disableOrEnable
} from '@/api/desensitizationStrategy'
const appStore = useAppStore()
......@@ -174,7 +175,8 @@ const deleteStrategy = (row) => {
* 启用/禁用策略
*/
const toggleStatus = (row) => {
const newStatus = row.status === '1' ? '0' : '1'
const newStatus = row.state === '1' ? '0' : '1'
const action = newStatus === '1' ? '启用' : '禁用'
ElMessageBox.confirm(
......@@ -186,18 +188,24 @@ const toggleStatus = (row) => {
type: 'warning'
}
).then(() => {
// 调用启用/禁用API
// changeStrategyStatus(row.id, newStatus).then(res => {
// if (res.flag) {
// ElMessage.success(`${action}成功`)
// getList() // 刷新列表
// } else {
// ElMessage.error(res.msg)
// }
// }).catch(err => {
// ElMessage.error(`${action}失败`)
// })
ElMessage.info(`${action}功能待实现`)
disableOrEnable({
projectid: sessionStorage.getItem('projectId'),
state:row.state === '1' ? '0' : '1',
strategyId:row.strategyId
}).then(res => {
if(res.flag){
ElMessage({
type: 'success',
message: `${action}成功`
})
handleQuery()
}
})
}).catch(() => {
// 用户取消操作
})
......@@ -242,8 +250,8 @@ const toggleStatus = (row) => {
<el-table-column prop="createuser" label="创建人" width="120" />
<el-table-column prop="statezh" label="状态" width="100" align="center">
<template #default="{ row }">
<el-tag :type="row.status === '1' ? 'success' : 'info'">
{{ row.status === '1' ? '已启用' : '未启用' }}
<el-tag :type="row.state === '1' ? 'success' : 'info'">
{{ row.state === '1' ? '已启用' : '未启用' }}
</el-tag>
</template>
</el-table-column>
......@@ -256,7 +264,7 @@ const toggleStatus = (row) => {
<el-button link type="danger" size="small" @click="deleteStrategy(row)">删除</el-button>
<el-divider direction="vertical" />
<el-button link type="success" size="small" @click="toggleStatus(row)">
{{ row.status === '1' ? '禁用' : '启用' }}
{{ row.state === '1' ? '禁用' : '启用' }}
</el-button>
</template>
</el-table-column>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论