简体中文
FxDuplicateTool
约 575 字大约 2 分钟
2025-12-16
用于展示查重工具的数据列表。
Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| dToolParams | 查重工具默认支持的参数 | Object | - | - |
| dToolParams.isOverwrite | 是否覆盖查重工具操作区域 | Boolean | - | - |
| dToolParams.apiname | 查重工具指定对象 | String | - | - |
| dToolParams.autoDuplicate | 打开查重工具自动查询 | Boolean | - | - |
| dToolParams.beforeInitTable | 查询后 & 表格渲染前的事件 | Boolean | - | - |
Methods
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| mOperateAction | 表格每一列点击操作按钮的回调 | Function | - | - |
| toolChange | 查重对象切换时的回调 | Function | - | - |
简单使用
组件通过 FxUI.component.get('DuplicateTool') 获取。
下面的效果是传入对象name的值,默认自动查询的效果
<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>组件扩展
为了满足企业定制化的需求,这里我们为开发者提供了一些扩展方式,能够快速开发出相应功能。
钩子
查重工具在渲染时会提供能操作表格渲染的结果的函数,在这里能重写表格内容达到想要的效果,例如下面重写 “领取” “共享” 按钮 把结果通过自定义函数上传
<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:;">领取</a>`
const share = `<a data-action="operate" data-operate="share" style="margin-right: 10px" class="j-duplicate-action" href="javascript:;">共享</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>