Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -59,3 +59,14 @@ export function stuDel(id){
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
//根据学号获取学生原宿舍信息
|
||||
export function getStuDom(studentNo) {
|
||||
return request({
|
||||
url: '/dormitory/application/studentDormitoryInfo/',
|
||||
method: 'get',
|
||||
params: {
|
||||
studentNo
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<!-- 详情对话框 -->
|
||||
<el-dialog title="查看" :visible.sync="lookV" width="700px" append-to-body>
|
||||
<el-form ref="lookForm" :model="lookForm" label-width="120px">
|
||||
<el-form-item label="学号" prop="stuNo">
|
||||
|
||||
@@ -22,6 +22,13 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddApply">新增申请</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="applicationList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="编号" align="center" prop="id" />
|
||||
@@ -53,6 +60,11 @@
|
||||
<span v-if="scope.row.fdyStatus == 0">审核</span>
|
||||
<span v-else>查看</span>
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.taskNum != 0" size="mini" type="text" icon="el-icon-view"
|
||||
@click="lookTask(scope.row)"
|
||||
>
|
||||
<span>查看学生调宿计划</span>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -61,8 +73,8 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改宿舍管理申请对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<!-- 原辅导员审批宿舍管理申请对话框 -->
|
||||
<!-- <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
|
||||
<el-form ref="form" class="audit-form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="学号" prop="stuNo">
|
||||
<el-input v-model="form.stuNo" readonly />
|
||||
@@ -88,7 +100,7 @@
|
||||
<el-form-item v-if="form.type == 1" label="新校区" prop="tarBuilding">
|
||||
<el-input v-if="dormitoryInfo.length != 0" v-model="this.dormitoryInfo.campusName" readonly />
|
||||
<el-select v-else v-model="form.campusId" @change="campusChange">
|
||||
<el-option v-for="item in campusList" :value="item.id" :label="item.name" />
|
||||
<el-option v-for="item in campusList" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type == 1" label="新园区" prop="tarBuilding">
|
||||
@@ -96,7 +108,7 @@
|
||||
<el-select v-else v-model="form.parkId" placeholder="请先选择校区" :disabled="parkList.length == 0"
|
||||
@change="parkChange"
|
||||
>
|
||||
<el-option v-for="item in parkList" :value="item.id" :label="item.parkName" />
|
||||
<el-option v-for="item in parkList" :key="item.id" :value="item.id" :label="item.parkName" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type == 1" label="新宿舍楼" prop="tarBuilding">
|
||||
@@ -106,7 +118,7 @@
|
||||
<el-select v-else v-model="form.tarBuildingId" placeholder="请先选择园区"
|
||||
:disabled="buildingList.length == 0" @change="buildingChange"
|
||||
>
|
||||
<el-option v-for="item in buildingList" :value="item.id" :label="item.name" />
|
||||
<el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -143,22 +155,128 @@
|
||||
<el-button v-if="this.form.status == 0" type="primary" @click="submitForm">同 意</el-button>
|
||||
<el-button v-if="this.form.status == 0" @click="cancel">拒 绝</el-button>
|
||||
</div>
|
||||
</el-dialog> -->
|
||||
|
||||
<!-- 查看学生调宿计划对话框 -->
|
||||
<el-dialog :visible.sync="taskV" title="查看学生调宿计划" width="90%">
|
||||
<el-table :data="task_list">
|
||||
<el-table-column label="学号" align="center" prop="stuNo" width="100" />
|
||||
<el-table-column label="姓名" align="center" prop="stuName" />
|
||||
<el-table-column label="旧宿舍" align="center" prop="oldDorm" width="200" />
|
||||
<el-table-column label="新宿舍" align="center" prop="newDorm" width="200" />
|
||||
<el-table-column label="任务类型" align="center" prop="taskType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.dms_change_status" :value="scope.row.taskType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务预执行日期" align="center" prop="taskWant" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.taskWant, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务执行时间" align="center" prop="taskRun" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.taskRun) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="任务执行状态" align="center" prop="taskStatus">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.dms_task_status" :value="scope.row.taskStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 新增申请对话框 -->
|
||||
<el-dialog :title="applyTitle" :visible.sync="applyOpen" width="700px" append-to-body>
|
||||
<el-form ref="applyForm" :model="applyForm" :rules="applyRules" label-width="100px">
|
||||
<el-form-item label="申请类型" prop="type">
|
||||
<el-select v-model="applyForm.type" @change="handleApplyTypeChange">
|
||||
<el-option :value="1" label="调宿申请" />
|
||||
<el-option :value="2" label="退宿申请" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="学号" prop="stuNo">
|
||||
<el-input v-model="applyForm.stuNo" style="width: 70%; display: inline-block;" />
|
||||
<el-button type="primary" style="margin-left: 10px;" @click="fetchStudentInfo">查询</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="姓名" prop="stuName">
|
||||
<el-input v-model="applyForm.stuName" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-input v-model="applyForm.gender" readonly />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="执行时间" prop="time" v-if="applyForm.type !== 3">
|
||||
<el-date-picker
|
||||
v-model="applyForm.time"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择执行时间"
|
||||
:picker-options="{ disabledDate: time => time.getTime() < new Date(new Date().setHours(0, 0, 0, 0)).getTime() }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="原宿舍楼" prop="currBuilding">
|
||||
<el-input v-model="applyForm.currBuilding" readonly />
|
||||
</el-form-item>
|
||||
<el-form-item label="原宿舍" prop="currRoomNo">
|
||||
<el-input v-model="applyForm.currRoomNo" readonly />
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="applyForm.type === 1">
|
||||
<el-form-item label="新校区" prop="campusId">
|
||||
<el-select v-model="applyForm.campusId" @change="campusChangeApply">
|
||||
<el-option v-for="item in campusListApply" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="新园区" prop="parkId">
|
||||
<el-select v-model="applyForm.parkId" :disabled="parkListApply.length === 0" @change="parkChangeApply">
|
||||
<el-option v-for="item in parkListApply" :key="item.id" :value="item.id" :label="item.parkName" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="新宿舍楼" prop="tarBuildingId">
|
||||
<el-select v-model="applyForm.tarBuildingId" :disabled="buildingListApply.length === 0" @change="buildingChangeApply">
|
||||
<el-option v-for="item in buildingListApply" :key="item.id" :value="item.id" :label="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="新宿舍" prop="targetDormId">
|
||||
<el-select v-model="applyForm.targetDormId" style="width:300px" :disabled="dormitoryListApply.length === 0" filterable>
|
||||
<el-option v-for="(v, i) in dormitoryListApply" :key="i" :value="v.id"
|
||||
:label="v.roomNo + ' -- ' + v.gender + ' -- 床位 ' + v.bedNum + ' -- 已住 ' + v.occupancy + ' -- 任务中 ' + (parseInt(v.taskNum) + parseInt(v.manageNum))"
|
||||
:disabled="v.bedNum <= (parseInt(v.occupancy) + (parseInt(v.taskNum) + parseInt(v.manageNum)))"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item label="申请理由" prop="reason">
|
||||
<el-input v-model="applyForm.reason" type="textarea" autosize placeholder="请输入申请理由" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitApplyForm">提 交</el-button>
|
||||
<el-button @click="cancelApply">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listApplication, getApplication, delApplication, addApplication, updateApplication } from '@/api/dormitory/accommodation-management/application'
|
||||
import { listApplication, getApplication, delApplication, addApplication, updateApplication, getStuDom } from '@/api/dormitory/accommodation-management/application'
|
||||
import { getAllDormList, getDormitory } from '@/api/dormitory/basedata/dormitory'
|
||||
import { listBuilding } from '@/api/dormitory/basedata/building'
|
||||
import { listPark } from '@/api/dormitory/basedata/park'
|
||||
import { listCampus } from '@/api/dormitory/campus'
|
||||
import { fullLoading, isEmpty } from '@/api/helpFunc'
|
||||
import { listStuTask } from '@/api/dormitory/new/task'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Application',
|
||||
dicts: ['dms_approval_status'],
|
||||
dicts: ['dms_approval_status', 'dms_change_status', 'dms_task_status'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -246,11 +364,68 @@ export default {
|
||||
label: '调宿申请'
|
||||
}
|
||||
],
|
||||
dorm_text: ''
|
||||
dorm_text: '',
|
||||
|
||||
// 新增申请相关数据
|
||||
applyTitle: '',
|
||||
applyOpen: false,
|
||||
campusListApply: [],
|
||||
parkListApply: [],
|
||||
buildingListApply: [],
|
||||
dormitoryListApply: [],
|
||||
|
||||
// 新增申请表单
|
||||
applyForm: {
|
||||
stuNo: '',
|
||||
stuName: '',
|
||||
gender: '',
|
||||
time: '',
|
||||
currBuilding: '',
|
||||
currRoomNo: '',
|
||||
campusId: '',
|
||||
parkId: '',
|
||||
tarBuildingId: '',
|
||||
targetDormId: '',
|
||||
reason: '',
|
||||
type: 1 // 默认为调宿申请
|
||||
},
|
||||
|
||||
// 新增申请表单校验
|
||||
applyRules: {
|
||||
stuNo: [
|
||||
{ required: true, message: '学号不能为空', trigger: 'blur' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '申请类型不能为空', trigger: 'change' }
|
||||
],
|
||||
time: [
|
||||
{ required: true, message: '执行时间不能为空', trigger: 'change' }
|
||||
],
|
||||
reason: [
|
||||
{ required: true, message: '申请理由不能为空', trigger: 'blur' }
|
||||
],
|
||||
campusId: [
|
||||
{ required: true, message: '新校区不能为空', trigger: 'change' }
|
||||
],
|
||||
parkId: [
|
||||
{ required: true, message: '新园区不能为空', trigger: 'change' }
|
||||
],
|
||||
tarBuildingId: [
|
||||
{ required: true, message: '新宿舍楼不能为空', trigger: 'change' }
|
||||
],
|
||||
targetDormId: [
|
||||
{ required: true, message: '新宿舍不能为空', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
|
||||
// 查看学生调宿计划相关数据
|
||||
taskV: false,
|
||||
task_list: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.initApplyData() // 初始化新增申请相关数据
|
||||
},
|
||||
methods: {
|
||||
/** 查询宿舍管理申请列表 */
|
||||
@@ -348,8 +523,8 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
/** 原辅导员审批提交按钮 */
|
||||
/* submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (this.form.time == null && this.form.type != '3') {
|
||||
this.$message.info('请选择执行时间')
|
||||
@@ -381,7 +556,7 @@ export default {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
}, */
|
||||
campusChange(e) {
|
||||
this.form.parkId = null
|
||||
this.form.tarBuildingId = null
|
||||
@@ -415,7 +590,196 @@ export default {
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/** 初始化新增申请相关数据 */
|
||||
initApplyData() {
|
||||
// 获取所有校区用于新增申请
|
||||
listCampus({ pageSize: 100000000, pageNum: 1 }).then(res => {
|
||||
this.campusListApply = res.rows
|
||||
})
|
||||
},
|
||||
|
||||
/** 处理新增申请按钮 */
|
||||
handleAddApply() {
|
||||
this.applyForm = {
|
||||
stuNo: '',
|
||||
stuName: '',
|
||||
gender: '',
|
||||
time: '',
|
||||
currBuilding: '',
|
||||
currRoomNo: '',
|
||||
campusId: '',
|
||||
parkId: '',
|
||||
tarBuildingId: '',
|
||||
targetDormId: '',
|
||||
reason: '',
|
||||
type: 1
|
||||
}
|
||||
this.applyOpen = true
|
||||
this.applyTitle = '新增住宿申请'
|
||||
},
|
||||
|
||||
/** 处理申请类型变化 */
|
||||
handleApplyTypeChange(value) {
|
||||
// 清空与特定类型相关的字段
|
||||
if (value !== 1) { // 不是调宿申请
|
||||
this.applyForm.campusId = ''
|
||||
this.applyForm.parkId = ''
|
||||
this.applyForm.tarBuildingId = ''
|
||||
this.applyForm.targetDormId = ''
|
||||
this.parkListApply = []
|
||||
this.buildingListApply = []
|
||||
this.dormitoryListApply = []
|
||||
}
|
||||
},
|
||||
|
||||
/** 查询学生原宿舍信息 */
|
||||
async fetchStudentInfo() {
|
||||
if (!this.applyForm.stuNo) {
|
||||
this.$message.warning('请先输入学号')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const loading = fullLoading(this)
|
||||
const response = await getStuDom(this.applyForm.stuNo)
|
||||
loading.close()
|
||||
|
||||
if (response.code === 200 && response.data) {
|
||||
const data = response.data
|
||||
this.applyForm.stuName = data.stuName
|
||||
this.applyForm.gender = data.gender
|
||||
this.applyForm.currBuilding = data.buildingName
|
||||
this.applyForm.currRoomNo = data.roomNo
|
||||
|
||||
// 保存其他必要信息
|
||||
this.applyForm.currentDormId = data.dormitoryId
|
||||
|
||||
this.$message.success('获取学生信息成功')
|
||||
} else {
|
||||
this.$message.error(response.msg || '获取学生信息失败')
|
||||
// 清空已填充的信息
|
||||
this.clearStudentInfo()
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('查询学生信息失败,请检查网络连接')
|
||||
console.error('Error fetching student info:', error)
|
||||
this.clearStudentInfo()
|
||||
}
|
||||
},
|
||||
|
||||
/** 清空学生信息 */
|
||||
clearStudentInfo() {
|
||||
this.applyForm.stuName = ''
|
||||
this.applyForm.gender = ''
|
||||
this.applyForm.currBuilding = ''
|
||||
this.applyForm.currRoomNo = ''
|
||||
this.applyForm.currentDormId = ''
|
||||
},
|
||||
|
||||
/** 校区变化事件 - 新增申请用 */
|
||||
campusChangeApply(campusId) {
|
||||
this.applyForm.parkId = ''
|
||||
this.applyForm.tarBuildingId = ''
|
||||
this.applyForm.targetDormId = ''
|
||||
this.parkListApply = []
|
||||
this.buildingListApply = []
|
||||
this.dormitoryListApply = []
|
||||
|
||||
if (campusId) {
|
||||
const loading = fullLoading(this)
|
||||
listPark({ pageSize: 100000000, pageNum: 1, campusId }).then(res => {
|
||||
loading.close()
|
||||
this.parkListApply = res.rows
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/** 园区变化事件 - 新增申请用 */
|
||||
parkChangeApply(parkId) {
|
||||
this.applyForm.tarBuildingId = ''
|
||||
this.applyForm.targetDormId = ''
|
||||
this.buildingListApply = []
|
||||
this.dormitoryListApply = []
|
||||
|
||||
if (parkId) {
|
||||
const loading = fullLoading(this)
|
||||
listBuilding({ pageSize: 100000000, pageNum: 1, parkId }).then(res => {
|
||||
loading.close()
|
||||
this.buildingListApply = res.rows
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/** 宿舍楼变化事件 - 新增申请用 */
|
||||
buildingChangeApply(buildingId) {
|
||||
this.applyForm.targetDormId = ''
|
||||
this.dormitoryListApply = []
|
||||
|
||||
if (buildingId && this.applyForm.gender) {
|
||||
const loading = fullLoading(this)
|
||||
getAllDormList({ buildingId, gender: this.applyForm.gender }).then(res => {
|
||||
loading.close()
|
||||
this.dormitoryListApply = [...res.data]
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/** 提交新增申请 */
|
||||
submitApplyForm() {
|
||||
this.$refs['applyForm'].validate(async valid => {
|
||||
if (valid) {
|
||||
this.$confirm('您确定要提交该申请吗?请和宿舍管理员确认好住宿信息。', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
try {
|
||||
const loading = fullLoading(this)
|
||||
const params = {
|
||||
...this.applyForm,
|
||||
getBy: 'teacher'
|
||||
}
|
||||
|
||||
const response = await addApplication(params)
|
||||
loading.close()
|
||||
|
||||
if (response.code === 200) {
|
||||
this.$modal.msgSuccess('申请提交成功')
|
||||
this.applyOpen = false
|
||||
this.getList()
|
||||
} else {
|
||||
this.$message.error(response.msg || '申请提交失败')
|
||||
}
|
||||
} catch (error) {
|
||||
this.$message.error('申请提交失败,请重试')
|
||||
console.error('Error submitting application:', error)
|
||||
}
|
||||
}).catch(() => {
|
||||
// 用户点击取消
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 取消新增申请 */
|
||||
cancelApply() {
|
||||
this.applyOpen = false
|
||||
this.clearStudentInfo()
|
||||
},
|
||||
/** 查看学生调宿计划 */
|
||||
async lookTask(row) {
|
||||
this.task_list = []
|
||||
let stuNo = row.stuNo
|
||||
let loading = fullLoading(this)
|
||||
let res = await listStuTask(stuNo)
|
||||
loading.close()
|
||||
if (res.code == 200) {
|
||||
this.task_list = [...res.data]
|
||||
this.taskV = true
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -426,4 +790,4 @@ export default {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user