From d5bd0e88c1eec6bb2947d2bfa57348d89edbc1c3 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期五, 18 七月 2025 16:20:45 +0800
Subject: [PATCH] 修改

---
 src/views/work/onlineEducation/people/components/stuDialog.vue |   73 +++++++++++++++++++++++++-----------
 1 files changed, 51 insertions(+), 22 deletions(-)

diff --git a/src/views/work/onlineEducation/people/components/stuDialog.vue b/src/views/work/onlineEducation/people/components/stuDialog.vue
index 8976689..2b87294 100644
--- a/src/views/work/onlineEducation/people/components/stuDialog.vue
+++ b/src/views/work/onlineEducation/people/components/stuDialog.vue
@@ -33,25 +33,39 @@
         <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-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
-              clearable
-              v-model="state.form.createBy"
-              filterable
-              remote
-              @change="selectValue"
-              reserve-keyword
-              placeholder="请输入部门账号名称"
-              remote-show-suffix
-              :remote-method="getDeptUserList"
-              :loading="loading"
+              v-model="state.form.deptId"
+              placeholder="请选择部门"
               style="width: 100%"
           >
             <el-option
-                v-for="item in state.deptUserList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.name"
+                v-for="item in state.deptList"
+                :key="item.deptId"
+                :label="item.deptName"
+                :value="item.deptId"
             />
           </el-select>
         </el-form-item>
@@ -87,6 +101,7 @@
 import {addStudent, checkStuIdNo, checkStuPhone, editStudent} from "@/api/onlineEducation/student";
 import {getCompany} from "@/api/onlineEducation/company";
 import {getUser} from "@/api/onlineEducation/user";
+import {getDept} from "@/api/qualityObjectives/object";
 const emit = defineEmits(["getList"]);
 const dialogVisible = ref(false)
 const superRef = ref(null)
@@ -221,7 +236,8 @@
     idNo: '',
     createId: null,
     createBy: '',
-    userType: null
+    userType: null,
+    deptId: null
 
   },
   formRules:{
@@ -230,21 +246,33 @@
     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,
-  deptUserList: []
+  deptUserList: [],
+  deptList: []
 
 })
 const startPhone = ref('');
 const startIdNo = ref('');
 const UisMounted = ref(false);
-onMounted(() => {
+onMounted(async () => {
   UisMounted.value = true;
+  await getDeptList()
 
 });
-
+const getDeptList = async () => {
+  const param = {
+    pageNum: 1,
+    pageSize: 999,
+    companyId: state.form.companyId
+  }
+  const res = await getDept(param)
+  if(res.code === 200){
+    state.deptList = res.data
+  }
+}
 const currentUserType = ref(null)
 const disabled = ref(false);
 const openDialog = async (type, value) => {
@@ -287,6 +315,7 @@
   if(valid){
     if(state.title == '新增'){
       const {confirmPassword,id,...data} = state.form
+
       data.password = Base64.encode(data.password)
       const res = await addStudent(data)
       if(res.code == 200){
@@ -298,8 +327,8 @@
         ElMessage.warning(res.message)
       }
     }else if(state.title == '编辑'){
-      const {id, name, phone, sex, companyId, empno, post, duty, idNo,createId,createBy} = state.form
-      const data = {id, name, phone, sex, companyId, empno, post, duty, idNo,createId,createBy}
+      const {id, name, phone, sex, companyId, empno, post, duty,deptId, idNo,createId,createBy} = state.form
+      const data = {id, name, phone, sex, companyId, empno, post, deptId, duty, idNo,createId,createBy}
       const res = await editStudent(data)
       if(res.code == 200){
         ElMessage.success(res.message)

--
Gitblit v1.9.2