本文整理匯總了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',