@simitgroup/simpleapp-generator 2.0.3-f-alpha → 2.0.3-h-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/ReleaseNote.md +6 -0
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +5 -10
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/generate.ts +5 -11
- package/templates/nest/src/app.service.ts.eta +1 -5
- package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +0 -7
- package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +0 -4
- package/templates/nest/src/simple-app/_core/framework/schemas/simple-app.schema.ts.eta +0 -1
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +11 -26
- package/templates/nuxt/plugins/09.app-init.ts.eta +13 -0
- package/templates/nuxt/plugins/10.axios.ts.eta +86 -0
- package/templates/nuxt/plugins/11.event-bus.ts.eta +20 -0
- package/templates/nuxt/plugins/12.primevue-services.ts.eta +18 -0
- package/templates/nuxt/types/index.ts._eta +0 -1
- package/templates/nuxt/types/schema.ts.eta +12 -11
- package/README copy.md +0 -1283
- package/src/processors/bpmnbuilder.ts +0 -167
- package/templates/nuxt/components/header/button/task/HeaderButtonTaskItem.vue.eta +0 -28
- package/templates/nuxt/components/header/button/task/HeaderButtonTaskList.vue._eta +0 -114
- package/templates/nuxt/components/workflow/forms/dynamicfield.vue._eta +0 -92
- package/templates/nuxt/components/workflow/forms/index.ts._eta +0 -17
- package/templates/nuxt/components/workflow/forms/simpleapprove.vue._eta +0 -49
- package/templates/nuxt/composables/workflow.generate.ts.eta +0 -27
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +0 -126
- package/templates/nuxt/simpleapp/workflows/bpmn/readme.md._eta +0 -1
- package/templates/nuxt/simpleapp/workflows/forms/index.ts._eta +0 -8
- package/templates/nuxt/simpleapp/workflows/forms/readme.md._eta +0 -1
- package/templates/nuxt/simpleapp/workflows/forms/simpleapprove.jsonschema.ts._eta +0 -14
- package/templates/nuxt/types/workflow.ts.eta +0 -25
- package/templates/project/workflows/bpmn/sayhello.bpmn._eta +0 -42
- package/templates/project/workflows/forms/index.ts._eta +0 -2
- package/templates/project/workflows/forms/simpleapprove.jsonschema.ts._eta +0 -8
- package/templates/workflow/next/listener.ts.eta +0 -79
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { Logger, ILogObj } from "tslog";
|
|
2
|
-
import { capitalizeFirstLetter } from './../libs';
|
|
3
|
-
import {mkdirSync, readdir,readFileSync,writeFileSync,existsSync,copyFileSync, readdirSync} from 'fs'
|
|
4
|
-
import BpmnModdle from 'bpmn-moddle';
|
|
5
|
-
import _ from 'lodash'
|
|
6
|
-
import * as constants from '../constant'
|
|
7
|
-
import {moddleOptions} from '../resource/camunda-moodle'
|
|
8
|
-
const log: Logger<ILogObj> = new Logger();
|
|
9
|
-
const { Eta } = require('eta');
|
|
10
|
-
export const generateWorkflows = async (configs,genFor:string[]) =>{
|
|
11
|
-
const invalidElementId = /[ `!@#$%^&*()+\-=\[\]{};':"\\|,.<>\/?~]/;
|
|
12
|
-
|
|
13
|
-
const moddle = new BpmnModdle({moddleOptions});
|
|
14
|
-
const frontendFolder=configs.frontendFolder
|
|
15
|
-
const backendFolder=configs.backendFolder
|
|
16
|
-
const bpmnFolder = configs.bpmnFolder
|
|
17
|
-
const filelist = readdirSync(bpmnFolder)
|
|
18
|
-
|
|
19
|
-
console.log("bpmn filelist",filelist)
|
|
20
|
-
const generateTemplatefolder = `${constants.templatedir}/workflow`
|
|
21
|
-
let workflows:string[] = []
|
|
22
|
-
|
|
23
|
-
if(genFor.includes('nest')){
|
|
24
|
-
mkdirSync(`${backendFolder}/src/simpleapp/workflows/bpmn`,{recursive:true})
|
|
25
|
-
mkdirSync(`${backendFolder}/src/simpleapp/workflows/listeners`,{recursive:true})
|
|
26
|
-
}
|
|
27
|
-
if(genFor.includes('nuxt')){
|
|
28
|
-
mkdirSync(`${frontendFolder}/simpleapp/workflows/bpmn`,{recursive:true})
|
|
29
|
-
mkdirSync(`${frontendFolder}/simpleapp/workflows/forms`,{recursive:true})
|
|
30
|
-
copyFormKeys(`${bpmnFolder}/../forms`,`${frontendFolder}/simpleapp/workflows/forms`)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for(let w = 0; w< filelist.length;w++){
|
|
34
|
-
const bpmnfile = filelist[w]
|
|
35
|
-
if(!bpmnfile.includes('.bpmn')){
|
|
36
|
-
continue
|
|
37
|
-
}
|
|
38
|
-
const bpmnfilepath = `${bpmnFolder}/${bpmnfile}`
|
|
39
|
-
const processName = bpmnfile.split('.')[0]
|
|
40
|
-
console.log("processNameprocessName",processName)
|
|
41
|
-
const xmlstring = readFileSync(`${bpmnfilepath}`, 'utf-8');
|
|
42
|
-
|
|
43
|
-
const xmlobj = await moddle.fromXML(xmlstring);
|
|
44
|
-
const flowElements = xmlobj.rootElement.rootElements[0].flowElements
|
|
45
|
-
let elements:any[]=[]
|
|
46
|
-
for(let i=0; i<flowElements.length;i++){
|
|
47
|
-
const e = flowElements[i]
|
|
48
|
-
if(['bpmn:UserTask','bpmn:ServiceTask'].includes(e.$type)){
|
|
49
|
-
if(invalidElementId.test(e.id)){
|
|
50
|
-
log.error(`bpmn File : ${bpmnfile} -> Task(${e.name} defined invalid symbol in id:"${e.id}"`)
|
|
51
|
-
throw "quite"
|
|
52
|
-
}
|
|
53
|
-
/*
|
|
54
|
-
read current process user task
|
|
55
|
-
1. create type and apischemas for process task.such as updatescheduleacknowledgeteacher, with content same with inputsetting
|
|
56
|
-
read input setting
|
|
57
|
-
create file if not exists
|
|
58
|
-
backend/src/simpleapp/workflows/types
|
|
59
|
-
backend/src/simpleapp/workflows/apischemas
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
2. create workflow controller with input body updatescheduleacknowledgeteacher
|
|
63
|
-
import types and apischemas
|
|
64
|
-
|
|
65
|
-
3. create formkey .vue at frontend
|
|
66
|
-
enum = select, text = text, number =input number
|
|
67
|
-
|
|
68
|
-
4. submit workflow shall define presentation properties also, possible form key
|
|
69
|
-
5. onclick workflow prompt out dialog, complete dialog refresh task list
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
=====================
|
|
73
|
-
messaging service
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
let documentation :string= ''
|
|
87
|
-
if(e.documentation && e.documentation[0] && e.documentation[0].text){
|
|
88
|
-
documentation=e.documentation[0].text
|
|
89
|
-
}
|
|
90
|
-
const setting={
|
|
91
|
-
type: e.$type,
|
|
92
|
-
id: e.id,
|
|
93
|
-
name: e.name,
|
|
94
|
-
documentation: documentation.replace("\n","\n *")
|
|
95
|
-
}
|
|
96
|
-
elements.push(setting)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// delegates = _.uniq(delegates)
|
|
102
|
-
const variables = {
|
|
103
|
-
name:processName,
|
|
104
|
-
processName: capitalizeFirstLetter(processName),
|
|
105
|
-
elements: elements
|
|
106
|
-
}
|
|
107
|
-
// console.log("sample--------sample",xmlobj.rootElement.rootElements[0].name, )
|
|
108
|
-
|
|
109
|
-
//copy workflow definition file to frontend and backend
|
|
110
|
-
if(genFor.includes('nest')){
|
|
111
|
-
copyFileSync(`${bpmnfilepath}`,`${backendFolder}/src/simpleapp/workflows/bpmn/${bpmnfile}`)
|
|
112
|
-
const targetlistener = `${backendFolder}/src/simpleapp/workflows/listeners/${processName}.listener.ts`
|
|
113
|
-
|
|
114
|
-
const eta = new Eta({
|
|
115
|
-
views: '/',
|
|
116
|
-
functionHeader: getCodeGenHelper()
|
|
117
|
-
});
|
|
118
|
-
if(!existsSync(targetlistener) || readFileSync(targetlistener, 'utf-8').includes('--remove-this-line-to-prevent-override--')){
|
|
119
|
-
// //write something
|
|
120
|
-
const templatepath = `${generateTemplatefolder}/next/listener.ts.eta`
|
|
121
|
-
const filecontent = eta.render(templatepath, variables)
|
|
122
|
-
writeFileSync(targetlistener,filecontent)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if(genFor.includes('nuxt')){
|
|
126
|
-
copyFileSync(`${bpmnfilepath}`,`${frontendFolder}/simpleapp/workflows/bpmn/${bpmnfile}`)
|
|
127
|
-
|
|
128
|
-
//create form key
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
workflows.push(processName)
|
|
137
|
-
|
|
138
|
-
//modify workflowdeletegate to import all files
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
//copy file backend
|
|
143
|
-
//copy file frontend
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// const groupdata = JSON.parse(groupjsonstr);
|
|
147
|
-
// const documentname = groupfile.split('.')[0]
|
|
148
|
-
// const roles = prepareRoles(groupdata)
|
|
149
|
-
// allroles[documentname]=roles
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return workflows
|
|
155
|
-
}
|
|
156
|
-
const copyFormKeys=(fromtPath:string , toPath:string)=>{
|
|
157
|
-
const files = readdirSync(fromtPath)
|
|
158
|
-
for(let i=0; i< files.length;i++){
|
|
159
|
-
const filename = files[i]
|
|
160
|
-
if(filename=='.') continue
|
|
161
|
-
|
|
162
|
-
copyFileSync(`${fromtPath}/${filename}`,`${toPath}/${filename}`)
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const getCodeGenHelper = () => 'const capitalizeFirstLetter = (str) => str.slice(0, 1).toUpperCase() + str.slice(1);' +
|
|
166
|
-
'const initType=(str)=>{return ["string","number","boolean","array","object"].includes(str) ? capitalizeFirstLetter(str) : str;};' +
|
|
167
|
-
'const camelCaseToWords = (s) => {const result = s.replace(/([A-Z])/g, \' $1\');return result.charAt(0).toUpperCase() + result.slice(1);}'
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex flex-col border cursor-pointer p-2" @click="$emit('click',task)">
|
|
3
|
-
<!-- <span v-else class="text-gray-400 text-sm">{{ value[f] }}</span> -->
|
|
4
|
-
<!-- <div>{{ task.data }}</div> -->
|
|
5
|
-
<div class="flex flex-row">
|
|
6
|
-
<span class="flex-1">{{task.name}}</span><span class="flex-1 text-right">{{ task.startedAt }}</span>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="text text-sm text-gray-400">{{task.processName}}</div>
|
|
9
|
-
<!-- <div class="text text-xs text-gray-300">{{task.taskId}}</div> -->
|
|
10
|
-
<div v-if="task.dueDate" class="text text-xs text-gray-200">{{ task.dueDate }}</div>
|
|
11
|
-
<div v-if="task.priority" class="text text-xs text-gray-200">{{ task.priority }}</div>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
/**
|
|
16
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
17
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
18
|
-
* last change 2023-10-28
|
|
19
|
-
* Author: Ks Tan
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
defineEmits(['click'])
|
|
23
|
-
const props = defineProps<{
|
|
24
|
-
task:any
|
|
25
|
-
}>()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</script>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button class="text-center border-none cursor-pointer p-1" @click="visible=true" >
|
|
3
|
-
<i class="pi pi-bell">
|
|
4
|
-
<Badge :value="taskqty" severity="danger"></Badge>
|
|
5
|
-
</i>
|
|
6
|
-
|
|
7
|
-
<Drawer v-model:visible="visible" position="right" :modal="false" :dismissable="false">
|
|
8
|
-
<template #header>
|
|
9
|
-
<div class="text text-lg font-bold">{{ t('mytasks') }}</div>
|
|
10
|
-
</template>
|
|
11
|
-
<HeaderButtonTaskItem v-for="task in tasklist" :task="task" @click="viewTask"></HeaderButtonTaskItem>
|
|
12
|
-
</Drawer>
|
|
13
|
-
<Dialog v-model:visible="dialogvisible"
|
|
14
|
-
@update:visible="closeDialog"
|
|
15
|
-
:pt="{root:{class:'w-1/2 h-5/6'}}"
|
|
16
|
-
:modal="true"
|
|
17
|
-
:close-on-escape="false" >
|
|
18
|
-
<template #header>
|
|
19
|
-
<div class="text text-lg font-bold">
|
|
20
|
-
{{ selectedtask?.processName }} / {{ selectedtask?.name }}
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
<template #default>
|
|
24
|
-
<div v-if="componentresolver && formSchema" >
|
|
25
|
-
<component :is="componentresolver"
|
|
26
|
-
:processName="selectedtask?.processName ?? ''"
|
|
27
|
-
:taskName="selectedtask?.name??''"
|
|
28
|
-
:instanceData="instanceData"
|
|
29
|
-
:jsonschema="formSchema"
|
|
30
|
-
v-model="data"
|
|
31
|
-
@submit="invokeTask"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
</Dialog>
|
|
36
|
-
</button>
|
|
37
|
-
</template>
|
|
38
|
-
<script setup lang="ts">
|
|
39
|
-
/**
|
|
40
|
-
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
41
|
-
* --remove-this-line-to-prevent-override--
|
|
42
|
-
* last change 2023-10-28
|
|
43
|
-
* Author: Ks Tan
|
|
44
|
-
*/
|
|
45
|
-
import {UserTaskType,NotificationStatus} from '~/types'
|
|
46
|
-
import { useDialog } from 'primevue/usedialog';
|
|
47
|
-
import * as forms from '~/simpleapp/workflows/forms'
|
|
48
|
-
import {getFormComponent} from '~/components/workflow/forms'
|
|
49
|
-
const dialog = useDialog()
|
|
50
|
-
const dialogvisible = ref(false)
|
|
51
|
-
const visible = ref(false)
|
|
52
|
-
const selectedtask = ref<UserTaskType>()
|
|
53
|
-
const tasklist = ref<UserTaskType[]>([])
|
|
54
|
-
const formSchema = ref()
|
|
55
|
-
const formkey = ref<string>('')
|
|
56
|
-
const data = ref<any>({})
|
|
57
|
-
const instanceData = ref<any>({})
|
|
58
|
-
const componentresolver = computed(()=>{
|
|
59
|
-
const workflowform = getFormComponent(formkey.value as string)
|
|
60
|
-
console.log("workflowformworkflowformworkflowform",workflowform)
|
|
61
|
-
return workflowform
|
|
62
|
-
})
|
|
63
|
-
const taskqty = computed(()=>tasklist.value.length)
|
|
64
|
-
|
|
65
|
-
onMounted(async ()=> syncTask())
|
|
66
|
-
watch(visible,(newvalue)=>{
|
|
67
|
-
if(newvalue){
|
|
68
|
-
syncTask()
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
const syncTask = async ()=>{
|
|
72
|
-
tasklist.value = await getTaskList()
|
|
73
|
-
if(tasklist.value.length==0){
|
|
74
|
-
visible.value=false
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const closeDialog = ()=>{
|
|
78
|
-
console.log('close dialog')
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const invokeTask = async ()=>{
|
|
82
|
-
const res = await invokeUserTask(selectedtask.value?.taskId,data)
|
|
83
|
-
syncTask()
|
|
84
|
-
dialogvisible.value=false
|
|
85
|
-
}
|
|
86
|
-
const viewTask = async (task:UserTaskType)=>{
|
|
87
|
-
|
|
88
|
-
selectedtask.value=task
|
|
89
|
-
instanceData.value=task.data
|
|
90
|
-
|
|
91
|
-
const formsettings:any = await getTaskForm(task.processName, task.elementId)
|
|
92
|
-
formkey.value = formsettings.schema
|
|
93
|
-
console.log("viewTask formsettings",formsettings)
|
|
94
|
-
formSchema.value = forms[formkey.value as keyof typeof forms]
|
|
95
|
-
if(formSchema.value){
|
|
96
|
-
Object.keys(formSchema.value.properties).forEach((key)=>{
|
|
97
|
-
data.value[key]=''
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
dialogvisible.value=true
|
|
101
|
-
}else{
|
|
102
|
-
useNuxtApp().$event('Notification',{
|
|
103
|
-
documentName:task.processName,
|
|
104
|
-
summary:t('formKeyNotFound',{formKey:formkey.value}),
|
|
105
|
-
status:NotificationStatus.error,
|
|
106
|
-
message:t('formKeyNotFound',{formKey:formkey.value}),
|
|
107
|
-
|
|
108
|
-
})
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
onMounted(()=>syncTask())
|
|
114
|
-
</script>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div >
|
|
3
|
-
<div>
|
|
4
|
-
<pre>{{ data}}dynamic</pre>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="border " v-if="jsonschema">
|
|
7
|
-
<SimpleAppJsonSchemaForm :schema="jsonschema" :data="data" #default="o" >
|
|
8
|
-
<Card>
|
|
9
|
-
<template #header>Response</template>
|
|
10
|
-
<template #content>
|
|
11
|
-
<div >
|
|
12
|
-
<div v-for="field in Object.keys(jsonschema.properties ?? {} )" class="border p-2">
|
|
13
|
-
<SimpleAppInput :setting="o.getField(`#/properties/${field}`)"
|
|
14
|
-
:input-type="autoPickInput( field )"
|
|
15
|
-
v-model="data[field]" />
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
<template #footer>
|
|
20
|
-
<Button class="btn-primary" @click="o.validate(validateCallBack)">{{ t('submit') }}</Button>
|
|
21
|
-
|
|
22
|
-
</template>
|
|
23
|
-
</Card>
|
|
24
|
-
</SimpleAppJsonSchemaForm>
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
<script lang="ts" setup>
|
|
30
|
-
/**
|
|
31
|
-
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
32
|
-
* --remove-this-line-to-prevent-override--
|
|
33
|
-
* last change 2024-02-22
|
|
34
|
-
* author: Ks Tan
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
import {UserTaskType,SimpleAppInputType} from '~/types'
|
|
38
|
-
import type { JSONSchema7 } from 'json-schema'
|
|
39
|
-
const props = defineProps<{
|
|
40
|
-
processName:string
|
|
41
|
-
taskName:string
|
|
42
|
-
jsonschema:JSONSchema7
|
|
43
|
-
instanceData:any
|
|
44
|
-
}>()
|
|
45
|
-
// props.jsonschema.properties
|
|
46
|
-
const modelValue = defineModel<any>({})
|
|
47
|
-
const emit = defineEmits(['submit'])
|
|
48
|
-
const validateCallBack = async (errors:any)=>{
|
|
49
|
-
// console.log("After validate",result)
|
|
50
|
-
if(!errors){
|
|
51
|
-
emit('submit',modelValue)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const autoPickInput = (field:string) =>{
|
|
56
|
-
let setting :JSONSchema7= {type:'string'}
|
|
57
|
-
|
|
58
|
-
if(props.jsonschema.properties && props.jsonschema.properties[field]){
|
|
59
|
-
setting = props.jsonschema.properties[field] as JSONSchema7 //force type
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if(setting.type=='boolean'){
|
|
64
|
-
return SimpleAppInputType.checkbox
|
|
65
|
-
}if(setting.type=='number'){
|
|
66
|
-
return SimpleAppInputType.number
|
|
67
|
-
}
|
|
68
|
-
else if(setting.enum){
|
|
69
|
-
return SimpleAppInputType.select
|
|
70
|
-
}
|
|
71
|
-
else if(setting.type=='string'){
|
|
72
|
-
return pickStringInput(setting)
|
|
73
|
-
}else{
|
|
74
|
-
return SimpleAppInputType.text
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const pickStringInput = (setting:any) =>{
|
|
79
|
-
switch(setting.format){
|
|
80
|
-
case 'date':
|
|
81
|
-
return SimpleAppInputType.date
|
|
82
|
-
break;
|
|
83
|
-
case 'textarea':
|
|
84
|
-
return SimpleAppInputType.textarea
|
|
85
|
-
break;
|
|
86
|
-
case 'text':
|
|
87
|
-
default:
|
|
88
|
-
return SimpleAppInputType.text
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
3
|
-
* --remove-this-line-to-prevent-override--
|
|
4
|
-
* last change 2024-02-22
|
|
5
|
-
* author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import dynamicfield from './dynamicfield.vue'
|
|
9
|
-
import simpleapprove from './simpleapprove.vue'
|
|
10
|
-
|
|
11
|
-
const forms: {[key:string]:Component}={
|
|
12
|
-
dynamicfield:dynamicfield,
|
|
13
|
-
simpleapprove:simpleapprove
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const getFormComponent =(formkey:string)=> forms[formkey] ?? forms['dynamicfield']
|
|
17
|
-
export {dynamicfield,simpleapprove}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<SimpleAppJsonSchemaForm :schema="jsonschema" :data="modelValue" #default="o" >
|
|
3
|
-
<Card>
|
|
4
|
-
<template #content>
|
|
5
|
-
<div>
|
|
6
|
-
<h1>{{t('simpleApproveMessage')}}</h1>
|
|
7
|
-
</div>
|
|
8
|
-
<div >
|
|
9
|
-
<SimpleAppInput :setting="o.getField(`#/properties/decision`)"
|
|
10
|
-
:input-type="SimpleAppInputType.select"
|
|
11
|
-
v-model="modelValue.decision"
|
|
12
|
-
/>
|
|
13
|
-
<SimpleAppInput :setting="o.getField(`#/properties/description`)"
|
|
14
|
-
:input-type="SimpleAppInputType.textarea"
|
|
15
|
-
v-model="modelValue.description"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
<template #footer>
|
|
20
|
-
<Button class="btn-primary" @click="o.validate(validateCallBack)">{{ t('submit') }}</Button>
|
|
21
|
-
</template>
|
|
22
|
-
</Card>
|
|
23
|
-
</SimpleAppJsonSchemaForm>
|
|
24
|
-
</template>
|
|
25
|
-
<script lang="ts" setup>
|
|
26
|
-
/**
|
|
27
|
-
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
28
|
-
* --remove-this-line-to-prevent-override--
|
|
29
|
-
* last change 2024-02-22
|
|
30
|
-
* author: Ks Tan
|
|
31
|
-
*/
|
|
32
|
-
import {UserTaskType,SimpleAppInputType} from '~/types'
|
|
33
|
-
import type { JSONSchema7 } from 'json-schema'
|
|
34
|
-
const props = defineProps<{
|
|
35
|
-
processName:string
|
|
36
|
-
taskName:string
|
|
37
|
-
jsonschema:JSONSchema7
|
|
38
|
-
instanceData:any
|
|
39
|
-
}>()
|
|
40
|
-
const modelValue = defineModel<{decision:string,description:string}>()
|
|
41
|
-
|
|
42
|
-
const emit = defineEmits(['submit'])
|
|
43
|
-
const validateCallBack = async (errors:any)=>{
|
|
44
|
-
// console.log("After validate",result)
|
|
45
|
-
if(!errors){
|
|
46
|
-
emit('submit',modelValue)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
</script>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-03-24
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
// import {UserTaskApiSchema} from
|
|
8
|
-
// import {UserTaskType} from '../types'
|
|
9
|
-
|
|
10
|
-
import { UserTaskApiSchema } from "~/simpleapp/generate/openapi"
|
|
11
|
-
let taskslist:UserTaskApiSchema[] =[]
|
|
12
|
-
|
|
13
|
-
export const getTaskList = async ()=>{
|
|
14
|
-
const tmp = await getWorkflowApi().getMyUserTask()
|
|
15
|
-
return taskslist
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const getTaskForm = async (workflowName:string,elementId:string)=>{
|
|
19
|
-
const tasks = await getWorkflowApi().getWorkflowUserTaskFormKey(workflowName,elementId)
|
|
20
|
-
return tasks.data
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export const invokeUserTask = async (taskId:string, data:any)=>{
|
|
25
|
-
const result = await getWorkflowApi().invokeWorkflowUserTask(taskId,data)
|
|
26
|
-
return result.data
|
|
27
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2025-10-25
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
import { defineNuxtPlugin } from "#app";
|
|
8
|
-
import axios from "axios";
|
|
9
|
-
import { EventType } from "~/types";
|
|
10
|
-
// import PrimeVue from "primevue/config";
|
|
11
|
-
import mitt from "mitt";
|
|
12
|
-
import { useConfirm } from "primevue/useconfirm";
|
|
13
|
-
import { useDialog } from "primevue/usedialog";
|
|
14
|
-
|
|
15
|
-
// import ToastService from 'primevue/toastservice';
|
|
16
|
-
// import ConfirmationService from 'primevue/confirmationservice';
|
|
17
|
-
// import Tooltip from 'primevue/tooltip';
|
|
18
|
-
const emitter = mitt<EventType>();
|
|
19
|
-
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
20
|
-
//hide __NUXT__ at client side.
|
|
21
|
-
onNuxtReady(() => {
|
|
22
|
-
window.__NUXT__ = undefined;
|
|
23
|
-
});
|
|
24
|
-
// useNuxtApp().vueApp.use(DialogService)
|
|
25
|
-
//const { csrf } = useCsrf()
|
|
26
|
-
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
27
|
-
const myaxios = axios.create({ timeout: 10000 });
|
|
28
|
-
myaxios.interceptors.response.use(
|
|
29
|
-
(response) => {
|
|
30
|
-
return response;
|
|
31
|
-
},
|
|
32
|
-
(error) => {
|
|
33
|
-
// console.log("error catch",error)
|
|
34
|
-
|
|
35
|
-
if (error?.code && error.code == "ERR_BAD_REQUEST") {
|
|
36
|
-
if (error.response && (error.response.status == 401 || error.response.status == 302)) {
|
|
37
|
-
return Promise.reject(error);
|
|
38
|
-
} else if (error.response && error.response.status == 403) {
|
|
39
|
-
console.warn("error status 403, redirect to external link /");
|
|
40
|
-
navigateTo("/", { external: true });
|
|
41
|
-
} else if (error.response && error.response.status === 402) {
|
|
42
|
-
const route = useRoute();
|
|
43
|
-
// if (route.fullPath.endsWith("/billing")) {
|
|
44
|
-
// return Promise.resolve({});
|
|
45
|
-
// } else {
|
|
46
|
-
throw createError({
|
|
47
|
-
statusCode: error.response.status,
|
|
48
|
-
statusMessage: "System Expired",
|
|
49
|
-
message: error.response.statusText,
|
|
50
|
-
});
|
|
51
|
-
// }
|
|
52
|
-
console.log(route);
|
|
53
|
-
} else {
|
|
54
|
-
console.error("axios ERR_BAD_REQUEST", error);
|
|
55
|
-
let errorMsg = "";
|
|
56
|
-
let errorCode = 0;
|
|
57
|
-
let moreMsg = "";
|
|
58
|
-
if (error.response?.data?.data?.message) {
|
|
59
|
-
errorCode = error.response.data.data.status;
|
|
60
|
-
moreMsg = error.response.data.data.message;
|
|
61
|
-
errorMsg = error.response.data.data.name;
|
|
62
|
-
} else if (error.response?.data) {
|
|
63
|
-
errorCode = error.response.data.statusCode;
|
|
64
|
-
moreMsg = error.response.data.statusMessage;
|
|
65
|
-
errorMsg = error.response.data.message;
|
|
66
|
-
} else {
|
|
67
|
-
errorCode = error.status;
|
|
68
|
-
moreMsg = error.message;
|
|
69
|
-
errorMsg = error.name;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const errorData = {
|
|
73
|
-
statusCode: errorCode,
|
|
74
|
-
statusMessage: errorMsg,
|
|
75
|
-
message: moreMsg,
|
|
76
|
-
fatal: true,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// console.log(error.response)
|
|
80
|
-
throw createError(errorData);
|
|
81
|
-
}
|
|
82
|
-
} else if (error.code) {
|
|
83
|
-
throw createError({
|
|
84
|
-
statusCode: error.code,
|
|
85
|
-
statusMessage: error.message,
|
|
86
|
-
fatal: true,
|
|
87
|
-
});
|
|
88
|
-
} else if (error.response && (error.response.status == 302 || error.response.status == 401)) {
|
|
89
|
-
console.error("axios 302 session expired, start login flow");
|
|
90
|
-
} else if (error.response && error.response.status) {
|
|
91
|
-
let errmsg = error.response.message;
|
|
92
|
-
let errorcode = error.response.status;
|
|
93
|
-
if (error.response?.data && error.response?.data?.message) {
|
|
94
|
-
errmsg = error.response.data.message;
|
|
95
|
-
errorcode = error.response.data.statusCode;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
throw createError({
|
|
99
|
-
statusCode: errorcode,
|
|
100
|
-
statusMessage: errmsg,
|
|
101
|
-
fatal: true,
|
|
102
|
-
});
|
|
103
|
-
// return Promise.reject(error)
|
|
104
|
-
} else {
|
|
105
|
-
console.error("unknown error");
|
|
106
|
-
throw createError({ statusCode: 500, statusMessage: "Internal server error" });
|
|
107
|
-
}
|
|
108
|
-
// if (error.response) {
|
|
109
|
-
// console.error("Backend error response:", error.response.data);
|
|
110
|
-
// } else {
|
|
111
|
-
// console.error("Network error:", error);
|
|
112
|
-
// }
|
|
113
|
-
return Promise.reject(error);
|
|
114
|
-
},
|
|
115
|
-
);
|
|
116
|
-
return {
|
|
117
|
-
provide: {
|
|
118
|
-
event: emitter.emit, // Will emit an event
|
|
119
|
-
listen: emitter.on, // Will register a listener for an event
|
|
120
|
-
axios: myaxios,
|
|
121
|
-
confirm: useConfirm(),
|
|
122
|
-
dialog: useDialog,
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
//other components that you need
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
put bpmn files here
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
all form for user task obtain from here
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator during initialization. It is changable.
|
|
3
|
-
* --remove-this-line-to-prevent-override--
|
|
4
|
-
* last change 2024-02-22
|
|
5
|
-
* author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
export const simpleapprove = {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"required": ["decision"],
|
|
10
|
-
"properties": {
|
|
11
|
-
"decision": { "type": "string", "enum": ["", "approve", "reject"] },
|
|
12
|
-
"description": { "type": "string", "default":"" }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2024-02-23
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*/
|
|
7
|
-
export type UserTaskType = {
|
|
8
|
-
|
|
9
|
-
id: string
|
|
10
|
-
taskId: string
|
|
11
|
-
elementId: string
|
|
12
|
-
name: string
|
|
13
|
-
processName: string
|
|
14
|
-
assignee: string
|
|
15
|
-
candidateUsers: string[]
|
|
16
|
-
candidateGroups: string[]
|
|
17
|
-
data: any
|
|
18
|
-
vars: any
|
|
19
|
-
startedAt: string
|
|
20
|
-
followUpDate: string
|
|
21
|
-
dueDate: string
|
|
22
|
-
priority: string
|
|
23
|
-
type: string
|
|
24
|
-
userId: string
|
|
25
|
-
}
|