From 8b4487baca9c4c1248f8069fa78b104cd9f42236 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: 星期五, 18 七月 2025 14:52:49 +0800
Subject: [PATCH] 修改新增
---
src/layout/components/Navbar.vue | 2
src/views/build/conpanyFunctionConsult/staffManage/staffRegister/index.vue | 8
src/views/work/onlineEducation/people/components/stuDialog.vue | 46 ++++----
src/views/menuPage.vue | 2
src/views/build/conpanyFunctionConsult/staffManage/staffRegister/components/staffDialog.vue | 235 +++++++++++++++++-----------------------------
5 files changed, 118 insertions(+), 175 deletions(-)
diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue
index e507d05..bddcd70 100644
--- a/src/layout/components/Navbar.vue
+++ b/src/layout/components/Navbar.vue
@@ -92,7 +92,7 @@
if(getToken()){
userInfo.value = JSON.parse(Cookies.get('userInfo'))
userName.value = userInfo.value.username
- userTypeName.value = userInfo.value.userType == 0 ? '系统管理员' : userInfo.value.userType == 1 ? '企业管理员' :userInfo.value.userType == 2 ? '部门级':userInfo.value.userType == 3 ? '车间级' :userInfo.value.userType == 6 ? '企业用户' :userInfo.value.userType == 4 ? '其他' : '学员'
+ userTypeName.value = userInfo.value.userType == 0 ? '系统管理员' : (userInfo.value.userType == 1 || userInfo.value.userType == 2 || userInfo.value.userType == 3) ? '企业用户' :userInfo.value.userType == 6 ? '企业管理员' :userInfo.value.userType == 4 ? '其他' : '学员'
}
// getState();
})
diff --git a/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/components/staffDialog.vue b/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/components/staffDialog.vue
index 055431f..a3a7a50 100644
--- a/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/components/staffDialog.vue
+++ b/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/components/staffDialog.vue
@@ -67,8 +67,8 @@
<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>
@@ -81,13 +81,13 @@
<!-- <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
@@ -125,21 +125,21 @@
</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
@@ -148,6 +148,7 @@
:disabled="disabled"
placeholder="请选择部门"
style="width: 100%"
+ @change="getParentId"
>
<el-option
v-for="item in state.deptList"
@@ -192,7 +193,7 @@
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)
@@ -303,7 +304,7 @@
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' }],
@@ -328,16 +329,15 @@
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;
@@ -361,19 +361,6 @@
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'){
@@ -390,60 +377,18 @@
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)=> {
@@ -535,63 +480,54 @@
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 = () => {
@@ -617,8 +553,6 @@
personType: null,
positional: ''
}
- showCompany.value = false;
- showChild.value = false;
state.userList = [];
state.companyList = [];
state.pageNum = 1;
@@ -640,7 +574,6 @@
const selectValue = (val) => {
state.form.parentId = null;
- state.form.parentName = null;
state.companyList.forEach(item => {
if(item.name === val){
state.form.companyId = item.id
@@ -648,6 +581,16 @@
})
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;
diff --git a/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/index.vue b/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/index.vue
index f27261f..35b800c 100644
--- a/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/index.vue
+++ b/src/views/build/conpanyFunctionConsult/staffManage/staffRegister/index.vue
@@ -186,7 +186,7 @@
data.dataList = res.data.list.map(item => {
return {
...item,
- userTypeName: item.userType === 0 ? '管理员' : item.userType === 1 ? '企业级' : item.userType === 2 ? '部门级' : item.userType === 3 ? '车间级' :'其他',
+ userTypeName: item.userType === 0 ? '系统管理员' : (item.userType === 1 || item.userType === 2 || item.userType === 3) ? '企业用户': item.userType === 6 ? '企业管理员':'其他',
entryTime: item.entryTime?.substring(0, 10)
}
})
@@ -225,7 +225,7 @@
return {
...item,
index: index + 1,
- userTypeName: item.userType === 0 ? '管理员' : item.userType === 1 ? '企业级' : item.userType === 2 ? '部门级' : item.userType === 3 ? '车间级' :'其他',
+ userTypeName: item.userType === 0 ? '系统管理员' : (item.userType === 1 || item.userType === 2 || item.userType === 3) ? '企业用户': item.userType === 6 ? '企业管理员':'其他',
entryTime: item.entryTime?.substring(0, 10)
}
})
@@ -235,8 +235,8 @@
}
const openDialog = (type, value) => {
- if(userInfo.value.userType === 3){
- ElMessage.warning('车间级用户不能新增')
+ if(userInfo.value.userType !== 0 && userInfo.value.userType !== 6){
+ ElMessage.warning('非管理员身份不可操作')
return;
}
dialogRef.value.openDialog(type, value, data.queryParams.companyId);
diff --git a/src/views/menuPage.vue b/src/views/menuPage.vue
index 28df0c8..5944604 100644
--- a/src/views/menuPage.vue
+++ b/src/views/menuPage.vue
@@ -82,7 +82,7 @@
if(getToken()){
userInfo.value = JSON.parse(Cookies.get('userInfo'))
userName.value = userInfo.value.username
- userTypeName.value = userInfo.value.userType == 0 ? '系统管理员' : userInfo.value.userType == 1 ? '企业管理员' :userInfo.value.userType == 2 ? '部门级':userInfo.value.userType == 3 ? '车间级' :userInfo.value.userType == 6 ? '企业用户' :userInfo.value.userType == 4 ? '其他' : '学员'
+ userTypeName.value = userInfo.value.userType == 0 ? '系统管理员' : (userInfo.value.userType == 1 || userInfo.value.userType == 2 || userInfo.value.userType == 3) ? '企业用户' :userInfo.value.userType == 6 ? '企业管理员' :userInfo.value.userType == 4 ? '其他' : '学员'
}
const userStore = useUserStore()
diff --git a/src/views/work/onlineEducation/people/components/stuDialog.vue b/src/views/work/onlineEducation/people/components/stuDialog.vue
index 75a879f..2b87294 100644
--- a/src/views/work/onlineEducation/people/components/stuDialog.vue
+++ b/src/views/work/onlineEducation/people/components/stuDialog.vue
@@ -33,28 +33,28 @@
<el-form-item label="重复密码:" prop="confirmPassword" v-if="state.title == '新增' || state.title == '修改密码'">
<el-input v-model.trim="state.form.confirmPassword" type="password" show-password placeholder="请输入确认密码"></el-input>
</el-form-item>
- <el-form-item label="所属部门账号:" prop="createBy" v-if="state.title !== '修改密码' && (currentUserType === 1 || currentUserType === 4)">
- <el-select
- clearable
- v-model="state.form.createBy"
- filterable
- remote
- @change="selectValue"
- reserve-keyword
- placeholder="请输入部门账号名称"
- remote-show-suffix
- :remote-method="getDeptUserList"
- :loading="loading"
- style="width: 100%"
- >
- <el-option
- v-for="item in state.deptUserList"
- :key="item.id"
- :label="item.name"
- :value="item.name"
- />
- </el-select>
- </el-form-item>
+<!-- <el-form-item label="所属部门账号:" prop="createBy" v-if="state.title !== '修改密码' && (currentUserType === 1 || currentUserType === 4)">-->
+<!-- <el-select-->
+<!-- clearable-->
+<!-- v-model="state.form.createBy"-->
+<!-- filterable-->
+<!-- remote-->
+<!-- @change="selectValue"-->
+<!-- reserve-keyword-->
+<!-- placeholder="请输入部门账号名称"-->
+<!-- remote-show-suffix-->
+<!-- :remote-method="getDeptUserList"-->
+<!-- :loading="loading"-->
+<!-- style="width: 100%"-->
+<!-- >-->
+<!-- <el-option-->
+<!-- v-for="item in state.deptUserList"-->
+<!-- :key="item.id"-->
+<!-- :label="item.name"-->
+<!-- :value="item.name"-->
+<!-- />-->
+<!-- </el-select>-->
+<!-- </el-form-item>-->
<el-form-item label="部门:" prop="deptId" v-if="state.title !== '修改密码'">
<el-select
v-model="state.form.deptId"
@@ -246,7 +246,7 @@
confirmPassword: [{ required: true, validator: equalToPassword, trigger: 'blur' }],
phone: [{ required: true, validator: validateUserPhone, trigger: 'blur' }],
idNo: [{ required: true, validator: validateIdNo, trigger: 'blur' }],
- createBy: [{ required: true, message: '请输入所属部门名称', trigger: 'blur' }],
+ // createBy: [{ required: true, message: '请输入所属部门名称', trigger: 'blur' }],
},
isAdmin: false,
--
Gitblit v1.9.2