@simitgroup/simpleapp-generator 1.1.24 → 1.1.26
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 +7 -0
- package/dist/generate.js +1 -1
- package/dist/generate.js.map +1 -1
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -1
- package/dist/processors/jsonschemabuilder.js +4 -0
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/user.ts +1 -1
- package/src/generate.ts +1 -1
- package/src/processors/jsonschemabuilder.ts +5 -0
- package/templates/basic/nest/controller.ts.eta +17 -4
- package/templates/basic/nest/processor.ts.eta +2 -1
- package/templates/basic/nest/service.ts.eta +38 -37
- package/templates/basic/nuxt/pages.form.vue.eta +15 -13
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +46 -4
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +9 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +47 -37
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +47 -21
- package/templates/nuxt/assets/css/style.css._eta +7 -1
- package/templates/nuxt/components/list/ListView.vue.eta +2 -2
- package/templates/nuxt/components/simpleApp/SimpleAppDocumentNo.vue.eta +3 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFieldContainer.vue.eta +2 -2
- package/templates/nuxt/components/simpleApp/SimpleAppInput.vue.eta +79 -37
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +2 -2
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +10 -16
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -2
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +2 -3
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +10 -0
- package/templates/nuxt/simpleapp/generate/types/index.ts.eta +7 -0
- package/templates/nuxt/types/simpleappinput.ts.eta +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- /package/templates/nuxt/{nuxt.config.ts.eta → nuxt.config.ts._eta} +0 -0
- /package/templates/nuxt/types/{index.ts.eta → index.ts._eta} +0 -0
|
@@ -5,29 +5,55 @@
|
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
export type ForeignKey = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
_id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
11
|
export type ModifiedCollection = {
|
|
12
|
-
|
|
13
|
-
}
|
|
12
|
+
[key: string]: string[];
|
|
13
|
+
};
|
|
14
14
|
export type ModifiedRecords = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
15
|
+
createds: ModifiedCollection;
|
|
16
|
+
updateds: ModifiedCollection;
|
|
17
|
+
deleteds: ModifiedCollection;
|
|
18
|
+
};
|
|
19
19
|
export type DocNumberFormatResult = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
20
|
+
formatId: string;
|
|
21
|
+
formatName: string;
|
|
22
|
+
result: string;
|
|
23
|
+
};
|
|
25
24
|
|
|
26
25
|
export type SearchBody = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
filter?: Object;
|
|
27
|
+
|
|
28
|
+
fields?: any[];
|
|
29
|
+
|
|
30
|
+
sorts?: any[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export enum IsolationType {
|
|
35
|
+
'none' = 'none',
|
|
36
|
+
'org' = 'org',
|
|
37
|
+
'tenant' = 'tenant',
|
|
38
|
+
'branch' = 'branch',
|
|
39
|
+
}
|
|
40
|
+
export enum HookType {
|
|
41
|
+
'init' = 'init',
|
|
42
|
+
'beforeSearch' = 'beforeSearch',
|
|
43
|
+
'afterSearch' = 'afterSearch',
|
|
44
|
+
'beforeValidation' = 'beforeValidation',
|
|
45
|
+
'afterValidation' = 'afterValidation',
|
|
46
|
+
'beforeCreate' = 'beforeCreate',
|
|
47
|
+
'afterCreate' = 'afterCreate',
|
|
48
|
+
'beforeUpdate' = 'beforeUpdate',
|
|
49
|
+
'afterUpdate' = 'afterUpdate',
|
|
50
|
+
'beforeDelete' = 'beforeDelete',
|
|
51
|
+
'afterDelete' = 'afterDelete',
|
|
52
|
+
'beforeFetchRecord' = 'beforeFetchRecord',
|
|
53
|
+
'afterFetchRecord' = 'afterFetchRecord',
|
|
54
|
+
'beforeSetStatus'='beforeSetStatus',
|
|
55
|
+
'afterSetStatus'='afterSetStatus'
|
|
56
|
+
}
|
|
57
|
+
export type MoreProjectionType = {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
};
|
|
@@ -30,7 +30,9 @@ input {
|
|
|
30
30
|
@apply bg-primary-100 dark:bg-gray-800 block
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
.invisible{
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
34
36
|
.title-text{
|
|
35
37
|
@apply text-xl font-bold text-gray-700
|
|
36
38
|
}
|
|
@@ -54,3 +56,7 @@ input {
|
|
|
54
56
|
.btn-warn {
|
|
55
57
|
@apply btn bg-warning-600 hover:bg-warning-400
|
|
56
58
|
}
|
|
59
|
+
|
|
60
|
+
.simpleapp-input-label{
|
|
61
|
+
@apply text-left
|
|
62
|
+
}
|
|
@@ -31,9 +31,9 @@ import {ListItem} from '~/types/listview'
|
|
|
31
31
|
const props = withDefaults(defineProps<{
|
|
32
32
|
list:any[],
|
|
33
33
|
url?:string,
|
|
34
|
-
titleField
|
|
34
|
+
titleField?:string
|
|
35
35
|
idField?:string
|
|
36
|
-
subTitleField
|
|
36
|
+
subTitleField?:string
|
|
37
37
|
withFilter?:boolean
|
|
38
38
|
}>(),{
|
|
39
39
|
idField:'_id'
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
:readonly="readonly"
|
|
7
7
|
v-model="modelValue"
|
|
8
8
|
:placeholder="placeholder"
|
|
9
|
-
:
|
|
9
|
+
:pt="pt"
|
|
10
|
+
:class=" !pt ? 'flex-1 w-full rounded-lg '+ ( props.readonly?'':'dark:!bg-gray-700 rounded-tr-none rounded-br-none') : ''"
|
|
10
11
|
/>
|
|
11
12
|
<span class="" v-if="!readonly">
|
|
12
13
|
<button type="button" @click="toggle" tabindex="-1"
|
|
@@ -39,6 +40,7 @@ import {DocNoFormat} from "~/types"
|
|
|
39
40
|
const props = defineProps<{
|
|
40
41
|
setting:any
|
|
41
42
|
readonly?:boolean
|
|
43
|
+
pt?:any
|
|
42
44
|
}>()
|
|
43
45
|
const op = ref();
|
|
44
46
|
const placeholder = ref('')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="schema" class="flex flex-col">
|
|
3
3
|
<div v-if="hidelabel"></div>
|
|
4
|
-
<label v-else-if="error" class="text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
-
<label v-else :for="uuid" class="whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
4
|
+
<label v-else-if="error" class="simpleapp-input-label text-danger-600 overflow-hidden" :for="uuid">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
5
|
+
<label v-else :for="uuid" class="simpleapp-input-label whitespace-nowrap text-gray-500 truncate">{{ fieldlabel }} <span v-if="props.setting.isrequired && fieldlabel" class="text-danger-600">*</span></label>
|
|
6
6
|
|
|
7
7
|
<!-- <div :uuid="uuid" >{{ modelValue }}</div> -->
|
|
8
8
|
<!-- <div v-if="typeof modelValue =='object' && typeof modelValue['_id']!='undefined' && typeof modelValue['label']!='undefined' && readonly ==true " :uuid="uuid" class="simpleapp-value-readonly">{{ modelValue['label'] }}</div> -->
|
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<SimpleAppFieldContainer :hidelabel="hidelabel" v-model="modelValue"
|
|
3
|
-
:label="label" :description="description"
|
|
3
|
+
:label="label" :description="description" :pt="pt"
|
|
4
4
|
:setting="setting" :instancepath="instancepath" :error="error" #default="slotprops">
|
|
5
5
|
<!-- binary input -->
|
|
6
6
|
<component :is="inputComponent" :readonly="isReadonly" :pt="pt"
|
|
7
7
|
v-if="[SimpleAppInputType.checkbox,SimpleAppInputType.switch ].includes(inputType)"
|
|
8
8
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
9
|
-
v-model="modelValue" :binary="true"
|
|
9
|
+
v-model="modelValue" :binary="true"
|
|
10
|
+
v-bind="componentProps"/>
|
|
10
11
|
|
|
11
12
|
<!-- date component -->
|
|
12
13
|
<component :is="inputComponent" type="date" :pt="pt"
|
|
13
14
|
v-else-if="inputType == SimpleAppInputType.date"
|
|
14
15
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
15
|
-
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
|
|
16
|
+
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
|
|
17
|
+
v-bind="componentProps"/>
|
|
16
18
|
<!-- calendar component -->
|
|
17
|
-
<component :is="inputComponent" type="date" :pt="pt" class="flex flex-col"
|
|
19
|
+
<component :is="inputComponent" type="date" :pt="pt" :class="'flex flex-col yyy-'+modelValue+ ' xxx-'+datevalue"
|
|
18
20
|
v-else-if="SimpleAppInputType.calendar==inputType"
|
|
19
21
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
20
|
-
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
|
|
21
|
-
|
|
22
|
+
v-model="datevalue" @update:modelValue="updateDate" :readonly="isReadonly"
|
|
23
|
+
v-bind="componentProps"/>
|
|
24
|
+
<!-- time component -->
|
|
25
|
+
<component :is="inputComponent" :pt="pt"
|
|
26
|
+
v-else-if="inputType == SimpleAppInputType.time"
|
|
27
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
28
|
+
v-model="modelValue" :readonly="isReadonly"
|
|
29
|
+
v-bind="componentProps"/>
|
|
22
30
|
<!-- select/list component -->
|
|
23
31
|
<component :is="inputComponent" v-model="modelValue" :pt="pt"
|
|
24
32
|
v-else-if="[SimpleAppInputType.select,SimpleAppInputType.list].includes(inputType)"
|
|
25
33
|
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
26
34
|
:readonly="isReadonly"
|
|
35
|
+
class="w w-full lg:w-full"
|
|
27
36
|
:disabled="isReadonly"
|
|
28
|
-
:options="getListOptions()" optionLabel="label" optionValue="value"
|
|
37
|
+
:options="getListOptions()" optionLabel="label" optionValue="value"
|
|
38
|
+
v-bind="componentProps"/>
|
|
29
39
|
|
|
30
40
|
<!-- radio component -->
|
|
31
41
|
<div v-else-if="inputType == SimpleAppInputType.radio" >
|
|
@@ -46,15 +56,16 @@
|
|
|
46
56
|
:disabled="isReadonly"
|
|
47
57
|
:inputId="slotprops.uuid"
|
|
48
58
|
:path="setting.instancepath"
|
|
49
|
-
:readonly="isReadonly"
|
|
59
|
+
:readonly="isReadonly"
|
|
50
60
|
/>
|
|
51
|
-
|
|
61
|
+
<!-- v-bind:attributes="componentProps" -->
|
|
52
62
|
<!-- document no input-->
|
|
53
63
|
<SimpleAppDocumentNo v-else-if="inputType == SimpleAppInputType.documentno"
|
|
54
64
|
:setting="setting" v-model="modelValue" :inputId="slotprops.uuid"
|
|
55
65
|
:readonly="isReadonly" @update:docNoFormat="triggerDocNoFormatChange"
|
|
56
66
|
:pt="pt"
|
|
57
|
-
:path="setting.instancepath"
|
|
67
|
+
:path="setting.instancepath"
|
|
68
|
+
v-bind:attributes="componentProps"/>
|
|
58
69
|
|
|
59
70
|
|
|
60
71
|
<!-- password -->
|
|
@@ -62,35 +73,44 @@
|
|
|
62
73
|
v-else-if="inputType == SimpleAppInputType.password"
|
|
63
74
|
:type="type" v-model="modelValue" :pt="pt"
|
|
64
75
|
:readonly="isReadonly" class="flex flex-col"
|
|
65
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
76
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
77
|
+
v-bind="componentProps"/>
|
|
66
78
|
|
|
67
79
|
<!-- rating -->
|
|
68
|
-
<
|
|
69
|
-
|
|
80
|
+
<component v-else-if="inputType == SimpleAppInputType.rating"
|
|
81
|
+
:type="type" v-model="modelValue" :pt="pt"
|
|
70
82
|
:readonly="isReadonly"
|
|
71
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
83
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
84
|
+
v-bind="componentProps"/>
|
|
72
85
|
|
|
73
86
|
<!-- chip -->
|
|
74
87
|
<component v-else-if="inputType == SimpleAppInputType.chip"
|
|
75
88
|
:is="inputComponent" :type="type" v-model="modelValue"
|
|
76
89
|
:pt="pt"
|
|
77
90
|
:disabled="isReadonly"
|
|
78
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
91
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
92
|
+
v-bind="componentProps"
|
|
93
|
+
/>
|
|
79
94
|
<!-- simple component -->
|
|
80
95
|
<InputNumber v-else-if="inputType == SimpleAppInputType.number"
|
|
81
96
|
:type="type" v-model="modelValue"
|
|
82
97
|
:readonly="isReadonly"
|
|
83
98
|
:pt="pt"
|
|
84
|
-
class="w-full flex flex-col"
|
|
85
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
99
|
+
:class="!pt ? 'w-full flex flex-col' :''"
|
|
100
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
101
|
+
v-bind="componentProps"
|
|
102
|
+
/>
|
|
86
103
|
|
|
87
104
|
<component v-else
|
|
88
105
|
v-model="modelValue"
|
|
89
|
-
|
|
106
|
+
:is="inputComponent"
|
|
90
107
|
:readonly="isReadonly"
|
|
91
108
|
:pt="pt"
|
|
109
|
+
:type="type"
|
|
92
110
|
class="w-full flex flex-col"
|
|
93
|
-
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
111
|
+
:inputId="slotprops.uuid" :path="setting.instancepath"
|
|
112
|
+
v-bind="componentProps"
|
|
113
|
+
/>
|
|
94
114
|
|
|
95
115
|
|
|
96
116
|
<!-- component require special treatment -->
|
|
@@ -100,23 +120,23 @@
|
|
|
100
120
|
|
|
101
121
|
<script lang="ts" setup>
|
|
102
122
|
import moment from 'moment'
|
|
103
|
-
import AutoComplete from 'primevue/autocomplete';
|
|
104
|
-
import Calendar from 'primevue/calendar';
|
|
105
|
-
import Checkbox from 'primevue/checkbox';
|
|
106
|
-
import Chips from 'primevue/chips';
|
|
123
|
+
import AutoComplete,{ AutoCompleteProps } from 'primevue/autocomplete';
|
|
124
|
+
import Calendar,{ CalendarProps } from 'primevue/calendar';
|
|
125
|
+
import Checkbox,{ CheckboxProps } from 'primevue/checkbox';
|
|
126
|
+
import Chips,{ ChipsProps } from 'primevue/chips';
|
|
107
127
|
import SimpleAppDocumentNo from './SimpleAppDocumentNo.vue';
|
|
108
128
|
import SimpleAppAutocomplete from './SimpleAppAutocomplete.vue'
|
|
109
|
-
import Dropdown from 'primevue/dropdown';
|
|
110
|
-
import InputNumber from 'primevue/inputnumber';
|
|
111
|
-
import InputSwitch from 'primevue/inputswitch';
|
|
112
|
-
import InputText from 'primevue/inputtext';
|
|
113
|
-
import Listbox from 'primevue/listbox';
|
|
114
|
-
import MultiSelect from 'primevue/multiselect';
|
|
115
|
-
import Password from 'primevue/password';
|
|
116
|
-
import RadioButton from 'primevue/radiobutton';
|
|
117
|
-
import Rating from 'primevue/rating';
|
|
118
|
-
import Slider from 'primevue/slider';
|
|
119
|
-
import Textarea from 'primevue/textarea';
|
|
129
|
+
import Dropdown,{ DropdownProps } from 'primevue/dropdown';
|
|
130
|
+
import InputNumber, { InputNumberProps } from 'primevue/inputnumber';
|
|
131
|
+
import InputSwitch, { InputSwitchProps } from 'primevue/inputswitch';
|
|
132
|
+
import InputText, { InputTextProps } from 'primevue/inputtext';
|
|
133
|
+
import Listbox,{ ListboxProps } from 'primevue/listbox';
|
|
134
|
+
import MultiSelect,{ MultiSelectProps } from 'primevue/multiselect';
|
|
135
|
+
import Password,{ PasswordProps } from 'primevue/password';
|
|
136
|
+
import RadioButton,{ RadioButtonProps } from 'primevue/radiobutton';
|
|
137
|
+
import Rating,{ RatingProps } from 'primevue/rating';
|
|
138
|
+
import Slider,{ SliderProps } from 'primevue/slider';
|
|
139
|
+
import Textarea, { TextareaProps } from 'primevue/textarea';
|
|
120
140
|
import {SimpleAppInputType} from '~/types'
|
|
121
141
|
|
|
122
142
|
|
|
@@ -125,6 +145,12 @@ let inputComponent :Component
|
|
|
125
145
|
|
|
126
146
|
const datevalue = ref('')
|
|
127
147
|
const modelValue = defineModel()
|
|
148
|
+
|
|
149
|
+
if(modelValue.value){
|
|
150
|
+
datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
|
|
151
|
+
}else{
|
|
152
|
+
datevalue.value = ''
|
|
153
|
+
}
|
|
128
154
|
const props = withDefaults( defineProps<{
|
|
129
155
|
inputType:SimpleAppInputType,
|
|
130
156
|
label?:string,
|
|
@@ -135,7 +161,9 @@ const props = withDefaults( defineProps<{
|
|
|
135
161
|
instancepath?:string,
|
|
136
162
|
hidelabel?: boolean
|
|
137
163
|
readonly?: boolean
|
|
138
|
-
pt?:any
|
|
164
|
+
pt?:any,
|
|
165
|
+
componentProps?: InputNumberProps | InputSwitchProps | InputTextProps | TextareaProps | DropdownProps | CalendarProps | RatingProps
|
|
166
|
+
|
|
139
167
|
}>(),{type:'text'})
|
|
140
168
|
|
|
141
169
|
|
|
@@ -152,6 +180,9 @@ switch(props.inputType){
|
|
|
152
180
|
case SimpleAppInputType.date:
|
|
153
181
|
inputComponent = InputText
|
|
154
182
|
break;
|
|
183
|
+
case SimpleAppInputType.time:
|
|
184
|
+
inputComponent = InputText
|
|
185
|
+
break;
|
|
155
186
|
case SimpleAppInputType.calendar:
|
|
156
187
|
inputComponent = Calendar
|
|
157
188
|
break;
|
|
@@ -208,7 +239,13 @@ const isReadonly = computed(()=>{
|
|
|
208
239
|
})
|
|
209
240
|
|
|
210
241
|
const updateDate = (value:any)=>{
|
|
211
|
-
|
|
242
|
+
|
|
243
|
+
if(value){
|
|
244
|
+
modelValue.value = moment(value).format('YYYY-MM-DD')
|
|
245
|
+
}else{
|
|
246
|
+
modelValue.value=''
|
|
247
|
+
}
|
|
248
|
+
|
|
212
249
|
}
|
|
213
250
|
|
|
214
251
|
|
|
@@ -232,7 +269,12 @@ const emits = defineEmits(['change','update:modelValue','update:docNoFormat'])
|
|
|
232
269
|
watch(modelValue ,(newvalue:any)=>{
|
|
233
270
|
|
|
234
271
|
if([SimpleAppInputType.date,SimpleAppInputType.calendar].includes(props.inputType)){
|
|
235
|
-
|
|
272
|
+
if(modelValue.value){
|
|
273
|
+
datevalue.value = moment(modelValue.value as string ).format('YYYY-MM-DD')
|
|
274
|
+
}else{
|
|
275
|
+
datevalue.value = ''
|
|
276
|
+
}
|
|
277
|
+
|
|
236
278
|
}
|
|
237
279
|
// else if(props.inputType==SimpleAppInputType.autocomplete){
|
|
238
280
|
// modelValue.value=autocompleteitem.value
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
class="simpleapp-datatable p-datatable-sm" :value="modelValue">
|
|
4
4
|
<template #empty> <div class="text-center">No record found.</div> </template>
|
|
5
5
|
<template #header >
|
|
6
|
-
<div>
|
|
7
|
-
<Button icon="pi pi-plus" @click="addNew()" class="simpleapp-datatable-add btn-primary" type="button">Add</Button>
|
|
6
|
+
<div>
|
|
7
|
+
<Button v-if="!setting.readonly" icon="pi pi-plus" @click="addNew()" class="simpleapp-datatable-add btn-primary" type="button">Add</Button>
|
|
8
8
|
</div>
|
|
9
9
|
</template>
|
|
10
10
|
<slot>
|
|
@@ -16,32 +16,26 @@ const getAxiosConfig = () => {
|
|
|
16
16
|
};
|
|
17
17
|
return config
|
|
18
18
|
}
|
|
19
|
-
export const getDocumentApi = (
|
|
19
|
+
export const getDocumentApi = (documentName: string): any => {
|
|
20
20
|
//const { csrf } = useCsrf()
|
|
21
21
|
//axios.defaults.headers.common = {"CSRF-TOKEN": csrf};
|
|
22
22
|
const route = useRoute();
|
|
23
23
|
|
|
24
24
|
const config = getAxiosConfig()
|
|
25
25
|
const docsOpenapi: any = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'category': new o.CATApi(config),
|
|
34
|
-
'customer': new o.CUSTApi(config),
|
|
35
|
-
'invoice': new o.INVApi(config),
|
|
36
|
-
'product': new o.PRDApi(config),
|
|
37
|
-
};
|
|
38
|
-
if (!docsOpenapi[apiname]) {
|
|
26
|
+
<%for(let i=0; i<it.modules.length;i++){ %>
|
|
27
|
+
<% const d = it.modules[i] %>
|
|
28
|
+
'<%= d['docname'].toLowerCase() %>': new o.<%= d['doctype'].toUpperCase() %>Api(config),
|
|
29
|
+
|
|
30
|
+
<%}%>
|
|
31
|
+
};
|
|
32
|
+
if (!docsOpenapi[documentName]) {
|
|
39
33
|
console.error(
|
|
40
|
-
`api for '${
|
|
34
|
+
`api for '${documentName}' does not exists, most probably define wrong x-foreignkey`,
|
|
41
35
|
);
|
|
42
36
|
return undefined;
|
|
43
37
|
} else {
|
|
44
|
-
return docsOpenapi[
|
|
38
|
+
return docsOpenapi[documentName];
|
|
45
39
|
}
|
|
46
40
|
};
|
|
47
41
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import plugin from 'primevue/config';
|
|
2
2
|
import {Md5} from 'ts-md5'
|
|
3
|
-
|
|
3
|
+
import moment from "moment";
|
|
4
4
|
export const camelCaseToWords = (s: string) =>{
|
|
5
5
|
const result = s.replace(/([A-Z])/g, ' $1');
|
|
6
6
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
@@ -16,5 +16,5 @@ export const getAvatarLink = (email:string, size:number):string=>{
|
|
|
16
16
|
|
|
17
17
|
export const toLocalDate = (dateiso8601:string)=> new Date(String(dateiso8601)).toLocaleDateString()
|
|
18
18
|
export const t = (txt:string,options?:any):string => useNuxtApp().$i18n.t(txt,options)
|
|
19
|
-
|
|
19
|
+
export const today = () => moment().format('YYYY-MM-DD')
|
|
20
20
|
|
|
@@ -46,7 +46,7 @@ export class SimpleAppClient<
|
|
|
46
46
|
getDocType = () => this.doctype;
|
|
47
47
|
getDocName = () => this.docname;
|
|
48
48
|
setNew = ()=>{}
|
|
49
|
-
isNew = () => this.data.value
|
|
49
|
+
isNew = () => this.data.value?.created==''
|
|
50
50
|
setSchema = (schema: SchemaType) => (this.schema = schema);
|
|
51
51
|
getSchema = ():SchemaType=> this.schema;
|
|
52
52
|
getErrors = () => this.errorlist;
|
|
@@ -135,8 +135,7 @@ export class SimpleAppClient<
|
|
|
135
135
|
status:NotificationStatus.success,
|
|
136
136
|
data:errors
|
|
137
137
|
})
|
|
138
|
-
this.data.value = res.data
|
|
139
|
-
console.log("save ok ", this.data.value)
|
|
138
|
+
this.data.value = res.data
|
|
140
139
|
return res.data;
|
|
141
140
|
}).catch((errors:any)=>{
|
|
142
141
|
$event('Notification',{
|
|
@@ -21,6 +21,16 @@ const allroles:roletype[] = [
|
|
|
21
21
|
{resource: '<%=m.docname%>', action:'<%=api.action%>'},
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
<%}%>
|
|
25
|
+
<%}%>
|
|
26
|
+
|
|
27
|
+
<% if(m.schema['x-simpleapp-config']['allStatus'] && m.schema['x-simpleapp-config']['allStatus'].length >0) {%>
|
|
28
|
+
<%let allstatus = m.schema['x-simpleapp-config']['allStatus']%>
|
|
29
|
+
<% for(let j=0;j<allstatus.length; j++){ %>
|
|
30
|
+
<%let setting = allstatus[j]%>
|
|
31
|
+
{resource: '<%=m.docname%>', action:'<%=setting.status%>'},
|
|
32
|
+
|
|
33
|
+
|
|
24
34
|
<%}%>
|
|
25
35
|
<%}%>
|
|
26
36
|
<%}%>
|