Skip to main content

Split multiple values of child table member components and fill them into other forms

1. Usage scenarios

When there are member components in the subform, when the component selects multiple values when submitting data, the data is split and filled into another form as a single piece of data.

2. Video Display

此处为语雀视频卡片,点击链接查看:王德家-成员组件多选拆分.mp4.crdownload.mp4

3. Procedure

3.1 Step 1: Create a form and configure it

Create two new forms, where table A is used as A data table and table B is used as A data fill table.

3.1.1 create and configure Table A

As shown in the following figure:

Create and configure form A

3.1.2 create and configure form B

As shown in the following figure:

Create and configure form B

(1) configure the interface to obtain the instance details of Table A

For more information about the YIDA interface, go to the following steps:Search the list of form instance IDs based on criteria.

Add a remote data source

(2) code setting interface parameters, data processing, and data filling

Bind events through JS panel

The following code can be copied and used,Please note the replacement of component unique identifier and form unique identifier!

export function onChange({value, actionType, item}) {
let val = this.$("selectField_kqbq76t1").getValue();
let params = {
"formUuid":"FORM-0P966T61TXARO4WVZZQGSLJ549LV11U44QBQK7",
"searchFieldJson":JSON.stringify({
"textField_kqbq48w7":val
})
}
let newobj = {};
let newarr = [];
this.dataSourceMap.getdata.load(params).then(res=>{ //调用数据源,获取数据
//对返回的数据进行数据处理
const arr = res.data;
for (let i = 0; i < arr[0].formData.tableField_kqbq48w6[0].employeeField_kqbq48w8.length;i++){
newobj.label = arr[0].formData.tableField_kqbq48w6[0].employeeField_kqbq48w8[i];
newobj.value = arr[0].formData.tableField_kqbq48w6[0].employeeField_kqbq48w8_id[i];
newarr.push({...newobj});
}
let newValue = newarr.map(item=>{
return {
"employeeField_kqbq55dc":item
}
})
//将数据赋值给子表单
this.$("tableField_kqbq55db").setValue(newValue);
})
}

-------------------------- Get the latest information YIDA, welcome to follow US-------------------------


This doc is generated using machine translation. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes.
Copyright © 2024钉钉(中国)信息技术有限公司和/或其关联公司浙ICP备18037475号-4