Files
zhxg_pc/src/views/routine/dis/basic/index.vue
2025-12-09 15:20:41 +08:00

575 lines
19 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<h1 style="font-size: 30px;text-align: center;">个人信息填写</h1>
<div class="stylecard">
<el-card class="box-card1">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="学号" prop="stId" :rules="rules.reason1">
<el-input v-model="form.stId" placeholder="请输入学号" @blur="changeGet" />
</el-form-item>
<!-- <el-form-item label="学生编号" prop="studentId" >
<el-input v-model="form.studentId" placeholder="" disabled />
</el-form-item> -->
<el-form-item label="姓名" prop="stName" :rules="rules.reason2">
<el-input v-model="form.stName" placeholder="请输入姓名" />
</el-form-item>
<!-- <el-form-item label="辅导员名字" prop="fdName" :rules="rules.reason3">
<el-input v-model="form.fdName" placeholder="请输入辅导员名字" />
</el-form-item> -->
<el-form-item label="性别" prop="sex" :rules="rules.reason4">
<el-select v-model="form.sex" placeholder="请选择性别">
<el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="民族" prop="nations" :rules="rules.reason5">
<!-- <el-input v-model="form.nations" placeholder="请输入民族" /> -->
<el-select v-model="form.nations" placeholder="请选择民族">
<el-option v-for="dict in dict.type.rt_nation" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="班级" prop="stClass" :rules="rules.reason6">
<el-input v-model="form.stClass" placeholder="请输入班级" />
</el-form-item>
<el-form-item label="专业" prop="majors" :rules="rules.reason7">
<el-input v-model="form.majors" placeholder="请输入专业" />
</el-form-item>
<el-form-item label="年级" prop="grade" :rules="rules.reason8">
<el-input v-model="form.grade" placeholder="请输入年级" />
</el-form-item>
<el-form-item label="学院" prop="college" :rules="rules.reason9">
<!-- <el-input v-model="form.college" placeholder="请输入学院" /> -->
<el-select v-model="form.college" placeholder="请选择学院" :rules="rules.reason10">
<el-option v-for="dict in dict.type.rt_filling_college" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="原因" prop="reasons" :rules="rules.reason10">
<el-input v-model="form.reasons" placeholder="请输入原因" type="textarea" />
</el-form-item>
<el-form-item label="时间" prop="times" :rules="rules.reason11">
<!-- <el-input v-model="form.times" placeholder="请输入时间" /> -->
<el-date-picker v-model="form.times" clearable type="date" value-format="yyyy-MM-dd"
placeholder="请选择填报时间" />
</el-form-item>
<!-- 入伍时间 -->
<el-form-item label="入伍时间" prop="rwTime" :rules="rules.reason11">
<el-date-picker v-model="form.rwTime" clearable type="date" value-format="yyyy-MM-dd"
placeholder="请选择填报时间" />
</el-form-item>
<!-- 退伍时间 -->
<el-form-item label="退伍时间" prop="dataa" :rules="rules.reason11">
<!-- <el-input v-model="form.dataa" placeholder="请输入" /> -->
<el-date-picker v-model="form.dataa" clearable type="date" value-format="yyyy-MM-dd"
placeholder="请选择填报时间" />
</el-form-item>
<!-- 手机号 -->
<el-form-item label="手机号" prop="datab" :rules="rules.reason13">
<el-input v-model="form.datab" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="专业转换" prop="conversion" :rules="rules.reason12">
<el-select v-model="form.conversion" placeholder="请选择专业转换">
<el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</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-card>
</div>
<div slot="footer" class="stylecard">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</div>
</template>
<script>
import { listBasic, getBasic, delBasic, addBasic, updateBasic } from "@/api/routine/basic";
import { listMate, getMate, delMate, addMate, updateMate } from "@/api/routine/mate";
import { getStudentInfoByStuId } from '@/api/routine/stuIdReissue'
import { getUserProfile } from '@/api/system/user' // 获取
// 获取学生信息
import { addStudent, delStudent, doDept, getClassName, getStatus, getStudent, initOnePwd, initPwd, listStudent, updateStudent } from '@/api/stuCQS/basedata/student'
import { log } from "vxe-table";
export default {
name: "Basic",
dicts: ['sys_yes_no', 'sys_user_sex', 'rt_filling_college', 'sys_commit_status', 'sys_teacher_kpi_filling_year', 'rt_nation', 'rt_classes'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 退伍复学申请表格数据
basicList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
studentId:null,
fxId: null,
fxTime: null,
stId: null,
stName: null,
fdName: null,
sex: null,
nations: null,
fdQm: null,
xwQm: null,
erQm: null,
xjQm: null,
jwQm: null,
stClass: null,
majors: null,
grade: null,
college: null,
reasons: null,
fdIdea: null,
twoIdea: null,
xwIdea: null,
xjIdea: null,
jwIdea: null,
zsIdea: null,
zsStatus: null,
times: null,
fdStatus: null,
xwStatus: null,
twoStatus: null,
xjglStatus: null,
jwStatus: null,
rwTime: null,
zsTime: null,
fdTime: null,
xwTime: null,
twoTime: null,
xjTime: null,
jwTime: null,
datab: null,
dataa: null,
conversion: null,
processId: null,
deployId: null
},
// 表单参数
form: {},
// 表单校验
rules: {
reason1: [
{ required: true, message: '学号不能为空', trigger: 'blur' },
],
reason2: [
{ required: true, message: '姓名不能为空', trigger: 'blur' },
],
reason3: [
{ required: true, message: '辅导员不能为空', trigger: 'blur' },
],
reason4: [
{ required: true, message: '请选择性别', trigger: 'blur' },
],
reason5: [
{ required: true, message: '请选择民族', trigger: 'blur' },
],
reason6: [
{ required: true, message: '请输入班级', trigger: 'blur' },
],
reason7: [
{ required: true, message: '请输入专业', trigger: 'blur' },
],
reason8: [
{ required: true, message: '请输入年级', trigger: 'blur' },
],
reason9: [
{ required: true, message: '请选择学院', trigger: 'blur' },
],
reason10: [
{ required: true, message: '请填写原因', trigger: 'blur' },
],
reason11: [
{ required: true, message: '请选择时间', trigger: 'blur' },
],
reason12: [
{ required: true, message: '请选择是否专业转换', trigger: 'blur' },
],
reason13: [
{ required: true, message: '请输入联系电话', trigger: 'blur' },
{ pattern: /^1[3-9]\d{9}$/, message: '请输入有效的手机号码', trigger: 'blur' }
],
}
};
},
created() {
// this.getList();
this.getUser()
this.showData()
},
methods: {
// 获取当前登录信息
getUser() {
this.loading = true
getUserProfile().then(response => {
// this.user = response.data;
this.roleGroup = response.roleGroup
// this.postGroup = response.postGroup;
// console.log(response);
console.log(response.data)
this.form.studentId = response.data.userId
// this.loading = false
this.getList();
})
},
// 修改数据
showData() {
if (this.$route.query.id != undefined) {
console.log(this.$route.query.id)
getBasic(this.$route.query.id).then((response) => {
this.form = response.data
// this.active = response.data.status + 1;
})
}
},
// 填写学号时自动获取其他信息
// changeGet() {
// this.form.stuId = this.form.stId ? this.form.stId : this.$route.query.stId
// getStudentInfoByStuId(this.form.stuId).then(response => {
// if (response.data == null) {
// this.$message.error('学号不存在')
// return
// }
// this.form = response.data
// console.log(this.form)
// this.form.stId = response.data.stuNo
// this.form.stName = response.data.studentName
// this.form.college = response.data.departmentName
// this.majors = response.data.className
// this.form.sex = response.data.gender
// this.form.grade = response.data.gradeName
// })
// },
// 填写学号时自动获取其他信息 + 同步赋值studentId
changeGet() {
// 1. 先确定stId优先取form.stId无则取路由参数
this.form.stuId = this.form.stId ? this.form.stId : this.$route.query.stId;
// 2. 并行请求:同时获取学生信息和登录用户信息(提升效率)
Promise.all([
// 请求1根据stuId获取学生信息
getStudentInfoByStuId(this.form.stuId),
// 请求2获取登录用户信息用于赋值studentId
getUserProfile()
]).then(([studentRes, userRes]) => {
// 处理学生信息请求的结果
if (studentRes.data == null) {
this.$message.error('学号不存在');
return;
}
// 赋值学生信息到form
this.form = studentRes.data;
this.form.stId = studentRes.data.stuNo;
this.form.stName = studentRes.data.studentName;
this.form.college = studentRes.data.departmentName;
this.majors = studentRes.data.className;
this.form.sex = studentRes.data.gender;
this.form.grade = studentRes.data.gradeName;
listStudent({pageNum:1,pageSize:10,name:this.form.stName}).then(response => {
this.form.studentId = response.rows[0].stuId
// console.log(this.form.studentId)
})
// 处理登录用户信息请求的结果赋值studentId
// this.form.studentId = userRes.data.userId; // 核心把userId赋值给studentId
// console.log("学生信息+studentId已完成赋值", this.form);
}).catch(err => {
// 捕获请求异常
console.error("请求失败:", err);
this.$message.error('数据获取失败,请重试');
});
},
/** 查询退伍复学申请列表 */
getList() {
this.loading = true;
listBasic(this.queryParams).then(response => {
this.basicList = response.rows;
this.total = response.total;
this.loading = false;
console.log(this.basicList)
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
fxId: null,
fxTime: null,
stId: null,
stName: null,
fdName: null,
sex: null,
nations: null,
fdQm: null,
xwQm: null,
erQm: null,
xjQm: null,
jwQm: null,
stClass: null,
majors: null,
grade: null,
college: null,
reasons: null,
fdIdea: null,
twoIdea: null,
xwIdea: null,
xjIdea: null,
jwIdea: null,
zsIdea: null,
zsStatus: null,
times: null,
fdStatus: null,
xwStatus: null,
twoStatus: null,
xjglStatus: null,
jwStatus: null,
rwTime: null,
zsTime: null,
fdTime: null,
xwTime: null,
twoTime: null,
xjTime: null,
jwTime: null,
datab: null,
dataa: null,
conversion: null,
processId: null,
deployId: null,
studentId: null,
testData: null,
testTest: 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
getBasic(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) {
// 重置状态
this.form.zsStatus=0
this.form.fdStatus=0
this.form.xwStatus=0
this.form.twoStatus=0
this.form.Status=0
this.form.jwStatus=0
this.form.fdIdea=""
this.form.xwIdeaI=""
this.form.twoIdea=""
this.form.xjIdea=""
this.form.jwIdea=""
updateBasic(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.dataform = {
id: null,
stId: this.form.stId,
stName: this.form.stName,
times: null,
college: this.form.college,
oldgrade: this.form.grade,
oldmajor: this.form.majors,
newgrade: null,
newmajor: null,
proof: null,
idcard: null,
material: null,
data1: null,
data2: null
};
addMate(this.dataform).then(response => {
this.open = false;
this.getList();
});
if (this.form.conversion == "N") {
this.$router.push({
path: '/routine/dis/appli',
})
} else {
this.$router.push({
path: '/routine/dis/disma',
})
}
});
} else {
addBasic(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
console.log(this.form.stId)
this.dataform = {
id: null,
stId: this.form.stId,
stName: this.form.stName,
times: null,
college: this.form.college,
oldgrade: this.form.grade,
oldmajor: this.form.majors,
newgrade: null,
newmajor: null,
proof: null,
idcard: null,
material: null,
data1: null,
data2: null
};
addMate(this.dataform).then(response => {
this.open = false;
this.getList();
});
if (this.form.conversion == "N") {
this.$router.push({
path: '/routine/dis/appli',
})
} else {
this.$router.push({
path: '/routine/dis/disma',
})
}
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除退伍复学申请编号为"' + ids + '"的数据项?').then(function () {
return delBasic(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('routine/basic/export', {
...this.queryParams
}, `basic_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style>
.box-card1 {
width: 600px;
max-width: 100%;
/* 新增:适配小屏幕,避免溢出 */
text-align: center;
margin: 0 auto;
/* 替代原margin-left实现水平居中更优雅 */
padding: 20px;
/* 新增:内边距,提升内容呼吸感 */
background-color: #fff;
/* 新增:卡片背景色 */
border-radius: 8px;
/* 新增:圆角,增强视觉友好度 */
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
/* 新增:阴影,突出卡片层次 */
box-sizing: border-box;
/* 新增保证width包含padding和border */
white-space: nowrap
}
.stylecard {
display: flex;
align-items: center;
justify-content: center;
}
</style>