🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
平台本身已经提供的最常用的默认值,但在一些实际项目中满足不了需求,因此平台提供了默认扩展接口,基本原理是这样的:平台根据默认值编码进行匹配,如果属于平台默认值,平台直接解析,否则平台直接调用扩展接口进行解析。 一、在平台默认值表(T_E_App_DefValues)中配置相应关键字(默认值编码),后面的扩展接口就是根据默认值编码进行解析 ![](https://box.kancloud.cn/017f2e9f6deb98de45deed9bb9706fa2_671x411.png) 二、新建一个类库工程,在工程下新建一个类(或者在现有工程中增加一个类),用于实现扩展接口 a)引用 EIS.AppModel.dll ,扩展接口命名空间为:EIS.AppModel.AppMode ![](https://box.kancloud.cn/b84715f22eaca7b62126eb3b6c0de760_714x448.png) b)在新建类中实现接口 using System; using System.Collections.Generic; using System.Linq; using System.Web; using EIS.AppModel.AppModel; using EIS.Permission.Service; using EIS.DataAccess; using NLog; namespace EIS.Sheet.Logic { public class DefaultValue : ICustomise { private Logger fileLogger = LogManager.GetCurrentClassLogger(); public string GetDefaultValue(AppBase.UserContext user, string dType, string dPara) { string empId = user.EmployeeId; string empCode = EmployeeService.GetEmployeeAttrById(empId,"EmployeeCode"); string defValue = ""; switch (dType) { case "StudentNo": //计算学号,把计算后赋值给defValue break; case "StudentClass": //计算班级,把计算后赋值给defValue break; default: break; } return defValue; } public void Login_After(AppBase.UserContext user) { throw new NotImplementedException(); } public void Logout_After(AppBase.UserContext user) { throw new NotImplementedException(); } } } 三、把上面工程生成DLL复制到bin目录下面,同时在扩展接口配置文件 Unity.config 文件中增加相关配置 ![](https://box.kancloud.cn/9db8bcd0319ae23721219d009293c446_988x266.png)