提交代码
This commit is contained in:
1 parent
4d7bb19fd9
commit
4e16396463
14 files changed
+436
-33
No files matched your search
@@ -1,13 +1,12 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { DormBedVO, DormBedDetailVO, DormBedForm, DormBedQuery } from '@/api/xg/xgss/dormBed/types';
|
||||
import { DormBedVO, DormBedForm, DormBedQuery, DormBedDetailVO } from '@/api/xg/xgss/dormBed/types';
|
||||
|
||||
/**
|
||||
* 查询宿舍床位信息列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listDormBed = (query?: DormBedQuery): AxiosPromise<DormBedVO[]> => {
|
||||
return request({
|
||||
url: '/dormbed/dormBed/list',
|
||||
@@ -73,6 +72,17 @@ export const getBedDetailsByRoomId = (roomId: string | number): AxiosPromise<Dor
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前用户所在学院的指定房间床位详细信息列表(包含学生信息)
|
||||
* @param roomId 房间ID
|
||||
*/
|
||||
export const getBedDetailsByRoomIdForCurrentUserCollege = (roomId: string | number): AxiosPromise<DormBedDetailVO[]> => {
|
||||
return request({
|
||||
url: '/dormbed/dormBed/details/college/room/' + roomId,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询指定宿舍楼的床位详细信息列表(包含学生信息)
|
||||
* @param buildingId 宿舍楼ID
|
||||
|
||||
@@ -16,6 +16,19 @@ export const listDormRoom = (query?: DormRoomQuery): AxiosPromise<DormRoomVO[]>
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询当前用户所在学院的宿舍房间信息列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
export const listDormRoomForCurrentUserCollege = (query?: DormRoomQuery): AxiosPromise<DormRoomVO[]> => {
|
||||
return request({
|
||||
url: '/xgss/dormRoom/college/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询宿舍房间信息详细
|
||||
* @param id
|
||||
|
||||
@@ -237,14 +237,16 @@
|
||||
<el-tag v-if="scope.row.roomStatus === '0'" type="success">正常</el-tag>
|
||||
<el-tag v-else-if="scope.row.roomStatus === '1'" type="warning">维修中</el-tag>
|
||||
<el-tag v-else type="danger">停用</el-tag>
|
||||
<!-- 房间床位占用状态 -->
|
||||
<span v-if="scope.row.roomStatus === '0'" class="text-xs text-gray-500"> ({{ getRoomBedStatusText(scope.row) }}) </span>
|
||||
<!-- 房间床位分配数量 -->
|
||||
<span v-if="scope.row.roomStatus === '0'" class="text-xs text-gray-500">
|
||||
(已分配: {{ scope.row.children?.filter((bed) => bed.classId).length || 0 }}/{{ scope.row.children?.length || 0 }}床位)
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag v-if="scope.row.bedStatus === '0'" type="success">空闲</el-tag>
|
||||
<el-tag v-else-if="scope.row.bedStatus === '1'" type="warning">已分配</el-tag>
|
||||
<el-tag v-else type="danger">维修中</el-tag>
|
||||
<el-tag v-if="scope.row.bedStatus === '2'" type="danger">维修中</el-tag>
|
||||
<el-tag v-else-if="scope.row.classId" type="warning">已分配</el-tag>
|
||||
<el-tag v-else type="success">空闲</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -298,7 +300,7 @@
|
||||
{{ scope.row.remark || scope.row.bedRemark }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right">
|
||||
<el-table-column label="操作" width="180" align="center" fixed="right" v-if="false">
|
||||
<template #default="scope">
|
||||
<template v-if="!scope.row.isBed">
|
||||
<!-- <el-button type="primary" link icon="Plus" @click="handleAddBed(scope.row)" /> -->
|
||||
@@ -357,8 +359,8 @@ import type { DormRoomVO } from '@/api/xg/xgss/dormRoom/types';
|
||||
import type { DormBedDetailVO } from '@/api/xg/xgss/dormBed/types';
|
||||
import type { XgStudentTreeVO } from '@/api/xg/xsjcxx/studentMsg/types';
|
||||
import { getCurrentUserCollegeDormTree } from '@/api/xg/xgss/dormBedStudent/dormBedStudent';
|
||||
import { getBedDetailsByRoomId, delDormBed, getDormBed } from '@/api/xg/xgss/dormBed';
|
||||
import { listDormRoom, delDormRoom } from '@/api/xg/xgss/dormRoom';
|
||||
import { getBedDetailsByRoomIdForCurrentUserCollege, delDormBed, getDormBed } from '@/api/xg/xgss/dormBed';
|
||||
import { listDormRoomForCurrentUserCollege, delDormRoom } from '@/api/xg/xgss/dormRoom';
|
||||
import { getCurrentUserStudentTree } from '@/api/xg/xsjcxx/studentMsg';
|
||||
import ElMessage from 'element-plus/es/components/message/index';
|
||||
import ElMessageBox from 'element-plus/es/components/message-box/index';
|
||||
@@ -567,7 +569,7 @@ const loadRoomData = async () => {
|
||||
|
||||
try {
|
||||
// 获取房间列表
|
||||
const res = await listDormRoom({
|
||||
const res = await listDormRoomForCurrentUserCollege({
|
||||
...queryParams
|
||||
});
|
||||
const rooms = res.rows || [];
|
||||
@@ -584,7 +586,7 @@ const loadRoomData = async () => {
|
||||
};
|
||||
|
||||
try {
|
||||
const bedDetailRes = await getBedDetailsByRoomId(room.id);
|
||||
const bedDetailRes = await getBedDetailsByRoomIdForCurrentUserCollege(room.id);
|
||||
|
||||
// 如果请求已被取消,不继续处理
|
||||
if (controller?.signal?.aborted) return roomRecord;
|
||||
@@ -874,9 +876,9 @@ const getRoomBedStatusText = (room: any) => {
|
||||
}
|
||||
|
||||
const totalBeds = room.children.length;
|
||||
const availableBeds = room.children.filter((bed: any) => bed.bedStatus === '0').length;
|
||||
const allocatedBeds = room.children.filter((bed: any) => bed.bedStatus === '1').length;
|
||||
const maintenanceBeds = room.children.filter((bed: any) => bed.bedStatus === '2').length;
|
||||
const allocatedBeds = room.children.filter((bed: any) => bed.classId).length;
|
||||
const availableBeds = room.children.filter((bed: any) => bed.bedStatus !== '2' && !bed.classId).length;
|
||||
|
||||
if (availableBeds === totalBeds) {
|
||||
return '空闲';
|
||||
@@ -1004,12 +1006,12 @@ const updateSelectionCount = (rows: any[]) => {
|
||||
// 床位:记录床位ID并统计状态
|
||||
uniqueBeds.add(row.id);
|
||||
// 统计床位状态
|
||||
if (row.bedStatus === '0') {
|
||||
bedStats.available++;
|
||||
} else if (row.bedStatus === '1') {
|
||||
bedStats.allocated++;
|
||||
} else if (row.bedStatus === '2') {
|
||||
if (row.bedStatus === '2') {
|
||||
bedStats.maintenance++;
|
||||
} else if (row.classId) {
|
||||
bedStats.allocated++;
|
||||
} else {
|
||||
bedStats.available++;
|
||||
}
|
||||
} else {
|
||||
// 房间:记录房间ID
|
||||
|
||||
Reference in new issue
Block a user