Custom Component Field Service
Get Current Form or Current Row Record
javascript
customFieldService.getRecord()Return Value Promise<Record>
javascript
customFieldService.getRecord().then(record => {
console.log(record);
});Get Field Information Bound to Custom Component Field
javascript
customFieldService.getField()Return Value Promise<Field>
javascript
customFieldService.getField().then(field => {
console.log(field);
});Get Data Table Module Information Where Current Field is Located
javascript
customFieldService.getTableInfo()Return Value Promise<TableInfo>
javascript
customFieldService.getTableInfo().then(tableInfo => {
console.log(tableInfo);
});Set Field Value in Form
javascript
customFieldService.setFieldValue(args)| Parameter | Type | Description |
|---|---|---|
| args | FieldValueParam | Field and data to be set |
FieldValueParam structure is as follows
| Parameter | Type | Description |
|---|---|---|
| field | String | Field to be set |
| value | Object | Data to be set |
javascript
customFieldService.setFieldValue({
field:'age',
value:20
});Usage Instructions
- Fields not displayed in the form can also be assigned values through this method (they will be automatically saved when saving)
- In form edit pages, if the form field storage mode is save after modifying a single field, then when setting list-type (associated list, child object, lookup list) field values and the field is hidden, this operation will fail, and you need to call automated data changes yourself
- In form creation pages, form storage modes are not distinguished
- Values are set in overwrite mode, so when setting list-type (associated list, child object, lookup list) field values, you need to first get the current value corresponding to the field in the form. Merge the current value with the changed value before setting it back to the form field
Get Whether Field with Identifier field in Current Form is Editable
javascript
customFieldService.isFieldEditable(field)| Parameter | Type | Description |
|---|---|---|
| field | String | Field identifier |
Return Value Promise<Boolean>
javascript
customFieldService.isFieldEditable('age').then(editable=>{
console.log('age',editable);
});Get Whether Field with Identifier field in Current Form is Visible
javascript
customFieldService.isFieldVisible(field)| Parameter | Type | Description |
|---|---|---|
| field | String | Field identifier |
Return Value Promise<Boolean>
javascript
customFieldService.isFieldVisible('age').then(visible=>{
console.log('age',visible);
});Set Form to Display Loading State
Usage Instructions
The loading state between multiple custom component fields in the form is recorded independently; after using customFieldService.showLoading() within a field, you must use customFieldService.hideLoading() to hide the form loading state
javascript
customFieldService.showLoading()Return Value Promise<void>
javascript
customFieldService.showLoading();Set Form to Hide Loading State
javascript
customFieldService.hideLoading()Return Value Promise<void>
javascript
customFieldService.hideLoading();
