@simitgroup/simpleapp-generator 1.0.32 → 1.0.35
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/.vscode/settings.json +3 -0
- package/README.md +185 -16
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +39 -0
- package/buildinschemas copy/branch.branch.jsonschema.json +41 -0
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +41 -0
- package/buildinschemas copy/organization.org.jsonschema.json +50 -0
- package/buildinschemas copy/permission.perm.jsonschema.json +23 -0
- package/buildinschemas copy/permission.perm.jsonschema.try.json +25 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.json +21 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.try.json +27 -0
- package/buildinschemas copy/user.user.jsonschema.json +31 -0
- package/dist/buildinschemas/autoincreament.d.ts +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -0
- package/dist/buildinschemas/autoincreament.js +36 -0
- package/dist/buildinschemas/autoincreament.js.map +1 -0
- package/dist/buildinschemas/branch.d.ts +3 -0
- package/dist/buildinschemas/branch.d.ts.map +1 -0
- package/dist/buildinschemas/branch.js +41 -0
- package/dist/buildinschemas/branch.js.map +1 -0
- package/dist/buildinschemas/docnoformat.d.ts +3 -0
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/docnoformat.js +60 -0
- package/dist/buildinschemas/docnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +8 -0
- package/dist/buildinschemas/index.d.ts.map +1 -0
- package/dist/buildinschemas/index.js +18 -0
- package/dist/buildinschemas/index.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts +3 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -0
- package/dist/buildinschemas/organization.js +34 -0
- package/dist/buildinschemas/organization.js.map +1 -0
- package/dist/buildinschemas/permission.d.ts +3 -0
- package/dist/buildinschemas/permission.d.ts.map +1 -0
- package/dist/buildinschemas/permission.js +34 -0
- package/dist/buildinschemas/permission.js.map +1 -0
- package/dist/buildinschemas/tenant.d.ts +3 -0
- package/dist/buildinschemas/tenant.d.ts.map +1 -0
- package/dist/buildinschemas/tenant.js +41 -0
- package/dist/buildinschemas/tenant.js.map +1 -0
- package/dist/buildinschemas/user.d.ts +3 -0
- package/dist/buildinschemas/user.d.ts.map +1 -0
- package/dist/buildinschemas/user.js +31 -0
- package/dist/buildinschemas/user.js.map +1 -0
- package/dist/constant.d.ts +4 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +2 -1
- package/dist/constant.js.map +1 -1
- package/dist/framework.d.ts +10 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +120 -68
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +310 -230
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/libs.d.ts +2 -0
- package/dist/libs.d.ts.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.d.ts +4 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -0
- package/dist/processors/jsonschemabuilder.js +146 -172
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/type.d.ts +164 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +16 -1
- package/dist/type.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/documentation/designconcept.bpmn +349 -0
- package/documentation/documentation.png +0 -0
- package/documentation/infra.drawio +141 -0
- package/documentation/infra.png +0 -0
- package/documentation/management.drawio +57 -0
- package/documentation/stack.drawio +106 -0
- package/package.json +3 -1
- package/src/buildinschemas/autoincreament.ts +34 -0
- package/src/buildinschemas/branch.ts +39 -0
- package/src/buildinschemas/docnoformat.ts +58 -0
- package/src/buildinschemas/index.ts +7 -0
- package/src/buildinschemas/organization.ts +31 -0
- package/src/buildinschemas/permission.ts +31 -0
- package/src/buildinschemas/tenant.ts +38 -0
- package/src/buildinschemas/user.ts +28 -0
- package/src/constant.ts +2 -1
- package/src/framework.ts +126 -67
- package/src/generate.ts +327 -266
- package/src/generate.ts.backup +339 -0
- package/src/index.ts +93 -18
- package/src/processors/jsonschemabuilder.ts +199 -226
- package/src/processors/jsonschemabuilder.ts-old +383 -0
- package/src/storage.ts +1 -1
- package/src/type.ts +94 -27
- package/templates/basic/nest/controller.ts.eta +255 -0
- package/templates/basic/nest/default.ts.eta +42 -0
- package/templates/basic/{model.eta → nest/model.ts.eta} +18 -5
- package/templates/basic/nest/processor.ts.eta +129 -0
- package/templates/basic/nest/service.ts.eta +64 -0
- package/templates/basic/{type.eta → nest/type.ts.eta} +3 -3
- package/templates/basic/nuxt/default.ts.eta +42 -0
- package/templates/basic/{pageindex.vue.eta → nuxt/pages.crud.vue.eta} +85 -22
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +11 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +212 -0
- package/templates/nest/.env.eta +31 -0
- package/templates/nest/.gitignore.eta +40 -0
- package/templates/nest/src/app.controller.ts.eta +19 -0
- package/templates/nest/src/app.module.ts.eta +77 -0
- package/templates/nest/src/app.service.ts.eta +9 -0
- package/templates/nest/src/main.ts.eta +58 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +8 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +101 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +39 -0
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +38 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +88 -0
- package/templates/nest/{Workflow.eta → src/simpleapp/generate/commons/providers/workflow.provider.ts.etax} +20 -14
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +28 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +10 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +34 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +391 -0
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +53 -0
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +45 -0
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +57 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +624 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +74 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +110 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +195 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +18 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +89 -0
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +93 -0
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +67 -0
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +102 -0
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +69 -0
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +43 -0
- package/templates/nuxt/.env.eta +21 -0
- package/templates/nuxt/.gitignore.eta +28 -0
- package/templates/nuxt/app.vue.eta +5 -2
- package/templates/nuxt/assets/css/tailwind.css.eta +35 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +164 -0
- package/templates/nuxt/components/CrudSimple.vue.eta +179 -0
- package/templates/nuxt/{components.debugdocdata.vue.eta → components/DebugDocumentData.vue.eta} +4 -1
- package/templates/nuxt/{components.eventmonitor.vue.eta → components/EventMonitor.vue.eta} +27 -27
- package/templates/nuxt/components/Invitation.vue.eta +50 -0
- package/templates/nuxt/components/Menus.vue.eta +58 -0
- package/templates/nuxt/components/PermissionInfo.vue.eta +92 -0
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppAutocompletemulti.vue.eta +73 -0
- package/templates/nuxt/components/SimpleAppCalendar.vue.eta +55 -0
- package/templates/nuxt/components/SimpleAppCheckbox.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppChip.vue.eta +28 -0
- package/templates/nuxt/components/SimpleAppColor.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +20 -0
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +90 -0
- package/templates/nuxt/components/SimpleAppDynamicInput.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppEditor.vue.eta +31 -0
- package/templates/nuxt/components/SimpleAppForm.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +104 -0
- package/templates/nuxt/components/SimpleAppList.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppListmulti.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppNumber.vue.eta +32 -0
- package/templates/nuxt/components/SimpleAppPassword.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppRadio.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppRating.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppSelect.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppSelectmulti.vue.eta +39 -0
- package/templates/nuxt/components/SimpleAppSlider.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppSwitch.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppText.vue.eta +50 -0
- package/templates/nuxt/components/SimpleAppTextarea.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppValue.vue.eta +86 -0
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +102 -0
- package/templates/nuxt/components/XorgPicker.vue.eta +66 -0
- package/templates/nuxt/components/helper.ts.eta +90 -0
- package/templates/nuxt/components/type.ts.eta +32 -0
- package/templates/nuxt/composables/docformat.generate.ts.eta +5 -0
- package/templates/nuxt/{composables.getautocomplete.ts.eta → composables/getAutocomplete.generate.ts.eta} +4 -5
- package/templates/nuxt/{composables.getmenus.ts.eta → composables/getMenus.generate.ts.eta} +22 -7
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -0
- package/templates/nuxt/composables/getTenant.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +22 -0
- package/templates/nuxt/composables/logout.generate.ts.eta +22 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +48 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -0
- package/templates/nuxt/{layouts.default.vue.eta → layouts/default.vue.eta} +2 -0
- package/templates/nuxt/middleware/10.acl.global.ts.eta +38 -0
- package/templates/nuxt/nuxt.config.ts.eta +12 -2
- package/templates/nuxt/pages/[xorg]/branch/index.vue.eta +102 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[id].vue.eta +17 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +269 -0
- package/templates/nuxt/pages/[xorg]/index.vue.eta +36 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +148 -0
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +280 -0
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +93 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +468 -0
- package/templates/nuxt/pages/index.vue.eta +191 -0
- package/templates/nuxt/pages/login.vue.eta +21 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +53 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +155 -0
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +23 -0
- package/templates/nuxt/{server.api.ts.eta → server/api/[xorg]/[...].ts.eta} +5 -2
- package/templates/nuxt/server/api/auth/[...].ts.eta +68 -0
- package/templates/nuxt/{server.api.auth.logout.ts.eta → server/api/auth/logout.ts.eta} +1 -3
- package/templates/nuxt/server/api/profile/[...].ts.eta +150 -0
- package/templates/nuxt/server/api/profile/index.ts.eta +103 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +187 -0
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +21 -0
- package/templates/nuxt/types/index.ts.eta +65 -0
- package/templates/project/README.md +11 -0
- package/templates/project/build.sh.eta +17 -0
- package/templates/project/config.json.eta +2 -0
- package/templates/project/generate.ts.eta +10 -0
- package/templates/project/schemas/category.ts.eta +26 -0
- package/templates/project/schemas/index.ts.eta +5 -0
- package/templates/project/schemas/product.ts.eta +59 -0
- package/templates/project/shares/hello.ts.eta +1 -0
- package/templates/project/shares/index.ts.eta +2 -0
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/definations/category.cat.jsonschema.json +0 -55
- package/definations/level.lvl.jsonschema.json +0 -48
- package/definations/product.prd.jsonschema.json +0 -46
- package/templates/basic/controller.eta +0 -152
- package/templates/basic/module.eta +0 -22
- package/templates/basic/service.eta +0 -62
- package/templates/basic/simpleappclient.eta +0 -120
- package/templates/nest/SimpleAppController.eta +0 -69
- package/templates/nest/SimpleAppService.eta +0 -366
- package/templates/nest/TenantMiddleware.eta +0 -34
- package/templates/nest/UserProvider.eta +0 -127
- package/templates/nest/app.controller.eta +0 -12
- package/templates/nest/app.module.eta +0 -64
- package/templates/nest/app.service.eta +0 -8
- package/templates/nest/inputvalidation-exception.eta +0 -6
- package/templates/nest/nest.env.eta +0 -28
- package/templates/nest/nest.main.eta +0 -31
- package/templates/nuxt/components.crudsimple.vue.eta +0 -124
- package/templates/nuxt/components.menus.vue.eta +0 -35
- package/templates/nuxt/env.eta +0 -17
- package/templates/nuxt/pages.[xorg].index.vue.eta +0 -20
- package/templates/nuxt/pages.index.vue.eta +0 -72
- package/templates/nuxt/pages.login.vue.eta +0 -20
- package/templates/nuxt/plugins.simpleapp.ts.eta +0 -88
- package/templates/nuxt/server.api.auth[...].ts.eta +0 -233
- package/templates/nuxt/tailwind.css.eta +0 -49
- /package/templates/basic/{apischema.eta → nest/apischema.ts.eta} +0 -0
- /package/templates/basic/{jsonschema.eta → nest/jsonschema.ts.eta} +0 -0
- /package/templates/basic/{pageindexwithid.vue.eta → nuxt/pages.[id].vue.eta} +0 -0
- /package/templates/nest/{oauth2-redirect.eta → public_html/oauth2-redirect.html.eta} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp generator during initialization.
|
|
4
|
+
* You may modify it for your need
|
|
5
|
+
* last change 2023-09-09
|
|
6
|
+
* author: Ks Tan
|
|
7
|
+
*/
|
|
8
|
+
import { ref, Ref } from "vue";
|
|
9
|
+
import { TenantDoc } from "../simpleapp/TenantDoc";
|
|
10
|
+
// import OrderList from 'primevue/orderlist';
|
|
11
|
+
import Panel from "primevue/panel";
|
|
12
|
+
|
|
13
|
+
const { $event, $listen, $userstore } = useNuxtApp();
|
|
14
|
+
const route = useRoute();
|
|
15
|
+
const userinfo =ref()
|
|
16
|
+
const tenantlist = ref()
|
|
17
|
+
onNuxtReady(()=>{
|
|
18
|
+
|
|
19
|
+
console.log("res",res)
|
|
20
|
+
userinfo.value = $userstore.getUserInfo();
|
|
21
|
+
tenantlist.value=userinfo.value.xOrgList
|
|
22
|
+
// console.log('tenantlist',tenantlist.value)
|
|
23
|
+
// const firstxorg = userinfo.value.xOrgList[0].xorg;
|
|
24
|
+
// if(firstxorg){
|
|
25
|
+
// navigateTo(`/${firstxorg}`)
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</script>
|
|
33
|
+
<template>
|
|
34
|
+
<div>
|
|
35
|
+
<Panel header="Tenant List">
|
|
36
|
+
<div>
|
|
37
|
+
<NuxtLink
|
|
38
|
+
v-for="item in tenantlist"
|
|
39
|
+
:external="true"
|
|
40
|
+
:to="`/${item.xorg}`"
|
|
41
|
+
class="tenant-link"
|
|
42
|
+
>
|
|
43
|
+
<div class="flex flex-wrap p-2 align-items-center gap-3">
|
|
44
|
+
<div class="flex-1 flex flex-column gap-2">
|
|
45
|
+
<span class="font-bold">{{ item.orgId }} - {{ item.orgName }}</span>
|
|
46
|
+
<div class="flex align-items-center gap-2">
|
|
47
|
+
<span>{{ item.branchId }} - {{ item.branchCode }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<span class="font-bold text-900">{{ item.xorg }}</span>
|
|
51
|
+
</div>
|
|
52
|
+
</NuxtLink>
|
|
53
|
+
{{ userinfo }}
|
|
54
|
+
</div>
|
|
55
|
+
</Panel>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
.p-panel {
|
|
61
|
+
@apply m-2;
|
|
62
|
+
}
|
|
63
|
+
.tenant-link:hover div {
|
|
64
|
+
@apply bg-gray-300;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { JSONSchema7,JSONSchema7Definition } from 'json-schema';
|
|
2
|
+
import type {ListOptionType} from './type'
|
|
3
|
+
export const prepareList=(schemaComposition:string,fsetting:JSONSchema7Definition | JSONSchema7Definition[] | undefined,labelfield:string,valuefield:string,propsoptions?:any[],):ListOptionType[]=>{
|
|
4
|
+
let options :ListOptionType[] = []
|
|
5
|
+
let fieldsetting:JSONSchema7 = {} as JSONSchema7
|
|
6
|
+
Object.assign(fieldsetting,fsetting)
|
|
7
|
+
// {...fsetting} as JSONSchema7
|
|
8
|
+
try{
|
|
9
|
+
const convertToList=(list:any[]):ListOptionType[]=>{
|
|
10
|
+
let opts :ListOptionType[] = []
|
|
11
|
+
if(list.length>0 && typeof list[0]=='object'){
|
|
12
|
+
for(let i=0;i<list.length;i++){
|
|
13
|
+
const t = list[i]
|
|
14
|
+
const item = {value:t[valuefield], label:t[labelfield]}
|
|
15
|
+
opts.push(item)
|
|
16
|
+
}
|
|
17
|
+
}else{
|
|
18
|
+
opts = simpleArrayToObject(list)
|
|
19
|
+
}
|
|
20
|
+
return opts
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if(Array.isArray(propsoptions)){
|
|
24
|
+
if(propsoptions.length>0 && typeof propsoptions[0]== 'string'){
|
|
25
|
+
options = simpleArrayToObject(propsoptions)
|
|
26
|
+
}else{
|
|
27
|
+
options = convertToList(propsoptions)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
else if(Array.isArray(fieldsetting.enum)){
|
|
32
|
+
|
|
33
|
+
options = simpleArrayToObject(fieldsetting.enum)
|
|
34
|
+
}else{
|
|
35
|
+
let list:JSONSchema7Definition[]|undefined=[]
|
|
36
|
+
switch(schemaComposition){
|
|
37
|
+
case 'anyOf':
|
|
38
|
+
list=fieldsetting.anyOf
|
|
39
|
+
break;
|
|
40
|
+
case 'oneOf':
|
|
41
|
+
list=fieldsetting.oneOf
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
// console.log("get from anyof")
|
|
47
|
+
// let list:any[]=fieldsetting.anyOf
|
|
48
|
+
options = convertToList(list??[])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// else if(fieldsetting.oneOf && Array.isArray(fieldsetting.oneOf)){
|
|
52
|
+
// let list:any[]=fieldsetting.oneOf
|
|
53
|
+
// options = convertToList(list)
|
|
54
|
+
// }
|
|
55
|
+
//try validate data
|
|
56
|
+
if(options.length>0){
|
|
57
|
+
const d:any = options[0]
|
|
58
|
+
if(typeof d.label=='undefined'){
|
|
59
|
+
const errormsg = `undefine property '${labelfield}', correct 'optionLabel'`
|
|
60
|
+
console.error(errormsg,fieldsetting)
|
|
61
|
+
options=[{value:'',label:errormsg}]
|
|
62
|
+
}
|
|
63
|
+
if(typeof d.value=='undefined'){
|
|
64
|
+
const errormsg = `undefine property '${valuefield}', correct 'optionValue`
|
|
65
|
+
console.error(errormsg,fieldsetting)
|
|
66
|
+
options=[{value:'',label:errormsg}]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return options;
|
|
70
|
+
}catch(error){
|
|
71
|
+
console.error("xxxxx",error)
|
|
72
|
+
return []
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const simpleArrayToObject=(list:any[]):ListOptionType[]=>{
|
|
77
|
+
let options :ListOptionType[] = []
|
|
78
|
+
for (let i =0; i< list.length; i++){
|
|
79
|
+
const value:string = list[i].toString()
|
|
80
|
+
let item :any={value:value,label:value}
|
|
81
|
+
options.push(item)
|
|
82
|
+
}
|
|
83
|
+
return options
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const camelCaseToWords = (s: string) =>{
|
|
87
|
+
const result = s.replace(/([A-Z])/g, ' $1');
|
|
88
|
+
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SimpleAppClient } from './SimpleAppClient';
|
|
2
|
+
import type { JSONSchema7,JSONSchema7Definition } from 'json-schema';
|
|
3
|
+
export type ListOptionType = {
|
|
4
|
+
value?: string
|
|
5
|
+
label?: string
|
|
6
|
+
}
|
|
7
|
+
export enum InputTableColumnType {
|
|
8
|
+
'field'='field',
|
|
9
|
+
'button'='button',
|
|
10
|
+
'checkbox'='checkbox',
|
|
11
|
+
'renderer'='renderer'
|
|
12
|
+
}
|
|
13
|
+
export type InputTableColumn={
|
|
14
|
+
type:InputTableColumnType,
|
|
15
|
+
title?:string
|
|
16
|
+
field?:string
|
|
17
|
+
renderer?:Function
|
|
18
|
+
style?:string
|
|
19
|
+
readonly?:boolean
|
|
20
|
+
}
|
|
21
|
+
export type SimpleAppFieldSetting= {
|
|
22
|
+
path: string,
|
|
23
|
+
instancepath: string,
|
|
24
|
+
fieldsetting:JSONSchema7
|
|
25
|
+
document:SimpleAppClient<any,any>
|
|
26
|
+
modelObject: any,
|
|
27
|
+
modelField: string,
|
|
28
|
+
isrequired: boolean,
|
|
29
|
+
readonly?:boolean
|
|
30
|
+
// errors: props.document.getErrors()
|
|
31
|
+
}
|
|
32
|
+
// x.fieldsetting.pro
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import * as o from "../simpleapp/openapi";
|
|
8
|
+
import * as o from "../simpleapp/generate/openapi";
|
|
9
9
|
import axios from 'axios'
|
|
10
|
-
const
|
|
10
|
+
export const getAutocomplete = (apiname: string): any => {
|
|
11
11
|
//const { csrf } = useCsrf()
|
|
12
12
|
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
13
13
|
const route = useRoute();
|
|
@@ -17,8 +17,8 @@ const getAutoComplete = (apiname: string): any => {
|
|
|
17
17
|
isJsonMime: () => true,
|
|
18
18
|
};
|
|
19
19
|
const docsOpenapi: any = {
|
|
20
|
-
<% for(let i=0;i<it.length; i++){ %>
|
|
21
|
-
'<%=it[i].docname.toLowerCase()%>': new o.<%=it[i].doctype.toUpperCase()%>Api(config),
|
|
20
|
+
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
21
|
+
'<%=it.modules[i].docname.toLowerCase()%>': new o.<%=it.modules[i].doctype.toUpperCase()%>Api(config),
|
|
22
22
|
<%}%>
|
|
23
23
|
};
|
|
24
24
|
if (!docsOpenapi[apiname]) {
|
|
@@ -30,4 +30,3 @@ const getAutoComplete = (apiname: string): any => {
|
|
|
30
30
|
return docsOpenapi[apiname];
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
export default getAutoComplete;
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* last change 2023-09-10
|
|
5
5
|
* author: Ks Tan
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import _ from 'lodash'
|
|
8
|
+
import {alldocuments} from '../simpleapp/generate/commons/documents'
|
|
9
|
+
export const getDocTypes = ()=>{
|
|
10
|
+
return alldocuments.filter(item=>item.page!='')
|
|
11
|
+
}
|
|
8
12
|
export const getMenus =()=>{
|
|
9
13
|
const logout = async () => {
|
|
10
14
|
const { signOut } = useAuth();
|
|
@@ -13,18 +17,29 @@ export const getMenus =()=>{
|
|
|
13
17
|
signOut({ redirect: false });
|
|
14
18
|
window.location.href = data?.value?.path + addPath;
|
|
15
19
|
};
|
|
20
|
+
const {$userstore}=useNuxtApp()
|
|
16
21
|
const route = useRoute();
|
|
17
22
|
const xorg = route.params.xorg
|
|
18
23
|
let data =[];
|
|
24
|
+
//sss
|
|
25
|
+
let allmenus:string[] = alldocuments.filter(item=>item.page!='').map(item=>item.docName)
|
|
26
|
+
|
|
27
|
+
const roles = $userstore.getUserInfo().roles
|
|
28
|
+
let allowmenus=[]
|
|
29
|
+
for(let i=0; i< allmenus.length;i++){
|
|
30
|
+
const keyword = allmenus[i]
|
|
31
|
+
// if(m.label)
|
|
32
|
+
|
|
33
|
+
if($userstore.haveAccess(keyword)){
|
|
34
|
+
const m = {label: keyword, to:`/${xorg}/${keyword}`}
|
|
35
|
+
allowmenus.push(m)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
if(xorg){
|
|
20
40
|
data =[
|
|
21
41
|
{label: 'Home',icon: 'pi pi-fw pi-home', url:'/'},
|
|
22
|
-
{label: 'Cruds',icon: 'pi pi-fw pi-pencil',items:
|
|
23
|
-
<% for(let i=0;i<it.length; i++){ %>
|
|
24
|
-
<% let obj = it[i]%>
|
|
25
|
-
{label: '<%=obj.docname.toLowerCase()%>', to:`/${xorg}/<%=obj.docname.toLowerCase()%>`},
|
|
26
|
-
<%}%>
|
|
27
|
-
]},
|
|
42
|
+
{label: 'Cruds',icon: 'pi pi-fw pi-pencil',items:allowmenus},
|
|
28
43
|
{label: 'Signout',icon: 'pi pi-fw pi-home', command: () => logout()},
|
|
29
44
|
]
|
|
30
45
|
}else{
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const getUserStore = ()=>{
|
|
2
|
+
const {$userstore} = useNuxtApp()
|
|
3
|
+
return $userstore
|
|
4
|
+
}
|
|
5
|
+
export const reloadUserStore = async () =>{
|
|
6
|
+
const {$userstore} = useNuxtApp()
|
|
7
|
+
await $userstore.loadRemoteUserInfo()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const getUserProfile = () =>{
|
|
11
|
+
return getUserStore().getUserInfo()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* verify current user can perform specific action base on backend RBAC
|
|
16
|
+
* @param resource:string upper case first letter document name
|
|
17
|
+
* @param action:string action name, can be create/update/delete...
|
|
18
|
+
* @return boolean
|
|
19
|
+
*/
|
|
20
|
+
export const canPerform = (resource:string,action:string):boolean =>{
|
|
21
|
+
return getUserStore().canPerform(resource,action)
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const logout = async () => {
|
|
2
|
+
const { signOut } = useAuth();
|
|
3
|
+
const { data } = await <any>useFetch('/api/auth/logout');
|
|
4
|
+
const signoutres = await signOut({redirect:false});
|
|
5
|
+
console.log("signout data", signoutres)
|
|
6
|
+
// console.log(data.value)
|
|
7
|
+
if(data['value']&& data['value']['path']){
|
|
8
|
+
// const logoutkeycloak = await <any>useFetch(data.value.path);
|
|
9
|
+
// console.log('logoutkeycloak',data['value']['path'])
|
|
10
|
+
if(data['value']['path']){
|
|
11
|
+
navigateTo(data.value.path, { external: true })
|
|
12
|
+
}
|
|
13
|
+
//
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// console.log('logout data',data.value)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// const addPath = encodeURIComponent("/login");
|
|
20
|
+
//
|
|
21
|
+
|
|
22
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
|
|
3
|
+
type roletype = {resource:string, action:string}
|
|
4
|
+
type grouptype = {[key:string]:roletype[]}
|
|
5
|
+
|
|
6
|
+
const allroles:roletype[] = [
|
|
7
|
+
<% for(let i=0;i<it.modules.length; i++){ %>
|
|
8
|
+
<% const m = it.modules[i] %>
|
|
9
|
+
{resource: '<%=m.docname%>', action:'create'},
|
|
10
|
+
{resource: '<%=m.docname%>', action:'update'},
|
|
11
|
+
{resource: '<%=m.docname%>', action:'delete'},
|
|
12
|
+
{resource: '<%=m.docname%>', action:'search'},
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<% if(m.api && m.api.length >0) {%>
|
|
16
|
+
|
|
17
|
+
<% for(let j=0;j<m.api.length; j++){ %>
|
|
18
|
+
<%let api = m.api[j]%>
|
|
19
|
+
{resource: '<%=m.docname%>', action:'<%=api.action%>'},
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<%}%>
|
|
23
|
+
<%}%>
|
|
24
|
+
<%}%>
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
export const allgroups:grouptype = {
|
|
28
|
+
<% Object.getOwnPropertyNames(it.allroles).forEach((key)=>{ %>
|
|
29
|
+
<%=key%>:[
|
|
30
|
+
<%for(let i=0; i <it.allroles[key].length; i++){%>
|
|
31
|
+
<% const arr = it.allroles[key][i].split('_') %>
|
|
32
|
+
{resource:'<%=arr[0]%>',action:'<%=arr[1]%>'},
|
|
33
|
+
<%}%>
|
|
34
|
+
],
|
|
35
|
+
<%})%>
|
|
36
|
+
}
|
|
37
|
+
export const getAllRoles = () => allroles
|
|
38
|
+
export const getUniqueResource = () => _.uniqBy(allroles,'resource').map((item,index)=>item.resource)
|
|
39
|
+
export const getActionFromResource = (resource:string)=>_.filter(allroles,{resource:resource})
|
|
40
|
+
.map((item,index)=>item.action)
|
|
41
|
+
export const getAllGroups = () =>Object.getOwnPropertyNames(allgroups)
|
|
42
|
+
export const getGroupRoles = (groupname:string) => allgroups[groupname]
|
|
43
|
+
export const getGroupResourcePermission= (groupname:string,targetresource:string) =>
|
|
44
|
+
allgroups[groupname].filter((r)=>r.resource==targetresource)
|
|
45
|
+
export const canPerformAction =(groupname:string,resource:string,actionname:string)=>{
|
|
46
|
+
const grouppermissions = getGroupResourcePermission(groupname,resource)
|
|
47
|
+
return grouppermissions.map((r)=>r.action).includes(actionname)
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getUserProfile } from './../composables/getUserStore.generate';
|
|
2
|
+
export default defineNuxtRouteMiddleware((to, from) => {
|
|
3
|
+
|
|
4
|
+
const userprofile = getUserProfile()
|
|
5
|
+
|
|
6
|
+
if(to.fullPath=='/login'){
|
|
7
|
+
return true
|
|
8
|
+
}// no permission control needed yet
|
|
9
|
+
else if(!to.params['xorg']){
|
|
10
|
+
|
|
11
|
+
return true //no permission needed
|
|
12
|
+
}else{
|
|
13
|
+
|
|
14
|
+
const resourcename = to.fullPath.split('/')[2]
|
|
15
|
+
|
|
16
|
+
if(resourcename===undefined){//home page
|
|
17
|
+
|
|
18
|
+
// return true //no permission needed
|
|
19
|
+
if(userprofile.group==''){
|
|
20
|
+
console.error("no access right to current xorg")
|
|
21
|
+
return navigateTo('/')
|
|
22
|
+
}else{
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}else{
|
|
27
|
+
const {$userstore} = useNuxtApp()
|
|
28
|
+
if($userstore.haveAccess(resourcename)){
|
|
29
|
+
return true
|
|
30
|
+
}else{
|
|
31
|
+
console.error("access deny, redirect to '/'")
|
|
32
|
+
return navigateTo('/')
|
|
33
|
+
// abortNavigation()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
})
|
|
@@ -4,6 +4,7 @@ export default defineNuxtConfig({
|
|
|
4
4
|
public:{
|
|
5
5
|
SIMPLEAPP_BACKEND_URL: process.env.SIMPLEAPP_BACKEND_URL,
|
|
6
6
|
APP_URL: process.env.APP_URL,
|
|
7
|
+
API_URL: process.env.API_URL,
|
|
7
8
|
DEBUGDATA: process.env.DEBUGDATA,
|
|
8
9
|
}
|
|
9
10
|
},
|
|
@@ -22,15 +23,24 @@ tailwindcss: {
|
|
|
22
23
|
'@sidebase/nuxt-auth',
|
|
23
24
|
"nuxt-security",
|
|
24
25
|
'@vueuse/nuxt',
|
|
25
|
-
'@nuxt/ui'
|
|
26
|
+
'@nuxt/ui',
|
|
27
|
+
'@nuxtjs/tailwindcss',
|
|
28
|
+
'@pinia/nuxt'
|
|
26
29
|
],
|
|
30
|
+
pinia: {
|
|
31
|
+
autoImports: [
|
|
32
|
+
// automatically imports `defineStore`
|
|
33
|
+
'defineStore', // import { defineStore } from 'pinia'
|
|
34
|
+
['defineStore', 'definePiniaStore'], // import { defineStore as definePiniaStore } from 'pinia'
|
|
35
|
+
],
|
|
36
|
+
},
|
|
27
37
|
auth: {
|
|
28
38
|
globalAppMiddleware: true
|
|
29
39
|
},
|
|
30
40
|
security: {
|
|
31
41
|
//csrf: true, // been force to off csrf cash it crash with nuxt-auth
|
|
32
42
|
},
|
|
33
|
-
ssr:
|
|
43
|
+
ssr: false,
|
|
34
44
|
|
|
35
45
|
css: [
|
|
36
46
|
"primevue/resources/themes/lara-light-blue/theme.css",
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
4
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
+
* prevent regenerate code override it.
|
|
6
|
+
* last change 2023-09-09
|
|
7
|
+
* author: Ks Tan
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
InputTableColumnType,
|
|
12
|
+
InputTableColumn,
|
|
13
|
+
} from "@simitgroup/simpleapp-vue-component/src/type";
|
|
14
|
+
import Column from "primevue/column";
|
|
15
|
+
const { $BranchDoc } = useNuxtApp();
|
|
16
|
+
const doc = $BranchDoc();
|
|
17
|
+
const data = doc.getReactiveData();
|
|
18
|
+
const columns = [
|
|
19
|
+
/* skip system columns branchId*/
|
|
20
|
+
"branchCode",
|
|
21
|
+
"branchName",
|
|
22
|
+
"description" /* skip system columns _id*/,
|
|
23
|
+
/* skip system columns doctype*/
|
|
24
|
+
/* skip system columns created*/
|
|
25
|
+
/* skip system columns updated*/
|
|
26
|
+
/* skip system columns createdby*/
|
|
27
|
+
/* skip system columns updatedby*/
|
|
28
|
+
/* skip system columns tenantId*/
|
|
29
|
+
/* skip system columns orgId*/
|
|
30
|
+
];
|
|
31
|
+
//prepare subtable if exists
|
|
32
|
+
/*
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
*/
|
|
48
|
+
//end
|
|
49
|
+
</script>
|
|
50
|
+
<template>
|
|
51
|
+
<div>
|
|
52
|
+
<CrudSimple
|
|
53
|
+
:document="doc"
|
|
54
|
+
title="Branch"
|
|
55
|
+
#default="o"
|
|
56
|
+
:path="`/${useRoute().params.xorg}/branch`"
|
|
57
|
+
:listColumns="columns"
|
|
58
|
+
>
|
|
59
|
+
<SimpleAppAutocomplete
|
|
60
|
+
:setting="o.getField('#/properties/organization')"
|
|
61
|
+
v-model="data.organization"
|
|
62
|
+
optionLabel="label"
|
|
63
|
+
:remote-src="getAutocomplete('organization')"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<SimpleAppText
|
|
67
|
+
autofocus
|
|
68
|
+
:setting="o.getField('#/properties/branchCode')"
|
|
69
|
+
v-model="data.branchCode"
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<SimpleAppText
|
|
73
|
+
autofocus
|
|
74
|
+
:setting="o.getField('#/properties/branchName')"
|
|
75
|
+
v-model="data.branchName"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<SimpleAppCheckbox
|
|
79
|
+
autofocus
|
|
80
|
+
:setting="o.getField('#/properties/active')"
|
|
81
|
+
v-model="data.active"
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<SimpleAppText
|
|
85
|
+
autofocus
|
|
86
|
+
:setting="o.getField('#/properties/description')"
|
|
87
|
+
v-model="data.description"
|
|
88
|
+
/>
|
|
89
|
+
<SimpleAppNumber
|
|
90
|
+
:readonly="true"
|
|
91
|
+
:setting="o.getField('#/properties/orgId')"
|
|
92
|
+
v-model="data.orgId"
|
|
93
|
+
/>
|
|
94
|
+
<SimpleAppNumber
|
|
95
|
+
:readonly="true"
|
|
96
|
+
:setting="o.getField('#/properties/branchId')"
|
|
97
|
+
v-model="data.branchId"
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
</CrudSimple>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by simpleapp everytime regenerate code.
|
|
4
|
+
* delete file "delete-me-for-avoid-override" if you want to modify this file and
|
|
5
|
+
* prevent regenerate code override it.
|
|
6
|
+
* last change 2023-09-09
|
|
7
|
+
* author: Ks Tan
|
|
8
|
+
*/
|
|
9
|
+
import Index from "./index.vue";
|
|
10
|
+
definePageMeta({
|
|
11
|
+
layout: 'sidelistcrud',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
</script>
|
|
15
|
+
<template>
|
|
16
|
+
<Index />
|
|
17
|
+
</template>
|