fix: 修复改变用户状态提示错误以及取消显示错误

修复改变用户状态提示错误以及取消显示错误bug
This commit is contained in:
zc
2021-12-16 07:28:53 +08:00
parent be5ec40bc0
commit 858aeaecfb

View File

@@ -264,7 +264,7 @@
width="600px" width="600px"
append-to-body append-to-body
@opened="showDialog" @opened="showDialog"
@closed="cancel" @close="cancel"
> >
<el-form <el-form
ref="addForm" ref="addForm"
@@ -337,18 +337,19 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item label="状态">
v-if="dataMap.formVal.id === undefined" <el-radio-group v-model="dataMap.formVal.status">
label="用户密码" <el-radio
prop="password" v-for="dict in dataMap.statusOptions"
> :key="dict.dictValue"
<el-input :label="dict.dictValue"
v-model="dataMap.formVal.password" >
placeholder="请输入用户密码" {{ dict.dictLabel }}
type="password" </el-radio>
/> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@@ -366,21 +367,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="dataMap.formVal.status">
<el-radio
v-for="dict in dataMap.statusOptions"
:key="dict.dictValue"
:label="dict.dictValue"
>
{{ dict.dictLabel }}
</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="角色"> <el-form-item label="角色">
<el-select <el-select
@@ -399,6 +385,23 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item
v-if="dataMap.formVal.id === undefined"
label="用户密码"
prop="password"
>
<el-input
v-model="dataMap.formVal.password"
placeholder="请输入用户密码"
type="password"
/>
</el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<template #footer> <template #footer>
<div <div
@@ -604,8 +607,8 @@ function handleNodeClick(data: { [key: string]: any }) {
// 用户状态修改 // 用户状态修改
function handleStatusChange(row: { [key: string]: any }) { function handleStatusChange(row: { [key: string]: any }) {
if (dataMap.tigger) { if (dataMap.tigger) {
const text = row.status === '1' ? '启用' : '停用' const text = row.status === 1 ? '启用' : '停用'
ElMessageBox.confirm('确认要"' + text + '""' + row.username + '"用户吗?', '警告', { ElMessageBox.confirm('确认要' + text + ''+ row.username + '用户吗?', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
@@ -614,7 +617,7 @@ function handleStatusChange(row: { [key: string]: any }) {
}).then(() => { }).then(() => {
ElMessage.success(text + '成功') ElMessage.success(text + '成功')
}).catch( ()=>{ }).catch( ()=>{
row.status = row.status === '1' ? 1 : 0 row.status = row.status === 1 ? 0 : 1
}) })
} }