school_website/ruoyi-ui/src/views/hit/teacherInfo/index.vue
2025-02-19 18:02:19 +08:00

350 lines
12 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="教师姓名" prop="teacherName">
<el-input
v-model="queryParams.teacherName"
placeholder="请输入教师姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="赛区" prop="division">
<el-select v-model="queryParams.division" filterable allow-create default-first-option
placeholder="请选择赛区">
<el-option v-for="item in dict.type.com_region" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="queryParams.type"
placeholder="请选择类型">
<el-option key="0" label="指导老师"
value="0">
</el-option>
<el-option key="1" label="领队老师"
value="1">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="学校名称" prop="schoolName">
<el-input
v-model="queryParams.schoolName"
placeholder="请输入学校名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="teacherNumber">
<el-input
v-model="queryParams.teacherNumber"
placeholder="请输入教师手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="年份" prop="year">
<el-date-picker
v-model="queryParams.year"
type="year"
placeholder="选择年份"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="HitRegistrationTeachInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="赛区" align="center" prop="division" />
<el-table-column label="学校" align="center" prop="schoolName" />
<el-table-column label="教师姓名" align="center" prop="teacherName" />
<el-table-column label="教师职务" align="center" prop="teacherJob" />
<el-table-column label="教师手机号" align="center" prop="teacherNumber" />
<el-table-column label="教师email" align="center" prop="teacherEmail" />
<el-table-column label="教师所在系及专业" align="center" prop="teacherSchool" />
<el-table-column label="类型" align="center" prop="type" >
<template slot-scope="scope">
<div v-if="scope.row.type==0">指导老师</div>
<div v-else>领队老师</div>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div v-if="scope.row.status==0">待审核</div>
<div style="color:green" v-else-if="scope.row.status==1">审核通过</div>
<div style="color:red" v-else>审核拒绝</div>
</template>
</el-table-column>
<el-table-column label="附件" align="center" prop="file" >
<template slot-scope="scope">
<el-link :href="`${baseUrl}${scope.row.file}`" type="primary" :underline="false" target="_blank" v-if="scope.row.file">
<span class="el-icon-document"> 下载 </span>
</el-link>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
v-if="scope.row.status==0"
@click="auditRecord(scope.row,1)"
>通过</el-button>
<el-button
size="mini"
type="text"
v-if="scope.row.status==0"
@click="auditRecord(scope.row,1)"
>拒绝</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改教师信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="教师姓名" prop="teacherName">
<el-input v-model="form.teacherName" placeholder="请输入教师姓名" />
</el-form-item>
<el-form-item label="教师职务" prop="teacherJob">
<el-input v-model="form.teacherJob" placeholder="请输入教师职务" />
</el-form-item>
<el-form-item label="教师手机号" prop="teacherNumber">
<el-input v-model="form.teacherNumber" placeholder="请输入教师手机号" />
</el-form-item>
<el-form-item label="教师email" prop="teacherEmail">
<el-input v-model="form.teacherEmail" placeholder="请输入教师email" />
</el-form-item>
<el-form-item label="教师所在系及专业" prop="teacherSchool">
<el-input v-model="form.teacherSchool" placeholder="请输入教师所在系及专业" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listHitRegistrationTeachInfo, getHitRegistrationTeachInfo, delHitRegistrationTeachInfo, addHitRegistrationTeachInfo, updateHitRegistrationTeachInfo } from "@/api/hit/teacherInfo";
export default {
name: "HitRegistrationTeachInfo",
dicts: ["com_region"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
baseUrl: process.env.VUE_APP_BASE_API,
// 总条数
total: 0,
// 教师信息表格数据
HitRegistrationTeachInfoList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
teacherName: null,
teacherNumber: null,
type: null,
year: new Date().getFullYear().toString(),
},
// 表单参数
form: {},
// 表单校验
rules: {
teacherName: [
{ required: true, message: "教师姓名不能为空", trigger: "blur" }
],
teacherJob: [
{ required: true, message: "教师职务不能为空", trigger: "blur" }
],
teacherNumber: [
{ required: true, message: "教师手机号不能为空", trigger: "blur" }
],
teacherEmail: [
{ required: true, message: "教师email不能为空", trigger: "blur" }
],
teacherSchool: [
{ required: true, message: "教师所在系及专业不能为空", trigger: "blur" }
],
delFlag: [
{ required: true, message: "逻辑删除0未删除1真删除不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询教师信息列表 */
getList() {
this.loading = true;
this.queryParams.year = new Date(this.queryParams.year).getFullYear().toString()
listHitRegistrationTeachInfo(this.queryParams).then(response => {
this.HitRegistrationTeachInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
hitRegId: null,
teacherName: null,
teacherJob: null,
teacherNumber: null,
teacherEmail: null,
teacherSchool: null,
remark: null,
delFlag: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null,
type: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加教师信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getHitRegistrationTeachInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改教师信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateHitRegistrationTeachInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addHitRegistrationTeachInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
auditRecord(data,status){
data.status = status
updateHitRegistrationTeachInfo(data).then(response => {
this.$modal.msgSuccess("成功");
}).finally(res=>{
this.getList();
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除教师信息编号为"' + ids + '"的数据项?').then(function() {
return delHitRegistrationTeachInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('HitRegistrationTeachInfo/HitRegistrationTeachInfo/export', {
...this.queryParams
}, `HitRegistrationTeachInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>