MENU

[泛微E9 ecode] 像批量增加选项一样去"批量新增字段"(半成品)

• 2025 年 06 月 09 日 • 阅读: 191 • OA

我希望的Ecode目的:每行1个字段,请用回车分隔

昨晚心血来潮搞了一半,感觉功能还是有用的,能节省字段维护不少的时间,不知有没有大佬继续完成这个功能~

db290cfb6666bfc6f3d76597ad01dc0.png

代码请勿直接运行

以下ecode代码为半成品,仅供交流,非技术人员请勿直接在ecode运行~

// 我计划用WeaDialog,1.锁定弹窗范围,防止污染,并且newProps.children.props.wfFormSetCusBatchOpsStore中似乎可以直接修改表单中的数据
ecodeSDK.overwritePropsFnQueueMapSet('WeaDialog', {
  fn: (newProps) => {
    if (!ecodeSDK.checkLPath('/wui/engine.html#/workflowengine/path/pathSet/pathDetail/formManage/editField')) return;


    if (newProps.title === "批量添加字段") {
      console.log(newProps.children.props.wfFormSetCusBatchOpsStore);

    }
  },
});


let textValue = '';
// 我计划复写WeaSearchGroup 来获取原有添加按钮的动作,并添加新的按钮
ecodeSDK.overwritePropsFnQueueMapSet('WeaSearchGroup', {
  fn: (newProps) => {

    var addClickHandler = null;
    for (var i = 0; i < newProps.customComponent.props.children.length; i++) {
        var child = newProps.customComponent.props.children[i];
        if (child && child.props && child.props.title === "添加") {
            addClickHandler = child.props.onClick;
            break;
        }
    }

    const {Button,Input} = antd;
    const content = (
        <div>
            <Input type="textarea" placeholder="每行1个字段,请用回车分隔" autosize={{ minRows: 2, maxRows: 6 }}  
            onChange={event => { textValue = event.target.value;}}
              />
        </div>
    );
    const batchAddButton = (
        <Button
            title="批量添加"
            type="primary"
            size="small"
            style={{ marginRight: '8px' }}
            // style={{"border": "none","padding": "0px","fontSize": "20px","lineHeight": "1","color": "#55a1f8","backgroundColor": "#fff","marginLeft": "10px"}}
            onClick={() => {
                window.antd.Modal.info({
                    title: '批量添加字段',
                    content: content,
                    okText: '确认添加',
                    cancelText: '取消操作',
                    onOk: () => {
                        // console.log("?????????",textValue);
                        addClickHandler();
                        addClickHandler();
                        addClickHandler();
                    },
                });

            }}
        >批量添加
        </Button>
    );

    newProps.customComponent.props.children.unshift(batchAddButton);
  },
});
添加新评论

已有 1 条评论
  1. wintsa wintsa

    emmmmm,其实oa他不是提供了模板功能了吗