| | |
| | | <el-input v-model.trim="userForm.phone" placeholder="手机号" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="是否专家" prop="identityStatus"> |
| | | <el-radio-group v-model="userForm.identityStatus"> |
| | | <el-radio :label="0">是</el-radio> |
| | | <el-radio :label="1">否</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20" v-if="userForm.identityStatus == 0"> |
| | | <el-form-item label="专家类型" prop="identityIds"> |
| | | <el-select v-model="userForm.identityIds" placeholder="专家类型" clearable class="w100" multiple> |
| | | <el-option v-for="item in expData" :key="item.id" :label="item.identity" :value="item.id"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="证件类型" prop="idType"> |
| | | <el-select v-model="userForm.idType" placeholder="证件类型" clearable class="w100"> |
| | |
| | | roleIds: Array<any> |
| | | depId: number | null; |
| | | phone: string; |
| | | identityStatus:number|null; |
| | | identityIds: Array<any> |
| | | pwd: string; |
| | | idType: number | null; |
| | | idSerial: string; |
| | |
| | | }, |
| | | departmentData: Array<DeptData>; |
| | | roleData: Array<roleData>; |
| | | expData: Array<roleData>; |
| | | isAdd:boolean |
| | | } |
| | | |
| | |
| | | roleIds: [], // 关联角色 |
| | | depId: null, // 部门 |
| | | phone: '', // 手机号 |
| | | identityStatus: null, |
| | | identityIds: [], |
| | | idType: 1, |
| | | idSerial: '', |
| | | }, |
| | |
| | | roleIds: [{ required: true, message: '请选择用户角色', trigger: 'change' }], |
| | | depId: [{ required: true, message: '请选择部门', trigger: 'change' }], |
| | | phone: [{ required: true, message: '请填写手机号', trigger: 'blur' }], |
| | | identityStatus: [{ required: true, message: '请选择是否为专家', trigger: 'change' }], |
| | | identityIds: [{ required: true, message: '请选择专家类型', trigger: 'change' }], |
| | | idType: [{ required: true, message: '请选择证件类型', trigger: 'blur' }], |
| | | pwd: [{ required: true, message: '请输入账户密码', trigger: 'blur' }], |
| | | }, |
| | | departmentData: [], // 部门数据 |
| | | roleData: [], //角色数据 |
| | | expData: [], |
| | | isAdd: true |
| | | }); |
| | | // 打开弹窗 |
| | | const openDialog = (type: string, value: any, departmentList: [], roleList: []) => { |
| | | const openDialog = (type: string, value: any, departmentList: [], roleList: [],expList: []) => { |
| | | state.isShowUserDialog = true; |
| | | state.departmentData = departmentList; |
| | | state.roleData = roleList; |
| | | state.expData = expList |
| | | if (type === '新增') { |
| | | state.title = '新增用户'; |
| | | state.isAdd = true |
| | |
| | | roleIds: [], |
| | | depId: null, |
| | | phone: '', |
| | | identityStatus: null, |
| | | identityIds: [], |
| | | idType: 1, |
| | | idSerial: '', |
| | | pwd: '' |
| | |
| | | state.isAdd = false |
| | | state.userForm = JSON.parse(JSON.stringify(value)); |
| | | state.userForm.roleIds = JSON.parse(JSON.stringify(value)).roles.map(i=>i.roleId) |
| | | state.userForm.identityIds = JSON.parse(JSON.stringify(value)).userIdentities.map(i=>i.userIdentityId) |
| | | } |
| | | }; |
| | | |
| | |
| | | }); |
| | | return |
| | | } |
| | | if(state.userForm.identityStatus == 1){ |
| | | state.userForm.identityIds = [] |
| | | } |
| | | if (state.title === '新增用户') { |
| | | let res = await userApi().addUser(state.userForm); |
| | | if (res.data.code === 100) { |
| | |
| | | }); |
| | | } |
| | | } else { |
| | | const {name, realName, roleIds, depId, phone, idType, idSerial,id } = state.userForm |
| | | const data = {name, realName, roleIds, depId, phone, idType, idSerial,id} |
| | | const {name, realName, roleIds, depId, phone, idType, idSerial, id, identityStatus, identityIds } = state.userForm |
| | | const data = {name, realName, roleIds, depId, phone, idType, idSerial,id, identityStatus, identityIds} |
| | | let res = await userApi().modUser(data); |
| | | if (res.data.code === 100) { |
| | | ElMessage({ |