本文整理汇总了TypeScript中ts/opg.api函数的典型用法代码示例。如果您正苦于以下问题:TypeScript api函数的具体用法?TypeScript api怎么用?TypeScript api使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import opg from 'ts/opg';
import Panel from "ts/ui/Panel";
opg.api({
collection: 'system/collection/findPage',
amssp: 'system/amssp/findAll',
'delete!DELETE!': 'system/collection/delete/${id}',
'switch!delete!': 'system/collection/switch/${id}'
});
const infoPage = '/page/admin/collection/info.html';
let panel: Panel = opg.wrapPanel('#tbSearch', {
title: '采集源查询',
btnSearchText: '<i class="ico-find"></i> 查询'
});
panel.btnSearch.click(function () {
let param = $('#tbSearch').fieldsToJson();
param.pageNo = 1;
//param.spCode = sel.getValue();
console.log(param);
tb.update(param);
});
let spHash = {};
opg('#spCode').listBox({
示例2:
import opg from 'ts/opg';
let id = opg.request['id'];
opg.api({
amssp: 'system/amssp/findAll',
sourcetype: 'base/sourceTypes',
'findById!!': 'system/collection/findById/${id}',
'update!post': 'system/collection/update',
'add!post': 'system/collection/add'
});
const codes = {
'system_amssp_name_empty': '内容生产商名称为空',
'system_amssp_code_empty': '内容生产商代码为空',
'system_amssp_name_existed': '内容生产商名称已被占用',
'system_amssp_code_existed': '内容生产商代码已被占用',
};
opg.api.add.set('codes', codes);
opg.api.update.set('codes', codes);
let form = $('#tbSearch');
$.when(
opg.api.amssp(data => {
opg('#spCode').listBox({
data: data,
value: 'code'
});
示例3: opg
import opg from 'ts/opg';
opg.api({
roles: 'system/role/list',
'delete!delete!': 'system/role/delete/${roleId}'
});
opg.api.delete.set('codes', {
'role_blind_users': '该角色绑定有用户,不能删除',
'role_have_child': '该角色有子角色,不能删除',
});
const infoPage = '/page/admin/role/info.html';
let subNodeParentId = 0;
let nodeParentId = 0;
let rootAdminId = 0;
let tree = opg('#leftSec').tree({
api: opg.api.roles,
root: '角色',
name : 'rolesTree' ,
onAjaxEnd: (json)=> {
console.log(json);
let d = json;
json.results = [d];
//console.log(tree);
//tree.rootName = d.name;
},
示例4: opg
import opg from 'ts/opg';
opg.api({
roles: 'system/role/list',
org: 'system/organization/orgsubstree/0',
'findById!!': 'system/user/edit/${id}',
'save!post': 'system/user/save',
});
opg.api.save.set('codes' , {
'loginName_exist' : '登录名已经存在'
});
const id = opg.request['id'];
let reservedCheckedRolesHash = {};
let form = $('#tbSearch');
let tree1;//, tree2;
$.when(
opg.api.roles(data => {
let d = data;
data.results = [d];
tree1 = opg('#tree1').tree({
data: data,
root: '角色',
name : 'rolesTree' ,
cmd: 'checkAll'
});
示例5:
import opg from 'ts/opg';
import {store, Cache} from "ts/util/store";
import ViewMedia from "./viewMedia";
import ViewMeta from "./viewMeta";
import ViewAudit from "./viewAudit";
import ViewCopyright from "./viewCopyright";
let cache = Cache.getInstance() ;
opg.api({
pics: 'audit/viewPics/${assetId}',
//信息
'auditFile!PUT': 'audit/auditFile/${fileId}', //更改媒体文件审核状态
});
let currentUser = store.get('userInfo');
const currentRow = cache.get('currentRow');
console.log(currentRow , currentUser);
const id = opg.request['id'] ;
opg('#mainTab').tabView({
data: [
{label: '媒体文件', view: '#d0'},
{label: '元数据', view: '#d1'},
{label: '图片文件', view: '#d2'},
{label: '审片意见', view: '#d3'},
{label: '关联版权', view: '#d4'},
示例6: add
import opg from 'ts/opg' ;
import Table from 'ts/ui/Table';
import Popup from 'ts/ui/Popup';
import {store, Cache} from 'ts/util/store';
opg.api({
'alias!!': 'produce/asset/copyrights/${id}',
'deleteContracts!post' : 'copyright/contract/deleteBatchCopyrightContract' , //删除合同
'changeContractNumber!post' : 'copyright/contract/changeBatchContractNumber' , //变更合同号
download: 'copyright/contract/downloadCopyrightContract', //导出全量版权
});
const moduleRoot: string = '/page/copyright/contract/module/';
export default class Contract {
/**
* 新增合同
* @param tb
*/
static add(tb: Table) {
let pop = top.opg.confirm(`<iframe src="${moduleRoot}preAdd.html" />`, function (i, ifr) {
ifr.doSave(pop, Contract.modify, tb);
return true;
}, {
title: '新增合同',
btnMax: true,
width: 640,
height: 320,
buttons: {
ok: '保存新增',
示例7: constructor
import opg from 'ts/opg' ;
opg.api({
'copyrights!!' : 'produce/asset/copyrights/${id}'
});
class ViewCopyright {
constructor(row){
opg.api.copyrights({id: row.id} , (data)=>{
let html:string ;
console.log('版权',data);
if(data&& data.length){
html = '' ;
data.forEach((cp)=>{
let program = cp.program||{} ;
html += `
<table class="search-table">
<tr><td colspan="4" class="lead text-center">关联版权内容</td></tr>
<tr>
<td class="lead">版权内容名称</td><td style="width: 40%;">${program.name||''}</td>
<td class="lead">版权内容别名</td><td>${program.alias||''}</td>
</tr>
</table>
<table class="search-table">
<thead>
<tr>
<td class="lead text-center" style="width: 180px;">版权类型</td><td class="lead text-center" style="width: 160px;">版权开始时间</td>
<td class="lead text-center" style="width: 160px;">版权结束时间</td><td class="lead text-center" style="width: 120px;">使用期限(天)</td>
<td class="lead text-center">授权平台</td>
</tr>
</thead>
示例8: opg
import opg from 'ts/opg';
opg.api({
templates: 'admin/template/findPage',
'delete!GET!': 'admin/template/deleteById?id=${id}'
});
const infoPage = '/page/collection/templates/template.html';
//create a data table
let tb = opg('#tb').table({
api: opg.api.templates,
columns: [
{
text: '模板名称',
width: 200,
src: 'name'
},
{
text: '描述',
src: 'description'
},
{
text: '操作',
src: 'id',
width: 160,
render: (val, i, row)=> {
return `
<button class="btn-mini btn-info" data-id="${val}" data-title="${row.name}">修改</button>
示例9: constructor
import opg from 'ts/opg';
opg.api({
'comments!!': 'produce/asset/comments/${id}', //获取审核意见
});
class ViewAudit {
constructor(currentRow) {
//debugger;
//console.log(currentRow);
opg.api.comments({id: currentRow.id}, function (data) {
let tb = opg('#tbRemarks').table({
data: data,
columns: [
{
text: '内容名称', width: 220,
src: 'managerName'
},
{
text: '内容类型', width: 90,
src: 'contentType'
},
{
text: '已生产业务', width: 120,
src: 'busiCodes',
},
{
text: '生产中业务', width: 120,
src: 'produceBusiCodes',