@7365admin1/layer-common 3.0.23 → 3.0.25
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 +12 -0
- package/components/AccessCardAddForm.vue +2 -2
- package/components/AccessCardAssignToUnitForm.vue +2 -2
- package/components/AccessManagement.vue +16 -6
- package/components/BuildingUnitFormEdit.vue +1 -1
- package/components/DashboardMain.vue +29 -1
- package/components/DocumentManagement.vue +228 -1
- package/components/Nfc/NFCPatrolReportMain.vue +1 -0
- package/components/Nfc/PatrolReport/PatrolReportTab.vue +2 -1
- package/components/Nfc/PatrolReport/ReportFilters.vue +3 -1
- package/components/RolePermissionMain.vue +25 -2
- package/components/ServiceProviderMain.vue +1 -0
- package/components/VisitorForm.vue +161 -397
- package/composables/useNFCPatrolLog.ts +35 -0
- package/composables/useNFCPatrolReport.ts +37 -4
- package/composables/useNFCPatrolReportFilters.ts +28 -5
- package/composables/useServiceProvider.ts +2 -1
- package/package.json +1 -1
- package/services/nfcPatrolReport.ts +5 -1
- package/types/nfc-patrol-report.ts +7 -1
- package/types/visitor.d.ts +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface NFCPatrolLogQuery {
|
|
2
|
+
page?: number;
|
|
3
|
+
limit?: number;
|
|
4
|
+
site: string;
|
|
5
|
+
date: string;
|
|
6
|
+
routeId: string;
|
|
7
|
+
routeStartTime: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function useNFCPatrolLog() {
|
|
11
|
+
function getAll<T = Record<string, any>>({
|
|
12
|
+
page = 1,
|
|
13
|
+
limit = 10,
|
|
14
|
+
site,
|
|
15
|
+
date,
|
|
16
|
+
routeId,
|
|
17
|
+
routeStartTime,
|
|
18
|
+
}: NFCPatrolLogQuery) {
|
|
19
|
+
return useNuxtApp().$api<T>("/api/nfc-patrol-log", {
|
|
20
|
+
method: "GET",
|
|
21
|
+
query: {
|
|
22
|
+
page,
|
|
23
|
+
limit,
|
|
24
|
+
site,
|
|
25
|
+
date,
|
|
26
|
+
"route._id": routeId,
|
|
27
|
+
"route.startTime": routeStartTime,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
getAll,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -3,25 +3,58 @@ import type {
|
|
|
3
3
|
NFCPatrolReport,
|
|
4
4
|
NFCPatrolReportFilters,
|
|
5
5
|
} from "../types/nfc-patrol-report";
|
|
6
|
-
import { useNFCPatrolReportService } from "../services/nfcPatrolReport";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
interface NFCPatrolLogResponse {
|
|
8
|
+
data?: NFCPatrolLogResponse | NFCPatrolReport;
|
|
9
|
+
item?: NFCPatrolReport;
|
|
10
|
+
items?: NFCPatrolReport[];
|
|
11
|
+
nfcPatrolLog?: NFCPatrolReport;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function useNFCPatrolReport(
|
|
15
|
+
filters: NFCPatrolReportFilters,
|
|
16
|
+
site: string,
|
|
17
|
+
) {
|
|
18
|
+
const { getAll: getPatrolLogs } = useNFCPatrolLog();
|
|
10
19
|
const report = ref<NFCPatrolReport | null>(null);
|
|
11
20
|
const loading = ref(false);
|
|
12
21
|
const selectedActivityRemarks = ref("");
|
|
13
22
|
const dialogRemarks = ref(false);
|
|
14
23
|
|
|
15
24
|
async function fetchReport() {
|
|
25
|
+
if (!site || !filters.date || !filters.route || !filters.timeRange) {
|
|
26
|
+
report.value = null;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
loading.value = true;
|
|
17
31
|
|
|
18
32
|
try {
|
|
19
|
-
|
|
33
|
+
const response = await getPatrolLogs<NFCPatrolLogResponse>({
|
|
34
|
+
page: 1,
|
|
35
|
+
limit: 10,
|
|
36
|
+
site,
|
|
37
|
+
date: filters.date,
|
|
38
|
+
routeId: filters.route,
|
|
39
|
+
routeStartTime: filters.timeRange.split(" - ")[0],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
report.value = extractReport(response);
|
|
20
43
|
} finally {
|
|
21
44
|
loading.value = false;
|
|
22
45
|
}
|
|
23
46
|
}
|
|
24
47
|
|
|
48
|
+
function extractReport(response: NFCPatrolLogResponse): NFCPatrolReport | null {
|
|
49
|
+
const payload = response.data ?? response;
|
|
50
|
+
|
|
51
|
+
if ("location" in payload && "activities" in payload) {
|
|
52
|
+
return payload;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return payload.nfcPatrolLog ?? payload.item ?? payload.items?.[0] ?? null;
|
|
56
|
+
}
|
|
57
|
+
|
|
25
58
|
function openRemarksDialog(activity: NFCPatrolActivity) {
|
|
26
59
|
selectedActivityRemarks.value = activity.remarks || "No remarks provided";
|
|
27
60
|
dialogRemarks.value = true;
|
|
@@ -2,14 +2,13 @@ import type {
|
|
|
2
2
|
NFCPatrolReportFilterOptions,
|
|
3
3
|
NFCPatrolReportFilters,
|
|
4
4
|
} from "../types/nfc-patrol-report";
|
|
5
|
-
import { useNFCPatrolReportService } from "../services/nfcPatrolReport";
|
|
6
5
|
|
|
7
6
|
export function useNFCPatrolReportFilters(site: string) {
|
|
8
|
-
const
|
|
7
|
+
const { getAll: getPatrolRoutes } = useNFCPatrolRoute();
|
|
9
8
|
|
|
10
9
|
const filters = reactive<NFCPatrolReportFilters>({
|
|
11
|
-
route: "
|
|
12
|
-
timeRange: "
|
|
10
|
+
route: "",
|
|
11
|
+
timeRange: "",
|
|
13
12
|
date: "2025-11-27",
|
|
14
13
|
});
|
|
15
14
|
|
|
@@ -24,12 +23,36 @@ export function useNFCPatrolReportFilters(site: string) {
|
|
|
24
23
|
loading.value = true;
|
|
25
24
|
|
|
26
25
|
try {
|
|
27
|
-
|
|
26
|
+
const response = await getPatrolRoutes({ site, page: 1, limit: 100 });
|
|
27
|
+
const routes = (response.items ?? []).map((route: Record<string, any>) => ({
|
|
28
|
+
title: route.name,
|
|
29
|
+
value: route._id,
|
|
30
|
+
startTimes: route.startTimes ?? [],
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
options.value.routes = routes;
|
|
34
|
+
|
|
35
|
+
if (!routes.some((route) => route.value === filters.route)) {
|
|
36
|
+
filters.route = routes[0]?.value ?? "";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
updateStartTimes();
|
|
28
40
|
} finally {
|
|
29
41
|
loading.value = false;
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
44
|
|
|
45
|
+
function updateStartTimes() {
|
|
46
|
+
const route = options.value.routes.find(({ value }) => value === filters.route);
|
|
47
|
+
options.value.timeRanges = route?.startTimes ?? [];
|
|
48
|
+
|
|
49
|
+
if (!options.value.timeRanges.includes(filters.timeRange)) {
|
|
50
|
+
filters.timeRange = options.value.timeRanges[0] ?? "";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
watch(() => filters.route, updateStartTimes);
|
|
55
|
+
|
|
33
56
|
return {
|
|
34
57
|
filters,
|
|
35
58
|
options,
|
|
@@ -174,13 +174,14 @@ export default function useServiceProvider() {
|
|
|
174
174
|
orgId = "",
|
|
175
175
|
siteId = "",
|
|
176
176
|
siteName = "",
|
|
177
|
+
app = "",
|
|
177
178
|
inviteType=""
|
|
178
179
|
} = {}) {
|
|
179
180
|
return useNuxtApp().$api<Record<string, any>>(
|
|
180
181
|
"/api/service-providers/invite",
|
|
181
182
|
{
|
|
182
183
|
method: "POST",
|
|
183
|
-
body: { email, orgId, siteId, siteName, inviteType },
|
|
184
|
+
body: { email, orgId, siteId, siteName, app, inviteType },
|
|
184
185
|
}
|
|
185
186
|
);
|
|
186
187
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,11 @@ import type {
|
|
|
7
7
|
} from "../types/nfc-patrol-report";
|
|
8
8
|
|
|
9
9
|
const filterOptions: NFCPatrolReportFilterOptions = {
|
|
10
|
-
routes: [
|
|
10
|
+
routes: [
|
|
11
|
+
{ title: "WH01 Patrol Route", value: "WH01 Patrol Route", startTimes: [] },
|
|
12
|
+
{ title: "WH02 Patrol Route", value: "WH02 Patrol Route", startTimes: [] },
|
|
13
|
+
{ title: "WH03 Patrol Route", value: "WH03 Patrol Route", startTimes: [] },
|
|
14
|
+
],
|
|
11
15
|
timeRanges: ["15:00 - 17:00", "08:00 - 10:00", "13:00 - 15:00", "18:00 - 20:00"],
|
|
12
16
|
};
|
|
13
17
|
|
|
@@ -13,8 +13,14 @@ export interface NFCPatrolReportExportRequest {
|
|
|
13
13
|
filters: NFCPatrolReportFilters;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface NFCPatrolReportRouteOption {
|
|
17
|
+
title: string;
|
|
18
|
+
value: string;
|
|
19
|
+
startTimes: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
export interface NFCPatrolReportFilterOptions {
|
|
17
|
-
routes:
|
|
23
|
+
routes: NFCPatrolReportRouteOption[];
|
|
18
24
|
timeRanges: string[];
|
|
19
25
|
}
|
|
20
26
|
|