English
FxDuplicateTool
About 428 wordsAbout 1 min
2025-12-16
Used to display the data list of the duplicate-checking tool.
Attributes
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| dToolParams | Parameters supported by the duplicate-checking tool by default | Object | - | - |
| dToolParams.isOverwrite | Whether to overwrite the operation area of the duplicate-checking tool | Boolean | - | - |
| dToolParams.apiname | Object specified by the duplicate-checking tool | String | - | - |
| dToolParams.autoDuplicate | Whether to auto-query when opening the duplicate-checking tool | Boolean | - | - |
| dToolParams.beforeInitTable | Event triggered after query and before table rendering | Boolean | - | - |
Methods
| Parameter | Description | Type | Optional Values | Default |
|---|---|---|---|---|
| mOperateAction | Callback for clicking action buttons in each table column | Function | - | - |
| toolChange | Callback when switching the duplicate-checking object | Function | - | - |
Basic Usage
The component is obtained through FxUI.component.get('DuplicateTool').
The effect below shows passing in the value of the object name and enabling automatic query by default.
<template>
<duplicate-tool :toolParams="dToolParams"/>
</template>
<script>
export default {
props: ['data'],
data() {
return {
dToolParams: {
apiname: this.data.objectAPIName,
autoDuplicate: true,
fieldsBackfill: [{field_name:'name',field_values: this.data.objectData.name }]
}
}
},
components: {
DuplicateTool: FxUI.component.get('DuplicateTool'),
}
}
</script>Component Extension
To meet enterprise customization needs, the component provides several extension methods that allow developers to quickly build corresponding functions.
Hooks
When the duplicate-checking tool renders, it provides functions that can manipulate the rendered table result. Here you can overwrite the table content to achieve the desired effect. For example, the Receive and Share buttons below are rewritten and the result is uploaded through a custom function.
<template>
<div>
<duplicate-tool @operateAction="mOperateAction" @toolChange="mToolChange" :toolParams="dToolParams"/>
</div>
</template>
<script>
export default {
props:["userData"],
components: {
DuplicateTool: FxUI.component.get('DuplicateTool'),
},
data() {
return {
status: 0,
currentObject: '',
dToolParams: {
isOverwrite: true,
beforeInitTable: this.beforeInitTable
}
}
},
methods: {
beforeInitTable(options) {
const receive = `<a data-action="operate" data-operate="receive" style="margin-right: 10px" class="j-duplicate-action" href="javascript:;">Receive</a>`
const share = `<a data-action="operate" data-operate="share" style="margin-right: 10px" class="j-duplicate-action" href="javascript:;">Share</a>`
options.columns.forEach(option => {
if(option.data === 'handle') {
option.render = (data, type, full) => {
if(this.currentObject === 'ContactObj' || this.currentObject === 'AccountObj') {
if(this.status == 1) {
return `${receive}${share}`
} else if (this.status == 2) {
return `${receive}`
} else if (this.status == 3) {
return `${share}`
} else {
return ``
}
} else {
return ``
}
}
}
});
return options
},
mOperateAction(type, data) {
const params = [{
type: 'Map',
name: 'account',
value: data
},{
type: 'String',
name: 'userId',
value: FxUI.organization.getCurrentEmeployee().id
},{
type: 'String',
name: 'objName',
value: this.currentObject
}]
const apiName = type == 'receive' ? 'func_2Sig1__c' : type == 'share' ? 'func_Vl5XN__c' : null
apiName
&& FxUI.userDefine.call_controller(apiName, params).then((res) => {
if(res.Result.StatusCode == 0) {
const { Value } = res;
if(Value.success) {
this.$message({ showClose: true, message: Value.functionResult.errorMessage, type: 'success' })
} else {
this.$message({ showClose: true, message: Value.errorInfo, type: 'error' })
}
}
}).catch(err => {
this.$message({ showClose: true, message: err, type: 'error' })
})
},
mToolChange(opts) {
this.currentObject = opts.apiname
}
}
}
</script>