上传新增文件
This commit is contained in:
2
.env
2
.env
@@ -14,7 +14,7 @@ VITE_PUBLIC_PATH = /
|
||||
VITE_API_URL = /api
|
||||
|
||||
# ADMIN 服务地址
|
||||
VITE_ADMIN_PROXY_PATH = http://localhost:9999
|
||||
VITE_ADMIN_PROXY_PATH = http://scj-v3.zhxy.link/
|
||||
|
||||
# 前端加密密钥
|
||||
VITE_PWD_ENC_KEY='pigxpigxpigxpigx'
|
||||
|
||||
@@ -8,4 +8,4 @@ VITE_OPEN = true
|
||||
ENV = 'development'
|
||||
|
||||
# ADMIN 服务地址
|
||||
VITE_ADMIN_PROXY_PATH = http://localhost:9999
|
||||
VITE_ADMIN_PROXY_PATH = http://scj-v3.zhxy.link/api
|
||||
|
||||
60940
docs/默认模块.openapi.json
Normal file
60940
docs/默认模块.openapi.json
Normal file
File diff suppressed because one or more lines are too long
@@ -12,6 +12,8 @@
|
||||
"prettier": "prettier --write ."
|
||||
},
|
||||
"dependencies": {
|
||||
"file-saver": "^2.0.5",
|
||||
"xlsx": "^0.18.5",
|
||||
"@axolo/json-editor-vue": "^0.3.2",
|
||||
"@chenfengyuan/vue-qrcode": "^2.0.0",
|
||||
"@element-plus/icons-vue": "^2.0.10",
|
||||
@@ -72,6 +74,11 @@
|
||||
"vue3-video-play": "1.3.1-beta.6",
|
||||
"vuedraggable": "^4.1.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@achrinza/node-ipc": "^11.0.0",
|
||||
"minimatch": "^9.0.5",
|
||||
"commander": "^13.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/core": "1.6.13",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
@@ -89,6 +96,7 @@
|
||||
"daisyui": "4.12.10",
|
||||
"eslint": "^8.34.0",
|
||||
"eslint-plugin-vue": "^9.9.0",
|
||||
"mockjs": "^1.1.0",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"prettier": "2.8.4",
|
||||
"sass": "1.58.3",
|
||||
|
||||
@@ -28,12 +28,12 @@ export function addObj(obj?: Object) {
|
||||
|
||||
/**
|
||||
* 根据查询参数获取对象详情。
|
||||
* @param {Object} [obj] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 对象数组。
|
||||
* @param {Object} [obj] - 查询参数,包含 id。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classRoomHygieneDaily/details',
|
||||
url: '/stuwork/classRoomHygieneDaily/detail',
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
@@ -41,13 +41,13 @@ export function getObj(obj?: Object) {
|
||||
|
||||
/**
|
||||
* 根据 ID 删除对象。
|
||||
* @param {Object} [ids] - 要删除的对象 ID。
|
||||
* @param {Object} [ids] - 要删除的对象 ID 数组。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classRoomHygieneDaily',
|
||||
method: 'delete',
|
||||
url: '/stuwork/classRoomHygieneDaily/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
@@ -59,8 +59,8 @@ export function delObjs(ids?: Object) {
|
||||
*/
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classRoomHygieneDaily',
|
||||
method: 'put',
|
||||
url: '/stuwork/classRoomHygieneDaily/edit',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
54
src/api/stuwork/classcheckdaily.ts
Normal file
54
src/api/stuwork/classcheckdaily.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
/**
|
||||
* 根据分页查询参数获取列表数据。
|
||||
* @param {Object} [query] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 分页对象。
|
||||
*/
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classcheckdaily/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个新对象。
|
||||
* @param {Object} [obj] - 要添加的对象。
|
||||
* @returns {Promise} 请求的 Promise 对象 (true/false)。
|
||||
*/
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classcheckdaily',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据查询参数获取对象详情。
|
||||
* @param {Object} [obj] - 查询参数,包含 id。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classcheckdaily/detail',
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 删除对象。
|
||||
* @param {Object} [ids] - 要删除的对象 ID 数组。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classcheckdaily/delete',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
67
src/api/stuwork/classhygienedaily.ts
Normal file
67
src/api/stuwork/classhygienedaily.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
/**
|
||||
* 根据分页查询参数获取列表数据。
|
||||
* @param {Object} [query] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 分页对象。
|
||||
*/
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classhygienedaily/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个新对象。
|
||||
* @param {Object} [obj] - 要添加的对象。
|
||||
* @returns {Promise} 请求的 Promise 对象 (true/false)。
|
||||
*/
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classhygienedaily',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据查询参数获取对象详情。
|
||||
* @param {Object} [obj] - 查询参数,包含 id。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classhygienedaily/detail',
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 删除对象。
|
||||
* @param {Object} [ids] - 要删除的对象 ID 数组。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classhygienedaily/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个已存在的对象。
|
||||
* @param {Object} [obj] - 要更新的对象。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classhygienedaily/edit',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
102
src/api/stuwork/classmasterresume.ts
Normal file
102
src/api/stuwork/classmasterresume.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
/**
|
||||
* 根据分页查询参数获取列表数据。
|
||||
* @param {Object} [query] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 分页对象。
|
||||
*/
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个新对象。
|
||||
* @param {Object} [obj] - 要添加的对象。
|
||||
* @returns {Promise} 请求的 Promise 对象 (true/false)。
|
||||
*/
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据查询参数获取对象详情。
|
||||
* @param {Object} [obj] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 对象数组。
|
||||
*/
|
||||
export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume/details',
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 ID 删除对象。
|
||||
* @param {Object} [ids] - 要删除的对象 ID 数组。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新一个已存在的对象。
|
||||
* @param {Object} [obj] - 要更新的对象。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume/edit',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取班主任履历详情列表。
|
||||
* @param {Object} [query] - 查询参数,包含 teacherNo(必填)、classCode(可选)、current、size。
|
||||
* @returns {Promise} 请求的 Promise 分页对象。
|
||||
*/
|
||||
export function fetchDetailList(query?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/classmasterresume/fetchDetailList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证某个字段的值是否已经存在。
|
||||
* @param {Object} rule - 验证规则对象。
|
||||
* @param {*} value - 要验证的值。
|
||||
* @param {Function} callback - 验证完成后的回调函数。
|
||||
* @param {boolean} isEdit - 当前操作是否为编辑。
|
||||
*/
|
||||
export function validateExist(rule: any, value: any, callback: any, isEdit: boolean) {
|
||||
if (isEdit) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
getObj({ [rule.field]: value }).then((response) => {
|
||||
const result = response.data;
|
||||
if (result !== null && result.length > 0) {
|
||||
callback(new Error('数据已经存在'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ export function addObj(obj?: Object) {
|
||||
|
||||
/**
|
||||
* 根据查询参数获取对象详情。
|
||||
* @param {Object} [obj] - 查询参数。
|
||||
* @returns {Promise} 请求的 Promise 对象数组。
|
||||
* @param {Object} [obj] - 查询参数,包含 id。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function getObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan/details',
|
||||
url: '/stuwork/weekPlan/detail',
|
||||
method: 'get',
|
||||
params: obj
|
||||
})
|
||||
@@ -41,13 +41,13 @@ export function getObj(obj?: Object) {
|
||||
|
||||
/**
|
||||
* 根据 ID 删除对象。
|
||||
* @param {Object} [ids] - 要删除的对象 ID。
|
||||
* @param {Object} [ids] - 要删除的对象 ID 数组。
|
||||
* @returns {Promise} 请求的 Promise 对象。
|
||||
*/
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan',
|
||||
method: 'delete',
|
||||
url: '/stuwork/weekPlan/delete',
|
||||
method: 'post',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
@@ -59,8 +59,8 @@ export function delObjs(ids?: Object) {
|
||||
*/
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/stuwork/weekPlan',
|
||||
method: 'put',
|
||||
url: '/stuwork/weekPlan/edit',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* eslint-disable */
|
||||
require('script-loader!file-saver');
|
||||
require('script-loader!@/excel/Blob');
|
||||
require('script-loader!xlsx/dist/xlsx.core.min');
|
||||
import { saveAs } from 'file-saver';
|
||||
import Blob from '@/excel/Blob.js';
|
||||
import * as XLSX from 'xlsx';
|
||||
function generateArray(table) {
|
||||
var out = [];
|
||||
var rows = table.querySelectorAll('tr');
|
||||
|
||||
@@ -156,13 +156,20 @@ export function dynamicImport(dynamicViewsModules: Record<string, Function>, com
|
||||
|
||||
const matchKeys = keys.filter((key) => {
|
||||
const k = key.replace(/..\/views|../, '');
|
||||
return k.startsWith(`${component}.vue`);
|
||||
// 支持路径格式:/stuwork/weekPlan/index 或 stuwork/weekPlan/index
|
||||
const normalizedComponent = component.startsWith('/') ? component : `/${component}`;
|
||||
return k.startsWith(`${normalizedComponent}.vue`) || k.startsWith(`${component}.vue`);
|
||||
});
|
||||
if (matchKeys?.length === 1) {
|
||||
const matchKey = matchKeys[0];
|
||||
return dynamicViewsModules[matchKey];
|
||||
}
|
||||
if (matchKeys?.length > 1) {
|
||||
console.warn(`Multiple matches found for component: ${component}`, matchKeys);
|
||||
return false;
|
||||
}
|
||||
if (matchKeys?.length === 0) {
|
||||
console.warn(`No match found for component: ${component}. Available keys:`, keys.slice(0, 10));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
157
src/views/stuwork/classRoomHygieneDaily/detail.vue
Normal file
157
src/views/stuwork/classRoomHygieneDaily/detail.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="履历详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="1200px">
|
||||
<el-table
|
||||
:data="detailList"
|
||||
v-loading="loading"
|
||||
border
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
:header-cell-style="{ textAlign: 'center', background: 'var(--el-table-row-hover-bg-color)' }">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNoVal" label="教师工号" show-overflow-tooltip />
|
||||
<el-table-column prop="telPhone" label="联系方式" show-overflow-tooltip />
|
||||
<el-table-column prop="className" label="班级名称" show-overflow-tooltip />
|
||||
<el-table-column prop="beginTime" label="开始时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="endTime" label="结束时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="resumeRemark" label="履历" show-overflow-tooltip />
|
||||
<el-table-column prop="remarks" label="备注" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新 增</el-button>
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑表单对话框 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="handleRefresh" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResumeDetail">
|
||||
import { ref, defineAsyncComponent } from 'vue'
|
||||
import { fetchDetailList, delObjs } from '/@/api/stuwork/classmasterresume'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
|
||||
// 引入编辑表单组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailList = ref([])
|
||||
const teacherNo = ref('')
|
||||
const formDialogRef = ref()
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (teacherNoValue: string) => {
|
||||
visible.value = true
|
||||
teacherNo.value = teacherNoValue
|
||||
getDetailList()
|
||||
};
|
||||
|
||||
// 获取详情列表
|
||||
const getDetailList = () => {
|
||||
loading.value = true
|
||||
fetchDetailList({
|
||||
teacherNo: teacherNo.value,
|
||||
current: 1,
|
||||
size: 9999
|
||||
}).then((res: any) => {
|
||||
if (res.data && res.data.records) {
|
||||
detailList.value = res.data.records
|
||||
} else if (Array.isArray(res.data)) {
|
||||
detailList.value = res.data
|
||||
} else {
|
||||
detailList.value = []
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取履历详情失败', err)
|
||||
detailList.value = []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
if (row && row.id) {
|
||||
// 直接使用表格行数据,不需要再次调用接口
|
||||
formDialogRef.value?.openDialog(row)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
if (!row.id) {
|
||||
useMessage().error('缺少记录ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除这条履历记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await delObjs([row.id])
|
||||
useMessage().success('删除成功')
|
||||
getDetailList() // 刷新列表
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
// 打开新增表单,预填充教师工号
|
||||
if (teacherNo.value) {
|
||||
formDialogRef.value?.openDialog({
|
||||
teacherNo: teacherNo.value
|
||||
})
|
||||
} else {
|
||||
useMessage().error('缺少教师工号')
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新列表(编辑后)
|
||||
const handleRefresh = () => {
|
||||
getDetailList()
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,98 +1,73 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑' : '新增'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
label-width="100px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="创建人" prop="createBy">
|
||||
<el-input v-model="form.createBy" placeholder="请输入创建人"/>
|
||||
<!-- 编辑时显示学院 -->
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="form.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%" >
|
||||
<el-option
|
||||
v-for="item in (form.id && form.id !== '' && form.deptCode) ? filteredClassList : classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="form.createTime" placeholder="请输入创建时间"/>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="检查日期" prop="recordDate">
|
||||
<el-date-picker
|
||||
v-model="form.recordDate"
|
||||
type="date"
|
||||
placeholder="选择检查日期"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="更新人" prop="updateBy">
|
||||
<el-input v-model="form.updateBy" placeholder="请输入更新人"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="form.updateTime" placeholder="请输入更新时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="删除标记" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标记"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input v-model="form.remarks" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="班级代码" prop="classCode">
|
||||
<el-input v-model="form.classCode" placeholder="请输入班级代码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="score">
|
||||
<el-input v-model="form.score" placeholder="请输入备注"/>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="扣分" prop="score">
|
||||
<el-input-number
|
||||
v-model="form.score"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
:min="0"
|
||||
placeholder="请输入扣分"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="检查记录" prop="note">
|
||||
<el-input v-model="form.note" placeholder="请输入检查记录"/>
|
||||
<el-input
|
||||
v-model="form.note"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入检查记录"
|
||||
maxlength="500"
|
||||
show-word-limit />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-input v-model="form.schoolYear" placeholder="请输入学年"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input v-model="form.schoolTerm" placeholder="请输入学期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="记录时间" prop="recordDate">
|
||||
<el-input v-model="form.recordDate" placeholder="请输入记录时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="部门代码" prop="deptCode">
|
||||
<el-input v-model="form.deptCode" placeholder="请输入部门代码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" placeholder="请输入部门名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -105,57 +80,94 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassRoomHygieneDailyDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { ref, reactive, nextTick, computed, onMounted } from 'vue'
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, validateExist } from '/@/api/stuwork/classRoomHygieneDaily'
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { getObj, addObj, putObj } from '/@/api/stuwork/classRoomHygieneDaily'
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole, queryClassByDeptCode } from '/@/api/basic/basicclass'
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
delFlag: '',
|
||||
tenantId: '',
|
||||
remarks: '',
|
||||
classCode: '',
|
||||
score: '',
|
||||
note: '',
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
recordDate: '',
|
||||
deptCode: '',
|
||||
deptName: '',
|
||||
classCode: '',
|
||||
recordDate: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
// 根据学院筛选班级列表
|
||||
const filteredClassList = computed(() => {
|
||||
if (!form.deptCode) {
|
||||
return []
|
||||
}
|
||||
return classList.value.filter((item: any) => item.deptCode === form.deptCode)
|
||||
})
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = computed(() => ({
|
||||
deptCode: form.id ? [
|
||||
{ required: true, message: '学院不能为空', trigger: 'change' }
|
||||
] : [],
|
||||
classCode: [
|
||||
{ required: true, message: '班号不能为空', trigger: 'change' }
|
||||
],
|
||||
recordDate: [
|
||||
{ required: true, message: '检查日期不能为空', trigger: 'blur' }
|
||||
],
|
||||
score: [
|
||||
{ required: true, message: '扣分不能为空', trigger: 'blur' }
|
||||
],
|
||||
note: [
|
||||
{ required: true, message: '检查记录不能为空', trigger: 'blur' }
|
||||
]
|
||||
}))
|
||||
|
||||
// 学院选择变化
|
||||
const handleDeptChange = () => {
|
||||
// 清空班号选择
|
||||
form.classCode = ''
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
const openDialog = (id?: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
deptCode: '',
|
||||
classCode: '',
|
||||
recordDate: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
})
|
||||
|
||||
// 清除表单验证状态,不触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取classRoomHygieneDaily信息
|
||||
// 获取详情
|
||||
if (id) {
|
||||
form.id = id
|
||||
getClassRoomHygieneDailyData(id)
|
||||
}
|
||||
// 新增时,确保验证状态已清除
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 提交
|
||||
@@ -170,23 +182,82 @@ const onSubmit = async () => {
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg || '操作失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getClassRoomHygieneDailyData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
Object.assign(form, res.data[0])
|
||||
if (res.data) {
|
||||
// 处理返回数据,可能是对象或数组
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
Object.assign(form, {
|
||||
id: data.id || '',
|
||||
deptCode: data.deptCode || '',
|
||||
classCode: data.classCode || '',
|
||||
recordDate: data.recordDate || '',
|
||||
score: data.score || 0,
|
||||
note: data.note || ''
|
||||
})
|
||||
|
||||
// 如果编辑时 deptCode 为空,但 classCode 有值,尝试从 classList 中找到对应的 deptCode
|
||||
if (!form.deptCode && form.classCode && classList.value.length > 0) {
|
||||
const classItem = classList.value.find((item: any) => item.classCode === form.classCode)
|
||||
if (classItem && classItem.deptCode) {
|
||||
form.deptCode = classItem.deptCode
|
||||
}
|
||||
}
|
||||
|
||||
// 数据加载完成后,清除验证状态,避免触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data) {
|
||||
deptList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
|
||||
@@ -1,112 +1,166 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="班级代码" prop="classCode" >
|
||||
<el-input placeholder="请输入班级代码" v-model="state.queryForm.classCode" />
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="searchForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="记录时间" prop="recordDate">
|
||||
<el-date-picker type="date" placeholder="请输入记录时间" v-model="state.queryForm.recordDate"></el-date-picker>
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="searchForm.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门代码" prop="deptCode" >
|
||||
<el-input placeholder="请输入部门代码" v-model="state.queryForm.deptCode" />
|
||||
<el-form-item label="开始时间" prop="startDate">
|
||||
<el-date-picker
|
||||
v-model="searchForm.startDate"
|
||||
type="date"
|
||||
placeholder="选择开始时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endDate">
|
||||
<el-date-picker
|
||||
v-model="searchForm.endDate"
|
||||
type="date"
|
||||
placeholder="选择结束时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">
|
||||
查 询
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重 置</el-button>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'stuwork_classRoomHygieneDaily_add'">
|
||||
<el-button
|
||||
icon="FolderAdd"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain icon="upload-filled" type="primary" class="ml10" @click="excelUploadRef.show()" v-auth="'sys_user_add'">
|
||||
导 入
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'stuwork_classRoomHygieneDaily_del'" @click="handleDelete(selectObjs)">
|
||||
删 除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'stuwork_classRoomHygieneDaily_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'stuwork_classRoomHygieneDaily_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="createBy" label="创建人" show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateBy" label="更新人" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateTime" label="更新时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="delFlag" label="删除标记" show-overflow-tooltip/>
|
||||
<el-table-column prop="tenantId" label="租户ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="remarks" label="备注" show-overflow-tooltip/>
|
||||
<el-table-column prop="classCode" label="班级代码" show-overflow-tooltip/>
|
||||
<el-table-column prop="score" label="备注" show-overflow-tooltip/>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip />
|
||||
<el-table-column prop="recordDate" label="时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="score" label="扣分" show-overflow-tooltip width="80" />
|
||||
<el-table-column prop="note" label="检查记录" show-overflow-tooltip />
|
||||
<el-table-column prop="schoolYear" label="学年" show-overflow-tooltip/>
|
||||
<el-table-column prop="schoolTerm" label="学期" show-overflow-tooltip/>
|
||||
<el-table-column prop="recordDate" label="记录时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="deptCode" label="部门代码" show-overflow-tooltip/>
|
||||
<el-table-column prop="deptName" label="部门名称" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'stuwork_classRoomHygieneDaily_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'stuwork_classRoomHygieneDaily_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<!-- 导入excel (需要在 upms-biz/resources/file 下维护模板) -->
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
title="导入"
|
||||
url="/stuwork/classRoomHygieneDaily/import"
|
||||
temp-url="/admin/sys-file/local/file/classRoomHygieneDaily.xlsx"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemClassRoomHygieneDaily">
|
||||
<script setup lang="ts" name="ClassRoomHygieneDaily">
|
||||
import { ref, reactive, defineAsyncComponent, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/classRoomHygieneDaily";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const excelUploadRef = ref();
|
||||
const searchFormRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
deptCode: '',
|
||||
classCode: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -119,40 +173,80 @@ const {
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/stuwork/classRoomHygieneDaily/export', Object.assign(state.queryForm, { ids: selectObjs }), 'classRoomHygieneDaily.xlsx')
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.deptCode = ''
|
||||
searchForm.classCode = ''
|
||||
searchForm.startDate = ''
|
||||
searchForm.endDate = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data) {
|
||||
deptList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
})
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile(
|
||||
'/stuwork/classRoomHygieneDaily/export',
|
||||
searchForm,
|
||||
'教室卫生.xlsx'
|
||||
)
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm('此操作将永久删除', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success('删除成功')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
157
src/views/stuwork/classcheckdaily/detail.vue
Normal file
157
src/views/stuwork/classcheckdaily/detail.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="履历详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="1200px">
|
||||
<el-table
|
||||
:data="detailList"
|
||||
v-loading="loading"
|
||||
border
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
:header-cell-style="{ textAlign: 'center', background: 'var(--el-table-row-hover-bg-color)' }">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNoVal" label="教师工号" show-overflow-tooltip />
|
||||
<el-table-column prop="telPhone" label="联系方式" show-overflow-tooltip />
|
||||
<el-table-column prop="className" label="班级名称" show-overflow-tooltip />
|
||||
<el-table-column prop="beginTime" label="开始时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="endTime" label="结束时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="resumeRemark" label="履历" show-overflow-tooltip />
|
||||
<el-table-column prop="remarks" label="备注" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新 增</el-button>
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑表单对话框 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="handleRefresh" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResumeDetail">
|
||||
import { ref, defineAsyncComponent } from 'vue'
|
||||
import { fetchDetailList, delObjs } from '/@/api/stuwork/classmasterresume'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
|
||||
// 引入编辑表单组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailList = ref([])
|
||||
const teacherNo = ref('')
|
||||
const formDialogRef = ref()
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (teacherNoValue: string) => {
|
||||
visible.value = true
|
||||
teacherNo.value = teacherNoValue
|
||||
getDetailList()
|
||||
};
|
||||
|
||||
// 获取详情列表
|
||||
const getDetailList = () => {
|
||||
loading.value = true
|
||||
fetchDetailList({
|
||||
teacherNo: teacherNo.value,
|
||||
current: 1,
|
||||
size: 9999
|
||||
}).then((res: any) => {
|
||||
if (res.data && res.data.records) {
|
||||
detailList.value = res.data.records
|
||||
} else if (Array.isArray(res.data)) {
|
||||
detailList.value = res.data
|
||||
} else {
|
||||
detailList.value = []
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取履历详情失败', err)
|
||||
detailList.value = []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
if (row && row.id) {
|
||||
// 直接使用表格行数据,不需要再次调用接口
|
||||
formDialogRef.value?.openDialog(row)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
if (!row.id) {
|
||||
useMessage().error('缺少记录ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除这条履历记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await delObjs([row.id])
|
||||
useMessage().success('删除成功')
|
||||
getDetailList() // 刷新列表
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
// 打开新增表单,预填充教师工号
|
||||
if (teacherNo.value) {
|
||||
formDialogRef.value?.openDialog({
|
||||
teacherNo: teacherNo.value
|
||||
})
|
||||
} else {
|
||||
useMessage().error('缺少教师工号')
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新列表(编辑后)
|
||||
const handleRefresh = () => {
|
||||
getDetailList()
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
291
src/views/stuwork/classcheckdaily/form.vue
Normal file
291
src/views/stuwork/classcheckdaily/form.vue
Normal file
@@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="新增"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
label-width="100px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="form.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="学生" prop="stuNo">
|
||||
<el-select
|
||||
v-model="form.stuNo"
|
||||
placeholder="请选择学生"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
:disabled="!form.classCode"
|
||||
@change="handleStudentChange">
|
||||
<el-option
|
||||
v-for="item in studentList"
|
||||
:key="item.stuNo"
|
||||
:label="item.realName"
|
||||
:value="item.stuNo">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="记录时间" prop="recordTime">
|
||||
<el-date-picker
|
||||
v-model="form.recordTime"
|
||||
type="date"
|
||||
placeholder="选择记录时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input-number
|
||||
v-model="form.score"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
:min="0"
|
||||
placeholder="请输入分数"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="检查记录" prop="note">
|
||||
<el-input
|
||||
v-model="form.note"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入检查记录"
|
||||
maxlength="500"
|
||||
show-word-limit />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassCheckDailyDialog">
|
||||
import { ref, reactive, nextTick, onMounted, watch } from 'vue'
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj } from '/@/api/stuwork/classcheckdaily'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
import { queryAllStudentByClassCode } from '/@/api/basic/basicstudent'
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const classList = ref<any[]>([])
|
||||
const studentList = ref<any[]>([])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
classCode: '',
|
||||
stuNo: '',
|
||||
realName: '',
|
||||
recordTime: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
classCode: [
|
||||
{ required: true, message: '班号不能为空', trigger: 'change' }
|
||||
],
|
||||
stuNo: [
|
||||
{ required: true, message: '学生不能为空', trigger: 'change' }
|
||||
],
|
||||
recordTime: [
|
||||
{ required: true, message: '记录时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
score: [
|
||||
{ required: true, message: '分数不能为空', trigger: 'blur' }
|
||||
],
|
||||
note: [
|
||||
{ required: true, message: '检查记录不能为空', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 监听班级变化,加载学生列表
|
||||
watch(() => form.classCode, (newVal) => {
|
||||
if (newVal) {
|
||||
getStudentList(newVal)
|
||||
} else {
|
||||
studentList.value = []
|
||||
form.stuNo = ''
|
||||
form.realName = ''
|
||||
}
|
||||
})
|
||||
|
||||
// 学生选择变化
|
||||
const handleStudentChange = (stuNo: string) => {
|
||||
const student = studentList.value.find((item: any) => item.stuNo === stuNo)
|
||||
if (student) {
|
||||
form.realName = student.realName || ''
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id?: string) => {
|
||||
visible.value = true
|
||||
|
||||
// 重置表单数据
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
classCode: '',
|
||||
stuNo: '',
|
||||
realName: '',
|
||||
recordTime: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
})
|
||||
|
||||
// 清空学生列表
|
||||
studentList.value = []
|
||||
|
||||
// 清除表单验证状态,不触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取详情
|
||||
if (id) {
|
||||
form.id = id
|
||||
getClassCheckDailyData(id)
|
||||
}
|
||||
// 新增时,确保验证状态已清除
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
// 日常巡检只有新增,没有编辑功能
|
||||
await addObj(form);
|
||||
useMessage().success('添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '操作失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化表单数据(如果需要查看详情)
|
||||
const getClassCheckDailyData = (id: string) => {
|
||||
loading.value = true
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
if (res.data) {
|
||||
// 处理返回数据,可能是对象或数组
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
Object.assign(form, {
|
||||
id: data.id || '',
|
||||
classCode: data.classCode || '',
|
||||
stuNo: data.stuNo || '',
|
||||
realName: data.realName || '',
|
||||
recordTime: data.recordTime || '',
|
||||
score: data.score || 0,
|
||||
note: data.note || ''
|
||||
})
|
||||
|
||||
// 如果有班级代码,加载学生列表
|
||||
if (data.classCode) {
|
||||
getStudentList(data.classCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
// 数据加载完成后,清除验证状态,避免触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 获取学生列表
|
||||
const getStudentList = async (classCode: string) => {
|
||||
try {
|
||||
const res = await queryAllStudentByClassCode(classCode)
|
||||
if (res.data) {
|
||||
studentList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学生列表失败', err)
|
||||
studentList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getClassListData()
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
279
src/views/stuwork/classcheckdaily/index.vue
Normal file
279
src/views/stuwork/classcheckdaily/index.vue
Normal file
@@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-select
|
||||
v-model="searchForm.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in schoolYearList"
|
||||
:key="item.year"
|
||||
:label="item.year"
|
||||
:value="item.year">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input
|
||||
v-model="searchForm.schoolTerm"
|
||||
placeholder="请输入学期"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="searchForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px"
|
||||
@change="handleDeptChange">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="searchForm.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in filteredClassList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学生" prop="realName">
|
||||
<el-input
|
||||
v-model="searchForm.realName"
|
||||
placeholder="请输入学生姓名"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="FolderAdd"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()">
|
||||
新 增
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip />
|
||||
<el-table-column prop="realName" label="学生" show-overflow-tooltip />
|
||||
<el-table-column prop="recordTime" label="记录时间" show-overflow-tooltip />
|
||||
<el-table-column prop="score" label="分数" show-overflow-tooltip />
|
||||
<el-table-column prop="note" label="检查记录" show-overflow-tooltip />
|
||||
<el-table-column prop="handleResult" label="处理结果" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassCheckDaily">
|
||||
import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/classcheckdaily";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
// 搜索变量
|
||||
const showSearch = ref(true)
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
const schoolYearList = ref<any[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
deptCode: '',
|
||||
classCode: '',
|
||||
realName: ''
|
||||
})
|
||||
|
||||
// 根据学院筛选班级列表
|
||||
const filteredClassList = computed(() => {
|
||||
if (!searchForm.deptCode) {
|
||||
return classList.value
|
||||
}
|
||||
return classList.value.filter((item: any) => item.deptCode === searchForm.deptCode)
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 学院选择变化
|
||||
const handleDeptChange = () => {
|
||||
// 清空班号选择
|
||||
searchForm.classCode = ''
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.formRef?.resetFields()
|
||||
searchForm.schoolYear = ''
|
||||
searchForm.schoolTerm = ''
|
||||
searchForm.deptCode = ''
|
||||
searchForm.classCode = ''
|
||||
searchForm.realName = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除选中的记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data) {
|
||||
deptList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
if (res.data) {
|
||||
schoolYearList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学年列表失败', err)
|
||||
schoolYearList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
getSchoolYearList()
|
||||
})
|
||||
</script>
|
||||
157
src/views/stuwork/classhygienedaily/detail.vue
Normal file
157
src/views/stuwork/classhygienedaily/detail.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="履历详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="1200px">
|
||||
<el-table
|
||||
:data="detailList"
|
||||
v-loading="loading"
|
||||
border
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
:header-cell-style="{ textAlign: 'center', background: 'var(--el-table-row-hover-bg-color)' }">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNoVal" label="教师工号" show-overflow-tooltip />
|
||||
<el-table-column prop="telPhone" label="联系方式" show-overflow-tooltip />
|
||||
<el-table-column prop="className" label="班级名称" show-overflow-tooltip />
|
||||
<el-table-column prop="beginTime" label="开始时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="endTime" label="结束时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="resumeRemark" label="履历" show-overflow-tooltip />
|
||||
<el-table-column prop="remarks" label="备注" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新 增</el-button>
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑表单对话框 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="handleRefresh" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResumeDetail">
|
||||
import { ref, defineAsyncComponent } from 'vue'
|
||||
import { fetchDetailList, delObjs } from '/@/api/stuwork/classmasterresume'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
|
||||
// 引入编辑表单组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailList = ref([])
|
||||
const teacherNo = ref('')
|
||||
const formDialogRef = ref()
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (teacherNoValue: string) => {
|
||||
visible.value = true
|
||||
teacherNo.value = teacherNoValue
|
||||
getDetailList()
|
||||
};
|
||||
|
||||
// 获取详情列表
|
||||
const getDetailList = () => {
|
||||
loading.value = true
|
||||
fetchDetailList({
|
||||
teacherNo: teacherNo.value,
|
||||
current: 1,
|
||||
size: 9999
|
||||
}).then((res: any) => {
|
||||
if (res.data && res.data.records) {
|
||||
detailList.value = res.data.records
|
||||
} else if (Array.isArray(res.data)) {
|
||||
detailList.value = res.data
|
||||
} else {
|
||||
detailList.value = []
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取履历详情失败', err)
|
||||
detailList.value = []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
if (row && row.id) {
|
||||
// 直接使用表格行数据,不需要再次调用接口
|
||||
formDialogRef.value?.openDialog(row)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
if (!row.id) {
|
||||
useMessage().error('缺少记录ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除这条履历记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await delObjs([row.id])
|
||||
useMessage().success('删除成功')
|
||||
getDetailList() // 刷新列表
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
// 打开新增表单,预填充教师工号
|
||||
if (teacherNo.value) {
|
||||
formDialogRef.value?.openDialog({
|
||||
teacherNo: teacherNo.value
|
||||
})
|
||||
} else {
|
||||
useMessage().error('缺少教师工号')
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新列表(编辑后)
|
||||
const handleRefresh = () => {
|
||||
getDetailList()
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
219
src/views/stuwork/classhygienedaily/form.vue
Normal file
219
src/views/stuwork/classhygienedaily/form.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑' : '新增'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
label-width="100px"
|
||||
:validate-on-rule-change="false"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="form.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="记录时间" prop="recordDate">
|
||||
<el-date-picker
|
||||
v-model="form.recordDate"
|
||||
type="date"
|
||||
placeholder="选择记录时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="分数" prop="score">
|
||||
<el-input-number
|
||||
v-model="form.score"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
:min="0"
|
||||
placeholder="请输入分数"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="检查记录" prop="note">
|
||||
<el-input
|
||||
v-model="form.note"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
placeholder="请输入检查记录"
|
||||
maxlength="500"
|
||||
show-word-limit />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassHygieneDailyDialog">
|
||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/stuwork/classhygienedaily'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
classCode: '',
|
||||
recordDate: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
classCode: [
|
||||
{ required: true, message: '班号不能为空', trigger: 'change' }
|
||||
],
|
||||
recordDate: [
|
||||
{ required: true, message: '记录时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
score: [
|
||||
{ required: true, message: '分数不能为空', trigger: 'blur' }
|
||||
],
|
||||
note: [
|
||||
{ required: true, message: '检查记录不能为空', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id?: string) => {
|
||||
visible.value = true
|
||||
|
||||
// 重置表单数据
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
classCode: '',
|
||||
recordDate: '',
|
||||
score: 0,
|
||||
note: ''
|
||||
})
|
||||
|
||||
// 清除表单验证状态,不触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取详情
|
||||
if (id) {
|
||||
form.id = id
|
||||
getClassHygieneDailyData(id)
|
||||
}
|
||||
// 新增时,确保验证状态已清除
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '操作失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getClassHygieneDailyData = (id: string) => {
|
||||
loading.value = true
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
if (res.data) {
|
||||
// 处理返回数据,可能是对象或数组
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
Object.assign(form, {
|
||||
id: data.id || '',
|
||||
classCode: data.classCode || '',
|
||||
recordDate: data.recordDate || '',
|
||||
score: data.score || 0,
|
||||
note: data.note || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
// 数据加载完成后,清除验证状态,避免触发验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.clearValidate();
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getClassListData()
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
255
src/views/stuwork/classhygienedaily/index.vue
Normal file
255
src/views/stuwork/classhygienedaily/index.vue
Normal file
@@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="学院" prop="deptCode">
|
||||
<el-select
|
||||
v-model="searchForm.deptCode"
|
||||
placeholder="请选择学院"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px"
|
||||
@change="handleDeptChange">
|
||||
<el-option
|
||||
v-for="item in deptList"
|
||||
:key="item.deptCode"
|
||||
:label="item.deptName"
|
||||
:value="item.deptCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="班号" prop="classCode">
|
||||
<el-select
|
||||
v-model="searchForm.classCode"
|
||||
placeholder="请选择班号"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in filteredClassList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="searchForm.startTime"
|
||||
type="date"
|
||||
placeholder="选择开始时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="searchForm.endTime"
|
||||
type="date"
|
||||
placeholder="选择结束时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="FolderAdd"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()">
|
||||
新 增
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" align="center" />
|
||||
<el-table-column prop="deptName" label="学院" show-overflow-tooltip />
|
||||
<el-table-column prop="classNo" label="班号" show-overflow-tooltip />
|
||||
<el-table-column prop="recordDate" label="时间" show-overflow-tooltip />
|
||||
<el-table-column prop="score" label="扣分" show-overflow-tooltip />
|
||||
<el-table-column prop="note" label="检查记录" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassHygieneDaily">
|
||||
import { ref, reactive, defineAsyncComponent, computed, onMounted } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/classhygienedaily";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { getDeptList } from '/@/api/basic/basicclass'
|
||||
import { getClassListByRole } from '/@/api/basic/basicclass'
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
// 搜索变量
|
||||
const showSearch = ref(true)
|
||||
const deptList = ref<any[]>([])
|
||||
const classList = ref<any[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
deptCode: '',
|
||||
classCode: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
})
|
||||
|
||||
// 根据学院筛选班级列表
|
||||
const filteredClassList = computed(() => {
|
||||
if (!searchForm.deptCode) {
|
||||
return classList.value
|
||||
}
|
||||
return classList.value.filter((item: any) => item.deptCode === searchForm.deptCode)
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 学院选择变化
|
||||
const handleDeptChange = () => {
|
||||
// 清空班号选择
|
||||
searchForm.classCode = ''
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.formRef?.resetFields()
|
||||
searchForm.deptCode = ''
|
||||
searchForm.classCode = ''
|
||||
searchForm.startTime = ''
|
||||
searchForm.endTime = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除选中的记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids)
|
||||
useMessage().success('删除成功')
|
||||
getDataList()
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取学院列表
|
||||
const getDeptListData = async () => {
|
||||
try {
|
||||
const res = await getDeptList()
|
||||
if (res.data) {
|
||||
deptList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学院列表失败', err)
|
||||
deptList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班号列表
|
||||
const getClassListData = async () => {
|
||||
try {
|
||||
const res = await getClassListByRole()
|
||||
if (res.data) {
|
||||
classList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取班号列表失败', err)
|
||||
classList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getDeptListData()
|
||||
getClassListData()
|
||||
})
|
||||
</script>
|
||||
157
src/views/stuwork/classmasterresume/detail.vue
Normal file
157
src/views/stuwork/classmasterresume/detail.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="履历详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="1200px">
|
||||
<el-table
|
||||
:data="detailList"
|
||||
v-loading="loading"
|
||||
border
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
:header-cell-style="{ textAlign: 'center', background: 'var(--el-table-row-hover-bg-color)' }">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNoVal" label="教师工号" show-overflow-tooltip />
|
||||
<el-table-column prop="telPhone" label="联系方式" show-overflow-tooltip />
|
||||
<el-table-column prop="className" label="班级名称" show-overflow-tooltip />
|
||||
<el-table-column prop="beginTime" label="开始时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="endTime" label="结束时间" show-overflow-tooltip width="120" />
|
||||
<el-table-column prop="resumeRemark" label="履历" show-overflow-tooltip />
|
||||
<el-table-column prop="remarks" label="备注" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleEdit(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" icon="Plus" @click="handleAdd">新 增</el-button>
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑表单对话框 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="handleRefresh" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResumeDetail">
|
||||
import { ref, defineAsyncComponent } from 'vue'
|
||||
import { fetchDetailList, delObjs } from '/@/api/stuwork/classmasterresume'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
|
||||
// 引入编辑表单组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailList = ref([])
|
||||
const teacherNo = ref('')
|
||||
const formDialogRef = ref()
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (teacherNoValue: string) => {
|
||||
visible.value = true
|
||||
teacherNo.value = teacherNoValue
|
||||
getDetailList()
|
||||
};
|
||||
|
||||
// 获取详情列表
|
||||
const getDetailList = () => {
|
||||
loading.value = true
|
||||
fetchDetailList({
|
||||
teacherNo: teacherNo.value,
|
||||
current: 1,
|
||||
size: 9999
|
||||
}).then((res: any) => {
|
||||
if (res.data && res.data.records) {
|
||||
detailList.value = res.data.records
|
||||
} else if (Array.isArray(res.data)) {
|
||||
detailList.value = res.data
|
||||
} else {
|
||||
detailList.value = []
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取履历详情失败', err)
|
||||
detailList.value = []
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = (row: any) => {
|
||||
if (row && row.id) {
|
||||
// 直接使用表格行数据,不需要再次调用接口
|
||||
formDialogRef.value?.openDialog(row)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (row: any) => {
|
||||
if (!row.id) {
|
||||
useMessage().error('缺少记录ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm('确定要删除这条履历记录吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
await delObjs([row.id])
|
||||
useMessage().success('删除成功')
|
||||
getDetailList() // 刷新列表
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 新增
|
||||
const handleAdd = () => {
|
||||
// 打开新增表单,预填充教师工号
|
||||
if (teacherNo.value) {
|
||||
formDialogRef.value?.openDialog({
|
||||
teacherNo: teacherNo.value
|
||||
})
|
||||
} else {
|
||||
useMessage().error('缺少教师工号')
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新列表(编辑后)
|
||||
const handleRefresh = () => {
|
||||
getDetailList()
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
306
src/views/stuwork/classmasterresume/form.vue
Normal file
306
src/views/stuwork/classmasterresume/form.vue
Normal file
@@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑' : '新增'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
label-width="100px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="教师" prop="teacherNo">
|
||||
<el-select
|
||||
v-model="form.teacherNo"
|
||||
placeholder="请选择教师"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="handleTeacherChange">
|
||||
<el-option
|
||||
v-for="item in teacherList"
|
||||
:key="item.teacherNo"
|
||||
:label="item.realName"
|
||||
:value="item.teacherNo">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="班级" prop="classCode">
|
||||
<el-select
|
||||
v-model="form.classCode"
|
||||
placeholder="请选择班级"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="handleClassChange">
|
||||
<el-option
|
||||
v-for="item in classList"
|
||||
:key="item.classCode"
|
||||
:label="item.classNo"
|
||||
:value="item.classCode">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="开始时间" prop="beginTime">
|
||||
<el-date-picker
|
||||
v-model="form.beginTime"
|
||||
type="date"
|
||||
placeholder="选择开始时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="form.endTime"
|
||||
type="date"
|
||||
placeholder="选择结束时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="履历备注" prop="resumeRemark">
|
||||
<el-input
|
||||
v-model="form.resumeRemark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入履历备注"
|
||||
maxlength="250"
|
||||
show-word-limit />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注"
|
||||
maxlength="250"
|
||||
show-word-limit />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确 认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResumeDialog">
|
||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/stuwork/classmasterresume'
|
||||
import request from "/@/utils/request";
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const teacherList = ref([])
|
||||
const classList = ref([])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
teacherNo: '',
|
||||
teacherNoVal: '',
|
||||
telPhone: '',
|
||||
classCode: '',
|
||||
className: '',
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
resumeRemark: '',
|
||||
remarks: ''
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
teacherNo: [
|
||||
{ required: true, message: '教师不能为空', trigger: 'blur' }
|
||||
],
|
||||
classCode: [
|
||||
{ required: true, message: '班级不能为空', trigger: 'blur' }
|
||||
],
|
||||
beginTime: [
|
||||
{ required: true, message: '开始时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
endTime: [
|
||||
{ required: true, message: '结束时间不能为空', trigger: 'blur' }
|
||||
],
|
||||
resumeRemark: [
|
||||
{ required: true, message: '履历备注不能为空', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 获取教师列表
|
||||
const getTeacherList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/professional/teacherbase/TeacherBaseList',
|
||||
method: 'get'
|
||||
})
|
||||
teacherList.value = res.data || []
|
||||
} catch (err) {
|
||||
console.error('获取教师列表失败', err)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取班级列表
|
||||
const getClassList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/basic/basicclass/listByRole',
|
||||
method: 'get'
|
||||
})
|
||||
classList.value = res.data || []
|
||||
} catch (err) {
|
||||
console.error('获取班级列表失败', err)
|
||||
}
|
||||
}
|
||||
|
||||
// 教师选择变化
|
||||
const handleTeacherChange = (teacherNo: string) => {
|
||||
const teacher = teacherList.value.find((item: any) => item.teacherNo === teacherNo)
|
||||
if (teacher) {
|
||||
form.teacherNoVal = teacher.teacherNo || ''
|
||||
form.telPhone = teacher.telPhone || ''
|
||||
}
|
||||
}
|
||||
|
||||
// 班级选择变化
|
||||
const handleClassChange = (classCode: string) => {
|
||||
const classItem = classList.value.find((item: any) => item.classCode === classCode)
|
||||
if (classItem) {
|
||||
form.className = classItem.classNo || ''
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (idOrData?: string | any) => {
|
||||
visible.value = true
|
||||
|
||||
// 重置表单数据
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
teacherNo: '',
|
||||
teacherNoVal: '',
|
||||
telPhone: '',
|
||||
classCode: '',
|
||||
className: '',
|
||||
beginTime: '',
|
||||
endTime: '',
|
||||
resumeRemark: '',
|
||||
remarks: ''
|
||||
})
|
||||
|
||||
// 重置表单验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 如果传入的是对象(表格行数据),直接使用
|
||||
if (idOrData && typeof idOrData === 'object') {
|
||||
Object.assign(form, {
|
||||
id: idOrData.id || '',
|
||||
teacherNo: idOrData.teacherNo || '',
|
||||
teacherNoVal: idOrData.teacherNoVal || '',
|
||||
telPhone: idOrData.telPhone || '',
|
||||
classCode: idOrData.classCode || '',
|
||||
className: idOrData.className || '',
|
||||
beginTime: idOrData.beginTime || '',
|
||||
endTime: idOrData.endTime || '',
|
||||
resumeRemark: idOrData.resumeRemark || '',
|
||||
remarks: idOrData.remarks || ''
|
||||
})
|
||||
}
|
||||
// 如果传入的是字符串(ID),调用接口获取详情
|
||||
else if (idOrData && typeof idOrData === 'string') {
|
||||
form.id = idOrData
|
||||
getClassMasterResumeData(idOrData)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '操作失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化表单数据
|
||||
const getClassMasterResumeData = (id: string) => {
|
||||
loading.value = true
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
if (res.data) {
|
||||
// 处理返回数据,可能是数组或对象
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
// 先重置,再赋值
|
||||
Object.assign(form, {
|
||||
id: data.id || '',
|
||||
teacherNo: data.teacherNo || '',
|
||||
teacherNoVal: data.teacherNoVal || '',
|
||||
telPhone: data.telPhone || '',
|
||||
classCode: data.classCode || '',
|
||||
className: data.className || '',
|
||||
beginTime: data.beginTime || '',
|
||||
endTime: data.endTime || '',
|
||||
resumeRemark: data.resumeRemark || '',
|
||||
remarks: data.remarks || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getTeacherList()
|
||||
getClassList()
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
213
src/views/stuwork/classmasterresume/index.vue
Normal file
213
src/views/stuwork/classmasterresume/index.vue
Normal file
@@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="教师" prop="teacherNo">
|
||||
<el-select
|
||||
v-model="searchForm.teacherNo"
|
||||
placeholder="请选择教师"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in teacherList"
|
||||
:key="item.teacherNo"
|
||||
:label="item.realName"
|
||||
:value="item.teacherNo">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系方式" prop="telPhone">
|
||||
<el-input
|
||||
v-model="searchForm.telPhone"
|
||||
placeholder="请输入联系方式"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button
|
||||
icon="FolderAdd"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()"
|
||||
v-auth="'stuwork_classmasterresume_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'stuwork_classmasterresume_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="teacherNoVal" label="教师" show-overflow-tooltip />
|
||||
<el-table-column prop="teacherNo" label="工号" show-overflow-tooltip />
|
||||
<el-table-column prop="telPhone" label="联系方式" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
icon="View"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleViewDetail(scope.row)">
|
||||
查看履历详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<!-- 履历详情 -->
|
||||
<DetailDialog ref="detailDialogRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ClassMasterResume">
|
||||
import { ref, reactive, defineAsyncComponent, onMounted, nextTick } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList } from "/@/api/stuwork/classmasterresume";
|
||||
import request from "/@/utils/request";
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 尝试直接导入看看是否能解决问题
|
||||
import DetailDialog from './detail.vue';
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
const detailDialogRef = ref()
|
||||
// 搜索变量
|
||||
const showSearch = ref(true)
|
||||
// 教师列表
|
||||
const teacherList = ref<any[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
teacherNo: '',
|
||||
telPhone: ''
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 获取教师列表
|
||||
const getTeacherList = async () => {
|
||||
try {
|
||||
const res = await request({
|
||||
url: '/professional/teacherbase/TeacherBaseList',
|
||||
method: 'get'
|
||||
})
|
||||
teacherList.value = res.data || []
|
||||
} catch (err) {
|
||||
console.error('获取教师列表失败', err)
|
||||
}
|
||||
}
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.formRef?.resetFields()
|
||||
searchForm.teacherNo = ''
|
||||
searchForm.telPhone = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile(
|
||||
'/stuwork/classmasterresume/export',
|
||||
searchForm,
|
||||
'班主任履历.xlsx'
|
||||
)
|
||||
}
|
||||
|
||||
// 查看履历详情
|
||||
const handleViewDetail = async (row: any) => {
|
||||
console.log('handleViewDetail 被调用,row:', row)
|
||||
|
||||
if (!row.teacherNo) {
|
||||
console.error('缺少教师工号', row)
|
||||
return
|
||||
}
|
||||
|
||||
// 确保组件已挂载
|
||||
await nextTick()
|
||||
|
||||
console.log('nextTick 后,detailDialogRef.value:', detailDialogRef.value)
|
||||
console.log('detailDialogRef.value?.openDialog:', detailDialogRef.value?.openDialog)
|
||||
|
||||
if (detailDialogRef.value && typeof detailDialogRef.value.openDialog === 'function') {
|
||||
detailDialogRef.value.openDialog(row.teacherNo)
|
||||
} else {
|
||||
console.error('详情对话框组件未找到或 openDialog 方法不存在', {
|
||||
detailDialogRef: detailDialogRef.value,
|
||||
hasOpenDialog: detailDialogRef.value?.openDialog
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getTeacherList()
|
||||
// 调试:检查组件是否已挂载
|
||||
nextTick(() => {
|
||||
console.log('组件挂载后,detailDialogRef:', detailDialogRef.value)
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
217
src/views/stuwork/weekPlan/detail.vue
Normal file
217
src/views/stuwork/weekPlan/detail.vue
Normal file
@@ -0,0 +1,217 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="每周工作详情"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="1000px">
|
||||
<div v-loading="loading" class="article-container">
|
||||
<!-- 报纸文章样式 -->
|
||||
<div class="article-header">
|
||||
<h1 class="article-title">{{ detailData.title || '-' }}</h1>
|
||||
<div class="article-meta">
|
||||
<span class="article-author">作者:{{ detailData.author || '-' }}</span>
|
||||
<span class="article-time">{{ detailData.schoolYear || '-' }} 第{{ detailData.schoolTerm || '-' }}学期</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-content" v-html="detailData.content || '-'"></div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" icon="Edit" @click="handleEdit">编 辑</el-button>
|
||||
<el-button type="danger" icon="Delete" @click="handleDelete">删 除</el-button>
|
||||
<el-button @click="visible = false">关 闭</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑表单对话框 -->
|
||||
<FormDialog ref="formDialogRef" @refresh="handleRefresh" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WeekPlanDetail">
|
||||
import { ref, reactive, nextTick, defineAsyncComponent } from 'vue'
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { getObj, delObjs } from '/@/api/stuwork/weekPlan'
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const detailId = ref('')
|
||||
|
||||
// 详情数据
|
||||
const detailData = reactive({
|
||||
id: '',
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
title: '',
|
||||
content: '',
|
||||
author: ''
|
||||
})
|
||||
|
||||
// 打开对话框
|
||||
const openDialog = async (id: string) => {
|
||||
visible.value = true
|
||||
detailId.value = id
|
||||
await nextTick()
|
||||
getWeekPlanDetail(id)
|
||||
}
|
||||
|
||||
// 获取详情
|
||||
const getWeekPlanDetail = (id: string) => {
|
||||
loading.value = true
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
if (res.data) {
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
Object.assign(detailData, {
|
||||
id: data.id || '',
|
||||
schoolYear: data.schoolYear || '',
|
||||
schoolTerm: data.schoolTerm || '',
|
||||
title: data.title || '',
|
||||
content: data.content || '',
|
||||
author: data.author || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = () => {
|
||||
if (detailId.value) {
|
||||
formDialogRef.value?.openDialog(detailId.value)
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async () => {
|
||||
if (!detailId.value) return
|
||||
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs([detailId.value])
|
||||
useMessage().success('删除成功')
|
||||
visible.value = false
|
||||
emit('refresh')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新
|
||||
const handleRefresh = () => {
|
||||
if (detailId.value) {
|
||||
getWeekPlanDetail(detailId.value)
|
||||
}
|
||||
emit('refresh')
|
||||
}
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.article-container {
|
||||
padding: 20px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.article-header {
|
||||
border-bottom: 2px solid #e4e7ed;
|
||||
padding-bottom: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
margin: 0 0 15px 0;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
color: #909399;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.article-author {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.article-time {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
font-size: 16px;
|
||||
line-height: 1.8;
|
||||
color: #606266;
|
||||
text-align: justify;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.article-content :deep(p) {
|
||||
margin: 0 0 15px 0;
|
||||
}
|
||||
|
||||
.article-content :deep(img) {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.article-content :deep(h1),
|
||||
.article-content :deep(h2),
|
||||
.article-content :deep(h3),
|
||||
.article-content :deep(h4),
|
||||
.article-content :deep(h5),
|
||||
.article-content :deep(h6) {
|
||||
margin: 20px 0 15px 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.article-content :deep(ul),
|
||||
.article-content :deep(ol) {
|
||||
margin: 15px 0;
|
||||
padding-left: 30px;
|
||||
}
|
||||
|
||||
.article-content :deep(blockquote) {
|
||||
border-left: 4px solid #409eff;
|
||||
padding-left: 15px;
|
||||
margin: 15px 0;
|
||||
color: #909399;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,80 +1,43 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-dialog
|
||||
:title="form.id ? '编辑' : '新增'"
|
||||
v-model="visible"
|
||||
:close-on-click-modal="false"
|
||||
draggable
|
||||
width="800px">
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="form"
|
||||
:rules="dataRules"
|
||||
label-width="100px"
|
||||
v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="创建人" prop="createBy">
|
||||
<el-input v-model="form.createBy" placeholder="请输入创建人"/>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input
|
||||
v-model="form.title"
|
||||
placeholder="请输入标题"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-input v-model="form.createTime" placeholder="请输入创建时间"/>
|
||||
<el-form-item label="内容" prop="content">
|
||||
<Editor
|
||||
v-model:get-html="form.content"
|
||||
height="400"
|
||||
placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="更新人" prop="updateBy">
|
||||
<el-input v-model="form.updateBy" placeholder="请输入更新人"/>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input
|
||||
v-model="form.author"
|
||||
placeholder="请输入作者"
|
||||
clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="更新时间" prop="updateTime">
|
||||
<el-input v-model="form.updateTime" placeholder="请输入更新时间"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="删除标记" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标记"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="租户ID" prop="tenantId">
|
||||
<el-input v-model="form.tenantId" placeholder="请输入租户ID"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="备注" prop="REMARKS">
|
||||
<el-input v-model="form.remarks" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-input v-model="form.schoolYear" placeholder="请输入学年"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input v-model="form.schoolTerm" placeholder="请输入学期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="标题" prop="TITLE">
|
||||
<el-input v-model="form.title" placeholder="请输入标题"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="内容" prop="CONTENT">
|
||||
<el-input v-model="form.content" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="作者" prop="AUTHOR">
|
||||
<el-input v-model="form.author" placeholder="请输入作者"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
@@ -87,50 +50,93 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="WeekPlanDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { ref, reactive, nextTick, onMounted } from 'vue'
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj, validateExist } from '/@/api/stuwork/weekPlan'
|
||||
import { rule } from '/@/utils/validate';
|
||||
import { getObj, addObj, putObj } from '/@/api/stuwork/weekPlan'
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
import Editor from '/@/components/Editor/index.vue'
|
||||
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const schoolYearList = ref<any[]>([])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id: '',
|
||||
createBy: '',
|
||||
createTime: '',
|
||||
updateBy: '',
|
||||
updateTime: '',
|
||||
delFlag: '',
|
||||
tenantId: '',
|
||||
REMARKS: '',
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
title: '',
|
||||
content: '',
|
||||
author: '',
|
||||
author: ''
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
schoolYear: [
|
||||
{ required: false, message: '学年不能为空', trigger: 'blur' }
|
||||
],
|
||||
schoolTerm: [
|
||||
{ required: false, message: '学期不能为空', trigger: 'blur' }
|
||||
],
|
||||
title: [
|
||||
{ required: true, message: '标题不能为空', trigger: 'blur' }
|
||||
],
|
||||
content: [
|
||||
{ required: true, message: '内容不能为空', trigger: 'blur' }
|
||||
],
|
||||
author: [
|
||||
{ required: true, message: '作者不能为空', trigger: 'blur' }
|
||||
]
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
const openDialog = async (id?: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
Object.assign(form, {
|
||||
id: '',
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
title: '',
|
||||
content: '',
|
||||
author: ''
|
||||
})
|
||||
|
||||
// 确保学年列表已加载
|
||||
if (schoolYearList.value.length === 0) {
|
||||
await getSchoolYearList()
|
||||
}
|
||||
|
||||
// 如果是新增,设置学年为列表中的第一条数据,学期默认为1
|
||||
if (!id) {
|
||||
// 设置学年为列表中的第一条数据
|
||||
if (schoolYearList.value.length > 0) {
|
||||
form.schoolYear = schoolYearList.value[0].year
|
||||
}
|
||||
// 设置学期默认为1
|
||||
form.schoolTerm = '1'
|
||||
} else {
|
||||
// 编辑时,如果没有学年,也设置默认值
|
||||
if (!form.schoolYear && schoolYearList.value.length > 0) {
|
||||
form.schoolYear = schoolYearList.value[0].year
|
||||
}
|
||||
// 编辑时,如果没有学期,设置默认为1
|
||||
if (!form.schoolTerm) {
|
||||
form.schoolTerm = '1'
|
||||
}
|
||||
}
|
||||
|
||||
// 重置表单验证
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取weekPlan信息
|
||||
// 获取详情
|
||||
if (id) {
|
||||
form.id = id
|
||||
getWeekPlanData(id)
|
||||
@@ -144,28 +150,60 @@ const onSubmit = async () => {
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.ID ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.ID ? '修改成功' : '添加成功');
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg || '操作失败');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getWeekPlanData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj({ID: id}).then((res: any) => {
|
||||
Object.assign(form, res.data[0])
|
||||
getObj({ id: id }).then((res: any) => {
|
||||
if (res.data) {
|
||||
// 处理返回数据,可能是对象或数组
|
||||
const data = Array.isArray(res.data) ? res.data[0] : res.data
|
||||
if (data) {
|
||||
Object.assign(form, {
|
||||
id: data.id || '',
|
||||
schoolYear: data.schoolYear || '',
|
||||
schoolTerm: data.schoolTerm || '',
|
||||
title: data.title || '',
|
||||
content: data.content || '',
|
||||
author: data.author || ''
|
||||
})
|
||||
}
|
||||
}
|
||||
}).catch((err: any) => {
|
||||
console.error('获取详情失败', err)
|
||||
useMessage().error('获取详情失败')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
if (res.data) {
|
||||
schoolYearList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学年列表失败', err)
|
||||
schoolYearList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getSchoolYearList()
|
||||
})
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
|
||||
@@ -1,90 +1,156 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<!-- 搜索表单 -->
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="searchForm" ref="searchFormRef" :inline="true" @keyup.enter="handleSearch">
|
||||
<el-form-item label="学年" prop="schoolYear">
|
||||
<el-select
|
||||
v-model="searchForm.schoolYear"
|
||||
placeholder="请选择学年"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 200px">
|
||||
<el-option
|
||||
v-for="item in schoolYearList"
|
||||
:key="item.year"
|
||||
:label="item.year"
|
||||
:value="item.year">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学期" prop="schoolTerm">
|
||||
<el-input
|
||||
v-model="searchForm.schoolTerm"
|
||||
placeholder="请输入学期"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作者" prop="author">
|
||||
<el-input
|
||||
v-model="searchForm.author"
|
||||
placeholder="请输入作者"
|
||||
clearable
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" plain icon="Search" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="Refresh" @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'stuwork_weekPlan_add'">
|
||||
<el-button
|
||||
icon="FolderAdd"
|
||||
type="primary"
|
||||
class="ml10"
|
||||
@click="formDialogRef.openDialog()">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain icon="upload-filled" type="primary" class="ml10" @click="excelUploadRef.show()" v-auth="'sys_user_add'">
|
||||
导 入
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'stuwork_weekPlan_del'" @click="handleDelete(selectObjs)">
|
||||
删 除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'stuwork_weekPlan_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
:export="'stuwork_weekPlan_export'"
|
||||
@exportExcel="exportExcel"
|
||||
class="ml10 mr20"
|
||||
style="float: right;"
|
||||
@queryTable="getDataList">
|
||||
</right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
:data="state.dataList"
|
||||
v-loading="state.loading"
|
||||
border
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="createBy" label="创建人" show-overflow-tooltip/>
|
||||
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateBy" label="更新人" show-overflow-tooltip/>
|
||||
<el-table-column prop="updateTime" label="更新时间" show-overflow-tooltip/>
|
||||
<el-table-column prop="delFlag" label="删除标记" show-overflow-tooltip/>
|
||||
<el-table-column prop="tenantId" label="租户ID" show-overflow-tooltip/>
|
||||
<el-table-column prop="REMARKS" label="备注" show-overflow-tooltip/>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="schoolYear" label="学年" show-overflow-tooltip />
|
||||
<el-table-column prop="schoolTerm" label="学期" show-overflow-tooltip />
|
||||
<el-table-column prop="TITLE" label="标题" show-overflow-tooltip/>
|
||||
<el-table-column prop="CONTENT" label="内容" show-overflow-tooltip/>
|
||||
<el-table-column prop="AUTHOR" label="作者" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<el-table-column prop="title" label="标题" show-overflow-tooltip />
|
||||
<el-table-column prop="content" label="内容" show-overflow-tooltip />
|
||||
<el-table-column prop="author" label="作者" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'stuwork_weekPlan_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'stuwork_weekPlan_del'" @click="handleDelete([scope.row.ID])">删除</el-button>
|
||||
<el-button
|
||||
icon="View"
|
||||
text
|
||||
type="primary"
|
||||
@click="handleViewDetail(scope.row.id)">
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Edit"
|
||||
text
|
||||
type="primary"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="Delete"
|
||||
text
|
||||
type="danger"
|
||||
@click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<FormDialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
<!-- 导入excel (需要在 upms-biz/resources/file 下维护模板) -->
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
title="导入"
|
||||
url="/stuwork/weekPlan/import"
|
||||
temp-url="/admin/sys-file/local/file/weekPlan.xlsx"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<!-- 详情对话框 -->
|
||||
<DetailDialog ref="detailDialogRef" @refresh="getDataList(false)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemWeekPlan">
|
||||
<script setup lang="ts" name="WeekPlan">
|
||||
import { ref, reactive, defineAsyncComponent, onMounted, nextTick } from 'vue'
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/stuwork/weekPlan";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { queryAllSchoolYear } from '/@/api/basic/basicyear'
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
const DetailDialog = defineAsyncComponent(() => import('./detail.vue'));
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
const excelUploadRef = ref();
|
||||
const detailDialogRef = ref()
|
||||
const searchFormRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
const schoolYearList = ref<any[]>([])
|
||||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
schoolYear: '',
|
||||
schoolTerm: '',
|
||||
author: ''
|
||||
})
|
||||
|
||||
// 配置 useTable
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
queryForm: searchForm,
|
||||
pageList: fetchList,
|
||||
props: {
|
||||
item: 'records',
|
||||
totalCount: 'total'
|
||||
}
|
||||
})
|
||||
|
||||
// table hook
|
||||
@@ -97,40 +163,71 @@ const {
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchFormRef.value?.resetFields()
|
||||
searchForm.schoolYear = ''
|
||||
searchForm.schoolTerm = ''
|
||||
searchForm.author = ''
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/stuwork/weekPlan/export', Object.assign(state.queryForm, { ids: selectObjs }), 'weekPlan.xlsx')
|
||||
downBlobFile(
|
||||
'/stuwork/weekPlan/export',
|
||||
searchForm,
|
||||
'每周工作.xlsx'
|
||||
)
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { ID: string }[]) => {
|
||||
selectObjs.value = objs.map(({ ID }) => ID);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
// 查看详情
|
||||
const handleViewDetail = async (id: string) => {
|
||||
await nextTick()
|
||||
detailDialogRef.value?.openDialog(id)
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm('此操作将永久删除', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success('删除成功')
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg || '删除失败')
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 获取学年列表
|
||||
const getSchoolYearList = async () => {
|
||||
try {
|
||||
const res = await queryAllSchoolYear()
|
||||
if (res.data) {
|
||||
schoolYearList.value = Array.isArray(res.data) ? res.data : []
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('获取学年列表失败', err)
|
||||
schoolYearList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getSchoolYearList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -19,6 +19,7 @@ const pathResolve = (dir: string) => {
|
||||
|
||||
const alias: Record<string, string> = {
|
||||
'/@': pathResolve('./src/'),
|
||||
'@': pathResolve('./src/'), // 添加这一行
|
||||
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user