zhouwx
2025-07-15 4fe6c5ac4bc2b7fa9c9c71bb52d9df3e8b13bd7c
src/views/work/onlineEducation/people/components/stuDialog.vue
@@ -55,6 +55,20 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="部门:"  prop="deptId" v-if="state.title !== '修改密码'">
          <el-select
              v-model="state.form.deptId"
              placeholder="请选择部门"
              style="width: 100%"
          >
            <el-option
                v-for="item in state.deptList"
                :key="item.deptId"
                :label="item.deptName"
                :value="item.deptId"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="工号:"  prop="empno" v-if="state.title !== '修改密码'">
          <el-input v-model.trim="state.form.empno" :disabled="disabled" placeholder="请输入工号" ></el-input>
        </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:{
@@ -234,17 +250,29 @@
  },
  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)