MENU

[泛微Ecology10] 丸子的 E10 小本本

• 2025 年 11 月 14 日 • 阅读: 1833 • OA

  1. 检查表单在打开后数据是否存在变更:
window.WeaForm.getDataStatus();
  1. 无刷(静默)保存:formSdk.weFormApi.formStore.submitFormData();
  2. 获取整个表单数据: formSdk.weFormApi.formStore.getFormData().dataDetails;
  3. 图片上传字段单图片上传样式优化(最新版本:10.0.2512.01基线做了该优化处理):
.ui-upload-line-of-row > div:nth-child(1):nth-last-child(2) {
  display: none !important ;
}

.ui-upload:has(.ui-upload-listT) .ui-upload-select-image {
  display: none !important;
}
优化前优化后
image.pngimage.png
  1. ESB调用
const ebSdk=window.ebuilderSDK;
ebSdk.callEsbFlow("1991410702295896092",{dept:"taet"},[]).then(res=>{/*动作流回调逻辑*/});
// 1. 构造请求参数
const requestData = {
    customParams: {
        mainTable: {
            requestId: requestId
        }
    },
    esbFlowId: "1981608218199199750"
};

// 2. 发送POST请求到ESB接口
fetch('/api/esb/server/event/triggerActionFlow', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(requestData)
})
.then((response) => {
    // 3. 解析响应JSON(捕获HTTP错误状态)
    if (!response.ok) {
        throw new Error(`HTTP错误!状态码:${response.status}`);
    }
    return response.json();
})
.then((data) => {
    // 4. 请求成功回调
    console.log('ESB流程触发成功:', data);
    // wffpSdk.showMessage('触发流程成功', 1, 3); // 成功提示(按需启用)
})
.catch((error) => {
    // 5. 异常捕获(网络错误/HTTP错误/解析错误)
    console.error('ESB流程触发失败:', error);
    wffpSdk.showMessage('触发刷新合同失败', 2, 3); // 失败提示
});
  1. 下拉字段显示值 键值关系 表单自定义字段选项表 field_option
  2. 自定义弹窗
    image.png
weappUi.Dialog.confirm({
    title: 'Notification',
    content: React.createElement('div', { style: { lineHeight: '1.6' } },
        React.createElement('div', { style: { fontWeight: 'bold' } }, 'Your template has been applied successfully.'),
        React.createElement('div', { style: { marginTop: '8px' } }, 'Please go to the Edit or View (Letter to Approve) page to edit your letter content.'),
        React.createElement('div', { style: { marginTop: '12px', fontSize: '12px', color: '#666', borderTop: '1px dashed #eee', paddingTop: '8px' } }, 
            'Note: If an incorrect template was selected, click [Generate Letter] to re-apply.'
        )
    ),
    icon: 'Icon-correct02-mcolor',
    cancelText: 'Got it',
    hideOkBtn: true,
    onCancel: () => console.log('Acknowledged')
});
  1. 当前人员id:TEAMS.currentUser.id
  2. 另一种alert弹窗
window.ebuilderSDK.alert(
  <div><div>AD mapping not found for the current user. Unable to synchronize Active Directory information.</div></div>, 
  {
    mask: true,
    title: "AD Mapping Notice",
    okText: "OK",
    onOk: () => ebSdk.closePage(),
    onCancel: () => ebSdk.closePage()
  }
);
  1. 待整理 :你们有没有表单加载完成操作DOM的js,整个页面渲染完成的动作怎么取到的,有佬知道吗
    没找到标准,因为React机制问题,渲染是在页面加载完成之后
    ,我去试一下字段渲染sdk方案,我去试试,突然想到
    formready 这个表单完成,但是dom没完成
    React的问题,当然React解决啦~
    formSdk.afterFieldComp(
    fieldMark,
    React.createElement(() => {

     // 组件挂载时执行
     React.useEffect(() => {
         console.log("多行文本组件渲染/追加完成了!执行你的函数...");
         // 在这里调用你的函数
     }, []);
    
     return null; // 重点:返回 null,不渲染任何 div 或内容到页面上

    })
    );

最后编辑于: 2026 年 05 月 28 日