2788 lines
89 KiB
Vue
2788 lines
89 KiB
Vue
<script setup lang="ts">
|
|
import { getDisplayLocale } from "../i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
const { t, locale } = useI18n();
|
|
import {
|
|
computed,
|
|
nextTick,
|
|
onBeforeUnmount,
|
|
onMounted,
|
|
reactive,
|
|
ref,
|
|
watch,
|
|
} from "vue";
|
|
import * as echarts from "echarts/core";
|
|
import { BarChart, PieChart } from "echarts/charts";
|
|
import {
|
|
GridComponent,
|
|
LegendComponent,
|
|
TooltipComponent,
|
|
} from "echarts/components";
|
|
import { CanvasRenderer } from "echarts/renderers";
|
|
import {
|
|
Download,
|
|
HomeFilled,
|
|
Plus,
|
|
Search,
|
|
Upload,
|
|
} from "@element-plus/icons-vue";
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
import http, { apiErrorMessage } from "../api/http";
|
|
import { downloadApiFile, importExcel } from "../api/excel";
|
|
import { useAuthStore } from "../stores/auth";
|
|
import VacantBedPicker from "../components/VacantBedPicker.vue";
|
|
|
|
echarts.use([
|
|
BarChart,
|
|
PieChart,
|
|
GridComponent,
|
|
LegendComponent,
|
|
TooltipComponent,
|
|
CanvasRenderer,
|
|
]);
|
|
const props = defineProps<{ section?: string }>();
|
|
type Bed = {
|
|
id: string;
|
|
bedNumber: string;
|
|
isEnabled: boolean;
|
|
occupant?: any;
|
|
};
|
|
type Room = {
|
|
id: string;
|
|
roomNumber: string;
|
|
floor: number;
|
|
genderPolicy: number | string;
|
|
isEnabled: boolean;
|
|
notes?: string;
|
|
capacity: number;
|
|
occupiedCount: number;
|
|
beds: Bed[];
|
|
};
|
|
type Building = {
|
|
id: string;
|
|
code: string;
|
|
name: string;
|
|
floorCount: number;
|
|
genderPolicy: number | string;
|
|
isEnabled: boolean;
|
|
notes?: string;
|
|
rooms: Room[];
|
|
};
|
|
function localDateValue(date = new Date()) {
|
|
const year = date.getFullYear(),
|
|
month = String(date.getMonth() + 1).padStart(2, "0"),
|
|
day = String(date.getDate()).padStart(2, "0");
|
|
return `${year}-${month}-${day}`;
|
|
}
|
|
const auth = useAuthStore(),
|
|
roles = computed(() => auth.user?.roles ?? []);
|
|
const isStudent = computed(
|
|
() =>
|
|
roles.value.includes("Student") &&
|
|
!roles.value.some((x) =>
|
|
[
|
|
"SuperAdmin",
|
|
"AcademicAdmin",
|
|
"DormitoryAdmin",
|
|
"CollegeAdmin",
|
|
"Counselor",
|
|
].includes(x),
|
|
),
|
|
);
|
|
const canManage = computed(() =>
|
|
roles.value.some((x) =>
|
|
["SuperAdmin", "AcademicAdmin", "DormitoryAdmin"].includes(x),
|
|
),
|
|
);
|
|
const canCounselor = computed(() =>
|
|
roles.value.some((x) =>
|
|
["SuperAdmin", "AcademicAdmin", "CollegeAdmin", "Counselor"].includes(x),
|
|
),
|
|
);
|
|
const loading = ref(false),
|
|
saving = ref(false),
|
|
activeTab = ref(props.section ?? "overview");
|
|
const overview = ref<any>(),
|
|
buildings = ref<Building[]>([]),
|
|
applications = ref<any[]>([]),
|
|
myApplications = ref<any[]>([]);
|
|
const applicationPage = ref(1),
|
|
applicationPageSize = ref(20),
|
|
applicationTotal = ref(0);
|
|
const mine = reactive<{ room?: any; scores: any[] }>({ scores: [] });
|
|
const pieEl = ref<HTMLElement>(),
|
|
barEl = ref<HTMLElement>();
|
|
let charts: echarts.ECharts[] = [];
|
|
const buildingDialog = ref(false),
|
|
roomDialog = ref(false),
|
|
bedsDialog = ref(false),
|
|
transferDialog = ref(false),
|
|
checkInDateDialog = ref(false),
|
|
applicationDialog = ref(false),
|
|
finalDialog = ref(false);
|
|
const editingBuilding = ref<string>(),
|
|
editingRoom = ref<string>(),
|
|
editingBatch = ref<any>(),
|
|
bedRoom = ref<Room>(),
|
|
transferStudent = ref<any>(),
|
|
editingOccupant = ref<any>(),
|
|
finalApplication = ref<any>();
|
|
const buildingForm = reactive({
|
|
code: "",
|
|
name: "",
|
|
campusId: null as string | null,
|
|
floorCount: 6,
|
|
genderPolicy: 0,
|
|
isEnabled: true,
|
|
notes: "",
|
|
});
|
|
const roomForm = reactive({
|
|
buildingId: "",
|
|
roomNumber: "",
|
|
floor: 1,
|
|
genderPolicy: 0,
|
|
bedCount: 4,
|
|
isEnabled: true,
|
|
notes: "",
|
|
});
|
|
const bedNumbers = ref<string[]>([]),
|
|
transferForm = reactive({
|
|
targetBedId: "",
|
|
transferDate: localDateValue(),
|
|
reason: "",
|
|
});
|
|
const checkInDateForm = reactive({ checkInDate: localDateValue() }),
|
|
allocationCheckInDate = ref(localDateValue());
|
|
const applicationForm = reactive({ type: 1, reason: "" }),
|
|
finalForm = reactive({ approved: true, targetBedId: "", comment: "" });
|
|
const allocationTable = ref<any>(),
|
|
students = ref<any[]>([]),
|
|
selectedStudents = ref<any[]>([]),
|
|
studentKeyword = ref(""),
|
|
studentGradeFilter = ref<number[]>([]),
|
|
studentMajorFilter = ref<string[]>([]),
|
|
studentClassFilter = ref<string[]>([]),
|
|
buildingFilter = ref<string[]>([]),
|
|
assignments = ref<any[]>([]),
|
|
allocationMode = ref(2),
|
|
allocationJobId = ref<string>(),
|
|
allocationJobStatus = ref(""),
|
|
studentTotal = ref(0),
|
|
studentPage = ref(1),
|
|
studentPageSize = ref(50);
|
|
const studentFilterOptions = reactive<{
|
|
grades: number[];
|
|
majors: any[];
|
|
classes: any[];
|
|
}>({ grades: [], majors: [], classes: [] });
|
|
const batches = ref<any[]>([]),
|
|
selectedBatch = ref<any>(),
|
|
scores = ref<any[]>([]),
|
|
scoreSummary = ref<any>(),
|
|
batchDialog = ref(false),
|
|
scoreDialog = ref(false);
|
|
const batchPage = ref(1),
|
|
batchPageSize = ref(20),
|
|
batchTotal = ref(0),
|
|
scorePage = ref(1),
|
|
scorePageSize = ref(50),
|
|
scoreTotal = ref(0);
|
|
const terms = ref<any[]>([]),
|
|
calculationTermId = ref(""),
|
|
calculationBatchIds = ref<string[]>([]),
|
|
calculationOptions = ref<any[]>([]),
|
|
calculations = ref<any[]>([]),
|
|
selectedCalculation = ref<any>(),
|
|
calculationResults = ref<any[]>([]),
|
|
calculationResultPage = ref(1),
|
|
calculationResultTotal = ref(0);
|
|
const calculationPage = ref(1),
|
|
calculationPageSize = ref(20),
|
|
calculationTotal = ref(0);
|
|
const studentTermId = ref(""),
|
|
studentBatchIds = ref<string[]>([]);
|
|
const hygieneBuilding = ref<string>(),
|
|
hygieneFloor = ref<number>();
|
|
const batchForm = reactive({
|
|
name: "",
|
|
inspectionDate: new Date().toISOString().slice(0, 10),
|
|
inspector: "",
|
|
});
|
|
const scoreRooms = ref<any[]>([]),
|
|
scoreForm = reactive({
|
|
dormitoryRoomId: "",
|
|
floorScore: 20,
|
|
beddingScore: 20,
|
|
belongingsScore: 20,
|
|
facilitiesScore: 20,
|
|
safetyScore: 20,
|
|
isViolation: false,
|
|
issues: "",
|
|
notes: "",
|
|
});
|
|
const scoreRoomsLoading = ref(false);
|
|
let scoreRoomsRequestId = 0;
|
|
const housingFile = ref<HTMLInputElement>(),
|
|
scoreFile = ref<HTMLInputElement>();
|
|
const pageTitle = computed(() =>
|
|
isStudent.value
|
|
? t("dormScript.myHousingServices")
|
|
: ((
|
|
{
|
|
overview: t("dormScript.housingOverview"),
|
|
buildings: t("dormScript.buildingsAndBeds"),
|
|
allocation: t("dormScript.roomAllocationAndTransfers"),
|
|
applications: t("dormScript.housingApplications"),
|
|
scores: t("dormScript.dormitoryHygieneScores"),
|
|
} as Record<string, string>
|
|
)[activeTab.value] ?? t("dormScript.housingServices")),
|
|
);
|
|
const pageDescription = computed(() =>
|
|
isStudent.value
|
|
? t(
|
|
"dormScript.viewHousingDetailsAndHygieneResultsOrApplyToTransferOrCheckOut",
|
|
)
|
|
: ((
|
|
{
|
|
overview: t(
|
|
"dormScript.viewOccupancyVacanciesAndResourceUsageAcrossBuildings",
|
|
),
|
|
buildings: t(
|
|
"dormScript.manageBuildingsRoomsBedsAndOccupancyWithExcelImportAndExport",
|
|
),
|
|
allocation: t(
|
|
"dormScript.allocateStudentsManuallyOrAutomaticallyWithPriorityForTheSameMajorAndManageTransfers",
|
|
),
|
|
applications: t(
|
|
"dormScript.reviewStudentTransferAndCheckoutRequestsAsCounselorOrHousingManager",
|
|
),
|
|
scores: t(
|
|
"dormScript.enterImportExportAndPublishDormitoryHygieneInspectionScores",
|
|
),
|
|
} as Record<string, string>
|
|
)[activeTab.value] ?? t("dormScript.housingServices")),
|
|
);
|
|
const assignmentPage = ref(1),
|
|
assignmentPageSize = ref(100),
|
|
bedEditDialog = ref(false),
|
|
editingAssignment = ref<any>(),
|
|
editingBedId = ref(""),
|
|
editingBedLabel = ref("");
|
|
const pagedAssignments = computed(() =>
|
|
assignments.value.slice(
|
|
(assignmentPage.value - 1) * assignmentPageSize.value,
|
|
assignmentPage.value * assignmentPageSize.value,
|
|
),
|
|
);
|
|
const editingExcludeIds = computed(() =>
|
|
assignments.value
|
|
.filter((x) => x !== editingAssignment.value)
|
|
.map((x) => x.bedId)
|
|
.filter(Boolean),
|
|
);
|
|
const hygieneFloors = computed(() =>
|
|
[
|
|
...new Set(
|
|
buildings.value
|
|
.filter((b) => !hygieneBuilding.value || b.id === hygieneBuilding.value)
|
|
.flatMap((b) => b.rooms.map((r) => r.floor)),
|
|
),
|
|
].sort((a, b) => a - b),
|
|
);
|
|
const studentTermScores = computed(() => {
|
|
const term = terms.value.find((x) => x.id === studentTermId.value);
|
|
return term
|
|
? mine.scores.filter(
|
|
(x) =>
|
|
x.inspectionDate >= term.startDate &&
|
|
x.inspectionDate <= term.endDate,
|
|
)
|
|
: [];
|
|
});
|
|
const studentCalculatorScores = computed(() =>
|
|
studentTermScores.value.filter((x) =>
|
|
studentBatchIds.value.includes(x.dormitoryHygieneBatchId),
|
|
),
|
|
);
|
|
const studentCalculatorAverage = computed(() =>
|
|
studentCalculatorScores.value.length
|
|
? studentCalculatorScores.value.reduce(
|
|
(sum: number, x: any) => sum + Number(x.totalScore),
|
|
0,
|
|
) / studentCalculatorScores.value.length
|
|
: null,
|
|
);
|
|
const studentCalculatorViolations = computed(
|
|
() => studentCalculatorScores.value.filter((x) => x.isViolation).length,
|
|
);
|
|
const enumCode = (v: any, map: any) =>
|
|
typeof v === "number" ? v : (map[v] ?? Number(v)),
|
|
gender = (v: any) =>
|
|
(
|
|
({
|
|
0: t("dormScript.any"),
|
|
1: t("dormScript.male"),
|
|
2: t("dormScript.female"),
|
|
}) as Record<number, string>
|
|
)[enumCode(v, { Any: 0, Unknown: 0, Male: 1, Female: 2 })] ??
|
|
t("dormScript.any");
|
|
const appStatus = (v: any) =>
|
|
enumCode(v, {
|
|
Submitted: 1,
|
|
CounselorApproved: 2,
|
|
Approved: 3,
|
|
Rejected: 4,
|
|
Cancelled: 5,
|
|
}),
|
|
appType = (v: any) => enumCode(v, { Transfer: 1, Checkout: 2 });
|
|
const appStatusLabel = (v: any) =>
|
|
(
|
|
({
|
|
1: t("dormScript.awaitingCounselorReview"),
|
|
2: t("dormScript.awaitingHousingManagerReview"),
|
|
3: t("dormScript.completed"),
|
|
4: t("dormScript.rejected"),
|
|
5: t("dormScript.withdrawn"),
|
|
}) as Record<number, string>
|
|
)[appStatus(v)] ?? t("dormScript.unknown");
|
|
const grade = (v: any) =>
|
|
enumCode(v, { Excellent: 1, Good: 2, Qualified: 3, Unqualified: 4 }),
|
|
gradeLabel = (v: any) =>
|
|
(
|
|
({
|
|
1: t("dormScript.excellent"),
|
|
2: t("dormScript.good"),
|
|
3: t("dormScript.pass"),
|
|
4: t("dormScript.fail"),
|
|
}) as Record<number, string>
|
|
)[grade(v)] ?? "—";
|
|
const fmt = (v?: string) =>
|
|
v
|
|
? new Intl.DateTimeFormat(getDisplayLocale()).format(
|
|
new Date(v.length === 10 ? `${v}T00:00:00` : v),
|
|
)
|
|
: "—";
|
|
async function safe(fn: () => Promise<void>) {
|
|
try {
|
|
await fn();
|
|
} catch (e) {
|
|
ElMessage.error(apiErrorMessage(e));
|
|
}
|
|
}
|
|
async function load() {
|
|
loading.value = true;
|
|
await safe(async () => {
|
|
if (isStudent.value) {
|
|
const [h, a] = await Promise.all([
|
|
http.get("/dormitory-hygiene/mine"),
|
|
http.get("/dormitory-services/applications/mine"),
|
|
loadTerms(),
|
|
]);
|
|
mine.room = h.data.room;
|
|
mine.scores = h.data.scores ?? [];
|
|
myApplications.value = a.data ?? [];
|
|
resetStudentCalculator();
|
|
} else {
|
|
const tasks = [
|
|
loadOverview(),
|
|
loadBuildings(),
|
|
loadApps(),
|
|
loadBatches(),
|
|
loadTerms(),
|
|
];
|
|
if (canManage.value) tasks.push(loadCalculations());
|
|
if (activeTab.value === "allocation")
|
|
tasks.push(loadStudentFilterOptions(), loadStudents());
|
|
await Promise.all(tasks);
|
|
}
|
|
});
|
|
loading.value = false;
|
|
}
|
|
async function loadTerms() {
|
|
terms.value = (await http.get("/base-data/terms")).data ?? [];
|
|
const preferred =
|
|
terms.value.find((x) => x.isCurrent) ??
|
|
terms.value.find((x) => x.isEnabled) ??
|
|
terms.value[0];
|
|
if (preferred) {
|
|
if (!calculationTermId.value) calculationTermId.value = preferred.id;
|
|
if (!studentTermId.value) studentTermId.value = preferred.id;
|
|
}
|
|
}
|
|
function resetStudentCalculator() {
|
|
studentBatchIds.value = studentTermScores.value.map(
|
|
(x) => x.dormitoryHygieneBatchId,
|
|
);
|
|
}
|
|
async function loadOverview() {
|
|
overview.value = (await http.get("/dormitory-services/overview")).data;
|
|
if (activeTab.value === "overview") await nextTick(renderCharts);
|
|
}
|
|
async function loadBuildings() {
|
|
buildings.value =
|
|
(await http.get("/dormitory-services/buildings")).data ?? [];
|
|
}
|
|
async function loadApps(page = applicationPage.value) {
|
|
applicationPage.value = page;
|
|
const { data } = await http.get("/dormitory-services/applications", {
|
|
params: { page, pageSize: applicationPageSize.value },
|
|
});
|
|
applications.value = data.items ?? [];
|
|
applicationTotal.value = data.total ?? 0;
|
|
}
|
|
async function refreshHousing() {
|
|
await Promise.all([loadBuildings(), loadOverview()]);
|
|
}
|
|
function renderCharts() {
|
|
charts.forEach((x) => x.dispose());
|
|
charts = [];
|
|
if (!overview.value || !pieEl.value || !barEl.value) return;
|
|
const p = echarts.init(pieEl.value),
|
|
b = echarts.init(barEl.value);
|
|
p.setOption({
|
|
tooltip: { trigger: "item" },
|
|
legend: { bottom: 0 },
|
|
series: [
|
|
{
|
|
type: "pie",
|
|
radius: ["50%", "75%"],
|
|
data: [
|
|
{
|
|
name: t("dormScript.occupied"),
|
|
value: overview.value.occupiedCount,
|
|
},
|
|
{ name: t("dormScript.vacant"), value: overview.value.vacantCount },
|
|
],
|
|
},
|
|
],
|
|
});
|
|
b.setOption({
|
|
tooltip: { trigger: "axis" },
|
|
legend: { bottom: 0 },
|
|
grid: { left: 40, right: 10, bottom: 45 },
|
|
xAxis: {
|
|
type: "category",
|
|
data: overview.value.buildings.map((x: any) => x.name),
|
|
},
|
|
yAxis: { type: "value" },
|
|
series: [
|
|
{
|
|
name: t("dormScript.occupied"),
|
|
type: "bar",
|
|
stack: "床位",
|
|
data: overview.value.buildings.map((x: any) => x.occupiedCount),
|
|
},
|
|
{
|
|
name: t("dormScript.vacant"),
|
|
type: "bar",
|
|
stack: "床位",
|
|
data: overview.value.buildings.map(
|
|
(x: any) => x.bedCount - x.occupiedCount,
|
|
),
|
|
},
|
|
],
|
|
});
|
|
charts = [p, b];
|
|
}
|
|
function openBuilding(x?: Building) {
|
|
editingBuilding.value = x?.id;
|
|
Object.assign(
|
|
buildingForm,
|
|
x
|
|
? {
|
|
code: x.code,
|
|
name: x.name,
|
|
floorCount: x.floorCount,
|
|
genderPolicy: enumCode(x.genderPolicy, {
|
|
Any: 0,
|
|
Male: 1,
|
|
Female: 2,
|
|
}),
|
|
isEnabled: x.isEnabled,
|
|
notes: x.notes ?? "",
|
|
}
|
|
: {
|
|
code: "",
|
|
name: "",
|
|
floorCount: 6,
|
|
genderPolicy: 0,
|
|
isEnabled: true,
|
|
notes: "",
|
|
},
|
|
);
|
|
buildingDialog.value = true;
|
|
}
|
|
async function saveBuilding() {
|
|
if (!buildingForm.code.trim() || !buildingForm.name.trim())
|
|
return ElMessage.warning(t("dormScript.enterTheBuildingCodeAndName"));
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
editingBuilding.value
|
|
? await http.put(
|
|
`/dormitory-services/buildings/${editingBuilding.value}`,
|
|
buildingForm,
|
|
)
|
|
: await http.post("/dormitory-services/buildings", buildingForm);
|
|
buildingDialog.value = false;
|
|
ElMessage.success(t("dormScript.buildingSaved"));
|
|
await refreshHousing();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
function openRoom(b: Building, r?: any) {
|
|
editingRoom.value = r?.id;
|
|
Object.assign(
|
|
roomForm,
|
|
r
|
|
? {
|
|
buildingId: b.id,
|
|
roomNumber: r.roomNumber,
|
|
floor: r.floor,
|
|
genderPolicy: enumCode(r.genderPolicy, {
|
|
Any: 0,
|
|
Male: 1,
|
|
Female: 2,
|
|
}),
|
|
bedCount: r.capacity,
|
|
isEnabled: r.isEnabled,
|
|
notes: r.notes ?? "",
|
|
}
|
|
: {
|
|
buildingId: b.id,
|
|
roomNumber: "",
|
|
floor: 1,
|
|
genderPolicy: 0,
|
|
bedCount: 4,
|
|
isEnabled: true,
|
|
notes: "",
|
|
},
|
|
);
|
|
roomDialog.value = true;
|
|
}
|
|
async function saveRoom() {
|
|
if (!roomForm.roomNumber.trim())
|
|
return ElMessage.warning(t("dormScript.enterTheRoomNumber"));
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
editingRoom.value
|
|
? await http.put(
|
|
`/dormitory-services/rooms/${editingRoom.value}`,
|
|
roomForm,
|
|
)
|
|
: await http.post("/dormitory-services/rooms", roomForm);
|
|
roomDialog.value = false;
|
|
ElMessage.success(t("dormScript.roomSaved"));
|
|
await refreshHousing();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
function openBeds(r: any) {
|
|
bedRoom.value = r;
|
|
bedNumbers.value = r.beds.map((x: Bed) => x.bedNumber);
|
|
bedsDialog.value = true;
|
|
}
|
|
async function saveBeds() {
|
|
if (!bedRoom.value) return;
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
await http.put(`/dormitory-services/rooms/${bedRoom.value!.id}/beds`, {
|
|
bedNumbers: bedNumbers.value,
|
|
});
|
|
bedsDialog.value = false;
|
|
ElMessage.success(t("dormScript.bedsUpdated"));
|
|
await refreshHousing();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
async function downloadHousingTemplate() {
|
|
await safe(async () =>
|
|
downloadApiFile(
|
|
"/dormitory-services/excel/template.xlsx",
|
|
t("dormScript.housingDataImportTemplateXlsx"),
|
|
),
|
|
);
|
|
}
|
|
async function exportHousing() {
|
|
await safe(async () =>
|
|
downloadApiFile(
|
|
"/dormitory-services/excel/export.xlsx",
|
|
t("dormScript.housingDataXlsx"),
|
|
),
|
|
);
|
|
}
|
|
async function importHousing(event: Event) {
|
|
const input = event.target as HTMLInputElement,
|
|
file = input.files?.[0];
|
|
input.value = "";
|
|
if (!file) return;
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
const { data } = await importExcel(
|
|
"/dormitory-services/excel/import.xlsx",
|
|
file,
|
|
);
|
|
ElMessage.success(
|
|
t("dormScript.importHousing", {
|
|
buildings: data.createdBuildings,
|
|
rooms: data.createdRooms,
|
|
beds: data.createdBeds,
|
|
assigned: data.assigned,
|
|
}),
|
|
);
|
|
await refreshHousing();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
async function loadStudentFilterOptions() {
|
|
const { data } = await http.get(
|
|
"/dormitory-services/unassigned-students/filter-options",
|
|
);
|
|
studentFilterOptions.grades = data.grades ?? [];
|
|
studentFilterOptions.majors = data.majors ?? [];
|
|
studentFilterOptions.classes = data.classes ?? [];
|
|
}
|
|
async function loadStudents() {
|
|
const params = new URLSearchParams();
|
|
if (studentKeyword.value) params.set("keyword", studentKeyword.value);
|
|
studentGradeFilter.value.forEach((x) => params.append("grades", String(x)));
|
|
studentMajorFilter.value.forEach((x) => params.append("majorIds", x));
|
|
studentClassFilter.value.forEach((x) => params.append("classIds", x));
|
|
params.set("page", String(studentPage.value));
|
|
params.set("pageSize", String(studentPageSize.value));
|
|
const { data } = await http.get("/dormitory-services/unassigned-students", {
|
|
params,
|
|
});
|
|
students.value = data.items ?? [];
|
|
studentTotal.value = data.total ?? 0;
|
|
}
|
|
function clearStudentSelection() {
|
|
allocationTable.value?.clearSelection();
|
|
selectedStudents.value = [];
|
|
}
|
|
async function searchStudents() {
|
|
clearStudentSelection();
|
|
studentPage.value = 1;
|
|
await loadStudents();
|
|
}
|
|
async function changeStudentPage(page: number) {
|
|
studentPage.value = page;
|
|
await loadStudents();
|
|
}
|
|
async function changeStudentPageSize(size: number) {
|
|
studentPageSize.value = size;
|
|
studentPage.value = 1;
|
|
await loadStudents();
|
|
}
|
|
function manual() {
|
|
allocationMode.value = 1;
|
|
allocationJobId.value = undefined;
|
|
allocationJobStatus.value = "";
|
|
assignments.value = selectedStudents.value.map((x) => ({ ...x, bedId: "" }));
|
|
}
|
|
function assignmentBedLabel(row: any) {
|
|
return (
|
|
row.bedLabel ||
|
|
(row.buildingName && row.roomNumber && row.bedNumber
|
|
? `${row.buildingName} ${row.roomNumber}-${row.bedNumber}`
|
|
: "")
|
|
);
|
|
}
|
|
function openBedEdit(row: any) {
|
|
editingAssignment.value = row;
|
|
editingBedId.value = "";
|
|
editingBedLabel.value = "";
|
|
bedEditDialog.value = true;
|
|
}
|
|
function confirmBedEdit() {
|
|
if (!editingBedId.value)
|
|
return ElMessage.warning(t("dormScript.selectANewBed"));
|
|
editingAssignment.value.bedId = editingBedId.value;
|
|
editingAssignment.value.bedLabel = editingBedLabel.value;
|
|
bedEditDialog.value = false;
|
|
}
|
|
function onBedEditPicked(bed: any) {
|
|
if (bed) editingBedLabel.value = bed.label;
|
|
}
|
|
watch(assignments, () => {
|
|
assignmentPage.value = 1;
|
|
});
|
|
function changeAssignmentPage(page: number) {
|
|
assignmentPage.value = page;
|
|
}
|
|
function changeAssignmentPageSize(size: number) {
|
|
assignmentPageSize.value = size;
|
|
assignmentPage.value = 1;
|
|
}
|
|
const wait = (milliseconds: number) =>
|
|
new Promise((resolve) => window.setTimeout(resolve, milliseconds));
|
|
async function automatic() {
|
|
if (!selectedStudents.value.length)
|
|
return ElMessage.warning(t("dormScript.selectStudentsFirst"));
|
|
saving.value = true;
|
|
assignments.value = [];
|
|
allocationJobId.value = undefined;
|
|
allocationJobStatus.value = "dormScript.jobQueued";
|
|
await safe(async () => {
|
|
const { data } = await http.post(
|
|
"/dormitory-services/allocations/preview",
|
|
{
|
|
studentIds: selectedStudents.value.map((x) => x.id),
|
|
buildingIds: buildingFilter.value,
|
|
},
|
|
);
|
|
allocationMode.value = 2;
|
|
allocationJobId.value = data.jobId;
|
|
for (let attempt = 0; attempt < 300; attempt++) {
|
|
const job = (
|
|
await http.get(`/dormitory-services/allocations/jobs/${data.jobId}`)
|
|
).data;
|
|
const status = enumCode(job.status, {
|
|
Queued: 1,
|
|
Running: 2,
|
|
PreviewReady: 3,
|
|
Committed: 4,
|
|
Failed: 5,
|
|
});
|
|
allocationJobStatus.value =
|
|
status === 1
|
|
? "dormScript.jobQueued"
|
|
: status === 2
|
|
? "dormScript.calculatingInBackground"
|
|
: status === 3
|
|
? "dormScript.previewGenerated"
|
|
: status === 5
|
|
? "dormScript.calculationFailed"
|
|
: "";
|
|
if (status === 3) {
|
|
assignments.value = job.assignments ?? [];
|
|
if (job.unassigned?.length)
|
|
ElMessage.warning(
|
|
t("dormScript.unassigned", { count: job.unassigned.length }),
|
|
);
|
|
return;
|
|
}
|
|
if (status === 5)
|
|
throw new Error(
|
|
job.errorMessage || t("dormScript.automaticHousingAllocationFailed"),
|
|
);
|
|
await wait(1000);
|
|
}
|
|
throw new Error(
|
|
t("dormScript.calculationTimedOutReopenThisPageLaterToCheck"),
|
|
);
|
|
});
|
|
saving.value = false;
|
|
}
|
|
async function commit() {
|
|
if (!assignments.value.length || assignments.value.some((x) => !x.bedId))
|
|
return ElMessage.warning(t("dormScript.selectABedForEachStudent"));
|
|
if (!allocationCheckInDate.value)
|
|
return ElMessage.warning(t("dormScript.selectACheckInDate"));
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
await http.post("/dormitory-services/allocations/commit", {
|
|
name: `宿舍分配 ${new Date().toLocaleDateString()}`,
|
|
mode: allocationMode.value,
|
|
checkInDate: allocationCheckInDate.value,
|
|
reason:
|
|
allocationMode.value === 2 ? "按同专业优先规则自动分配" : "人工编排",
|
|
assignments: assignments.value.map((x) => ({
|
|
studentId: x.id ?? x.studentId,
|
|
bedId: x.bedId,
|
|
})),
|
|
jobId: allocationMode.value === 2 ? allocationJobId.value : undefined,
|
|
});
|
|
ElMessage.success(t("dormScript.housingAllocationApplied"));
|
|
assignments.value = [];
|
|
allocationJobId.value = undefined;
|
|
allocationJobStatus.value = "";
|
|
allocationCheckInDate.value = localDateValue();
|
|
clearStudentSelection();
|
|
await Promise.all([loadStudents(), refreshHousing()]);
|
|
});
|
|
saving.value = false;
|
|
}
|
|
function openTransfer(o: any) {
|
|
transferStudent.value = o;
|
|
Object.assign(transferForm, {
|
|
targetBedId: "",
|
|
transferDate: localDateValue(),
|
|
reason: "",
|
|
});
|
|
transferDialog.value = true;
|
|
}
|
|
async function transfer() {
|
|
if (!transferForm.targetBedId)
|
|
return ElMessage.warning(t("dormScript.selectABed"));
|
|
await safe(async () => {
|
|
await http.post(
|
|
`/dormitory-services/occupancies/${transferStudent.value.studentId}/transfer`,
|
|
transferForm,
|
|
);
|
|
transferDialog.value = false;
|
|
ElMessage.success(t("dormScript.roomTransferCompleted"));
|
|
await refreshHousing();
|
|
});
|
|
}
|
|
function openCheckInDate(o: any) {
|
|
editingOccupant.value = o;
|
|
checkInDateForm.checkInDate = o.checkInDate ?? localDateValue();
|
|
checkInDateDialog.value = true;
|
|
}
|
|
async function saveCheckInDate() {
|
|
if (!editingOccupant.value || !checkInDateForm.checkInDate)
|
|
return ElMessage.warning(t("dormScript.selectACheckInDate"));
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
await http.put(
|
|
`/dormitory-services/occupancies/${editingOccupant.value.studentId}/check-in-date`,
|
|
checkInDateForm,
|
|
);
|
|
checkInDateDialog.value = false;
|
|
ElMessage.success(t("dormScript.checkInDateUpdated"));
|
|
await refreshHousing();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
async function createApplication() {
|
|
if (!applicationForm.reason.trim())
|
|
return ElMessage.warning(t("dormScript.enterAReason"));
|
|
await safe(async () => {
|
|
await http.post("/dormitory-services/applications", {
|
|
...applicationForm,
|
|
preferredBuildingId: null,
|
|
preferredRoomId: null,
|
|
});
|
|
applicationDialog.value = false;
|
|
applicationForm.reason = "";
|
|
myApplications.value = (
|
|
await http.get("/dormitory-services/applications/mine")
|
|
).data;
|
|
ElMessage.success(t("dormScript.applicationSubmitted"));
|
|
});
|
|
}
|
|
async function cancelApp(id: string) {
|
|
await safe(async () => {
|
|
await http.post(`/dormitory-services/applications/${id}/cancel`);
|
|
myApplications.value = (
|
|
await http.get("/dormitory-services/applications/mine")
|
|
).data;
|
|
});
|
|
}
|
|
async function counselorReview(x: any, approved: boolean) {
|
|
try {
|
|
const { value } = await ElMessageBox.prompt(
|
|
t("dormScript.reviewComments"),
|
|
t("dormScript.counselorReview"),
|
|
{ inputType: "textarea" },
|
|
);
|
|
await http.post(
|
|
`/dormitory-services/applications/${x.id}/counselor-review`,
|
|
{ approved, comment: value },
|
|
);
|
|
await loadApps();
|
|
} catch (e) {
|
|
if (e !== "cancel" && e !== "close") ElMessage.error(apiErrorMessage(e));
|
|
}
|
|
}
|
|
function openFinal(x: any) {
|
|
finalApplication.value = x;
|
|
Object.assign(finalForm, { approved: true, targetBedId: "", comment: "" });
|
|
finalDialog.value = true;
|
|
}
|
|
async function finalReview() {
|
|
if (
|
|
finalForm.approved &&
|
|
appType(finalApplication.value.type) === 1 &&
|
|
!finalForm.targetBedId
|
|
)
|
|
return ElMessage.warning(t("dormScript.selectTheDestinationBed"));
|
|
await safe(async () => {
|
|
await http.post(
|
|
`/dormitory-services/applications/${finalApplication.value.id}/final-review`,
|
|
{ ...finalForm, targetBedId: finalForm.targetBedId || null },
|
|
);
|
|
finalDialog.value = false;
|
|
await Promise.all([loadApps(), refreshHousing()]);
|
|
ElMessage.success(t("dormScript.finalReviewCompleted"));
|
|
});
|
|
}
|
|
async function loadBatches(page = batchPage.value) {
|
|
batchPage.value = page;
|
|
const { data } = await http.get("/dormitory-hygiene/batches", {
|
|
params: { page, pageSize: batchPageSize.value },
|
|
});
|
|
batches.value = data.items ?? [];
|
|
batchTotal.value = data.total ?? 0;
|
|
}
|
|
async function loadCalculationOptions() {
|
|
if (!calculationTermId.value) return;
|
|
const { data } = await http.get(
|
|
`/dormitory-hygiene/calculations/options/${calculationTermId.value}`,
|
|
);
|
|
calculationOptions.value = data.batches ?? [];
|
|
calculationBatchIds.value = calculationOptions.value.map((x) => x.id);
|
|
}
|
|
async function loadCalculations(page = calculationPage.value) {
|
|
calculationPage.value = page;
|
|
const { data } = await http.get("/dormitory-hygiene/calculations", {
|
|
params: { page, pageSize: calculationPageSize.value },
|
|
});
|
|
calculations.value = data.items ?? [];
|
|
calculationTotal.value = data.total ?? 0;
|
|
}
|
|
const calculationStatus = (v: any) =>
|
|
(
|
|
({
|
|
1: t("dormScript.queued"),
|
|
2: t("dormScript.calculating"),
|
|
3: t("dormScript.completed2"),
|
|
4: t("dormScript.failed"),
|
|
}) as Record<number, string>
|
|
)[enumCode(v, { Queued: 1, Running: 2, Succeeded: 3, Failed: 4 })] ??
|
|
t("dormScript.unknown");
|
|
async function openCalculation(x: any, pageOrColumn: any = 1) {
|
|
const page = typeof pageOrColumn === "number" ? pageOrColumn : 1;
|
|
calculationResultPage.value = page;
|
|
const { data } = await http.get(`/dormitory-hygiene/calculations/${x.id}`, {
|
|
params: { page, pageSize: 50 },
|
|
});
|
|
selectedCalculation.value = data.calculation;
|
|
calculationResults.value = data.results.items ?? [];
|
|
calculationResultTotal.value = data.results.total ?? 0;
|
|
}
|
|
async function startCalculation() {
|
|
if (!calculationTermId.value)
|
|
return ElMessage.warning(t("businessLabels.selectTerm"));
|
|
if (!calculationBatchIds.value.length)
|
|
return ElMessage.warning(t("dormScript.selectAtLeastOneInspectionBatch"));
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
const { data } = await http.post("/dormitory-hygiene/calculations", {
|
|
academicTermId: calculationTermId.value,
|
|
batchIds: calculationBatchIds.value,
|
|
});
|
|
ElMessage.success(t("dormScript.summaryJobQueued"));
|
|
let completed = false;
|
|
for (let attempt = 0; attempt < 300; attempt++) {
|
|
await wait(1000);
|
|
const detail = (
|
|
await http.get(`/dormitory-hygiene/calculations/${data.id}`, {
|
|
params: { page: 1, pageSize: 50 },
|
|
})
|
|
).data;
|
|
selectedCalculation.value = detail.calculation;
|
|
calculationResults.value = detail.results.items ?? [];
|
|
calculationResultTotal.value = detail.results.total ?? 0;
|
|
const status = enumCode(detail.calculation.status, {
|
|
Queued: 1,
|
|
Running: 2,
|
|
Succeeded: 3,
|
|
Failed: 4,
|
|
});
|
|
if (status === 3) {
|
|
completed = true;
|
|
ElMessage.success(t("dormScript.termAverageHygieneScoresSaved"));
|
|
break;
|
|
}
|
|
if (status === 4)
|
|
throw new Error(
|
|
detail.calculation.errorMessage ||
|
|
t("dormScript.summaryCalculationFailed"),
|
|
);
|
|
}
|
|
if (!completed)
|
|
throw new Error(
|
|
t(
|
|
"dormScript.calculationIsStillRunningCheckTheCalculationHistoryLater",
|
|
),
|
|
);
|
|
await loadCalculations();
|
|
});
|
|
saving.value = false;
|
|
}
|
|
async function openBatch(x: any, page = 1) {
|
|
selectedBatch.value = x;
|
|
scorePage.value = page;
|
|
const { data } = await http.get(`/dormitory-hygiene/batches/${x.id}/scores`, {
|
|
params: {
|
|
buildingId: hygieneBuilding.value,
|
|
floor: hygieneFloor.value,
|
|
page,
|
|
pageSize: scorePageSize.value,
|
|
},
|
|
});
|
|
scores.value = data.scores.items;
|
|
scoreTotal.value = data.scores.total ?? 0;
|
|
scoreSummary.value = data.summary;
|
|
}
|
|
function openBatchForm(x?: any) {
|
|
editingBatch.value = x;
|
|
Object.assign(
|
|
batchForm,
|
|
x
|
|
? {
|
|
name: x.name,
|
|
inspectionDate: x.inspectionDate,
|
|
inspector: x.inspector ?? "",
|
|
}
|
|
: { name: "", inspectionDate: localDateValue(), inspector: "" },
|
|
);
|
|
batchDialog.value = true;
|
|
}
|
|
async function saveBatch() {
|
|
if (!batchForm.name.trim())
|
|
return ElMessage.warning(t("dormScript.enterABatchName"));
|
|
await safe(async () => {
|
|
editingBatch.value
|
|
? await http.put(
|
|
`/dormitory-hygiene/batches/${editingBatch.value.id}`,
|
|
batchForm,
|
|
)
|
|
: await http.post("/dormitory-hygiene/batches", batchForm);
|
|
batchDialog.value = false;
|
|
ElMessage.success(
|
|
editingBatch.value
|
|
? t("dormScript.batchUpdated")
|
|
: t("dormScript.batchCreated"),
|
|
);
|
|
await loadBatches();
|
|
if (
|
|
editingBatch.value &&
|
|
selectedBatch.value?.id === editingBatch.value.id
|
|
) {
|
|
const updated = batches.value.find((x) => x.id === editingBatch.value.id);
|
|
if (updated) await openBatch(updated);
|
|
}
|
|
});
|
|
}
|
|
async function deleteBatch(x: any) {
|
|
if (enumCode(x.status, { Draft: 1, Published: 2 }) === 2)
|
|
return ElMessage.warning(t("dormScript.publishedBatchesCannotBeDeleted"));
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("dormScript.deleteBatch", { name: x.name, count: x.scoreCount ?? 0 }),
|
|
t("dormScript.deleteInspectionBatch"),
|
|
{ type: "warning", confirmButtonText: t("dormScript.confirmDeletion") },
|
|
);
|
|
await http.delete(`/dormitory-hygiene/batches/${x.id}`);
|
|
if (selectedBatch.value?.id === x.id) {
|
|
selectedBatch.value = undefined;
|
|
scores.value = [];
|
|
scoreSummary.value = undefined;
|
|
}
|
|
await loadBatches();
|
|
ElMessage.success(t("dormScript.inspectionBatchDeleted"));
|
|
} catch (e) {
|
|
if (e !== "cancel" && e !== "close") ElMessage.error(apiErrorMessage(e));
|
|
}
|
|
}
|
|
async function searchScoreRooms(keyword = "") {
|
|
const requestId = ++scoreRoomsRequestId;
|
|
scoreRoomsLoading.value = true;
|
|
try {
|
|
const { data } = await http.get("/dormitory-hygiene/rooms", {
|
|
params: { keyword: keyword.trim() || undefined, page: 1, pageSize: 50 },
|
|
});
|
|
if (requestId !== scoreRoomsRequestId) return;
|
|
const selected = scoreRooms.value.find(
|
|
(item) => item.id === scoreForm.dormitoryRoomId,
|
|
);
|
|
scoreRooms.value = [
|
|
...(selected ? [selected] : []),
|
|
...data.items.filter((item: any) => item.id !== selected?.id),
|
|
];
|
|
} catch (e) {
|
|
ElMessage.error(apiErrorMessage(e));
|
|
} finally {
|
|
if (requestId === scoreRoomsRequestId) scoreRoomsLoading.value = false;
|
|
}
|
|
}
|
|
async function newScore(x?: any) {
|
|
Object.assign(
|
|
scoreForm,
|
|
x
|
|
? {
|
|
dormitoryRoomId: x.dormitoryRoomId,
|
|
floorScore: x.floorScore,
|
|
beddingScore: x.beddingScore,
|
|
belongingsScore: x.belongingsScore,
|
|
facilitiesScore: x.facilitiesScore,
|
|
safetyScore: x.safetyScore,
|
|
isViolation: Boolean(x.isViolation),
|
|
issues: x.issues ?? "",
|
|
notes: x.notes ?? "",
|
|
}
|
|
: {
|
|
dormitoryRoomId: "",
|
|
floorScore: 20,
|
|
beddingScore: 20,
|
|
belongingsScore: 20,
|
|
facilitiesScore: 20,
|
|
safetyScore: 20,
|
|
isViolation: false,
|
|
issues: "",
|
|
notes: "",
|
|
},
|
|
);
|
|
scoreRooms.value = x
|
|
? [
|
|
{
|
|
id: x.dormitoryRoomId,
|
|
buildingName: x.buildingName,
|
|
roomNumber: x.roomNumber,
|
|
},
|
|
]
|
|
: [];
|
|
await searchScoreRooms();
|
|
scoreDialog.value = true;
|
|
}
|
|
async function saveScore() {
|
|
if (!selectedBatch.value || !scoreForm.dormitoryRoomId) return;
|
|
await safe(async () => {
|
|
await http.put(
|
|
`/dormitory-hygiene/batches/${selectedBatch.value.id}/scores`,
|
|
{ scores: [scoreForm] },
|
|
);
|
|
scoreDialog.value = false;
|
|
await openBatch(selectedBatch.value);
|
|
ElMessage.success(t("dormScript.scoresSaved"));
|
|
});
|
|
}
|
|
async function publish() {
|
|
if (!selectedBatch.value) return;
|
|
try {
|
|
await ElMessageBox.confirm(
|
|
t("dormScript.publishTheScoresInThisBatch"),
|
|
t("dormScript.publishScores"),
|
|
{ type: "warning" },
|
|
);
|
|
await http.post(
|
|
`/dormitory-hygiene/batches/${selectedBatch.value.id}/publish`,
|
|
);
|
|
await Promise.all([openBatch(selectedBatch.value), loadBatches()]);
|
|
ElMessage.success(t("otherExams.published"));
|
|
} catch (e) {
|
|
if (e !== "cancel" && e !== "close") ElMessage.error(apiErrorMessage(e));
|
|
}
|
|
}
|
|
async function downloadScoreTemplate() {
|
|
if (selectedBatch.value)
|
|
await safe(async () =>
|
|
downloadApiFile(
|
|
`/dormitory-hygiene/batches/${selectedBatch.value.id}/template`,
|
|
t("dormScript.templateFile", { name: selectedBatch.value.name }),
|
|
),
|
|
);
|
|
}
|
|
async function exportScores() {
|
|
if (selectedBatch.value)
|
|
await safe(async () =>
|
|
downloadApiFile(
|
|
`/dormitory-hygiene/batches/${selectedBatch.value.id}/export.xlsx`,
|
|
t("dormScript.scoresFile", { name: selectedBatch.value.name }),
|
|
{
|
|
params: {
|
|
buildingId: hygieneBuilding.value,
|
|
floor: hygieneFloor.value,
|
|
},
|
|
},
|
|
),
|
|
);
|
|
}
|
|
async function importScores(event: Event) {
|
|
const input = event.target as HTMLInputElement,
|
|
file = input.files?.[0];
|
|
input.value = "";
|
|
if (!file || !selectedBatch.value) return;
|
|
saving.value = true;
|
|
await safe(async () => {
|
|
const { data } = await importExcel(
|
|
`/dormitory-hygiene/batches/${selectedBatch.value.id}/import`,
|
|
file,
|
|
);
|
|
ElMessage.success(t("dormScript.importScores", { count: data.imported }));
|
|
await Promise.all([openBatch(selectedBatch.value), loadBatches()]);
|
|
});
|
|
saving.value = false;
|
|
}
|
|
watch(locale, async () => {
|
|
if (activeTab.value === "overview") {
|
|
await nextTick();
|
|
renderCharts();
|
|
}
|
|
});
|
|
watch(activeTab, async (x) => {
|
|
if (x === "overview") {
|
|
await nextTick();
|
|
renderCharts();
|
|
}
|
|
if (x === "allocation")
|
|
await Promise.all([
|
|
students.value.length ? Promise.resolve() : loadStudents(),
|
|
studentFilterOptions.classes.length
|
|
? Promise.resolve()
|
|
: loadStudentFilterOptions(),
|
|
]);
|
|
});
|
|
watch(
|
|
() => props.section,
|
|
(x) => {
|
|
if (x) activeTab.value = x;
|
|
},
|
|
);
|
|
watch(calculationTermId, () => {
|
|
if (canManage.value) safe(loadCalculationOptions);
|
|
});
|
|
watch(studentTermId, resetStudentCalculator);
|
|
onMounted(() => {
|
|
window.addEventListener("resize", renderCharts);
|
|
load();
|
|
});
|
|
onBeforeUnmount(() => {
|
|
window.removeEventListener("resize", renderCharts);
|
|
charts.forEach((x) => x.dispose());
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="page" v-loading="loading">
|
|
<header class="hero">
|
|
<div>
|
|
<small>CAMPUS LIVING</small>
|
|
<h1>{{ pageTitle }}</h1>
|
|
<p>{{ pageDescription }}</p>
|
|
</div>
|
|
<el-button
|
|
v-if="isStudent && mine.room"
|
|
type="primary"
|
|
size="large"
|
|
:icon="Plus"
|
|
@click="applicationDialog = true"
|
|
>{{ t("dormTemplate.submitAccommodationRequest") }}</el-button
|
|
>
|
|
</header>
|
|
<template v-if="isStudent"
|
|
><section v-if="mine.room" class="room-banner">
|
|
<HomeFilled />
|
|
<div>
|
|
<small>{{ t("dormTemplate.currentAccommodation") }}</small>
|
|
<h2>{{ mine.room.buildingName }} · {{ mine.room.roomNumber }}</h2>
|
|
<span>{{
|
|
t("dormTemplate.bedBedCheckedInDate", {
|
|
bed: mine.room.bedNumber,
|
|
date: fmt(mine.room.checkInDate),
|
|
})
|
|
}}</span>
|
|
</div>
|
|
</section>
|
|
<el-empty v-else :description="t('batchBusiness.noDormitoryAssigned')" />
|
|
<section class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.myAccommodationRequests") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.afterCounselorReviewDormitoryStaffMakeTheFinalDecisionAndChangeTheBedAssignment",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<el-table :data="myApplications"
|
|
><el-table-column :label="t('businessLabels.type')" width="90"
|
|
><template #default="{ row }">{{
|
|
appType(row.type) === 1
|
|
? t("dormTemplate.transfer")
|
|
: t("dormTemplate.checkOut")
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
prop="reason"
|
|
:label="t('businessLabels.reason')"
|
|
/><el-table-column :label="t('businessLabels.status')" width="150"
|
|
><template #default="{ row }">{{
|
|
appStatusLabel(row.status)
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
prop="finalComment"
|
|
:label="t('businessLabels.reviewComment')"
|
|
/><el-table-column width="160"
|
|
><template #default="{ row }"
|
|
><el-button
|
|
link
|
|
type="primary"
|
|
@click="
|
|
$router.push({
|
|
path: '/approvals',
|
|
query: {
|
|
progressType: 'DormitoryApplication',
|
|
progressId: row.id,
|
|
},
|
|
})
|
|
"
|
|
>{{ t("approvalProgress.title") }}</el-button
|
|
><el-button
|
|
v-if="appStatus(row.status) === 1"
|
|
link
|
|
type="danger"
|
|
@click="cancelApp(row.id)"
|
|
>{{ t("teachingPreferences.withdraw") }}</el-button
|
|
></template
|
|
></el-table-column
|
|
></el-table
|
|
>
|
|
</section>
|
|
<section class="panel calculator">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.termHygieneAverageCalculator") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.calculatedOnlyInThisBrowserAndNotSavedExcludeInspectionBatchesAsNeeded",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<div class="calculator-result">
|
|
<b>{{
|
|
studentCalculatorAverage === null
|
|
? "—"
|
|
: studentCalculatorAverage.toFixed(2)
|
|
}}</b
|
|
><span>{{ t("courseStats.average") }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="filters">
|
|
<el-select
|
|
v-model="studentTermId"
|
|
:placeholder="t('batchBusiness.selectTerm')"
|
|
><el-option
|
|
v-for="term in terms"
|
|
:key="term.id"
|
|
:label="term.name"
|
|
:value="term.id" /></el-select
|
|
><el-select
|
|
v-model="studentBatchIds"
|
|
multiple
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
:placeholder="t('batchBusiness.selectBatchesToInclude')"
|
|
><el-option
|
|
v-for="score in studentTermScores"
|
|
:key="score.dormitoryHygieneBatchId"
|
|
:label="
|
|
t('dormTemplate.nameDateScorePoints', {
|
|
name: score.batchName,
|
|
date: fmt(score.inspectionDate),
|
|
score: score.totalScore,
|
|
})
|
|
"
|
|
:value="score.dormitoryHygieneBatchId"
|
|
/></el-select>
|
|
</div>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.includesCountBatchesAndViolationsViolationsScoresAroundTransfersAndCheckoutAreMatchedToAccommodationHistoryOnTheInspectionDate",
|
|
{
|
|
count: studentCalculatorScores.length,
|
|
violations: studentCalculatorViolations,
|
|
},
|
|
)
|
|
}}
|
|
</p>
|
|
</section>
|
|
<section class="cards">
|
|
<article v-for="x in mine.scores" :key="x.id">
|
|
<div class="score-head">
|
|
<div>
|
|
<small
|
|
>{{ fmt(x.inspectionDate) }} · {{ x.buildingName }}
|
|
{{ x.roomNumber }} ·
|
|
{{
|
|
t("dormTemplateCounts.bedBed", { bed: x.bedNumber })
|
|
}}</small
|
|
>
|
|
<h3>{{ x.batchName }}</h3>
|
|
</div>
|
|
<b>{{
|
|
t("dormTemplateCounts.scorePoints", { score: x.totalScore })
|
|
}}</b>
|
|
</div>
|
|
<div class="score-tags">
|
|
<el-tag>{{ gradeLabel(x.grade) }}</el-tag
|
|
><el-tag v-if="x.isViolation" type="danger">{{
|
|
t("batchBusiness.violation")
|
|
}}</el-tag>
|
|
</div>
|
|
<p>{{ x.issues || t("dormTemplate.noIssuesInThisInspection") }}</p>
|
|
</article>
|
|
</section></template
|
|
>
|
|
<template v-else
|
|
><el-tabs v-if="!props.section" v-model="activeTab"
|
|
><el-tab-pane
|
|
:label="t('batchBusiness.occupancyOverview')"
|
|
name="overview" /><el-tab-pane
|
|
:label="t('batchBusiness.buildingsAndBeds')"
|
|
name="buildings" /><el-tab-pane
|
|
v-if="canManage"
|
|
:label="t('batchBusiness.allocationAndTransfers')"
|
|
name="allocation" /><el-tab-pane
|
|
:label="t('batchBusiness.accommodationRequests')"
|
|
name="applications" /><el-tab-pane
|
|
:label="t('batchBusiness.hygieneScores')"
|
|
name="scores"
|
|
/></el-tabs>
|
|
<template v-if="activeTab === 'overview'"
|
|
><section class="stats">
|
|
<article>
|
|
<small>{{ t("shared.bed.building") }}</small
|
|
><b>{{
|
|
t("dormTemplateCounts.countBuildings", {
|
|
count: overview?.buildingCount ?? 0,
|
|
})
|
|
}}</b>
|
|
</article>
|
|
<article>
|
|
<small>{{ t("dormTemplate.roomsBeds") }}</small
|
|
><b>{{
|
|
t("dormTemplateCounts.roomsRoomsBedsBeds", {
|
|
rooms: overview?.roomCount ?? 0,
|
|
beds: overview?.bedCount ?? 0,
|
|
})
|
|
}}</b>
|
|
</article>
|
|
<article>
|
|
<small>{{ t("dormTemplate.occupancyRate") }}</small
|
|
><b>{{ overview?.occupancyRate ?? 0 }}%</b
|
|
><span
|
|
>{{ overview?.occupiedCount ?? 0 }}
|
|
{{ t("graduationAudits.people") }}</span
|
|
>
|
|
</article>
|
|
<article>
|
|
<small>{{ t("dormTemplate.vacancyRate") }}</small
|
|
><b>{{ overview?.vacancyRate ?? 0 }}%</b
|
|
><span>{{
|
|
t("dormTemplateCounts.countBeds", {
|
|
count: overview?.vacantCount ?? 0,
|
|
})
|
|
}}</span>
|
|
</article>
|
|
<article>
|
|
<small>{{ t("dormTemplate.unassignedStudents") }}</small
|
|
><b>{{ overview?.unassignedStudentCount ?? 0 }}</b
|
|
><span>{{ t("graduationAudits.people") }}</span>
|
|
</article>
|
|
<article>
|
|
<small>{{ t("dormTemplate.pendingRequests") }}</small
|
|
><b>{{
|
|
t("dormTemplateCounts.countRequests", {
|
|
count: overview?.pendingApplicationCount ?? 0,
|
|
})
|
|
}}</b>
|
|
</article>
|
|
</section>
|
|
<section class="charts">
|
|
<article class="panel">
|
|
<h2>{{ t("dormTemplate.bedOccupancyBreakdown") }}</h2>
|
|
<div ref="pieEl" class="chart" />
|
|
</article>
|
|
<article class="panel">
|
|
<h2>{{ t("dormTemplate.occupancyByBuilding") }}</h2>
|
|
<div ref="barEl" class="chart" />
|
|
</article></section
|
|
></template>
|
|
<section v-else-if="activeTab === 'buildings'" class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.buildingsRoomsAndBeds") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.occupiedBedsCanBeDeletedOnlyAfterTransferOrCheckoutExcelImportsMergeByCodeAndDoNotDeleteRecordsAbsentFromTheFile",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<div v-if="canManage" class="tools">
|
|
<el-button :icon="Download" @click="downloadHousingTemplate">{{
|
|
t("dormTemplate.importTemplate")
|
|
}}</el-button
|
|
><el-button :icon="Upload" @click="housingFile?.click()">{{
|
|
t("businessLabels.batchImport")
|
|
}}</el-button
|
|
><input
|
|
ref="housingFile"
|
|
hidden
|
|
type="file"
|
|
accept=".xlsx"
|
|
@change="importHousing"
|
|
/><el-button :icon="Download" @click="exportHousing">{{
|
|
t("businessLabels.exportAll")
|
|
}}</el-button
|
|
><el-button type="primary" @click="openBuilding()">{{
|
|
t("dormTemplate.addBuilding")
|
|
}}</el-button>
|
|
</div>
|
|
</div>
|
|
<el-collapse
|
|
><el-collapse-item v-for="b in buildings" :key="b.id" :name="b.id"
|
|
><template #title
|
|
><div class="building">
|
|
<b>{{ b.name }}</b
|
|
><small
|
|
>{{ b.code }} · {{ gender(b.genderPolicy) }} ·
|
|
{{
|
|
t("dormTemplateCounts.countFloors", { count: b.floorCount })
|
|
}}</small
|
|
>
|
|
</div></template
|
|
>
|
|
<div class="tools" v-if="canManage">
|
|
<el-button size="small" @click="openRoom(b)">{{
|
|
t("dormTemplate.addRoom")
|
|
}}</el-button
|
|
><el-button size="small" @click="openBuilding(b)">{{
|
|
t("dormTemplate.editBuilding")
|
|
}}</el-button>
|
|
</div>
|
|
<el-table :data="b.rooms"
|
|
><el-table-column :label="t('shared.bed.room')" width="120"
|
|
><template #default="{ row }"
|
|
><b>{{ row.roomNumber }}</b
|
|
><small class="block">{{
|
|
t("dormTemplateCounts.floorFloorGender", {
|
|
floor: row.floor,
|
|
gender: gender(row.genderPolicy),
|
|
})
|
|
}}</small></template
|
|
></el-table-column
|
|
><el-table-column :label="t('batchBusiness.bedsAndOccupancy')"
|
|
><template #default="{ row }"
|
|
><div class="beds">
|
|
<div
|
|
v-for="bed in row.beds"
|
|
:key="bed.id"
|
|
:class="['bed', { used: bed.occupant }]"
|
|
>
|
|
<b>{{
|
|
t("dormTemplateCounts.bedBed", { bed: bed.bedNumber })
|
|
}}</b
|
|
><span>{{
|
|
bed.occupant
|
|
? `${bed.occupant.name} · ${bed.occupant.studentNumber}`
|
|
: t("dormTemplate.vacant")
|
|
}}</span
|
|
><small v-if="bed.occupant">{{
|
|
bed.occupant.majorName
|
|
}}</small
|
|
><small v-if="bed.occupant"
|
|
>{{ t("batchBusiness.checkIn") }}
|
|
{{ fmt(bed.occupant.checkInDate) }}</small
|
|
>
|
|
<div v-if="canManage && bed.occupant" class="bed-actions">
|
|
<el-button
|
|
link
|
|
@click="openCheckInDate(bed.occupant)"
|
|
>{{ t("dormTemplate.changeDate") }}</el-button
|
|
><el-button link @click="openTransfer(bed.occupant)">{{
|
|
t("dormTemplate.transfer")
|
|
}}</el-button>
|
|
</div>
|
|
</div>
|
|
</div></template
|
|
></el-table-column
|
|
><el-table-column :label="t('batchBusiness.checkIn')" width="80"
|
|
><template #default="{ row }"
|
|
>{{ row.occupiedCount }}/{{ row.capacity }}</template
|
|
></el-table-column
|
|
><el-table-column v-if="canManage" width="120"
|
|
><template #default="{ row }"
|
|
><el-button link @click="openBeds(row)">{{
|
|
t("dormTemplate.bed")
|
|
}}</el-button
|
|
><el-button link @click="openRoom(b, row)">{{
|
|
t("businessLabels.edit")
|
|
}}</el-button></template
|
|
></el-table-column
|
|
></el-table
|
|
></el-collapse-item
|
|
></el-collapse
|
|
>
|
|
</section>
|
|
<template v-else-if="activeTab === 'allocation'"
|
|
><section class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.allocateStudentsInBulk") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.filterByMultipleYearsMajorsAndClassesGenderIsRequiredSameMajorAndSameClassAssignmentsArePreferredAutomaticAllocationRunsInTheBackgroundAndSelectionsPersistAcrossPages",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<span>{{
|
|
allocationJobStatus
|
|
? t(allocationJobStatus)
|
|
: t("dormTemplate.countStudentsAwaitingAllocation", {
|
|
count: studentTotal,
|
|
})
|
|
}}</span>
|
|
</div>
|
|
<div class="filters allocation-filters">
|
|
<el-input
|
|
v-model="studentKeyword"
|
|
:placeholder="t('businessLabels.studentSearch')"
|
|
@keyup.enter="searchStudents"
|
|
><template #prefix><Search /></template></el-input
|
|
><el-select
|
|
v-model="studentGradeFilter"
|
|
multiple
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
clearable
|
|
:placeholder="t('auth.activation.selectGrade')"
|
|
><el-option
|
|
v-for="x in studentFilterOptions.grades"
|
|
:key="x"
|
|
:label="t('dormTemplate.enrolledYear', { year: x })"
|
|
:value="x" /></el-select
|
|
><el-select
|
|
v-model="studentMajorFilter"
|
|
multiple
|
|
filterable
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
clearable
|
|
:placeholder="t('auth.activation.selectMajor')"
|
|
><el-option
|
|
v-for="x in studentFilterOptions.majors"
|
|
:key="x.id"
|
|
:label="x.name"
|
|
:value="x.id" /></el-select
|
|
><el-select
|
|
v-model="studentClassFilter"
|
|
multiple
|
|
filterable
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
clearable
|
|
:placeholder="t('batchBusiness.selectClass')"
|
|
><el-option
|
|
v-for="x in studentFilterOptions.classes"
|
|
:key="x.id"
|
|
:label="
|
|
t('dormTemplate.enrolledYearMajorName', {
|
|
year: x.grade,
|
|
major: x.majorName,
|
|
name: x.name,
|
|
})
|
|
"
|
|
:value="x.id" /></el-select
|
|
><el-select
|
|
v-model="buildingFilter"
|
|
multiple
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
clearable
|
|
:placeholder="t('batchBusiness.restrictBuilding')"
|
|
><el-option
|
|
v-for="b in buildings"
|
|
:key="b.id"
|
|
:label="b.name"
|
|
:value="b.id" /></el-select
|
|
><el-button @click="searchStudents">{{
|
|
t("businessLabels.search")
|
|
}}</el-button
|
|
><el-button @click="manual">{{
|
|
t("dormTemplate.manualAllocation")
|
|
}}</el-button
|
|
><el-button type="primary" :loading="saving" @click="automatic">{{
|
|
t("dormTemplate.automaticAllocationPreviewCount", {
|
|
count: selectedStudents.length,
|
|
})
|
|
}}</el-button>
|
|
</div>
|
|
<el-table
|
|
ref="allocationTable"
|
|
:data="students"
|
|
row-key="id"
|
|
max-height="420"
|
|
@selection-change="selectedStudents = $event"
|
|
><el-table-column
|
|
type="selection"
|
|
reserve-selection /><el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')" /><el-table-column
|
|
prop="name"
|
|
:label="t('businessLabels.name')" /><el-table-column
|
|
prop="grade"
|
|
:label="t('businessLabels.grade')"
|
|
width="85"
|
|
><template #default="{ row }">{{
|
|
t("dormTemplate.enrolledYear", { year: row.grade })
|
|
}}</template></el-table-column
|
|
><el-table-column :label="t('businessLabels.gender')"
|
|
><template #default="{ row }">{{
|
|
gender(row.gender)
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
prop="majorName"
|
|
:label="t('businessLabels.major')" /><el-table-column
|
|
prop="className"
|
|
:label="t('businessLabels.class')" /></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="studentPage"
|
|
:page-size="studentPageSize"
|
|
:page-sizes="[50, 100, 200]"
|
|
:total="studentTotal"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@current-change="changeStudentPage"
|
|
@size-change="changeStudentPageSize"
|
|
/>
|
|
</section>
|
|
<section v-if="assignments.length" class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.allocationPreview") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.changeBedsIndividuallyBeforeConfirmingTheCheckInDateCanBeInThePastOrFuture",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<div class="tools">
|
|
<el-date-picker
|
|
v-model="allocationCheckInDate"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
format="YYYY-MM-DD"
|
|
:placeholder="t('batchBusiness.checkInDate')"
|
|
/><el-button type="success" @click="commit">{{
|
|
t("dormTemplateCounts.confirmCheckInForCountStudents", {
|
|
count: assignments.length,
|
|
})
|
|
}}</el-button>
|
|
</div>
|
|
</div>
|
|
<el-table :data="pagedAssignments"
|
|
><el-table-column
|
|
prop="studentNumber"
|
|
:label="t('businessLabels.studentNumber')"
|
|
/><el-table-column
|
|
:prop="allocationMode === 2 ? 'studentName' : 'name'"
|
|
:label="t('businessLabels.name')"
|
|
/><el-table-column
|
|
prop="majorName"
|
|
:label="t('businessLabels.major')"
|
|
/><el-table-column :label="t('batchBusiness.targetBed')"
|
|
><template #default="{ row }"
|
|
><span>{{
|
|
assignmentBedLabel(row) || t("dormTemplate.notSelected")
|
|
}}</span
|
|
><el-button
|
|
link
|
|
type="primary"
|
|
style="margin-left: 8px"
|
|
@click="openBedEdit(row)"
|
|
>{{ t("dormTemplate.edit") }}</el-button
|
|
></template
|
|
></el-table-column
|
|
></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="assignmentPage"
|
|
:page-size="assignmentPageSize"
|
|
:page-sizes="[100, 200, 500]"
|
|
:total="assignments.length"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@current-change="changeAssignmentPage"
|
|
@size-change="changeAssignmentPageSize"
|
|
/></section
|
|
></template>
|
|
<section v-else-if="activeTab === 'applications'" class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.transferAndCheckoutReview") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.theCounselorVerifiesDormitoryStaffChangeOrReleaseTheBedAtFinalReview",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<el-table :data="applications"
|
|
><el-table-column :label="t('batchBusiness.student')"
|
|
><template #default="{ row }"
|
|
><b>{{ row.studentName }}</b
|
|
><small class="block"
|
|
>{{ row.studentNumber }} · {{ row.className }}</small
|
|
></template
|
|
></el-table-column
|
|
><el-table-column :label="t('businessLabels.type')"
|
|
><template #default="{ row }">{{
|
|
appType(row.type) === 1
|
|
? t("dormTemplate.transfer")
|
|
: t("dormTemplate.checkOut")
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
prop="current"
|
|
:label="t('batchBusiness.currentBed')"
|
|
/><el-table-column
|
|
prop="reason"
|
|
:label="t('businessLabels.reason')"
|
|
/><el-table-column :label="t('businessLabels.status')"
|
|
><template #default="{ row }">{{
|
|
appStatusLabel(row.status)
|
|
}}</template></el-table-column
|
|
><el-table-column :label="t('businessLabels.actions')" width="200"
|
|
><template #default="{ row }"
|
|
><template v-if="appStatus(row.status) === 1 && canCounselor"
|
|
><el-button
|
|
link
|
|
type="success"
|
|
@click="counselorReview(row, true)"
|
|
>{{ t("businessLabels.approve") }}</el-button
|
|
><el-button
|
|
link
|
|
type="danger"
|
|
@click="counselorReview(row, false)"
|
|
>{{ t("businessLabels.reject") }}</el-button
|
|
></template
|
|
><el-button
|
|
v-if="appStatus(row.status) === 2 && canManage"
|
|
link
|
|
@click="openFinal(row)"
|
|
>{{ t("dormTemplate.dormitoryFinalReview") }}</el-button
|
|
></template
|
|
></el-table-column
|
|
></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="applicationPage"
|
|
:page-size="applicationPageSize"
|
|
:total="applicationTotal"
|
|
layout="total, prev, pager, next"
|
|
@current-change="loadApps"
|
|
/>
|
|
</section>
|
|
<template v-else
|
|
><section v-if="canManage" class="panel calculator">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.termHygieneAverageCalculator2") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.selectPublishedBatchesTheBackgroundCalculationUsesAccommodationHistoryOnEachInspectionDateAndSavesTraceableResultsForAssessment",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<el-button
|
|
type="primary"
|
|
:loading="saving"
|
|
@click="startCalculation"
|
|
>{{ t("dormTemplate.startBackgroundCalculation") }}</el-button
|
|
>
|
|
</div>
|
|
<div class="filters">
|
|
<el-select
|
|
v-model="calculationTermId"
|
|
:placeholder="t('batchBusiness.selectTerm')"
|
|
><el-option
|
|
v-for="term in terms"
|
|
:key="term.id"
|
|
:label="term.name"
|
|
:value="term.id" /></el-select
|
|
><el-select
|
|
v-model="calculationBatchIds"
|
|
multiple
|
|
collapse-tags
|
|
collapse-tags-tooltip
|
|
:placeholder="t('batchBusiness.selectBatchesToInclude')"
|
|
><el-option
|
|
v-for="batch in calculationOptions"
|
|
:key="batch.id"
|
|
:label="
|
|
t('dormTemplateCounts.nameDateCountRooms', {
|
|
name: batch.name,
|
|
date: fmt(batch.inspectionDate),
|
|
count: batch.scoreCount,
|
|
})
|
|
"
|
|
:value="batch.id"
|
|
/></el-select>
|
|
</div>
|
|
<el-table
|
|
:data="calculations"
|
|
@row-click="(row) => openCalculation(row)"
|
|
><el-table-column
|
|
prop="termName"
|
|
:label="t('businessLabels.term')"
|
|
/><el-table-column :label="t('batchBusiness.batch')"
|
|
><template #default="{ row }">{{
|
|
t("dormTemplateCounts.count", { count: row.selectedBatchCount })
|
|
}}</template></el-table-column
|
|
><el-table-column :label="t('batchBusiness.student')"
|
|
><template #default="{ row }"
|
|
>{{ row.studentCount }} {{ t("graduationAudits.people")
|
|
}}<span v-if="row.studentWithoutScoreCount">{{
|
|
t("dormTemplateCounts.countStudentsWithoutScores", {
|
|
count: row.studentWithoutScoreCount,
|
|
})
|
|
}}</span></template
|
|
></el-table-column
|
|
><el-table-column :label="t('businessLabels.status')"
|
|
><template #default="{ row }"
|
|
><el-tag
|
|
:type="
|
|
enumCode(row.status, {
|
|
Queued: 1,
|
|
Running: 2,
|
|
Succeeded: 3,
|
|
Failed: 4,
|
|
}) === 3
|
|
? 'success'
|
|
: enumCode(row.status, {
|
|
Queued: 1,
|
|
Running: 2,
|
|
Succeeded: 3,
|
|
Failed: 4,
|
|
}) === 4
|
|
? 'danger'
|
|
: 'warning'
|
|
"
|
|
>{{ calculationStatus(row.status) }}</el-tag
|
|
></template
|
|
></el-table-column
|
|
><el-table-column :label="t('repairManagement.completedAt')"
|
|
><template #default="{ row }">{{
|
|
fmt(row.completedAt)
|
|
}}</template></el-table-column
|
|
></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="calculationPage"
|
|
:page-size="calculationPageSize"
|
|
:total="calculationTotal"
|
|
layout="total, prev, pager, next"
|
|
@current-change="loadCalculations"
|
|
/>
|
|
</section>
|
|
<section v-if="canManage && selectedCalculation" class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>
|
|
{{
|
|
t("dormTemplate.nameSummaryResults", {
|
|
name: selectedCalculation.termName,
|
|
})
|
|
}}
|
|
</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.includesCountBatchesMissingScoresMeanTheStudentWasHousedThatDayButNoScoreWasEnteredForThatRoomInThatBatch",
|
|
{ count: selectedCalculation.selectedBatchCount },
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<el-tag>{{ calculationStatus(selectedCalculation.status) }}</el-tag>
|
|
</div>
|
|
<el-alert
|
|
v-if="selectedCalculation.errorMessage"
|
|
type="error"
|
|
:title="selectedCalculation.errorMessage"
|
|
show-icon
|
|
/><el-table :data="calculationResults"
|
|
><el-table-column :label="t('batchBusiness.student')"
|
|
><template #default="{ row }"
|
|
><b>{{ row.name }}</b
|
|
><small class="block"
|
|
>{{ row.studentNumber }} · {{ row.majorName }} ·
|
|
{{ row.className }}</small
|
|
></template
|
|
></el-table-column
|
|
><el-table-column :label="t('courseStats.average')"
|
|
><template #default="{ row }"
|
|
><b>{{ row.averageScore ?? "—" }}</b></template
|
|
></el-table-column
|
|
><el-table-column
|
|
prop="includedScoreCount"
|
|
:label="t('batchBusiness.includedCount')" /><el-table-column
|
|
prop="missingScoreCount"
|
|
:label="t('batchBusiness.missingCount')" /><el-table-column
|
|
prop="violationCount"
|
|
:label="t('batchBusiness.violationCount')" /></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="calculationResultPage"
|
|
:page-size="50"
|
|
:total="calculationResultTotal"
|
|
layout="total, prev, pager, next"
|
|
@current-change="
|
|
(page) => openCalculation(selectedCalculation, page)
|
|
"
|
|
/>
|
|
</section>
|
|
<section class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ t("dormTemplate.hygieneInspectionBatches") }}</h2>
|
|
<p>
|
|
{{
|
|
t(
|
|
"dormTemplate.editingAPublishedBatchOrScoreRetainsItsPublishedStatusPublishedBatchesCannotBeDeleted",
|
|
)
|
|
}}
|
|
</p>
|
|
</div>
|
|
<el-button
|
|
v-if="canManage"
|
|
type="primary"
|
|
@click="openBatchForm()"
|
|
>{{ t("dormTemplate.newBatch") }}</el-button
|
|
>
|
|
</div>
|
|
<el-table :data="batches" @row-click="(row) => openBatch(row)"
|
|
><el-table-column
|
|
prop="name"
|
|
:label="t('batchBusiness.batch')"
|
|
/><el-table-column :label="t('businessLabels.date')"
|
|
><template #default="{ row }">{{
|
|
fmt(row.inspectionDate)
|
|
}}</template></el-table-column
|
|
><el-table-column :label="t('businessLabels.score')"
|
|
><template #default="{ row }">{{
|
|
t(
|
|
"dormTemplateCounts.countRoomsAverageAverageViolationsViolations",
|
|
{
|
|
count: row.scoreCount,
|
|
average: row.averageScore ?? "—",
|
|
violations: row.violationCount ?? 0,
|
|
},
|
|
)
|
|
}}</template></el-table-column
|
|
><el-table-column :label="t('businessLabels.status')"
|
|
><template #default="{ row }">{{
|
|
enumCode(row.status, { Draft: 1, Published: 2 }) === 2
|
|
? t("teachingMonitoring.published")
|
|
: t("adjustmentBatch.draft")
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
v-if="canManage"
|
|
:label="t('businessLabels.actions')"
|
|
width="130"
|
|
><template #default="{ row }"
|
|
><el-button link @click.stop="openBatchForm(row)">{{
|
|
t("dormTemplate.edit")
|
|
}}</el-button
|
|
><el-button
|
|
link
|
|
type="danger"
|
|
:disabled="
|
|
enumCode(row.status, { Draft: 1, Published: 2 }) === 2
|
|
"
|
|
@click.stop="deleteBatch(row)"
|
|
>{{ t("businessLabels.delete") }}</el-button
|
|
></template
|
|
></el-table-column
|
|
></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="batchPage"
|
|
:page-size="batchPageSize"
|
|
:total="batchTotal"
|
|
layout="total, prev, pager, next"
|
|
@current-change="loadBatches"
|
|
/>
|
|
</section>
|
|
<section v-if="selectedBatch" class="panel">
|
|
<div class="title">
|
|
<div>
|
|
<h2>{{ selectedBatch.name }}</h2>
|
|
<p>
|
|
{{
|
|
t("dormTemplate.averageAverageCountRoomsWithViolations", {
|
|
average: scoreSummary?.averageScore ?? 0,
|
|
count: scoreSummary?.violationCount ?? 0,
|
|
})
|
|
}}
|
|
</p>
|
|
</div>
|
|
<div class="tools">
|
|
<el-button
|
|
v-if="canManage"
|
|
:icon="Download"
|
|
@click="downloadScoreTemplate"
|
|
>{{ t("dormTemplate.importTemplate") }}</el-button
|
|
><el-button
|
|
v-if="canManage"
|
|
:icon="Upload"
|
|
@click="scoreFile?.click()"
|
|
>{{ t("businessLabels.batchImport") }}</el-button
|
|
><input
|
|
ref="scoreFile"
|
|
hidden
|
|
type="file"
|
|
accept=".xlsx"
|
|
@change="importScores"
|
|
/><el-button :icon="Download" @click="exportScores">{{
|
|
t("dormTemplate.exportScores")
|
|
}}</el-button
|
|
><el-button v-if="canManage" @click="newScore()">{{
|
|
t("dormTemplate.enter")
|
|
}}</el-button
|
|
><el-button v-if="canManage" type="success" @click="publish">{{
|
|
t("businessLabels.publish")
|
|
}}</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="filters">
|
|
<el-select
|
|
v-model="hygieneBuilding"
|
|
clearable
|
|
:placeholder="t('batchBusiness.allBuildings')"
|
|
@change="hygieneFloor = undefined"
|
|
><el-option
|
|
v-for="b in buildings"
|
|
:key="b.id"
|
|
:label="b.name"
|
|
:value="b.id" /></el-select
|
|
><el-select
|
|
v-model="hygieneFloor"
|
|
clearable
|
|
:placeholder="t('batchBusiness.allFloors')"
|
|
><el-option
|
|
v-for="floor in hygieneFloors"
|
|
:key="floor"
|
|
:label="t('dormTemplate.floorFloor', { floor })"
|
|
:value="floor" /></el-select
|
|
><el-button @click="openBatch(selectedBatch)">{{
|
|
t("dormTemplate.filterByFloor")
|
|
}}</el-button>
|
|
</div>
|
|
<el-table :data="scores"
|
|
><el-table-column :label="t('batchBusiness.dormitory')"
|
|
><template #default="{ row }"
|
|
>{{ row.buildingName }} · {{ row.roomNumber }}</template
|
|
></el-table-column
|
|
><el-table-column
|
|
prop="floor"
|
|
:label="t('shared.bed.floor')"
|
|
width="75"
|
|
><template #default="{ row }">{{
|
|
t("dormTemplate.floorFloor", { floor: row.floor })
|
|
}}</template></el-table-column
|
|
><el-table-column
|
|
prop="floorScore"
|
|
:label="t('batchBusiness.floor')"
|
|
/><el-table-column
|
|
prop="beddingScore"
|
|
:label="t('batchBusiness.bedding')"
|
|
/><el-table-column
|
|
prop="belongingsScore"
|
|
:label="t('batchBusiness.belongings')"
|
|
/><el-table-column
|
|
prop="facilitiesScore"
|
|
:label="t('batchBusiness.facilities')"
|
|
/><el-table-column
|
|
prop="safetyScore"
|
|
:label="t('batchBusiness.safety')"
|
|
/><el-table-column :label="t('batchBusiness.violation')" width="75"
|
|
><template #default="{ row }"
|
|
><el-tag v-if="row.isViolation" type="danger">{{
|
|
t("businessLabels.yes")
|
|
}}</el-tag
|
|
><span v-else>{{ t("businessLabels.no") }}</span></template
|
|
></el-table-column
|
|
><el-table-column :label="t('batchBusiness.totalScore')"
|
|
><template #default="{ row }"
|
|
><b>{{ row.totalScore }}</b>
|
|
{{ gradeLabel(row.grade) }}</template
|
|
></el-table-column
|
|
><el-table-column
|
|
prop="issues"
|
|
:label="t('batchBusiness.issuesAndImprovements')"
|
|
/><el-table-column v-if="canManage" width="70"
|
|
><template #default="{ row }"
|
|
><el-button link @click="newScore(row)">{{
|
|
t("businessLabels.edit")
|
|
}}</el-button></template
|
|
></el-table-column
|
|
></el-table
|
|
><el-pagination
|
|
class="student-pagination"
|
|
background
|
|
:current-page="scorePage"
|
|
:page-size="scorePageSize"
|
|
:total="scoreTotal"
|
|
layout="total, prev, pager, next"
|
|
@current-change="(page) => openBatch(selectedBatch, page)"
|
|
/></section></template
|
|
></template>
|
|
<el-dialog
|
|
v-model="buildingDialog"
|
|
:title="
|
|
editingBuilding
|
|
? t('dormTemplate.editBuilding')
|
|
: t('dormTemplate.addBuilding')
|
|
"
|
|
width="520"
|
|
><el-form label-position="top"
|
|
><div class="form-grid">
|
|
<el-form-item :label="t('baseData.code')"
|
|
><el-input v-model="buildingForm.code" /></el-form-item
|
|
><el-form-item :label="t('baseData.name')"
|
|
><el-input v-model="buildingForm.name" /></el-form-item
|
|
><el-form-item :label="t('batchBusiness.numberOfFloors')"
|
|
><el-input-number
|
|
v-model="buildingForm.floorCount"
|
|
:min="1" /></el-form-item
|
|
><el-form-item :label="t('businessLabels.gender')"
|
|
><el-select v-model="buildingForm.genderPolicy"
|
|
><el-option
|
|
:label="t('freeClassrooms.unlimited')"
|
|
:value="0" /><el-option
|
|
:label="t('batchBusiness.maleStudents')"
|
|
:value="1" /><el-option
|
|
:label="t('batchBusiness.femaleStudents')"
|
|
:value="2" /></el-select
|
|
></el-form-item>
|
|
</div>
|
|
<el-form-item :label="t('businessLabels.enabled')"
|
|
><el-switch
|
|
v-model="buildingForm.isEnabled" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="buildingDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="saveBuilding">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="roomDialog"
|
|
:title="
|
|
editingRoom ? t('dormTemplate.editRoom') : t('dormTemplate.addRoom')
|
|
"
|
|
width="520"
|
|
><el-form label-position="top"
|
|
><div class="form-grid">
|
|
<el-form-item :label="t('batchBusiness.roomNumber')"
|
|
><el-input v-model="roomForm.roomNumber" /></el-form-item
|
|
><el-form-item :label="t('shared.bed.floor')"
|
|
><el-input-number v-model="roomForm.floor" :min="1" /></el-form-item
|
|
><el-form-item :label="t('businessLabels.gender')"
|
|
><el-select v-model="roomForm.genderPolicy"
|
|
><el-option
|
|
:label="t('batchBusiness.inheritFromBuilding')"
|
|
:value="0" /><el-option
|
|
:label="t('batchBusiness.maleStudents')"
|
|
:value="1" /><el-option
|
|
:label="t('batchBusiness.femaleStudents')"
|
|
:value="2" /></el-select></el-form-item
|
|
><el-form-item
|
|
v-if="!editingRoom"
|
|
:label="t('batchBusiness.numberOfBeds')"
|
|
><el-input-number v-model="roomForm.bedCount" :min="1" :max="20"
|
|
/></el-form-item></div></el-form
|
|
><template #footer
|
|
><el-button @click="roomDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="saveRoom">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="bedsDialog"
|
|
:title="t('batchBusiness.bedNumber')"
|
|
width="520"
|
|
><el-select
|
|
v-model="bedNumbers"
|
|
multiple
|
|
filterable
|
|
allow-create
|
|
default-first-option
|
|
><el-option v-for="x in bedNumbers" :key="x" :label="x" :value="x"
|
|
/></el-select>
|
|
<p>{{ t("dormTemplate.occupiedBedsCannotBeDeleted") }}</p>
|
|
<template #footer
|
|
><el-button @click="bedsDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="saveBeds">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="transferDialog"
|
|
:title="t('batchBusiness.transferAccommodation')"
|
|
width="560"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('batchBusiness.student')">{{
|
|
transferStudent?.name
|
|
}}</el-form-item
|
|
><el-form-item :label="t('batchBusiness.targetBed')"
|
|
><VacantBedPicker
|
|
v-model="transferForm.targetBedId"
|
|
:buildings="buildings" /></el-form-item
|
|
><el-form-item :label="t('businessLabels.reason')"
|
|
><el-input
|
|
v-model="transferForm.reason"
|
|
type="textarea" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="transferDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="transfer">{{
|
|
t("dormTemplate.confirmTransfer")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="checkInDateDialog"
|
|
:title="t('dormTemplate.editCheckInDate')"
|
|
width="440"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('batchBusiness.student')"
|
|
>{{ editingOccupant?.name }} ·
|
|
{{ editingOccupant?.studentNumber }}</el-form-item
|
|
><el-form-item :label="t('batchBusiness.checkInDate')"
|
|
><el-date-picker
|
|
v-model="checkInDateForm.checkInDate"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
format="YYYY-MM-DD"
|
|
:placeholder="t('dormTemplate.selectAPastOrFutureDate')"
|
|
/></el-form-item>
|
|
<p class="date-tip">
|
|
{{
|
|
t(
|
|
"dormTemplate.theCorrespondingCheckInOrTransferHistoryDateIsUpdatedAsWell",
|
|
)
|
|
}}
|
|
</p></el-form
|
|
><template #footer
|
|
><el-button @click="checkInDateDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" :loading="saving" @click="saveCheckInDate">{{
|
|
t("dormTemplate.saveDate")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="applicationDialog"
|
|
:title="t('batchBusiness.accommodationRequests')"
|
|
width="500"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('businessLabels.type')"
|
|
><el-radio-group v-model="applicationForm.type"
|
|
><el-radio-button :value="1">{{
|
|
t("dormTemplate.transfer")
|
|
}}</el-radio-button
|
|
><el-radio-button :value="2">{{
|
|
t("dormTemplate.checkOut")
|
|
}}</el-radio-button></el-radio-group
|
|
></el-form-item
|
|
><el-form-item :label="t('businessLabels.reason')"
|
|
><el-input
|
|
v-model="applicationForm.reason"
|
|
type="textarea"
|
|
:rows="4" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="applicationDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="createApplication">{{
|
|
t("businessLabels.submit")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="finalDialog"
|
|
:title="t('dormTemplate.dormitoryFinalReview')"
|
|
width="560"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('businessLabels.result')"
|
|
><el-radio-group v-model="finalForm.approved"
|
|
><el-radio-button :value="true">{{
|
|
t("classroomReservation.approve")
|
|
}}</el-radio-button
|
|
><el-radio-button :value="false">{{
|
|
t("businessLabels.reject")
|
|
}}</el-radio-button></el-radio-group
|
|
></el-form-item
|
|
><el-form-item
|
|
v-if="finalForm.approved && appType(finalApplication?.type) === 1"
|
|
:label="t('dormTemplate.destinationBed')"
|
|
><VacantBedPicker
|
|
v-model="finalForm.targetBedId"
|
|
:buildings="buildings" /></el-form-item
|
|
><el-form-item :label="t('dormTemplate.comment')"
|
|
><el-input
|
|
v-model="finalForm.comment"
|
|
type="textarea" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="finalDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="finalReview">{{
|
|
t("businessLabels.submit")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="bedEditDialog"
|
|
:title="t('dormTemplate.changeBed')"
|
|
width="600"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('batchBusiness.student')"
|
|
><span
|
|
>{{ editingAssignment?.studentNumber }} ·
|
|
{{
|
|
editingAssignment?.studentName || editingAssignment?.name
|
|
}}</span
|
|
></el-form-item
|
|
><el-form-item :label="t('batchBusiness.currentBed')"
|
|
><span>{{
|
|
assignmentBedLabel(editingAssignment) ||
|
|
t("dormTemplate.notSelected")
|
|
}}</span></el-form-item
|
|
><el-form-item :label="t('dormTemplate.newBed')"
|
|
><VacantBedPicker
|
|
v-model="editingBedId"
|
|
:buildings="buildings"
|
|
:exclude-ids="editingExcludeIds"
|
|
@change="onBedEditPicked" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="bedEditDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="confirmBedEdit">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="batchDialog"
|
|
:title="
|
|
editingBatch
|
|
? t('dormTemplate.editInspectionBatch')
|
|
: t('dormTemplate.newInspectionBatch')
|
|
"
|
|
width="500"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('baseData.name')"
|
|
><el-input v-model="batchForm.name" /></el-form-item
|
|
><el-form-item :label="t('businessLabels.date')"
|
|
><el-date-picker
|
|
v-model="batchForm.inspectionDate"
|
|
value-format="YYYY-MM-DD" /></el-form-item
|
|
><el-form-item :label="t('dormTemplate.inspector')"
|
|
><el-input v-model="batchForm.inspector" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="batchDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="saveBatch">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
<el-dialog
|
|
v-model="scoreDialog"
|
|
:title="t('dormTemplate.enterHygieneScores')"
|
|
width="650"
|
|
><el-form label-position="top"
|
|
><el-form-item :label="t('batchBusiness.dormitory')"
|
|
><el-select
|
|
v-model="scoreForm.dormitoryRoomId"
|
|
filterable
|
|
remote
|
|
:remote-method="searchScoreRooms"
|
|
:loading="scoreRoomsLoading"
|
|
:placeholder="t('dormTemplate.searchBuildingOrRoomNumber')"
|
|
><el-option
|
|
v-for="x in scoreRooms"
|
|
:key="x.id"
|
|
:label="`${x.buildingName} · ${x.roomNumber}`"
|
|
:value="x.id" /></el-select
|
|
></el-form-item>
|
|
<div class="form-grid">
|
|
<el-form-item
|
|
v-for="x in [
|
|
{ k: 'floorScore', n: t('batchBusiness.floor') },
|
|
{ k: 'beddingScore', n: t('batchBusiness.bedding') },
|
|
{ k: 'belongingsScore', n: t('batchBusiness.belongings') },
|
|
{ k: 'facilitiesScore', n: t('batchBusiness.facilities') },
|
|
{ k: 'safetyScore', n: t('batchBusiness.safety') },
|
|
]"
|
|
:key="x.k"
|
|
:label="x.n"
|
|
><el-input-number
|
|
v-model="(scoreForm as any)[x.k]"
|
|
:min="0"
|
|
:max="20"
|
|
/></el-form-item>
|
|
</div>
|
|
<el-form-item :label="t('dormTemplate.violation')"
|
|
><el-switch
|
|
v-model="scoreForm.isViolation"
|
|
inline-prompt
|
|
:active-text="t('businessLabels.yes')"
|
|
:inactive-text="t('businessLabels.no')" /></el-form-item
|
|
><el-form-item :label="t('batchBusiness.issuesAndImprovements')"
|
|
><el-input
|
|
v-model="scoreForm.issues"
|
|
type="textarea" /></el-form-item></el-form
|
|
><template #footer
|
|
><el-button @click="scoreDialog = false">{{
|
|
t("businessLabels.cancel")
|
|
}}</el-button
|
|
><el-button type="primary" @click="saveScore">{{
|
|
t("businessLabels.save")
|
|
}}</el-button></template
|
|
></el-dialog
|
|
>
|
|
</div>
|
|
</template>
|
|
<style scoped>
|
|
.page {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 18px;
|
|
color: #263630;
|
|
}
|
|
.hero {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 28px 32px;
|
|
border-radius: 20px;
|
|
background: linear-gradient(125deg, #143d35, #246a57 62%, #d6a84b);
|
|
color: white;
|
|
}
|
|
.hero h1 {
|
|
margin: 5px 0;
|
|
}
|
|
.hero p {
|
|
margin: 0;
|
|
color: #d6e6df;
|
|
}
|
|
.panel {
|
|
padding: 20px;
|
|
border: 1px solid #e0e9e4;
|
|
border-radius: 18px;
|
|
background: white;
|
|
}
|
|
.title {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 16px;
|
|
}
|
|
.title h2,
|
|
.panel > h2 {
|
|
margin: 0 0 5px;
|
|
}
|
|
.title p {
|
|
margin: 0;
|
|
color: #798780;
|
|
}
|
|
.stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 12px;
|
|
}
|
|
.stats article {
|
|
padding: 18px;
|
|
border-radius: 15px;
|
|
background: #edf6f1;
|
|
}
|
|
.stats small {
|
|
display: block;
|
|
color: #718078;
|
|
}
|
|
.stats b {
|
|
font-size: 28px;
|
|
color: #24624f;
|
|
margin-right: 5px;
|
|
}
|
|
.charts {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1.5fr;
|
|
gap: 16px;
|
|
}
|
|
.chart {
|
|
height: 290px;
|
|
}
|
|
.building {
|
|
display: flex;
|
|
flex-direction: column;
|
|
text-align: left;
|
|
}
|
|
.building small,
|
|
.block {
|
|
color: #7d8984;
|
|
}
|
|
.tools,
|
|
.filters {
|
|
display: flex;
|
|
gap: 10px;
|
|
flex-wrap: wrap;
|
|
margin-bottom: 12px;
|
|
}
|
|
.filters .el-input {
|
|
max-width: 260px;
|
|
}
|
|
.filters .el-select {
|
|
min-width: 220px;
|
|
}
|
|
.student-pagination {
|
|
justify-content: flex-end;
|
|
margin-top: 16px;
|
|
}
|
|
.beds {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
|
|
gap: 7px;
|
|
}
|
|
.bed {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 9px;
|
|
border-radius: 9px;
|
|
background: #f1f4f3;
|
|
}
|
|
.bed.used {
|
|
background: #e7f4ed;
|
|
border: 1px solid #c8e0d4;
|
|
}
|
|
.bed span,
|
|
.bed small {
|
|
font-size: 12px;
|
|
}
|
|
.bed-actions,
|
|
.score-tags {
|
|
display: flex;
|
|
gap: 4px;
|
|
margin-top: 2px;
|
|
}
|
|
.date-tip {
|
|
margin: 0;
|
|
color: #798780;
|
|
font-size: 13px;
|
|
}
|
|
.room-banner {
|
|
display: flex;
|
|
gap: 15px;
|
|
align-items: center;
|
|
padding: 22px;
|
|
background: white;
|
|
border-radius: 16px;
|
|
}
|
|
.room-banner svg {
|
|
width: 40px;
|
|
color: #26705a;
|
|
}
|
|
.room-banner h2 {
|
|
margin: 3px 0;
|
|
}
|
|
.cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(2, 1fr);
|
|
gap: 14px;
|
|
}
|
|
.cards article {
|
|
padding: 20px;
|
|
background: white;
|
|
border-radius: 16px;
|
|
}
|
|
.score-head {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
.score-head h3 {
|
|
margin: 4px 0;
|
|
}
|
|
.form-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 10px;
|
|
}
|
|
.calculator {
|
|
border-color: #c7dfd4;
|
|
background: linear-gradient(135deg, #fff, #f3faf6);
|
|
}
|
|
.calculator .filters .el-select:last-child {
|
|
flex: 1;
|
|
min-width: 320px;
|
|
}
|
|
.calculator-result {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-end;
|
|
}
|
|
.calculator-result b {
|
|
font-size: 34px;
|
|
color: #24624f;
|
|
}
|
|
.calculator-result span {
|
|
font-size: 12px;
|
|
color: #798780;
|
|
}
|
|
@media (max-width: 850px) {
|
|
.stats {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
.charts,
|
|
.cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
.hero,
|
|
.title {
|
|
align-items: flex-start;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
}
|
|
@media (max-width: 550px) {
|
|
.stats,
|
|
.form-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
.hero {
|
|
padding: 22px;
|
|
}
|
|
.filters > * {
|
|
width: 100% !important;
|
|
max-width: none !important;
|
|
}
|
|
}
|
|
</style>
|