@steedos-widgets/amis-object 1.1.0-beta.2 → 1.1.1
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/amis/AmisInstanceDetail.d.ts +34 -45
- package/dist/amis/AmisSelectFlow.d.ts +1 -85
- package/dist/amis-object.cjs.css +3 -0
- package/dist/amis-object.cjs.js +270 -252
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +270 -252
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +270 -252
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +10 -10
- package/dist/meta.js +3 -0
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -1408,17 +1408,10 @@ async function getSource$1(field, ctx) {
|
|
|
1408
1408
|
data.$value = `$${valueField}`;
|
|
1409
1409
|
// data["&"] = "$$";
|
|
1410
1410
|
|
|
1411
|
-
const fieldValue = ctx.value;
|
|
1412
|
-
|
|
1413
1411
|
const requestAdaptor = `
|
|
1414
1412
|
var filters = [['parent', '=', null]];
|
|
1415
1413
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
1416
1414
|
var defaultValue = api.data.$value;
|
|
1417
|
-
var fieldValue = ${JSON.stringify(fieldValue)};
|
|
1418
|
-
if(!defaultValue && fieldValue){
|
|
1419
|
-
// 如果表单中没有字段值,则认字段上配置的value属性
|
|
1420
|
-
defaultValue = fieldValue;
|
|
1421
|
-
}
|
|
1422
1415
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
1423
1416
|
var optionsFilters = [["user", optionsFiltersOp, []]];
|
|
1424
1417
|
if (defaultValue) {
|
|
@@ -4307,6 +4300,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
4307
4300
|
`;
|
|
4308
4301
|
source.adaptor = `
|
|
4309
4302
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
4303
|
+
const value = api.data.$self.value;
|
|
4304
|
+
if(!_.isEmpty(value)){
|
|
4305
|
+
// value 不为空值,表示返回当前选中节点信息
|
|
4306
|
+
return payload;
|
|
4307
|
+
}
|
|
4310
4308
|
if(enable_tree){
|
|
4311
4309
|
const records = payload.data.rows;
|
|
4312
4310
|
const treeRecords = [];
|
|
@@ -4611,21 +4609,20 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
4611
4609
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
4612
4610
|
}
|
|
4613
4611
|
|
|
4614
|
-
if(ctx.ids || ctx.idsTrackOn){
|
|
4615
|
-
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4616
|
-
}
|
|
4617
|
-
|
|
4618
4612
|
let referenceTo = await getReferenceTo(field);
|
|
4619
4613
|
if(!referenceTo){
|
|
4620
4614
|
return await lookupToAmisSelect(field, readonly, ctx);
|
|
4621
4615
|
}
|
|
4622
4616
|
|
|
4623
|
-
const refObject = await getUISchema(referenceTo.objectName);
|
|
4624
|
-
|
|
4625
4617
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
4618
|
+
if(ctx.idsDependOn || field.amis){
|
|
4619
|
+
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4620
|
+
}
|
|
4626
4621
|
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4627
4622
|
}
|
|
4628
4623
|
|
|
4624
|
+
const refObject = await getUISchema(referenceTo.objectName);
|
|
4625
|
+
|
|
4629
4626
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
4630
4627
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
4631
4628
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
@@ -4660,7 +4657,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4660
4657
|
}
|
|
4661
4658
|
const refObjectConfig = await getUISchema(referenceTo.objectName);
|
|
4662
4659
|
|
|
4663
|
-
const {
|
|
4660
|
+
const { idsDependOn } = ctx;
|
|
4664
4661
|
|
|
4665
4662
|
const fields = {
|
|
4666
4663
|
[referenceTo.labelField.name]: referenceTo.labelField,
|
|
@@ -4674,14 +4671,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4674
4671
|
source.data.$term = "$term";
|
|
4675
4672
|
source.data.$self = "$$";
|
|
4676
4673
|
|
|
4677
|
-
if(
|
|
4678
|
-
source.sendOn =
|
|
4679
|
-
|
|
4680
|
-
else {
|
|
4681
|
-
source.sendOn = false;
|
|
4682
|
-
}
|
|
4683
|
-
if(idsTrackOn){
|
|
4684
|
-
source.sendOn = `\${${idsTrackOn} && ${idsTrackOn}.length}`;
|
|
4674
|
+
if(idsDependOn && source.url){
|
|
4675
|
+
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
4676
|
+
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
4685
4677
|
}
|
|
4686
4678
|
|
|
4687
4679
|
source.requestAdaptor = `
|
|
@@ -4698,10 +4690,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4698
4690
|
}
|
|
4699
4691
|
}
|
|
4700
4692
|
|
|
4701
|
-
var ids
|
|
4702
|
-
var
|
|
4703
|
-
if(
|
|
4704
|
-
ids = api.data.$self[
|
|
4693
|
+
var ids;
|
|
4694
|
+
var idsDependOn = "${idsDependOn}";
|
|
4695
|
+
if(idsDependOn){
|
|
4696
|
+
ids = api.data.$self[idsDependOn];
|
|
4705
4697
|
}
|
|
4706
4698
|
if(ids && ids.length){
|
|
4707
4699
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
@@ -6980,7 +6972,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6980
6972
|
const searchableFields = [];
|
|
6981
6973
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6982
6974
|
|
|
6983
|
-
if(!top){
|
|
6975
|
+
if (!top) {
|
|
6984
6976
|
// 日历请求不翻页
|
|
6985
6977
|
top = 200;
|
|
6986
6978
|
}
|
|
@@ -7106,7 +7098,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
7106
7098
|
title: n["${calendarOptions.textExpr}"],
|
|
7107
7099
|
start: n["${calendarOptions.startDateExpr}"],
|
|
7108
7100
|
end: n["${calendarOptions.endDateExpr}"],
|
|
7109
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
7101
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
7102
|
+
extendedProps: n
|
|
7110
7103
|
}
|
|
7111
7104
|
});
|
|
7112
7105
|
const successCallback = selfData.successCallback;
|
|
@@ -7179,7 +7172,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
7179
7172
|
return payload;
|
|
7180
7173
|
`,
|
|
7181
7174
|
headers: {
|
|
7182
|
-
|
|
7175
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
7183
7176
|
}
|
|
7184
7177
|
};
|
|
7185
7178
|
}
|
|
@@ -7198,9 +7191,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7198
7191
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
|
|
7199
7192
|
|
|
7200
7193
|
const titleFields = calendarOptions.title || [
|
|
7201
|
-
calendarOptions.startDateExpr,
|
|
7202
|
-
calendarOptions.endDateExpr,
|
|
7203
|
-
calendarOptions.allDayExpr,
|
|
7194
|
+
calendarOptions.startDateExpr,
|
|
7195
|
+
calendarOptions.endDateExpr,
|
|
7196
|
+
calendarOptions.allDayExpr,
|
|
7204
7197
|
calendarOptions.textExpr
|
|
7205
7198
|
];
|
|
7206
7199
|
let fields = [];
|
|
@@ -7224,9 +7217,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7224
7217
|
}
|
|
7225
7218
|
}
|
|
7226
7219
|
let initialView = calendarOptions.currentView;
|
|
7227
|
-
if(initialView){
|
|
7220
|
+
if (initialView) {
|
|
7228
7221
|
// day, week, month, agenda
|
|
7229
|
-
switch(initialView){
|
|
7222
|
+
switch (initialView) {
|
|
7230
7223
|
case "day":
|
|
7231
7224
|
initialView = "timeGridDay";
|
|
7232
7225
|
break;
|
|
@@ -7237,7 +7230,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7237
7230
|
initialView = "dayGridMonth";
|
|
7238
7231
|
break;
|
|
7239
7232
|
case "agenda":
|
|
7240
|
-
initialView = "
|
|
7233
|
+
initialView = "listWeek";
|
|
7241
7234
|
break;
|
|
7242
7235
|
}
|
|
7243
7236
|
}
|
|
@@ -7333,19 +7326,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7333
7326
|
const recordId = "${event.id}";
|
|
7334
7327
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
7335
7328
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
7336
|
-
|
|
7329
|
+
|
|
7337
7330
|
const businessHours = {
|
|
7338
|
-
daysOfWeek: [
|
|
7331
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
7339
7332
|
startTime: '08:00',
|
|
7340
7333
|
endTime: '18:00',
|
|
7341
7334
|
};
|
|
7342
|
-
if(!isEmpty(calendarOptions.startDayHour)){
|
|
7335
|
+
if (!isEmpty(calendarOptions.startDayHour)) {
|
|
7343
7336
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
7344
7337
|
}
|
|
7345
|
-
if(!isEmpty(calendarOptions.endDayHour)){
|
|
7338
|
+
if (!isEmpty(calendarOptions.endDayHour)) {
|
|
7346
7339
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
7347
7340
|
}
|
|
7348
|
-
|
|
7341
|
+
|
|
7342
|
+
const onEvent = {
|
|
7343
|
+
"getEvents": {
|
|
7344
|
+
"weight": 0,
|
|
7345
|
+
"actions": [
|
|
7346
|
+
{
|
|
7347
|
+
"componentId": "",
|
|
7348
|
+
"args": {
|
|
7349
|
+
},
|
|
7350
|
+
"actionType": "custom",
|
|
7351
|
+
"script": onGetEventsScript
|
|
7352
|
+
}
|
|
7353
|
+
]
|
|
7354
|
+
},
|
|
7355
|
+
"select": {
|
|
7356
|
+
"weight": 0,
|
|
7357
|
+
"actions": [
|
|
7358
|
+
{
|
|
7359
|
+
"componentId": "",
|
|
7360
|
+
"args": {
|
|
7361
|
+
},
|
|
7362
|
+
"actionType": "custom",
|
|
7363
|
+
"script": onSelectScript
|
|
7364
|
+
}
|
|
7365
|
+
]
|
|
7366
|
+
},
|
|
7367
|
+
"eventClick": {
|
|
7368
|
+
"weight": 0,
|
|
7369
|
+
"actions": [
|
|
7370
|
+
{
|
|
7371
|
+
"componentId": "",
|
|
7372
|
+
"args": {
|
|
7373
|
+
},
|
|
7374
|
+
"actionType": "custom",
|
|
7375
|
+
"script": onEventClickScript
|
|
7376
|
+
}
|
|
7377
|
+
]
|
|
7378
|
+
},
|
|
7379
|
+
"eventAdd": {
|
|
7380
|
+
"weight": 0,
|
|
7381
|
+
"actions": [
|
|
7382
|
+
{
|
|
7383
|
+
"componentId": "",
|
|
7384
|
+
"args": {
|
|
7385
|
+
},
|
|
7386
|
+
"actionType": "custom",
|
|
7387
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7388
|
+
}
|
|
7389
|
+
]
|
|
7390
|
+
},
|
|
7391
|
+
"eventChange": {
|
|
7392
|
+
"weight": 0,
|
|
7393
|
+
"actions": [
|
|
7394
|
+
{
|
|
7395
|
+
"actionType": 'ajax',
|
|
7396
|
+
"args": {
|
|
7397
|
+
"api": recordPermissionsApi
|
|
7398
|
+
}
|
|
7399
|
+
},
|
|
7400
|
+
{
|
|
7401
|
+
"actionType": "toast",
|
|
7402
|
+
"expression": "!event.data.editable",
|
|
7403
|
+
"args": {
|
|
7404
|
+
"msgType": "error",
|
|
7405
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7406
|
+
"position": "top-center"
|
|
7407
|
+
}
|
|
7408
|
+
},
|
|
7409
|
+
{
|
|
7410
|
+
"actionType": 'ajax',
|
|
7411
|
+
"expression": "event.data.editable",
|
|
7412
|
+
"args": {
|
|
7413
|
+
"api": recordSaveApi,
|
|
7414
|
+
"messages": {
|
|
7415
|
+
"success": objectSchema.label + "修改成功",
|
|
7416
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7420
|
+
]
|
|
7421
|
+
},
|
|
7422
|
+
"eventRemove": {
|
|
7423
|
+
"weight": 0,
|
|
7424
|
+
"actions": [
|
|
7425
|
+
{
|
|
7426
|
+
"componentId": "",
|
|
7427
|
+
"args": {
|
|
7428
|
+
},
|
|
7429
|
+
"actionType": "custom",
|
|
7430
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7431
|
+
}
|
|
7432
|
+
]
|
|
7433
|
+
},
|
|
7434
|
+
"eventsSet": {
|
|
7435
|
+
"weight": 0,
|
|
7436
|
+
"actions": [
|
|
7437
|
+
{
|
|
7438
|
+
"componentId": "",
|
|
7439
|
+
"args": {
|
|
7440
|
+
},
|
|
7441
|
+
"actionType": "custom",
|
|
7442
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7443
|
+
}
|
|
7444
|
+
]
|
|
7445
|
+
}
|
|
7446
|
+
};
|
|
7447
|
+
|
|
7448
|
+
Object.assign(onEvent, options.onEvent);
|
|
7449
|
+
|
|
7450
|
+
const config = options.config || {};
|
|
7451
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7452
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7453
|
+
if(hasReturn){
|
|
7454
|
+
try {
|
|
7455
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7456
|
+
let fn = new Function("arg", config.eventContent);
|
|
7457
|
+
config.eventContent = fn;
|
|
7458
|
+
} catch (e) {
|
|
7459
|
+
console.warn(e);
|
|
7460
|
+
}
|
|
7461
|
+
}
|
|
7462
|
+
}
|
|
7463
|
+
|
|
7464
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7465
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7466
|
+
if(hasReturn){
|
|
7467
|
+
try {
|
|
7468
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7469
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7470
|
+
config.noEventsContent = fn;
|
|
7471
|
+
} catch (e) {
|
|
7472
|
+
console.warn(e);
|
|
7473
|
+
}
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7349
7477
|
const amisSchema = {
|
|
7350
7478
|
"type": "steedos-fullcalendar",
|
|
7351
7479
|
"label": "",
|
|
@@ -7355,111 +7483,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7355
7483
|
"selectMirror": permissions.allowCreate,
|
|
7356
7484
|
"initialView": initialView,
|
|
7357
7485
|
"businessHours": businessHours,
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
"weight": 0,
|
|
7361
|
-
"actions": [
|
|
7362
|
-
{
|
|
7363
|
-
"componentId": "",
|
|
7364
|
-
"args": {
|
|
7365
|
-
},
|
|
7366
|
-
"actionType": "custom",
|
|
7367
|
-
"script": onGetEventsScript
|
|
7368
|
-
}
|
|
7369
|
-
]
|
|
7370
|
-
},
|
|
7371
|
-
"select": {
|
|
7372
|
-
"weight": 0,
|
|
7373
|
-
"actions": [
|
|
7374
|
-
{
|
|
7375
|
-
"componentId": "",
|
|
7376
|
-
"args": {
|
|
7377
|
-
},
|
|
7378
|
-
"actionType": "custom",
|
|
7379
|
-
"script": onSelectScript
|
|
7380
|
-
}
|
|
7381
|
-
]
|
|
7382
|
-
},
|
|
7383
|
-
"eventClick": {
|
|
7384
|
-
"weight": 0,
|
|
7385
|
-
"actions": [
|
|
7386
|
-
{
|
|
7387
|
-
"componentId": "",
|
|
7388
|
-
"args": {
|
|
7389
|
-
},
|
|
7390
|
-
"actionType": "custom",
|
|
7391
|
-
"script": onEventClickScript
|
|
7392
|
-
}
|
|
7393
|
-
]
|
|
7394
|
-
},
|
|
7395
|
-
"eventAdd": {
|
|
7396
|
-
"weight": 0,
|
|
7397
|
-
"actions": [
|
|
7398
|
-
{
|
|
7399
|
-
"componentId": "",
|
|
7400
|
-
"args": {
|
|
7401
|
-
},
|
|
7402
|
-
"actionType": "custom",
|
|
7403
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7404
|
-
}
|
|
7405
|
-
]
|
|
7406
|
-
},
|
|
7407
|
-
"eventChange": {
|
|
7408
|
-
"weight": 0,
|
|
7409
|
-
"actions": [
|
|
7410
|
-
{
|
|
7411
|
-
"actionType": 'ajax',
|
|
7412
|
-
"args": {
|
|
7413
|
-
"api": recordPermissionsApi
|
|
7414
|
-
}
|
|
7415
|
-
},
|
|
7416
|
-
{
|
|
7417
|
-
"actionType": "toast",
|
|
7418
|
-
"expression": "!event.data.editable",
|
|
7419
|
-
"args": {
|
|
7420
|
-
"msgType": "error",
|
|
7421
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7422
|
-
"position": "top-center"
|
|
7423
|
-
}
|
|
7424
|
-
},
|
|
7425
|
-
{
|
|
7426
|
-
"actionType": 'ajax',
|
|
7427
|
-
"expression": "event.data.editable",
|
|
7428
|
-
"args": {
|
|
7429
|
-
"api": recordSaveApi,
|
|
7430
|
-
"messages": {
|
|
7431
|
-
"success": objectSchema.label + "修改成功",
|
|
7432
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7433
|
-
}
|
|
7434
|
-
}
|
|
7435
|
-
}
|
|
7436
|
-
]
|
|
7437
|
-
},
|
|
7438
|
-
"eventRemove": {
|
|
7439
|
-
"weight": 0,
|
|
7440
|
-
"actions": [
|
|
7441
|
-
{
|
|
7442
|
-
"componentId": "",
|
|
7443
|
-
"args": {
|
|
7444
|
-
},
|
|
7445
|
-
"actionType": "custom",
|
|
7446
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7447
|
-
}
|
|
7448
|
-
]
|
|
7449
|
-
},
|
|
7450
|
-
"eventsSet": {
|
|
7451
|
-
"weight": 0,
|
|
7452
|
-
"actions": [
|
|
7453
|
-
{
|
|
7454
|
-
"componentId": "",
|
|
7455
|
-
"args": {
|
|
7456
|
-
},
|
|
7457
|
-
"actionType": "custom",
|
|
7458
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7459
|
-
}
|
|
7460
|
-
]
|
|
7461
|
-
},
|
|
7462
|
-
}
|
|
7486
|
+
...config,
|
|
7487
|
+
"onEvent": onEvent
|
|
7463
7488
|
};
|
|
7464
7489
|
return amisSchema;
|
|
7465
7490
|
}
|
|
@@ -9289,7 +9314,6 @@ const getJudgeInput = async (instance) => {
|
|
|
9289
9314
|
"args": {
|
|
9290
9315
|
"value": {
|
|
9291
9316
|
new_judge: "${event.data.value}",
|
|
9292
|
-
new_next_step: undefined,
|
|
9293
9317
|
next_step: undefined,
|
|
9294
9318
|
}
|
|
9295
9319
|
},
|
|
@@ -9341,7 +9365,11 @@ const getNextStepInput = async (instance) => {
|
|
|
9341
9365
|
id: "u:next_step",
|
|
9342
9366
|
multiple: false,
|
|
9343
9367
|
required: true,
|
|
9344
|
-
selectFirst: true,
|
|
9368
|
+
// selectFirst: true,
|
|
9369
|
+
autoFill: {
|
|
9370
|
+
"new_next_step": "${step}",
|
|
9371
|
+
"next_users": null
|
|
9372
|
+
},
|
|
9345
9373
|
"source": {
|
|
9346
9374
|
"url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
|
|
9347
9375
|
"headers": {
|
|
@@ -9353,10 +9381,12 @@ const getNextStepInput = async (instance) => {
|
|
|
9353
9381
|
"requestAdaptor": "let { context, judge } = api.data; if(!judge){judge='approved'}\nconst formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\nflowVersionId: context.flowVersion._id,\n instanceId: context._id,\n flowId: context.flow._id,\n step: context.step,\n judge: judge,\n values: formValues\n}\n\n\n return api;",
|
|
9354
9382
|
"adaptor": `
|
|
9355
9383
|
payload.data = {
|
|
9384
|
+
value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
|
|
9356
9385
|
options: _.map(payload.nextSteps, (item)=>{
|
|
9357
9386
|
return {
|
|
9358
9387
|
label: item.name,
|
|
9359
|
-
value: item
|
|
9388
|
+
value: item._id,
|
|
9389
|
+
step: item
|
|
9360
9390
|
}
|
|
9361
9391
|
})
|
|
9362
9392
|
};
|
|
@@ -9369,29 +9399,29 @@ const getNextStepInput = async (instance) => {
|
|
|
9369
9399
|
"judge": "${new_judge}",
|
|
9370
9400
|
}
|
|
9371
9401
|
},
|
|
9372
|
-
"onEvent": {
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
}
|
|
9402
|
+
// "onEvent": {
|
|
9403
|
+
// "change": {
|
|
9404
|
+
// "weight": 0,
|
|
9405
|
+
// "actions": [
|
|
9406
|
+
// {
|
|
9407
|
+
// "componentId": "instance_approval",
|
|
9408
|
+
// "args": {
|
|
9409
|
+
// "value": {
|
|
9410
|
+
// new_next_step: "${event.data.value}",
|
|
9411
|
+
// }
|
|
9412
|
+
// },
|
|
9413
|
+
// "actionType": "setValue"
|
|
9414
|
+
// },
|
|
9415
|
+
// // {
|
|
9416
|
+
// // "args": {
|
|
9417
|
+
// // next_step: "${event.data.value}",
|
|
9418
|
+
// // },
|
|
9419
|
+
// // "actionType": "broadcast",
|
|
9420
|
+
// // eventName: "approve_next_step_change"
|
|
9421
|
+
// // },
|
|
9422
|
+
// ]
|
|
9423
|
+
// }
|
|
9424
|
+
// }
|
|
9395
9425
|
},
|
|
9396
9426
|
],
|
|
9397
9427
|
id: "u:4d3a884b437c",
|
|
@@ -9429,56 +9459,44 @@ const getNextStepUsersInput = async (instance) => {
|
|
|
9429
9459
|
body: [
|
|
9430
9460
|
// TODO 处理下一步处理人默认值
|
|
9431
9461
|
Object.assign({},
|
|
9432
|
-
// await lookupToAmisPicker(
|
|
9433
|
-
// {
|
|
9434
|
-
// name: "next_users",
|
|
9435
|
-
// label: false,
|
|
9436
|
-
// reference_to: "space_users",
|
|
9437
|
-
// reference_to_field: 'user',
|
|
9438
|
-
// multiple: false,
|
|
9439
|
-
// },
|
|
9440
|
-
// false,
|
|
9441
|
-
// {}
|
|
9442
|
-
// ),
|
|
9443
9462
|
{
|
|
9444
9463
|
"type": "steedos-select-user"
|
|
9445
9464
|
},
|
|
9446
|
-
|
|
9447
9465
|
{
|
|
9448
9466
|
name: "next_users",
|
|
9449
|
-
// value: "",
|
|
9450
9467
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
|
|
9451
9468
|
required: true
|
|
9452
9469
|
}),
|
|
9453
9470
|
{
|
|
9454
|
-
type: "
|
|
9471
|
+
type: "steedos-select-user",
|
|
9455
9472
|
label: "",
|
|
9456
9473
|
name: "next_users",
|
|
9457
|
-
// options: await getNextStepOptions(instance),
|
|
9458
9474
|
id: "u:next_users",
|
|
9459
9475
|
required: true,
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
"
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
"
|
|
9467
|
-
|
|
9468
|
-
|
|
9476
|
+
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
|
|
9477
|
+
amis: {
|
|
9478
|
+
multiple: "this.new_next_step.deal_type === 'counterSign'",
|
|
9479
|
+
"source": {
|
|
9480
|
+
"url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
|
|
9481
|
+
"method": "post",
|
|
9482
|
+
"sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
|
|
9483
|
+
"headers": {
|
|
9484
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
9485
|
+
},
|
|
9486
|
+
"messages": {
|
|
9487
|
+
},
|
|
9488
|
+
"requestAdaptor": "\nconst { context, next_step, $scopeId } = api.data;\nconst formValues = SteedosUI.getRef($scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
|
|
9489
|
+
"adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
|
|
9490
|
+
"data": {
|
|
9491
|
+
"&": "$$",
|
|
9492
|
+
"$scopeId": "$scopeId",
|
|
9493
|
+
"context": "${context}",
|
|
9494
|
+
"next_step": "${new_next_step}",
|
|
9495
|
+
}
|
|
9469
9496
|
},
|
|
9470
|
-
"
|
|
9471
|
-
"
|
|
9472
|
-
|
|
9473
|
-
"&": "$$",
|
|
9474
|
-
"$scopeId": "$scopeId",
|
|
9475
|
-
"context": "${context}",
|
|
9476
|
-
"next_step": "${new_next_step}",
|
|
9477
|
-
}
|
|
9478
|
-
},
|
|
9479
|
-
"labelField": "name",
|
|
9480
|
-
"valueField": "id",
|
|
9481
|
-
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'"
|
|
9497
|
+
"labelField": "name",
|
|
9498
|
+
"valueField": "id",
|
|
9499
|
+
}
|
|
9482
9500
|
}
|
|
9483
9501
|
],
|
|
9484
9502
|
id: "u:81a4913c61cc",
|
|
@@ -9680,6 +9698,10 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9680
9698
|
clearPersistDataAfterSubmit: true,
|
|
9681
9699
|
persistData: `workflow_approve_form_${instance.approve._id}`,
|
|
9682
9700
|
body: [
|
|
9701
|
+
{
|
|
9702
|
+
type: 'hidden',
|
|
9703
|
+
name: 'new_next_step'
|
|
9704
|
+
},
|
|
9683
9705
|
await getJudgeInput(instance),
|
|
9684
9706
|
{
|
|
9685
9707
|
type: "textarea",
|
|
@@ -9710,7 +9732,7 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9710
9732
|
// {
|
|
9711
9733
|
// "actionType": "reload",
|
|
9712
9734
|
// "componentId": "u:nex_users",
|
|
9713
|
-
// "args": {
|
|
9735
|
+
// "args": {
|
|
9714
9736
|
// }
|
|
9715
9737
|
// }
|
|
9716
9738
|
// ]
|
|
@@ -10021,7 +10043,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
10021
10043
|
* @Author: baozhoutao@steedos.com
|
|
10022
10044
|
* @Date: 2022-09-07 16:20:45
|
|
10023
10045
|
* @LastEditors: baozhoutao@steedos.com
|
|
10024
|
-
* @LastEditTime: 2023-03-
|
|
10046
|
+
* @LastEditTime: 2023-03-23 16:49:44
|
|
10025
10047
|
* @Description:
|
|
10026
10048
|
*/
|
|
10027
10049
|
|
|
@@ -10585,7 +10607,6 @@ const getFormTableView = async (instance) => {
|
|
|
10585
10607
|
trs: await getFormTrs(instance),
|
|
10586
10608
|
id: "u:047f3669468b",
|
|
10587
10609
|
};
|
|
10588
|
-
console.log(`getFormTableView formSchema=====>`, formSchema);
|
|
10589
10610
|
return formSchema;
|
|
10590
10611
|
};
|
|
10591
10612
|
|
|
@@ -12027,11 +12048,12 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
12027
12048
|
}); };
|
|
12028
12049
|
|
|
12029
12050
|
var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12030
|
-
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
12051
|
+
var top, sort, filters, filtersFunction, title, currentView, startDateExpr, endDateExpr, allDayExpr, textExpr, data, defaultData, _a, className, onEvent, config, objectApiName, amisSchemaData, schema, uiSchema, amisSchema, serviceData;
|
|
12031
12052
|
return __generator(this, function (_b) {
|
|
12032
12053
|
switch (_b.label) {
|
|
12033
12054
|
case 0:
|
|
12034
|
-
|
|
12055
|
+
console.log("AmisObjectCalendar props", props);
|
|
12056
|
+
props.$schema, top = props.top, sort = props.sort, filters = props.filters, filtersFunction = props.filtersFunction, title = props.title, currentView = props.currentView, startDateExpr = props.startDateExpr, endDateExpr = props.endDateExpr, allDayExpr = props.allDayExpr, textExpr = props.textExpr, data = props.data, defaultData = props.defaultData, _a = props.className, className = _a === void 0 ? "" : _a, onEvent = props.onEvent, config = props.config;
|
|
12035
12057
|
objectApiName = props.objectApiName || "events";
|
|
12036
12058
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
12037
12059
|
return [4 /*yield*/, getCalendarSchema(amisSchemaData.appId, objectApiName, {
|
|
@@ -12041,7 +12063,7 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12041
12063
|
endDateExpr: endDateExpr,
|
|
12042
12064
|
allDayExpr: allDayExpr,
|
|
12043
12065
|
textExpr: textExpr
|
|
12044
|
-
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction })];
|
|
12066
|
+
}, { top: top, sort: sort, filter: filters, filtersFunction: filtersFunction, onEvent: onEvent, config: config })];
|
|
12045
12067
|
case 1:
|
|
12046
12068
|
schema = (_b.sent());
|
|
12047
12069
|
uiSchema = schema.uiSchema;
|
|
@@ -12208,15 +12230,14 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
|
|
|
12208
12230
|
}); };
|
|
12209
12231
|
|
|
12210
12232
|
var AmisSelectUser = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12211
|
-
var $schema,
|
|
12212
|
-
return __generator(this, function (
|
|
12213
|
-
switch (
|
|
12233
|
+
var $schema, idsDependOn, _a, readonly, amis, _b, ctx, amisSchema, steedosField, options, error_1;
|
|
12234
|
+
return __generator(this, function (_c) {
|
|
12235
|
+
switch (_c.label) {
|
|
12214
12236
|
case 0:
|
|
12215
|
-
$schema = props.$schema, props.data,
|
|
12216
|
-
|
|
12217
|
-
_d.label = 1;
|
|
12237
|
+
$schema = props.$schema, props.data, idsDependOn = props.idsDependOn, _a = props.readonly, readonly = _a === void 0 ? false : _a, amis = props.amis, _b = props.ctx, ctx = _b === void 0 ? {} : _b;
|
|
12238
|
+
_c.label = 1;
|
|
12218
12239
|
case 1:
|
|
12219
|
-
|
|
12240
|
+
_c.trys.push([1, 3, , 4]);
|
|
12220
12241
|
steedosField = {
|
|
12221
12242
|
type: "lookup",
|
|
12222
12243
|
reference_to: "users",
|
|
@@ -12225,20 +12246,16 @@ var AmisSelectUser = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12225
12246
|
multiple: $schema.multiple,
|
|
12226
12247
|
required: $schema.required,
|
|
12227
12248
|
searchable: $schema.searchable,
|
|
12228
|
-
onEvent: $schema.onEvent,
|
|
12229
12249
|
filters: $schema.filters,
|
|
12230
12250
|
amis: amis
|
|
12231
12251
|
};
|
|
12232
|
-
options = Object.assign.apply(Object, __spreadArray(__spreadArray([{}], __read(ctx), false), [{
|
|
12233
|
-
if (value) {
|
|
12234
|
-
options.value = value;
|
|
12235
|
-
}
|
|
12252
|
+
options = Object.assign.apply(Object, __spreadArray(__spreadArray([{}], __read(ctx), false), [{ idsDependOn: idsDependOn }], false));
|
|
12236
12253
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, options)];
|
|
12237
12254
|
case 2:
|
|
12238
|
-
amisSchema =
|
|
12255
|
+
amisSchema = _c.sent();
|
|
12239
12256
|
return [3 /*break*/, 4];
|
|
12240
12257
|
case 3:
|
|
12241
|
-
error_1 =
|
|
12258
|
+
error_1 = _c.sent();
|
|
12242
12259
|
console.log("error", error_1);
|
|
12243
12260
|
return [3 /*break*/, 4];
|
|
12244
12261
|
case 4: return [2 /*return*/, amisSchema];
|
|
@@ -12998,28 +13015,34 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
12998
13015
|
* @Author: baozhoutao@steedos.com
|
|
12999
13016
|
* @Date: 2023-01-14 16:41:24
|
|
13000
13017
|
* @LastEditors: baozhoutao@steedos.com
|
|
13001
|
-
* @LastEditTime: 2023-
|
|
13018
|
+
* @LastEditTime: 2023-03-23 11:37:25
|
|
13002
13019
|
* @Description:
|
|
13003
13020
|
*/
|
|
13004
13021
|
var getSelectFlowSchema = function (id, props) {
|
|
13005
|
-
var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? 'query' : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? 'input-tree' : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName;
|
|
13006
|
-
return {
|
|
13007
|
-
"
|
|
13008
|
-
"
|
|
13009
|
-
"label
|
|
13010
|
-
"
|
|
13011
|
-
"
|
|
13012
|
-
"
|
|
13013
|
-
"
|
|
13014
|
-
|
|
13015
|
-
"
|
|
13016
|
-
"
|
|
13017
|
-
"
|
|
13018
|
-
"
|
|
13019
|
-
"
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13022
|
+
var label = props.label, data = props.data, name = props.name, required = props.required, _a = props.action, action = _a === void 0 ? 'query' : _a, _b = props.distributeInstanceId, distributeInstanceId = _b === void 0 ? "" : _b, _c = props.distributeStepId, distributeStepId = _c === void 0 ? "" : _c, _d = props.mode, mode = _d === void 0 ? 'input-tree' : _d, className = props.className, onEvent = props.onEvent, _e = props.multiple, multiple = _e === void 0 ? false : _e, delimiter = props.delimiter, joinValues = props.joinValues, extractValue = props.extractValue, searchable = props.searchable, _f = props.showIcon, showIcon = _f === void 0 ? true : _f, _g = props.showRadio, showRadio = _g === void 0 ? false : _g, showOutline = props.showOutline, initiallyOpen = props.initiallyOpen, unfoldedLevel = props.unfoldedLevel, treeContainerClassName = props.treeContainerClassName, _h = props.amis, amis = _h === void 0 ? {} : _h;
|
|
13023
|
+
return __assign$2({ "type": mode, "id": id, "label": label, "name": name, "options": [], "multiple": multiple, "delimiter": delimiter, "joinValues": joinValues, "extractValue": extractValue, "searchable": searchable, "showOutline": showOutline, "initiallyOpen": initiallyOpen, "unfoldedLevel": unfoldedLevel, "className": className, "required": required, "treeContainerClassName": treeContainerClassName,
|
|
13024
|
+
// "menuTpl": {
|
|
13025
|
+
// type: "tpl",
|
|
13026
|
+
// tpl: "<div class='flex justify-between'><span>${label}</span><span class='rounded p-1 text-xs text-center w-14 ${children != null ? \'hidden\' : \'\'}'><button onClick='console.log(11111)'><i class='fa-regular fa-star'></i></button></span></div>",
|
|
13027
|
+
// "onEvent": {
|
|
13028
|
+
// "click": {
|
|
13029
|
+
// "weight": 0,
|
|
13030
|
+
// "actions": [
|
|
13031
|
+
// {
|
|
13032
|
+
// "args": {
|
|
13033
|
+
// "api": {
|
|
13034
|
+
// "url": "/aaa",
|
|
13035
|
+
// "method": "get",
|
|
13036
|
+
// "messages": {
|
|
13037
|
+
// }
|
|
13038
|
+
// }
|
|
13039
|
+
// },
|
|
13040
|
+
// "actionType": "download"
|
|
13041
|
+
// }
|
|
13042
|
+
// ]
|
|
13043
|
+
// }
|
|
13044
|
+
// }
|
|
13045
|
+
// },
|
|
13023
13046
|
"source": {
|
|
13024
13047
|
"method": "post",
|
|
13025
13048
|
"url": "${context.rootUrl}/graphql?keywords=${keywords}",
|
|
@@ -13027,12 +13050,7 @@ var getSelectFlowSchema = function (id, props) {
|
|
|
13027
13050
|
"headers": {
|
|
13028
13051
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
13029
13052
|
}
|
|
13030
|
-
},
|
|
13031
|
-
"showIcon": showIcon,
|
|
13032
|
-
"showRadio": showRadio,
|
|
13033
|
-
"onlyLeaf": true,
|
|
13034
|
-
"onEvent": onEvent,
|
|
13035
|
-
};
|
|
13053
|
+
}, "showIcon": showIcon, "showRadio": showRadio, "onlyLeaf": true, "onEvent": onEvent }, amis);
|
|
13036
13054
|
};
|
|
13037
13055
|
/**
|
|
13038
13056
|
*
|