| | |
| | | </el-select> |
| | | <el-input v-else disabled style="width: 100%" v-model="state.form.companyName"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属部门:" prop="departId" v-if="state.form.userType !=0" > |
| | | <el-form-item label="所属部门:" prop="departId" v-if="state.form.userType !=0 && state.title !== '修改密码'" > |
| | | <el-cascader |
| | | v-if="(state.currentUserType == 1 ||state.currentUserType == 0) && (state.title == '新增用户' || state.title == '编辑用户')" |
| | | v-if="state.title == '新增用户' || state.title == '编辑用户'" |
| | | style="width: 100%" |
| | | ref="classifyRef" |
| | | v-model="state.form.departId" |
| | |
| | | const userInfo = ref() |
| | | const classifyRef = ref(null) |
| | | const openDialog = async (type, value) => { |
| | | |
| | | userInfo.value = JSON.parse(Cookies.get('userInfo')) |
| | | console.log("userInfo",userInfo.value) |
| | | state.currentUserType = userInfo.value.userType |
| | |
| | | state.form.companyName = userInfo.value.companyName; |
| | | state.form.userType = 2 |
| | | } |
| | | if(userInfo.value.userType != 0 || (userInfo.value.userType ==0 && (type =='edit' || state.title =='查看用户'))){ |
| | | |
| | | state.title = type === 'add' ? '新增用户' : type ==='edit' ? '编辑用户' : type ==='pwd' ? '修改密码' : '查看用户' ; |
| | | if(state.title !== '修改密码' && (userInfo.value.userType != 0 || (userInfo.value.userType ==0 && (type =='edit' || state.title =='查看用户')))){ |
| | | await getDeptList() |
| | | } |
| | | state.title = type === 'add' ? '新增用户' : type ==='edit' ? '编辑用户' : type ==='pwd' ? '修改密码' : '查看用户' ; |
| | | if(type === 'edit' || type === 'view') { |
| | | startUsername.value = value.username |
| | | if( type === 'view'){ |
| | |
| | | if(type === 'edit' && state.isAdmin){ |
| | | await getCompanyList("") |
| | | } |
| | | state.form = value |
| | | |
| | | state.form = JSON.parse(JSON.stringify(value)); |
| | | } |
| | | if(type == 'pwd'){ |
| | | state.form.id = value.id |
| | |
| | | data.password = Base64.encode(data.password) |
| | | const res = await editUser(data) |
| | | if(res.code == 200){ |
| | | |
| | | // Cookies.set('userInfo',JSON.stringify(data)) |
| | | ElMessage.success(res.message) |
| | | emit('getList') |
| | | handleClose() |