1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043 |
- MWF.xApplication.query = MWF.xApplication.query || {};
- MWF.xApplication.query.Query = MWF.xApplication.query.Query || {};
- MWF.require("MWF.widget.Common", null, false);
- MWF.require("o2.widget.Paging", null, false);
- MWF.require("MWF.xScript.Macro", null, false);
- MWF.xDesktop.requireApp("query.Query", "lp."+o2.language, null, false);
- MWF.xApplication.query.Query.Viewer = MWF.QViewer = new Class({
- Implements: [Options, Events],
- Extends: MWF.widget.Common,
- options: {
- "style": "default",
- "skin" : null,
- "resizeNode": true,
- "paging" : "scroll",
- "perPageCount" : 50,
- "isload": "true",
- "export": false,
- "lazy": false,
- "moduleEvents": ["queryLoad", "postLoad", "postLoadPageData", "postLoadPage", "selectRow", "unselectRow",
- "queryLoadItemRow", "postLoadItemRow", "queryLoadCategoryRow", "postLoadCategoryRow"]
- // "actions": {
- // "lookup": {"uri": "/jaxrs/view/flag/{view}/query/{application}/execute", "method":"PUT"},
- // "getView": {"uri": "/jaxrs/view/flag/{view}/query/{application}"}
- //
- // },
- // "actionRoot": "x_query_assemble_surface"
- },
- initialize: function(container, json, options, app, parentMacro){
- //本类有三种事件,
- //一种是通过 options 传进来的事件,包括 loadView、openDocument、select、unselect
- //一种是用户配置的 事件, 在this.options.moduleEvents 中定义的作为类事件
- //还有一种也是用户配置的事件,不在this.options.moduleEvents 中定义的作为 this.node 的DOM事件
- this.setOptions(options);
- this.path = "../x_component_query_Query/$Viewer/";
- this.cssPath = "../x_component_query_Query/$Viewer/"+this.options.style+"/css.wcss";
- this._loadCss();
- this.lp = MWF.xApplication.query.Query.LP;
- this.app = app;
- this.container = $(container);
- this.json = json;
- this.parentMacro = parentMacro;
- this.originalJson = Object.clone(json);
- this.viewJson = null;
- this.filterItems = [];
- this.searchStatus = "none"; //none, custom, default
- this.items = [];
- this.selectedItems = [];
- this.hideColumns = [];
- this.openColumns = [];
- this.gridJson = null;
- if (this.options.isload){
- this.init(function(){
- this.load();
- }.bind(this));
- }
- },
- loadView: function( callback ){
- if (this.viewJson){
- this.reload( callback );
- }else{
- this.init(function(){
- this.load( callback );
- }.bind(this));
- }
- },
- init: function(callback){
- if (this.json.data){
- this.viewJson = JSON.decode(this.json.data);
- if (callback) callback();
- }else{
- this.getView(callback);
- }
- },
- load: function( callback ){
- this.loadResource( function () {
- this._loadModuleEvents();
- if (this.fireEvent("queryLoad")){
- this._loadUserInterface( callback );
- //this._loadStyles();
- this._loadDomEvents();
- }
- }.bind(this))
- },
- _loadUserInterface : function( callback ){
- this.loadLayout();
- this.createActionbarNode();
- this.createSearchNode();
- this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}, callback);
- if (this.options.resizeNode){
- this.setContentHeightFun = this.setContentHeight.bind(this);
- this.container.addEvent("resize", this.setContentHeightFun);
- this.setContentHeightFun();
- }
- },
- loadLayout: function(){
- this.node = new Element("div", {"styles": this.css.node}).inject(this.container);
- this.actionbarAreaNode = new Element("div.actionbarAreaNode", {"styles": this.css.actionbarAreaNode}).inject(this.node);
- //if (this.options.export) this.exportAreaNode = new Element("div", {"styles": this.css.exportAreaNode}).inject(this.node);
- this.searchAreaNode = new Element("div", {"styles": this.css.searchAreaNode}).inject(this.node);
- this.viewAreaNode = new Element("div", {"styles": this.css.viewAreaNode}).inject(this.node);
- // this.viewPageNode = new Element("div", {"styles": this.css.viewPageNode}).inject(this.node);
- this.viewPageAreaNode = new Element("div", {"styles": this.css.viewPageAreaNode}).inject(this.node);
- this.fireEvent("loadLayout");
- },
- loadResource: function( callback ){
- if( this.options.lazy ){
- var loadedIOResource = false;
- var callback2 = function(){
- if( this.Macro && loadedIOResource )callback();
- }.bind(this)
- this.loadMacro( callback2 );
- this.loadIOResource( function(){
- loadedIOResource = true;
- callback2();
- }.bind(this));
- }else{
- this.loadMacro( callback );
- }
- },
- loadMacro: function (callback) {
- MWF.require("MWF.xScript.Macro", function () {
- this.Macro = new MWF.Macro.ViewContext(this);
- if (callback) callback();
- }.bind(this));
- },
- createExportNode: function(){
- if (this.options.export){
- MWF.require("MWF.widget.Toolbar", function(){
- this.toolbar = new MWF.widget.Toolbar(this.actionbarAreaNode, {"style": "simple"}, this); //this.exportAreaNode
- var actionNode = new Element("div", {
- "id": "",
- "MWFnodetype": "MWFToolBarButton",
- "MWFButtonImage": this.path+""+this.options.style+"/icon/export.png",
- "title": this.lp.exportExcel,
- "MWFButtonAction": "exportView",
- "MWFButtonText": this.lp.exportExcel
- }).inject(this.actionbarAreaNode); //this.exportAreaNode
- this.toolbar.load();
- }.bind(this));
- //this.exportNode = new Element("button", {"text": this.lp.exportExcel}).inject(this.exportAreaNode);
- }
- },
- getExportTotalCount: function(){
- return ( this.bundleItems || [] ).length;
- },
- getExportMaxCount: function(){
- return 2000;
- },
- exportView: function(){
- var _self = this;
- var total = this.getExportTotalCount();
- var max = this.getExportMaxCount();
- var lp = this.lp.viewExport;
- var node = this.exportExcelDlgNode = new Element("div");
- var html = "<div style=\"line-height: 30px; height: 30px; color: #333333; overflow: hidden;margin-top:20px;\">" + lp.exportRange + ":" +
- " <input class='start' value='" + ( this.exportExcelStart || 1) + "'><span>"+ lp.to +"</span>" +
- " <input class='end' value='"+ ( this.exportExcelEnd || Math.min( total, max ) ) +"' ><span>"+lp.item+"</span>" +
- "</div>";
- html += "<div style=\"clear:both; max-height: 300px; margin-bottom:10px; margin-top:10px; overflow-y:auto;\">"+( lp.description.replace("{count}", total ))+"</div>";
- node.set("html", html);
- var check = function () {
- if(this.value.length == 1){
- this.value = this.value.replace(/[^1-9]/g,'')
- }else{
- this.value = this.value.replace(/\D/g,'')
- }
- if( this.value.toInt() > total ){
- this.value = total;
- }
- }
- node.getElement(".start").addEvent( "keyup", function(){ check.call(this) } );
- node.getElement(".end").addEvent( "keyup", function(){ check.call(this) } );
- var dlg = o2.DL.open({
- "title": this.lp.exportExcel,
- "style": "user",
- "isResize": false,
- "content": node,
- "width": 600,
- "height" : 260,
- "buttonList": [
- {
- "type": "ok",
- "text": MWF.LP.process.button.ok,
- "action": function (d, e) {
- var start = node.getElement(".start").get("value");
- var end = node.getElement(".end").get("value");
- if( !start || !end ){
- MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, lp.inputIntegerNotice, node, {"x": 0, "y": 85});
- return false;
- }
- start = start.toInt();
- end = end.toInt();
- if( end < start ){
- MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, lp.startLargetThanEndNotice, node, {"x": 0, "y": 85});
- return false;
- }
- debugger;
- this.exportExcelStart = start;
- this.exportExcelEnd = end;
- this._exportView(start, end);
- dlg.close();
- }.bind(this)
- },
- {
- "type": "cancel",
- "text": MWF.LP.process.button.cancel,
- "action": function () { dlg.close(); }
- }
- ]
- });
- },
- _exportView: function(start, end){
- var bundleList = this.bundleItems.slice(start-1, end);
- var excelName = this.json.name + "(" + start + "-" + end + ").xlsx";
- var action = MWF.Actions.get("x_query_assemble_surface");
- var filterData = this.json.filter ? this.json.filter.clone() : [];
- if (this.filterItems.length){
- this.filterItems.each(function(filter){
- filterData.push(filter.data);
- }.bind(this));
- }
- var data = {"filterList": filterData};
- if( bundleList )data.bundleList = bundleList;
- if( excelName )data.excelName = excelName;
- data.key = this.bundleKey;
- action.exportViewWithQuery(this.json.viewName, this.json.application, data, function(json){
- var uri = action.action.actions.getViewExcel.uri;
- uri = uri.replace("{flag}", json.data.id);
- uri = o2.filterUrl( action.action.address+uri );
- var a = new Element("a", {"href": uri, "target":"_blank"});
- a.click();
- a.destroy();
- }.bind(this));
- },
- setContentHeight: function(){
- var size = this.node.getSize();
- var searchSize = this.searchAreaNode.getComputedSize();
- var h = size.y-searchSize.totalHeight;
- //if (this.exportAreaNode){
- // var exportSize = this.exportAreaNode.getComputedSize();
- // h = h-exportSize.totalHeight;
- //}
- if( this.actionbarAreaNode ){
- var exportSize = this.actionbarAreaNode.getComputedSize();
- h = h-exportSize.totalHeight;
- }
- var pageSize = this.viewPageAreaNode.getComputedSize();
- h = h-pageSize.totalHeight;
- var paddingTop = (this.viewAreaNode.getStyle("padding-top") || "0").toInt();
- var paddingBottom = (this.viewAreaNode.getStyle("padding-bottom") || "0").toInt();
- h = h - paddingTop - paddingBottom;
- this.viewAreaNode.setStyle("height", ""+h+"px");
- },
- createLoadding: function(){
- this.loadingAreaNode = new Element("div", {"styles": this.css.viewLoadingAreaNode}).inject(this.contentAreaNode);
- new Element("div", {"styles": {"height": "5px"}}).inject(this.loadingAreaNode);
- var loadingNode = new Element("div", {"styles": this.css.viewLoadingNode}).inject(this.loadingAreaNode);
- new Element("div", {"styles": this.css.viewLoadingIconNode}).inject(loadingNode);
- var loadingTextNode = new Element("div", {"styles": this.css.viewLoadingTextNode}).inject(loadingNode);
- loadingTextNode.set("text", "loading...");
- },
- createActionbarNode : function(){
- this.actionbarAreaNode.empty();
- if( typeOf(this.json.showActionbar) === "boolean" && this.json.showActionbar !== true )return;
- if( typeOf( this.viewJson.actionbarHidden ) === "boolean" ){
- if( this.viewJson.actionbarHidden === true || !this.viewJson.actionbarList || !this.viewJson.actionbarList.length )return;
- this.actionbar = new MWF.xApplication.query.Query.Viewer.Actionbar(this.actionbarAreaNode, this.viewJson.actionbarList[0], this, {});
- this.actionbar.load();
- }else{ //兼容以前的ExportNode
- this.createExportNode();
- }
- },
- createViewNode: function(data, callback){
- this.viewAreaNode.empty();
- this.selectedItems = [];
- var viewStyles = this.viewJson.viewStyles;
- this.contentAreaNode = new Element("div", {"styles":
- (viewStyles && viewStyles["container"]) ? viewStyles["container"] : this.css.contentAreaNode
- }).inject(this.viewAreaNode);
- this.loadObserver();
- this.viewTable = new Element("table", {
- "styles": this.css.viewTitleTableNode,
- "border": "0px",
- "cellPadding": "0",
- "cellSpacing": "0"
- }).inject(this.contentAreaNode);
- if( viewStyles ){
- if( viewStyles["tableProperties"] )this.viewTable.set(viewStyles["tableProperties"]);
- if( viewStyles["table"] )this.viewTable.setStyles(viewStyles["table"]);
- }
- this.createLoadding();
- var viewTitleCellNode = (viewStyles && viewStyles["titleTd"]) ? viewStyles["titleTd"] : this.css.viewTitleCellNode;
- if (this.json.isTitle!=="no"){
- this.viewTitleLine = new Element("tr.viewTitleLine", {
- "styles": (viewStyles && viewStyles["titleTr"]) ? viewStyles["titleTr"] : this.css.viewTitleLineNode
- }).inject(this.viewTable);
- //if (this.json.select==="single" || this.json.select==="multi") {
- this.selectTitleCell = new Element("td.selectTitleCell", {
- "styles": viewTitleCellNode
- }).inject(this.viewTitleLine);
- this.selectTitleCell.setStyle("width", "10px");
- if (this.json.titleStyles) this.selectTitleCell.setStyles(this.json.titleStyles);
- //}
- if( this.isSelectTdHidden() ){
- this.selectTitleCell.hide();
- }
- if( this.getSelectFlag( true ) !== "multi" || !this.viewJson.allowSelectAll ){
- this.expandTitleCell = this.selectTitleCell;
- }
- //序号
- if (this.viewJson.isSequence==="yes"){
- this.sequenceTitleCell = new Element("td", {
- "styles": viewTitleCellNode,
- "text": this.lp.sequence
- }).inject(this.viewTitleLine);
- this.sequenceTitleCell.setStyles({
- "width": "30px",
- "text-align": "center"
- });
- if (this.json.titleStyles) this.sequenceTitleCell.setStyles(this.json.titleStyles);
- if( !this.expandTitleCell )this.expandTitleCell = this.sequenceTitleCell;
- }
- this.entries = {};
- debugger;
- this.viewJson.selectList.each(function(column){
- this.entries[column.column] = column;
- if (!column.hideColumn){
- var viewCell = new Element("td", {
- "styles": viewTitleCellNode,
- "text": column.displayName
- }).inject(this.viewTitleLine);
- var size = MWF.getTextSize(column.displayName, viewTitleCellNode);
- viewCell.setStyle("min-width", ""+size.x+"px");
- if (this.json.titleStyles) viewCell.setStyles(this.json.titleStyles);
- if( column.groupEntry && !this.expandTitleCell )this.expandTitleCell = viewCell;
- if( typeOf(column.titleStyles) === "object" )viewCell.setStyles(column.titleStyles);
- if( typeOf(column.titleProperties) === "object" )viewCell.setProperties(column.titleProperties);
- if( column.events && column.events.loadTitle && column.events.loadTitle.code ){
- var code = column.events.loadTitle.code;
- this.Macro.fire( code, {"node" : viewCell, "json" : column, "data" : column.displayName, "view" : this});
- }
- }else{
- this.hideColumns.push(column.column);
- }
- if (column.allowOpen) this.openColumns.push(column.column);
- }.bind(this));
- this.lookup(data, callback);
- }else{
- this.entries = {};
- this.viewJson.selectList.each(function(column){
- this.entries[column.column] = column;
- if (column.hideColumn) this.hideColumns.push(column.column);
- if (column.allowOpen) this.openColumns.push(column.column);
- }.bind(this));
- this.lookup(data, callback);
- }
- },
- getExpandFlag : function(){
- if( this.options && this.options.isExpand )return this.options.isExpand;
- if( this.json && this.json.isExpand )return this.json.isExpand;
- if( this.viewJson && this.viewJson.isExpand )return this.viewJson.isExpand;
- return "no";
- },
- getSelectFlag : function( ignoreSelectEnable ){
- if( !ignoreSelectEnable && !this.viewSelectedEnable )return "none";
- if( this.options && this.options.select )return this.options.select;
- if( this.json && this.json.select )return this.json.select;
- if( this.viewJson && this.viewJson.select )return this.viewJson.select;
- // if( this.json.select === "single" || this.json.select === "multi" )return this.json.select;
- // if( this.viewJson.select === "single" || this.viewJson.select === "multi" )return this.viewJson.select;
- // if( this.options.select === "single" || this.options.select === "multi" )return this.options.select;
- return "none";
- },
- isSelectTdHidden :function(){
- if( !this.viewJson.firstTdHidden ){
- return false;
- }
- if( this.viewJson.group && this.viewJson.group.column ){
- return false;
- }
- if( this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
- return false;
- }
- // if( !this.viewSelectedEnable ){
- // return true;
- // }
- if( this.options && this.options.select ){
- return this.options.select === "none" || this.options.select === "no";
- }
- if( this.json && this.json.select ){
- return this.json.select === "none" || this.json.select === "no";
- }
- if( this.viewJson && this.viewJson.select ){
- return this.viewJson.select === "none" || this.viewJson.select === "no";
- }
- return true;
- // if( this.json.select === "single" || this.json.select === "multi" || this.json.defaultSelectedScript || this.viewJson.defaultSelectedScript ){
- // return false;
- // }
- // if( this.options.select === "single" || this.options.select === "multi" ){
- // return false;
- // }
- // if( this.viewJson.select === "single" || this.viewJson.select === "multi" ){
- // return false;
- // }
- // if( this.viewJson.group && this.viewJson.group.column ){
- // return false;
- // }
- // return true;
- },
- // _loadPageCountNode: function(){
- // this.viewPageContentNode.empty();
- //
- // var size = this.viewPageAreaNode.getSize();
- // var w1 = this.viewPageFirstNode.getSize().x*2;
- // var w2 = this.viewPageContentNode.getStyle("margin-left").toInt();
- // var w = size.x-w1-w2;
- //
- // var bw = this.css.viewPageButtonNode.width.toInt()+this.css.viewPageButtonNode["margin-right"].toInt();
- // var count = (w/bw).toInt()-2;
- // if (count>10) count = 10;
- // this.showPageCount = Math.min(count, this.pages);
- //
- // var tmp = this.showPageCount/2;
- // var n = tmp.toInt();
- // var left = this.currentPage-n;
- // if (left<=0) left = 1;
- // var right = this.showPageCount + left-1;
- // if (right>this.pages) right = this.pages;
- // left = right-this.showPageCount+1;
- // if (left<=1) left = 1;
- //
- // this.viewPagePrevNode = new Element("div", {"styles": this.css.viewPagePrevButtonNode}).inject(this.viewPageContentNode);
- // this.loadPageButtonEvent(this.viewPagePrevNode, "viewPagePrevButtonNode_over", "viewPagePrevButtonNode_up", "viewPagePrevButtonNode_down", function(){
- // if (this.currentPage>1) this.currentPage--;
- // this.loadCurrentPageData();
- // }.bind(this));
- //
- // for (i=left; i<=right; i++){
- // var node = new Element("div", {"styles": this.css.viewPageButtonNode, "text": i}).inject(this.viewPageContentNode);
- // if (i==this.currentPage){
- // node.setStyles(this.css.viewPageButtonNode_current);
- // }else{
- // this.loadPageButtonEvent(node, "viewPageButtonNode_over", "viewPageButtonNode_up", "viewPageButtonNode_down", function(e){
- // this.currentPage = e.target.get("text").toInt();
- // this.loadCurrentPageData();
- // }.bind(this));
- // }
- // }
- // this.viewPageNextNode = new Element("div", {"styles": this.css.viewPageNextButtonNode}).inject(this.viewPageContentNode);
- // this.loadPageButtonEvent(this.viewPageNextNode, "viewPageNextButtonNode_over", "viewPageNextButtonNode_up", "viewPageNextButtonNode_down", function(){
- // if (this.currentPage<=this.pages-1) this.currentPage++;
- // this.loadCurrentPageData();
- // }.bind(this));
- // },
- // loadPageButtonEvent: function(node, over, out, down, click){
- // node.addEvents({
- // "mouseover": function(){node.setStyles(this.css[over])}.bind(this),
- // "mouseout": function(){node.setStyles(this.css[out])}.bind(this),
- // "mousedown": function(){node.setStyles(this.css[down])}.bind(this),
- // "mouseup": function(){node.setStyles(this.css[out])}.bind(this),
- // "click": click
- // });
- // },
- // _loadPageNode: function(){
- // this.viewPageAreaNode.empty();
- // this.viewPageFirstNode = new Element("div", {"styles": this.css.viewPageFirstLastNode, "text": this.lp.firstPage}).inject(this.viewPageAreaNode);
- // this.viewPageContentNode = new Element("div", {"styles": this.css.viewPageContentNode}).inject(this.viewPageAreaNode);
- // this.viewPageLastNode = new Element("div", {"styles": this.css.viewPageFirstLastNode, "text": this.lp.lastPage}).inject(this.viewPageAreaNode);
- // this._loadPageCountNode();
- //
- // this.loadPageButtonEvent(this.viewPageFirstNode, "viewPageFirstLastNode_over", "viewPageFirstLastNode_up", "viewPageFirstLastNode_down", function(){
- // this.currentPage = 1;
- // this.loadCurrentPageData();
- // }.bind(this));
- // this.loadPageButtonEvent(this.viewPageLastNode, "viewPageFirstLastNode_over", "viewPageFirstLastNode_up", "viewPageFirstLastNode_down", function(){
- // this.currentPage = this.pages;
- // this.loadCurrentPageData();
- // }.bind(this));
- // },
- _loadPageNode : function(){
- this.viewPageAreaNode.empty();
- if( this.viewJson.pagingbarHidden === true ){
- return;
- }
- if( !this.paging ){
- var json;
- if( !this.viewJson.pagingList || !this.viewJson.pagingList.length ){
- json = {
- "firstPageText": this.lp.firstPage,
- "lastPageText": this.lp.lastPage
- };
- }else{
- json = this.viewJson.pagingList[0];
- }
- this.paging = new MWF.xApplication.query.Query.Viewer.Paging(this.viewPageAreaNode, json, this, {});
- this.paging.load();
- }else{
- this.paging.reload();
- }
- },
- _initPage: function(){
- this.count = this.bundleItems.length;
- var i = this.count/this.json.pageSize;
- this.pages = (i.toInt()<i) ? i.toInt()+1 : i;
- this.currentPage = this.options.defaultPage || 1;
- this.options.defaultPage = null;
- this.exportExcelStart = null;
- this.exportExcelEnd = null;
- },
- lookup: function(data, callback){
- if( this.lookuping )return;
- this.lookuping = true;
- this.getLookupAction(function(){
- if (this.json.application){
- var d = data || {};
- d.count = this.json.count;
- this.lookupAction.bundleView(this.json.id, d, function(json){
- this.bundleItems = json.data.valueList;
- this.bundleKey = json.data.key;
- this._initPage();
- if (this.bundleItems.length){
- if( this.noDataTextNode )this.noDataTextNode.destroy();
- this.loadCurrentPageData( function () {
- this.fireEvent("postLoad"); //用户配置的事件
- this.lookuping = false;
- if(callback)callback(this);
- }.bind(this));
- }else{
- //this._loadPageNode();
- this.viewPageAreaNode.empty();
- if( this.viewJson.noDataText ){
- var noDataTextNodeStyle = this.css.noDataTextNode;
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["noDataTextNode"] ){
- noDataTextNodeStyle = this.viewJson.viewStyles["noDataTextNode"];
- }
- this.noDataTextNode = new Element( "div", {
- "styles": noDataTextNodeStyle,
- "text" : this.viewJson.noDataText
- }).inject( this.contentAreaNode );
- }
- if (this.loadingAreaNode){
- this.loadingAreaNode.destroy();
- this.loadingAreaNode = null;
- }
- this.fireEvent("postLoad"); //用户配置的事件
- this.lookuping = false;
- if(callback)callback(this);
- }
- }.bind(this));
- }
- }.bind(this));
- },
- loadCurrentPageData: function( callback, async ){
- //是否需要在翻页的时候清空之前的items ?
- if( this.pageloading )return;
- this.pageloading = true;
- if( this.io ){
- this.items.each(function(item){
- this.io.unobserve(item.node);
- }.bind(this))
- }
- this.items = [];
- var p = this.currentPage;
- var d = {};
- var valueList = this.bundleItems.slice((p-1)*this.json.pageSize,this.json.pageSize*p);
- d.bundleList = valueList;
- d.key = this.bundleKey;
- while (this.viewTable.rows.length>1){
- this.viewTable.deleteRow(-1);
- }
- if( this.viewTable.rows.length>0 && !this.viewTable.rows[0].hasClass("viewTitleLine") ){
- this.viewTable.deleteRow(0);
- }
- this.contentAreaNode.scrollTo(0, 0);
- //this.createLoadding();
- this.loadViewRes = this.lookupAction.loadView(this.json.name, this.json.application, d, function(json){
- this.viewData = json.data;
- this.fireEvent("postLoadPageData");
- if (this.viewJson.group.column){
- this.gridJson = json.data.groupGrid;
- this.setSelectedableFlag();
- this.loadGroupData();
- }else{
- this.gridJson = json.data.grid;
- this.setSelectedableFlag();
- this.loadData();
- }
- if (this.gridJson.length) this._loadPageNode();
- if (this.loadingAreaNode){
- this.loadingAreaNode.destroy();
- this.loadingAreaNode = null;
- }
- this.pageloading = false;
- this.fireEvent("loadView"); //options 传入的事件
- this.fireEvent("postLoadPage");
- if(callback)callback();
- }.bind(this), null, async === false ? false : true );
- },
- setSelectedableFlag : function(){
- this.viewSelectedEnable = false;
- var selectedAbleScript = this.json.selectedAbleScript || this.viewJson.selectedAbleScript;
- if (this.viewJson.group.column){
- this.gridJson.each( function( d ){
- d.list.each( function( v ){
- if( selectedAbleScript ){
- v.$selectedEnable = this.Macro.exec( selectedAbleScript, { "data" : v, "groupData" : d ,"view": this });
- }else{
- v.$selectedEnable = true;
- }
- if( v.$selectedEnable ){
- d.$selectedEnable = true;
- this.viewSelectedEnable = true;
- }
- }.bind(this))
- }.bind(this))
- }else{
- this.gridJson.each( function( v ){
- if( selectedAbleScript ){
- v.$selectedEnable = this.Macro.exec( selectedAbleScript, { "data" : v, "view": this });
- }else{
- v.$selectedEnable = true;
- }
- if( v.$selectedEnable )this.viewSelectedEnable = true;
- }.bind(this))
- }
- },
- getMode: function(){
- return this.viewJson.group.column ? "group" : "item";
- },
- createSelectAllNode: function(){
- if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ){
- if (this.selectTitleCell && !this.selectTitleCell.retrieve("selectAllLoaded") ){
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkboxNode"] ){
- this.selectAllNode = this.selectTitleCell;
- this.selectAllNode.setStyles( this.viewJson.viewStyles["checkboxNode"] );
- // this.selectAllNode = new Element("div", {
- // styles : this.viewJson.viewStyles["checkboxNode"]
- // }).inject( this.selectTitleCell );
- }else{
- this.selectAllNode.html( "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>" )
- // this.selectAllNode = new Element("div",{
- // html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>",
- // style : "font-family: Webdings"
- // }).inject( this.selectTitleCell );
- }
- this.selectTitleCell.setStyle("cursor", "pointer");
- this.selectTitleCell.addEvent("click", function () {
- if( this.getSelectAllStatus() === "all" ){
- this.unSelectAll("view")
- }else{
- this.selectAll("view");
- }
- }.bind(this));
- this.selectTitleCell.store("selectAllLoaded", true);
- }
- }
- },
- loadData: function(){
- if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ) {
- if(this.selectTitleCell && this.selectTitleCell.retrieve("selectAllLoaded")){
- this.setUnSelectAllStyle();
- }else{
- this.createSelectAllNode();
- }
- }else if(this.selectAllNode){
- this.clearSelectAllStyle();
- }
- if (this.gridJson.length){
- // if( !this.options.paging ){
- this.gridJson.each(function(line, i){
- this.items.push(new MWF.xApplication.query.Query.Viewer.Item(this, line, null, i, null, this.options.lazy));
- }.bind(this));
- // }else{
- // this.loadPaging();
- // }
- }else{
- if (this.viewPageAreaNode) this.viewPageAreaNode.empty();
- }
- },
- loadPaging : function(){
- this.isItemsLoading = false;
- this.pageNumber = 0;
- this.isItemsLoaded = false;
- this.isSetedScroll = false;
- this.setScroll();
- this.loadDataByPaging()
- },
- setScroll : function(){
- if( this.options.paging && !this.isSetedScroll ){
- this.contentAreaNode.setStyle("overflow","auto");
- this.scrollContainerFun = function(){
- var scrollSize = this.contentAreaNode.getScrollSize();
- var clientSize = this.contentAreaNode.getSize();
- var scrollHeight = scrollSize.y - clientSize.y;
- //alert( "clientSize.y=" + clientSize.y + " scrollSize.y="+scrollSize.y + " this.contentAreaNode.scrollTop="+this.contentAreaNode.scrollTop);
- if (this.contentAreaNode.scrollTop + 150 > scrollHeight ) {
- if (!this.isItemsLoaded) this.loadDataByPaging();
- }
- }.bind(this);
- this.isSetedScroll = true;
- this.contentAreaNode.addEvent("scroll", this.scrollContainerFun )
- }
- },
- loadDataByPaging : function(){
- if( this.isItemsLoading )return;
- if( !this.isItemsLoaded ){
- var from = Math.min( this.pageNumber * this.options.perPageCount , this.gridJson.length);
- var to = Math.min( ( this.pageNumber + 1 ) * this.options.perPageCount + 1 , this.gridJson.length);
- this.isItemsLoading = true;
- for( var i = from; i<to; i++ ){
- this.items.push(new MWF.xApplication.query.Query.Viewer.Item(this, this.gridJson[i], null, i, null, this.options.lazy));
- }
- this.isItemsLoading = false;
- this.pageNumber ++;
- if( to == this.gridJson.length )this.isItemsLoaded = true;
- }
- },
- loadGroupData: function(){
- if( this.getSelectFlag() === "multi" && this.viewJson.allowSelectAll ) {
- if(this.selectTitleCell && this.selectTitleCell.retrieve("selectAllLoaded")){
- this.setUnSelectAllStyle();
- }else{
- this.createSelectAllNode();
- }
- }else if( this.selectAllNode ){
- this.clearSelectAllStyle();
- }
- if( this.expandTitleCell ){
- if ( !this.expandTitleCell.retrieve("expandLoaded") ){
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
- this.expandAllNode = new Element("span", {
- styles : this.viewJson.viewStyles["groupCollapseNode"]
- }).inject( this.expandTitleCell, "top" );
- // this.selectTitleCell.setStyle("cursor", "pointer");
- }else{
- // this.selectTitleCell.set("html", "<span style='font-family: Webdings'>"+"<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>"+"</span>");
- this.expandAllNode = new Element("span",{
- html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>"+"</span>",
- style : "font-family: Webdings"
- }).inject( this.expandTitleCell, "top" );
- }
- this.expandTitleCell.setStyle("cursor", "pointer");
- this.expandTitleCell.addEvent("click", this.expandOrCollapseAll.bind(this));
- this.expandTitleCell.store("expandLoaded", true);
- }else if( this.getExpandFlag() !=="yes" ){
- this.setCollapseAllStyle();
- }
- }
- // this.isAllExpanded = false;
- if (this.gridJson.length){
- var i = 0;
- this.gridJson.each(function(data){
- this.items.push(new MWF.xApplication.query.Query.Viewer.ItemCategory(this, data, i));
- i += data.list.length;
- }.bind(this));
- if (this.getExpandFlag()=="yes") this.expandOrCollapseAll();
- }else{
- if (this.viewPageAreaNode) this.viewPageAreaNode.empty();
- }
- },
- getView: function(callback){
- this.getLookupAction(function(){
- if (this.json.application){
- this.getViewRes = this.lookupAction.getView(this.json.viewName, this.json.application, function(json){
- this.viewJson = JSON.decode(json.data.data);
- this.json = Object.merge(this.json, json.data);
- if (callback) callback();
- }.bind(this));
- // this.lookupAction.invoke({"name": "getView","async": true, "parameter": {"view": this.json.viewName, "application": this.json.application},"success": function(json){
- // this.viewJson = JSON.decode(json.data.data);
- // this.json = Object.merge(this.json, json.data);
- // //var viewData = JSON.decode(json.data.data);
- // if (callback) callback();
- // }.bind(this)});
- }else{
- this.getViewRes = this.lookupAction.getViewById(this.json.viewId, function(json){
- this.viewJson = JSON.decode(json.data.data);
- this.json.application = json.data.query;
- this.json = Object.merge(this.json, json.data);
- if (callback) callback();
- }.bind(this));
- }
- }.bind(this));
- },
- getLookupAction: function(callback){
- if (!this.lookupAction){
- this.lookupAction = MWF.Actions.get("x_query_assemble_surface");
- if (callback) callback();
- // var _self = this;
- // MWF.require("MWF.xDesktop.Actions.RestActions", function(){
- // this.lookupAction = new MWF.xDesktop.Actions.RestActions("", this.options.actionRoot, "");
- // this.lookupAction.getActions = function(actionCallback){
- // this.actions = _self.options.actions;
- // if (actionCallback) actionCallback();
- // };
- // if (callback) callback();
- // }.bind(this));
- }else{
- if (callback) callback();
- }
- },
- hide: function(){
- this.node.setStyle("display", "none");
- },
- reload: function( callback ){
- if( this.lookuping || this.pageloading )return;
- this.node.setStyle("display", "block");
- if (this.loadingAreaNode) this.loadingAreaNode.setStyle("display", "block");
- this.filterItems.each(function(filter){
- filter.destroy();
- }.bind(this));
- this.filterItems = [];
- if (this.viewSearchInputNode) this.viewSearchInputNode.set("text", this.lp.searchKeywork);
- this.closeCustomSearch();
- this.viewAreaNode.empty();
- this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}, callback);
- },
- getFilter: function(){
- var filterData = [];
- if (this.searchStatus==="custom"){
- if (this.filterItems.length){
- this.filterItems.each(function(filter){
- filterData.push(filter.data);
- }.bind(this));
- }
- }
- if (this.searchStatus==="default"){
- var key = this.viewSearchInputNode.get("value");
- if (key && key!==this.lp.searchKeywork){
- this.viewJson.customFilterList.each(function(entry){
- if (entry.formatType==="textValue"){
- var d = {
- "path": entry.path,
- "value": key,
- "formatType": entry.formatType,
- "logic": "or",
- "comparison": "like"
- };
- filterData.push(d);
- }
- if (entry.formatType==="numberValue"){
- var v = key.toFloat();
- if (!isNaN(v)){
- var d = {
- "path": entry.path,
- "value": v,
- "formatType": entry.formatType,
- "logic": "or",
- "comparison": "like"
- };
- filterData.push(d);
- }
- }
- }.bind(this));
- }
- }
- return (filterData.length) ? filterData : null;
- },
- getData: function(){
- if (this.selectedItems.length){
- var arr = [];
- this.selectedItems.each(function(item){
- arr.push(item.data);
- });
- return arr;
- }else{
- return [];
- }
- },
- _loadModuleEvents : function(){
- Object.each(this.viewJson.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event, target){
- return this.Macro.fire(e.code, target || this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- _loadDomEvents: function(){
- Object.each(this.viewJson.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)===-1){
- this.node.addEvent(key, function(event){
- return this.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- //搜索相关开始
- createSearchNode: function(){
- if( this.viewJson.searchbarHidden === true ){
- return;
- }
- if (this.viewJson.customFilterList && this.viewJson.customFilterList.length){
- this.searchStatus = "default";
- this.loadFilterSearch();
- }else{
- this.loadSimpleSearch();
- }
- },
- loadSimpleSearch: function(){
- return false;
- this.searchSimpleNode = new Element("div", {"styles": this.css.searchSimpleNode}).inject(this.searchAreaNode);
- this.searchSimpleButtonNode = new Element("div", {"styles": this.css.searchSimpleButtonNode}).inject(this.searchSimpleNode);
- this.searchSimpleInputNode = new Element("input", {"type":"text", "styles": this.css.searchSimpleInputNode, "value": this.lp.searchKeywork}).inject(this.searchSimpleNode);
- this.searchSimpleButtonNode.addEvent("click", function(){
- this.search();
- }.bind(this));
- this.searchSimpleInputNode.addEvents({
- "focus": function(){
- if (this.searchSimpleInputNode.get("value")===this.lp.searchKeywork) this.searchSimpleInputNode.set("value", "");
- }.bind(this),
- "blur": function(){if (!this.searchSimpleInputNode.get("value")) this.searchSimpleInputNode.set("value", this.lp.searchKeywork);}.bind(this),
- "keydown": function(e){
- if (e.code===13) this.search();
- }.bind(this)
- });
- },
- search: function(){
- if (this.gridJson){
- var key = this.searchSimpleInputNode.get("value");
- var rows = this.viewTable.rows;
- var first = (this.json.isTitle!=="no") ? 1 : 0;
- for (var i = first; i<rows.length; i++){
- var tr = rows[i];
- if (!key || key==this.lp.searchKeywork){
- if (tr.getStyle("display")==="none") tr.setStyle("display", "table-row");
- }else{
- if (tr.get("text").indexOf(key)!==-1){
- if (tr.getStyle("display")==="none") tr.setStyle("display", "table-row");
- }else{
- if (tr.getStyle("display")!=="none") tr.setStyle("display", "none");
- }
- }
- }
- //if (this.viewPageAreaNode) this.viewPageAreaNode.hide();
- }
- },
- loadFilterSearch: function(){
- this.viewSearchCustomActionNode = new Element("div", {"styles": this.css.viewFilterSearchCustomActionNode, "text": this.lp.customSearch}).inject(this.searchAreaNode);
- this.viewSearchInputAreaNode = new Element("div", {"styles": this.css.viewFilterSearchInputAreaNode}).inject(this.searchAreaNode);
- this.viewSearchIconNode = new Element("div", {"styles": this.css.viewFilterSearchIconNode}).inject(this.viewSearchInputAreaNode);
- this.viewSearchInputBoxNode = new Element("div", {"styles": this.css.viewFilterSearchInputBoxNode}).inject(this.viewSearchInputAreaNode);
- this.viewSearchInputNode = new Element("input", {"styles": this.css.viewFilterSearchInputNode, "value": this.lp.searchKeywork}).inject(this.viewSearchInputBoxNode);
- this.viewSearchInputNode.addEvents({
- "focus": function(){
- if (this.viewSearchInputNode.get("value")===this.lp.searchKeywork) this.viewSearchInputNode.set("value", "");
- }.bind(this),
- "blur": function(){if (!this.viewSearchInputNode.get("value")) this.viewSearchInputNode.set("value", this.lp.searchKeywork);}.bind(this),
- "keydown": function(e){
- if (e.code===13) this.searchView();
- }.bind(this)
- });
- this.viewSearchIconNode.addEvents({
- "click": function(){this.searchView();}.bind(this)
- });
- this.viewSearchCustomActionNode.addEvents({
- "click": function(){this.loadCustomSearch();}.bind(this)
- });
- },
- searchView: function(){
- debugger;
- if (this.viewJson.customFilterList) {
- var key = this.viewSearchInputNode.get("value");
- if (key && key !== this.lp.searchKeywork) {
- var filterData = [];
- this.filterItems = [];
- this.viewJson.customFilterList.each(function (entry) {
- if (entry.formatType === "textValue") {
- var d = {
- "path": entry.path,
- "value": key,
- "formatType": entry.formatType,
- "logic": "or",
- "comparison": "like"
- };
- filterData.push(d);
- this.filterItems.push({"data":d});
- }
- if (entry.formatType === "numberValue") {
- var v = key.toFloat();
- if (!isNaN(v)) {
- var d = {
- "path": entry.path,
- "value": v,
- "formatType": entry.formatType,
- "logic": "or",
- "comparison": "equals"
- };
- filterData.push(d);
- this.filterItems.push({"data":d});
- }
- }
- }.bind(this));
- if( this.json.filter ){
- this.json.filter.clone().each(function(f){
- filterData.push(f);
- })
- }
- this.createViewNode({"filterList": filterData});
- }else{
- this.filterItems = [];
- var filterData = this.json.filter ? this.json.filter.clone() : [];
- this.createViewNode( {"filterList": filterData} );
- }
- }
- },
- searchCustomView: function(){
- if (this.filterItems.length){
- var filterData = this.json.filter ? this.json.filter.clone() : [];
- this.filterItems.each(function(filter){
- filterData.push(filter.data);
- }.bind(this));
- this.createViewNode({"filterList": filterData});
- }else{
- this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null});
- }
- },
- loadCustomSearch: function(){
- if( this.lastFilterItems ){
- this.filterItems = this.lastFilterItems;
- }else{
- this.filterItems = [];
- }
- debugger;
- this.viewSearchIconNode.setStyle("display", "none");
- this.viewSearchInputBoxNode.setStyle("display", "none");
- this.viewSearchCustomActionNode.setStyle("display", "none");
- if (!this.searchMorph) this.searchMorph = new Fx.Morph(this.viewSearchInputAreaNode);
- var x = this.viewSearchInputAreaNode.getParent().getSize().x-2-20;
- this.css.viewFilterSearchInputAreaNode_custom.width = ""+x+"px";
- var x1 = this.viewSearchInputAreaNode.getSize().x-2;
- this.viewSearchInputAreaNode.setStyle("width", ""+x1+"px");
- this.searchMorph.start(this.css.viewFilterSearchInputAreaNode_custom).chain(function(){
- this.searchStatus = "custom";
- this.css.viewFilterSearchInputAreaNode_custom.width = "auto";
- this.viewSearchInputAreaNode.setStyle("width", "auto");
- if (this.viewSearchCustomContentNode){
- this.viewSearchCustomCloseActionNode.setStyle("display", "block");
- this.viewSearchCustomContentNode.setStyle("display", "block");
- }else{
- this.loadCustomSearchContent();
- }
- if(this.setContentHeightFun)this.setContentHeightFun();
- }.bind(this));
- this.searchCustomView();
- },
- loadCustomSearchContent: function(){
- this.viewSearchCustomCloseActionNode = new Element("div", {"styles": this.css.viewFilterSearchCustomCloseActionNode}).inject(this.viewSearchInputAreaNode);
- this.viewSearchCustomContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomContentNode}).inject(this.viewSearchInputAreaNode);
- this.viewSearchCustomPathContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomPathContentNode}).inject(this.viewSearchCustomContentNode);
- this.viewSearchCustomComparisonContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomComparisonContentNode}).inject(this.viewSearchCustomContentNode);
- this.viewSearchCustomValueContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomValueContentNode}).inject(this.viewSearchCustomContentNode);
- this.viewSearchCustomAddContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomAddContentNode}).inject(this.viewSearchCustomContentNode);
- this.viewSearchCustomAddIconNode = new Element("div", {"styles": this.css.viewFilterSearchCustomAddIconNode}).inject(this.viewSearchCustomAddContentNode);
- this.viewSearchCustomFilterContentNode = new Element("div", {"styles": this.css.viewFilterSearchCustomFilterContentNode}).inject(this.viewSearchCustomContentNode);
- this.loadViewSearchCustomList();
- this.viewSearchCustomCloseActionNode.addEvents({
- "click": function(){this.closeCustomSearch();}.bind(this)
- });
- this.viewSearchCustomAddIconNode.addEvents({
- "click": function(){this.viewSearchCustomAddToFilter();}.bind(this)
- });
- },
- loadViewSearchCustomList: function(){
- this.viewSearchCustomPathListNode = new Element("select", {
- "styles": this.css.viewFilterSearchCustomPathListNode,
- "multiple": true
- }).inject(this.viewSearchCustomPathContentNode);
- this.viewSearchCustomComparisonListNode = new Element("select", {
- "styles": this.css.viewFilterSearchCustomComparisonListNode,
- "multiple": true
- }).inject(this.viewSearchCustomComparisonContentNode);
- this.viewJson.customFilterList.each(function(entry){
- var option = new Element("option", {
- "style": this.css.viewFilterSearchOptionNode,
- "value": entry.path,
- "text": entry.title
- }).inject(this.viewSearchCustomPathListNode);
- option.store("entry", entry);
- }.bind(this));
- this.viewSearchCustomPathListNode.addEvent("change", function(){
- this.loadViewSearchCustomComparisonList();
- }.bind(this));
- },
- loadViewSearchCustomComparisonList: function(){
- var idx = this.viewSearchCustomPathListNode.selectedIndex;
- var option = this.viewSearchCustomPathListNode.options[idx];
- var entry = option.retrieve("entry");
- if (entry){
- var selectableList = this.getCustomSelectScriptResult(entry);
- switch (entry.formatType){
- case "numberValue":
- this.loadComparisonSelect(this.lp.numberFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else{
- this.loadViewSearchCustomValueNumberInput();
- }
- break;
- case "dateTimeValue":
- this.loadComparisonSelect(this.lp.dateFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else {
- this.loadViewSearchCustomValueDateTimeInput();
- }
- break;
- case "dateValue":
- this.loadComparisonSelect(this.lp.dateFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else {
- this.loadViewSearchCustomValueDateInput();
- }
- break;
- case "timeValue":
- this.loadComparisonSelect(this.lp.dateFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else {
- this.loadViewSearchCustomValueTimeInput();
- }
- break;
- case "booleanValue":
- this.loadComparisonSelect(this.lp.booleanFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else {
- this.loadViewSearchCustomValueBooleanInput();
- }
- break;
- default:
- this.loadComparisonSelect(this.lp.textFilter);
- if( selectableList.length > 0 ){
- this.loadViewSerchCustomSelectByScript(selectableList)
- }else {
- this.loadViewSearchCustomValueTextInput();
- }
- }
- }
- },
- getCustomSelectScriptResult : function( entry ){
- var scriptResult = [];
- if( entry.valueType === "script" ){
- if( entry.valueScript && entry.valueScript.code ){
- var result = this.Macro.exec(entry.valueScript.code, this);
- var array = typeOf( result ) === "array" ? result : [result];
- for( var i=0; i<array.length; i++ ){
- if( array[i].indexOf( "|" ) > -1 ){
- var arr = array[i].split("|");
- scriptResult.push({ "text" : arr[0], "value" : arr[1] })
- }else{
- scriptResult.push({ "text" : array[i], "value" : array[i] })
- }
- }
- }
- }
- return scriptResult;
- },
- loadViewSerchCustomSelectByScript: function( array ){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("select", {
- "styles": this.css.viewFilterSearchCustomComparisonListNode,
- "multiple": true
- }).inject(this.viewSearchCustomValueContentNode);
- array.each(function( v ){
- var option = new Element("option", {
- "style": this.css.viewFilterSearchOptionNode,
- "value": v.value,
- "text": v.text,
- "selected" : array.length === 1
- }).inject(this.viewSearchCustomValueNode);
- }.bind(this));
- },
- loadViewSearchCustomValueNumberInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("input", {
- "styles": this.css.viewFilterSearchCustomValueNode,
- "type": "number"
- }).inject(this.viewSearchCustomValueContentNode);
- },
- loadViewSearchCustomValueDateTimeInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("input", {
- "styles": this.css.viewFilterSearchCustomValueNode,
- "type": "text",
- "readonly": true
- }).inject(this.viewSearchCustomValueContentNode);
- MWF.require("MWF.widget.Calendar", function(){
- this.calendar = new MWF.widget.Calendar(this.viewSearchCustomValueNode, {
- "style": "xform",
- "isTime": true,
- "secondEnable" : true,
- "target": this.app ? this.app.content : this.container,
- "format": "db"
- });
- }.bind(this));
- },
- loadViewSearchCustomValueDateInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("input", {
- "styles": this.css.viewFilterSearchCustomValueNode,
- "type": "text",
- "readonly": true
- }).inject(this.viewSearchCustomValueContentNode);
- MWF.require("MWF.widget.Calendar", function(){
- this.calendar = new MWF.widget.Calendar(this.viewSearchCustomValueNode, {
- "style": "xform",
- "isTime": false,
- "target": this.app ? this.app.content : this.container,
- "format": "%Y-%m-%d"
- });
- }.bind(this));
- },
- loadViewSearchCustomValueTimeInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("input", {
- "styles": this.css.viewFilterSearchCustomValueNode,
- "type": "text",
- "readonly": true
- }).inject(this.viewSearchCustomValueContentNode);
- MWF.require("MWF.widget.Calendar", function(){
- this.calendar = new MWF.widget.Calendar(this.viewSearchCustomValueNode, {
- "style": "xform",
- "timeOnly": true,
- "target": this.app ? this.app.content : this.container,
- "format": "%H:%M:%S"
- });
- }.bind(this));
- },
- loadViewSearchCustomValueBooleanInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("select", {
- "styles": this.css.viewFilterSearchCustomValueSelectNode,
- "multiple": true
- }).inject(this.viewSearchCustomValueContentNode);
- new Element("option", {"value": "true","text": this.lp.yes}).inject(this.viewSearchCustomValueNode);
- new Element("option", {"value": "false","text": this.lp.no}).inject(this.viewSearchCustomValueNode);
- },
- loadViewSearchCustomValueTextInput: function(){
- this.viewSearchCustomValueContentNode.empty();
- this.viewSearchCustomValueNode = new Element("textarea", {
- "styles": this.css.viewFilterSearchCustomValueNode
- }).inject(this.viewSearchCustomValueContentNode);
- },
- loadComparisonSelect:function(obj){
- this.viewSearchCustomComparisonListNode.empty();
- Object.each(obj, function(v, k){
- var option = new Element("option", {"value": k,"text": v}).inject(this.viewSearchCustomComparisonListNode);
- }.bind(this));
- },
- closeCustomSearch: function(){
- if (this.viewSearchCustomContentNode && this.viewSearchCustomContentNode.getStyle("display")==="block"){
- this.viewSearchCustomCloseActionNode.setStyle("display", "none");
- this.viewSearchCustomContentNode.setStyle("display", "none");
- var x = this.viewSearchInputAreaNode.getParent().getSize().x;
- x1 = x-2-10-90;
- this.css.viewFilterSearchInputAreaNode.width = ""+x1+"px";
- var x1 = this.viewSearchInputAreaNode.getSize().x-2;
- this.viewSearchInputAreaNode.setStyle("width", ""+x1+"px");
- if (!this.searchMorph) this.searchMorph = new Fx.Morph(this.viewSearchInputAreaNode);
- this.searchMorph.start(this.css.viewFilterSearchInputAreaNode).chain(function(){
- this.searchStatus = "default";
- this.css.viewFilterSearchInputAreaNode.width = "auto";
- this.viewSearchInputAreaNode.setStyle("margin-right", "90px");
- this.viewSearchIconNode.setStyle("display", "block");
- this.viewSearchInputBoxNode.setStyle("display", "block");
- this.viewSearchCustomActionNode.setStyle("display", "block");
- if(this.setContentHeightFun)this.setContentHeightFun();
- }.bind(this));
- this.lastFilterItems = this.filterItems;
- this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null});
- }
- },
- viewSearchCustomAddToFilter: function(){
- var pathIdx = this.viewSearchCustomPathListNode.selectedIndex;
- var comparisonIdx = this.viewSearchCustomComparisonListNode.selectedIndex;
- if (pathIdx===-1){
- MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorTitle, this.viewSearchCustomPathListNode, {"x": 0, "y": 85});
- return false;
- }
- if (comparisonIdx===-1){
- MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorComparison, this.viewSearchCustomComparisonListNode, {"x": 0, "y": 85});
- return false;
- }
- var pathOption = this.viewSearchCustomPathListNode.options[pathIdx];
- var entry = pathOption.retrieve("entry");
- if (entry){
- var pathTitle = entry.title;
- var path = entry.path;
- var comparison = this.viewSearchCustomComparisonListNode.options[comparisonIdx].get("value");
- var comparisonTitle = this.viewSearchCustomComparisonListNode.options[comparisonIdx].get("text");
- var value = "";
- if( entry.valueType === "script" && entry.valueScript && entry.valueScript.code ){
- var idx = this.viewSearchCustomValueNode.selectedIndex;
- if (idx!==-1){
- var v = this.viewSearchCustomValueNode.options[idx].get("value");
- value = entry.formatType === "booleanValue" ? (v==="true") : v;
- }
- }else{
- switch (entry.formatType){
- case "numberValue":
- value = this.viewSearchCustomValueNode.get("value");
- break;
- case "dateTimeValue":
- value = this.viewSearchCustomValueNode.get("value");
- break;
- case "booleanValue":
- var idx = this.viewSearchCustomValueNode.selectedIndex;
- if (idx!==-1){
- var v = this.viewSearchCustomValueNode.options[idx].get("value");
- value = (v==="true");
- }
- break;
- default:
- value = this.viewSearchCustomValueNode.get("value");
- }
- }
- if (value===""){
- MWF.xDesktop.notice("error", {"x": "left", "y": "top"}, this.lp.filterErrorValue, this.viewSearchCustomValueContentNode, {"x": 0, "y": 85});
- return false;
- }
- this.filterItems.push(new MWF.xApplication.query.Query.Viewer.Filter(this, {
- "logic": "and",
- "path": path,
- "title": pathTitle,
- "comparison": comparison,
- "comparisonTitle": comparisonTitle,
- "value": value,
- "formatType": (entry.formatType=="datetimeValue") ? "dateTimeValue": entry.formatType
- }, this.viewSearchCustomFilterContentNode));
- this.searchCustomView();
- }
- },
- searchViewRemoveFilter: function(filter){
- this.filterItems.erase(filter);
- filter.destroy();
- this.searchCustomView()
- },
- //搜索相关结束
- //api 使用 开始
- getParentEnvironment : function(){
- return this.parentMacro ? this.parentMacro.environment : null;
- },
- getViewInfor : function(){
- return this.json;
- },
- getPageInfor : function(){
- return {
- pages : this.pages,
- perPageCount : this.options.perPageCount,
- currentPageNumber : this.currentPage
- };
- },
- getPageData : function () {
- return this.gridJson;
- },
- toPage : function( pageNumber, callback ){
- this.currentPage = pageNumber;
- this.loadCurrentPageData( callback );
- },
- getSelectedData : function(){
- return this.getData();
- },
- getSelectAllStatus : function(){
- if( this.getSelectFlag()!=="multi")return;
- if( !this.items.length )return "none";
- var allFlag = true, noneFlag = true;
- for( var i=0; i<this.items.length; i++ ){
- var item = this.items[i];
- if( item.clazzType === "item" ){
- if( item.data.$selectedEnable ){
- item.isSelected ? ( noneFlag = false ) : (allFlag = false);
- }
- }else{
- if( item.data.$selectedEnable ) {
- var f = item.getSelectAllStatus();
- if (f === "none") {
- allFlag = false;
- } else if (f === "all") {
- noneFlag = false;
- } else if (f === "some") {
- allFlag = false;
- noneFlag = false;
- }
- }
- }
- if( !allFlag && !noneFlag )return "some"
- }
- if( noneFlag )return "none";
- if( allFlag )return "all";
- return "some";
- },
- checkSelectAllStatus : function(){
- if(!this.selectAllNode)return;
- var status = this.getSelectAllStatus();
- if( status === "all" ){
- this.setSelectAllStyle()
- }else{
- this.setUnSelectAllStyle()
- }
- },
- setSelectAllStyle : function () {
- if(!this.selectAllNode)return;
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkedCheckboxNode"] ){
- this.selectAllNode.setStyles( this.viewJson.viewStyles["checkedCheckboxNode"] );
- }else {
- this.selectAllNode.getElement("img").set("src",
- '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox_checked.png' )
- }
- },
- setUnSelectAllStyle : function () {
- if(!this.selectAllNode)return;
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["checkboxNode"] ){
- this.selectAllNode.setStyles( this.viewJson.viewStyles["checkboxNode"] );
- }else {
- this.selectAllNode.getElement("img").set("src",
- '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox.png' )
- }
- },
- clearSelectAllStyle : function(){
- debugger;
- if(!this.selectAllNode)return;
- var viewStyles = this.viewJson.viewStyles;
- var viewTitleCellNode = (viewStyles && viewStyles["titleTd"]) ? viewStyles["titleTd"] : this.css.viewTitleCellNode;
- if( !viewTitleCellNode["background"] || !viewTitleCellNode["background-image"] || !viewTitleCellNode["background-color"] ){
- viewTitleCellNode["background"] = "inherit";
- }
- this.selectAllNode.setStyles( viewTitleCellNode );
- var img = this.selectAllNode.getElement("img");
- if( img )img.set("src", '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/blank.png')
- },
- selectAll : function(){
- // var flag = this.json.select || this.viewJson.select || "none";
- if ( this.getSelectFlag()==="multi"){
- this.items.each( function (item) {
- if( item.data.$selectedEnable ){
- if( item.clazzType === "item" ){
- item.selected("view");
- }else{
- item.selectAll("view");
- }
- }
- })
- if( this.viewJson.allowSelectAll ) {
- this.setSelectAllStyle();
- }
- }
- },
- unSelectAll : function(){
- // var flag = this.json.select || this.viewJson.select || "none";
- if ( this.getSelectFlag()==="multi"){
- this.items.each( function (item) {
- if( item.data.$selectedEnable ) {
- if (item.clazzType === "item") {
- item.unSelected("view");
- } else {
- item.unSelectAll("view");
- }
- }
- })
- if( this.viewJson.allowSelectAll ) {
- this.setUnSelectAllStyle();
- }
- }
- },
- getExpandAllStatus: function(){
- if( !this.items.length )return "none";
- var allFlag = true, noneFlag = true;
- for( var i=0; i<this.items.length; i++ ){
- var item = this.items[i];
- item.expanded ? ( noneFlag = false ) : (allFlag = false);
- if( !allFlag && !noneFlag )return "some"
- }
- if( allFlag )return "all";
- if( noneFlag )return "none";
- return "some";
- },
- checkExpandAllStatus: function(){
- if(!this.expandAllNode)return;
- var status = this.getExpandAllStatus();
- if( status === "all" ){
- this.setExpandAllStyle()
- }else{
- this.setCollapseAllStyle()
- }
- },
- setExpandAllStyle: function(){
- if(!this.expandAllNode)return;
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupExpandNode"] ){
- this.expandAllNode.setStyles( this.viewJson.viewStyles["groupExpandNode"] );
- }else{
- this.expandAllNode.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>");
- }
- },
- setCollapseAllStyle : function(){
- if(!this.expandAllNode)return;
- if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
- this.expandAllNode.setStyles( this.viewJson.viewStyles["groupCollapseNode"] );
- }else{
- this.expandAllNode.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/down.png'/>");
- }
- },
- expandAll: function(){
- this.items.each(function(item, i){
- window.setTimeout(function(){
- item.expand( "view" );
- }.bind(this), 10*i+5);
- }.bind(this));
- this.setExpandAllStyle();
- },
- collapseAll: function(){
- this.items.each(function(item){
- item.collapse( "view" );
- }.bind(this));
- this.setCollapseAllStyle();
- },
- expandOrCollapseAll: function(){
- this.getExpandAllStatus() === "all" ? this.collapseAll() : this.expandAll();
- // if( this.viewJson.viewStyles && this.viewJson.viewStyles["groupCollapseNode"] ){
- // var span = this.expandAllNode; //this.selectTitleCell.getElement("span");
- // if( this.isAllExpanded ){
- // this.items.each(function(item){
- // item.collapse();
- // span.setStyles( this.viewJson.viewStyles["groupCollapseNode"] );
- // }.bind(this));
- // this.isAllExpanded = false;
- // }else{
- // this.items.each(function(item, i){
- // window.setTimeout(function(){
- // item.expand();
- // }.bind(this), 10*i+5);
- //
- // span.setStyles( this.viewJson.viewStyles["groupExpandNode"] );
- // this.isAllExpanded = true;
- // }.bind(this));
- // }
- // }else{
- // var icon = this.expandAllNode; //this.selectTitleCell.getElement("span");
- // if (icon.get("html").indexOf("expand.png")===-1){
- // this.items.each(function(item){
- // item.collapse();
- // icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/expand.png'/>");
- // }.bind(this));
- // this.isAllExpanded = false;
- // }else{
- // this.items.each(function(item, i){
- // window.setTimeout(function(){
- // item.expand();
- // }.bind(this), 10*i+5);
- //
- // icon.set("html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/down.png'/>");
- // }.bind(this));
- // this.isAllExpanded = true;
- // }
- // }
- },
- setFilter : function( filter, callback ){
- if( this.lookuping || this.pageloading )return;
- if( !filter )filter = [];
- if( typeOf( filter ) === "object" )filter = [ filter ];
- this.json.filter = filter;
- if( this.viewAreaNode ){
- this.createViewNode({"filterList": this.json.filter ? this.json.filter.clone() : null}, callback);
- }
- },
- switchView : function( json ){
- debugger;
- // json = {
- // "application": application,
- // "viewName": viewName,
- // "isTitle": "yes",
- // "select": "none",
- // "titleStyles": titleStyles,
- // "itemStyles": itemStyles,
- // "isExpand": "no",
- // "filter": filter
- // }
- this.node.setStyle("display", "block");
- if (this.loadingAreaNode) this.loadingAreaNode.setStyle("display", "block");
- this.searchMorph = null;
- this.viewSearchCustomContentNode = null;
- this.paging = null;
- var newJson = Object.merge( Object.clone(this.originalJson), json );
- this.container.empty();
- this.initialize( this.container, newJson, Object.clone(this.options), this.app, this.parentMacro);
- },
- confirm: function (type, e, title, text, width, height, ok, cancel, callback, mask, style) {
- this.app.confirm(type, e, title, text, width, height, ok, cancel, callback, mask, style)
- },
- alert: function (type, title, text, width, height) {
- this.app.alert(type, "center", title, text, width, height);
- },
- notice: function (content, type, target, where, offset, option) {
- this.app.notice(content, type, target, where, offset, option)
- },
- //api 使用 结束
- loadObserver: function(){
- debugger;
- if( this.io ){
- this.io.disconnect();
- this.io = null;
- }
- if( !this.options.lazy )return;
- if (typeof window !== 'undefined' && window.IntersectionObserver) {
- this.io = new IntersectionObserver( function (entries, observer) {
- entries.forEach(function (entry) {
- if (entry.intersectionRatio > 0 || entry.isIntersecting) {
- var item = entry.target.retrieve("item");
- if( item && !item.loading && !item.loaded){ //已经加载完成
- item.active();
- }
- observer.unobserve(entry.target);
- }
- })
- }, {
- root: this.contentAreaNode,
- rootMargin: "10px 0px 0px 0px"
- });
- }
- },
- loadIOResource: function (callback) {
- if( !this.options.lazy ){
- callback();
- return;
- }
- var observerPath = "../o2_lib/IntersectionObserver/intersection-observer.min.js";
- var observerPath_ie11 = "../o2_lib/IntersectionObserver/polyfill_ie11.min.js";
- if( window.IntersectionObserver && window.MutationObserver) {
- if(callback)callback();
- }else if( !!window.MSInputMethodContext && !!document.documentMode ){ //ie11
- o2.load(observerPath_ie11, function () { callback(); }.bind(this));
- }else{
- o2.load([observerPath, observerPath_ie11], function () { callback(); }.bind(this));
- }
- }
- });
- MWF.xApplication.query.Query.Viewer.Item = new Class({
- initialize: function(view, data, prev, i, category, lazy){
- this.view = view;
- this.data = data;
- this.css = this.view.css;
- this.isSelected = false;
- this.category = category;
- this.prev = prev;
- this.idx = i;
- this.clazzType = "item";
- this.lazy = lazy;
- this.load();
- },
- load: function(){
- if( this.lazy && this.view.io ){
- this.view.fireEvent("queryLoadItemRow", [null, this]);
- this.loadNode();
- this.view.io.observe( this.node );
- }else{
- this._load();
- }
- },
- active: function(){
- if( !this.loaded && !this.loading ){
- this._load();
- }
- },
- loadNode: function(){
- var viewStyles = this.view.viewJson.viewStyles;
- var trStyle = ( viewStyles && viewStyles["contentTr"] ) ? viewStyles["contentTr"] : this.css.viewContentTrNode;
- this.node = new Element("tr", {
- "styles": trStyle
- });
- if (this.prev){
- this.node.inject(this.prev.node, "after");
- }else{
- this.node.inject(this.view.viewTable);
- }
- this.node.store("item", this);
- if( this.lazy && this.view.io ) {
- var viewContentTdNode = ( viewStyles && viewStyles["contentTd"] ) ? viewStyles["contentTd"] : this.css.viewContentTdNode;
- this.placeholderTd = new Element("td", {
- "styles": viewContentTdNode
- }).inject(this.node)
- }
- },
- _load: function(){
- this.loading = true;
- if(!this.node)this.view.fireEvent("queryLoadItemRow", [null, this]);
- var viewStyles = this.view.viewJson.viewStyles;
- var viewContentTdNode = ( viewStyles && viewStyles["contentTd"] ) ? viewStyles["contentTd"] : this.css.viewContentTdNode;
- if(!this.node)this.loadNode();
- //if (this.view.json.select==="single" || this.view.json.select==="multi"){
- this.selectTd = new Element("td", { "styles": viewContentTdNode }).inject(this.node);
- this.selectTd.setStyles({"cursor": "pointer"});
- if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
- //var selectFlag = this.view.json.select || this.view.viewJson.select || "none";
- var selectFlag = this.view.getSelectFlag();
- if ( this.data.$selectedEnable && ["multi","single"].contains(selectFlag) && this.view.viewJson.selectBoxShow==="always") {
- var viewStyles = this.view.viewJson.viewStyles;
- if (viewStyles) {
- if (selectFlag === "single") {
- this.selectTd.setStyles(viewStyles["radioNode"]);
- } else {
- this.selectTd.setStyles(viewStyles["checkboxNode"]);
- }
- } else {
- var iconName = "checkbox";
- if (selectFlag === "single") iconName = "radiobox";
- this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/" + iconName + ".png) center center no-repeat"});
- }
- }
- if( this.view.isSelectTdHidden() ){
- this.selectTd.hide();
- }
- //}
- //序号
- var sequence = 1+this.view.json.pageSize*(this.view.currentPage-1)+this.idx;
- this.data["$sequence"] = sequence;
- if (this.view.viewJson.isSequence==="yes"){
- this.sequenceTd = new Element("td", {"styles": viewContentTdNode}).inject(this.node);
- this.sequenceTd.setStyles({
- "width": "30px",
- "text-align": "center"
- });
- this.sequenceTd.set("text", sequence);
- }
- Object.each(this.view.entries, function(c, k){
- var cell = this.data.data[k];
- if (cell === undefined) cell = "";
- //if (cell){
- if (this.view.hideColumns.indexOf(k)===-1){
- var td = new Element("td", {"styles": viewContentTdNode}).inject(this.node);
- if (k!== this.view.viewJson.group.column){
- //var v = (this.view.entries[k].code) ? MWF.Macro.exec(this.view.entries[k].code, {"value": cell, "gridData": this.view.gridJson, "data": this.view.viewData, "entry": this.data}) : cell;
- var v = cell;
- if (c.isHtml){
- td.set("html", v);
- }else{
- td.set("text", v);
- }
- if( typeOf(c.contentProperties) === "object" )td.setProperties(c.contentProperties);
- if (this.view.json.itemStyles) td.setStyles(this.view.json.itemStyles);
- if( typeOf(c.contentStyles) === "object" )td.setStyles(c.contentStyles);
- }else{
- if (this.view.json.itemStyles) td.setStyles(this.view.json.itemStyles);
- }
- if (this.view.openColumns.indexOf(k)!==-1){
- this.setOpenWork(td, c)
- }
- if (k!== this.view.viewJson.group.column){
- Object.each( c.events || {}, function (e , key) {
- if(e.code){
- if( key === "loadContent" ){
- this.view.Macro.fire( e.code,
- {"node" : td, "json" : c, "data" : v, "view": this.view, "row" : this});
- }else if( key !== "loadTitle" ){
- td.addEvent(key, function(event){
- return this.view.Macro.fire(
- e.code,
- {"node" : td, "json" : c, "data" : v, "view": this.view, "row" : this},
- event
- );
- }.bind(this));
- }
- }
- }.bind(this));
- }
- }
- //}
- }.bind(this));
- if(this.placeholderTd){
- this.placeholderTd.destroy();
- this.placeholderTd = null;
- }
- //默认选中
- var selectedFlag;
- var defaultSelectedScript = this.view.json.defaultSelectedScript || this.view.viewJson.defaultSelectedScript;
- if( !this.isSelected && defaultSelectedScript ){
- // var flag = this.view.json.select || this.view.viewJson.select || "none";
- // if ( flag ==="single" || flag==="multi"){
- //
- // }
- selectedFlag = this.view.Macro.exec( defaultSelectedScript,
- {"node" : this.node, "data" : this.data, "view": this.view, "row" : this});
- }
- //判断是不是在selectedItems中,用户手工选择
- if( !this.isSelected && this.view.selectedItems.length ){
- for(var i=0; i<this.view.selectedItems.length; i++){
- if( this.view.selectedItems[i].data.bundle === this.data.bundle ){
- selectedFlag = "true";
- break;
- }
- }
- }
- if( selectedFlag ){
- if( selectedFlag === "multi" || selectedFlag === "single" ){
- this.select( selectedFlag );
- }else if( selectedFlag.toString() === "true" ){
- var f = this.view.json.select || this.view.viewJson.select || "none";
- if ( f ==="single" || f==="multi"){
- this.select();
- }
- }
- }
- // Object.each(this.data.data, function(cell, k){
- // if (this.view.hideColumns.indexOf(k)===-1){
- // var td = new Element("td", {"styles": this.css.viewContentTdNode}).inject(this.node);
- // if (k!== this.view.viewJson.group.column){
- // var v = (this.view.entries[k].code) ? MWF.Macro.exec(this.view.entries[k].code, {"value": cell, "gridData": this.view.gridJson, "data": this.view.viewData, "entry": this.data}) : cell;
- // td.set("text", v);
- // }
- // if (this.view.openColumns.indexOf(k)!==-1){
- // this.setOpenWork(td)
- // }
- // if (this.view.json.itemStyles) td.setStyles(this.view.json.itemStyles);
- // }
- // }.bind(this));
- this.setEvent();
- this.view.fireEvent("postLoadItemRow", [null, this]);
- this.loading = false;
- this.loaded = true;
- },
- setOpenWork: function(td, column){
- td.setStyle("cursor", "pointer");
- if( column.clickCode ){
- // if( !this.view.Macro ){
- // MWF.require("MWF.xScript.Macro", function () {
- // this.view.businessData = {};
- // this.view.Macro = new MWF.Macro.PageContext(this.view);
- // }.bind(this), false);
- // }
- td.addEvent("click", function( ev ){
- var result = this.view.Macro.fire(column.clickCode, this, ev);
- ev.stopPropagation();
- return result;
- }.bind(this));
- }else{
- if (this.view.json.type==="cms"){
- td.addEvent("click", function(ev){
- this.openCms(ev)
- ev.stopPropagation();
- }.bind(this));
- }else{
- td.addEvent("click", function(ev){
- this.openWorkAndCompleted(ev)
- ev.stopPropagation();
- }.bind(this));
- }
- }
- },
- openCms: function(e){
- var options = {"documentId": this.data.bundle};
- this.view.fireEvent("openDocument", [options, this]); //options 传入的事件
- layout.desktop.openApplication(e, "cms.Document", options);
- },
- openWorkAndCompleted: function(e){
- MWF.Actions.get("x_processplatform_assemble_surface").listWorkByJob(this.data.bundle, function(json){
- var workCompletedCount = json.data.workCompletedList.length;
- var workCount = json.data.workList.length;
- var count = workCount+workCompletedCount;
- if (count===1){
- if (workCompletedCount) {
- this.openWorkCompleted(json.data.workCompletedList[0].id, e);
- }else{
- this.openWork(json.data.workList[0].id, e);
- }
- }else if (count>1){
- var worksAreaNode = this.createWorksArea();
- json.data.workCompletedList.each(function(work){
- this.createWorkCompletedNode(work, worksAreaNode);
- }.bind(this));
- json.data.workList.each(function(work){
- this.createWorkNode(work, worksAreaNode);
- }.bind(this));
- this.showWorksArea(worksAreaNode, e);
- }else{
- }
- }.bind(this));
- },
- createWorkNode: function(work, worksAreaNode){
- var worksAreaContentNode = worksAreaNode.getLast();
- var node = new Element("div", {"styles": this.css.workAreaNode}).inject(worksAreaContentNode);
- var actionNode = new Element("div", {"styles": this.css.workAreaActionNode, "text": this.view.lp.open}).inject(node);
- actionNode.store("workId", work.id);
- actionNode.addEvent("click", function(e){
- this.openWork(e.target.retrieve("workId"), e);
- this.mask.hide();
- worksAreaNode.destroy();
- }.bind(this));
- var areaNode = new Element("div", {"styles": this.css.workAreaLeftNode}).inject(node);
- var titleNode = new Element("div", {"styles": this.css.workAreaTitleNode, "text": work.title}).inject(areaNode);
- var contentNode = new Element("div", {"styles": this.css.workAreaContentNode}).inject(areaNode);
- new Element("div", {"styles": this.css.workAreaContentTitleNode, "text": this.view.lp.activity+": "}).inject(contentNode);
- new Element("div", {"styles": this.css.workAreaContentTextNode, "text": work.activityName}).inject(contentNode);
- var taskUsers = [];
- MWF.Actions.get("x_processplatform_assemble_surface").listTaskByWork(work.id, function(json){
- json.data.each(function(task){
- taskUsers.push(MWF.name.cn(task.person));
- }.bind(this));
- new Element("div", {"styles": this.css.workAreaContentTitleNode, "text": this.view.lp.taskPeople+": "}).inject(contentNode);
- new Element("div", {"styles": this.css.workAreaContentTextNode, "text": taskUsers.join(", ")}).inject(contentNode);
- }.bind(this));
- },
- createWorkCompletedNode: function(work, worksAreaNode){
- var worksAreaContentNode = worksAreaNode.getLast();
- var node = new Element("div", {"styles": this.css.workAreaNode}).inject(worksAreaContentNode);
- var actionNode = new Element("div", {"styles": this.css.workAreaActionNode, "text": this.view.lp.open}).inject(node);
- actionNode.store("workId", work.id);
- actionNode.addEvent("click", function(e){
- this.mask.hide();
- var id = e.target.retrieve("workId");
- worksAreaNode.destroy();
- this.openWorkCompleted(id, e);
- }.bind(this));
- var areaNode = new Element("div", {"styles": this.css.workAreaLeftNode}).inject(node);
- var titleNode = new Element("div", {"styles": this.css.workAreaTitleNode, "text": work.title}).inject(areaNode);
- var contentNode = new Element("div", {"styles": this.css.workAreaContentNode}).inject(areaNode);
- new Element("div", {"styles": this.css.workAreaContentTitleNode, "text": this.view.lp.activity+": "}).inject(contentNode);
- new Element("div", {"styles": this.css.workAreaContentTextNode, "text": this.view.lp.processCompleted}).inject(contentNode);
- },
- createWorksArea: function(){
- var cssWorksArea = this.css.worksAreaNode
- if (layout.mobile) {
- cssWorksArea = this.css.worksAreaNodeMobile;
- }
- var worksAreaNode = new Element("div", {"styles": cssWorksArea});
- var worksAreaTitleNode = new Element("div", {"styles": this.css.worksAreaTitleNode}).inject(worksAreaNode);
- var worksAreaTitleCloseNode = new Element("div", {"styles": this.css.worksAreaTitleCloseNode}).inject(worksAreaTitleNode);
- worksAreaTitleCloseNode.addEvent("click", function(e){
- this.mask.hide();
- e.target.getParent().getParent().destroy();
- }.bind(this));
- var worksAreaContentNode = new Element("div", {"styles": this.css.worksAreaContentNode}).inject(worksAreaNode);
- return worksAreaNode;
- },
- showWorksArea: function(node, e){
- MWF.require("MWF.widget.Mask", null, false);
- this.mask = new MWF.widget.Mask({"style": "desktop", "loading": false});
- this.mask.loadNode(this.view.container);
- node.inject(this.view.node);
- this.setWorksAreaPosition(node, e.target);
- },
- setWorksAreaPosition: function(node, td){
- var p = td.getPosition(this.view.container);
- var containerS = this.view.container.getSize();
- var containerP = this.view.container.getPosition(this.view.container.getOffsetParent());
- var s = node.getSize();
- var offX = p.x+s.x-containerS.x;
- offX = (offX>0) ? offX+20 : 0;
- var offY = p.y+s.y-containerS.y;
- offY = (offY>0) ? offY+5 : 0;
- node.position({
- "relativeTo": td,
- "position": "lefttop",
- "edge": "lefttop",
- "offset": {
- "x": 0-offX,
- "y": 0-offY
- }
- });
- },
- openWork: function(id, e){
- var options = {"workId": id};
- this.view.fireEvent("openDocument", [options, this]); //options 传入的事件
- layout.desktop.openApplication(e, "process.Work", options);
- },
- openWorkCompleted: function(id, e){
- var options = {"workCompletedId": id};
- this.view.fireEvent("openDocument", [options, this]); //options 传入的事件
- layout.desktop.openApplication(e, "process.Work", options);
- },
- setEvent: function(){
- var flag = this.view.getSelectFlag();
- if ( this.data.$selectedEnable && (flag ==="single" || flag==="multi")){
- this.node.addEvents({
- "mouseover": function(){
- if (!this.isSelected && this.view.viewJson.selectBoxShow !=="always" ){
- var viewStyles = this.view.viewJson.viewStyles;
- if( viewStyles ){
- if( flag === "single" ){
- this.selectTd.setStyles( viewStyles["radioNode"] );
- }else{
- this.selectTd.setStyles( viewStyles["checkboxNode"] );
- }
- }else{
- var iconName = "checkbox";
- if (flag==="single") iconName = "radiobox";
- this.selectTd.setStyles({"background": "url("+"../x_component_query_Query/$Viewer/default/icon/"+iconName+".png) center center no-repeat"});
- }
- }
- }.bind(this),
- "mouseout": function(){
- if (!this.isSelected && this.view.viewJson.selectBoxShow !=="always") this.selectTd.setStyles({"background": "transparent"});
- }.bind(this),
- "click": function(){this.select();}.bind(this)
- });
- }
- },
- select: function( force ){
- debugger
- // var flag = force || this.view.json.select || this.view.viewJson.select || "none";
- var flag = force || this.view.getSelectFlag();
- if (this.isSelected){
- if (flag==="single"){
- this.unSelectedSingle();
- }else{
- this.unSelected();
- }
- }else{
- if (flag==="single"){
- this.selectedSingle();
- }else{
- this.selected();
- }
- }
- },
- selected: function( from ){
- for(var i=0; i<this.view.selectedItems.length; i++){
- var item = this.view.selectedItems[i];
- if( item.data.bundle === this.data.bundle ){
- this.view.selectedItems.erase(item);
- break;
- }
- }
- this.view.selectedItems.push(this);
- var viewStyles = this.view.viewJson.viewStyles;
- if( viewStyles ){
- this.selectTd.setStyles( viewStyles["checkedCheckboxNode"] );
- this.node.setStyles( viewStyles["contentSelectedTr"] );
- }else{
- this.selectTd.setStyles({"background": "url("+"../x_component_query_Query/$Viewer/default/icon/checkbox_checked.png) center center no-repeat"});
- this.node.setStyles(this.css.viewContentTrNode_selected);
- }
- this.isSelected = true;
- if( from !== "view" && from !=="category" && this.view.viewJson.allowSelectAll ){
- this.view.checkSelectAllStatus();
- if( this.category )this.category.checkSelectAllStatus();
- }
- this.view.fireEvent("selectRow", [this]);
- this.view.fireEvent("select", [{
- "selected": true,
- "item": this,
- "data": this.data
- }]); //options 传入的事件
- },
- unSelected: function( from ){
- for(var i=0; i<this.view.selectedItems.length; i++){
- var item = this.view.selectedItems[i];
- if( item.data.bundle === this.data.bundle ){
- this.view.selectedItems.erase(item);
- break;
- }
- }
- var viewStyles = this.view.viewJson.viewStyles;
- if( this.view.viewJson.selectBoxShow !=="always" ){
- this.selectTd.setStyles({"background": "transparent"});
- }else{
- if (viewStyles) {
- this.selectTd.setStyles(viewStyles["checkboxNode"]);
- }else{
- this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/checkbox.png) center center no-repeat"});
- }
- }
- if( viewStyles ){
- this.node.setStyles( viewStyles["contentTr"] );
- }else{
- this.node.setStyles(this.css.viewContentTrNode);
- }
- this.isSelected = false;
- if( from !== "view" && from !=="category" && this.view.viewJson.allowSelectAll ){
- this.view.checkSelectAllStatus();
- if( this.category )this.category.checkSelectAllStatus();
- }
- this.view.fireEvent("unselectRow", [this]);
- this.view.fireEvent("unselect", [{
- "selected": false,
- "item": this,
- "data": this.data
- }]); //options 传入的事件
- },
- selectedSingle: function(){
- if (this.view.currentSelectedItem) this.view.currentSelectedItem.unSelectedSingle();
- this.view.selectedItems = [this];
- this.view.currentSelectedItem = this;
- var viewStyles = this.view.viewJson.viewStyles;
- if( viewStyles ){
- this.selectTd.setStyles( viewStyles["checkedRadioNode"] );
- this.node.setStyles( viewStyles["contentSelectedTr"] );
- }else {
- this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/radiobox_checked.png) center center no-repeat"});
- this.node.setStyles(this.css.viewContentTrNode_selected);
- }
- this.isSelected = true;
- this.view.fireEvent("selectRow", [this]);
- this.view.fireEvent("select", [{
- "selected": true,
- "item": this,
- "data": this.data
- }]); //options 传入的事件
- },
- unSelectedSingle: function(){
- this.view.selectedItems = [];
- this.view.currentSelectedItem = null;
- var viewStyles = this.view.viewJson.viewStyles;
- if( this.view.viewJson.selectBoxShow !=="always" ){
- this.selectTd.setStyles({"background": "transparent"});
- }else{
- if (viewStyles) {
- this.selectTd.setStyles(viewStyles["radioNode"]);
- }else{
- this.selectTd.setStyles({"background": "url(" + "../x_component_query_Query/$Viewer/default/icon/radiobox.png) center center no-repeat"});
- }
- }
- if( viewStyles ){
- this.node.setStyles( viewStyles["contentTr"] );
- }else{
- this.node.setStyles(this.css.viewContentTrNode);
- }
- this.isSelected = false;
- this.view.fireEvent("unselectRow", [this]);
- this.view.fireEvent("unselect", [{
- "selected": false,
- "item": this,
- "data": this.data
- }]); //options 传入的事件
- }
- });
- MWF.xApplication.query.Query.Viewer.ItemCategory = new Class({
- initialize: function(view, data, i){
- this.view = view;
- this.data = data;
- this.css = this.view.css;
- this.items = [];
- this.loadChild = false;
- this.idx = i;
- this.clazzType = "category";
- this.load();
- },
- load: function(){
- this.view.fireEvent("queryLoadCategoryRow", [null, this]);
- var viewStyles = this.view.viewJson.viewStyles;
- var viewContentCategoryTdNode = ( viewStyles && viewStyles["contentGroupTd"] ) ? viewStyles["contentGroupTd"] : this.css.viewContentCategoryTdNode;
- this.node = new Element("tr", {
- "styles": (viewStyles && viewStyles["contentTr"]) ? viewStyles["contentTr"] : this.css.viewContentTrNode
- }).inject(this.view.viewTable);
- //if (this.view.json.select==="single" || this.view.json.select==="multi"){
- this.selectTd = new Element("td", {"styles": viewContentCategoryTdNode}).inject(this.node);
- if (this.view.json.itemStyles) this.selectTd.setStyles(this.view.json.itemStyles);
- if( this.data.$selectedEnable && this.view.getSelectFlag() === "multi" && this.view.viewJson.allowSelectAll ){
- this.selectAllNode = this.selectTd;
- if( viewStyles && viewStyles["checkboxNode"] ){
- this.selectAllNode.setStyles( viewStyles["checkboxNode"] )
- // this.selectAllNode = new Element("span", {
- // styles : viewStyles["checkboxNode"]
- // }).inject( this.selectTd );
- }else{
- this.selectAllNode.set( "html", "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>" )
- // this.selectAllNode = new Element("span",{
- // html : "<img src='../x_component_query_Query/$Viewer/"+this.options.style+"/icon/checkbox.png'/>"+"</span>",
- // style : "font-family: Webdings"
- // }).inject( this.selectTd );
- }
- this.selectAllNode.setStyle("cursor", "pointer");
- this.selectAllNode.addEvent("click", function (ev) {
- if( this.getSelectAllStatus() === "all" ){
- this.unSelectAll("category")
- }else{
- this.selectAll("category");
- }
- ev.stopPropagation();
- }.bind(this));
- }
- // if( this.view.isSelectTdHidden() ){
- // this.selectTd.hide();
- // }
- //}
- this.categoryTd = new Element("td", {
- "styles": viewContentCategoryTdNode,
- "colspan": this.view.viewJson.selectList.length+1
- }).inject(this.node);
- this.groupColumn = null;
- for (var c = 0; c<this.view.viewJson.selectList.length; c++){
- if (this.view.viewJson.selectList[c].column === this.view.viewJson.group.column){
- this.groupColumn = this.view.viewJson.selectList[c];
- break;
- }
- }
- if (this.groupColumn){
- //var text = (this.groupColumn.code) ? MWF.Macro.exec(this.groupColumn.code, {"value": this.data.group, "gridData": this.view.gridJson, "data": this.view.viewData, "entry": this.data}) : this.data.group;
- var text = this.data.group;
- }else{
- var text = this.data.group;
- }
- if( viewStyles && viewStyles["groupCollapseNode"] ){
- this.expandNode = new Element("span", {
- styles : viewStyles["groupCollapseNode"]
- }).inject( this.categoryTd );
- new Element("span", { text : text }).inject( this.categoryTd );
- // this.categoryTd.set("text", text );
- }else{
- this.categoryTd.set("html", "<span style='font-family: Webdings'><img src='../x_component_query_Query/$Viewer/"+this.view.options.style+"/icon/expand.png'/></span> "+text);
- }
- this.expanded = false;
- if (this.view.json.itemStyles) this.categoryTd.setStyles(this.view.json.itemStyles);
- if( this.groupColumn ){
- if( typeOf(this.groupColumn.contentStyles) === "object" )this.categoryTd.setStyles(this.groupColumn.contentStyles);
- if( typeOf(this.groupColumn.contentProperties) === "object" )this.categoryTd.setProperties(this.groupColumn.contentProperties);
- }
- this.setEvent();
- var column = this.groupColumn;
- var td = this.categoryTd;
- Object.each( column.events || {}, function (e , key) {
- if(e.code){
- if( key === "loadContent" ){
- this.view.Macro.fire( e.code,
- {"node" : td, "json" : column, "data" : this.data.group, "view": this.view, "row" : this});
- }else if( key !== "loadTitle" ){
- td.addEvent(key, function(event){
- return this.view.Macro.fire(
- e.code,
- {"node" : td, "json" : column, "data" : this.data.group, "view": this.view, "row" : this},
- event
- );
- }.bind(this));
- }
- }
- }.bind(this));
- this.view.fireEvent("postLoadCategoryRow", [null, this]);
- },
- getSelectAllStatus : function(){
- if ( this.view.getSelectFlag()!=="multi")return;
- if( !this.items.length )return "none";
- var flag = "all";
- var allFlag = true, noneFlag = true;
- for( var i=0; i<this.items.length; i++ ){
- var item = this.items[i];
- if( item.data.$selectedEnable ){
- item.isSelected ? ( noneFlag = false ) : (allFlag = false);
- if( !allFlag && !noneFlag )return "some"
- }
- }
- if( allFlag )return "all";
- if( noneFlag )return "none";
- return "some";
- },
- checkSelectAllStatus : function(){
- if( !this.selectAllNode )return;
- var status = this.getSelectAllStatus();
- if( status === "all" ){
- this.setSelectAllStyle()
- }else{
- this.setUnSelectAllStyle()
- }
- },
- setSelectAllStyle : function () {
- if( !this.selectAllNode )return;
- if( this.view.viewJson.viewStyles && this.view.viewJson.viewStyles["checkedCheckboxNode"] ){
- this.selectAllNode.setStyles( this.view.viewJson.viewStyles["checkedCheckboxNode"] );
- }else {
- this.selectAllNode.getElement("img").set("src",
- '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox_checked.png' )
- }
- },
- setUnSelectAllStyle : function () {
- if( !this.selectAllNode )return;
- if( this.view.viewJson.viewStyles && this.view.viewJson.viewStyles["checkboxNode"] ){
- this.selectAllNode.setStyles( this.view.viewJson.viewStyles["checkboxNode"] );
- }else {
- this.selectAllNode.getElement("img").set("src",
- '../x_component_query_Query/$Viewer/" + this.options.style + "/icon/checkbox.png' )
- }
- },
- selectAll : function( from ){
- // var flag = this.json.select || this.viewJson.select || "none";
- if ( this.view.getSelectFlag()==="multi"){
- this.expand();
- this.items.each( function (item) {
- if( item.data.$selectedEnable ){
- item.selected( from );
- }
- })
- if( this.view.viewJson.allowSelectAll ){
- this.setSelectAllStyle();
- if( from !== "view" ){
- this.view.checkSelectAllStatus();
- }
- }
- }
- },
- unSelectAll : function( from ){
- // var flag = this.json.select || this.viewJson.select || "none";
- if ( this.view.getSelectFlag()==="multi"){
- this.items.each( function (item) {
- if( item.data.$selectedEnable ) {
- item.unSelected(from);
- }
- })
- if( this.view.viewJson.allowSelectAll ) {
- this.setUnSelectAllStyle();
- if (from !== "view") {
- this.view.checkSelectAllStatus();
- }
- }
- }
- },
- setEvent: function(){
- //if (this.selectTd){
- this.node.addEvents({
- "click": function(){this.expandOrCollapse();}.bind(this)
- });
- //}
- },
- expandOrCollapse: function(){
- // var t = this.node.getElement("span").get("html");
- // if (t.indexOf("expand.png")===-1){
- // this.collapse();
- // }else{
- // this.expand();
- // }
- if( this.expanded ){
- this.collapse();
- }else{
- this.expand();
- }
- },
- collapse: function( from ){
- this.items.each(function(item){
- item.node.setStyle("display", "none");
- }.bind(this));
- if( this.expandNode ){
- this.expandNode.setStyles( this.view.viewJson.viewStyles["groupCollapseNode"] )
- }else{
- this.node.getElement("span").set("html", "<img src='../x_component_query_Query/$Viewer/"+this.view.options.style+"/icon/expand.png'/>");
- }
- this.expanded = false;
- if( from !== "view" ){
- this.view.checkExpandAllStatus();
- }
- },
- expand: function( from ){
- this.items.each(function(item){
- item.node.setStyle("display", "table-row");
- }.bind(this));
- if( this.expandNode ){
- this.expandNode.setStyles( this.view.viewJson.viewStyles["groupExpandNode"] )
- }else{
- this.node.getElement("span").set("html", "<img src='../x_component_query_Query/$Viewer/"+this.view.options.style+"/icon/down.png'/>");
- }
- this.expanded = true;
- if (!this.loadChild){
- //window.setTimeout(function(){
- this.data.list.each(function(line, i){
- var s = this.idx+i;
- this.lastItem = new MWF.xApplication.query.Query.Viewer.Item(this.view, line, (this.lastItem || this), s, this, this.view.options.lazy);
- this.items.push(this.lastItem);
- }.bind(this));
- this.loadChild = true;
- //}.bind(this), 10);
- }
- if( from !== "view" ){
- this.view.checkExpandAllStatus();
- }
- }
- });
- MWF.xApplication.query.Query.Viewer.Filter = new Class({
- initialize: function(viewer, data, node){
- this.viewer = viewer;
- this.data = data;
- this.css = this.viewer.css;
- this.content = node;
- this.load();
- },
- load: function(){
- this.node = new Element("div", {"styles": this.css.viewSearchFilterNode}).inject(this.content);
- if (this.viewer.filterItems.length){
- this.logicNode = new Element("div", {"styles": this.css.viewSearchFilterSelectAreaNode}).inject(this.node);
- this.logicSelectNode = new Element("div", {
- "styles": this.css.viewSearchFilterSelectNode,
- "text": this.viewer.lp.and,
- "value": "and"
- }).inject(this.logicNode);
- this.logicSelectButtonNode = new Element("div", {"styles": this.css.viewSearchFilterSelectButtonNode}).inject(this.logicNode);
- this.logicNode.addEvents({
- "click": function(){
- var v = this.logicSelectNode.get("value");
- if (v==="and"){
- this.logicSelectButtonNode.setStyle("float", "left");
- this.logicSelectNode.setStyle("float", "right");
- this.logicSelectNode.set({
- "text": this.viewer.lp.or,
- "value": "or"
- });
- this.data.logic = "or";
- }else{
- this.logicSelectButtonNode.setStyle("float", "right");
- this.logicSelectNode.setStyle("float", "left");
- this.logicSelectNode.set({
- "text": this.viewer.lp.and,
- "value": "and"
- });
- this.data.logic = "and";
- }
- this.viewer.searchCustomView();
- }.bind(this)
- });
- }
- this.titleNode = new Element("div", {"styles": this.css.viewSearchFilterTextNode, "text": this.data.title}).inject(this.node);
- this.comparisonTitleNode = new Element("div", {"styles": this.css.viewSearchFilterTextNode, "text": this.data.comparisonTitle}).inject(this.node);
- this.valueNode = new Element("div", {"styles": this.css.viewSearchFilterTextNode, "text": "\""+this.data.value+"\""}).inject(this.node);
- this.deleteNode = new Element("div", {"styles": this.css.viewSearchFilterDeleteNode}).inject(this.node);
- this.node.addEvents({
- "mouseover": function(){
- this.node.setStyles(this.css.viewSearchFilterNode_over);
- this.deleteNode.setStyles(this.css.viewSearchFilterDeleteNode_over);
- }.bind(this),
- "mouseout": function(){
- this.node.setStyles(this.css.viewSearchFilterNode);
- this.deleteNode.setStyles(this.css.viewSearchFilterDeleteNode);
- }.bind(this)
- });
- this.deleteNode.addEvent("click", function(){
- this.viewer.searchViewRemoveFilter(this);
- }.bind(this));
- },
- destroy: function(){
- this.node.destroy();
- MWF.release(this);
- }
- });
- MWF.xApplication.query.Query.Viewer.Actionbar = new Class({
- Implements: [Events],
- options: {
- "style" : "default",
- "moduleEvents": ["load", "queryLoad", "postLoad", "afterLoad"]
- },
- initialize: function(node, json, form, options){
- this.node = $(node);
- this.node.store("module", this);
- this.json = json;
- this.form = form;
- this.view = form;
- },
- hide: function(){
- var dsp = this.node.getStyle("display");
- if (dsp!=="none") this.node.store("mwf_display", dsp);
- this.node.setStyle("display", "none");
- },
- show: function(){
- var dsp = this.node.retrieve("mwf_display", dsp);
- this.node.setStyle("display", dsp);
- },
- load: function(){
- this._loadModuleEvents();
- if (this.fireEvent("queryLoad")){
- //this._queryLoaded();
- this._loadUserInterface();
- this._loadStyles();
- this._loadDomEvents();
- //this._loadEvents();
- //this._afterLoaded();
- this.fireEvent("postLoad");
- this.fireEvent("load");
- }
- },
- _loadStyles: function(){
- if (this.json.styles) Object.each(this.json.styles, function(value, key){
- if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1 || value.indexOf("x_cms_assemble_control")!=-1)){
- var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
- var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
- var host3 = MWF.Actions.getHost("x_cms_assemble_control");
- if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
- value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
- }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
- value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
- }
- if (value.indexOf("/x_portal_assemble_surface")!==-1){
- value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
- }else if (value.indexOf("x_portal_assemble_surface")!==-1){
- value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
- }
- if (value.indexOf("/x_cms_assemble_control")!==-1){
- value = value.replace("/x_cms_assemble_control", host3+"/x_cms_assemble_control");
- }else if (value.indexOf("x_cms_assemble_control")!==-1){
- value = value.replace("x_cms_assemble_control", host3+"/x_cms_assemble_control");
- }
- value = o2.filterUrl(value);
- }
- this.node.setStyle(key, value);
- }.bind(this));
- // if (["x_processplatform_assemble_surface", "x_portal_assemble_surface"].indexOf(root.toLowerCase())!==-1){
- // var host = MWF.Actions.getHost(root);
- // return (flag==="/") ? host+this.json.template : host+"/"+this.json.template
- // }
- //if (this.json.styles) this.node.setStyles(this.json.styles);
- },
- _loadModuleEvents : function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- _loadDomEvents: function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)===-1){
- this.node.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- _loadEvents: function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }else{
- this.node.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- addModuleEvent: function(key, fun){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return (fun) ? fun(this, event) : null;
- }.bind(this));
- }else{
- this.node.addEvent(key, function(event){
- return (fun) ? fun(this, event) : null;
- }.bind(this));
- }
- },
- _loadUserInterface: function(){
- // if (this.form.json.mode == "Mobile"){
- // this.node.empty();
- // }else if (COMMON.Browser.Platform.isMobile){
- // this.node.empty();
- // }else{
- this.toolbarNode = this.node.getFirst("div");
- if( !this.toolbarNode ){
- this.toolbarNode = new Element("div").inject( this.node );
- }
- this.toolbarNode.empty();
- MWF.require("MWF.widget.Toolbar", function(){
- this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {
- "style": this.json.style,
- "onPostLoad" : function(){
- this.fireEvent("afterLoad");
- }.bind(this)
- }, this);
- if (this.json.actionStyles) this.toolbarWidget.css = this.json.actionStyles;
- //alert(this.readonly)
- if( this.json.multiTools ){
- this.json.multiTools.each( function (tool) {
- if( tool.system ){
- if( !this.json.hideSystemTools ){
- this.setToolbars([tool], this.toolbarNode, this.readonly);
- }
- }else{
- this.setCustomToolbars([tool], this.toolbarNode);
- }
- }.bind(this));
- this.toolbarWidget.load();
- }else{
- if (this.json.hideSystemTools){
- this.setCustomToolbars(this.json.tools, this.toolbarNode);
- this.toolbarWidget.load();
- }else{
- if (this.json.defaultTools){
- this.setToolbars(this.json.defaultTools, this.toolbarNode, this.readonly);
- this.setCustomToolbars(this.json.tools, this.toolbarNode);
- this.toolbarWidget.load();
- }else{
- MWF.getJSON(this.form.path+"toolbars.json", function(json){
- this.setToolbars(json, this.toolbarNode, this.readonly, true);
- this.setCustomToolbars(this.json.tools, this.toolbarNode);
- this.toolbarWidget.load();
- }.bind(this), null);
- }
- }
- }
- }.bind(this));
- // }
- },
- setCustomToolbars: function(tools, node){
- var path = "../x_component_process_FormDesigner/Module/Actionbar/";
- var iconPath = "";
- if( this.json.customIconStyle ){
- iconPath = this.json.customIconStyle+"/";
- }
- tools.each(function(tool){
- var flag = true;
- if (this.readonly){
- flag = tool.readShow;
- }else{
- flag = tool.editShow;
- }
- if (flag){
- flag = true;
- // if (tool.control){
- // flag = this.form.businessData.control[tool.control]
- // }
- if (tool.condition){
- var hideFlag = this.form.Macro.exec(tool.condition, this);
- flag = !hideFlag;
- }
- if (flag){
- var actionNode = new Element("div", {
- "id": tool.id,
- "MWFnodetype": tool.type,
- "MWFButtonImage": path+""+this.options.style+"/custom/"+iconPath+tool.img,
- "title": tool.title,
- "MWFButtonAction": "runCustomAction",
- "MWFButtonText": tool.text
- }).inject(node);
- if( this.json.customIconOverStyle ){
- actionNode.set("MWFButtonImageOver" , path+""+this.options.style +"/custom/"+this.json.customIconOverStyle+ "/" +tool.img );
- }
- if( tool.properties ){
- actionNode.set(tool.properties);
- }
- if (tool.actionScript){
- actionNode.store("script", tool.actionScript);
- }
- if (tool.sub){
- var subNode = node.getLast();
- this.setCustomToolbars(tool.sub, subNode);
- }
- }
- }
- }.bind(this));
- },
- setToolbarItem: function(tool, node, readonly, noCondition){
- //var path = "../x_component_process_FormDesigner/Module/Actionbar/";
- var path = "../x_component_query_ViewDesigner/$View/";
- var flag = true;
- // if (tool.control){
- // flag = this.form.businessData.control[tool.control]
- // }
- if (!noCondition) if (tool.condition){
- var hideFlag = this.form.Macro.exec(tool.condition, this);
- flag = flag && (!hideFlag);
- }
- if (readonly) if (!tool.read) flag = false;
- if (flag){
- var actionNode = new Element("div", {
- "id": tool.id,
- "MWFnodetype": tool.type,
- //"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+tool.img,
- //"MWFButtonImage": path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
- "MWFButtonImage": path+this.options.style+"/actionbar/"+ ( this.json.iconStyle || "default" ) +"/"+tool.img,
- "title": tool.title,
- "MWFButtonAction": tool.action,
- "MWFButtonText": tool.text
- }).inject(node);
- if( this.json.iconOverStyle ){
- actionNode.set("MWFButtonImageOver" , path+""+this.options.style+"/actionbar/"+this.json.iconOverStyle+"/"+tool.img );
- //actionNode.set("MWFButtonImageOver" , path+""+(this.options.style||"default")+"/tools/"+( this.json.iconOverStyle || "default" )+"/"+tool.img );
- }
- if( tool.properties ){
- actionNode.set(tool.properties);
- }
- if (tool.sub){
- var subNode = node.getLast();
- this.setToolbars(tool.sub, subNode, readonly, noCondition);
- }
- }
- },
- setToolbars: function(tools, node, readonly, noCondition){
- tools.each(function(tool){
- this.setToolbarItem(tool, node, readonly, noCondition);
- }.bind(this));
- },
- runCustomAction: function(bt){
- var script = bt.node.retrieve("script");
- this.form.Macro.exec(script, this);
- },
- exportView : function(){
- this.form.exportView();
- },
- deleteWork: function(){
- this.form.deleteWork();
- }
- });
- MWF.xApplication.query.Query.Viewer.Paging = new Class({
- Implements: [Options, Events],
- options: {
- "style" : "default",
- "useMainColor": false,
- "moduleEvents": ["load", "queryLoad", "postLoad", "afterLoad","jump"]
- },
- initialize: function(node, json, form, options){
- this.setOptions(options);
- this.node = $(node);
- this.node.store("module", this);
- this.json = json;
- this.form = form;
- this.view = form;
- },
- hide: function(){
- var dsp = this.node.getStyle("display");
- if (dsp!=="none") this.node.store("mwf_display", dsp);
- this.node.setStyle("display", "none");
- },
- show: function(){
- var dsp = this.node.retrieve("mwf_display", dsp);
- this.node.setStyle("display", dsp);
- },
- load: function(){
- this._loadModuleEvents();
- if (this.fireEvent("queryLoad")){
- //this._queryLoaded();
- this._loadUserInterface();
- this._loadStyles();
- this._loadDomEvents();
- //this._loadEvents();
- //this._afterLoaded();
- this.fireEvent("postLoad");
- }
- },
- _loadStyles: function(){
- if (this.json.styles) Object.each(this.json.styles, function(value, key){
- if ((value.indexOf("x_processplatform_assemble_surface")!=-1 || value.indexOf("x_portal_assemble_surface")!=-1 || value.indexOf("x_cms_assemble_control")!=-1)){
- var host1 = MWF.Actions.getHost("x_processplatform_assemble_surface");
- var host2 = MWF.Actions.getHost("x_portal_assemble_surface");
- var host3 = MWF.Actions.getHost("x_cms_assemble_control");
- if (value.indexOf("/x_processplatform_assemble_surface")!==-1){
- value = value.replace("/x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
- }else if (value.indexOf("x_processplatform_assemble_surface")!==-1){
- value = value.replace("x_processplatform_assemble_surface", host1+"/x_processplatform_assemble_surface");
- }
- if (value.indexOf("/x_portal_assemble_surface")!==-1){
- value = value.replace("/x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
- }else if (value.indexOf("x_portal_assemble_surface")!==-1){
- value = value.replace("x_portal_assemble_surface", host2+"/x_portal_assemble_surface");
- }
- if (value.indexOf("/x_cms_assemble_control")!==-1){
- value = value.replace("/x_cms_assemble_control", host3+"/x_cms_assemble_control");
- }else if (value.indexOf("x_cms_assemble_control")!==-1){
- value = value.replace("x_cms_assemble_control", host3+"/x_cms_assemble_control");
- }
- value = o2.filterUrl(value);
- }
- this.node.setStyle(key, value);
- }.bind(this));
- // if (["x_processplatform_assemble_surface", "x_portal_assemble_surface"].indexOf(root.toLowerCase())!==-1){
- // var host = MWF.Actions.getHost(root);
- // return (flag==="/") ? host+this.json.template : host+"/"+this.json.template
- // }
- //if (this.json.styles) this.node.setStyles(this.json.styles);
- },
- _loadModuleEvents : function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- _loadDomEvents: function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)===-1){
- this.node.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- _loadEvents: function(){
- Object.each(this.json.events, function(e, key){
- if (e.code){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }else{
- this.node.addEvent(key, function(event){
- return this.form.Macro.fire(e.code, this, event);
- }.bind(this));
- }
- }
- }.bind(this));
- },
- addModuleEvent: function(key, fun){
- if (this.options.moduleEvents.indexOf(key)!==-1){
- this.addEvent(key, function(event){
- return (fun) ? fun(this, event) : null;
- }.bind(this));
- }else{
- this.node.addEvent(key, function(event){
- return (fun) ? fun(this, event) : null;
- }.bind(this));
- }
- },
- _loadUserInterface: function(){
- // if (this.form.json.mode == "Mobile"){
- // this.node.empty();
- // }else if (COMMON.Browser.Platform.isMobile){
- // this.node.empty();
- // }else{
- this.loadPaging( true )
- },
- reload : function(){
- this.loadPaging( false )
- },
- loadPaging : function( firstLoading ){
- // this.pagingNode = this.node.getFirst("div");
- // if( !this.pagingNode ){
- // this.pagingNode = new Element("div").inject( this.node );
- // }
- // this.pagingNode.empty();
- this.node.empty();
- this.paging = new o2.widget.Paging(this.node, {
- //style : this.options.skin && this.options.skin.pagingBar ? this.options.skin.pagingBar : "default",
- countPerPage: this.view.json.pageSize || this.view.options.perPageCount,
- visiblePages: layout.mobile?5:(this.json.visiblePages ? this.json.visiblePages.toInt() : 9),
- currentPage: this.view.currentPage,
- itemSize: this.view.count,
- pageSize: this.view.pages,
- hasNextPage: typeOf( this.json.hasPreNextPage ) === "boolean" ? this.json.hasPreNextPage : true,
- hasPrevPage: typeOf( this.json.hasPreNextPage ) === "boolean" ? this.json.hasPreNextPage : true,
- hasTruningBar: typeOf( this.json.hasTruningBar ) === "boolean" ? this.json.hasTruningBar : true,
- hasBatchTuring: typeOf( this.json.hasBatchTuring ) === "boolean" ? this.json.hasBatchTuring : true,
- hasFirstPage: typeOf( this.json.hasFirstLastPage ) === "boolean" ? this.json.hasFirstLastPage : (layout.mobile?false:true),
- hasLastPage: typeOf( this.json.hasFirstLastPage ) === "boolean" ? this.json.hasFirstLastPage : (layout.mobile?false:true),
- hasJumper: typeOf( this.json.hasPageJumper ) === "boolean" ? this.json.hasPageJumper : (layout.mobile?false:true),
- hiddenWithDisable: false,
- hiddenWithNoItem: true,
- hasInfor: this.json.showPagingInfor,
- inforPosition: this.json.pagingPosition,
- inforTextStyle: this.json.textStyle,
- useMainColor: this.options.useMainColor,
- text: {
- prePage: this.json.prePageText,
- nextPage: this.json.nextPageText,
- firstPage: this.json.firstPageText,
- lastPage: this.json.lastPageText
- },
- onJumpingPage : function( pageNum, itemNum ){
- this.view.currentPage = pageNum;
- this.fireEvent("jump");
- this.view.loadCurrentPageData( null, false );
- }.bind(this),
- onPostLoad : function () {
- if( firstLoading ){
- if(this.view.setContentHeightFun)this.view.setContentHeightFun();
- this.fireEvent("load");
- }
- this.fireEvent("afterLoad");
- }.bind(this)
- }, this.json.pagingStyles || {});
- this.paging.load();
- }
- });
|