当前位置:网站首页>Dynamics 365 开发协作最佳实践思考
Dynamics 365 开发协作最佳实践思考
2022-07-06 01:35:00 【zcy_wxy】
一、前台开发
1、首先要考虑把常用代码独立成一个公共js,然后在需要用到的时候引入。这样会更便于维护。
2、做请求聚合。如果一个页面中发请求次数太多,且不为异步,就会导致前台卡顿明显。所以为了减少请求次数,做请求聚合,把几次请求整合成一次请求,获取页面需要的数据。
常用的比如说:
锁定和释放窗体属性
/**
* 锁定或解锁属性
* @param {any} attributeName
*/
lockOrUnlockControlByAttributeName: function (attributeName,lock) {
let controls = Xrm.Page.getAttribute(attributeName).controls.getAll();
if (controls) {
for (con of controls) {
con.setDisabled(lock);
}
}
}
获取选项集字段名称
/*
* summary:前端获取选项集字段的名称
* author:
* createTime:
*/
getOptionName:function (context, attributeName, value) {
let val = value;
if (val == null || val == undefined) {
val = context.getAttribute(attributeName).getValue();
}
let attrArray = context.getControl(attributeName).getOptions().filter(t => t.value == val);
if (attrArray.length > 0) {
return attrArray[0].text;
}
return "";
}
判断用户是否为负责人
/*
* summary:判断用户是否为负责人
* author:
* createTime:
* returns:
*/
function currentUserIsOwner() {
let owner = Xrm.Page.getAttribute("ownerid");
if (owner) {
let ownerid = owner.getValue()[0].id;
return Xrm.Page.context.getUserId() == ownerid;
}
return false;
}
判断用户是否包含指定角色
/*
* summary:判断用户是否拥有某些角色
* author:
* createTime:
* returns:
*/
function currentUserContainRoles(roleNames) {
var roleNameArray = roleNames.split(',');
let userRoles = Xrm.Utility.getGlobalContext().userSettings.roles.getAll();
if (roleNameArray.length > 1) {
let nameSet = new Set();
for (let role of userRoles) {
nameSet.add(role.name);
}
for (let roleName of roleNameArray) {
if (nameSet.has(roleName)) {
return true;
}
}
return false;
}
for (var role of userRoles) {
if (role.name == roleNameArray[0]) {
return true;
}
}
return false;
}
等等。
二、插件开发
1、最好是一个实体建一个插件项目,这样既可以避免多人开发时的冲突,也能在解决方案发布时避免多发或者漏发内容。或者根据模块划分插件项目,一个插件项目中只包含单个模块所需的实体。
2、公共模块也最好提取出来,放在共享项目中。按dao、service、controller的分层概念来说,dao层和service层的公共的内容,都放在共享项目中。
边栏推荐
- Unity | two ways to realize facial drive
- LeetCode 322. Change exchange (dynamic planning)
- General operation method of spot Silver
- National intangible cultural heritage inheritor HD Wang's shadow digital collection of "Four Beauties" made an amazing debut!
- [technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry
- Basic operations of databases and tables ----- non empty constraints
- 记一个 @nestjs/typeorm^8.1.4 版本不能获取.env选项问题
- Unreal browser plug-in
- [le plus complet du réseau] | interprétation complète de MySQL explicite
- SPIR-V初窥
猜你喜欢
leetcode刷题_平方数之和
TrueType字体文件提取关键信息
MUX VLAN configuration
General operation method of spot Silver
[机缘参悟-39]:鬼谷子-第五飞箝篇 - 警示之二:赞美的六种类型,谨防享受赞美快感如同鱼儿享受诱饵。
电气数据|IEEE118(含风能太阳能)
Huawei converged VLAN principle and configuration
Maya hollowed out modeling
Basic operations of database and table ----- delete data table
Mathematical modeling learning from scratch (2): Tools
随机推荐
Three methods of script about login and cookies
【全網最全】 |MySQL EXPLAIN 完全解讀
【已解决】如何生成漂亮的静态文档说明页
CocoaPods could not find compatible versions for pod 'Firebase/CoreOnly'
yii中console方法调用,yii console定时任务
Poj2315 football games
【Flask】响应、session与Message Flashing
[the most complete in the whole network] |mysql explain full interpretation
现货白银的一般操作方法
Unreal browser plug-in
02.Go语言开发环境配置
Paddle框架:PaddleNLP概述【飛槳自然語言處理開發庫】
Threedposetracker project resolution
Force buckle 1020 Number of enclaves
Hcip---ipv6 experiment
Maya hollowed out modeling
[flask] response, session and message flashing
Huawei Hrbrid interface and VLAN division based on IP
Leetcode1961. 检查字符串是否为数组前缀
Format code_ What does formatting code mean