a
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:name="item.deptCode">
|
||||
<div class="avue-crud">
|
||||
<div style="margin-top: 20px;">
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
@@ -111,10 +111,10 @@
|
||||
import { ref, reactive } from 'vue'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { list, delObj } from '@/api/recruit/recruitplanmajor'
|
||||
import { putObj } from '@/api/recruit/recruitstudentplan'
|
||||
import { fetchSecondTree } from "@/api/basic/basicdept"
|
||||
import { getDictByType } from "@/api/contract/contract"
|
||||
import { list, delObj } from '/@/api/recruit/recruitplanmajor'
|
||||
import { putObj } from '/@/api/recruit/recruitstudentplan'
|
||||
import { fetchSecondTree } from '/@/api/basic/basicdept'
|
||||
import { getDicts } from "/@/api/admin/dict"
|
||||
|
||||
// 消息提示 hooks
|
||||
const message = useMessage()
|
||||
@@ -141,42 +141,54 @@ const dataForm = reactive({
|
||||
const initData = () => {
|
||||
degreeOfEducationList.value = []
|
||||
// 获取数据字典
|
||||
getDictByType("finance_student_source").then((res: any) => {
|
||||
degreeOfEducationList.value = res.data
|
||||
getDicts("finance_student_source").then((res: any) => {
|
||||
degreeOfEducationList.value = res.data || []
|
||||
}).catch((error: any) => {
|
||||
message.error('获取字典数据失败:' + (error.msg || '未知错误'))
|
||||
degreeOfEducationList.value = []
|
||||
})
|
||||
}
|
||||
|
||||
// 获取部门列表
|
||||
const getDepartment = () => {
|
||||
fetchSecondTree().then((res: any) => {
|
||||
deptList.value = res.data
|
||||
deptList.value = res.data || []
|
||||
}).catch((error: any) => {
|
||||
message.error('获取部门列表失败:' + (error.msg || '未知错误'))
|
||||
deptList.value = []
|
||||
})
|
||||
}
|
||||
|
||||
// 更新专业
|
||||
const updateMajor = (row: any) => {
|
||||
if (row.degreeOfEducation && row.degreeOfEducation.length != 0) {
|
||||
if (!row || !row.planId) {
|
||||
message.error('缺少必要的参数:planId')
|
||||
return
|
||||
}
|
||||
|
||||
if (row.degreeOfEducation && Array.isArray(row.degreeOfEducation) && row.degreeOfEducation.length != 0) {
|
||||
row.degreeOfEducations = row.degreeOfEducation.join(",")
|
||||
} else {
|
||||
row.degreeOfEducations = ""
|
||||
}
|
||||
|
||||
putObj({
|
||||
id: row.planId,
|
||||
planStudentNum: row.planStudentNum,
|
||||
planStudentBoyNum: row.planStudentBoyNum,
|
||||
planStudentGirlNum: row.planStudentGirlNum,
|
||||
needStudentNum: row.needStudentNum,
|
||||
needStudentOverNum: row.needStudentOverNum,
|
||||
scoreLine: row.scoreLine,
|
||||
scoreMinLine: row.scoreMinLine,
|
||||
degreeOfEducations: row.degreeOfEducations
|
||||
planStudentNum: row.planStudentNum || 0,
|
||||
planStudentBoyNum: row.planStudentBoyNum || 0,
|
||||
planStudentGirlNum: row.planStudentGirlNum || 0,
|
||||
needStudentNum: row.needStudentNum || 0,
|
||||
needStudentOverNum: row.needStudentOverNum || 0,
|
||||
scoreLine: row.scoreLine || 0,
|
||||
scoreMinLine: row.scoreMinLine || 0,
|
||||
degreeOfEducations: row.degreeOfEducations || ""
|
||||
}).then(() => {
|
||||
ElNotification.success({
|
||||
title: '成功',
|
||||
message: '修改成功'
|
||||
})
|
||||
}).catch(() => {
|
||||
// 错误处理
|
||||
}).catch((error: any) => {
|
||||
message.error('修改失败:' + (error.msg || '未知错误'))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -188,20 +200,26 @@ const handleChange = (tab: any) => {
|
||||
|
||||
// 获取数据列表
|
||||
const getDataList = () => {
|
||||
if (!dataForm.groupId) {
|
||||
dataListLoading.value = false
|
||||
return
|
||||
}
|
||||
|
||||
dataList.value = []
|
||||
dataListLoading.value = true
|
||||
if (dataForm.deptCode == '') {
|
||||
dataForm.deptCode = "11"
|
||||
}
|
||||
list({ groupId: dataForm.groupId, deptCode: dataForm.deptCode }).then((response: any) => {
|
||||
dataList.value = response.data
|
||||
dataList.value.forEach(e => {
|
||||
if (e.degreeOfEducation) {
|
||||
dataList.value = response.data || []
|
||||
dataList.value.forEach((e: any) => {
|
||||
if (e.degreeOfEducation && typeof e.degreeOfEducation === 'string') {
|
||||
e.degreeOfEducation = e.degreeOfEducation.split(",")
|
||||
}
|
||||
})
|
||||
dataListLoading.value = false
|
||||
}).catch(() => {
|
||||
}).catch((error: any) => {
|
||||
message.error('获取数据失败:' + (error.msg || '未知错误'))
|
||||
dataListLoading.value = false
|
||||
})
|
||||
}
|
||||
@@ -220,13 +238,28 @@ const deleteHandle = async (id: string) => {
|
||||
|
||||
// 初始化方法
|
||||
const init = (row: any) => {
|
||||
visible.value = true
|
||||
dataForm.deptCode = "11"
|
||||
dataForm.groupName = row.groupName
|
||||
dataForm.groupId = row.id
|
||||
initData()
|
||||
getDepartment()
|
||||
getDataList()
|
||||
if (!row) {
|
||||
message.error('初始化参数错误')
|
||||
return
|
||||
}
|
||||
|
||||
if (!row.id || !row.groupName) {
|
||||
message.error('缺少必要的参数:id 或 groupName')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
visible.value = true
|
||||
dataForm.deptCode = "11"
|
||||
dataForm.groupName = row.groupName || ''
|
||||
dataForm.groupId = row.id || ''
|
||||
initData()
|
||||
getDepartment()
|
||||
getDataList()
|
||||
} catch (error: any) {
|
||||
message.error('初始化失败:' + (error.message || '未知错误'))
|
||||
visible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
@@ -237,7 +270,4 @@ defineExpose({
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.avue-crud {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user