Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: 主表记录locked时,记录详细页面附件子表列表右上角上传按钮如何配置为识别locked时隐藏 #7124

Open
yinlianghui opened this issue Jan 22, 2025 · 0 comments

Comments

@yinlianghui
Copy link
Contributor

Summary 摘要

  • 普通的主子表字段上可以配置开关来实现,但是像附件、任务等子表就没有这个开关,而且这个开关默认值是不勾选,即默认是主记录locked时,子表不允许增删改。
  • 附件子表目前现状是无论主表记录是否locked,都不影响附件增删改,且默认是主表记录只读时,附件可以增删改
Image Image

目前要实现附件子表在主表记录locked时不允许增删改,需要按以下步骤实现。

  • 主表记录looked时,通过触发器等手段,把该主表记录下的所有附件记录设置为locked
  • 重写附件上传按钮的显隐函数,如下:
module.exports = {
    uploadVisible: function () {
        if (arguments.length > 3) {
            var ctx = arguments[3];
            if (ctx && ctx._isRelated) {
                var masterObjectName = ctx._master && ctx._master.objectName;
                var masterRecord = ctx._master && ctx._master.record;
                if(masterObjectName === 'b6_collect' && masterRecord && masterRecord.locked){
                    return false;
                }
                // 统一的附件上传按钮显隐规则是下面的allowCreateFiles,上面判断附件子表是在填写任务对象记录详细页面且记录locked就不允许上传附件
                return ctx.recordPermissions.allowCreateFiles
            }
        }
    }
}
Image

Why should this be worked on? 此需求的应用场景?

项目中可能遇到主表记录locked时,希望附件子表不允许上传附件

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant