@7365admin1/layer-common 3.0.31-staging.23 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/components/AddEqupmentForm.vue +1 -52
- package/components/AddPassKeyToVisitor.vue +53 -115
- package/components/DashboardMain.vue +87 -231
- package/components/EquipmentManagementMain.vue +0 -56
- package/components/InvitationMain.vue +3 -4
- package/components/ManageChecklistMain.vue +25 -32
- package/components/Nfc/NFCPatrolReportMain.vue +38 -128
- package/components/Nfc/PatrolReport/DailyReportTab.vue +6 -10
- package/components/Nfc/PatrolReport/MonthlyReportTab.vue +9 -19
- package/components/Nfc/PatrolReport/PatrolReportTab.vue +3 -5
- package/components/Nfc/PatrolReport/ReportFilters.vue +18 -50
- package/components/PhotoUpload.vue +4 -19
- package/components/ServiceProviderMain.vue +29 -46
- package/components/VisitorForm.vue +182 -19
- package/components/VisitorManagement.vue +30 -109
- package/composables/useCleaningSchedulePermission.ts +51 -16
- package/composables/useEquipment.ts +0 -2
- package/composables/useLocalAuth.ts +1 -1
- package/composables/useNFCPatrolDailyReport.ts +4 -1
- package/composables/useNFCPatrolMonthlyReport.ts +30 -62
- package/package.json +1 -1
- package/types/customer.d.ts +1 -2
- package/types/equipment.d.ts +1 -5
- package/types/nfc-patrol-report.ts +1 -15
- package/components/Nfc/PatrolReport/MonthlyReportTable.vue +0 -69
|
@@ -63,12 +63,15 @@ export function useNFCPatrolDailyReport(
|
|
|
63
63
|
|
|
64
64
|
try {
|
|
65
65
|
const [logsRes, siteInfo] = await Promise.all([
|
|
66
|
-
getPatrolLogs({
|
|
66
|
+
getPatrolLogs<NFCPatrolLogListResponse>({
|
|
67
67
|
page: 1,
|
|
68
68
|
limit: 100,
|
|
69
69
|
site,
|
|
70
70
|
date: filters.date,
|
|
71
71
|
routeId: filters.route,
|
|
72
|
+
routeStartTime: filters.timeRange
|
|
73
|
+
? filters.timeRange.split(" - ")[0]
|
|
74
|
+
: undefined,
|
|
72
75
|
}),
|
|
73
76
|
getSiteById(site),
|
|
74
77
|
]);
|
|
@@ -2,8 +2,6 @@ import type {
|
|
|
2
2
|
NFCPatrolReportFilters,
|
|
3
3
|
NFCPatrolSummaryReport,
|
|
4
4
|
NFCPatrolReportSummaryRow,
|
|
5
|
-
NFCPatrolMonthlyReportRow,
|
|
6
|
-
NFCPatrolMonthlyReport,
|
|
7
5
|
} from "../types/nfc-patrol-report";
|
|
8
6
|
import useNFCPatrolLog from "./useNFCPatrolLog";
|
|
9
7
|
import useSite from "./useSite";
|
|
@@ -14,55 +12,6 @@ interface NFCPatrolLogListResponse {
|
|
|
14
12
|
pageRange?: string;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
const MONTHS = [
|
|
18
|
-
"January",
|
|
19
|
-
"February",
|
|
20
|
-
"March",
|
|
21
|
-
"April",
|
|
22
|
-
"May",
|
|
23
|
-
"June",
|
|
24
|
-
"July",
|
|
25
|
-
"August",
|
|
26
|
-
"September",
|
|
27
|
-
"October",
|
|
28
|
-
"November",
|
|
29
|
-
"December",
|
|
30
|
-
];
|
|
31
|
-
function mapLogsToMonthlyRows(
|
|
32
|
-
logs: Record<string, any>[],
|
|
33
|
-
): NFCPatrolMonthlyReportRow[] {
|
|
34
|
-
const rows = MONTHS.map((month) => ({
|
|
35
|
-
month,
|
|
36
|
-
checked: 0,
|
|
37
|
-
checkedPercentage: 0,
|
|
38
|
-
missed: 0,
|
|
39
|
-
missedPercentage: 0,
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
logs.forEach((log) => {
|
|
43
|
-
const monthIndex = new Date(log.date).getMonth();
|
|
44
|
-
|
|
45
|
-
for (const checkpoint of log.checkPoints ?? []) {
|
|
46
|
-
if (checkpoint.status === "Completed") {
|
|
47
|
-
rows[monthIndex].checked++;
|
|
48
|
-
} else if (checkpoint.status === "Skipped") {
|
|
49
|
-
rows[monthIndex].missed++;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
rows.forEach((row) => {
|
|
55
|
-
const total = row.checked + row.missed;
|
|
56
|
-
|
|
57
|
-
if (total > 0) {
|
|
58
|
-
row.checkedPercentage = Math.round((row.checked / total) * 100);
|
|
59
|
-
row.missedPercentage = Math.round((row.missed / total) * 100);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return rows;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
15
|
function buildAddress(address?: Record<string, string>) {
|
|
67
16
|
if (!address) return undefined;
|
|
68
17
|
|
|
@@ -78,7 +27,23 @@ function buildAddress(address?: Record<string, string>) {
|
|
|
78
27
|
return parts.length ? parts.join(", ") : undefined;
|
|
79
28
|
}
|
|
80
29
|
|
|
30
|
+
function mapLogToSummaryRow(
|
|
31
|
+
log: Record<string, any>,
|
|
32
|
+
index: number,
|
|
33
|
+
): NFCPatrolReportSummaryRow {
|
|
34
|
+
const checkpoints: Record<string, any>[] = log.checkPoints ?? [];
|
|
35
|
+
const checked = checkpoints.filter((cp) => cp.status === "Completed").length;
|
|
36
|
+
const missed = checkpoints.filter((cp) => cp.status === "Skipped").length;
|
|
81
37
|
|
|
38
|
+
return {
|
|
39
|
+
id: log._id,
|
|
40
|
+
routeName: `${index + 1}. ${log.route?.name ?? "-"}`,
|
|
41
|
+
securityCheckSchedule: log.route?.startTime ?? "-",
|
|
42
|
+
checked,
|
|
43
|
+
missed,
|
|
44
|
+
status: missed === 0 ? "Completed" : "Incomplete",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
82
47
|
|
|
83
48
|
export function useNFCPatrolMonthlyReport(
|
|
84
49
|
filters: NFCPatrolReportFilters,
|
|
@@ -87,12 +52,12 @@ export function useNFCPatrolMonthlyReport(
|
|
|
87
52
|
const { getAll: getPatrolLogs } = useNFCPatrolLog();
|
|
88
53
|
const { getSiteById } = useSite();
|
|
89
54
|
|
|
90
|
-
const report = ref<
|
|
55
|
+
const report = ref<NFCPatrolSummaryReport | null>(null);
|
|
91
56
|
const loading = ref(false);
|
|
92
57
|
const notFound = ref(false);
|
|
93
58
|
|
|
94
59
|
async function fetchReport() {
|
|
95
|
-
if (!site || !filters.route) {
|
|
60
|
+
if (!site || !filters.date || !filters.route) {
|
|
96
61
|
report.value = null;
|
|
97
62
|
notFound.value = false;
|
|
98
63
|
return;
|
|
@@ -100,16 +65,19 @@ export function useNFCPatrolMonthlyReport(
|
|
|
100
65
|
|
|
101
66
|
loading.value = true;
|
|
102
67
|
notFound.value = false;
|
|
103
|
-
|
|
68
|
+
|
|
104
69
|
try {
|
|
105
70
|
const [logsRes, siteInfo] = await Promise.all([
|
|
106
|
-
getPatrolLogs({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
71
|
+
getPatrolLogs<NFCPatrolLogListResponse>({
|
|
72
|
+
page: 1,
|
|
73
|
+
limit: 100,
|
|
74
|
+
site,
|
|
75
|
+
date: filters.date,
|
|
76
|
+
routeId: filters.route,
|
|
77
|
+
routeStartTime: filters.timeRange
|
|
78
|
+
? filters.timeRange.split(" - ")[0]
|
|
79
|
+
: undefined,
|
|
80
|
+
type: "month",
|
|
113
81
|
}),
|
|
114
82
|
getSiteById(site),
|
|
115
83
|
]);
|
|
@@ -125,7 +93,7 @@ export function useNFCPatrolMonthlyReport(
|
|
|
125
93
|
address: buildAddress(siteInfo.address),
|
|
126
94
|
},
|
|
127
95
|
title: `Patrol Route Summary: ${routeName}`,
|
|
128
|
-
rows:
|
|
96
|
+
rows: logs.map(mapLogToSummaryRow),
|
|
129
97
|
};
|
|
130
98
|
} else {
|
|
131
99
|
report.value = null;
|
package/package.json
CHANGED
package/types/customer.d.ts
CHANGED
package/types/equipment.d.ts
CHANGED
|
@@ -6,10 +6,6 @@ declare type TEquipment = {
|
|
|
6
6
|
unitOfMeasurement: string;
|
|
7
7
|
createdAt: string;
|
|
8
8
|
updatedAt: string;
|
|
9
|
-
attachment?: string;
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
declare type TEquipmentCreate = Pick<
|
|
13
|
-
TEquipment,
|
|
14
|
-
"name" | "unitOfMeasurement" | "attachment"
|
|
15
|
-
>;
|
|
11
|
+
declare type TEquipmentCreate = Pick<TEquipment, "name" | "unitOfMeasurement">;
|
|
@@ -26,7 +26,7 @@ export interface NFCPatrolReportFilterOptions {
|
|
|
26
26
|
|
|
27
27
|
export interface NFCPatrolReportLocation {
|
|
28
28
|
name?: string;
|
|
29
|
-
address?: string;
|
|
29
|
+
address?: string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface NFCPatrolRouteSummary {
|
|
@@ -77,17 +77,3 @@ export interface NFCPatrolSummaryReport {
|
|
|
77
77
|
title: string;
|
|
78
78
|
rows: NFCPatrolReportSummaryRow[];
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
export interface NFCPatrolMonthlyReportRow {
|
|
82
|
-
month: string;
|
|
83
|
-
checked: number;
|
|
84
|
-
checkedPercentage: number;
|
|
85
|
-
missed: number;
|
|
86
|
-
missedPercentage: number;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface NFCPatrolMonthlyReport {
|
|
90
|
-
location: NFCPatrolReportLocation;
|
|
91
|
-
title: string;
|
|
92
|
-
rows: NFCPatrolMonthlyReportRow[];
|
|
93
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="mt-6">
|
|
3
|
-
<div class="text-h6 font-weight-bold mb-4">
|
|
4
|
-
{{ title }}
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
<v-table class="border rounded-lg">
|
|
8
|
-
<thead>
|
|
9
|
-
<tr>
|
|
10
|
-
<th class="text-left font-weight-bold">Month</th>
|
|
11
|
-
<th class="text-center font-weight-bold">Checked</th>
|
|
12
|
-
<th class="text-center font-weight-bold">% Checked</th>
|
|
13
|
-
<th class="text-center font-weight-bold">Missed</th>
|
|
14
|
-
<th class="text-center font-weight-bold">% Missed</th>
|
|
15
|
-
</tr>
|
|
16
|
-
</thead>
|
|
17
|
-
|
|
18
|
-
<tbody>
|
|
19
|
-
<tr
|
|
20
|
-
v-for="row in rows"
|
|
21
|
-
:key="row.month"
|
|
22
|
-
>
|
|
23
|
-
<td>{{ row.month }}</td>
|
|
24
|
-
|
|
25
|
-
<td class="text-center">
|
|
26
|
-
{{ row.checked }}
|
|
27
|
-
</td>
|
|
28
|
-
|
|
29
|
-
<td class="text-center">
|
|
30
|
-
{{ row.checkedPercentage }}%
|
|
31
|
-
</td>
|
|
32
|
-
|
|
33
|
-
<td class="text-center">
|
|
34
|
-
{{ row.missed }}
|
|
35
|
-
</td>
|
|
36
|
-
|
|
37
|
-
<td class="text-center">
|
|
38
|
-
{{ row.missedPercentage }}%
|
|
39
|
-
</td>
|
|
40
|
-
</tr>
|
|
41
|
-
</tbody>
|
|
42
|
-
</v-table>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script setup lang="ts">
|
|
47
|
-
import type { NFCPatrolMonthlyReportRow } from "../../../types/nfc-patrol-report";
|
|
48
|
-
|
|
49
|
-
defineProps<{
|
|
50
|
-
title: string;
|
|
51
|
-
rows: NFCPatrolMonthlyReportRow[];
|
|
52
|
-
}>();
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<style scoped>
|
|
56
|
-
.v-table {
|
|
57
|
-
border: 1px solid rgb(var(--v-theme-outline));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
thead th {
|
|
61
|
-
background: transparent;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
font-weight: 600;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
tbody td {
|
|
67
|
-
height: 56px;
|
|
68
|
-
}
|
|
69
|
-
</style>
|