Files
school-developer/src/views/recruit/recruitImitateAdjustBatch/mnTable.vue
zhoutianchi 498752ed65 招生
2026-01-14 18:42:54 +08:00

247 lines
7.1 KiB
Vue

<template>
<el-dialog
title="模拟列表"
:close-on-click-modal="false"
v-model="visible"
width="80%"
>
<el-form :inline="true">
<el-form-item>
<el-button v-if="permissions.recruit_recruitImitateAdjustBatch_add" :icon="Plus" size="small" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
</el-form>
<div class="avue-crud">
<el-table
:data="dataList"
border
stripe
v-loading="dataListLoading">
<el-table-column
prop="serialNumber"
header-align="center"
align="center"
label="唯一号">
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
label="姓名">
</el-table-column>
<el-table-column
prop="gender"
header-align="center"
align="center"
label="性别">
<template #default="scope">
<span v-if="scope.row.gender==1"></span>
<span v-if="scope.row.gender==2"></span>
</template>
</el-table-column>
<el-table-column
prop="degreeOfEducation"
header-align="center"
align="center"
label="学历">
<template #default="scope">
{{global.getLabelValueByPropes(eduList,scope.row.degreeOfEducation,{'key':'value','value':'label'})}}
</template>
</el-table-column>
<el-table-column
prop="wishMajorOne"
header-align="center"
width="100px"
align="center"
label="拟报专业1">
<template #default="scope">
{{global.getLabelValueByPropes2(planMajorList,scope.row.wishMajorOne,{'key':'zydm','value':'zymc'})}}
</template>
</el-table-column>
<el-table-column
prop="wishMajorTwo"
header-align="center"
align="center"
width="100px"
label="拟报专业2">
<template #default="scope">
{{global.getLabelValueByPropes2(planMajorList,scope.row.wishMajorTwo,{'key':'zydm','value':'zymc'})}}
</template>
</el-table-column>
<el-table-column
prop="wishMajorThree"
header-align="center"
align="center"
width="100px"
label="拟报专业3">
<template #default="scope">
{{global.getLabelValueByPropes2(planMajorList,scope.row.wishMajorThree,{'key':'zydm','value':'zymc'})}}
</template>
</el-table-column>
<el-table-column
prop="oldConfirmedMajor"
header-align="center"
align="center"
label="原录取专业">
<template #default="scope">
{{global.getLabelValueByPropes2(planMajorList,scope.row.oldConfirmedMajor,{'key':'zydm','value':'zymc'})}}
</template>
</el-table-column>
<el-table-column
prop="confirmedMajor"
header-align="center"
align="center"
label="模拟录取专业">
<template #default="scope">
{{global.getLabelValueByPropes2(planMajorList,scope.row.confirmedMajor,{'key':'zydm','value':'zymc'})}}
</template>
</el-table-column>
<el-table-column
prop="isOut"
header-align="center"
align="center"
width="120"
label="来源">
<template #default="scope">
<span v-if="scope.row.isOut==0">学校</span>
<span v-if="scope.row.isOut==1">市平台</span>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="操作">
<template #default="scope">
<el-button v-if="permissions.recruit_recruitImitateAdjustBatch_edit" type="text" size="small" :icon="Edit" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button v-if="permissions.recruit_recruitImitateAdjustBatch_del" type="text" size="small" :icon="Delete" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<add-m-n-stu v-if="addMnStuVisible" ref="addMnStuRef" @refreshDataList="getDataList"></add-m-n-stu>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, computed, nextTick, defineAsyncComponent } from 'vue'
import { storeToRefs } from 'pinia'
import { useUserInfo } from '/@/stores/userInfo'
import { useMessage, useMessageBox } from '/@/hooks/message'
import { Plus, Edit, Delete } from '@element-plus/icons-vue'
import { getMNStuList, delMNObj } from '@/api/recruit/recruitImitateAdjustBatch'
import { listPlanByCondition as planMajor } from "@/api/recruit/recruitstudentplan"
import { getTypeValue } from "@/api/admin/dict"
// @ts-ignore
import global from '@/components/tools/commondict'
const AddMNStu = defineAsyncComponent(() => import('./addMNStu.vue'))
// Emits
const emit = defineEmits<{
(e: 'refreshDataList'): void
}>()
// 使用 Pinia store
const userInfoStore = useUserInfo()
const { userInfos } = storeToRefs(userInfoStore)
// 创建权限对象
const permissions = computed(() => {
const perms: Record<string, boolean> = {}
userInfos.value.authBtnList.forEach((perm: string) => {
perms[perm] = true
})
return perms
})
// 消息提示 hooks
const message = useMessage()
const messageBox = useMessageBox()
// 组件引用
const addMnStuRef = ref()
// 响应式数据
const visible = ref(false)
const canSubmit = ref(false)
const dataListLoading = ref(false)
const addMnStuVisible = ref(false)
const dataForm = reactive({
batchNo: "",
groupId: ""
})
const dataList = ref<any[]>([])
const eduList = ref<any[]>([])
const planMajorList = ref<any[]>([])
// 初始化方法
const init = (batchNo: string, groupId: string) => {
dataForm.batchNo = batchNo
dataForm.groupId = groupId
visible.value = true
canSubmit.value = true
initData()
}
// 新增 / 修改
const addOrUpdateHandle = (id?: string) => {
addMnStuVisible.value = true
nextTick(() => {
addMnStuRef.value?.init(id || null, dataForm.groupId, dataForm.batchNo)
})
}
// 删除
const deleteHandle = async (id: string) => {
try {
await messageBox.confirm('是否确认删除本条数据?请谨慎操作')
await delMNObj(id)
message.success('删除成功')
getDataList()
} catch {
// 用户取消
}
}
// 获取数据列表
const getDataList = () => {
dataList.value = []
dataListLoading.value = true
emit('refreshDataList')
getMNStuList(dataForm).then((response: any) => {
dataList.value = response.data
dataListLoading.value = false
}).catch(() => {
dataListLoading.value = false
})
}
// 初始化数据
const initData = () => {
eduList.value = []
getTypeValue('finance_student_source').then((res: any) => {
eduList.value = res.data
})
planMajorList.value = []
planMajor({ groupId: dataForm.groupId }).then((data: any) => {
planMajorList.value = data.data
getDataList()
})
}
// 暴露方法给父组件
defineExpose({
init
})
</script>
<style scoped>
.avue-crud {
margin-top: 20px;
}
</style>