@simitgroup/simpleapp-generator 1.6.4-b-alpha → 1.6.4-d-alpha
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/dist/buildinschemas/documentevent.d.ts +3 -0
- package/dist/buildinschemas/documentevent.d.ts.map +1 -0
- package/dist/buildinschemas/documentevent.js +38 -0
- package/dist/buildinschemas/documentevent.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +2 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/tenant.d.ts.map +1 -1
- package/dist/buildinschemas/tenant.js +8 -0
- package/dist/buildinschemas/tenant.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts.map +1 -1
- package/dist/buildinschemas/webhook.js +21 -3
- package/dist/buildinschemas/webhook.js.map +1 -1
- package/dist/buildinschemas/webhookhistory.d.ts +3 -0
- package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
- package/dist/buildinschemas/webhookhistory.js +44 -0
- package/dist/buildinschemas/webhookhistory.js.map +1 -0
- package/dist/framework.js +1 -1
- package/dist/framework.js.map +1 -1
- package/dist/generate.js +1 -1
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/documentevent.ts +36 -0
- package/src/buildinschemas/index.ts +3 -1
- package/src/buildinschemas/tenant.ts +8 -0
- package/src/buildinschemas/webhook.ts +22 -3
- package/src/buildinschemas/webhookhistory.ts +42 -0
- package/src/framework.ts +1 -1
- package/src/generate.ts +1 -1
- package/templates/basic/nest/apischema.ts.eta +6 -2
- package/templates/basic/nest/controller.ts.eta +4 -3
- package/templates/basic/nest/default.ts.eta +6 -5
- package/templates/basic/nuxt/default.ts.eta +2 -0
- package/templates/basic/nuxt/pages.viewer.vue.eta +1 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +1 -6
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +17 -0
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +37 -7
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +39 -20
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +53 -39
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +3 -3
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +100 -34
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +5 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +3 -3
- package/templates/nest/src/simpleapp/types/index.ts._eta +14 -0
- package/templates/nuxt/app.vue.eta +9 -7
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +7 -14
- package/templates/nuxt/components/list/ListView.vue.eta +97 -111
- package/templates/nuxt/components/renderer/RendererDocHistories.vue.eta +102 -42
- package/templates/nuxt/components/search/SearchBox.vue._eta +371 -0
- package/templates/nuxt/components/search/SearchBoxBefore.vue._eta +11 -0
- package/templates/nuxt/components/search/SearchBoxProduct.vue._eta +26 -0
- package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +24 -3
- package/templates/nuxt/components/simpleApp/SimpleAppCalendarInput.vue.eta +1 -0
- package/templates/nuxt/components/simpleApp/SimpleAppChildrenList.vue.eta +10 -5
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +4 -3
- package/templates/nuxt/components/user/UserTenantPicker.vue.eta +18 -16
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -49
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -2
- package/templates/nuxt/middleware/30.acl.global.ts.eta +6 -5
- package/templates/nuxt/pages/[xorg]/pickgroup.vue._eta +28 -27
- package/templates/nuxt/pages/picktenant.vue._eta +3 -3
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +49 -29
- package/templates/nuxt/server/api/profile/[...].ts.eta +44 -1
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
- package/templates/nuxt/types/others.ts.eta +7 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
:disabled="!canPerform(doc.getDocName(true), 'access')"
|
|
52
52
|
@click="emitEvent(menu, $event)"
|
|
53
53
|
:action-name="menu.action"
|
|
54
|
-
>{{ menu.label }}</ButtonAction
|
|
54
|
+
>{{ menu.label }}</ButtonAction
|
|
55
|
+
>
|
|
55
56
|
<ButtonAction
|
|
56
57
|
v-else
|
|
57
58
|
:disabled="!canPerform(doc.getDocName(true), menu.action)"
|
|
@@ -68,8 +69,8 @@
|
|
|
68
69
|
<!-- right -->
|
|
69
70
|
<div class="flex flex-row gap-2">
|
|
70
71
|
<DebugDocumentData v-model="data" :label="t(doc.getDocName())" />
|
|
71
|
-
<div
|
|
72
|
-
<RendererDocHistories :data="data" />
|
|
72
|
+
<div>
|
|
73
|
+
<RendererDocHistories :data="data" :documentName="doc.getDocName()" />
|
|
73
74
|
</div>
|
|
74
75
|
<div v-for="(menu, index) in menus" :key="index">
|
|
75
76
|
<div v-if="menu.label && menu.type == 'docstatus'">
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="w-full">
|
|
2
|
+
<div class="w-full p-4">
|
|
3
|
+
<LazyTenantCreator v-model:model-value="visibleCreateTenant"></LazyTenantCreator>
|
|
4
|
+
<ButtonPrimary @click="visibleCreateTenant=true">{{ t('newBusiness') }}</ButtonPrimary>
|
|
3
5
|
<div v-if="waiting" class="p-4 w-full">waiting..</div>
|
|
4
|
-
<div
|
|
6
|
+
<div
|
|
7
|
+
v-else
|
|
8
|
+
class="w-full p-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"
|
|
9
|
+
>
|
|
5
10
|
<div v-for="tenant in alltenants" class="border rounded-lg p-2 m-2">
|
|
6
|
-
|
|
7
11
|
<TextTitle>{{ tenant.tenantName }}</TextTitle>
|
|
8
|
-
<div v-for="
|
|
12
|
+
<div v-for="item in tenant.permissions">
|
|
9
13
|
<NuxtLink :to="`/${item.xOrg}`" external>
|
|
10
|
-
<div class="flex flex-row gap-2 hover:bg-primary-100">
|
|
14
|
+
<div class="flex flex-row gap-2 hover:bg-primary-100">
|
|
11
15
|
<div class="min-w-14 p=2">
|
|
12
|
-
<ImageOrganization :orgRecordId="item.orgRecordId" :size="12"/>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="flex flex-col w-full justify-end gap-2">
|
|
16
|
+
<ImageOrganization :orgRecordId="item.orgRecordId" :size="12" />
|
|
17
|
+
</div>
|
|
18
|
+
<div class="flex flex-col w-full justify-end gap-2">
|
|
15
19
|
<div class="flex flex-row gap-2">
|
|
16
20
|
<TextMain>{{ item.branchCode }}</TextMain>
|
|
17
21
|
<Tag v-for="groupname in item.groups">{{ t(groupname) }}</Tag>
|
|
18
22
|
</div>
|
|
19
23
|
<TextSubsubtitle>{{ item.orgName }}</TextSubsubtitle>
|
|
20
|
-
|
|
21
|
-
|
|
22
24
|
</div>
|
|
23
|
-
|
|
25
|
+
</div>
|
|
24
26
|
</NuxtLink>
|
|
25
27
|
</div>
|
|
26
28
|
</div>
|
|
@@ -39,7 +41,7 @@ import TextPrimary from "../text/TextPrimary.vue";
|
|
|
39
41
|
import ImageOrganization from "../image/ImageOrganization.vue";
|
|
40
42
|
const waiting = ref(true);
|
|
41
43
|
const alltenants = ref();
|
|
42
|
-
|
|
44
|
+
const visibleCreateTenant = ref(false)
|
|
43
45
|
const loadAllTenants = async () => {
|
|
44
46
|
waiting.value = false;
|
|
45
47
|
alltenants.value = (await getProfileApi().getAllTenants()).data;
|
|
@@ -53,10 +55,10 @@ const getBranchlist = (tenant: any) => tenant.permissions;
|
|
|
53
55
|
// const getOrglist = (tenant: any) =>
|
|
54
56
|
// _.uniqBy(getBranchlist(tenant), "orgId").map((item: any) => ({
|
|
55
57
|
// orgId: item.orgId,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
// orgRecordId:'aaa',// item.orgRecordId,
|
|
59
|
+
// orgCode: item.orgCode,
|
|
60
|
+
// orgName: item.orgName,
|
|
61
|
+
// }));
|
|
60
62
|
|
|
61
63
|
onNuxtReady(() => {
|
|
62
64
|
loadAllTenants();
|
|
@@ -38,51 +38,9 @@ export const getDocumentApi = (documentName: string): any => {
|
|
|
38
38
|
|
|
39
39
|
const config = getAxiosConfig()
|
|
40
40
|
const docsOpenapi: any = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
'permission': new o.PERMApi(config),
|
|
45
|
-
'autoincreament': new o.AUTOINCApi(config),
|
|
46
|
-
'docnoformat': new o.DOCNOApi(config),
|
|
47
|
-
'systemmessage': new o.SYSMSGApi(config),
|
|
48
|
-
'keyvaluepair': new o.KVPAIRApi(config),
|
|
49
|
-
'webhook': new o.WEBHOOKApi(config),
|
|
50
|
-
'academysession': new o.ACADEMYSESSIONApi(config),
|
|
51
|
-
'accounttransaction': new o.ACCTRANSApi(config),
|
|
52
|
-
'agent': new o.AGENTApi(config),
|
|
53
|
-
'area': new o.AREAApi(config),
|
|
54
|
-
'attendance': new o.ATTApi(config),
|
|
55
|
-
'category': new o.CATApi(config),
|
|
56
|
-
'creditnote': new o.CNApi(config),
|
|
57
|
-
'enrollment': new o.ENROLLApi(config),
|
|
58
|
-
'enrollmenttransaction': new o.ENROLLTRANSApi(config),
|
|
59
|
-
'holiday': new o.HOLIDAYApi(config),
|
|
60
|
-
'invoice': new o.INVApi(config),
|
|
61
|
-
'level': new o.LVLApi(config),
|
|
62
|
-
'parent': new o.PARENTApi(config),
|
|
63
|
-
'payment': new o.PAYApi(config),
|
|
64
|
-
'paymentmethod': new o.PAYMETHODApi(config),
|
|
65
|
-
'product': new o.PRDApi(config),
|
|
66
|
-
'productpackage': new o.PRDPKGApi(config),
|
|
67
|
-
'race': new o.RACEApi(config),
|
|
68
|
-
'refund': new o.REFUNDApi(config),
|
|
69
|
-
'refundtype': new o.REFUNDTYPEApi(config),
|
|
70
|
-
'religion': new o.RELIGIONApi(config),
|
|
71
|
-
'room': new o.ROOMApi(config),
|
|
72
|
-
'roomtype': new o.ROOMTYPEApi(config),
|
|
73
|
-
'schedule': new o.SCHEDULEApi(config),
|
|
74
|
-
'school': new o.SCHOOLApi(config),
|
|
75
|
-
'stopenrollment': new o.STOPENROLLApi(config),
|
|
76
|
-
'stopreason': new o.STOPREASONApi(config),
|
|
77
|
-
'student': new o.STUApi(config),
|
|
78
|
-
'studentgroup': new o.STUGROUPApi(config),
|
|
79
|
-
'studentsource': new o.STUDENTSRCApi(config),
|
|
80
|
-
'studentsummary': new o.STUSUMApi(config),
|
|
81
|
-
'teacher': new o.TEACHERApi(config),
|
|
82
|
-
'teachergroup': new o.TEACHERGROUPApi(config),
|
|
83
|
-
'tuitionclass': new o.TUITIONApi(config),
|
|
84
|
-
'user': new o.USERApi(config),
|
|
85
|
-
|
|
41
|
+
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
42
|
+
'<%=it.modules[i].docname.toLowerCase()%>': new o.<%=it.modules[i].doctype.toUpperCase()%>Api(config),
|
|
43
|
+
<%}%>
|
|
86
44
|
};
|
|
87
45
|
|
|
88
46
|
if (!docsOpenapi[documentName]) {
|
|
@@ -100,10 +58,9 @@ export const getAllApi=()=>{
|
|
|
100
58
|
return o
|
|
101
59
|
}
|
|
102
60
|
|
|
103
|
-
export const getWorkflowApi = () => {
|
|
104
|
-
return new o.WorkflowApi(getAxiosConfig())
|
|
105
|
-
|
|
106
|
-
}
|
|
61
|
+
//export const getWorkflowApi = () => {
|
|
62
|
+
//return new o.WorkflowApi(getAxiosConfig())
|
|
63
|
+
//}
|
|
107
64
|
|
|
108
65
|
export const getProfileApi = () => {
|
|
109
66
|
return new o.PROFILEApi(getAxiosConfig())
|
|
@@ -23,12 +23,12 @@ export const getAvatarLink = (email:string, size:number):string=>{
|
|
|
23
23
|
}
|
|
24
24
|
export const getAvatarByUid = (id:string, size:number):string=>{
|
|
25
25
|
const url = `${useRuntimeConfig().public.APP_URL}/api/${getCurrentXorg()}`
|
|
26
|
-
return `${url}/images/
|
|
26
|
+
return `${url}/images/user/${id}`;
|
|
27
27
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const getDefaultLocale =()=> useNuxtApp().$i18n.defaultLocale
|
|
31
|
-
export const t = (txt:string,options?:any):string =>
|
|
31
|
+
export const t = (txt:string,options?:any):string => typeof txt !='string' ?'' : useNuxtApp().$i18n.t(txt.trim(),options)
|
|
32
32
|
export const upperFirst = (str:string) => _.upperFirst(str)
|
|
33
33
|
export const labelSorter = (a,b)=>{
|
|
34
34
|
const nameA = a.label.toUpperCase(); // ignore upper and lowercase
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { getUserProfile } from './../composables/getUserStore.generate';
|
|
8
8
|
import {MenuData} from '~/types'
|
|
9
|
-
export default defineNuxtRouteMiddleware((to, from) => {
|
|
10
|
-
|
|
11
|
-
// return true;
|
|
9
|
+
export default defineNuxtRouteMiddleware((to, from) => {
|
|
12
10
|
const userprofile = getUserProfile()
|
|
13
|
-
|
|
11
|
+
//skip auto then simply allow
|
|
12
|
+
if(!to.meta.auth){
|
|
13
|
+
return true
|
|
14
|
+
}else if(to.path=='/relogin'){
|
|
14
15
|
return true
|
|
15
16
|
}else if( getPublicResource(String(to.params['xorg'])).filter((item:MenuData)=>to.fullPath === item.url)){
|
|
16
17
|
return true
|
|
@@ -37,7 +38,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
|
|
|
37
38
|
if($userstore.haveAccess(resourcename)){
|
|
38
39
|
return true
|
|
39
40
|
}else{
|
|
40
|
-
|
|
41
|
+
// congetWorkflowApisole.error("access deny, redirect to '/'")
|
|
41
42
|
return navigateTo('/')
|
|
42
43
|
// abortNavigation()
|
|
43
44
|
}
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<TextTitle class="text-center">{{ t("pickGroup") }}</TextTitle>
|
|
4
|
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 w-full gap-4 p-4">
|
|
5
|
+
|
|
4
6
|
<div v-for="(groupName, index) in getUserProfile()?.groups" :key="index">
|
|
5
7
|
<div
|
|
6
|
-
class="border rounded-lg bg-primary-500 text-white p-4 text-center"
|
|
8
|
+
class="border rounded-lg bg-primary-500 text-white p-4 text-center cursor-pointer"
|
|
7
9
|
@click="pickGroup(groupName)"
|
|
8
10
|
>
|
|
9
11
|
{{ t(groupName) }}
|
|
10
12
|
</div>
|
|
11
|
-
</div>
|
|
13
|
+
</div>
|
|
12
14
|
</div>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
/**
|
|
19
|
+
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
20
|
+
* --remove-this-line-to-prevent-override--
|
|
21
|
+
* last change 2024-04-09
|
|
22
|
+
* author: Ks Tan
|
|
23
|
+
*/
|
|
24
|
+
const pickGroup = async (groupName: string) => {
|
|
25
|
+
try {
|
|
26
|
+
useCookie("currentGroup").value = groupName;
|
|
27
|
+
localStorage.setItem("currentGroup", groupName);
|
|
28
|
+
useNuxtApp().$userstore.currentGroup = groupName;
|
|
29
|
+
useNuxtApp().$event("pickGroup", groupName);
|
|
30
|
+
goTo("");
|
|
31
|
+
} catch (e) {
|
|
32
|
+
alert("something wrong");
|
|
33
|
+
console.error(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
<div class="flex flex-col w-full">
|
|
3
3
|
<TextTitle class="text-center p-2">{{ t("pickYourDatabase") }}</TextTitle>
|
|
4
4
|
<div class="flex flex-col">
|
|
5
|
-
|
|
6
5
|
<div class="p-4">
|
|
7
|
-
{{ t(
|
|
8
|
-
<UserButtonCreateTenant></UserButtonCreateTenant>
|
|
6
|
+
{{ t("welcome ") }} {{ getUserProfile()?.fullName }}
|
|
9
7
|
</div>
|
|
10
8
|
<UserTenantPicker></UserTenantPicker>
|
|
9
|
+
|
|
11
10
|
</div>
|
|
11
|
+
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
<script lang="ts" setup>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { defineNuxtPlugin } from "#app";
|
|
8
8
|
import {PROFILEApi} from '../simpleapp/generate/openapi'
|
|
9
9
|
import {UserProfile} from '~/types'
|
|
10
|
-
import axios, { Axios, AxiosResponse } from 'axios'
|
|
10
|
+
import axios, { Axios, AxiosError, AxiosResponse } from 'axios'
|
|
11
11
|
import _ from 'lodash'
|
|
12
12
|
import { group } from "console";
|
|
13
13
|
|
|
@@ -109,12 +109,17 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
109
109
|
if(!xorg){
|
|
110
110
|
apiurl = `${useRuntimeConfig().public.APP_URL}/api`
|
|
111
111
|
}else{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
try{
|
|
113
|
+
const xorgdecode = atob(<string>xorg)
|
|
114
|
+
if(xorgdecode.includes('-')){
|
|
115
|
+
apiurl = `${useRuntimeConfig().public.APP_URL}/api/${xorg}`
|
|
116
|
+
}else{
|
|
117
|
+
return Promise.reject('wrongxorg')
|
|
118
|
+
}
|
|
119
|
+
}catch(e){
|
|
116
120
|
return Promise.reject('wrongxorg')
|
|
117
121
|
}
|
|
122
|
+
|
|
118
123
|
|
|
119
124
|
}
|
|
120
125
|
const {$axios} = useNuxtApp()
|
|
@@ -218,43 +223,58 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
218
223
|
}
|
|
219
224
|
}
|
|
220
225
|
})
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
if( useRoute().meta.auth !==false){
|
|
224
|
-
console.log("pingsessionres starat")
|
|
225
|
-
|
|
226
|
+
|
|
227
|
+
|
|
226
228
|
try{
|
|
227
229
|
const pingsessionres = await useUserStore().pingSession()
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
else if(pingsessionres){
|
|
230
|
+
|
|
231
|
+
if(pingsessionres){
|
|
232
232
|
await useUserStore().loadRemoteUserInfo()
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if(e?.code=='ERR_BAD_RESPONSE'){
|
|
244
|
-
console.log("ping failed failed failed",e.code)
|
|
234
|
+
|
|
235
|
+
}catch(e:any){
|
|
236
|
+
|
|
237
|
+
//server down, stop page
|
|
238
|
+
if(e == 'wrongxorg'){
|
|
239
|
+
navigateTo('/picktenant',{external:true})
|
|
240
|
+
}
|
|
241
|
+
else if(e?.code=='ERR_BAD_RESPONSE'){
|
|
245
242
|
throw createError({
|
|
246
243
|
statusCode:e.code,
|
|
247
244
|
statusMessage:e.message,
|
|
248
245
|
fatal:true
|
|
249
246
|
})
|
|
247
|
+
}else if(e?.response?.status==302){ //no session
|
|
248
|
+
//need authentication, relogin
|
|
249
|
+
if( useRoute().meta.auth !==false){
|
|
250
|
+
await useUserStore().logout(useRoute().path)
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
//pulic page, do nothing`
|
|
254
|
+
return {
|
|
255
|
+
provide: {
|
|
256
|
+
userstore:useUserStore()
|
|
257
|
+
}
|
|
250
258
|
}
|
|
251
|
-
|
|
252
|
-
|
|
259
|
+
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// else
|
|
263
|
+
//
|
|
253
264
|
}
|
|
254
265
|
|
|
255
|
-
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
return {
|
|
269
|
+
provide: {
|
|
270
|
+
userstore:useUserStore()
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// }else{
|
|
256
274
|
|
|
257
|
-
|
|
275
|
+
// console.log("No need auth")
|
|
276
|
+
// return true
|
|
277
|
+
// }
|
|
258
278
|
|
|
259
279
|
|
|
260
280
|
|
|
@@ -75,6 +75,34 @@ export default defineEventHandler(async (event:any) => {
|
|
|
75
75
|
|
|
76
76
|
// Send the image data as the response body
|
|
77
77
|
frontEndRes.end(Buffer.from(res.data, 'binary'));
|
|
78
|
+
}else if(documentLink.includes('images/')){
|
|
79
|
+
// console.log(documentLink," Resdata of base64 photo",res.data.length)
|
|
80
|
+
let imageData
|
|
81
|
+
frontEndRes.setHeader('Content-Type', 'image/png');
|
|
82
|
+
|
|
83
|
+
// console.log("load image for",documentLink)
|
|
84
|
+
if( res.data.length){
|
|
85
|
+
// console.log("obtain base64 from server length:",res.data.length)
|
|
86
|
+
imageData = base64ToBuffer(res.data);
|
|
87
|
+
|
|
88
|
+
}else{
|
|
89
|
+
// console.log("server no image, use default image")
|
|
90
|
+
const folder = 'public/images/'
|
|
91
|
+
let filename = ''
|
|
92
|
+
if(documentLink.includes('student')) filename='student.png';
|
|
93
|
+
else if(documentLink.includes('teacher')) filename='teacher.png';
|
|
94
|
+
else if(documentLink.includes('organization')) filename='organization.png';
|
|
95
|
+
else filename='unknown.png';
|
|
96
|
+
const fullpath = folder+filename;
|
|
97
|
+
// console.log("photo path",fullpath)
|
|
98
|
+
if(fs.existsSync(fullpath)){
|
|
99
|
+
imageData = fs.readFileSync(fullpath)
|
|
100
|
+
}else{
|
|
101
|
+
console.log(fullpath,'does not exists')
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
frontEndRes.end(Buffer.from(imageData, 'binary'));
|
|
105
|
+
|
|
78
106
|
} else {
|
|
79
107
|
// For non-image responses, set the Content-Type header and send the response body
|
|
80
108
|
// setHeader(event, 'Content-type', <string>res.headers['Content-Type']);
|
|
@@ -113,4 +141,19 @@ export default defineEventHandler(async (event:any) => {
|
|
|
113
141
|
// })
|
|
114
142
|
})
|
|
115
143
|
|
|
116
|
-
})
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
function base64ToBuffer(base64String:string) {
|
|
149
|
+
// Split the base64 string into parts
|
|
150
|
+
const parts = base64String.split(',');
|
|
151
|
+
const contentType = parts[0].split(':')[1];
|
|
152
|
+
const base64Data = parts[1];
|
|
153
|
+
|
|
154
|
+
// Decode the base64 data
|
|
155
|
+
const binaryString = atob(base64Data);
|
|
156
|
+
const buffer = new Buffer.from(binaryString, 'binary');
|
|
157
|
+
|
|
158
|
+
return buffer
|
|
159
|
+
}
|
|
@@ -10,7 +10,7 @@ import addErrors from 'ajv-errors';
|
|
|
10
10
|
import { ref } from 'vue';
|
|
11
11
|
import type { Ref } from 'vue';
|
|
12
12
|
import type { AxiosResponse } from 'axios';
|
|
13
|
-
import {SearchBody,Notification,NotificationStatus,SchemaType,FormActions} from '~/types'
|
|
13
|
+
import {SearchBody,TextSearchBody,Notification,NotificationStatus,SchemaType,FormActions} from '~/types'
|
|
14
14
|
|
|
15
15
|
// import { useToast, } from 'primevue/usetoast';
|
|
16
16
|
// import type { ToastMessageOptions } from 'primevue/toast';
|
|
@@ -24,6 +24,7 @@ type crudType = {
|
|
|
24
24
|
runDelete: Function;
|
|
25
25
|
runSearch: Function;
|
|
26
26
|
runDefault:Function;
|
|
27
|
+
runFullTextSearch:Function;
|
|
27
28
|
};
|
|
28
29
|
export class SimpleAppClient<
|
|
29
30
|
TData extends { _id?: string,created?:string },
|
|
@@ -349,4 +350,9 @@ export class SimpleAppClient<
|
|
|
349
350
|
}
|
|
350
351
|
return data
|
|
351
352
|
}
|
|
353
|
+
|
|
354
|
+
async runFullTextSearh(body:TextSearchBody) {
|
|
355
|
+
const response = await this.docapi.runFullTextSearch(body)
|
|
356
|
+
return response.data
|
|
357
|
+
}
|
|
352
358
|
}
|
|
@@ -16,7 +16,13 @@ export type NameValue={
|
|
|
16
16
|
code?: string
|
|
17
17
|
[key:string]: any
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
export type TextSearchBody = {
|
|
20
|
+
keyword: string;
|
|
21
|
+
fields?: string[];
|
|
22
|
+
sorts?: string[][];
|
|
23
|
+
lookup?: Record<string, string>;
|
|
24
|
+
};
|
|
25
|
+
|
|
20
26
|
export type DocumentMetaData = {
|
|
21
27
|
docName:string
|
|
22
28
|
docType:string
|