zhouwx
2024-08-21 48d5ab35c3fcdc6edca1278d1474a1b54a431191
src/views/hazardousChemicals/systemManage/user/components/userDialog.vue
@@ -64,9 +64,9 @@
          </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"
@@ -218,6 +218,7 @@
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
@@ -229,10 +230,11 @@
    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'){
@@ -241,7 +243,8 @@
    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
@@ -344,6 +347,8 @@
      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()