招生
This commit is contained in:
264
src/views/recruit/recruitexampeople/index.vue
Normal file
264
src/views/recruit/recruitexampeople/index.vue
Normal file
@@ -0,0 +1,264 @@
|
||||
<!--
|
||||
- Copyright (c) 2018-2025, cyweb All rights reserved.
|
||||
-
|
||||
- Redistribution and use in source and binary forms, with or without
|
||||
- modification, are permitted provided that the following conditions are met:
|
||||
-
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
- this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
- notice, this list of conditions and the following disclaimer in the
|
||||
- documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the pig4cloud.com developer nor the names of its
|
||||
- contributors may be used to endorse or promote products derived from
|
||||
- this software without specific prior written permission.
|
||||
-
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-dialog
|
||||
title="招生审核人员管理"
|
||||
:close-on-click-modal="false"
|
||||
v-model="visible"
|
||||
>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<div style="margin-top: 10px;">
|
||||
<el-time-picker
|
||||
is-range
|
||||
style="width:90%"
|
||||
v-model="form.time1"
|
||||
type="daterange"
|
||||
format="HH:mm:ss"
|
||||
value-format="HH:mm:ss"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
placeholder="选择时间范围"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 搜索表单 -->
|
||||
<el-form :model="queryForm" inline class="mb-4">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="getDataList">查询</el-button>
|
||||
<el-button type="primary" plain icon="Refresh" class="ml10" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="permissions.recruit_recruitexampeople_add">
|
||||
<el-button type="primary" icon="FolderAdd" class="ml10" @click="handleAdd">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
stripe
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNo" label="工号" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="teacherName" label="姓名" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="100" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="permissions.recruit_recruitexampeople_del"
|
||||
type="danger"
|
||||
link
|
||||
icon="Delete"
|
||||
@click="handleDel(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
v-bind="state.pagination"
|
||||
@current-change="currentChangeHandle"
|
||||
@size-change="sizeChangeHandle"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 保存审核人员弹窗 -->
|
||||
<el-dialog v-model="setTeachNoFormVisible" title="保存审核人员" width="20%" append-to-body>
|
||||
<div style="margin-top: 10px;">
|
||||
<el-select
|
||||
v-model="belongTeacherNos"
|
||||
filterable
|
||||
remote
|
||||
style="width: 90%"
|
||||
clearable
|
||||
reserve-keyword
|
||||
placeholder="请选择保管老师"
|
||||
:remote-method="remoteTeacherByQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in teacherList"
|
||||
:key="item.teacherNo"
|
||||
:label="item.realName"
|
||||
:value="item.realName"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="dialog-footer" style="margin-top: 10px">
|
||||
<el-button type="primary" @click="updateTeachNo">保存</el-button>
|
||||
<el-button @click="clouseWin">关闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="recruitexampeople">
|
||||
import { ref, reactive, computed } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useUserInfo } from '/@/stores/userInfo'
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table'
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message'
|
||||
import { addObj, delObj, fetchList } from '/@/api/recruit/recruitexampeople'
|
||||
import { queryTeacherBaseByNoByAssets } from '/@/api/professional/teacherbase'
|
||||
|
||||
// 使用 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 tableRef = ref()
|
||||
|
||||
// 弹窗状态
|
||||
const visible = ref(false)
|
||||
const setTeachNoFormVisible = ref(false)
|
||||
const belongTeacherNos = ref('')
|
||||
const teacherList = ref<any[]>([])
|
||||
|
||||
// 表单数据
|
||||
const form = reactive({
|
||||
time1: [] as string[]
|
||||
})
|
||||
|
||||
// 查询表单
|
||||
const queryForm = reactive({})
|
||||
|
||||
// 表格状态
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: queryForm,
|
||||
pageList: async (params: any) => {
|
||||
const response = await fetchList(params)
|
||||
return {
|
||||
data: {
|
||||
records: response.data.data.records,
|
||||
total: response.data.data.total
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoaded: async (state) => {
|
||||
// 如果有数据,设置时间范围
|
||||
if (state.dataList.length > 0) {
|
||||
form.time1 = [state.dataList[0].startTime, state.dataList[0].endTime]
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 使用 table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)
|
||||
|
||||
// 初始化
|
||||
const init = () => {
|
||||
form.time1 = []
|
||||
belongTeacherNos.value = ''
|
||||
getDataList()
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
// 检索教师
|
||||
const remoteTeacherByQuery = (query: string) => {
|
||||
teacherList.value = []
|
||||
if (query !== '') {
|
||||
setTimeout(() => {
|
||||
queryTeacherBaseByNoByAssets(query).then(response => {
|
||||
teacherList.value = response.data.data
|
||||
})
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
// 更新教师编号
|
||||
const updateTeachNo = async () => {
|
||||
if (form.time1.length === 0) {
|
||||
message.error('审核时间不能为空')
|
||||
return
|
||||
}
|
||||
try {
|
||||
await addObj({
|
||||
teacherNo: belongTeacherNos.value,
|
||||
startTime: form.time1[0],
|
||||
endTime: form.time1[1]
|
||||
})
|
||||
message.success('添加成功')
|
||||
setTeachNoFormVisible.value = false
|
||||
getDataList()
|
||||
} catch (error: any) {
|
||||
message.error(error.msg || '添加失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭窗口
|
||||
const clouseWin = () => {
|
||||
belongTeacherNos.value = ''
|
||||
setTeachNoFormVisible.value = false
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
belongTeacherNos.value = ''
|
||||
setTeachNoFormVisible.value = true
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDel = async (row: any) => {
|
||||
try {
|
||||
await messageBox.confirm(`是否确认删除ID为${row.id}的记录?`)
|
||||
await delObj(row.id)
|
||||
message.success('删除成功')
|
||||
getDataList()
|
||||
} catch {
|
||||
// 用户取消
|
||||
}
|
||||
}
|
||||
|
||||
// 重置查询
|
||||
const resetQuery = () => {
|
||||
Object.keys(queryForm).forEach(key => {
|
||||
queryForm[key] = ''
|
||||
})
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 暴露方法
|
||||
defineExpose({
|
||||
init
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user