本文摘要
汇总泛微Ecology10前端二开常见技巧,涵盖表单数据状态检查、静默保存与数据获取、图片上传样式优化、ESB动作流调用、自定义弹窗及当前用户信息获取等。针对表单渲染后操作DOM的时机问题,给出基于React字段组件的处理思路,并记录矩阵维护入口、组织日志表与报表空白滚动优化方法,适合E10开发人员查阅。
- 检查表单在打开后数据是否存在变更:
window.WeaForm.getDataStatus();- 无刷(静默)保存:
formSdk.weFormApi.formStore.submitFormData(); - 获取整个表单数据:
formSdk.weFormApi.formStore.getFormData().dataDetails; - 图片上传字段单图片上传样式优化(最新版本: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;}| 优化前 | 优化后 |
|---|---|
![]() | ![]() |
- 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); // 失败提示});- 下拉字段显示值 键值关系 表单自定义字段选项表
field_option - 自定义弹窗

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')});- 当前人员id:
TEAMS.currentUser.id - 另一种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() });- 待整理 :你们有没有表单加载完成操作DOM的js,整个页面渲染完成的动作怎么取到的,有佬知道吗 没找到标准,因为React机制问题,渲染是在页面加载完成之后 ,我去试一下字段渲染sdk方案,我去试试,突然想到 formready 这个表单完成,但是dom没完成 React的问题,当然React解决啦~
formSdk.afterFieldComp( fieldMark, React.createElement(() => { // 组件挂载时执行 React.useEffect(() => { console.log("多行文本组件渲染/追加完成了!执行你的函数..."); // 在这里调用你的函数 }, []);
// 重点:返回 null,不渲染任何 div 或内容到页面上 return null; }));矩阵维护单页:/sp/hrm/conditionMatrix
指定某个矩阵的单页:/sp/hrm/conditionMatrix?spMatrixId=矩阵id
说明:矩阵id需要浏览器f12抓取下获取维护数据时的id
获取下拉框的显示值:field_option 组织架构相关日志:hrm_employeeandorglogs,hrm_employeeandorglogs_detail,hrm_opterator_log
报表大片空白解决方案:代码块 excel.workbook.options.scrollbarMaxAlign = true; excel.workbook.options.scrollByPixel = true 要滚动条只想去除多余空白区域的用上面的代码块,想直接去除的用下面的。) excel.workbook.options.showVerticalScrollbar=false;//纵向滚动条不显示 excel.workbook.options.showHorizontalScrollbar=false;//横向滚动条不显示 excel.workbook.refresh();//刷新布局

