@7365admin1/layer-common 1.11.7 → 1.11.8
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/EquipmentManagementMain.vue +1 -0
- package/components/QrTemplate/CreditCardLandscape.vue +144 -0
- package/components/QrTemplate/PrintDialog.vue +1234 -0
- package/components/StockCard.vue +1 -1
- package/components/TiptapEditorQr.vue +73 -0
- package/composables/useKey.ts +381 -0
- package/composables/usePassKey.ts +351 -0
- package/composables/useStock.ts +4 -2
- package/composables/useTemplateReusable.ts +345 -0
- package/package.json +1 -1
- package/public/icons/timein-green.svg +12 -0
- package/public/icons/timeout-green.svg +12 -0
- package/public/images/keys/trash.svg +13 -0
- package/public/images/keys/undraw_keys_page.svg +41 -0
- package/public/images/keys/view-print-sample/logo.svg +10 -0
- package/public/images/keys/view-print-sample/qrcode.svg +332 -0
- package/public/images/throw.svg +1 -0
- package/public/images/undraw_team_page.svg +1 -0
- package/types/key-log.d.ts +28 -0
- package/types/passKey.d.ts +17 -0
- package/types/qr-code-template.d.ts +53 -0
- package/types/stock.d.ts +2 -1
package/components/StockCard.vue
CHANGED
|
@@ -165,7 +165,7 @@ const {
|
|
|
165
165
|
pending: loading,
|
|
166
166
|
} = await useLazyAsyncData(
|
|
167
167
|
`get-stock-by-supply-id-${supplyId}-page-${page}`,
|
|
168
|
-
() => getStockBySupply(props.site, supplyId),
|
|
168
|
+
() => getStockBySupply(props.site, supplyId, page.value, "", 10, props.serviceType),
|
|
169
169
|
{
|
|
170
170
|
watch: [page, () => props.site, () => supplyId],
|
|
171
171
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<VCard class="mx-auto">
|
|
4
|
+
<VuetifyTiptap
|
|
5
|
+
v-model="content"
|
|
6
|
+
markdown-theme="github"
|
|
7
|
+
:maxHeight="maxHeight"
|
|
8
|
+
:minHeight="editorMinHeight"
|
|
9
|
+
:maxWidth="maxWidth"
|
|
10
|
+
:disabled="isViewMode"
|
|
11
|
+
/>
|
|
12
|
+
</VCard>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
initialContent: String,
|
|
19
|
+
maxHeight: String,
|
|
20
|
+
minHeight: String,
|
|
21
|
+
maxWidth: String,
|
|
22
|
+
storageKey: String,
|
|
23
|
+
clearOnLoad: Boolean,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const route = useRoute();
|
|
27
|
+
|
|
28
|
+
const editorMinHeight = computed(() => {
|
|
29
|
+
const type = route.query?.type;
|
|
30
|
+
const isAddPage =
|
|
31
|
+
route.name?.toString().includes("add") || route.path?.includes("/add");
|
|
32
|
+
return ["edit", "add", "view"].includes(type as string) || isAddPage
|
|
33
|
+
? props.minHeight
|
|
34
|
+
: "100px";
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const isViewMode = computed(() => route.query?.type === "view");
|
|
38
|
+
|
|
39
|
+
const content = ref(localStorage.getItem(props.storageKey) || "");
|
|
40
|
+
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
if (props.clearOnLoad) {
|
|
43
|
+
content.value = "";
|
|
44
|
+
localStorage.removeItem(props.storageKey);
|
|
45
|
+
}
|
|
46
|
+
if (props.initialContent !== undefined) {
|
|
47
|
+
content.value = props.initialContent;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
watch(
|
|
52
|
+
() => props.initialContent,
|
|
53
|
+
(newVal) => {
|
|
54
|
+
content.value = newVal;
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
watch(
|
|
59
|
+
() => content.value,
|
|
60
|
+
(newVal) => {
|
|
61
|
+
updateContent();
|
|
62
|
+
localStorage.setItem(props.storageKey, newVal);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const emit = defineEmits(["content-updated"]);
|
|
67
|
+
|
|
68
|
+
const updateContent = () => {
|
|
69
|
+
emit("content-updated", content.value);
|
|
70
|
+
};
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style scoped></style>
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
export interface ISearch {
|
|
2
|
+
name?: string;
|
|
3
|
+
passType: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default function useKey() {
|
|
7
|
+
class MKeyLog implements TKeyLog {
|
|
8
|
+
_id?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
codes?: string[];
|
|
11
|
+
code?: string;
|
|
12
|
+
site?: string;
|
|
13
|
+
organization?: string;
|
|
14
|
+
serviceProvider?: string;
|
|
15
|
+
passType?: string; // Visitor Pass || Pass Key
|
|
16
|
+
passId?: string;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
updatedAt?: string;
|
|
19
|
+
location?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
qty?: number;
|
|
22
|
+
nextNumber?: number;
|
|
23
|
+
prefix?: string;
|
|
24
|
+
keyNo?: number;
|
|
25
|
+
userType?: string;
|
|
26
|
+
updatedBy?: string;
|
|
27
|
+
constructor(
|
|
28
|
+
{
|
|
29
|
+
_id = "",
|
|
30
|
+
name = "",
|
|
31
|
+
codes = [],
|
|
32
|
+
code = "",
|
|
33
|
+
site = "",
|
|
34
|
+
organization = "",
|
|
35
|
+
serviceProvider = "",
|
|
36
|
+
passType = "",
|
|
37
|
+
passId = "",
|
|
38
|
+
createdAt,
|
|
39
|
+
updatedAt,
|
|
40
|
+
location = "",
|
|
41
|
+
description = "",
|
|
42
|
+
qty = 0,
|
|
43
|
+
nextNumber = "",
|
|
44
|
+
prefix = "",
|
|
45
|
+
keyNo,
|
|
46
|
+
userType,
|
|
47
|
+
updatedBy,
|
|
48
|
+
} = {} as TKeyLog
|
|
49
|
+
) {
|
|
50
|
+
this._id = _id;
|
|
51
|
+
this.name = name;
|
|
52
|
+
this.codes = codes;
|
|
53
|
+
this.passType = passType;
|
|
54
|
+
this.passId = passId;
|
|
55
|
+
this.codes = codes;
|
|
56
|
+
this.codes = codes;
|
|
57
|
+
this.site = site;
|
|
58
|
+
this.organization = organization;
|
|
59
|
+
this.serviceProvider = serviceProvider;
|
|
60
|
+
this.createdAt = createdAt;
|
|
61
|
+
this.updatedAt = updatedAt;
|
|
62
|
+
this.location = location;
|
|
63
|
+
this.description = description;
|
|
64
|
+
this.qty = qty;
|
|
65
|
+
this.nextNumber = Number(nextNumber);
|
|
66
|
+
this.prefix = prefix;
|
|
67
|
+
this.keyNo = keyNo;
|
|
68
|
+
this.userType = userType;
|
|
69
|
+
this.updatedBy = updatedBy;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const keyLogApiUrl = "/api/keys/v1";
|
|
74
|
+
const passApiUrl = "/api/keys/v1/pass";
|
|
75
|
+
const keyApiUrl = "/api/keys/v1/keys";
|
|
76
|
+
|
|
77
|
+
const keyLog = useState("keyLog", (): TKeyLog => new MKeyLog());
|
|
78
|
+
const keyLogs = useState("keyLogs", (): TKeyLog[] => []);
|
|
79
|
+
const page = useState("keyPage", () => 1);
|
|
80
|
+
const pages = useState("keyPages", () => 1);
|
|
81
|
+
const pageLimit = useState("keyLimit", () => 10);
|
|
82
|
+
const pageRange = useState("keyPageRange", () => "-- - -- of --");
|
|
83
|
+
const search = useState("keySearch", () => "");
|
|
84
|
+
const isAdding = useState("isAdding", () => false);
|
|
85
|
+
const isTableLoading = useState("isTableLoading", () => false);
|
|
86
|
+
const isKeyLogValid = useState("isKeyLogValid", () => false);
|
|
87
|
+
|
|
88
|
+
const passList = useState("passList", (): TKeyLog[] => []);
|
|
89
|
+
const keyList = useState("keyList", (): TKeyLog[] => []);
|
|
90
|
+
const passTypes = useState(
|
|
91
|
+
"passTypes",
|
|
92
|
+
() =>
|
|
93
|
+
<any>[
|
|
94
|
+
{ title: "Visitor Pass", value: "visitor-pass" },
|
|
95
|
+
{ title: "Contractor Pass", value: "contractor-pass" },
|
|
96
|
+
{ title: "Agent Pass", value: "agent-pass" },
|
|
97
|
+
]
|
|
98
|
+
);
|
|
99
|
+
const passTypesStatus = useState("passTypesStatus", () => [
|
|
100
|
+
{ title: "Available", value: "Available" },
|
|
101
|
+
{ title: "In Use", value: "In Use" },
|
|
102
|
+
{ title: "Damaged", value: "Damaged" },
|
|
103
|
+
{ title: "Lost", value: "Lost" },
|
|
104
|
+
{ title: "Deleted", value: "Deleted" },
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
async function onSearchKey(term: string) {
|
|
108
|
+
isTableLoading.value = true;
|
|
109
|
+
const data = useNuxtApp().$api<string | undefined>(keyLogApiUrl, {
|
|
110
|
+
method: "GET",
|
|
111
|
+
query: {
|
|
112
|
+
name: term,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
isTableLoading.value = false;
|
|
116
|
+
return data;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onFilterKeyByType(value: string) {
|
|
120
|
+
isTableLoading.value = true;
|
|
121
|
+
const data = useNuxtApp().$api<string | undefined>(keyLogApiUrl, {
|
|
122
|
+
method: "GET",
|
|
123
|
+
query: {
|
|
124
|
+
passType: value,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
isTableLoading.value = false;
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function setKey(data?: TKeyLog) {
|
|
132
|
+
console.log("data", data);
|
|
133
|
+
keyLog.value = data || new MKeyLog();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function addKeyLog(_keyLog: TKeyLog) {
|
|
137
|
+
isAdding.value = true;
|
|
138
|
+
delete _keyLog._id;
|
|
139
|
+
const data = useNuxtApp().$api<{
|
|
140
|
+
message: string | undefined;
|
|
141
|
+
}>(keyLogApiUrl, {
|
|
142
|
+
method: "POST",
|
|
143
|
+
body: JSON.stringify(_keyLog),
|
|
144
|
+
});
|
|
145
|
+
isAdding.value = false;
|
|
146
|
+
return data.message;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getKeyById(id: string) {
|
|
150
|
+
const data = useNuxtApp().$api<TKeyLog | undefined>(
|
|
151
|
+
`${keyLogApiUrl}/${id}`,
|
|
152
|
+
{
|
|
153
|
+
method: "GET",
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
if (data && typeof data === "object") {
|
|
157
|
+
setKey(data);
|
|
158
|
+
}
|
|
159
|
+
return data;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function updateKeyById(id: string, payload: TKeyLog) {
|
|
163
|
+
payload.codes =
|
|
164
|
+
payload.codes instanceof Array && payload.codes.length > 0
|
|
165
|
+
? payload.codes
|
|
166
|
+
: [];
|
|
167
|
+
const data = useNuxtApp().$api<{
|
|
168
|
+
message: { acknowledged: boolean };
|
|
169
|
+
}>(`${keyLogApiUrl}/${id}`, {
|
|
170
|
+
method: "PUT",
|
|
171
|
+
body: payload,
|
|
172
|
+
});
|
|
173
|
+
return data.message;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function deleteKeyById(id: string) {
|
|
177
|
+
const data = useNuxtApp().$api<{ message: TKeyLog }>(
|
|
178
|
+
`${keyLogApiUrl}/${id}`,
|
|
179
|
+
{
|
|
180
|
+
method: "DELETE",
|
|
181
|
+
query: {
|
|
182
|
+
_id: id,
|
|
183
|
+
},
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
return data;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function getKeysByKeyPageSearch({
|
|
190
|
+
page = 1,
|
|
191
|
+
search = "",
|
|
192
|
+
limit = 10,
|
|
193
|
+
site,
|
|
194
|
+
serviceProvider,
|
|
195
|
+
organization,
|
|
196
|
+
startDateTime,
|
|
197
|
+
endDateTime,
|
|
198
|
+
}: {
|
|
199
|
+
page?: number;
|
|
200
|
+
search?: string | ISearch;
|
|
201
|
+
limit?: number;
|
|
202
|
+
site?: string;
|
|
203
|
+
serviceProvider?: string;
|
|
204
|
+
organization?: string;
|
|
205
|
+
startDateTime?: string;
|
|
206
|
+
endDateTime?: string;
|
|
207
|
+
} = {}) {
|
|
208
|
+
/*
|
|
209
|
+
search here should accept
|
|
210
|
+
empty string or ISearch
|
|
211
|
+
*/
|
|
212
|
+
return useNuxtApp().$api<TKeyLogResponse>(keyLogApiUrl, {
|
|
213
|
+
method: "GET",
|
|
214
|
+
query: {
|
|
215
|
+
page,
|
|
216
|
+
search,
|
|
217
|
+
limit,
|
|
218
|
+
site,
|
|
219
|
+
serviceProvider,
|
|
220
|
+
organization,
|
|
221
|
+
startDateTime,
|
|
222
|
+
endDateTime,
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function setKeyLogs(
|
|
228
|
+
site?: string,
|
|
229
|
+
serviceProvider?: string,
|
|
230
|
+
organization?: string,
|
|
231
|
+
startDate?: string,
|
|
232
|
+
endDate?: string
|
|
233
|
+
) {
|
|
234
|
+
try {
|
|
235
|
+
isTableLoading.value = true;
|
|
236
|
+
const _keyLogs = getKeysByKeyPageSearch({
|
|
237
|
+
page: page.value,
|
|
238
|
+
search: search.value,
|
|
239
|
+
limit: pageLimit.value,
|
|
240
|
+
site: site,
|
|
241
|
+
serviceProvider: serviceProvider,
|
|
242
|
+
organization: organization,
|
|
243
|
+
});
|
|
244
|
+
keyLogs.value = _keyLogs.items;
|
|
245
|
+
pageRange.value = _keyLogs.pageRange;
|
|
246
|
+
pages.value = _keyLogs.pages;
|
|
247
|
+
isTableLoading.value = false;
|
|
248
|
+
} catch (error) {
|
|
249
|
+
keyLogs.value = [];
|
|
250
|
+
pageRange.value = "-- - -- of --";
|
|
251
|
+
isTableLoading.value = false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const canNextPage = computed(() => pages.value > page.value);
|
|
256
|
+
function nextPage(
|
|
257
|
+
{ site, serviceProvider, startDate, endDate } = {} as {
|
|
258
|
+
site?: string;
|
|
259
|
+
serviceProvider?: string;
|
|
260
|
+
startDate?: string;
|
|
261
|
+
endDate?: string;
|
|
262
|
+
}
|
|
263
|
+
) {
|
|
264
|
+
page.value++;
|
|
265
|
+
setKeyLogs(site, serviceProvider, undefined, startDate, endDate);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const canPrevPage = computed(() => page.value <= 1);
|
|
269
|
+
function prevPage(
|
|
270
|
+
{ site, serviceProvider, startDate, endDate } = {} as {
|
|
271
|
+
site?: string;
|
|
272
|
+
serviceProvider?: string;
|
|
273
|
+
startDate?: string;
|
|
274
|
+
endDate?: string;
|
|
275
|
+
}
|
|
276
|
+
) {
|
|
277
|
+
page.value--;
|
|
278
|
+
setKeyLogs(site, serviceProvider, undefined, startDate, endDate);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function getPassList(
|
|
282
|
+
{ site, serviceProvider, passType } = {} as {
|
|
283
|
+
site?: string;
|
|
284
|
+
serviceProvider?: string;
|
|
285
|
+
passType?: string;
|
|
286
|
+
}
|
|
287
|
+
) {
|
|
288
|
+
const response = useNuxtApp().$api<TKeyLog[]>(passApiUrl, {
|
|
289
|
+
method: "GET",
|
|
290
|
+
query: {
|
|
291
|
+
site,
|
|
292
|
+
serviceProvider,
|
|
293
|
+
passType,
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
passList.value = response;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function getKeyList(
|
|
300
|
+
{ site, serviceProvider } = {} as {
|
|
301
|
+
site?: string;
|
|
302
|
+
serviceProvider?: string;
|
|
303
|
+
}
|
|
304
|
+
) {
|
|
305
|
+
const response = useNuxtApp().$api<TKeyLog[]>(keyApiUrl, {
|
|
306
|
+
method: "GET",
|
|
307
|
+
query: {
|
|
308
|
+
site,
|
|
309
|
+
serviceProvider,
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
keyList.value = response;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function getCountTotalKeys(
|
|
316
|
+
{ site, userType } = {} as {
|
|
317
|
+
site?: string;
|
|
318
|
+
userType?: string;
|
|
319
|
+
}
|
|
320
|
+
) {
|
|
321
|
+
const response = useNuxtApp().$api<TKeyLog[]>(keyLogApiUrl, {
|
|
322
|
+
method: "PATCH",
|
|
323
|
+
body: {
|
|
324
|
+
site,
|
|
325
|
+
userType,
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
keyList.value = response;
|
|
329
|
+
console.log("keyList", keyList.value);
|
|
330
|
+
return response;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async function getKeyWithSequence(
|
|
334
|
+
{ site, _id } = {} as {
|
|
335
|
+
site?: string;
|
|
336
|
+
_id?: string;
|
|
337
|
+
}
|
|
338
|
+
) {
|
|
339
|
+
const response = useNuxtApp().$api<TKeyLog[]>(keyLogApiUrl, {
|
|
340
|
+
method: "PUT",
|
|
341
|
+
query: {
|
|
342
|
+
site,
|
|
343
|
+
_id,
|
|
344
|
+
},
|
|
345
|
+
});
|
|
346
|
+
keyList.value = response;
|
|
347
|
+
console.log("keyList", keyList.value);
|
|
348
|
+
return response;
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
onSearchKey,
|
|
352
|
+
onFilterKeyByType,
|
|
353
|
+
deleteKeyById,
|
|
354
|
+
updateKeyById,
|
|
355
|
+
getKeyById,
|
|
356
|
+
addKeyLog,
|
|
357
|
+
setKeyLogs,
|
|
358
|
+
setKey,
|
|
359
|
+
nextPage,
|
|
360
|
+
prevPage,
|
|
361
|
+
page,
|
|
362
|
+
pages,
|
|
363
|
+
pageRange,
|
|
364
|
+
pageLimit,
|
|
365
|
+
canNextPage,
|
|
366
|
+
canPrevPage,
|
|
367
|
+
keyLogs,
|
|
368
|
+
keyLog,
|
|
369
|
+
isTableLoading,
|
|
370
|
+
isAdding,
|
|
371
|
+
isKeyLogValid,
|
|
372
|
+
getPassList,
|
|
373
|
+
getKeyList,
|
|
374
|
+
passList,
|
|
375
|
+
keyList,
|
|
376
|
+
passTypes,
|
|
377
|
+
passTypesStatus,
|
|
378
|
+
getCountTotalKeys,
|
|
379
|
+
getKeyWithSequence,
|
|
380
|
+
};
|
|
381
|
+
}
|