@steedos-labs/plugin-workflow 3.0.0-beta.10 → 3.0.0-beta.12
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/main/default/manager/push_manager.js +1 -1
- package/main/default/objects/categories.object.yml +1 -0
- package/main/default/objects/flows/flows.object.yml +1 -0
- package/main/default/routes/am.router.js +43 -1
- package/main/default/triggers/amis_form_design.trigger.js +1 -0
- package/main/default/utils/designerManager.js +2 -2
- package/package.json +1 -1
|
@@ -437,7 +437,7 @@ pushManager.get_badge = async function (send_from, user_id) {
|
|
|
437
437
|
if (((ref4 = appKeyValue.value) != null ? ref4[appName] : void 0) !== categoryBadge) {
|
|
438
438
|
_set = {};
|
|
439
439
|
_set['value.' + appName] = categoryBadge;
|
|
440
|
-
await getObject('steedos_keyvalues').update(appKeyValue._id,
|
|
440
|
+
await getObject('steedos_keyvalues').update(appKeyValue._id, _set)
|
|
441
441
|
continue;
|
|
442
442
|
}
|
|
443
443
|
} else {
|
|
@@ -3,6 +3,7 @@ const objectql = require("@steedos/objectql");
|
|
|
3
3
|
const _ = require('underscore');
|
|
4
4
|
const bodyParser = require('body-parser');
|
|
5
5
|
const steedosI18n = require("@steedos/i18n");
|
|
6
|
+
const lodash = require('lodash');
|
|
6
7
|
const { _makeNewID, getCollection } = require('../utils/collection');
|
|
7
8
|
|
|
8
9
|
const designerManager = require('../utils/designerManager');
|
|
@@ -151,11 +152,52 @@ router.post('/am/forms', async function (req, res) {
|
|
|
151
152
|
modified_by: userId,
|
|
152
153
|
fields: form["current"]["fields"]
|
|
153
154
|
};
|
|
155
|
+
let amis_schema = null;
|
|
154
156
|
if (objectName) {
|
|
155
157
|
current.fields = Object.values(formFields).concat(tables);
|
|
158
|
+
amis_schema = {
|
|
159
|
+
type: "form",
|
|
160
|
+
id: "instanceForm",
|
|
161
|
+
name: "instanceForm",
|
|
162
|
+
body: [],
|
|
163
|
+
"actions": [],
|
|
164
|
+
"wrapWithPanel": false
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const getFieldEditTpl = async (field) => {
|
|
168
|
+
if(field.steedos_field){
|
|
169
|
+
const config = field.steedos_field;
|
|
170
|
+
if(config.type === 'formula' || config.type === 'summary'){
|
|
171
|
+
if(config.data_type == 'boolean'){
|
|
172
|
+
config.type = "checkbox"
|
|
173
|
+
}else if(config.data_type == 'number' || config.data_type == 'currency' ){
|
|
174
|
+
config.type = 'number'
|
|
175
|
+
}else if(config.data_type == 'percent'){
|
|
176
|
+
config.type = "number"
|
|
177
|
+
}else {
|
|
178
|
+
config.type = config.data_type
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
type: `sfield-${lodash.toLower(lodash.camelCase(field.steedos_field.type))}`,
|
|
183
|
+
config: config
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (current.fields) {
|
|
189
|
+
for (let i = 0; i < current.fields.length; i++) {
|
|
190
|
+
const temp = await getFieldEditTpl(current.fields[i]);
|
|
191
|
+
if (temp) {
|
|
192
|
+
amis_schema.body.push(temp);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
156
196
|
}
|
|
157
197
|
newForm.current = current;
|
|
158
198
|
newForm.historys = [];
|
|
199
|
+
newForm.amis_schema = amis_schema ? JSON.stringify(amis_schema) : amis_schema
|
|
200
|
+
newForm.current.amis_schema = newForm.amis_schema;
|
|
159
201
|
await objectql.getObject('forms').insert(newForm);
|
|
160
202
|
const insertedForm = await formCollection.findOne({_id: newForm._id})
|
|
161
203
|
insertedForms.push(insertedForm);
|
|
@@ -181,7 +223,7 @@ router.post('/am/forms', async function (req, res) {
|
|
|
181
223
|
name: form["name"],
|
|
182
224
|
app: form["app"],
|
|
183
225
|
category: form["category"],
|
|
184
|
-
enable_amisform:
|
|
226
|
+
enable_amisform: false
|
|
185
227
|
}
|
|
186
228
|
if (companyId) {
|
|
187
229
|
flow.company_id = companyId;
|
|
@@ -134,7 +134,7 @@ async function updateForm(formId, form, forms, flows, currentUserId) {
|
|
|
134
134
|
let insCount = await instancesCollection.countDocuments({
|
|
135
135
|
space: spaceId,
|
|
136
136
|
form: formId,
|
|
137
|
-
|
|
137
|
+
form_version: form['current']['id'] || form['current']['_id']
|
|
138
138
|
});
|
|
139
139
|
if (insCount > 0) {
|
|
140
140
|
pass = true;
|
|
@@ -144,7 +144,7 @@ async function updateForm(formId, form, forms, flows, currentUserId) {
|
|
|
144
144
|
let recordsCount = await recordsCollection.countDocuments({
|
|
145
145
|
space: spaceId,
|
|
146
146
|
form: formId,
|
|
147
|
-
|
|
147
|
+
form_version: form['current']['id'] || form['current']['_id']
|
|
148
148
|
});
|
|
149
149
|
if (recordsCount > 0) {
|
|
150
150
|
pass = true;
|