添加用户的冻结功能

This commit is contained in:
king
2022-06-21 22:18:06 +08:00
parent 6321564bed
commit 1e6dfbff96
5 changed files with 51 additions and 3 deletions
+36
View File
@@ -33,6 +33,17 @@
/>
</template>
</el-table-column>
<el-table-column align="left" label="启用" min-width="150">
<template #default="scope">
<el-switch
v-model="scope.row.enable"
inline-prompt
:active-value="1"
:inactive-value="2"
@change="()=>{switchEnable(scope.row)}"
/>
</template>
</el-table-column>
<el-table-column label="操作" min-width="250" fixed="right">
<template #default="scope">
@@ -99,6 +110,14 @@
:clearable="false"
/>
</el-form-item>
<el-form-item label="启用" prop="disabled">
<el-switch
v-model="userInfo.enable"
inline-prompt
:active-value="1"
:inactive-value="2"
/>
</el-form-item>
<el-form-item label="头像" label-width="80px">
<div style="display:inline-block" @click="openHeaderChange">
<img v-if="userInfo.headerImg" class="header-img-box" :src="(userInfo.headerImg && userInfo.headerImg.slice(0, 4) !== 'http')?path+userInfo.headerImg:userInfo.headerImg">
@@ -268,6 +287,7 @@ const userInfo = ref({
headerImg: '',
authorityId: '',
authorityIds: [],
enable: 1,
})
const rules = ref({
@@ -349,6 +369,22 @@ const openEdit = (row) => {
addUserDialog.value = true
}
const switchEnable = async(row) => {
userInfo.value = JSON.parse(JSON.stringify(row))
await nextTick()
const req = {
...userInfo.value
}
const res = await setUserInfo(req)
if (res.code === 0) {
ElMessage({ type: 'success', message: '编辑成功' })
await getTableData()
userInfo.value.headerImg = ''
userInfo.value.authorityIds = []
}
}
</script>
<style lang="scss">