TreeviewCopyright © aleen42 all right reserved, powered by aleen42

单据扩展

建议

单据扩展这部分功能完全可以被函数替代,少人开发或单据开发没有交集时可以考虑使用函数开发【属于在沙箱环境-进行函数开发】;
但若多人同时开发,避免相互影响;方便本地前、后端调试,建议还是通过下面的单据扩展开发【属于在本地前端脚手架-进行扩展开发】

启用单据扩展

脚手架默认不启用单据扩展,推荐使用函数。如果需要使用,请参照以下配置

undefined

图 1


const businessContext = require.context('business');

单据扩展命名

预览页面

undefined

图 2

扩展脚本名称

undefined

图 3

创建文件

src/businesss/ 目录下创建

undefined

图 4

代码

基础代码

GT5439AT29_dfbc4e1fList_VM_Extend 为查看的函数名。主意一共有三处需要修改

cb.define(['common/common_VM.Extend.js'], function (common) {
    let GT5439AT29_dfbc4e1fList_VM_Extend = {
      doAction: function (name, viewmodel) {
        if (this[name])
            this[name](viewmodel);
      },
      init: function (viewmodel) {
        let self = this;
      }
    }
    try {
      module.exports = GT5439AT29_dfbc4e1fList_VM_Extend;
    } catch (error) {

    }
    return GT5439AT29_dfbc4e1fList_VM_Extend;
  });

扩展代码

扩展代码一般写在init中,使用mdf的事件即可。 例如列表过滤

cb.define(['common/common_VM.Extend.js'], function (common) {
    let GT5439AT29_dfbc4e1fList_VM_Extend = {
      doAction: function (name, viewmodel) {
        if (this[name])
            this[name](viewmodel);
      },
      init: function (viewmodel) {
        let self = this;
        viewmodel.on('beforeSearch',function(args){
            args.isExtend = true;
            var commonVOs = args.params.condition.commonVOs;  //通用检查查询条件
            commonVOs.push({
                itemName:'new1',
                op:'eq',
                value1:'11'
            });
            debugger;
        })
      }
    }
    try {
      module.exports = GT5439AT29_dfbc4e1fList_VM_Extend;
    } catch (error) {

    }
    return GT5439AT29_dfbc4e1fList_VM_Extend;
});
Copyright © 用友 -【生态技术部】 2022-2023 all right reserved,powered by Gitbook修订时间: 2021-11-03 14:43:15

results matching ""

    No results matching ""