@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.esm.js
CHANGED
|
@@ -1049,17 +1049,10 @@ async function getSource$1(field, ctx) {
|
|
|
1049
1049
|
data.$value = `$${valueField}`;
|
|
1050
1050
|
// data["&"] = "$$";
|
|
1051
1051
|
|
|
1052
|
-
const fieldValue = ctx.value;
|
|
1053
|
-
|
|
1054
1052
|
const requestAdaptor = `
|
|
1055
1053
|
var filters = [['parent', '=', null]];
|
|
1056
1054
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
1057
1055
|
var defaultValue = api.data.$value;
|
|
1058
|
-
var fieldValue = ${JSON.stringify(fieldValue)};
|
|
1059
|
-
if(!defaultValue && fieldValue){
|
|
1060
|
-
// 如果表单中没有字段值,则认字段上配置的value属性
|
|
1061
|
-
defaultValue = fieldValue;
|
|
1062
|
-
}
|
|
1063
1056
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
1064
1057
|
var optionsFilters = [["user", optionsFiltersOp, []]];
|
|
1065
1058
|
if (defaultValue) {
|
|
@@ -3948,6 +3941,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
3948
3941
|
`;
|
|
3949
3942
|
source.adaptor = `
|
|
3950
3943
|
const enable_tree = ${refObjectConfig.enable_tree};
|
|
3944
|
+
const value = api.data.$self.value;
|
|
3945
|
+
if(!_.isEmpty(value)){
|
|
3946
|
+
// value 不为空值,表示返回当前选中节点信息
|
|
3947
|
+
return payload;
|
|
3948
|
+
}
|
|
3951
3949
|
if(enable_tree){
|
|
3952
3950
|
const records = payload.data.rows;
|
|
3953
3951
|
const treeRecords = [];
|
|
@@ -4252,21 +4250,20 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
4252
4250
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
4253
4251
|
}
|
|
4254
4252
|
|
|
4255
|
-
if(ctx.ids || ctx.idsTrackOn){
|
|
4256
|
-
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
4253
|
let referenceTo = await getReferenceTo(field);
|
|
4260
4254
|
if(!referenceTo){
|
|
4261
4255
|
return await lookupToAmisSelect(field, readonly, ctx);
|
|
4262
4256
|
}
|
|
4263
4257
|
|
|
4264
|
-
const refObject = await getUISchema(referenceTo.objectName);
|
|
4265
|
-
|
|
4266
4258
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
4259
|
+
if(ctx.idsDependOn || field.amis){
|
|
4260
|
+
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4261
|
+
}
|
|
4267
4262
|
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4268
4263
|
}
|
|
4269
4264
|
|
|
4265
|
+
const refObject = await getUISchema(referenceTo.objectName);
|
|
4266
|
+
|
|
4270
4267
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
4271
4268
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
4272
4269
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
@@ -4301,7 +4298,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4301
4298
|
}
|
|
4302
4299
|
const refObjectConfig = await getUISchema(referenceTo.objectName);
|
|
4303
4300
|
|
|
4304
|
-
const {
|
|
4301
|
+
const { idsDependOn } = ctx;
|
|
4305
4302
|
|
|
4306
4303
|
const fields = {
|
|
4307
4304
|
[referenceTo.labelField.name]: referenceTo.labelField,
|
|
@@ -4315,14 +4312,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4315
4312
|
source.data.$term = "$term";
|
|
4316
4313
|
source.data.$self = "$$";
|
|
4317
4314
|
|
|
4318
|
-
if(
|
|
4319
|
-
source.sendOn =
|
|
4320
|
-
|
|
4321
|
-
else {
|
|
4322
|
-
source.sendOn = false;
|
|
4323
|
-
}
|
|
4324
|
-
if(idsTrackOn){
|
|
4325
|
-
source.sendOn = `\${${idsTrackOn} && ${idsTrackOn}.length}`;
|
|
4315
|
+
if(idsDependOn && source.url){
|
|
4316
|
+
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
4317
|
+
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
4326
4318
|
}
|
|
4327
4319
|
|
|
4328
4320
|
source.requestAdaptor = `
|
|
@@ -4339,10 +4331,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4339
4331
|
}
|
|
4340
4332
|
}
|
|
4341
4333
|
|
|
4342
|
-
var ids
|
|
4343
|
-
var
|
|
4344
|
-
if(
|
|
4345
|
-
ids = api.data.$self[
|
|
4334
|
+
var ids;
|
|
4335
|
+
var idsDependOn = "${idsDependOn}";
|
|
4336
|
+
if(idsDependOn){
|
|
4337
|
+
ids = api.data.$self[idsDependOn];
|
|
4346
4338
|
}
|
|
4347
4339
|
if(ids && ids.length){
|
|
4348
4340
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
@@ -6621,7 +6613,7 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6621
6613
|
const searchableFields = [];
|
|
6622
6614
|
let { filter, sort, top, setDataToComponentId = '' } = options;
|
|
6623
6615
|
|
|
6624
|
-
if(!top){
|
|
6616
|
+
if (!top) {
|
|
6625
6617
|
// 日历请求不翻页
|
|
6626
6618
|
top = 200;
|
|
6627
6619
|
}
|
|
@@ -6747,7 +6739,8 @@ async function getCalendarApi(mainObject, fields, options) {
|
|
|
6747
6739
|
title: n["${calendarOptions.textExpr}"],
|
|
6748
6740
|
start: n["${calendarOptions.startDateExpr}"],
|
|
6749
6741
|
end: n["${calendarOptions.endDateExpr}"],
|
|
6750
|
-
allDay: n["${calendarOptions.allDayExpr}"]
|
|
6742
|
+
allDay: n["${calendarOptions.allDayExpr}"],
|
|
6743
|
+
extendedProps: n
|
|
6751
6744
|
}
|
|
6752
6745
|
});
|
|
6753
6746
|
const successCallback = selfData.successCallback;
|
|
@@ -6820,7 +6813,7 @@ function getCalendarRecordSaveApi(object, calendarOptions) {
|
|
|
6820
6813
|
return payload;
|
|
6821
6814
|
`,
|
|
6822
6815
|
headers: {
|
|
6823
|
-
|
|
6816
|
+
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
6824
6817
|
}
|
|
6825
6818
|
};
|
|
6826
6819
|
}
|
|
@@ -6839,9 +6832,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6839
6832
|
calendarOptions = Object.assign({}, DEFAULT_CALENDAR_OPTIONS, omitBy(calendarOptions, isNil));
|
|
6840
6833
|
|
|
6841
6834
|
const titleFields = calendarOptions.title || [
|
|
6842
|
-
calendarOptions.startDateExpr,
|
|
6843
|
-
calendarOptions.endDateExpr,
|
|
6844
|
-
calendarOptions.allDayExpr,
|
|
6835
|
+
calendarOptions.startDateExpr,
|
|
6836
|
+
calendarOptions.endDateExpr,
|
|
6837
|
+
calendarOptions.allDayExpr,
|
|
6845
6838
|
calendarOptions.textExpr
|
|
6846
6839
|
];
|
|
6847
6840
|
let fields = [];
|
|
@@ -6865,9 +6858,9 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6865
6858
|
}
|
|
6866
6859
|
}
|
|
6867
6860
|
let initialView = calendarOptions.currentView;
|
|
6868
|
-
if(initialView){
|
|
6861
|
+
if (initialView) {
|
|
6869
6862
|
// day, week, month, agenda
|
|
6870
|
-
switch(initialView){
|
|
6863
|
+
switch (initialView) {
|
|
6871
6864
|
case "day":
|
|
6872
6865
|
initialView = "timeGridDay";
|
|
6873
6866
|
break;
|
|
@@ -6878,7 +6871,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6878
6871
|
initialView = "dayGridMonth";
|
|
6879
6872
|
break;
|
|
6880
6873
|
case "agenda":
|
|
6881
|
-
initialView = "
|
|
6874
|
+
initialView = "listWeek";
|
|
6882
6875
|
break;
|
|
6883
6876
|
}
|
|
6884
6877
|
}
|
|
@@ -6974,19 +6967,154 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6974
6967
|
const recordId = "${event.id}";
|
|
6975
6968
|
const recordPermissionsApi = getCalendarRecordPermissionsApi(objectSchema, recordId);
|
|
6976
6969
|
const recordSaveApi = getCalendarRecordSaveApi(objectSchema, calendarOptions);
|
|
6977
|
-
|
|
6970
|
+
|
|
6978
6971
|
const businessHours = {
|
|
6979
|
-
daysOfWeek: [
|
|
6972
|
+
daysOfWeek: [1, 2, 3, 4, 5],
|
|
6980
6973
|
startTime: '08:00',
|
|
6981
6974
|
endTime: '18:00',
|
|
6982
6975
|
};
|
|
6983
|
-
if(!isEmpty(calendarOptions.startDayHour)){
|
|
6976
|
+
if (!isEmpty(calendarOptions.startDayHour)) {
|
|
6984
6977
|
businessHours.startTime = `${calendarOptions.startDayHour}:00`;
|
|
6985
6978
|
}
|
|
6986
|
-
if(!isEmpty(calendarOptions.endDayHour)){
|
|
6979
|
+
if (!isEmpty(calendarOptions.endDayHour)) {
|
|
6987
6980
|
businessHours.endTime = `${calendarOptions.endDayHour}:00`;
|
|
6988
6981
|
}
|
|
6989
|
-
|
|
6982
|
+
|
|
6983
|
+
const onEvent = {
|
|
6984
|
+
"getEvents": {
|
|
6985
|
+
"weight": 0,
|
|
6986
|
+
"actions": [
|
|
6987
|
+
{
|
|
6988
|
+
"componentId": "",
|
|
6989
|
+
"args": {
|
|
6990
|
+
},
|
|
6991
|
+
"actionType": "custom",
|
|
6992
|
+
"script": onGetEventsScript
|
|
6993
|
+
}
|
|
6994
|
+
]
|
|
6995
|
+
},
|
|
6996
|
+
"select": {
|
|
6997
|
+
"weight": 0,
|
|
6998
|
+
"actions": [
|
|
6999
|
+
{
|
|
7000
|
+
"componentId": "",
|
|
7001
|
+
"args": {
|
|
7002
|
+
},
|
|
7003
|
+
"actionType": "custom",
|
|
7004
|
+
"script": onSelectScript
|
|
7005
|
+
}
|
|
7006
|
+
]
|
|
7007
|
+
},
|
|
7008
|
+
"eventClick": {
|
|
7009
|
+
"weight": 0,
|
|
7010
|
+
"actions": [
|
|
7011
|
+
{
|
|
7012
|
+
"componentId": "",
|
|
7013
|
+
"args": {
|
|
7014
|
+
},
|
|
7015
|
+
"actionType": "custom",
|
|
7016
|
+
"script": onEventClickScript
|
|
7017
|
+
}
|
|
7018
|
+
]
|
|
7019
|
+
},
|
|
7020
|
+
"eventAdd": {
|
|
7021
|
+
"weight": 0,
|
|
7022
|
+
"actions": [
|
|
7023
|
+
{
|
|
7024
|
+
"componentId": "",
|
|
7025
|
+
"args": {
|
|
7026
|
+
},
|
|
7027
|
+
"actionType": "custom",
|
|
7028
|
+
"script": "console.log('eventAdd'); console.log(event);"
|
|
7029
|
+
}
|
|
7030
|
+
]
|
|
7031
|
+
},
|
|
7032
|
+
"eventChange": {
|
|
7033
|
+
"weight": 0,
|
|
7034
|
+
"actions": [
|
|
7035
|
+
{
|
|
7036
|
+
"actionType": 'ajax',
|
|
7037
|
+
"args": {
|
|
7038
|
+
"api": recordPermissionsApi
|
|
7039
|
+
}
|
|
7040
|
+
},
|
|
7041
|
+
{
|
|
7042
|
+
"actionType": "toast",
|
|
7043
|
+
"expression": "!event.data.editable",
|
|
7044
|
+
"args": {
|
|
7045
|
+
"msgType": "error",
|
|
7046
|
+
"msg": "您没有编辑该记录的权限!",
|
|
7047
|
+
"position": "top-center"
|
|
7048
|
+
}
|
|
7049
|
+
},
|
|
7050
|
+
{
|
|
7051
|
+
"actionType": 'ajax',
|
|
7052
|
+
"expression": "event.data.editable",
|
|
7053
|
+
"args": {
|
|
7054
|
+
"api": recordSaveApi,
|
|
7055
|
+
"messages": {
|
|
7056
|
+
"success": objectSchema.label + "修改成功",
|
|
7057
|
+
"failed": objectSchema.label + "修改失败!"
|
|
7058
|
+
}
|
|
7059
|
+
}
|
|
7060
|
+
}
|
|
7061
|
+
]
|
|
7062
|
+
},
|
|
7063
|
+
"eventRemove": {
|
|
7064
|
+
"weight": 0,
|
|
7065
|
+
"actions": [
|
|
7066
|
+
{
|
|
7067
|
+
"componentId": "",
|
|
7068
|
+
"args": {
|
|
7069
|
+
},
|
|
7070
|
+
"actionType": "custom",
|
|
7071
|
+
"script": "console.log('eventRemove'); console.log(event);"
|
|
7072
|
+
}
|
|
7073
|
+
]
|
|
7074
|
+
},
|
|
7075
|
+
"eventsSet": {
|
|
7076
|
+
"weight": 0,
|
|
7077
|
+
"actions": [
|
|
7078
|
+
{
|
|
7079
|
+
"componentId": "",
|
|
7080
|
+
"args": {
|
|
7081
|
+
},
|
|
7082
|
+
"actionType": "custom",
|
|
7083
|
+
"script": "console.log('eventsSet'); console.log(event);"
|
|
7084
|
+
}
|
|
7085
|
+
]
|
|
7086
|
+
}
|
|
7087
|
+
};
|
|
7088
|
+
|
|
7089
|
+
Object.assign(onEvent, options.onEvent);
|
|
7090
|
+
|
|
7091
|
+
const config = options.config || {};
|
|
7092
|
+
if(config.eventContent && typeof config.eventContent === "string"){
|
|
7093
|
+
const hasReturn = /\breturn\b/.test(config.eventContent);
|
|
7094
|
+
if(hasReturn){
|
|
7095
|
+
try {
|
|
7096
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7097
|
+
let fn = new Function("arg", config.eventContent);
|
|
7098
|
+
config.eventContent = fn;
|
|
7099
|
+
} catch (e) {
|
|
7100
|
+
console.warn(e);
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
}
|
|
7104
|
+
|
|
7105
|
+
if(config.noEventsContent && typeof config.noEventsContent === "string"){
|
|
7106
|
+
const hasReturn = /\breturn\b/.test(config.noEventsContent);
|
|
7107
|
+
if(hasReturn){
|
|
7108
|
+
try {
|
|
7109
|
+
// 如果是包括return语句的字符串,则按函数解析,见 https://fullcalendar.io/docs/content-injection
|
|
7110
|
+
let fn = new Function("arg", config.noEventsContent);
|
|
7111
|
+
config.noEventsContent = fn;
|
|
7112
|
+
} catch (e) {
|
|
7113
|
+
console.warn(e);
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
}
|
|
7117
|
+
|
|
6990
7118
|
const amisSchema = {
|
|
6991
7119
|
"type": "steedos-fullcalendar",
|
|
6992
7120
|
"label": "",
|
|
@@ -6996,111 +7124,8 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6996
7124
|
"selectMirror": permissions.allowCreate,
|
|
6997
7125
|
"initialView": initialView,
|
|
6998
7126
|
"businessHours": businessHours,
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
"weight": 0,
|
|
7002
|
-
"actions": [
|
|
7003
|
-
{
|
|
7004
|
-
"componentId": "",
|
|
7005
|
-
"args": {
|
|
7006
|
-
},
|
|
7007
|
-
"actionType": "custom",
|
|
7008
|
-
"script": onGetEventsScript
|
|
7009
|
-
}
|
|
7010
|
-
]
|
|
7011
|
-
},
|
|
7012
|
-
"select": {
|
|
7013
|
-
"weight": 0,
|
|
7014
|
-
"actions": [
|
|
7015
|
-
{
|
|
7016
|
-
"componentId": "",
|
|
7017
|
-
"args": {
|
|
7018
|
-
},
|
|
7019
|
-
"actionType": "custom",
|
|
7020
|
-
"script": onSelectScript
|
|
7021
|
-
}
|
|
7022
|
-
]
|
|
7023
|
-
},
|
|
7024
|
-
"eventClick": {
|
|
7025
|
-
"weight": 0,
|
|
7026
|
-
"actions": [
|
|
7027
|
-
{
|
|
7028
|
-
"componentId": "",
|
|
7029
|
-
"args": {
|
|
7030
|
-
},
|
|
7031
|
-
"actionType": "custom",
|
|
7032
|
-
"script": onEventClickScript
|
|
7033
|
-
}
|
|
7034
|
-
]
|
|
7035
|
-
},
|
|
7036
|
-
"eventAdd": {
|
|
7037
|
-
"weight": 0,
|
|
7038
|
-
"actions": [
|
|
7039
|
-
{
|
|
7040
|
-
"componentId": "",
|
|
7041
|
-
"args": {
|
|
7042
|
-
},
|
|
7043
|
-
"actionType": "custom",
|
|
7044
|
-
"script": "console.log('eventAdd'); console.log(event);"
|
|
7045
|
-
}
|
|
7046
|
-
]
|
|
7047
|
-
},
|
|
7048
|
-
"eventChange": {
|
|
7049
|
-
"weight": 0,
|
|
7050
|
-
"actions": [
|
|
7051
|
-
{
|
|
7052
|
-
"actionType": 'ajax',
|
|
7053
|
-
"args": {
|
|
7054
|
-
"api": recordPermissionsApi
|
|
7055
|
-
}
|
|
7056
|
-
},
|
|
7057
|
-
{
|
|
7058
|
-
"actionType": "toast",
|
|
7059
|
-
"expression": "!event.data.editable",
|
|
7060
|
-
"args": {
|
|
7061
|
-
"msgType": "error",
|
|
7062
|
-
"msg": "您没有编辑该记录的权限!",
|
|
7063
|
-
"position": "top-center"
|
|
7064
|
-
}
|
|
7065
|
-
},
|
|
7066
|
-
{
|
|
7067
|
-
"actionType": 'ajax',
|
|
7068
|
-
"expression": "event.data.editable",
|
|
7069
|
-
"args": {
|
|
7070
|
-
"api": recordSaveApi,
|
|
7071
|
-
"messages": {
|
|
7072
|
-
"success": objectSchema.label + "修改成功",
|
|
7073
|
-
"failed": objectSchema.label + "修改失败!"
|
|
7074
|
-
}
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
]
|
|
7078
|
-
},
|
|
7079
|
-
"eventRemove": {
|
|
7080
|
-
"weight": 0,
|
|
7081
|
-
"actions": [
|
|
7082
|
-
{
|
|
7083
|
-
"componentId": "",
|
|
7084
|
-
"args": {
|
|
7085
|
-
},
|
|
7086
|
-
"actionType": "custom",
|
|
7087
|
-
"script": "console.log('eventRemove'); console.log(event);"
|
|
7088
|
-
}
|
|
7089
|
-
]
|
|
7090
|
-
},
|
|
7091
|
-
"eventsSet": {
|
|
7092
|
-
"weight": 0,
|
|
7093
|
-
"actions": [
|
|
7094
|
-
{
|
|
7095
|
-
"componentId": "",
|
|
7096
|
-
"args": {
|
|
7097
|
-
},
|
|
7098
|
-
"actionType": "custom",
|
|
7099
|
-
"script": "console.log('eventsSet'); console.log(event);"
|
|
7100
|
-
}
|
|
7101
|
-
]
|
|
7102
|
-
},
|
|
7103
|
-
}
|
|
7127
|
+
...config,
|
|
7128
|
+
"onEvent": onEvent
|
|
7104
7129
|
};
|
|
7105
7130
|
return amisSchema;
|
|
7106
7131
|
}
|
|
@@ -8930,7 +8955,6 @@ const getJudgeInput = async (instance) => {
|
|
|
8930
8955
|
"args": {
|
|
8931
8956
|
"value": {
|
|
8932
8957
|
new_judge: "${event.data.value}",
|
|
8933
|
-
new_next_step: undefined,
|
|
8934
8958
|
next_step: undefined,
|
|
8935
8959
|
}
|
|
8936
8960
|
},
|
|
@@ -8982,7 +9006,11 @@ const getNextStepInput = async (instance) => {
|
|
|
8982
9006
|
id: "u:next_step",
|
|
8983
9007
|
multiple: false,
|
|
8984
9008
|
required: true,
|
|
8985
|
-
selectFirst: true,
|
|
9009
|
+
// selectFirst: true,
|
|
9010
|
+
autoFill: {
|
|
9011
|
+
"new_next_step": "${step}",
|
|
9012
|
+
"next_users": null
|
|
9013
|
+
},
|
|
8986
9014
|
"source": {
|
|
8987
9015
|
"url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
|
|
8988
9016
|
"headers": {
|
|
@@ -8994,10 +9022,12 @@ const getNextStepInput = async (instance) => {
|
|
|
8994
9022
|
"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;",
|
|
8995
9023
|
"adaptor": `
|
|
8996
9024
|
payload.data = {
|
|
9025
|
+
value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
|
|
8997
9026
|
options: _.map(payload.nextSteps, (item)=>{
|
|
8998
9027
|
return {
|
|
8999
9028
|
label: item.name,
|
|
9000
|
-
value: item
|
|
9029
|
+
value: item._id,
|
|
9030
|
+
step: item
|
|
9001
9031
|
}
|
|
9002
9032
|
})
|
|
9003
9033
|
};
|
|
@@ -9010,29 +9040,29 @@ const getNextStepInput = async (instance) => {
|
|
|
9010
9040
|
"judge": "${new_judge}",
|
|
9011
9041
|
}
|
|
9012
9042
|
},
|
|
9013
|
-
"onEvent": {
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
}
|
|
9043
|
+
// "onEvent": {
|
|
9044
|
+
// "change": {
|
|
9045
|
+
// "weight": 0,
|
|
9046
|
+
// "actions": [
|
|
9047
|
+
// {
|
|
9048
|
+
// "componentId": "instance_approval",
|
|
9049
|
+
// "args": {
|
|
9050
|
+
// "value": {
|
|
9051
|
+
// new_next_step: "${event.data.value}",
|
|
9052
|
+
// }
|
|
9053
|
+
// },
|
|
9054
|
+
// "actionType": "setValue"
|
|
9055
|
+
// },
|
|
9056
|
+
// // {
|
|
9057
|
+
// // "args": {
|
|
9058
|
+
// // next_step: "${event.data.value}",
|
|
9059
|
+
// // },
|
|
9060
|
+
// // "actionType": "broadcast",
|
|
9061
|
+
// // eventName: "approve_next_step_change"
|
|
9062
|
+
// // },
|
|
9063
|
+
// ]
|
|
9064
|
+
// }
|
|
9065
|
+
// }
|
|
9036
9066
|
},
|
|
9037
9067
|
],
|
|
9038
9068
|
id: "u:4d3a884b437c",
|
|
@@ -9070,56 +9100,44 @@ const getNextStepUsersInput = async (instance) => {
|
|
|
9070
9100
|
body: [
|
|
9071
9101
|
// TODO 处理下一步处理人默认值
|
|
9072
9102
|
Object.assign({},
|
|
9073
|
-
// await lookupToAmisPicker(
|
|
9074
|
-
// {
|
|
9075
|
-
// name: "next_users",
|
|
9076
|
-
// label: false,
|
|
9077
|
-
// reference_to: "space_users",
|
|
9078
|
-
// reference_to_field: 'user',
|
|
9079
|
-
// multiple: false,
|
|
9080
|
-
// },
|
|
9081
|
-
// false,
|
|
9082
|
-
// {}
|
|
9083
|
-
// ),
|
|
9084
9103
|
{
|
|
9085
9104
|
"type": "steedos-select-user"
|
|
9086
9105
|
},
|
|
9087
|
-
|
|
9088
9106
|
{
|
|
9089
9107
|
name: "next_users",
|
|
9090
|
-
// value: "",
|
|
9091
9108
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
|
|
9092
9109
|
required: true
|
|
9093
9110
|
}),
|
|
9094
9111
|
{
|
|
9095
|
-
type: "
|
|
9112
|
+
type: "steedos-select-user",
|
|
9096
9113
|
label: "",
|
|
9097
9114
|
name: "next_users",
|
|
9098
|
-
// options: await getNextStepOptions(instance),
|
|
9099
9115
|
id: "u:next_users",
|
|
9100
9116
|
required: true,
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
"
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
"
|
|
9108
|
-
|
|
9109
|
-
|
|
9117
|
+
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
|
|
9118
|
+
amis: {
|
|
9119
|
+
multiple: "this.new_next_step.deal_type === 'counterSign'",
|
|
9120
|
+
"source": {
|
|
9121
|
+
"url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
|
|
9122
|
+
"method": "post",
|
|
9123
|
+
"sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
|
|
9124
|
+
"headers": {
|
|
9125
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
9126
|
+
},
|
|
9127
|
+
"messages": {
|
|
9128
|
+
},
|
|
9129
|
+
"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;",
|
|
9130
|
+
"adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
|
|
9131
|
+
"data": {
|
|
9132
|
+
"&": "$$",
|
|
9133
|
+
"$scopeId": "$scopeId",
|
|
9134
|
+
"context": "${context}",
|
|
9135
|
+
"next_step": "${new_next_step}",
|
|
9136
|
+
}
|
|
9110
9137
|
},
|
|
9111
|
-
"
|
|
9112
|
-
"
|
|
9113
|
-
|
|
9114
|
-
"&": "$$",
|
|
9115
|
-
"$scopeId": "$scopeId",
|
|
9116
|
-
"context": "${context}",
|
|
9117
|
-
"next_step": "${new_next_step}",
|
|
9118
|
-
}
|
|
9119
|
-
},
|
|
9120
|
-
"labelField": "name",
|
|
9121
|
-
"valueField": "id",
|
|
9122
|
-
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'"
|
|
9138
|
+
"labelField": "name",
|
|
9139
|
+
"valueField": "id",
|
|
9140
|
+
}
|
|
9123
9141
|
}
|
|
9124
9142
|
],
|
|
9125
9143
|
id: "u:81a4913c61cc",
|
|
@@ -9321,6 +9339,10 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9321
9339
|
clearPersistDataAfterSubmit: true,
|
|
9322
9340
|
persistData: `workflow_approve_form_${instance.approve._id}`,
|
|
9323
9341
|
body: [
|
|
9342
|
+
{
|
|
9343
|
+
type: 'hidden',
|
|
9344
|
+
name: 'new_next_step'
|
|
9345
|
+
},
|
|
9324
9346
|
await getJudgeInput(instance),
|
|
9325
9347
|
{
|
|
9326
9348
|
type: "textarea",
|
|
@@ -9351,7 +9373,7 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9351
9373
|
// {
|
|
9352
9374
|
// "actionType": "reload",
|
|
9353
9375
|
// "componentId": "u:nex_users",
|
|
9354
|
-
// "args": {
|
|
9376
|
+
// "args": {
|
|
9355
9377
|
// }
|
|
9356
9378
|
// }
|
|
9357
9379
|
// ]
|
|
@@ -9662,7 +9684,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
9662
9684
|
* @Author: baozhoutao@steedos.com
|
|
9663
9685
|
* @Date: 2022-09-07 16:20:45
|
|
9664
9686
|
* @LastEditors: baozhoutao@steedos.com
|
|
9665
|
-
* @LastEditTime: 2023-03-
|
|
9687
|
+
* @LastEditTime: 2023-03-23 16:49:44
|
|
9666
9688
|
* @Description:
|
|
9667
9689
|
*/
|
|
9668
9690
|
|
|
@@ -10226,7 +10248,6 @@ const getFormTableView = async (instance) => {
|
|
|
10226
10248
|
trs: await getFormTrs(instance),
|
|
10227
10249
|
id: "u:047f3669468b",
|
|
10228
10250
|
};
|
|
10229
|
-
console.log(`getFormTableView formSchema=====>`, formSchema);
|
|
10230
10251
|
return formSchema;
|
|
10231
10252
|
};
|
|
10232
10253
|
|