zhouwx
2024-07-18 026b72ee0218e9cf93c2ba2d4f944e7a7d3b56ae
src/views/onlineEducation/people/components/stuDialog.vue
@@ -59,7 +59,7 @@
import {ElMessage, ElMessageBox} from "element-plus";
import {verifyPhone, verifyPwd, verifyUsername} from "@/utils/validate";
import { checkUserName, checkPhone } from "@/api/login"
import {resetPwd} from "@/api/onlineEducation/student"
import {changeCompany, resetPwd} from "@/api/onlineEducation/student"
import {Base64} from "js-base64"
import Cookies from "js-cookie";
import {addStudent, checkStuIdNo, checkStuPhone, editStudent} from "@/api/onlineEducation/student";
@@ -136,28 +136,46 @@
      }
    }
    checkStuIdNo(param).then((res)=>{
      if(res.data == false){
        callback(new Error('身份证号已被占用,请更换其他身份证号'))
        // ElMessageBox.confirm(
        //     `该人员${state.form.name}(身份证号:${state.form.idNo})与${state.form.idNo}已经绑定,确定将该人员的责任归属变更到贵公企业?`,
        //     '提示',
        //     {
        //       confirmButtonText: '确认',
        //       cancelButtonText: '取消',
        //       type: 'warning',
        //       icon: ''
        //     }
        // )
        //     .then(() => {
        //       ElMessage({
        //         type: 'success',
        //         message: 'Delete completed',
        //       })
        //     })
        //     .catch(() => {
        //       callback(new Error('身份证号已被占用,请更换其他身份证号'))
        //     })
      }else{
      if(res.data.status == 0){
        callback(new Error('身份证号不存在'))
      }else if(res.data.status == 1){
        callback(new Error('身份证号在该企业已被占用,请更换其他身份证号'))
      }else if(res.data.status == 2){
        if(state.title == '新增'){
          ElMessageBox.confirm(
              `该人员 ${state.form.name} (身份证号: ${state.form.idNo} )与 ${res.data.companyName} 已经绑定,确定将该人员的责任归属变更到贵公企业?`,
              '提示',
              {
                confirmButtonText: '确认',
                cancelButtonText: '取消',
                type: 'warning',
                icon: ''
              }
          )
          .then(() => {
            const param = {
              companyId: state.form.companyId,
              studentId: res.data.studentId
            }
            changeCompany(param).then((res) => {
              if(res.code == 200){
                ElMessage({
                  type: 'success',
                  message: '变更成功',
                })
                emit('getList')
                handleClose()
                callback()
              }else {
                ElMessage.warning(res.message)
              }
            })
          })
        }else {
          callback(new Error('身份证号在其他企业已被占用,请更换身份证号'))
        }
      }else {
        callback()
      }
    })