本文整理汇总了TypeScript中ts/opg.api.findById方法的典型用法代码示例。如果您正苦于以下问题:TypeScript api.findById方法的具体用法?TypeScript api.findById怎么用?TypeScript api.findById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ts/opg.api
的用法示例。
在下文中一共展示了api.findById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
).done(()=> {
if (id) {
opg.api.findById({id: id}, function (data) {
form.jsonToFields(data);
});
}
});
示例2:
).done(()=> {
if (id) {
opg.api.findById({id: id}, data => {
form.jsonToFields(data);
if (data.roleIds) {
let checkedIds = data.roleIds;
checkedIds.map(v => {
reservedCheckedRolesHash[v] = true;
});
console.warn('findById', data, reservedCheckedRolesHash);
//选中全部被选择的
let l = data.roleIds.length;
while (l--) {
$('#' + tree1.treeName + 'Chk_' + data.roleIds[l]).prop('checked', true);
}
//将子节点选中的条数与全部子节点比较
l = data.roleIds.length;
while (l--) {
let curRoleId = data.roleIds[l];
let sp = $('#' + tree1.treeName + 'Sp_' + curRoleId);
if(sp.length){
if (sp.hasClass('folder')) {
let ul = $('#' + tree1.treeName + 'Ul_' + curRoleId);
ul.find(':checkbox').prop('checked' , true);
}
delete reservedCheckedRolesHash[curRoleId];
}
}
}
});
}
else {
$('#trRoleTree').before(`<tr style="height: 32px;">
<td class="lead"><b class="text-red">*</b>用户密码</td>
<td colspan="3"><label><input type="password" name="password" autocomplete="off" placeholder="密码8-15位,大小写字母与数字混合" style="width: 100%;"></label></td>
</tr>`);
}
});
示例3: while
opg.api.roleTree({parentRoleId}, (data)=> {
let actions = data.actions, x = actions.length;
while (x--) {
let p = actions[x];
if (!permissions[p.parentId]) {
permissions[p.parentId] = [];
}
permissions[p.parentId].push(p);
}
let menuData = data.menu ? data.menu : [];
function loopNode(list :Array) {
let z = list.length;
while (z--) {
let node = list[z];
if (node.id in permissions) {
node.children = permissions[node.id];
}
if (node.children) {
loopNode(node.children);
}
}
}
loopNode(menuData);
console.log('permissions', permissions);
tree2 = opg('#menuTree').tree({
data: menuData,
root: '菜单列表',
cmd: 'checkAll'
});
/*tree2.jq.on('change', ':checkbox', function (e) {
let elem = $(this), pId = ~~elem.val(), deal = elem.prop('checked');
//console.warn('deal' , this);
if (deal) {
reservedPermissionIdHash[pId] = true;
}
else {
delete reservedPermissionIdHash[pId];
}
});*/
if (id) {
opg.api.findById({roleId: id}, function (data) {
form.jsonToFields(data.role);
let checkedIds = data.checkedIds ? data.checkedIds : [];
checkedIds.map((v)=> {
reservedPermissionIdHash[v] = v;
});
console.log('checkedIds', reservedPermissionIdHash);
if (data.checkedIds) {
//选中全部被选择的
let l = data.checkedIds.length;
while (l--) {
let curId = data.checkedIds[l];
let chk = document.getElementById(`${tree2.treeName}Chk_${curId}`);
if (chk) {
$(chk).prop('checked', true);
delete reservedPermissionIdHash[curId];
}
}
console.warn('reservedPermissionIdHash', data, reservedPermissionIdHash);
//将子节点选中的条数与全部子节点比较
l = data.checkedIds.length;
while (l--) {
let sp = $('#' + tree2.treeName + 'Sp_' + data.checkedIds[l]);
if (sp.hasClass('folder')) {
let ul = $('#' + tree2.treeName + 'Ul_' + data.checkedIds[l]);
/*let li = ul.children('li');
let all = li.length;
if (all != li.children('span').children('label').children(':checkbox:checked').length) {
//console.error('uncheck' , data.checkedIds[l] , all , li.children('span').children(':checkbox:checked').length);
$('#tree' + tree2.guid + 'Chk_' + data.checkedIds[l]).prop('checked', false);
}*/
ul.find(':checkbox').prop('checked', true);
}
}
}
//.........这里部分代码省略.........