学校加入 注册 登录注册 加入学校审批

This commit is contained in:
zhangxuelin 2024-11-06 16:55:40 +08:00
parent bbf85c4337
commit dd8c48f3ae
9 changed files with 539 additions and 81 deletions

View File

@ -36,3 +36,18 @@ export class toLink {
// 删除链接-缓存
static delLink = key => ApiService.publicHttp(`/smarttalk/toLink/${key}`, null, 'delete')
}
// v2.5加入 认证学校
export class school {
// 学校加入 认证
static schoolJoin = data => ApiService.publicHttp(`/smarttalk/register/schoolJoin`,data, 'post')
// 获取学校列表
static deptTree = data => ApiService.publicHttp(`/smarttalk/register/deptTree`)
// 获取当前用户审核详情
static registerinfo = data => ApiService.publicHttp(`/smarttalk/register/info`)
// 获取学校管理列表
static auditlist = data => ApiService.publicHttp(`/smarttalk/audit/list`,data)
// 获取学校管理审核
static checkSchool = data => ApiService.publicHttp(`/smarttalk/audit/checkSchool`,data,'post')
}

View File

@ -139,10 +139,19 @@ export function listEvaluation(query) {
})
}
// 发送验证码
export function sendcode(query) {
export function sendcode(data) {
return request({
url: '/code/send',
method: 'post',
data
})
}
// 教师注册
export function instructorregister(data) {
return request({
url: '/instructor/register',
method: 'post',
data
})
}

View File

@ -11,13 +11,14 @@
</template>
<div class="head-aside">
<ul >
<li class="auth-li" @click="onUserTo('/schoolCertification')">
<li :class="computedregistertype==1 || computedregistertype==3?'auth-li':'auth-li pointer-events'" @click="onUserTo('/schoolCertification')" >
<i class="iconfont icon-renzheng-"></i>
<span class="mlr-5">学校认证</span>
<span class="gray">未认证</span>
</li>
<li @click="onUserTo('/joinSchool')">加入学校</li>
<li :class="computedregistertype==1 || computedregistertype==2 ? '':'pointer-events'" @click="onUserTo('/joinSchool')">加入学校</li>
<li @click="onUserTo('/profile')">个人中心</li>
<li @click="onUserTo('/schoolManagement')">学校管理</li>
<li @click="onUserTo('/class')">班级中心</li>
<li @click="logout">退出登录</li>
</ul>
@ -51,13 +52,14 @@
</template>
<script setup>
import { ref, watch } from 'vue'
import { ref, watch , reactive, onMounted,computed} from 'vue'
import { useRouter } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
import { sessionStore } from '@/utils/store'
import pkc from "../../../../../package.json"
const { ipcRenderer } = window.electron || {}
const dev_api = ref(import.meta.env.VITE_APP_BASE_API)
const userStore = useUserStore()
@ -66,6 +68,7 @@ const currentRoute = ref('')
const activeId = ref('/home')
const version = ref(pkc.version)
const popoverRef = ref('')
@ -106,7 +109,22 @@ const sideBottomMenu = [
},
]
const computedregistertype = computed(() => {
const type =userStore.DeptInfo?.register?.type ??0
if(type==0 || userStore.DeptInfo?.register?.auditStatus!=0){
return 1
}
//
if(type==3 && userStore.DeptInfo.register.auditStatus==0){
return 2
}
//
if(type==4 && userStore.DeptInfo.register.auditStatus==0){
return 3
}
})
const clickMenu = ({ id, disabled, path }) => {
if (disabled) return
activeId.value = id
@ -129,6 +147,7 @@ watch(
)
const logout = () => {
const hasClass = sessionStore.has('activeClass.id')
const hasTool = sessionStore.get('isToolWin')
@ -153,7 +172,10 @@ const logout = () => {
})
}).catch(()=>{})
}
onMounted(() => {
userStore.getDeptInfo()
// getregisterinfo()
})
</script>
<style lang="scss">
@ -275,4 +297,7 @@ const logout = () => {
font-size: 12px;
margin-top: 5px;
}
.pointer-events{
pointer-events: none;
}
</style>

View File

@ -152,7 +152,12 @@ export const constantRoutes = [
name: 'schoolCertification',
meta: {title: '学校认证'}
},
{
path: '/schoolManagement',
component: () => import('@/views/schoolManagement/index.vue'),
name: 'schoolManagement',
meta: {title: '学校管理'}
},
]
},
...toolRouters

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { login, logout, getInfo } from '@/api/login'
import { login, logout, getInfo, getdeptTree } from '@/api/login'
import {school} from '@/api/apiService'
import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/user.png'
@ -11,7 +12,8 @@ const useUserStore = defineStore('user', {
avatar: '',
roles: [],
permissions: [],
user: {}
user: {},
DeptInfo:{}
}),
actions: {
// 登录
@ -80,6 +82,12 @@ const useUserStore = defineStore('user', {
})
})
},
// 注册部门信息
getDeptInfo(){
school.registerinfo().then(res=>{
this.DeptInfo=res.data || {}
})
},
// 退出系统
logOut() {
return new Promise((resolve, reject) => {

View File

@ -1,36 +1,39 @@
<template>
<div class="joinschool">
<div class="titletext"><span style="font-size:30px;margin-right:30px" class="iconfont icon-tianchongxing-"></span>加入学校</div>
<!-- <div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px">
<div v-if="userregister.value">
<div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px" v-if="userregister.value.auditStatus==0">
<img style="margin: 0 auto;height:85px" src="@/assets/images/shenhe.png" alt="">
<p style="color:#F59A23;font-size:22px">申请审核中</p>
<p style="color:#000;font-size:16px;font-weight:600">申请信息已提交请耐心等待审核通过即可完成申请</p>
</div> -->
<!-- <div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8">
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8" v-if="userregister.value.auditStatus==1">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="success"></el-result>
<p style="font-size:30px;color:#67C23A">审核通过</p>
</div>
<p style="margin-bottom:10px;color:#439FFE; cursor: pointer">重新认证</p>
</div> -->
<div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE">
<p style="margin-bottom:10px;color:#439FFE; cursor: pointer" @click='chongxin'>重新认证</p>
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE" v-if="userregister.value.auditStatus==2">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="error"></el-result>
<p style="font-size:30px;color:#E10A07">申请驳回</p>
</div>
<p style="margin-bottom:10px;font-size:18px;font-weight:600">申请信息已驳回请重新提交申请信息</p>
</div>
</div>
<div class="box-item" >
<el-form ref="ruleFormRef" label-width="auto" size="large">
<el-form-item label="所属地区" prop="username">
<el-form ref="ruleFormRef" label-width="auto" :rules="rules" :model="ruleForm" size="large">
<!-- <el-form-item label="所属地区" prop="address">
<el-cascader
style="width:100%"
popper-class="aix-regist-address"
:options="regionData"
v-model="ruleForm.address"
/>
</el-form-item>
</el-form-item> -->
<el-form-item label="学校名称" prop="school" >
<el-cascader :options="optionsSchool" style="width:100%" v-model="ruleForm.school" @change="handleSchoolChange" />
<el-cascader :options="optionsSchool" style="width:100%" v-model="ruleForm.school" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="申请人" >
{{ state.user.nickName }}
@ -41,8 +44,8 @@
<el-form-item >
<div style="width:100%;text-align: right;padding-right:100px">
<el-button style="width:150px" type="default">关闭</el-button>
<el-button style="width:150px" type="primary" >确定</el-button>
<el-button style="width:150px" type="default" @click="closed">关闭</el-button>
<el-button style="width:150px" type="primary" @click="submitForm(ruleFormRef)" v-if="isshwoBtn">确定</el-button>
</div>
</el-form-item>
</el-form>
@ -51,27 +54,57 @@
</template>
<script setup >
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted ,watch} from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { getUserProfile } from '@/api/system/user'
import {getdeptTree} from '@/api/login'
import {getDept} from '@/api/login'
import {school} from '@/api/apiService'
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
import { useRouter } from 'vue-router'
const router = useRouter()
const userStore = useUserStore()
const ruleFormRef = ref(null)
const isshwoBtn = ref(true)
const state = reactive({
user: {},
})
const ruleForm = reactive({
school:[],
// address:[]
})
const optionsSchool=ref([])
const rules = reactive({
address:[ {
required: true,
message: '请选择地址',
trigger: 'change',
},],
school:[{
required: true,
message: '请选择地址',
trigger: 'change',
},],
})
watch (() => userStore.DeptInfo, (newValue, oldValue) => {
getregisterinfo()
})
const userregister = reactive({
value:null
})
const chongxin=()=>{
isshwoBtn.value=true
}
async function getUser() {
getUserProfile().then((response) => {
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
})
}
const getSchoolList = () => {
getdeptTree().then(res=>{
school.deptTree().then(res=>{
optionsSchool.value=res.data
optionsSchool.value.forEach(item=>{
item.value=item.id
@ -94,9 +127,56 @@ const getSchoolList = () => {
})
})
}
onMounted(() => {
//
const submitForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
// const araname = codeToText[ruleForm.address[0]] + '-' + codeToText[ruleForm.address[1]] + '-' + codeToText[ruleForm.address[2]];
const form={
schoolId:ruleForm.school[2],
// areaIds:ruleForm.address.join(','),
// area:araname
}
school.schoolJoin(form).then(async res=>{
if(res.code==200){
ElMessage.success('提交成功')
await userStore.getDeptInfo()
}
})
console.log('submit!')
} else {
console.log('error submit!', fields)
}
})
}
const getregisterinfo=()=>{
if(!(Object.keys(userStore.DeptInfo).length === 0 && userStore.DeptInfo.constructor === Object)){
if(userStore.DeptInfo.register.type==4) return
userregister.value=userStore.DeptInfo.register
getDept({deptId:userStore.DeptInfo.register.schoolId}).then(res1=>{
const arr=(res1?.data?.ancestors || '').split(',')
arr.shift()
arr.push(userStore.DeptInfo.register.schoolId)
ruleForm.school=arr.map(Number)
})
if(userStore.DeptInfo.register.auditStatus==0 || userStore.DeptInfo.register.auditStatus==1){
isshwoBtn.value=false
}
}
}
//
const closed=()=>{
if (ruleFormRef.value) ruleFormRef.value.resetFields()
router.push("/home")
}
onMounted(async () => {
getUser()
getSchoolList()
await userStore.getDeptInfo()
getregisterinfo()
})
</script>

View File

@ -25,7 +25,7 @@
<el-button :loading="btnLoading" class="btn" type="primary" @click="submitForm(formRef)">登录</el-button>
</el-form-item>
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="isRegister=false">注册账号</a>
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoreRegister">注册账号</a>
</div>
</el-form>
</div>
@ -35,20 +35,20 @@
<div class="login-title">账号注册</div>
<el-form ref="ruleFormRef" class="login-form" :model="ruleForm" label-width="auto" :rules="rules" size="large">
<el-form-item label="手机号" prop="username">
<el-input placeholder="请输入手机号" />
<el-input v-model="ruleForm.username" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="验证码" prop="Code">
<el-input style="width:185px" placeholder="请输入验证码" /><el-button type="primary" @click="sendyzm">发送验证码</el-button>
<el-form-item label="验证码" prop="smsCode">
<el-input style="width:185px" v-model="ruleForm.smsCode" placeholder="请输入验证码" /><el-button :disabled="codeName!='发送验证码'" type="primary" @click="sendyzm">{{ codeName }}</el-button>
</el-form-item>
<el-form-item label="密码" prop="password" >
<el-input autocomplete="on" type="password" placeholder="请输入密码" />
<el-input autocomplete="on" type="password" v-model="ruleForm.password" placeholder="请输入密码" />
</el-form-item>
<el-form-item>
<el-button class="btn" type="primary" @click="RegisterForm(ruleFormRef)">立即注册</el-button>
</el-form-item>
<div class="flex mb-4" style="display: flex;justify-content: center;color: #ccc;cursor: pointer;">
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="isRegister=true"> 返回登录 </a>
<a class="hover:text-sky-500" style="margin-right: 10px;" @click="gotoLogin"> 返回登录 </a>
</div>
</el-form>
</div>
@ -73,7 +73,7 @@ import WindowTools from '@/components/window-tools/index.vue'
import SelectSubject from '@/components/select-subject/index.vue'
import Register from './components/Register.vue'
import { sessionStore } from '@/utils/store'
import {sendcode} from '@/api/login'
import {sendcode,instructorregister} from '@/api/login'
const { session } = require('@electron/remote')
const downloadProp = ref(0)
@ -86,6 +86,8 @@ const isSubject = ref(false)
const RegModel = ref(false)
const isRegister = ref(true)
const ruleFormRef = ref(null)
const codeName=ref('发送验证码')
const timer=ref(null)
//
const loginForm = reactive({
username: '',
@ -99,7 +101,8 @@ const ruleForm = reactive({
//
const rules = reactive({
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }]
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
smsCode: [{ required: true, trigger: 'blur', message: '请输入您的验证码' }],
})
let curWinUrl = import.meta.env.VITE_APP_BUILD_BASE_PATH
@ -108,9 +111,42 @@ ipcRenderer.on('update-app-progress', (e, prop) => {
downloadProp.value = prop
showDownLoading.value = prop !== 100
})
const gotoreRegister=()=>{
codeName.value='发送验证码'
if(timer.value){
clearInterval(timer.value);
}
isRegister.value=false
}
//
const sendyzm=()=>{
// sendcode
if(ruleForm.username){
const pattern = /^1[3-9]\d{9}$/;
if( pattern.test(ruleForm.username) ){
sendcode({username:ruleForm.username, source: '4'}).then(res=>{
if(res.code==200){
ElMessage.success('消息发送成功')
codeName.value=60
timer.value=setInterval(()=>{
codeName.value--
if(codeName.value==0){
codeName.value='发送验证码'
clearInterval(timer.value);
}
},1000)
}else{
ElMessage.error(res.msg)
}
})
}else{
ElMessage.error('请输入正确的手机号码')
}
// captchaImg({mobile:ruleForm.phoneNumber}).then(res=>{
// console.log('res->', res)
// })
}else{
ElMessage.error('请输入手机号码')
}
}
//
const RegisterModel = type => {
@ -179,24 +215,25 @@ const setCookie = (name, value) => {
}
return session.defaultSession.cookies.set(cookie)
}
const gotoLogin = () => {
codeName.value='发送验证码'
if (ruleFormRef.value) ruleFormRef.value.resetFields()
isRegister.value = true
}
//
const RegisterForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
var form={
instructorregister(ruleForm).then(res=>{
if(res.code==200){
ElMessage.success('您已注册成功')
if (ruleFormRef.value) ruleFormRef.value.resetFields()
gotoLogin()
}else{
ElMessage.error(res.msg)
}
// signIn(form).then(res=>{
// if(res.code==200){
// ElMessage.success('')
// if (ruleFormRef.value) ruleFormRef.value.resetFields()
// }else{
// ElMessage.error(res.msg)
// }
// })
})
console.log('submit!')
} else {
console.log('error submit!', fields)

View File

@ -1,39 +1,44 @@
<template>
<div class="joinschool">
<div class="titletext"><span style="font-size:30px;margin-right:30px" class="iconfont icon-tianchongxing-"></span>学校认证</div>
<div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px">
<div v-if="userregister.value">
<div style="border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px" v-if="userregister.value.auditStatus==0">
<img style="margin: 0 auto;height:85px" src="@/assets/images/shenhe.png" alt="">
<p style="color:#F59A23;font-size:22px">申请审核中</p>
<p style="color:#000;font-size:16px;font-weight:600">申请信息已提交请耐心等待审核通过即可完成申请</p>
</div>
<!-- <div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8">
<div style="border:1px solid #000;margin-bottom:20px;background:#DFF0D8" v-if="userregister.value.auditStatus==1">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="success"></el-result>
<p style="font-size:30px;color:#67C23A">审核通过</p>
</div>
<p style="margin-bottom:10px;color:#439FFE; cursor: pointer">重新认证</p>
</div> -->
<!-- <div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE">
</div>
<div style="border:1px solid #000;margin-bottom:20px;background:#F2DEDE" v-if="userregister.value.auditStatus==2">
<div style="display: flex;align-items: center;justify-content: center;">
<el-result style="padding: 17px 35px;" icon="error"></el-result>
<p style="font-size:30px;color:#E10A07">申请驳回</p>
</div>
<p style="margin-bottom:10px;font-size:18px;font-weight:600">申请信息已驳回请重新提交申请信息</p>
</div> -->
<div class="box-item">
<el-form ref="ruleFormRef" label-width="auto" size="large">
<el-form-item label="学校名称" prop="name" >
<el-input v-model="ruleForm.name" placeholder="请输入学校名称" />
</div>
</div>
<div class="box-item" :style="userregister.value?'':'margin-top:30px'" >
<el-form ref="ruleFormRef" label-width="auto" :rules="rules" :model="ruleForm" size="large" >
<el-form-item label="学校名称" prop="schoolName" >
<el-input v-model="ruleForm.schoolName" placeholder="请输入学校名称" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="所属地区" prop="username">
<el-form-item label="所属地区" prop="address">
<el-cascader
:disabled="!isshwoBtn"
style="width:100%"
popper-class="aix-regist-address"
:options="regionData"
v-model="ruleForm.address"
/>
</el-form-item>
<el-form-item label="事业单位法人证书号" prop="school" >
<el-input v-model="ruleForm.name" placeholder="请输入事业单位法人证书号" />
<el-form-item label="事业单位法人证书号" prop="certNum" >
<el-input v-model="ruleForm.certNum" placeholder="请输入事业单位法人证书号" :disabled="!isshwoBtn" />
</el-form-item>
<el-form-item label="经办人" >
{{ state.user.nickName }}
@ -45,11 +50,11 @@
<el-form-item >
<div style="display:flex;align-items:center;justify-content: space-between;padding-right:100px; width: 100%;">
<div style="display:flex;align-items:center;">
<el-checkbox style="margin: 0px 10px 0px 55px" size="large" /> 以上信息真实有效勾选后提交
<el-checkbox style="margin: 0px 10px 0px 55px" v-model="ruleForm.istrue" size="large" :disabled="!isshwoBtn" /> 以上信息真实有效勾选后提交
</div>
<div >
<el-button style="width:150px" type="default">关闭</el-button>
<el-button style="width:150px" type="primary" >确定</el-button>
<el-button style="width:150px" type="default" @click="closed">关闭</el-button>
<el-button style="width:150px" type="primary" @click="submitForm(ruleFormRef)" v-if="isshwoBtn">确定</el-button>
</div>
</div>
@ -60,27 +65,66 @@
</template>
<script setup >
import { ref, reactive, onMounted } from 'vue'
import { ref, reactive, onMounted,watch } from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { getUserProfile } from '@/api/system/user'
import {getdeptTree} from '@/api/login'
import {getDept} from '@/api/login'
import {school} from '@/api/apiService'
import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const isshwoBtn=ref(true)
const router = useRouter()
const state = reactive({
user: {},
})
const userregister = reactive({
value:null
})
const ruleFormRef=ref(null)
const ruleForm = reactive({
school:[],
address:[],
schoolName:null,
istrue:false
})
const optionsSchool=ref([])
const rules = reactive({
address:[ {
required: true,
message: '请选择地址',
trigger: 'change',
},],
certNum:[{ required: true, message: '请输入证书号', trigger: 'blur' }],
schoolName:[ { required: true, message: '请输入学校名称', trigger: 'blur' },]
})
async function getUser() {
getUserProfile().then((response) => {
// response.data.avatar = import.meta.env.VITE_APP_BASE_API + response.data.avatar
Object.assign(state.user,response.data)
})
}
watch (() => userStore.DeptInfo, (newValue, oldValue) => {
getregisterinfo()
})
const getregisterinfo=()=>{
if(!(Object.keys(userStore.DeptInfo || {}).length === 0 && userStore.DeptInfo.constructor === Object)){
if(userStore.DeptInfo.register.type==3) return
userregister.value=userStore.DeptInfo.register
ruleForm.schoolName=userStore.DeptInfo.register.schoolName
ruleForm.certNum=userStore.DeptInfo.register.certNum
ruleForm.istrue=true
ruleForm.address=userStore.DeptInfo.register.areaIds.split(",")
if(userStore.DeptInfo.register.auditStatus==0 || userStore.DeptInfo.register.auditStatus==1){
isshwoBtn.value=false
}
}
}
const getSchoolList = () => {
getdeptTree().then(res=>{
school.deptTree().then(res=>{
optionsSchool.value=res.data
optionsSchool.value.forEach(item=>{
item.value=item.id
@ -103,9 +147,47 @@ const getSchoolList = () => {
})
})
}
//
const submitForm = async (formEl) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
if(!ruleForm.istrue) {
ElMessage.error('请勾选以上信息真实有效的复选框')
return
}
const araname = codeToText[ruleForm.address[0]] + '-' + codeToText[ruleForm.address[1]] + '-' + codeToText[ruleForm.address[2]];
const form={
schoolName:ruleForm.schoolName,
certNum:ruleForm.certNum,
areaIds:ruleForm.address.join(','),
area:araname
}
school.schoolJoin(form).then(async res=>{
if(res.code==200){
ElMessage.success('提交成功')
await userStore.getDeptInfo()
}
})
console.log('submit!')
} else {
console.log('error submit!', fields)
}
})
}
//
const closed=()=>{
if (ruleFormRef.value) ruleFormRef.value.resetFields()
router.push("/home")
}
onMounted(() => {
getUser()
getregisterinfo()
getSchoolList()
})
</script>

View File

@ -0,0 +1,197 @@
<template>
<div class="schoolManagement">
<div class="titletext">学校管理</div>
<div class="searchInput">
<div class="mr10">学校名称</div>
<el-input v-model="searchValue.schoolName" class="mr10" style="width: 240px" placeholder="请输入学校名称" />
<div class="mr10">所属区域</div>
<el-cascader
style="width: 240px;margin-right:10px"
:options="regionData"
v-model="address"
:props="{ checkStrictly: true }"
clearable
/>
<div class="mr10">审核状态</div>
<el-radio-group v-model="searchValue.status" class="mr10">
<el-radio :value="-1">全部</el-radio>
<el-radio :value="0">审核中</el-radio>
<el-radio :value="1">已通过</el-radio>
<el-radio :value="2">已驳回</el-radio>
</el-radio-group>
<el-button type="primary" @click="search">搜索</el-button>
</div>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="schoolName" label="学校名称" width="180" />
<el-table-column prop="area" label="所属地区" width="180" />
<el-table-column prop="certNum" label="事业单位法人证件号" />
<el-table-column prop="name" label="联系人" />
<el-table-column prop="mobile" label="联系电话" />
<el-table-column prop="status" label="审核状态">
<template #default="scope">
{{scope.row.status==0?'审核中':scope.row.status==1?'已通过':'已驳回' }}
</template>
</el-table-column>
<el-table-column prop="Operations" label="操作">
<template #default="scope">
<a v-if="scope.row.status==0" style="color:#04A8F0;cursor: pointer;" @click="audit(scope.row)">审核</a>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin-top:10px;float: right;" background layout="prev, pager, next" @size-change="handleSizeChange"
@current-change="handleCurrentChange" :default-page-size="searchValue.pageSize" v-model:current-page="searchValue.pageNum" :total="total" />
<el-dialog
v-model="dialogVisible"
title="加入学校审核"
width="500"
style="text-align: left;"
:before-close="handleClose"
>
<div style="margin-left:20px" class="formdialog">
审核状态
<el-radio-group v-model="form.status" class="mr10">
<el-radio :value="1">通过</el-radio>
<el-radio :value="2">拒绝</el-radio>
</el-radio-group>
</div>
<div style="margin-left:20px;margin-top:30px" class="formdialog">
审核理由
<el-input
v-model="form.auditMsg"
style="width: 300px"
:rows="3"
type="textarea"
placeholder="请输入理由"
/>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="sbmitform">
确定
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { school } from '@/api/apiService';
import { ref, reactive, onMounted ,computed} from 'vue'
import { regionData, codeToText } from 'element-china-area-data'
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
const userStore = useUserStore()
const searchValue = reactive({
status:-1,
schoolName:null,
pageNum:1,
pageSize:10,
type:3
})
const id=ref(null)
const address=ref([])
const total=ref(0)
const tableData = ref([])
const dialogVisible=ref(false)
const form=reactive({
status:'1',
auditMsg:null,
id:null,
ex1:null
})
const sbmitform=()=>{
if(!form.auditMsg){
return ElMessage.error('请输入理由')
}
school.checkSchool(form).then(res=>{
dialogVisible.value=false
form.auditMsg=null
form.status=1
getList()
userStore.getDeptInfo()
})
}
const filterNullProperties=(obj)=> {
const newObj = {};
for (const key in obj) {
if (obj[key] !== null && obj[key] != 'null' && obj[key] !== undefined) {
newObj[key] = obj[key];
}
}
return newObj;
}
const search=()=>{
searchValue.pageNum=1
getList()
}
const handleCurrentChange=()=>{
getList()
}
const handleSizeChange=()=>{
getList()
}
const handleClose=()=>{
form.id=null
form.ex1=null
form.auditMsg=null
form.status=1
dialogVisible.value=false
}
const formattedAddress = () => {
if (typeof address.value === 'undefined' || address.value?.length === 0) {
return null; //
}
return address.value.map(code => codeToText[code]).join('-'); // 使'-'
}
const getList = () =>{
const area=formattedAddress()
searchValue.area=area
let obj= filterNullProperties(searchValue)
school.auditlist(obj).then(res=>{
tableData.value=res.rows
total.value=res.total
})
}
const audit=(row)=>{
form.id=row.id
form.ex1=row.ex1
form.auditMsg=null
form.status=1
dialogVisible.value=true
}
onMounted(()=>{
console.log(searchValue)
getList()
})
</script>
<style scoped scss>
.schoolManagement{
padding: 20px;
background: #fff;
padding-bottom: 50px;
}
.titletext{
text-align: left;
display: flex;
align-items: center;
font-size: 30px;
margin-bottom: 30px;
}
.searchInput{
display: flex;
align-items:center;
margin-bottom: 20px;
}
.mr10{
margin-right: 10px;
}
.formdialog{
display: flex;
align-items: center;
}
</style>