| | |
| | | <el-radio :label="0" v-if="state.currentUserType == 0">系统管理员</el-radio> |
| | | <el-radio :label="6" v-if="state.currentUserType == 0 || state.currentUserType == 6 ">企业管理员</el-radio> |
| | | <el-radio :label="1" v-if="state.currentUserType == 0 || state.currentUserType == 6 || state.currentUserType ==1">企业用户</el-radio> |
| | | <el-radio :label="2" v-if="state.currentUserType !== 3">部门级</el-radio> |
| | | <el-radio :label="3">车间(岗位)级</el-radio> |
| | | <!-- <el-radio :label="2" v-if="state.currentUserType !== 3">部门级</el-radio>--> |
| | | <!-- <el-radio :label="3">车间(岗位)级</el-radio>--> |
| | | <!-- <el-radio :label="4" v-if="state.currentUserType == 0">其他</el-radio>--> |
| | | </el-radio-group> |
| | | <span v-else>{{state.currentUserType === 0 ? '系统管理员' : state.currentUserType === 1 ? '企业用户' : state.currentUserType === 6 ? '企业管理员' : state.currentUserType === 2 ? '部门级' : state.currentUserType === 3 ? '车间级' :'其他'}}</span> |
| | |
| | | <!-- <el-radio :label="4" >其他</el-radio>--> |
| | | <!-- </el-radio-group>--> |
| | | </el-form-item> |
| | | <el-form-item label="所属企业:" prop="companyName" v-if="state.title !== '修改密码' && showCompany"> |
| | | <el-form-item label="所属企业:" prop="companyName" v-if="state.title !== '修改密码' && state.form.userType !== 0"> |
| | | <el-select |
| | | clearable |
| | | v-if="state.isAdmin" |
| | | v-model="state.form.companyName" |
| | | filterable |
| | | :disabled="disabled || state.title =='编辑'" |
| | | :disabled="disabled || (state.title =='编辑' && state.currentUserType !== 0)" |
| | | remote |
| | | @change="selectValue" |
| | | reserve-keyword |
| | |
| | | |
| | | |
| | | </el-form-item> |
| | | <el-form-item label="所属上级账号:" prop="companyName" v-if="showChild"> |
| | | <scorllSelect |
| | | :disabled="disabled || state.title =='编辑'" |
| | | ref="scrollRef" |
| | | v-model="state.form.parentName" |
| | | @getval = "getSelectUser" |
| | | placeholder="请选择" |
| | | clearable |
| | | style="width: 45%;" |
| | | filterable |
| | | remote |
| | | searchKey="username" |
| | | :methods="getUser"> |
| | | </scorllSelect> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="所属上级账号:" prop="companyName" v-if="state.form.userType == 3">--> |
| | | <!-- <scorllSelect--> |
| | | <!-- :disabled="disabled"--> |
| | | <!-- ref="scrollRef"--> |
| | | <!-- v-model="state.form.parentName"--> |
| | | <!-- @getval = "getSelectUser"--> |
| | | <!-- placeholder="请选择"--> |
| | | <!-- clearable--> |
| | | <!-- style="width: 45%;"--> |
| | | <!-- filterable--> |
| | | <!-- remote--> |
| | | <!-- searchKey="username"--> |
| | | <!-- :methods="getUser">--> |
| | | <!-- </scorllSelect>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="部门:" prop="deptId" v-if="state.title !== '修改密码' && state.form.userType !== 0"> |
| | | <el-select |
| | | clearable |
| | |
| | | :disabled="disabled" |
| | | placeholder="请选择部门" |
| | | style="width: 100%" |
| | | @change="getParentId" |
| | | > |
| | | <el-option |
| | | v-for="item in state.deptList" |
| | |
| | | import {getDepart} from "@/api/orgStructure/depart"; |
| | | const emit = defineEmits(["getList"]); |
| | | const dialogVisible = ref(false) |
| | | const superRef = ref(null) |
| | | const superRef = ref() |
| | | const scrollRef = ref(null) |
| | | |
| | | |
| | |
| | | username: [{ required: true, message: '请选择用户名', trigger: 'blur' }], |
| | | password: [{ required: true, validator: validatePwd, trigger: 'blur' }], |
| | | confirmPassword: [{ required: true, validator: equalToPassword, trigger: 'blur' }], |
| | | // phone: [{ validator: validateUserPhone, trigger: 'blur' }], |
| | | phone: [{ validator: validateUserPhone, trigger: 'blur' }], |
| | | userType: [{ required: true, message: '请选择用户类型', trigger: 'blur' }], |
| | | // idCard: [{ validator: verifyId, trigger: 'blur' }], |
| | | entryTime: [{ required: true, message: '请选择入职时间', trigger: 'blur' }], |
| | |
| | | UisMounted.value = true; |
| | | |
| | | }); |
| | | const showCompany = ref(false) |
| | | const showChild = ref(false) |
| | | const disabled = ref(false); |
| | | const userInfo = ref() |
| | | const openDialog = async (type, value, companyId) => { |
| | | userInfo.value = JSON.parse(Cookies.get('userInfo')) |
| | | await getCompanyList() |
| | | state.currentUserType = userInfo.value.userType |
| | | if(state.currentUserType === 0){ |
| | | state.isAdmin = true; |
| | | state.form.companyId = companyId; |
| | | state.form.companyId = null; |
| | | }else { |
| | | state.isAdmin = false; |
| | | state.form.companyId = userInfo.value.companyId; |
| | |
| | | const res = await getUserById(value.id); |
| | | if(res.code === 200){ |
| | | state.form = res.data |
| | | if(res.data.userType === 3){ |
| | | showCompany.value = true; |
| | | showChild.value = true |
| | | }else if(res.data.userType === 2 || res.data.userType === 1 || res.data.userType === 4){ |
| | | showCompany.value = true; |
| | | showChild.value = false; |
| | | } |
| | | if(res.data.userType === 3){ |
| | | if(!res.data.parentId){ |
| | | state.form.parentId = '' |
| | | state.form.parentName = '无上级账号' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(type == 'pwd'){ |
| | |
| | | const finshed = ref(false) |
| | | const loading = ref(false) |
| | | |
| | | const getCompanyList = async (val)=>{ |
| | | if(val != ""){ |
| | | loading.value = true; |
| | | const queryParams = { |
| | | name: val |
| | | } |
| | | const res = await getCompany(queryParams) |
| | | if (res.code == 200) { |
| | | loading.value = false; |
| | | state.companyList = res.data.list |
| | | |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }else { |
| | | loading.value = true; |
| | | const queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | } |
| | | const res = await getCompany(queryParams) |
| | | if (res.code == 200) { |
| | | loading.value = false; |
| | | state.companyList = res.data.list |
| | | |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | const getCompanyList = async ()=>{ |
| | | const queryParams = { |
| | | pageNum: 1, |
| | | pageSize: 999 |
| | | } |
| | | |
| | | // if (type === 'open' && state.pageNum !== 1) { |
| | | // } else { |
| | | // const queryParams = { |
| | | // pageNum: state.pageNum, |
| | | // pageSize: state.pageSize, |
| | | // } |
| | | // const res = await getCompany(queryParams) |
| | | // if (res.code == 200) { |
| | | // if (res.data.pageNum === state.pageNum) { |
| | | // finshed.value = false; |
| | | // if (state.pageNum == 1) { |
| | | // state.companyList = res.data.list |
| | | // } else { |
| | | // state.companyList = state.companyList.concat(res.data.list) |
| | | // } |
| | | // } else { |
| | | // finshed.value = true; |
| | | // } |
| | | // |
| | | // } else { |
| | | // ElMessage.warning(res.message) |
| | | // } |
| | | // console.log("state.companyList",state.companyList) |
| | | // } |
| | | const res = await getCompany(queryParams) |
| | | if (res.code == 200) { |
| | | state.companyList = res.data.list?res.data.list:[] |
| | | // data.queryParams.companyId = data.companyList[0].id |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const getdeptList = async (companyId)=> { |
| | |
| | | scrollRef.value.getList(param,'change'); |
| | | } |
| | | const changeType = async (val) => { |
| | | state.companyList = []; |
| | | if(state.isAdmin && val !=0){ |
| | | await getCompanyList("") |
| | | } |
| | | state.form.parentId = null; |
| | | state.form.parentName = ''; |
| | | state.form.companyId = null; |
| | | state.form.companyName = ''; |
| | | // state.companyList = []; |
| | | // if(state.isAdmin){ |
| | | // await getCompanyList("") |
| | | // } |
| | | // state.form.parentId = null; |
| | | // state.form.parentName = ''; |
| | | // state.form.companyId = null; |
| | | // state.form.companyName = ''; |
| | | //当前是管理员级用户 |
| | | console.log(state.currentUserType,'type') |
| | | if(state.currentUserType === 0){ |
| | | |
| | | if(state.form.userType === 0){ |
| | | showCompany.value = false; |
| | | showChild.value = false; |
| | | }else { |
| | | showCompany.value = true; |
| | | if(state.form.userType === 3){ |
| | | showChild.value = true |
| | | }else{ |
| | | showChild.value = false; |
| | | } |
| | | |
| | | state.form.deptId = null; |
| | | state.form.parentId = null; |
| | | state.form.companyId = null; |
| | | state.form.companyName = ''; |
| | | state.form.duty = '' |
| | | state.form.post = '' |
| | | } |
| | | }else{ |
| | | state.form.companyId = userInfo.value.companyId; |
| | | state.form.companyName = userInfo.value.companyName |
| | | showCompany.value = true |
| | | } |
| | | |
| | | //当前是企业级/其他用户选择部门 |
| | | if((state.currentUserType === 1 && state.form.userType === 2) || (state.currentUserType === 4 && state.form.userType === 2) || (state.currentUserType === 6 && state.form.userType === 2)){ |
| | | state.form.parentId = userInfo.value.id; |
| | | state.form.companyName = userInfo.value.companyName |
| | | state.form.companyId = userInfo.value.companyId; |
| | | showChild.value = false; |
| | | // showCompany.value = true; |
| | | |
| | | } else if((state.currentUserType === 1 && state.form.userType === 3) || (state.currentUserType === 4 && state.form.userType === 3)|| (state.currentUserType === 6 && state.form.userType === 3)){ |
| | | state.form.companyName = userInfo.value.companyName |
| | | state.form.companyId = userInfo.value.companyId; |
| | | // showCompany.value = true; |
| | | showChild.value = true; |
| | | const param = { |
| | | userType: 2, |
| | | companyId: state.form.companyId, |
| | | } |
| | | nextTick(() => { |
| | | scrollRef.value.getList(param,'change'); |
| | | }) |
| | | } |
| | | //当前是部门级选择车间 |
| | | if((state.currentUserType === 2 && state.form.userType === 3)){ |
| | | state.form.parentId = userInfo.value.id; |
| | | state.form.companyName = userInfo.value.companyName |
| | | state.form.companyId = userInfo.value.companyId; |
| | | // showCompany.value = true; |
| | | showChild.value = false; |
| | | } |
| | | // if((state.currentUserType === 1 && state.form.userType === 2) || (state.currentUserType === 4 && state.form.userType === 2) || (state.currentUserType === 6 && state.form.userType === 2)){ |
| | | // state.form.parentId = userInfo.value.id; |
| | | // state.form.companyName = userInfo.value.companyName |
| | | // state.form.companyId = userInfo.value.companyId; |
| | | // showChild.value = false; |
| | | // // showCompany.value = true; |
| | | // |
| | | // } else if((state.currentUserType === 1 && state.form.userType === 3) || (state.currentUserType === 4 && state.form.userType === 3)|| (state.currentUserType === 6 && state.form.userType === 3)){ |
| | | // state.form.companyName = userInfo.value.companyName |
| | | // state.form.companyId = userInfo.value.companyId; |
| | | // // showCompany.value = true; |
| | | // showChild.value = true; |
| | | // const param = { |
| | | // userType: 2, |
| | | // companyId: state.form.companyId, |
| | | // } |
| | | // nextTick(() => { |
| | | // scrollRef.value.getList(param,'change'); |
| | | // }) |
| | | // } |
| | | // //当前是部门级选择车间 |
| | | // if((state.currentUserType === 2 && state.form.userType === 3)){ |
| | | // state.form.parentId = userInfo.value.id; |
| | | // state.form.companyName = userInfo.value.companyName |
| | | // state.form.companyId = userInfo.value.companyId; |
| | | // // showCompany.value = true; |
| | | // showChild.value = false; |
| | | // } |
| | | } |
| | | |
| | | const handleClose = () => { |
| | |
| | | personType: null, |
| | | positional: '' |
| | | } |
| | | showCompany.value = false; |
| | | showChild.value = false; |
| | | state.userList = []; |
| | | state.companyList = []; |
| | | state.pageNum = 1; |
| | |
| | | |
| | | const selectValue = (val) => { |
| | | state.form.parentId = null; |
| | | state.form.parentName = null; |
| | | state.companyList.forEach(item => { |
| | | if(item.name === val){ |
| | | state.form.companyId = item.id |
| | |
| | | }) |
| | | getdeptList(state.form.companyId) |
| | | } |
| | | |
| | | const getParentId = (val)=>{ |
| | | state.form.parentId = null; |
| | | state.deptList.forEach(item => { |
| | | if(item.deptId === val){ |
| | | state.form.deptId = item.deptId |
| | | state.form.parentId = item.parentId |
| | | } |
| | | }) |
| | | } |
| | | const getSelectUser = (val) => { |
| | | console.log("valllllllll",val) |
| | | state.form.parentId = val; |