@steedos-widgets/amis-lib 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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +231 -210
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +231 -210
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +231 -210
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/calendar.d.ts +1 -129
- package/dist/types/lib/objects.d.ts +1 -129
- package/dist/types/workflow/approve.d.ts +34 -45
- package/dist/types/workflow/flow.d.ts +34 -45
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1076,17 +1076,10 @@ async function getSource$1(field, ctx) {
|
|
|
1076
1076
|
data.$value = `$${valueField}`;
|
|
1077
1077
|
// data["&"] = "$$";
|
|
1078
1078
|
|
|
1079
|
-
const fieldValue = ctx.value;
|
|
1080
|
-
|
|
1081
1079
|
const requestAdaptor = `
|
|
1082
1080
|
var filters = [['parent', '=', null]];
|
|
1083
1081
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
1084
1082
|
var defaultValue = api.data.$value;
|
|
1085
|
-
var fieldValue = ${JSON.stringify(fieldValue)};
|
|
1086
|
-
if(!defaultValue && fieldValue){
|
|
1087
|
-
// 如果表单中没有字段值,则认字段上配置的value属性
|
|
1088
|
-
defaultValue = fieldValue;
|
|
1089
|
-
}
|
|
1090
1083
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
1091
1084
|
var optionsFilters = [["user", optionsFiltersOp, []]];
|
|
1092
1085
|
if (defaultValue) {
|
|
@@ -3975,6 +3968,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
3975
3968
|
`;
|
|
3976
3969
|
source.adaptor = `
|
|
3977
3970
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
3971
|
+
const value = api.data.$self.value;
|
|
3972
|
+
if(!_.isEmpty(value)){
|
|
3973
|
+
// value 不为空值,表示返回当前选中节点信息
|
|
3974
|
+
return payload;
|
|
3975
|
+
}
|
|
3978
3976
|
if(enable_tree){
|
|
3979
3977
|
const records = payload.data.rows;
|
|
3980
3978
|
const treeRecords = [];
|
|
@@ -4279,21 +4277,20 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
4279
4277
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
4280
4278
|
}
|
|
4281
4279
|
|
|
4282
|
-
if(ctx.ids || ctx.idsTrackOn){
|
|
4283
|
-
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4284
|
-
}
|
|
4285
|
-
|
|
4286
4280
|
let referenceTo = await getReferenceTo(field);
|
|
4287
4281
|
if(!referenceTo){
|
|
4288
4282
|
return await lookupToAmisSelect(field, readonly, ctx);
|
|
4289
4283
|
}
|
|
4290
4284
|
|
|
4291
|
-
const refObject = await getUISchema(referenceTo.objectName);
|
|
4292
|
-
|
|
4293
4285
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
4286
|
+
if(ctx.idsDependOn || field.amis){
|
|
4287
|
+
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4288
|
+
}
|
|
4294
4289
|
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4295
4290
|
}
|
|
4296
4291
|
|
|
4292
|
+
const refObject = await getUISchema(referenceTo.objectName);
|
|
4293
|
+
|
|
4297
4294
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
4298
4295
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
4299
4296
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
@@ -4328,7 +4325,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4328
4325
|
}
|
|
4329
4326
|
const refObjectConfig = await getUISchema(referenceTo.objectName);
|
|
4330
4327
|
|
|
4331
|
-
const {
|
|
4328
|
+
const { idsDependOn } = ctx;
|
|
4332
4329
|
|
|
4333
4330
|
const fields = {
|
|
4334
4331
|
[referenceTo.labelField.name]: referenceTo.labelField,
|
|
@@ -4342,14 +4339,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4342
4339
|
source.data.$term = "$term";
|
|
4343
4340
|
source.data.$self = "$$";
|
|
4344
4341
|
|
|
4345
|
-
if(
|
|
4346
|
-
source.sendOn =
|
|
4347
|
-
|
|
4348
|
-
else {
|
|
4349
|
-
source.sendOn = false;
|
|
4350
|
-
}
|
|
4351
|
-
if(idsTrackOn){
|
|
4352
|
-
source.sendOn = `\${${idsTrackOn} && ${idsTrackOn}.length}`;
|
|
4342
|
+
if(idsDependOn && source.url){
|
|
4343
|
+
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
4344
|
+
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
4353
4345
|
}
|
|
4354
4346
|
|
|
4355
4347
|
source.requestAdaptor = `
|
|
@@ -4366,10 +4358,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4366
4358
|
}
|
|
4367
4359
|
}
|
|
4368
4360
|
|
|
4369
|
-
var ids
|
|
4370
|
-
var
|
|
4371
|
-
if(
|
|
4372
|
-
ids = api.data.$self[
|
|
4361
|
+
var ids;
|
|
4362
|
+
var idsDependOn = "${idsDependOn}";
|
|
4363
|
+
if(idsDependOn){
|
|
4364
|
+
ids = api.data.$self[idsDependOn];
|
|
4373
4365
|
}
|
|
4374
4366
|
if(ids && ids.length){
|
|
4375
4367
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
@@ -6648,7 +6640,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6648
6640
|
const searchableFields = [];
|
|
6649
6641
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6650
6642
|
|
|
6651
|
-
if(!top){
|
|
6643
|
+
if (!top) {
|
|
6652
6644
|
// 日历请求不翻页
|
|
6653
6645
|
top = 200;
|
|
6654
6646
|
}
|
|
@@ -6774,7 +6766,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6774
6766
|
title: n["${calendarOptions.textExpr}"],
|
|
6775
6767
|
start: n["${calendarOptions.startDateExpr}"],
|
|
6776
6768
|
end: n["${calendarOptions.endDateExpr}"],
|
|
6777
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
6769
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
6770
|
+
extendedProps: n
|
|
6778
6771
|
}
|
|
6779
6772
|
});
|
|
6780
6773
|
const successCallback = selfData.successCallback;
|
|
@@ -6847,7 +6840,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
6847
6840
|
return payload;
|
|
6848
6841
|
`,
|
|
6849
6842
|
headers: {
|
|
6850
|
-
|
|
6843
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6851
6844
|
}
|
|
6852
6845
|
};
|
|
6853
6846
|
}
|
|
@@ -6866,9 +6859,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6866
6859
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, _$1.omitBy(calendarOptions, _$1.isNil));
|
|
6867
6860
|
|
|
6868
6861
|
const titleFields = calendarOptions.title || [
|
|
6869
|
-
calendarOptions.startDateExpr,
|
|
6870
|
-
calendarOptions.endDateExpr,
|
|
6871
|
-
calendarOptions.allDayExpr,
|
|
6862
|
+
calendarOptions.startDateExpr,
|
|
6863
|
+
calendarOptions.endDateExpr,
|
|
6864
|
+
calendarOptions.allDayExpr,
|
|
6872
6865
|
calendarOptions.textExpr
|
|
6873
6866
|
];
|
|
6874
6867
|
let fields = [];
|
|
@@ -6892,9 +6885,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6892
6885
|
}
|
|
6893
6886
|
}
|
|
6894
6887
|
let initialView = calendarOptions.currentView;
|
|
6895
|
-
if(initialView){
|
|
6888
|
+
if (initialView) {
|
|
6896
6889
|
// day, week, month, agenda
|
|
6897
|
-
switch(initialView){
|
|
6890
|
+
switch (initialView) {
|
|
6898
6891
|
case "day":
|
|
6899
6892
|
initialView = "timeGridDay";
|
|
6900
6893
|
break;
|
|
@@ -6905,7 +6898,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6905
6898
|
initialView = "dayGridMonth";
|
|
6906
6899
|
break;
|
|
6907
6900
|
case "agenda":
|
|
6908
|
-
initialView = "
|
|
6901
|
+
initialView = "listWeek";
|
|
6909
6902
|
break;
|
|
6910
6903
|
}
|
|
6911
6904
|
}
|
|
@@ -7001,19 +6994,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7001
6994
|
const recordId = "${event.id}";
|
|
7002
6995
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
7003
6996
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
7004
|
-
|
|
6997
|
+
|
|
7005
6998
|
const businessHours = {
|
|
7006
|
-
daysOfWeek: [
|
|
6999
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
7007
7000
|
startTime: '08:00',
|
|
7008
7001
|
endTime: '18:00',
|
|
7009
7002
|
};
|
|
7010
|
-
if(!_$1.isEmpty(calendarOptions.startDayHour)){
|
|
7003
|
+
if (!_$1.isEmpty(calendarOptions.startDayHour)) {
|
|
7011
7004
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
7012
7005
|
}
|
|
7013
|
-
if(!_$1.isEmpty(calendarOptions.endDayHour)){
|
|
7006
|
+
if (!_$1.isEmpty(calendarOptions.endDayHour)) {
|
|
7014
7007
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
7015
7008
|
}
|
|
7016
|
-
|
|
7009
|
+
|
|
7010
|
+
const onEvent = {
|
|
7011
|
+
"getEvents": {
|
|
7012
|
+
"weight": 0,
|
|
7013
|
+
"actions": [
|
|
7014
|
+
{
|
|
7015
|
+
"componentId": "",
|
|
7016
|
+
"args": {
|
|
7017
|
+
},
|
|
7018
|
+
"actionType": "custom",
|
|
7019
|
+
"script": onGetEventsScript
|
|
7020
|
+
}
|
|
7021
|
+
]
|
|
7022
|
+
},
|
|
7023
|
+
"select": {
|
|
7024
|
+
"weight": 0,
|
|
7025
|
+
"actions": [
|
|
7026
|
+
{
|
|
7027
|
+
"componentId": "",
|
|
7028
|
+
"args": {
|
|
7029
|
+
},
|
|
7030
|
+
"actionType": "custom",
|
|
7031
|
+
"script": onSelectScript
|
|
7032
|
+
}
|
|
7033
|
+
]
|
|
7034
|
+
},
|
|
7035
|
+
"eventClick": {
|
|
7036
|
+
"weight": 0,
|
|
7037
|
+
"actions": [
|
|
7038
|
+
{
|
|
7039
|
+
"componentId": "",
|
|
7040
|
+
"args": {
|
|
7041
|
+
},
|
|
7042
|
+
"actionType": "custom",
|
|
7043
|
+
"script": onEventClickScript
|
|
7044
|
+
}
|
|
7045
|
+
]
|
|
7046
|
+
},
|
|
7047
|
+
"eventAdd": {
|
|
7048
|
+
"weight": 0,
|
|
7049
|
+
"actions": [
|
|
7050
|
+
{
|
|
7051
|
+
"componentId": "",
|
|
7052
|
+
"args": {
|
|
7053
|
+
},
|
|
7054
|
+
"actionType": "custom",
|
|
7055
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7056
|
+
}
|
|
7057
|
+
]
|
|
7058
|
+
},
|
|
7059
|
+
"eventChange": {
|
|
7060
|
+
"weight": 0,
|
|
7061
|
+
"actions": [
|
|
7062
|
+
{
|
|
7063
|
+
"actionType": 'ajax',
|
|
7064
|
+
"args": {
|
|
7065
|
+
"api": recordPermissionsApi
|
|
7066
|
+
}
|
|
7067
|
+
},
|
|
7068
|
+
{
|
|
7069
|
+
"actionType": "toast",
|
|
7070
|
+
"expression": "!event.data.editable",
|
|
7071
|
+
"args": {
|
|
7072
|
+
"msgType": "error",
|
|
7073
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7074
|
+
"position": "top-center"
|
|
7075
|
+
}
|
|
7076
|
+
},
|
|
7077
|
+
{
|
|
7078
|
+
"actionType": 'ajax',
|
|
7079
|
+
"expression": "event.data.editable",
|
|
7080
|
+
"args": {
|
|
7081
|
+
"api": recordSaveApi,
|
|
7082
|
+
"messages": {
|
|
7083
|
+
"success": objectSchema.label + "修改成功",
|
|
7084
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7085
|
+
}
|
|
7086
|
+
}
|
|
7087
|
+
}
|
|
7088
|
+
]
|
|
7089
|
+
},
|
|
7090
|
+
"eventRemove": {
|
|
7091
|
+
"weight": 0,
|
|
7092
|
+
"actions": [
|
|
7093
|
+
{
|
|
7094
|
+
"componentId": "",
|
|
7095
|
+
"args": {
|
|
7096
|
+
},
|
|
7097
|
+
"actionType": "custom",
|
|
7098
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7099
|
+
}
|
|
7100
|
+
]
|
|
7101
|
+
},
|
|
7102
|
+
"eventsSet": {
|
|
7103
|
+
"weight": 0,
|
|
7104
|
+
"actions": [
|
|
7105
|
+
{
|
|
7106
|
+
"componentId": "",
|
|
7107
|
+
"args": {
|
|
7108
|
+
},
|
|
7109
|
+
"actionType": "custom",
|
|
7110
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7111
|
+
}
|
|
7112
|
+
]
|
|
7113
|
+
}
|
|
7114
|
+
};
|
|
7115
|
+
|
|
7116
|
+
Object.assign(onEvent, options.onEvent);
|
|
7117
|
+
|
|
7118
|
+
const config = options.config || {};
|
|
7119
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7120
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7121
|
+
if(hasReturn){
|
|
7122
|
+
try {
|
|
7123
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7124
|
+
let fn = new Function("arg", config.eventContent);
|
|
7125
|
+
config.eventContent = fn;
|
|
7126
|
+
} catch (e) {
|
|
7127
|
+
console.warn(e);
|
|
7128
|
+
}
|
|
7129
|
+
}
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7132
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7133
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7134
|
+
if(hasReturn){
|
|
7135
|
+
try {
|
|
7136
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7137
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7138
|
+
config.noEventsContent = fn;
|
|
7139
|
+
} catch (e) {
|
|
7140
|
+
console.warn(e);
|
|
7141
|
+
}
|
|
7142
|
+
}
|
|
7143
|
+
}
|
|
7144
|
+
|
|
7017
7145
|
const amisSchema = {
|
|
7018
7146
|
"type": "steedos-fullcalendar",
|
|
7019
7147
|
"label": "",
|
|
@@ -7023,111 +7151,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7023
7151
|
"selectMirror": permissions.allowCreate,
|
|
7024
7152
|
"initialView": initialView,
|
|
7025
7153
|
"businessHours": businessHours,
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
"weight": 0,
|
|
7029
|
-
"actions": [
|
|
7030
|
-
{
|
|
7031
|
-
"componentId": "",
|
|
7032
|
-
"args": {
|
|
7033
|
-
},
|
|
7034
|
-
"actionType": "custom",
|
|
7035
|
-
"script": onGetEventsScript
|
|
7036
|
-
}
|
|
7037
|
-
]
|
|
7038
|
-
},
|
|
7039
|
-
"select": {
|
|
7040
|
-
"weight": 0,
|
|
7041
|
-
"actions": [
|
|
7042
|
-
{
|
|
7043
|
-
"componentId": "",
|
|
7044
|
-
"args": {
|
|
7045
|
-
},
|
|
7046
|
-
"actionType": "custom",
|
|
7047
|
-
"script": onSelectScript
|
|
7048
|
-
}
|
|
7049
|
-
]
|
|
7050
|
-
},
|
|
7051
|
-
"eventClick": {
|
|
7052
|
-
"weight": 0,
|
|
7053
|
-
"actions": [
|
|
7054
|
-
{
|
|
7055
|
-
"componentId": "",
|
|
7056
|
-
"args": {
|
|
7057
|
-
},
|
|
7058
|
-
"actionType": "custom",
|
|
7059
|
-
"script": onEventClickScript
|
|
7060
|
-
}
|
|
7061
|
-
]
|
|
7062
|
-
},
|
|
7063
|
-
"eventAdd": {
|
|
7064
|
-
"weight": 0,
|
|
7065
|
-
"actions": [
|
|
7066
|
-
{
|
|
7067
|
-
"componentId": "",
|
|
7068
|
-
"args": {
|
|
7069
|
-
},
|
|
7070
|
-
"actionType": "custom",
|
|
7071
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7072
|
-
}
|
|
7073
|
-
]
|
|
7074
|
-
},
|
|
7075
|
-
"eventChange": {
|
|
7076
|
-
"weight": 0,
|
|
7077
|
-
"actions": [
|
|
7078
|
-
{
|
|
7079
|
-
"actionType": 'ajax',
|
|
7080
|
-
"args": {
|
|
7081
|
-
"api": recordPermissionsApi
|
|
7082
|
-
}
|
|
7083
|
-
},
|
|
7084
|
-
{
|
|
7085
|
-
"actionType": "toast",
|
|
7086
|
-
"expression": "!event.data.editable",
|
|
7087
|
-
"args": {
|
|
7088
|
-
"msgType": "error",
|
|
7089
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7090
|
-
"position": "top-center"
|
|
7091
|
-
}
|
|
7092
|
-
},
|
|
7093
|
-
{
|
|
7094
|
-
"actionType": 'ajax',
|
|
7095
|
-
"expression": "event.data.editable",
|
|
7096
|
-
"args": {
|
|
7097
|
-
"api": recordSaveApi,
|
|
7098
|
-
"messages": {
|
|
7099
|
-
"success": objectSchema.label + "修改成功",
|
|
7100
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7101
|
-
}
|
|
7102
|
-
}
|
|
7103
|
-
}
|
|
7104
|
-
]
|
|
7105
|
-
},
|
|
7106
|
-
"eventRemove": {
|
|
7107
|
-
"weight": 0,
|
|
7108
|
-
"actions": [
|
|
7109
|
-
{
|
|
7110
|
-
"componentId": "",
|
|
7111
|
-
"args": {
|
|
7112
|
-
},
|
|
7113
|
-
"actionType": "custom",
|
|
7114
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7115
|
-
}
|
|
7116
|
-
]
|
|
7117
|
-
},
|
|
7118
|
-
"eventsSet": {
|
|
7119
|
-
"weight": 0,
|
|
7120
|
-
"actions": [
|
|
7121
|
-
{
|
|
7122
|
-
"componentId": "",
|
|
7123
|
-
"args": {
|
|
7124
|
-
},
|
|
7125
|
-
"actionType": "custom",
|
|
7126
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7127
|
-
}
|
|
7128
|
-
]
|
|
7129
|
-
},
|
|
7130
|
-
}
|
|
7154
|
+
...config,
|
|
7155
|
+
"onEvent": onEvent
|
|
7131
7156
|
};
|
|
7132
7157
|
return amisSchema;
|
|
7133
7158
|
}
|
|
@@ -8957,7 +8982,6 @@ const getJudgeInput = async (instance) => {
|
|
|
8957
8982
|
"args": {
|
|
8958
8983
|
"value": {
|
|
8959
8984
|
new_judge: "${event.data.value}",
|
|
8960
|
-
new_next_step: undefined,
|
|
8961
8985
|
next_step: undefined,
|
|
8962
8986
|
}
|
|
8963
8987
|
},
|
|
@@ -9009,7 +9033,11 @@ const getNextStepInput = async (instance) => {
|
|
|
9009
9033
|
id: "u:next_step",
|
|
9010
9034
|
multiple: false,
|
|
9011
9035
|
required: true,
|
|
9012
|
-
selectFirst: true,
|
|
9036
|
+
// selectFirst: true,
|
|
9037
|
+
autoFill: {
|
|
9038
|
+
"new_next_step": "${step}",
|
|
9039
|
+
"next_users": null
|
|
9040
|
+
},
|
|
9013
9041
|
"source": {
|
|
9014
9042
|
"url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
|
|
9015
9043
|
"headers": {
|
|
@@ -9021,10 +9049,12 @@ const getNextStepInput = async (instance) => {
|
|
|
9021
9049
|
"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;",
|
|
9022
9050
|
"adaptor": `
|
|
9023
9051
|
payload.data = {
|
|
9052
|
+
value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
|
|
9024
9053
|
options: _.map(payload.nextSteps, (item)=>{
|
|
9025
9054
|
return {
|
|
9026
9055
|
label: item.name,
|
|
9027
|
-
value: item
|
|
9056
|
+
value: item._id,
|
|
9057
|
+
step: item
|
|
9028
9058
|
}
|
|
9029
9059
|
})
|
|
9030
9060
|
};
|
|
@@ -9037,29 +9067,29 @@ const getNextStepInput = async (instance) => {
|
|
|
9037
9067
|
"judge": "${new_judge}",
|
|
9038
9068
|
}
|
|
9039
9069
|
},
|
|
9040
|
-
"onEvent": {
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
}
|
|
9070
|
+
// "onEvent": {
|
|
9071
|
+
// "change": {
|
|
9072
|
+
// "weight": 0,
|
|
9073
|
+
// "actions": [
|
|
9074
|
+
// {
|
|
9075
|
+
// "componentId": "instance_approval",
|
|
9076
|
+
// "args": {
|
|
9077
|
+
// "value": {
|
|
9078
|
+
// new_next_step: "${event.data.value}",
|
|
9079
|
+
// }
|
|
9080
|
+
// },
|
|
9081
|
+
// "actionType": "setValue"
|
|
9082
|
+
// },
|
|
9083
|
+
// // {
|
|
9084
|
+
// // "args": {
|
|
9085
|
+
// // next_step: "${event.data.value}",
|
|
9086
|
+
// // },
|
|
9087
|
+
// // "actionType": "broadcast",
|
|
9088
|
+
// // eventName: "approve_next_step_change"
|
|
9089
|
+
// // },
|
|
9090
|
+
// ]
|
|
9091
|
+
// }
|
|
9092
|
+
// }
|
|
9063
9093
|
},
|
|
9064
9094
|
],
|
|
9065
9095
|
id: "u:4d3a884b437c",
|
|
@@ -9097,56 +9127,44 @@ const getNextStepUsersInput = async (instance) => {
|
|
|
9097
9127
|
body: [
|
|
9098
9128
|
// TODO 处理下一步处理人默认值
|
|
9099
9129
|
Object.assign({},
|
|
9100
|
-
// await lookupToAmisPicker(
|
|
9101
|
-
// {
|
|
9102
|
-
// name: "next_users",
|
|
9103
|
-
// label: false,
|
|
9104
|
-
// reference_to: "space_users",
|
|
9105
|
-
// reference_to_field: 'user',
|
|
9106
|
-
// multiple: false,
|
|
9107
|
-
// },
|
|
9108
|
-
// false,
|
|
9109
|
-
// {}
|
|
9110
|
-
// ),
|
|
9111
9130
|
{
|
|
9112
9131
|
"type": "steedos-select-user"
|
|
9113
9132
|
},
|
|
9114
|
-
|
|
9115
9133
|
{
|
|
9116
9134
|
name: "next_users",
|
|
9117
|
-
// value: "",
|
|
9118
9135
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
|
|
9119
9136
|
required: true
|
|
9120
9137
|
}),
|
|
9121
9138
|
{
|
|
9122
|
-
type: "
|
|
9139
|
+
type: "steedos-select-user",
|
|
9123
9140
|
label: "",
|
|
9124
9141
|
name: "next_users",
|
|
9125
|
-
// options: await getNextStepOptions(instance),
|
|
9126
9142
|
id: "u:next_users",
|
|
9127
9143
|
required: true,
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
"
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
"
|
|
9135
|
-
|
|
9136
|
-
|
|
9144
|
+
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
|
|
9145
|
+
amis: {
|
|
9146
|
+
multiple: "this.new_next_step.deal_type === 'counterSign'",
|
|
9147
|
+
"source": {
|
|
9148
|
+
"url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
|
|
9149
|
+
"method": "post",
|
|
9150
|
+
"sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
|
|
9151
|
+
"headers": {
|
|
9152
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
9153
|
+
},
|
|
9154
|
+
"messages": {
|
|
9155
|
+
},
|
|
9156
|
+
"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;",
|
|
9157
|
+
"adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
|
|
9158
|
+
"data": {
|
|
9159
|
+
"&": "$$",
|
|
9160
|
+
"$scopeId": "$scopeId",
|
|
9161
|
+
"context": "${context}",
|
|
9162
|
+
"next_step": "${new_next_step}",
|
|
9163
|
+
}
|
|
9137
9164
|
},
|
|
9138
|
-
"
|
|
9139
|
-
"
|
|
9140
|
-
|
|
9141
|
-
"&": "$$",
|
|
9142
|
-
"$scopeId": "$scopeId",
|
|
9143
|
-
"context": "${context}",
|
|
9144
|
-
"next_step": "${new_next_step}",
|
|
9145
|
-
}
|
|
9146
|
-
},
|
|
9147
|
-
"labelField": "name",
|
|
9148
|
-
"valueField": "id",
|
|
9149
|
-
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'"
|
|
9165
|
+
"labelField": "name",
|
|
9166
|
+
"valueField": "id",
|
|
9167
|
+
}
|
|
9150
9168
|
}
|
|
9151
9169
|
],
|
|
9152
9170
|
id: "u:81a4913c61cc",
|
|
@@ -9348,6 +9366,10 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9348
9366
|
clearPersistDataAfterSubmit: true,
|
|
9349
9367
|
persistData: `workflow_approve_form_${instance.approve._id}`,
|
|
9350
9368
|
body: [
|
|
9369
|
+
{
|
|
9370
|
+
type: 'hidden',
|
|
9371
|
+
name: 'new_next_step'
|
|
9372
|
+
},
|
|
9351
9373
|
await getJudgeInput(instance),
|
|
9352
9374
|
{
|
|
9353
9375
|
type: "textarea",
|
|
@@ -9378,7 +9400,7 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9378
9400
|
// {
|
|
9379
9401
|
// "actionType": "reload",
|
|
9380
9402
|
// "componentId": "u:nex_users",
|
|
9381
|
-
// "args": {
|
|
9403
|
+
// "args": {
|
|
9382
9404
|
// }
|
|
9383
9405
|
// }
|
|
9384
9406
|
// ]
|
|
@@ -9689,7 +9711,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
9689
9711
|
* @Author: baozhoutao@steedos.com
|
|
9690
9712
|
* @Date: 2022-09-07 16:20:45
|
|
9691
9713
|
* @LastEditors: baozhoutao@steedos.com
|
|
9692
|
-
* @LastEditTime: 2023-03-
|
|
9714
|
+
* @LastEditTime: 2023-03-23 16:49:44
|
|
9693
9715
|
* @Description:
|
|
9694
9716
|
*/
|
|
9695
9717
|
|
|
@@ -10253,7 +10275,6 @@ const getFormTableView = async (instance) => {
|
|
|
10253
10275
|
trs: await getFormTrs(instance),
|
|
10254
10276
|
id: "u:047f3669468b",
|
|
10255
10277
|
};
|
|
10256
|
-
console.log(`getFormTableView formSchema=====>`, formSchema);
|
|
10257
10278
|
return formSchema;
|
|
10258
10279
|
};
|
|
10259
10280
|
|