@steedos-widgets/amis-object 3.6.2-beta.2 → 3.6.2-beta.4
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-object.cjs.js +156 -50
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +156 -50
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +56 -15
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -6580,6 +6580,18 @@ function getBatchDelete(objectName){
|
|
|
6580
6580
|
return {
|
|
6581
6581
|
method: 'post',
|
|
6582
6582
|
url: getApi$2(),
|
|
6583
|
+
adaptor: `
|
|
6584
|
+
if(payload.errors){
|
|
6585
|
+
payload.data.deleteErrorMessage = [];
|
|
6586
|
+
payload.errors.forEach(function(error){
|
|
6587
|
+
let errorRecord = error.path.map(function (item) {
|
|
6588
|
+
return item.split('delete__')[1].to_float() + 1;
|
|
6589
|
+
}).toString();
|
|
6590
|
+
payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
|
|
6591
|
+
})
|
|
6592
|
+
}
|
|
6593
|
+
return payload;
|
|
6594
|
+
`,
|
|
6583
6595
|
requestAdaptor: `
|
|
6584
6596
|
var ids = api.data.ids.split(",");
|
|
6585
6597
|
var deleteArray = [];
|
|
@@ -11276,7 +11288,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11276
11288
|
// ]
|
|
11277
11289
|
if(options.displayAs === 'split'){
|
|
11278
11290
|
return [
|
|
11279
|
-
|
|
11291
|
+
{
|
|
11292
|
+
"type": "switch-per-page",
|
|
11293
|
+
"visibleOn": "${count >= 20}"
|
|
11294
|
+
},
|
|
11280
11295
|
{
|
|
11281
11296
|
"type": "pagination",
|
|
11282
11297
|
"maxButtons": 5,
|
|
@@ -11298,7 +11313,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11298
11313
|
else {
|
|
11299
11314
|
if(options && options.isRelated){
|
|
11300
11315
|
return [
|
|
11301
|
-
"statistics",
|
|
11302
11316
|
{
|
|
11303
11317
|
"type": "pagination",
|
|
11304
11318
|
"maxButtons": 10,
|
|
@@ -11311,7 +11325,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11311
11325
|
const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
|
|
11312
11326
|
const is_lookup = options.isLookup;
|
|
11313
11327
|
const commonConfig = [
|
|
11314
|
-
"statistics",
|
|
11315
11328
|
{
|
|
11316
11329
|
"type": "pagination",
|
|
11317
11330
|
"maxButtons": 10,
|
|
@@ -11322,7 +11335,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
|
|
|
11322
11335
|
if (no_pagination && is_lookup) {
|
|
11323
11336
|
return commonConfig;
|
|
11324
11337
|
} else {
|
|
11325
|
-
return [
|
|
11338
|
+
return [{
|
|
11339
|
+
"type": "switch-per-page",
|
|
11340
|
+
"visibleOn": "${count >= 20}"
|
|
11341
|
+
}, ...commonConfig];
|
|
11326
11342
|
}
|
|
11327
11343
|
}
|
|
11328
11344
|
}
|
|
@@ -11430,6 +11446,29 @@ function getBulkActions(objectSchema){
|
|
|
11430
11446
|
"className": "hidden",
|
|
11431
11447
|
"id": "batchDelete",
|
|
11432
11448
|
"api": getBatchDelete(objectSchema.name),
|
|
11449
|
+
"feedback": {
|
|
11450
|
+
"title": "删除警告",
|
|
11451
|
+
"visibleOn": "${deleteErrorMessage}",
|
|
11452
|
+
"body": [
|
|
11453
|
+
{
|
|
11454
|
+
"type": "each",
|
|
11455
|
+
"name": "deleteErrorMessage",
|
|
11456
|
+
"items": {
|
|
11457
|
+
"type": "alert",
|
|
11458
|
+
"body": "${item}",
|
|
11459
|
+
"level": "danger",
|
|
11460
|
+
"className": "mb-3"
|
|
11461
|
+
}
|
|
11462
|
+
}
|
|
11463
|
+
],
|
|
11464
|
+
"actions": [
|
|
11465
|
+
{
|
|
11466
|
+
"type": "button",
|
|
11467
|
+
"actionType": "close",
|
|
11468
|
+
"label": "关闭"
|
|
11469
|
+
}
|
|
11470
|
+
]
|
|
11471
|
+
}
|
|
11433
11472
|
}
|
|
11434
11473
|
// {
|
|
11435
11474
|
// "label": "批量修改",
|
|
@@ -15882,8 +15921,8 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
15882
15921
|
/*
|
|
15883
15922
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
15884
15923
|
* @Date: 2023-11-15 09:50:22
|
|
15885
|
-
* @LastEditors:
|
|
15886
|
-
* @LastEditTime: 2024-01-
|
|
15924
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15925
|
+
* @LastEditTime: 2024-01-14 21:08:32
|
|
15887
15926
|
*/
|
|
15888
15927
|
|
|
15889
15928
|
/**
|
|
@@ -16032,7 +16071,12 @@ function getFormPagination(props, mode) {
|
|
|
16032
16071
|
let currentIndex = event.data.index;
|
|
16033
16072
|
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
16034
16073
|
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
16035
|
-
|
|
16074
|
+
if(event.data.parent){
|
|
16075
|
+
fieldValue[event.data.__parentIndex].children[currentIndex] = currentFormValues;
|
|
16076
|
+
}
|
|
16077
|
+
else{
|
|
16078
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16079
|
+
}
|
|
16036
16080
|
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
16037
16081
|
doAction({
|
|
16038
16082
|
"componentId": "${props.id}",
|
|
@@ -16099,7 +16143,8 @@ function getFormPagination(props, mode) {
|
|
|
16099
16143
|
},
|
|
16100
16144
|
{
|
|
16101
16145
|
"type": "tpl",
|
|
16102
|
-
|
|
16146
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16147
|
+
"tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
|
|
16103
16148
|
},
|
|
16104
16149
|
{
|
|
16105
16150
|
"type": "button",
|
|
@@ -16107,7 +16152,9 @@ function getFormPagination(props, mode) {
|
|
|
16107
16152
|
"icon": `fa fa-angle-right`,
|
|
16108
16153
|
"level": "link",
|
|
16109
16154
|
"pageChangeDirection": "next",
|
|
16110
|
-
"disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16155
|
+
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
16156
|
+
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
16157
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
|
|
16111
16158
|
"size": "sm",
|
|
16112
16159
|
"id": buttonNextId,
|
|
16113
16160
|
"onEvent": {
|
|
@@ -16140,7 +16187,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16140
16187
|
"data": {
|
|
16141
16188
|
// 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16142
16189
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16143
|
-
"&": "${__tableItems[__super.index]}"
|
|
16190
|
+
"&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
|
|
16144
16191
|
}
|
|
16145
16192
|
});
|
|
16146
16193
|
let formBody = [
|
|
@@ -16163,6 +16210,10 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16163
16210
|
}
|
|
16164
16211
|
];
|
|
16165
16212
|
let onServiceInitedScript = `
|
|
16213
|
+
if(event.data.parent){
|
|
16214
|
+
// 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
|
|
16215
|
+
event.data.__parentIndex = _.findIndex(event.data.__tableItems, {_id: event.data.parent._id});
|
|
16216
|
+
}
|
|
16166
16217
|
// 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
|
|
16167
16218
|
// 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
|
|
16168
16219
|
// 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
|
|
@@ -16218,6 +16269,7 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
16218
16269
|
// "body": formBody,
|
|
16219
16270
|
"data": {
|
|
16220
16271
|
"__page": "${index + 1}",
|
|
16272
|
+
"__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
|
|
16221
16273
|
// "__total": `\${${props.name}.length}`,
|
|
16222
16274
|
// "__total": "${__tableItems.length}",
|
|
16223
16275
|
// "__paginationServiceId": serviceId,
|
|
@@ -16265,7 +16317,17 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
16265
16317
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16266
16318
|
//这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
|
|
16267
16319
|
// 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
|
|
16268
|
-
fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16320
|
+
// fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
|
|
16321
|
+
var currentIndex = event.data.__super.__super.index;
|
|
16322
|
+
var currentFormValues = JSON.parse(JSON.stringify(event.data));
|
|
16323
|
+
var parent = event.data.__super.__super.parent;
|
|
16324
|
+
var __parentIndex = event.data.__super.__super.__parentIndex;
|
|
16325
|
+
if(parent){
|
|
16326
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
16327
|
+
}
|
|
16328
|
+
else{
|
|
16329
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
16330
|
+
}
|
|
16269
16331
|
doAction({
|
|
16270
16332
|
"componentId": "${props.id}",
|
|
16271
16333
|
"actionType": "setValue",
|
|
@@ -16405,7 +16467,14 @@ async function getButtonActions(props, mode) {
|
|
|
16405
16467
|
let scope = event.context.scoped;
|
|
16406
16468
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16407
16469
|
// 新建一条空白行并保存到子表组件
|
|
16408
|
-
|
|
16470
|
+
var parent = event.data.__super.parent;
|
|
16471
|
+
var __parentIndex = parent && _.findIndex(fieldValue, {_id: parent._id});
|
|
16472
|
+
if(parent){
|
|
16473
|
+
fieldValue[__parentIndex].children.push({});
|
|
16474
|
+
}
|
|
16475
|
+
else{
|
|
16476
|
+
fieldValue.push({});
|
|
16477
|
+
}
|
|
16409
16478
|
doAction({
|
|
16410
16479
|
"componentId": "${props.id}",
|
|
16411
16480
|
"actionType": "setValue",
|
|
@@ -16417,7 +16486,13 @@ async function getButtonActions(props, mode) {
|
|
|
16417
16486
|
let __paginationServiceId = "${formPaginationId}";
|
|
16418
16487
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16419
16488
|
event.data.index = __paginationData.index;
|
|
16420
|
-
|
|
16489
|
+
if(parent){
|
|
16490
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16491
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
16492
|
+
}
|
|
16493
|
+
else{
|
|
16494
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16495
|
+
}
|
|
16421
16496
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16422
16497
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16423
16498
|
`;
|
|
@@ -16428,7 +16503,15 @@ async function getButtonActions(props, mode) {
|
|
|
16428
16503
|
let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
|
|
16429
16504
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
16430
16505
|
// 复制当前页数据到新建行并保存到子表组件
|
|
16431
|
-
fieldValue.push(newItem);
|
|
16506
|
+
// fieldValue.push(newItem);
|
|
16507
|
+
var parent = event.data.__super.parent;
|
|
16508
|
+
var __parentIndex = parent && _.findIndex(fieldValue, {_id: parent._id});
|
|
16509
|
+
if(parent){
|
|
16510
|
+
fieldValue[__parentIndex].children.push(newItem);
|
|
16511
|
+
}
|
|
16512
|
+
else{
|
|
16513
|
+
fieldValue.push(newItem);
|
|
16514
|
+
}
|
|
16432
16515
|
doAction({
|
|
16433
16516
|
"componentId": "${props.id}",
|
|
16434
16517
|
"actionType": "setValue",
|
|
@@ -16440,7 +16523,14 @@ async function getButtonActions(props, mode) {
|
|
|
16440
16523
|
let __paginationServiceId = "${formPaginationId}";
|
|
16441
16524
|
let __paginationData = scope.getComponentById(__paginationServiceId).getData();
|
|
16442
16525
|
event.data.index = __paginationData.index;
|
|
16443
|
-
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16526
|
+
// event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16527
|
+
if(parent){
|
|
16528
|
+
event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16529
|
+
event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
|
|
16530
|
+
}
|
|
16531
|
+
else{
|
|
16532
|
+
event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
|
|
16533
|
+
}
|
|
16444
16534
|
// 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
|
|
16445
16535
|
scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
|
|
16446
16536
|
`;
|
|
@@ -16516,13 +16606,15 @@ async function getButtonActions(props, mode) {
|
|
|
16516
16606
|
"_master": "${_master}",
|
|
16517
16607
|
"global": "${global}",
|
|
16518
16608
|
"uiSchema": "${uiSchema}",
|
|
16519
|
-
"index": "${index}"
|
|
16609
|
+
"index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
|
|
16610
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16520
16611
|
// "__tableItems": `\${${props.name}}`
|
|
16521
16612
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16522
16613
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16523
16614
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16524
|
-
|
|
16525
|
-
|
|
16615
|
+
// 这里加__super.__super是因为要让映射到准确的作用域层,如果不加,在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组
|
|
16616
|
+
"__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16617
|
+
},
|
|
16526
16618
|
"actions": dialogButtons,
|
|
16527
16619
|
"onEvent": {
|
|
16528
16620
|
"confirm": {
|
|
@@ -16544,35 +16636,39 @@ async function getButtonActions(props, mode) {
|
|
|
16544
16636
|
Object.assign(actionShowEditDialog.dialog, props.dialog);
|
|
16545
16637
|
}
|
|
16546
16638
|
if (mode == "new") {
|
|
16547
|
-
`
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16569
|
-
|
|
16570
|
-
|
|
16571
|
-
|
|
16572
|
-
|
|
16573
|
-
|
|
16574
|
-
|
|
16575
|
-
`;
|
|
16639
|
+
// let onNewLineScript = `
|
|
16640
|
+
// let newItem = {};
|
|
16641
|
+
// if(event.data["${props.name}"]){
|
|
16642
|
+
// // let fieldValue = event.data.__tableItems;
|
|
16643
|
+
// // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
|
|
16644
|
+
// // let fieldValue = _.clone(event.data["${props.name}"]);
|
|
16645
|
+
// let fieldValue = event.data["${props.name}"];
|
|
16646
|
+
// fieldValue.push(newItem);
|
|
16647
|
+
// doAction({
|
|
16648
|
+
// "componentId": "${props.id}",
|
|
16649
|
+
// "actionType": "setValue",
|
|
16650
|
+
// "args": {
|
|
16651
|
+
// "value": fieldValue
|
|
16652
|
+
// }
|
|
16653
|
+
// });
|
|
16654
|
+
// event.data.index = fieldValue.length - 1;
|
|
16655
|
+
// }
|
|
16656
|
+
// else{
|
|
16657
|
+
// // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
|
|
16658
|
+
// doAction({
|
|
16659
|
+
// "componentId": "${props.id}",
|
|
16660
|
+
// "actionType": "setValue",
|
|
16661
|
+
// "args": {
|
|
16662
|
+
// "value": [newItem]
|
|
16663
|
+
// }
|
|
16664
|
+
// });
|
|
16665
|
+
// event.data.index = 1;
|
|
16666
|
+
// }
|
|
16667
|
+
// `;
|
|
16668
|
+
// let actionNewLine = {
|
|
16669
|
+
// "actionType": "custom",
|
|
16670
|
+
// "script": onNewLineScript
|
|
16671
|
+
// };
|
|
16576
16672
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
16577
16673
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
16578
16674
|
actions = [actionShowEditDialog];
|
|
@@ -16607,15 +16703,17 @@ async function getButtonActions(props, mode) {
|
|
|
16607
16703
|
// 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
|
|
16608
16704
|
// "__parentForm": "${__super.__super || {}}",
|
|
16609
16705
|
"__parentForm": parentFormData,
|
|
16706
|
+
"_master": "${_master}",
|
|
16610
16707
|
"global": "${global}",
|
|
16611
16708
|
"uiSchema": "${uiSchema}",
|
|
16612
16709
|
"index": "${index}",
|
|
16710
|
+
"parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
|
|
16613
16711
|
// "__tableItems": `\${${props.name}}`
|
|
16614
16712
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
16615
16713
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
16616
16714
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
16617
|
-
"__tableItems": `\${(
|
|
16618
|
-
|
|
16715
|
+
"__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
16716
|
+
},
|
|
16619
16717
|
}
|
|
16620
16718
|
}
|
|
16621
16719
|
];
|
|
@@ -16631,7 +16729,15 @@ async function getButtonActions(props, mode) {
|
|
|
16631
16729
|
// 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
|
|
16632
16730
|
// 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
|
|
16633
16731
|
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
|
|
16634
|
-
|
|
16732
|
+
var currentIndex = event.data.index;
|
|
16733
|
+
var parent = event.data.__super.parent;
|
|
16734
|
+
var __parentIndex = parent && _.findIndex(lastestFieldValue, {_id: parent._id});
|
|
16735
|
+
if(parent){
|
|
16736
|
+
lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
|
|
16737
|
+
}
|
|
16738
|
+
else{
|
|
16739
|
+
lastestFieldValue.splice(currentIndex, 1);
|
|
16740
|
+
}
|
|
16635
16741
|
doAction({
|
|
16636
16742
|
"componentId": "${props.id}",
|
|
16637
16743
|
"actionType": "setValue",
|