@steedos-widgets/amis-lib 1.2.18 → 1.2.25
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 +186 -181
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +186 -181
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +186 -181
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +2 -0
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +8 -2
- package/dist/types/lib/converter/amis/fields/table.d.ts +4 -1
- package/dist/types/lib/converter/amis/fields_filter.d.ts +6 -2
- package/dist/types/lib/converter/amis/header.d.ts +6 -2
- package/dist/types/lib/converter/amis/toolbar.d.ts +6 -2
- package/dist/types/lib/converter/amis/toolbars/setting_listview/new.d.ts +21 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +21 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -2445,15 +2445,15 @@
|
|
|
2445
2445
|
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
2446
2446
|
|
|
2447
2447
|
url_tmp = api.url.split('?')[0];
|
|
2448
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
2448
|
+
api.url = url_tmp + "?$select=" + encodeURIComponent(select.toString()) + "&filename=" + encodeURIComponent(filename);
|
|
2449
2449
|
|
|
2450
2450
|
// 判断sort 和 filters
|
|
2451
2451
|
if (sort.length > 0) {
|
|
2452
|
-
api.url += "&$orderby=" + order;
|
|
2452
|
+
api.url += "&$orderby=" + encodeURIComponent(order);
|
|
2453
2453
|
}
|
|
2454
2454
|
let filters = list_views[list_views_name].filters;
|
|
2455
2455
|
if (filters && filters.length > 0) {
|
|
2456
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
2456
|
+
api.url = api.url + "&filters=" + encodeURIComponent(JSON.stringify(filters));
|
|
2457
2457
|
}
|
|
2458
2458
|
return api;
|
|
2459
2459
|
`;
|
|
@@ -3239,28 +3239,42 @@
|
|
|
3239
3239
|
// }
|
|
3240
3240
|
// }
|
|
3241
3241
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
3242
|
-
|
|
3243
|
-
let
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
3258
|
-
let filterFormValues = event.data;
|
|
3259
|
-
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
3260
|
-
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
3261
|
-
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3262
|
-
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter: false});
|
|
3242
|
+
// 点击搜索的时候自动收起搜索栏
|
|
3243
|
+
let resizeWindow = function(){
|
|
3244
|
+
//触发amis crud 高度重算
|
|
3245
|
+
setTimeout(()=>{
|
|
3246
|
+
window.dispatchEvent(new Event("resize"))
|
|
3247
|
+
}, 500);
|
|
3248
|
+
}
|
|
3249
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3250
|
+
return n.props.type === "service";
|
|
3251
|
+
});
|
|
3252
|
+
let showFieldsFilter = false;
|
|
3253
|
+
const isMobile = window.innerWidth < 768;
|
|
3254
|
+
if(event.data.__from_fields_filter_settings_confirm){
|
|
3255
|
+
// 如果是从设置搜索项点击确认按钮触发的搜索事件不应该自动关闭搜索栏
|
|
3256
|
+
showFieldsFilter = true;
|
|
3263
3257
|
}
|
|
3258
|
+
else if(isMobile){
|
|
3259
|
+
// 如果是手机端,点击搜索后自动关闭搜索栏
|
|
3260
|
+
showFieldsFilter = false;
|
|
3261
|
+
}
|
|
3262
|
+
else if(event.data.displayAs === "split") {
|
|
3263
|
+
// PC上分栏模式下的列表,始终按手机上效果处理,即自动关闭搜索栏
|
|
3264
|
+
showFieldsFilter = false;
|
|
3265
|
+
}
|
|
3266
|
+
else if(window.innerHeight >= 1200){
|
|
3267
|
+
// 高分辨率屏幕(2k+),列表高度比较高,没必要自动关闭搜索栏
|
|
3268
|
+
showFieldsFilter = true;
|
|
3269
|
+
}
|
|
3270
|
+
filterService.setData({showFieldsFilter});
|
|
3271
|
+
resizeWindow();
|
|
3272
|
+
// 使用filterForm.getValues()的话,并不能拿到本地存储中的过滤条件,所以需要从event.data中取。
|
|
3273
|
+
let filterFormValues = event.data;
|
|
3274
|
+
let isFieldsFilterEmpty = SteedosUI.isFilterFormValuesEmpty(filterFormValues);
|
|
3275
|
+
let crud = SteedosUI.getClosestAmisComponentByType(scope, "crud");
|
|
3276
|
+
let crudService = crud && SteedosUI.getClosestAmisComponentByType(crud.context, "service");
|
|
3277
|
+
crudService && crudService.setData({isFieldsFilterEmpty, showFieldsFilter});
|
|
3264
3278
|
`;
|
|
3265
3279
|
const onCancelScript = `
|
|
3266
3280
|
const scope = event.context.scoped;
|
|
@@ -3299,12 +3313,9 @@
|
|
|
3299
3313
|
setTimeout(()=>{
|
|
3300
3314
|
window.dispatchEvent(new Event("resize"))
|
|
3301
3315
|
}, 100);
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3306
|
-
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3307
|
-
}
|
|
3316
|
+
// 移除搜索按钮上的红点
|
|
3317
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
3318
|
+
crudService && crudService.setData({isFieldsFilterEmpty: true, showFieldsFilter: false});
|
|
3308
3319
|
`;
|
|
3309
3320
|
const dataProviderInited = `
|
|
3310
3321
|
const objectName = data.objectName;
|
|
@@ -3357,17 +3368,11 @@
|
|
|
3357
3368
|
|| (_.isArray(n) && _.isEmpty(n.filter(function(item){return !_.isNil(item)})))
|
|
3358
3369
|
|| (_.isString(n) && n.length === 0);
|
|
3359
3370
|
});
|
|
3360
|
-
//
|
|
3371
|
+
// 有过滤条件时只显示搜索按钮上的红点,不自动展开搜索栏
|
|
3361
3372
|
if(!_.isEmpty(omitedEmptyFormValue)){
|
|
3362
|
-
let
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3366
|
-
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3367
|
-
}
|
|
3368
|
-
else{
|
|
3369
|
-
setData({ showFieldsFilter: true });
|
|
3370
|
-
}
|
|
3373
|
+
let crudService = SteedosUI.getRef(data.$scopeId).getComponentById("service_listview_" + data.objectName)
|
|
3374
|
+
crudService && crudService.setData({isFieldsFilterEmpty: false});
|
|
3375
|
+
// setData({ showFieldsFilter: true });//自动展开搜索栏
|
|
3371
3376
|
}
|
|
3372
3377
|
}
|
|
3373
3378
|
}
|
|
@@ -3633,7 +3638,10 @@
|
|
|
3633
3638
|
},
|
|
3634
3639
|
{
|
|
3635
3640
|
"actionType": "click",
|
|
3636
|
-
"componentId": btnSearchId
|
|
3641
|
+
"componentId": btnSearchId,
|
|
3642
|
+
"args": {
|
|
3643
|
+
"__from_fields_filter_settings_confirm": true
|
|
3644
|
+
}
|
|
3637
3645
|
},
|
|
3638
3646
|
{
|
|
3639
3647
|
"componentId": "",
|
|
@@ -4132,97 +4140,6 @@
|
|
|
4132
4140
|
async function getObjectRelatedListHeader(objectSchema, recordId, relatedObjectName) {
|
|
4133
4141
|
}
|
|
4134
4142
|
|
|
4135
|
-
const getExportExcelToolbarButtonSchema = ()=>{
|
|
4136
|
-
return {
|
|
4137
|
-
"type": "button",
|
|
4138
|
-
"icon": "fa fa-download",
|
|
4139
|
-
"align": "right",
|
|
4140
|
-
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
4141
|
-
"tooltipPlacement": "bottom",
|
|
4142
|
-
"visibleOn": "${!isLookup && global.user.is_space_admin}",
|
|
4143
|
-
"tooltip": i18next__default["default"].t('frontend_export_excel'),
|
|
4144
|
-
"onEvent": {
|
|
4145
|
-
"click": {
|
|
4146
|
-
"weight": 0,
|
|
4147
|
-
"actions": [
|
|
4148
|
-
{
|
|
4149
|
-
"args": {
|
|
4150
|
-
"api": {
|
|
4151
|
-
"url": "${context.rootUrl}/api/record/export/${objectName}",
|
|
4152
|
-
"method": "get",
|
|
4153
|
-
"messages": {},
|
|
4154
|
-
"requestAdaptor": `${requestAdaptor$1()}`,
|
|
4155
|
-
"data": {
|
|
4156
|
-
"uiSchema": "${uiSchema}",
|
|
4157
|
-
"listName": "${listName}"
|
|
4158
|
-
},
|
|
4159
|
-
"headers": {
|
|
4160
|
-
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
4161
|
-
}
|
|
4162
|
-
}
|
|
4163
|
-
},
|
|
4164
|
-
"actionType": "download"
|
|
4165
|
-
}
|
|
4166
|
-
]
|
|
4167
|
-
}
|
|
4168
|
-
}
|
|
4169
|
-
}
|
|
4170
|
-
};
|
|
4171
|
-
|
|
4172
|
-
function requestAdaptor$1(){
|
|
4173
|
-
return `
|
|
4174
|
-
// 获取列表视图的属性
|
|
4175
|
-
let uiSchema = api.body.uiSchema;
|
|
4176
|
-
let list_views = uiSchema.list_views;
|
|
4177
|
-
let list_views_name = api.body.listName;
|
|
4178
|
-
let col = list_views[list_views_name].columns;
|
|
4179
|
-
let sort_test = list_views[list_views_name].sort;
|
|
4180
|
-
|
|
4181
|
-
// 获取下载字段
|
|
4182
|
-
let select = [];
|
|
4183
|
-
_.each(col, (col) => {
|
|
4184
|
-
if (col.field == undefined)
|
|
4185
|
-
select.push(col);
|
|
4186
|
-
else select.push(col.field);
|
|
4187
|
-
});
|
|
4188
|
-
|
|
4189
|
-
// 获取排序字段
|
|
4190
|
-
|
|
4191
|
-
let sort = [];
|
|
4192
|
-
_.forEach(sort_test, (sortField) => {
|
|
4193
|
-
if (sortField.field_name == undefined)
|
|
4194
|
-
sort.push(sortField);
|
|
4195
|
-
else sort.push([sortField.field_name, sortField.order]);
|
|
4196
|
-
})
|
|
4197
|
-
|
|
4198
|
-
let orders = [];
|
|
4199
|
-
_.map(sort, (value) => {
|
|
4200
|
-
let order_tmp = [];
|
|
4201
|
-
if (value[1] == "desc")
|
|
4202
|
-
order_tmp = value[0] + ' desc';
|
|
4203
|
-
else
|
|
4204
|
-
order_tmp = value[0];
|
|
4205
|
-
orders.push(order_tmp);
|
|
4206
|
-
});
|
|
4207
|
-
let order = orders.join(',');
|
|
4208
|
-
|
|
4209
|
-
let filename = uiSchema.label + "-" + list_views[list_views_name].label;
|
|
4210
|
-
|
|
4211
|
-
url_tmp = api.url.split('?')[0];
|
|
4212
|
-
api.url = url_tmp + "?$select=" + select.toString() + "&filename=" + filename;
|
|
4213
|
-
|
|
4214
|
-
// 判断sort 和 filters
|
|
4215
|
-
if (sort.length > 0) {
|
|
4216
|
-
api.url += "&$orderby=" + order;
|
|
4217
|
-
}
|
|
4218
|
-
let filters = list_views[list_views_name].filters;
|
|
4219
|
-
if (filters && filters.length > 0) {
|
|
4220
|
-
api.url = api.url + "&filters=" + JSON.stringify(filters);
|
|
4221
|
-
}
|
|
4222
|
-
return api;
|
|
4223
|
-
`
|
|
4224
|
-
}
|
|
4225
|
-
|
|
4226
4143
|
const getNewListviewButtonSchema = ()=>{
|
|
4227
4144
|
return {
|
|
4228
4145
|
"type": "button",
|
|
@@ -4256,7 +4173,8 @@
|
|
|
4256
4173
|
"name":"",
|
|
4257
4174
|
"label":"",
|
|
4258
4175
|
"filters":"",
|
|
4259
|
-
"shared":false
|
|
4176
|
+
"shared":false,
|
|
4177
|
+
"object_name": "${targetObjectName}",
|
|
4260
4178
|
},
|
|
4261
4179
|
"fieldsExtend": fieldsExtend$4(),
|
|
4262
4180
|
"fields": fields$1(),
|
|
@@ -4303,13 +4221,11 @@
|
|
|
4303
4221
|
"object_name",
|
|
4304
4222
|
"filter_scope",
|
|
4305
4223
|
"show_count",
|
|
4306
|
-
"columns
|
|
4307
|
-
"
|
|
4308
|
-
"sort.$.field_name",
|
|
4309
|
-
"sort.$.order",
|
|
4224
|
+
"columns",
|
|
4225
|
+
"sort",
|
|
4310
4226
|
"filters",
|
|
4311
|
-
"mobile_columns
|
|
4312
|
-
"searchable_fields
|
|
4227
|
+
"mobile_columns",
|
|
4228
|
+
"searchable_fields",
|
|
4313
4229
|
"is_system",
|
|
4314
4230
|
"shared"
|
|
4315
4231
|
]
|
|
@@ -4322,7 +4238,8 @@
|
|
|
4322
4238
|
},
|
|
4323
4239
|
"name": {
|
|
4324
4240
|
"amis": {
|
|
4325
|
-
"hidden": true
|
|
4241
|
+
"hidden": true,
|
|
4242
|
+
"required": false
|
|
4326
4243
|
}
|
|
4327
4244
|
},
|
|
4328
4245
|
"object_name": {
|
|
@@ -4332,37 +4249,56 @@
|
|
|
4332
4249
|
},
|
|
4333
4250
|
"filter_scope": {
|
|
4334
4251
|
"amis": {
|
|
4335
|
-
"hidden": true
|
|
4252
|
+
"hidden": true,
|
|
4253
|
+
"required": false
|
|
4336
4254
|
}
|
|
4337
4255
|
},
|
|
4338
4256
|
"columns": {
|
|
4339
4257
|
"amis": {
|
|
4340
|
-
"hidden": true
|
|
4258
|
+
"hidden": true,
|
|
4259
|
+
"required": false
|
|
4260
|
+
}
|
|
4261
|
+
},
|
|
4262
|
+
"mobile_columns":{
|
|
4263
|
+
"amis": {
|
|
4264
|
+
"hidden": true,
|
|
4265
|
+
"required": false
|
|
4266
|
+
}
|
|
4267
|
+
},
|
|
4268
|
+
"searchable_fields":{
|
|
4269
|
+
"amis": {
|
|
4270
|
+
"hidden": true,
|
|
4271
|
+
"required": false
|
|
4341
4272
|
}
|
|
4342
4273
|
},
|
|
4343
4274
|
"filter_fields": {
|
|
4344
4275
|
"amis": {
|
|
4345
|
-
"hidden": true
|
|
4276
|
+
"hidden": true,
|
|
4277
|
+
"required": false
|
|
4346
4278
|
}
|
|
4347
4279
|
},
|
|
4348
4280
|
"scrolling_mode": {
|
|
4349
4281
|
"amis": {
|
|
4350
|
-
"hidden": true
|
|
4282
|
+
"hidden": true,
|
|
4283
|
+
"required": false
|
|
4351
4284
|
}
|
|
4352
4285
|
},
|
|
4353
4286
|
"sort": {
|
|
4354
4287
|
"amis": {
|
|
4355
|
-
"hidden": true
|
|
4288
|
+
"hidden": true,
|
|
4289
|
+
"required": false
|
|
4356
4290
|
}
|
|
4357
4291
|
},
|
|
4358
4292
|
"show_count": {
|
|
4359
4293
|
"amis": {
|
|
4360
|
-
"hidden": true
|
|
4294
|
+
"hidden": true,
|
|
4295
|
+
"required": false
|
|
4361
4296
|
}
|
|
4362
4297
|
},
|
|
4363
4298
|
"type": {
|
|
4364
4299
|
"amis": {
|
|
4365
|
-
"hidden": true
|
|
4300
|
+
"hidden": true,
|
|
4301
|
+
"required": false
|
|
4366
4302
|
}
|
|
4367
4303
|
},
|
|
4368
4304
|
"shared": {
|
|
@@ -5185,36 +5121,38 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
5185
5121
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
5186
5122
|
return n.props.type === "service";
|
|
5187
5123
|
});
|
|
5188
|
-
|
|
5124
|
+
let toShowFieldsFilter = !!!filterService.props.data.showFieldsFilter;
|
|
5125
|
+
filterService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5189
5126
|
let resizeWindow = function(){
|
|
5190
5127
|
//触发amis crud 高度重算
|
|
5191
5128
|
setTimeout(()=>{
|
|
5192
5129
|
window.dispatchEvent(new Event("resize"))
|
|
5193
5130
|
}, 500);
|
|
5194
5131
|
}
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
}
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
}
|
|
5132
|
+
resizeWindow();
|
|
5133
|
+
// 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5134
|
+
let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5135
|
+
crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
5136
|
+
// if(filterService.props.data.showFieldsFilter){
|
|
5137
|
+
// if(isMobile){
|
|
5138
|
+
// // 手机上只能通过取消按钮来关闭搜索栏
|
|
5139
|
+
// return;
|
|
5140
|
+
// }
|
|
5141
|
+
// let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
5142
|
+
// direction: "down",
|
|
5143
|
+
// name: "btn_filter_form_cancel"
|
|
5144
|
+
// });
|
|
5145
|
+
// buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
5146
|
+
// resizeWindow();
|
|
5147
|
+
// });
|
|
5148
|
+
// }
|
|
5149
|
+
// else{
|
|
5150
|
+
// if(isMobile){
|
|
5151
|
+
// // 手机端在显示搜索栏时隐藏crud上的刷新按钮,因为点击后crud高度显示有问题
|
|
5152
|
+
// let crudService = scope.getComponentById("service_listview_" + event.data.objectName);
|
|
5153
|
+
// crudService && crudService.setData({showFieldsFilter: true});
|
|
5154
|
+
// }
|
|
5155
|
+
// }
|
|
5218
5156
|
`;
|
|
5219
5157
|
|
|
5220
5158
|
|
|
@@ -5260,7 +5198,7 @@ else{
|
|
|
5260
5198
|
},
|
|
5261
5199
|
},
|
|
5262
5200
|
filterVisible ? {
|
|
5263
|
-
"label": "",
|
|
5201
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5264
5202
|
"icon": "fa fa-search",
|
|
5265
5203
|
"type": "button",
|
|
5266
5204
|
"tooltip": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
@@ -5312,13 +5250,24 @@ else{
|
|
|
5312
5250
|
"tooltipPlacement": "bottom",
|
|
5313
5251
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5314
5252
|
},
|
|
5315
|
-
getExportExcelToolbarButtonSchema(),
|
|
5253
|
+
// getExportExcelToolbarButtonSchema(),
|
|
5254
|
+
getSettingListviewToolbarButtonSchema(),
|
|
5255
|
+
getDisplayAsButton(showDisplayAs),
|
|
5316
5256
|
filterVisible ? {
|
|
5317
|
-
"label": "",
|
|
5257
|
+
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5318
5258
|
"icon": "fa fa-search",
|
|
5319
5259
|
"tooltip": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5320
5260
|
"tooltipPlacement": "bottom",
|
|
5321
5261
|
"type": "button",
|
|
5262
|
+
"badge": {
|
|
5263
|
+
"offset": [
|
|
5264
|
+
-5,
|
|
5265
|
+
1
|
|
5266
|
+
],
|
|
5267
|
+
"size":8,
|
|
5268
|
+
"animation": true,
|
|
5269
|
+
"visibleOn": "${isFieldsFilterEmpty == false}"
|
|
5270
|
+
},
|
|
5322
5271
|
"align": "right",
|
|
5323
5272
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5324
5273
|
"onEvent": {
|
|
@@ -5331,9 +5280,7 @@ else{
|
|
|
5331
5280
|
]
|
|
5332
5281
|
}
|
|
5333
5282
|
}
|
|
5334
|
-
} : {}
|
|
5335
|
-
getSettingListviewToolbarButtonSchema(),
|
|
5336
|
-
getDisplayAsButton(showDisplayAs)
|
|
5283
|
+
} : {}
|
|
5337
5284
|
// {
|
|
5338
5285
|
// "type": "search-box",
|
|
5339
5286
|
// "align": "right",
|
|
@@ -5963,6 +5910,58 @@ else{
|
|
|
5963
5910
|
"actions": [
|
|
5964
5911
|
{
|
|
5965
5912
|
"actionType": "reload"
|
|
5913
|
+
},
|
|
5914
|
+
{
|
|
5915
|
+
"actionType": "custom",
|
|
5916
|
+
"script": `
|
|
5917
|
+
const masterRecord = event.data._master?.record;
|
|
5918
|
+
const fieldConfig = ${JSON.stringify(field)};
|
|
5919
|
+
let reference_to = fieldConfig.reference_to;
|
|
5920
|
+
let saveValue;
|
|
5921
|
+
const newRecord = {
|
|
5922
|
+
_id: event.data.result.data.recordId,
|
|
5923
|
+
...event.data.__super.__super
|
|
5924
|
+
}
|
|
5925
|
+
const saveField = fieldConfig.reference_to_field || '_id';
|
|
5926
|
+
const saveFieldValue = newRecord[saveField];
|
|
5927
|
+
|
|
5928
|
+
if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){
|
|
5929
|
+
|
|
5930
|
+
const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};
|
|
5931
|
+
const baseSaveValue = {
|
|
5932
|
+
o: reference_to,
|
|
5933
|
+
ids: [saveFieldValue]
|
|
5934
|
+
};
|
|
5935
|
+
if(fieldValue && fieldValue.o){
|
|
5936
|
+
if(fieldValue.o === reference_to){
|
|
5937
|
+
saveValue = fieldConfig.multiple ? { o: reference_to, ids: fieldValue.ids.concat(saveFieldValue)} : baseSaveValue;
|
|
5938
|
+
}else{
|
|
5939
|
+
saveValue = baseSaveValue;
|
|
5940
|
+
}
|
|
5941
|
+
}else{
|
|
5942
|
+
saveValue = baseSaveValue;
|
|
5943
|
+
}
|
|
5944
|
+
|
|
5945
|
+
}else{
|
|
5946
|
+
if(fieldConfig.multiple){
|
|
5947
|
+
// TODO: 连续新建多个记录时,因为获取的主记录不是实时的,所以只会勾选最后一个新建的记录。
|
|
5948
|
+
const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];
|
|
5949
|
+
saveValue = fieldValue.concat(saveFieldValue);
|
|
5950
|
+
}else{
|
|
5951
|
+
saveValue = saveFieldValue;
|
|
5952
|
+
}
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5955
|
+
const ctx = ${JSON.stringify(ctx)};
|
|
5956
|
+
const componentId = ctx.defaults.formSchema.id ? 'service-'+ctx.defaults.formSchema.id : 'new-'+ctx.defaults.formSchema.objectApiName;
|
|
5957
|
+
doAction({
|
|
5958
|
+
actionType: 'setValue',
|
|
5959
|
+
componentId: componentId,
|
|
5960
|
+
args: {
|
|
5961
|
+
value: { [fieldConfig.name]: saveValue }
|
|
5962
|
+
}
|
|
5963
|
+
});
|
|
5964
|
+
`
|
|
5966
5965
|
}
|
|
5967
5966
|
]
|
|
5968
5967
|
};
|
|
@@ -6193,7 +6192,7 @@ else{
|
|
|
6193
6192
|
type: 'steedos-field-lookup',
|
|
6194
6193
|
field,
|
|
6195
6194
|
readonly,
|
|
6196
|
-
ctx
|
|
6195
|
+
ctx,
|
|
6197
6196
|
}
|
|
6198
6197
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
6199
6198
|
}
|
|
@@ -6347,8 +6346,8 @@ else{
|
|
|
6347
6346
|
/*
|
|
6348
6347
|
* @Author: baozhoutao@steedos.com
|
|
6349
6348
|
* @Date: 2023-01-13 17:27:54
|
|
6350
|
-
* @LastEditors:
|
|
6351
|
-
* @LastEditTime: 2023-
|
|
6349
|
+
* @LastEditors: liaodaxue
|
|
6350
|
+
* @LastEditTime: 2023-06-16 15:58:21
|
|
6352
6351
|
* @Description:
|
|
6353
6352
|
*/
|
|
6354
6353
|
|
|
@@ -6400,6 +6399,7 @@ else{
|
|
|
6400
6399
|
}else {
|
|
6401
6400
|
return {
|
|
6402
6401
|
"type": "input-rich-text",
|
|
6402
|
+
"receiver": "${context.rootUrl}/s3/images",
|
|
6403
6403
|
"name": field.name
|
|
6404
6404
|
}
|
|
6405
6405
|
// return {
|
|
@@ -7686,7 +7686,10 @@ else{
|
|
|
7686
7686
|
level: "link",
|
|
7687
7687
|
actionType: "link",
|
|
7688
7688
|
link: url,
|
|
7689
|
-
innerClassName:
|
|
7689
|
+
innerClassName: {
|
|
7690
|
+
"steedos-listview-item block text-gray-500":"true",
|
|
7691
|
+
"max-w-[360px]": "${display == 'split'}",
|
|
7692
|
+
},
|
|
7690
7693
|
body: {
|
|
7691
7694
|
"type": "wrapper",
|
|
7692
7695
|
"body": columnLines,
|
|
@@ -9583,6 +9586,8 @@ else{
|
|
|
9583
9586
|
};
|
|
9584
9587
|
if(formSchema.id){
|
|
9585
9588
|
amisSchema.id = `service-${formSchema.id}`;
|
|
9589
|
+
}else {
|
|
9590
|
+
amisSchema.id = `new-${objectSchema.name}`;
|
|
9586
9591
|
}
|
|
9587
9592
|
return amisSchema;
|
|
9588
9593
|
}
|