WorkStat.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186
  1. MWF.xApplication.Execution = MWF.xApplication.Execution || {};
  2. MWF.xDesktop.requireApp("Template", "Explorer", null, false);
  3. MWF.require("MWF.widget.Identity", null,false);
  4. MWF.xApplication.Execution.WorkStat = new Class({
  5. Extends: MWF.widget.Common,
  6. Implements: [Options, Events],
  7. options: {
  8. "style": "default"
  9. },
  10. initialize: function (node, app, actions, options) {
  11. this.app = app;
  12. this.lp = app.lp.workStat;
  13. this.path = "../x_component_Execution/$WorkStat/";
  14. this.actions = actions;
  15. this.options.style = this.getViewStyle();
  16. this.setOptions(options);
  17. this.loadCss();
  18. this.node = $(node);
  19. },
  20. loadCss: function () {
  21. this.cssPath = "../x_component_Execution/$WorkStat/" + this.options.style + "/css.wcss";
  22. this._loadCss();
  23. },
  24. load: function () {
  25. this.middleContent = this.app.middleContent;
  26. //this.middleContent.setStyles({"margin-top":"0px","border":"0px solid #f00"});
  27. this.createNaviContent();
  28. //this.createContentDiv();
  29. this.resizeWindow();
  30. this.app.addEvent("resize", function(){
  31. this.resizeWindow();
  32. }.bind(this));
  33. },
  34. resizeWindow: function(){
  35. var size = this.app.middleContent.getSize();
  36. this.naviDiv.setStyles({"height":(size.y-40)+"px"});
  37. this.naviContentDiv.setStyles({"height":(size.y-180)+"px"});
  38. this.contentDiv.setStyles({"height":(size.y-60)+"px"});
  39. if(this.deptStatContent){
  40. this.deptStatContent.setStyles({"height":(size.y-130)+"px"})
  41. }
  42. if(this.statViewListDiv){
  43. var y = this.contentDiv.getSize().y - this.dateToolbar.getSize().y - this.dateStatListDiv.getSize().y;
  44. this.statViewListDiv.setStyles({"height":(y-40)+"px"})
  45. }
  46. },
  47. createNaviContent: function(){
  48. this.naviDiv = new Element("div.naviDiv",{
  49. "styles":this.css.naviDiv
  50. }).inject(this.middleContent);
  51. this.naviTitleDiv = new Element("div.naviTitleDiv",{
  52. "styles":this.css.naviTitleDiv,
  53. "text": this.lp.minderExplorerTitle
  54. }).inject(this.naviDiv);
  55. this.naviContentDiv = new Element("div.naviContentDiv",{"styles":this.css.naviContentDiv}).inject(this.naviDiv);
  56. this.naviBottomDiv = new Element("div.naviBottomDiv",{"styles":this.css.naviBottomDiv}).inject(this.naviDiv);
  57. this.createContentDiv();
  58. var jsonUrl = this.path+"navi.json";
  59. MWF.getJSON(jsonUrl, function(json){
  60. json.each(function(data, i){
  61. var naviContentLi = new Element("li.naviContentLi",{"styles":this.css.naviContentLi}).inject(this.naviContentDiv);
  62. naviContentLi.addEvents({
  63. "mouseover" : function(ev){
  64. if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles )
  65. }.bind({"styles": this.css.naviContentLi_over, "node":naviContentLi, "bindObj": this }) ,
  66. "mouseout" : function(ev){
  67. if(this.bindObj.currentNaviItem != this.node)this.node.setStyles( this.styles )
  68. }.bind({"styles": this.css.naviContentLi, "node":naviContentLi, "bindObj": this }) ,
  69. "click" : function(ev){
  70. if( this.bindObj.currentNaviItem )this.bindObj.currentNaviItem.setStyles( this.bindObj.css.naviContentLi );
  71. this.node.setStyles( this.styles );
  72. this.bindObj.currentNaviItem = this.node;
  73. if( this.action && this.bindObj[this.action] ){
  74. this.bindObj[this.action]();
  75. }
  76. }.bind({"styles": this.css.naviContentLi_current, "node":naviContentLi, "bindObj": this, "action" : data.action })
  77. });
  78. var naviContentImg = new Element("img.naviContentImg",{
  79. "styles":this.css.naviContentImg,
  80. "src":this.path+"default/icon/"+data.icon
  81. }).inject(naviContentLi);
  82. var naviContentSpan = new Element("span.naviContentSpan",{
  83. "styles":this.css.naviContentSpan,
  84. "text":data.title
  85. }).inject(naviContentLi);
  86. if( i == 0 ){
  87. naviContentLi.click();
  88. }
  89. }.bind(this));
  90. }.bind(this));
  91. },
  92. createContentDiv: function(){
  93. this.contentDiv = new Element("div.contentDiv",{"styles":this.css.contentDiv}).inject(this.middleContent);
  94. },
  95. //*************************中心工作开始**************************************
  96. openCenterWork: function(){
  97. this.contentDiv.empty();
  98. this.loadCategoryBar();
  99. this.loadToolbar();
  100. //this.loadView();
  101. },
  102. loadCategoryBar : function(){
  103. var _self = this;
  104. this.categoryBar = new Element("div.categoryBar",{"styles":this.css.categoryBar}).inject(this.contentDiv);
  105. this.allCategoryNode = new Element("li.allCategoryNode", {
  106. "styles": this.css.categoryNode,
  107. "text" : this.lp.category.all
  108. }).inject(this.categoryBar);
  109. this.allCategoryNode.addEvents({
  110. "mouseover" : function(){ if( this.currentCategoryNode != this.allCategoryNode)this.allCategoryNode.setStyles(this.css.categoryNode_over) }.bind(this),
  111. "mouseout" : function(){ if( this.currentCategoryNode != this.allCategoryNode)this.allCategoryNode.setStyles(this.css.categoryNode) }.bind(this),
  112. "click":function(){
  113. if( this.currentCategoryNode )this.currentCategoryNode.setStyles(this.css.categoryNode);
  114. this.currentCategoryNode = this.allCategoryNode;
  115. this.allCategoryNode.setStyles(this.css.categoryNode_current);
  116. this.loadView()
  117. }.bind(this)
  118. });
  119. this.actions.getCategoryCountAll( function( json ){
  120. json.data.each( function( d ){
  121. var categoryNode = new Element("li.categoryNode", {
  122. "styles": this.css.categoryNode,
  123. "text" : d.workTypeName + "(" + d.centerCount +")"
  124. }).inject(this.categoryBar);
  125. categoryNode.store( "workTypeName" , d.workTypeName );
  126. categoryNode.addEvents({
  127. "mouseover" : function(){ if( _self.currentCategoryNode != this.node)this.node.setStyles(_self.css.categoryNode_over) }.bind({node : categoryNode }),
  128. "mouseout" : function(){ if( _self.currentCategoryNode != this.node)this.node.setStyles(_self.css.categoryNode) }.bind({node : categoryNode }),
  129. "click":function(){
  130. if( _self.currentCategoryNode )_self.currentCategoryNode.setStyles(_self.css.categoryNode);
  131. _self.currentCategoryNode = this.node;
  132. this.node.setStyles(_self.css.categoryNode_current);
  133. _self.loadView( )
  134. }.bind({ name : d.workTypeName, node : categoryNode })
  135. })
  136. }.bind(this))
  137. }.bind(this), null, false
  138. );
  139. this.allCategoryNode.click();
  140. },
  141. loadToolbar: function(){
  142. this.toolbar = new Element("div.toolbar",{
  143. styles : this.css.toolbar
  144. }).inject(this.categoryBar);
  145. //this.toolbarTextNode = new Element("div",{
  146. // styles : this.css.toolbarTextNode,
  147. // text: this.lp.workTask.centerWork,
  148. //}).inject(this.toolbar);
  149. this.fileterNode = new Element("div.fileterNode",{
  150. styles : this.css.fileterNode
  151. }).inject(this.toolbar);
  152. this.loadFilter();
  153. },
  154. loadFilter: function () {
  155. var _self = this;
  156. var html = "<table bordr='0' cellpadding='5' cellspacing='0' styles='filterTable'>" +
  157. "<tr>" +
  158. //" <td styles='filterTableTitle' lable='year'></td>" +
  159. //" <td styles='filterTableValue' item='year'></td>" +
  160. //" <td styles='filterTableTitle' lable='workLevel'></td>" +
  161. //" <td styles='filterTableValue' item='workLevel'></td>" +
  162. //" <td styles='filterTableTitle' lable='workType'></td>" +
  163. //" <td styles='filterTableValue' item='workType'></td>" +
  164. //" <td styles='filterTableTitle' lable='star'></td>" +
  165. //" <td styles='filterTableValue' item='star'></td>" +
  166. " <td styles='filterTableValue' item='workTitle'></td>" +
  167. " <td styles='filterTableValue' item='searchAction'></td>" +
  168. " <td styles='filterTableValue' item='returnAction' style='display:none;'></td>" +
  169. "</tr>" +
  170. "</table>";
  171. this.fileterNode.set("html", html);
  172. MWF.xDesktop.requireApp("Template", "MForm", function () {
  173. this.filter = new MForm(this.fileterNode, {}, {
  174. style: "execution",
  175. isEdited: true,
  176. itemTemplate: {
  177. //year: {
  178. // "text": this.lp.yearCount +":", "type": "select", "className": "inputSelectUnformatWidth",
  179. // "selectValue": function () {
  180. // var years = [], year = new Date().getFullYear();
  181. // for (var i = 0; i < 6; i++) years.push(year--);
  182. // return years;
  183. // }
  184. //},
  185. //workLevel: {
  186. // "text": this.lp.level +":", "type": "select","className": "inputSelectUnformatWidth",
  187. // "selectValue": this.lp.workForm.workLevelValue.split(",")
  188. //},
  189. //workType: {
  190. // "text": this.lp.type +":","type": "select","className": "inputSelectUnformatWidth",
  191. // "selectValue": this.lp.workForm.workTypeValue.split(",")
  192. //},
  193. //star: {"text": this.lp.starWork +":", "type": "select", "className": "inputSelectUnformatWidth", "selectValue": this.lp.starWorkText.split(",")},
  194. workTitle: { "style":this.css.filterTitle , defaultValue : this.lp.searchText, "event" : {
  195. focus : function( item ){ if(item.get("value")==_self.lp.searchText)item.setValue("") },
  196. blur : function( item ){ if(item.get("value").trim()=="")item.setValue(_self.lp.searchText) },
  197. keydown: function( item, ev){
  198. if (ev.code == 13){ //回车,搜索
  199. _self.fileterNode.getElements("[item='returnAction']").setStyle("display","");
  200. _self.loadView( );
  201. }
  202. }.bind(this)
  203. }},
  204. searchAction: {
  205. "type": "button", "value": this.lp.search, "style": this.css.filterButton,
  206. "event": {
  207. "click": function () {
  208. _self.fileterNode.getElements("[item='returnAction']").setStyle("display","");
  209. _self.loadView();
  210. }
  211. }
  212. },
  213. returnAction : {
  214. "type": "button", "value": this.lp.return, "style": this.css.filterButton,
  215. "event": {
  216. "click": function () {
  217. _self.filter.getItem("workTitle").setValue( _self.lp.searchText );
  218. _self.fileterNode.getElements("[item='returnAction']").setStyle("display","none");
  219. _self.loadView();
  220. }
  221. }
  222. }
  223. }
  224. }, this.app, this.css);
  225. this.filter.load();
  226. }.bind(this), true);
  227. },
  228. loadView : function( ){
  229. var filterData = {};
  230. if( this.currentCategoryNode ){
  231. var value = this.currentCategoryNode.retrieve("workTypeName");
  232. if( value && value != "" ){
  233. //filterData.defaultWorkTypes = [value];
  234. filterData.workTypes = [value];
  235. }
  236. }
  237. if( this.filter ){
  238. var fd = this.filter.getResult(true, ",", true, true, true);
  239. fd.workTitle = fd.workTitle.replace(this.lp.searchText,"");
  240. for( var key in fd ){
  241. if( fd[key] != "" ){
  242. filterData[key] = fd[key];
  243. }
  244. }
  245. }
  246. var flag = false;
  247. if( this.viewContainer ){
  248. flag = true;
  249. this.viewContainer.destroy();
  250. }
  251. this.viewContainer = Element("div",{
  252. "styles" : this.css.viewContainer
  253. }).inject(this.contentDiv);
  254. this.setViewSize();
  255. if( !flag ){
  256. this.setViewSizeFun = this.setViewSize.bind(this);
  257. this.app.addEvent("resize", this.setViewSizeFun );
  258. }
  259. if( this.view ){
  260. this.view.destroy();
  261. }
  262. this.getViewStyle();
  263. this.view = new MWF.xApplication.Execution.WorkStat.WorkView( this.viewContainer, this.app, this, {
  264. //templateUrl : this.path+ ( this.getViewStyle() == "default" ? "listItem.json" : "listItem_graph.json" ),
  265. templateUrl : this.path + "listItem_stat.json",
  266. "scrollEnable" : true
  267. }, {
  268. lp : this.lp.centerWorkView
  269. });
  270. if( filterData )this.view.filterData = filterData;
  271. this.view.load();
  272. },
  273. getViewStyle : function(){
  274. if( this.viewStyle ) return this.viewStyle;
  275. this.actions.getProfileByCode( { "configCode" : "MIND_LISTSTYLE"} ,function( json ){
  276. if( json.data ){
  277. this.viewStyle = ( json.data.configValue == "ICON" ? "graph" : "default");
  278. }else{
  279. this.viewStyle = "default";
  280. }
  281. }.bind(this), function(){
  282. this.viewStyle = "default";
  283. }.bind(this), false );
  284. //return this.viewStyle || "default";
  285. return "default"
  286. },
  287. setViewSize: function(){
  288. var size = this.app.middleContent.getSize();
  289. var categoryBarSzie = this.categoryBar ? this.categoryBar.getSize() : {x:0, y:0};
  290. this.viewContainer.setStyles({"height":(size.y - categoryBarSzie.y - 56 )+"px"});
  291. },
  292. //*************************中心工作结束**************************************
  293. //*************************按部门统计开始**************************************
  294. statDepartment:function(){
  295. this.contentDiv.empty();
  296. this.deptToolbar = new Element("div.deptToolbar",{
  297. styles : this.css.deptToolbar
  298. }).inject(this.contentDiv);
  299. this.deptFileterNode = new Element("div.deptFileterNode",{
  300. styles : this.css.fileterNode
  301. }).inject(this.deptToolbar);
  302. this.loadDeptFilter();
  303. },
  304. loadDeptFilter: function () {
  305. var _self = this;
  306. _self.nowDate = new Date();
  307. _self.day = new Date(_self.nowDate.getFullYear(),(_self.nowDate.getMonth()+1),0);
  308. var html = "<table bordr='0' cellpadding='5' cellspacing='0' styles='filterTable'>" +
  309. "<tr>" +
  310. " <td styles='filterTableValue' item='beginDate'></td>" +
  311. " <td styles='filterTableValue' item='endDate'></td>" +
  312. " <td styles='filterTableValue' item='workType'></td>" +
  313. " <td styles='filterTableValue' item='centerWork'></td>" +
  314. " <td styles='filterTableValue' item='reportCycle'></td>" +
  315. " <td styles='filterTableValue' item='archiveType'></td>" +
  316. " <td styles='filterTableValue' item='searchAction'></td>" +
  317. " <td styles='filterTableValue' item='returnAction' style='display:none;'></td>" +
  318. " <td styles='filterTableValue' item='exportAction'></td>" +
  319. "</tr>" +
  320. "</table>";
  321. this.deptFileterNode.set("html", html);
  322. var defaultWorkType="";
  323. this.actions.listCategoryAll(function(json){
  324. if(json.type=="success"){
  325. json.data.each(function(d,i){
  326. defaultWorkType = defaultWorkType + "," + d.workTypeName
  327. }.bind(this))
  328. }
  329. }.bind(this),null,false);
  330. MWF.xDesktop.requireApp("Template", "MForm", function () {
  331. this.deptFilter = new MForm(this.deptFileterNode, {}, {
  332. style: "execution",
  333. isEdited: true,
  334. onPostLoad: function(){
  335. _self.loadDeptStat()
  336. }.bind(this),
  337. itemTemplate: {
  338. beginDate:{
  339. "style":this.css.filterTitle,
  340. tType:"date",
  341. name:"beginDate",
  342. attr : {readonly:true},
  343. notEmpty:true,
  344. defaultValue : _self.nowDate.getFullYear()+"-"+(_self.nowDate.getMonth()+1)+"-01",
  345. "event":{
  346. focus : function( item ){ if(item.get("value")==_self.lp.deptStat.beginDate)item.setValue("") },
  347. blur : function( item ){ if(item.get("value").trim()=="")item.setValue(_self.lp.deptStat.beginDate) }
  348. }
  349. },
  350. endDate:{
  351. "style":this.css.filterTitle,
  352. tType:"date",
  353. name:"endDate",
  354. attr : {readonly:true},
  355. notEmpty:true,
  356. defaultValue : _self.nowDate.getFullYear()+"-"+(_self.nowDate.getMonth()+1)+"-"+_self.day.getDate(),
  357. "event":{
  358. focus : function( item ){ if(item.get("value")==_self.lp.deptStat.endDate)item.setValue("") },
  359. blur : function( item ){ if(item.get("value").trim()=="")item.setValue(_self.lp.deptStat.endDate) }
  360. }
  361. },
  362. workType:{
  363. text: this.lp.workType + ":",
  364. type: "select",
  365. readonly:true,
  366. selectValue: defaultWorkType.split(",")
  367. },
  368. centerWork:{
  369. type:"text",
  370. defaultValue:this.lp.centerWorkDefault,
  371. event:{
  372. focus:function(item){this.select()}
  373. }
  374. },
  375. reportCycle: {
  376. text: this.lp.reportCycle + ":",
  377. type: "radio",
  378. notEmpty:true,
  379. //selectValue: lp.reportCycleValue.split(","),
  380. selectText: this.lp.reportCycleText.split(","),
  381. defaultValue: this.lp.reportCycleText.split(",")[0],
  382. event: {
  383. }
  384. },
  385. archiveType: {
  386. text: this.lp.archiveType + ":",
  387. type: "radio",
  388. notEmpty:true,
  389. //selectValue: lp.reportCycleValue.split(","),
  390. selectText: this.lp.archiveType.split(","),
  391. defaultValue: this.lp.archiveType.split(",")[0],
  392. event: {
  393. }
  394. },
  395. searchAction: {
  396. "type": "button", "value": this.lp.search, "style": this.css.filterButton,
  397. "event": {
  398. "click": function () {
  399. //_self.deptFileterNode.getElements("[item='returnAction']").setStyle("display","");
  400. _self.loadDeptStat()
  401. }
  402. }
  403. },
  404. returnAction : {
  405. "type": "button", "value": this.lp.return, "style": this.css.filterButton,
  406. "event": {
  407. "click": function () {
  408. _self.deptFilter.getItem("beginDate").setValue( _self.lp.deptStat.beginDate );
  409. _self.deptFilter.getItem("endDate").setValue( _self.lp.deptStat.endDate );
  410. _self.deptFileterNode.getElements("[item='returnAction']").setStyle("display","none");
  411. }
  412. }
  413. },
  414. exportAction : {
  415. "type": "button", "value": this.lp.export, "style": this.css.filterButton,
  416. "event": {
  417. "click": function () {
  418. _self.exportDeptExcel()
  419. }
  420. }
  421. }
  422. }
  423. }, this.app,this.css);
  424. this.deptFilter.load();
  425. }.bind(this), true);
  426. },
  427. loadDeptStat:function(){
  428. if(this.deptStatContent){
  429. this.deptStatContent.set("text","loading...");
  430. this.deptStatContent.setStyles({"padding-left":"20px"})
  431. }
  432. this.bDate = this.deptFilter.getItem("beginDate").get("value");
  433. this.eDate = this.deptFilter.getItem("endDate").get("value");
  434. this.workType = this.deptFilter.getItem("workType").get("value");
  435. this.centerWork = this.deptFilter.getItem("centerWork").get("value");
  436. this.cycleType = this.deptFilter.getItem("reportCycle").get("value");
  437. this.archiveType = this.deptFilter.getItem("archiveType").get("value");
  438. if(this.bDate == "" || this.bDate == this.lp.deptStat.beginDate || this.eDate == "" || this.eDate == this.lp.deptStat.endDate){
  439. //this.app.notice("选择日期","error")
  440. }
  441. var filterData = {
  442. "cycleType":this.cycleType,
  443. "status":this.archiveType,
  444. "startDate":this.bDate,
  445. "endDate":this.eDate,
  446. "workTypeName":this.workType,
  447. "centerTitle":this.centerWork == this.lp.centerWorkDefault?"":this.centerWork
  448. };
  449. this.app.createShade();
  450. this.actions.getStatType(filterData,
  451. function(json){
  452. if(json.type == "success"){
  453. this.deptStatData = json.data;
  454. this.displayDeptStat();
  455. var y = this.contentDiv.getSize().y - this.deptToolbar.getSize().y;
  456. this.deptStatContent.setStyles({"height":(y-20)+"px"});
  457. }
  458. this.app.destroyShade()
  459. }.bind(this),
  460. function(xhr,text,error){
  461. this.showErrorMessage(xhr,text,error);
  462. this.app.destroyShade()
  463. }.bind(this)
  464. )
  465. },
  466. displayDeptStat: function() {
  467. if(this.deptStatContent) this.deptStatContent.destroy();
  468. this.deptStatContent = new Element("div.deptStatContent", {styles: this.css.deptStatContent}).inject(this.contentDiv);
  469. if(this.deptStatData){
  470. this.deptStatInfo = new Element("div.deptStatInfo",{
  471. "styles": this.css.deptStatInfo
  472. }).inject(this.deptStatContent);
  473. var htmlstr = "<span >已汇报:</span> <img src='"+this.path+"default/icon/Checkmark-24.png' style='vertical-align:middle;margin-right:20px; width:20px;' />";
  474. htmlstr += "<span>不需要汇报: </span><img src='"+this.path+"default/icon/Circle24.png' style='vertical-align:middle;margin-right:20px;width:20px;' />";
  475. htmlstr += "<span>未汇报:</span> <img src='"+this.path+"default/icon/Delete-24.png' style='vertical-align:middle;margin-right:20px;width:20px;' />";
  476. this.deptStatInfo.set("html",htmlstr);
  477. this.deptStatText = new Element("div.deptStatText",{"styles":this.css.deptStatText}).inject(this.deptStatInfo);
  478. this.deptStatText.set("html","统计类别: "+this.cycleType+" 统计周期: "+this.bDate+" --- " + this.eDate);
  479. if(this.deptStatData.header) cols = this.deptStatData.header.length;
  480. this.deptStatTable = new Element("table.deptStatTable",{styles:this.css.deptStatTable}).inject(this.deptStatContent);
  481. this.deptStatHeadTr = new Element("tr.deptStatHeadTr",{styles:this.css.deptStatHeadTr}).inject(this.deptStatTable);
  482. this.deptStatData.header.each(function(d,i){
  483. this.tmpTd = new Element("td.deptStatTh",{
  484. "styles":this.css.deptStatTh,
  485. "text": d.title
  486. }).inject(this.deptStatHeadTr);
  487. if(i==0){
  488. this.tmpTd.setStyles({"width":"100px"})
  489. }else if(i==1 || i == 2){
  490. this.tmpTd.setStyles({
  491. "width":"300px",
  492. "height":"auto",
  493. "max-height":"50px",
  494. "overflow-y":"hidden"
  495. })
  496. }else{
  497. var bd = d.startDate;
  498. var ed = d.endDate;
  499. tmpstr = bd.split("-")[1]+"."+bd.split("-")[2]+"-" + ed.split("-")[1]+"."+ed.split("-")[2];
  500. this.tmpTd.set("text",tmpstr)
  501. }
  502. }.bind(this));
  503. this.deptStatTable.setStyles({"width":(cols * 50 + 680)+"px"});
  504. if(this.deptStatData.content){
  505. var curRow = 0;
  506. var rows1 = this.deptStatData.content.length; //多少部门
  507. this.deptStatData.content.each(function(d,i){
  508. if(d.array){
  509. var rows2 = d.array.length; //多少中心工作
  510. var rowsWork2 = d.rowCount;
  511. d.array.each(function(dd,ii){
  512. var rows3 = dd.array.length; //多少工作
  513. var rowsWork3 = dd.rowCount;
  514. if(dd.array){
  515. var _self = this;
  516. dd.array.each(function(ddd,iii){
  517. _self.tmpTr = new Element("tr.deptStatTr",{styles:_self.css.deptStatTr}).inject(_self.deptStatTable);
  518. curRow ++;
  519. if(iii==0){
  520. if(ii==0){
  521. _self.tmpTd = new Element("td.deptStatTd",{
  522. "styles":_self.css.deptStatTd,
  523. "rowspan": rowsWork2,
  524. "text": d.title.split("@")[0]
  525. }).inject(_self.tmpTr);
  526. _self.tmpTd.setStyles({"text-align":"center"});
  527. _self.tmpTd = new Element("td.deptStatTd",{
  528. "styles":_self.css.deptStatTd,
  529. "rowspan": rowsWork3,
  530. "text": dd.title
  531. }).inject(_self.tmpTr)
  532. }else{
  533. _self.tmpTd = new Element("td.deptStatTd",{
  534. "styles":_self.css.deptStatTd,
  535. "rowspan": rowsWork3,
  536. "text": dd.title
  537. }).inject(_self.tmpTr)
  538. }
  539. }
  540. _self.tmpTd = new Element("td.deptStatTd",{
  541. "styles":_self.css.deptStatTd,
  542. "text": ddd.title,
  543. "col":1,
  544. "row":curRow
  545. }).inject(_self.tmpTr);
  546. _self.tmpTd.setStyles({"cursor":"pointer","text-decoration":"underline"});
  547. _self.tmpTd.addEvents({
  548. "click":function(){
  549. MWF.xDesktop.requireApp("Execution", "WorkDetail", function(){
  550. var workform = new MWF.xApplication.Execution.WorkDetail(_self, _self.app.restActions,{id:ddd.id},{
  551. "isNew": false,
  552. "isEdited": false,
  553. "tabLocation":_self.category
  554. });
  555. workform.load();
  556. }.bind(_self));
  557. }.bind(_self),
  558. "mouseenter":function(e){
  559. _self.overStyles(e)
  560. }.bind(_self),
  561. "mouseleave":function(e){
  562. _self.outStyles(e)
  563. }.bind(_self)
  564. });
  565. if(ddd.fields){
  566. ddd.fields.each(function(dddd,iiii){
  567. _self.tmpTd = new Element("td.deptStatTd",{
  568. "styles":_self.css.deptStatTdStatus,
  569. "row":curRow,
  570. "col":iiii+2
  571. }).inject(_self.tmpTr);
  572. _self.tmpTd.addEvents({
  573. "mouseenter":function(e){
  574. _self.overStyles(e)
  575. }.bind(_self),
  576. "mouseleave":function(e){
  577. _self.outStyles(e)
  578. }.bind(_self)
  579. });
  580. var imgName = "";
  581. if(dddd.reportStatus == -1){
  582. imgName = "Circle24.png"
  583. }else if(dddd.reportStatus == 0){
  584. imgName = "Delete-24.png"
  585. }else if(dddd.reportStatus == 1){
  586. imgName = "Checkmark-24.png"
  587. }
  588. _self.deptStatStatusSpan = new Element("span.deptStatStatusSpan",{
  589. "styles":this.css.deptStatStatusSpan
  590. }).inject(_self.tmpTd);
  591. _self.deptStatStatusSpan.setStyles({
  592. "background":"url('"+_self.path+"default/icon/"+imgName+"')"
  593. })
  594. }.bind(_self))
  595. }
  596. }.bind(_self))
  597. }
  598. }.bind(this))
  599. }
  600. }.bind(this))
  601. }
  602. }
  603. },
  604. overStyles:function(e){
  605. var curRow = $(e.target).get("row");
  606. var curCol = $(e.target).get("col");
  607. //this.deptStatTable.getElements("[row='"+curRow+"']").setStyles({"border":"1px solid #cccccc","background-color":"#cccccc"})
  608. //this.deptStatTable.getElements("[col='"+curCol+"']").setStyles({"border":"1px solid #cccccc","background-color":"#cccccc"})
  609. //this.deptStatTable.getElements("[row='"+curRow+"']").setStyles({"background-color":"#ff0"})
  610. //this.deptStatTable.getElements("[col='"+curCol+"']").setStyles({"background-color":"#ff0"})
  611. },
  612. outStyles:function(e){
  613. var curRow = $(e.target).get("row");
  614. var curCol = $(e.target).get("col");
  615. //this.deptStatTable.getElements("[row='"+curRow+"']").setStyles({"border":"1px solid #000","background-color":""})
  616. //this.deptStatTable.getElements("[col='"+curCol+"']").setStyles({"border":"1px solid #000","background-color":""})
  617. //this.deptStatTable.getElements("[row='"+curRow+"']").setStyles({"background-color":""})
  618. //this.deptStatTable.getElements("[col='"+curCol+"']").setStyles({"background-color":""})
  619. },
  620. exportDeptExcel : function(){
  621. this.bDate = this.deptFilter.getItem("beginDate").get("value");
  622. this.eDate = this.deptFilter.getItem("endDate").get("value");
  623. this.archiveType = this.deptFilter.getItem("archiveType").get("value");
  624. this.workType = this.deptFilter.getItem("workType").get("value");
  625. this.centerWork = this.deptFilter.getItem("centerWork").get("value");
  626. this.cycleType = this.deptFilter.getItem("reportCycle").get("value");
  627. if(this.bDate == "" || this.bDate == this.lp.deptStat.beginDate || this.eDate == "" || this.eDate == this.lp.deptStat.endDate){
  628. this.app.notice("选择日期","error");
  629. return false;
  630. }
  631. var filterData = {
  632. "cycleType":this.cycleType,
  633. "startDate":this.bDate,
  634. "endDate":this.eDate,
  635. "status":this.archiveType,
  636. "workTypeName":this.workType,
  637. "centerTitle":this.centerWork == this.lp.centerWorkDefault?"":this.centerWork
  638. };
  639. this.actions.exportByDeptWork(filterData,function(json){
  640. if(json.data && json.data.id){
  641. var address = this.actions.action.address;
  642. var url = address + "/jaxrs/export/statisticreportcontent/"+json.data.id+"/stream";
  643. window.open(o2.filterUrl(url))
  644. }
  645. }.bind(this),
  646. function(xhr,text,error){
  647. this.showErrorMsg(xhr,text,error)
  648. }.bind(this),false)
  649. },
  650. //*************************按部门统计结束**************************************
  651. //*************************按日期统计开始**************************************
  652. statDate:function(){
  653. this.contentDiv.empty();
  654. this.dateToolbar = new Element("div.dateToolbar",{
  655. styles : this.css.dateToolbar
  656. }).inject(this.contentDiv);
  657. this.dateFileterNode = new Element("div.dateFileterNode",{
  658. styles : this.css.fileterNode
  659. }).inject(this.dateToolbar);
  660. this.loadDateFilter();
  661. },
  662. loadDateFilter: function () {
  663. var _self = this;
  664. _self.nowDate = new Date();
  665. _self.day = new Date(_self.nowDate.getFullYear(),(_self.nowDate.getMonth()+1),0);
  666. var html = "<table bordr='0' cellpadding='5' cellspacing='0' styles='filterTable'>" +
  667. "<tr>" +
  668. " <td styles='filterTableValue' item='beginDate'></td>" +
  669. " <td styles='filterTableValue' item='endDate'></td>" +
  670. " <td styles='filterTableValue' item='workType'></td>" +
  671. " <td styles='filterTableValue' item='centerWork'></td>" +
  672. " <td styles='filterTableValue' item='reportCycle'></td>" +
  673. " <td styles='filterTableValue' item='archiveType'></td>" +
  674. " <td styles='filterTableValue' item='searchAction'></td>" +
  675. " <td styles='filterTableValue' item='returnAction' style='display:none;'></td>" +
  676. " <td styles='filterTableValue' item='exportAction'></td>" +
  677. "</tr>" +
  678. "</table>";
  679. this.dateFileterNode.set("html", html);
  680. var defaultWorkType="";
  681. this.actions.listCategoryAll(function(json){
  682. if(json.type=="success"){
  683. json.data.each(function(d,i){
  684. defaultWorkType = defaultWorkType + "," + d.workTypeName
  685. }.bind(this))
  686. }
  687. }.bind(this),null,false);
  688. MWF.xDesktop.requireApp("Template", "MForm", function () {
  689. this.dateFilter = new MForm(this.dateFileterNode, {}, {
  690. style: "execution",
  691. isEdited: true,
  692. onPostLoad: function(){
  693. _self.loadDateStat()
  694. }.bind(this),
  695. itemTemplate: {
  696. beginDate:{
  697. "style":this.css.filterTitle,
  698. tType:"date",
  699. name:"beginDate",
  700. attr : {readonly:true},
  701. notEmpty:true,
  702. defaultValue : _self.nowDate.getFullYear()+"-"+(_self.nowDate.getMonth()+1)+"-01",
  703. "event":{
  704. focus : function( item ){ if(item.get("value")==_self.lp.dateStat.beginDate)item.setValue("") },
  705. blur : function( item ){ if(item.get("value").trim()=="")item.setValue(_self.lp.dateStat.beginDate) }
  706. }
  707. },
  708. endDate:{
  709. "style":this.css.filterTitle,
  710. tType:"date",
  711. name:"endDate",
  712. attr : {readonly:true},
  713. notEmpty:true,
  714. defaultValue : _self.nowDate.getFullYear()+"-"+(_self.nowDate.getMonth()+1)+"-"+_self.day.getDate(),
  715. "event":{
  716. focus : function( item ){ if(item.get("value")==_self.lp.dateStat.endDate)item.setValue("") },
  717. blur : function( item ){ if(item.get("value").trim()=="")item.setValue(_self.lp.dateStat.endDate) }
  718. }
  719. },
  720. workType:{
  721. text: this.lp.workType + ":",
  722. type: "select",
  723. attr : {readonly:true},
  724. selectValue: defaultWorkType.split(",")
  725. },
  726. centerWork:{
  727. type:"text",
  728. defaultValue:this.lp.centerWorkDefault,
  729. event:{
  730. focus:function(item){this.select()}
  731. }
  732. },
  733. reportCycle: {
  734. text: this.lp.reportCycle + ":",
  735. type: "radio",
  736. notEmpty:true,
  737. //selectValue: lp.reportCycleValue.split(","),
  738. selectText: this.lp.reportCycleText.split(","),
  739. defaultValue: this.lp.reportCycleText.split(",")[0],
  740. event: {
  741. }
  742. },
  743. archiveType: {
  744. text: this.lp.archiveType + ":",
  745. type: "radio",
  746. notEmpty:true,
  747. //selectValue: lp.reportCycleValue.split(","),
  748. selectText: this.lp.archiveType.split(","),
  749. defaultValue: this.lp.archiveType.split(",")[0],
  750. event: {
  751. }
  752. },
  753. searchAction: {
  754. "type": "button", "value": this.lp.search, "style": this.css.filterButton,
  755. "event": {
  756. "click": function () {
  757. //_self.deptFileterNode.getElements("[item='returnAction']").setStyle("display","");
  758. _self.loadDateStat()
  759. }
  760. }
  761. },
  762. returnAction : {
  763. "type": "button", "value": this.lp.return, "style": this.css.filterButton,
  764. "event": {
  765. "click": function () {
  766. _self.dateFilter.getItem("beginDate").setValue( _self.lp.dateStat.beginDate );
  767. _self.dateFilter.getItem("endDate").setValue( _self.lp.dateStat.endDate );
  768. _self.dateFileterNode.getElements("[item='returnAction']").setStyle("display","none");
  769. }
  770. }
  771. },
  772. exportAction : {
  773. "type": "button", "value": this.lp.export, "style": this.css.filterButton,
  774. "event": {
  775. "click": function () {
  776. _self.exportDateExcel()
  777. }
  778. }
  779. }
  780. }
  781. }, this.app, this.css);
  782. this.dateFilter.load();
  783. }.bind(this), true);
  784. },
  785. loadDateStat:function(){
  786. this.bDate = this.dateFilter.getItem("beginDate").get("value");
  787. this.eDate = this.dateFilter.getItem("endDate").get("value");
  788. this.workType = this.dateFilter.getItem("workType").get("value");
  789. this.centerWork = this.dateFilter.getItem("centerWork").get("value");
  790. this.cycleType = this.dateFilter.getItem("reportCycle").get("value");
  791. this.archiveType = this.dateFilter.getItem("archiveType").get("value");
  792. if(this.bDate == "" || this.bDate == this.lp.dateStat.beginDate || this.eDate == "" || this.eDate == this.lp.dateStat.endDate){
  793. //this.app.notice("选择日期","error")
  794. }
  795. if(this.dateStatListDiv) this.dateStatListDiv.destroy();
  796. if(this.statViewListDiv) this.statViewListDiv.destroy();
  797. var filterData = {
  798. "reportCycle":this.cycleType,
  799. "status":this.archiveType,
  800. "workTypeName":this.workType,
  801. "startDate":this.bDate,
  802. "centerTitle":this.centerWork == this.lp.centerWorkDefault?"":this.centerWork,
  803. "endDate":this.eDate
  804. };
  805. this.app.createShade();
  806. this.actions.getStatDateList(filterData,function(json){
  807. this.app.destroyShade();
  808. if(json.type == "success"){
  809. this.dateStatListData = json.data;
  810. this.displayDateStatList();
  811. }
  812. }.bind(this),
  813. function(xhr,text,error){
  814. this.showErrorMessage(xhr,text,error);
  815. this.app.destroyShade();
  816. }.bind(this)
  817. )
  818. },
  819. displayDateStatList: function() {
  820. if(this.dateStatListDiv) this.dateStatListDiv.destroy();
  821. if(this.statViewListDiv) this.statViewListDiv.destroy();
  822. this.dateStatListDiv = new Element("div.dateStatListDiv", {
  823. "styles": this.css.dateStatListDiv
  824. }).inject(this.contentDiv);
  825. var dateStatListTitleDiv = new Element("div.dateStatListTitleDiv", {
  826. "styles": this.css.dateStatListTitleDiv,
  827. "text": this.lp.dateStatListTitle
  828. }).inject(this.dateStatListDiv);
  829. this.dateStatContentDiv = new Element("div.dateStatContentDiv", {
  830. "styles": this.css.dateStatContentDiv
  831. }).inject(this.dateStatListDiv);
  832. this.loadDateStatList();
  833. },
  834. loadDateStatList: function(){
  835. if(this.dateStatListData){
  836. this.dateStatListData.each(function(d,i){
  837. var tmpLi = new Element("li.dateStatContentLi",{
  838. "styles": this.css.dateStatContentLi,
  839. "text": d.datetime,
  840. "title": d.reportCycle
  841. }).inject(this.dateStatContentDiv);
  842. tmpLi.addEvents({
  843. "click":function(){
  844. this.dateStatContentDiv.getElements("li").setStyles({"background-color":"","color":""});
  845. tmpLi.setStyles({"background-color":"#3c76c1","color":"#ffffff"});
  846. this.currentDateData = d;
  847. this.displayDateStat(d)
  848. }.bind(this)
  849. })
  850. }.bind(this));
  851. if(this.dateStatListData.length==0){
  852. this.tmpSpan = new Element("span",{
  853. styles:{"margin-left":"10px"},
  854. text :this.lp.nullReportStat
  855. }).inject(this.dateStatContentDiv)
  856. }
  857. if(this.dateStatContentDiv.getElements("li").length>0)this.dateStatContentDiv.getElements("li")[0].click()
  858. }
  859. },
  860. displayDateStat: function(d,id){
  861. if(this.statViewListDiv){
  862. this.statViewListDiv.empty();
  863. this.statViewListDiv.set("text","loading...");
  864. this.statViewListDiv.setStyles({"padding-left":"15px"})
  865. }
  866. if(d){
  867. var filterData = {
  868. "statisticTimeFlag": d.datetime,
  869. "workTypeName":this.workType,
  870. "status":this.archiveType,
  871. "centerTitle":this.centerWork == this.lp.centerWorkDefault?"":this.centerWork,
  872. "reportCycle": d.reportCycle
  873. };
  874. if(id){
  875. filterData.centerId = id
  876. }
  877. this.app.createShade();
  878. this.actions.getStatDate(filterData,function(json){
  879. if(json.type == "success"){
  880. this.dateStatData = json.data;
  881. this.displayDateStatTable()
  882. }
  883. this.app.destroyShade();
  884. }.bind(this),
  885. function(xhr,text,error){
  886. this.showErrorMessage(xhr,text,error);
  887. this.app.destroyShade();
  888. }.bind(this)
  889. )
  890. }
  891. },
  892. displayDateStatTable:function(){
  893. if(this.statViewListDiv) this.statViewListDiv.empty();
  894. if(this.dateStatData){
  895. if(this.statViewListDiv) this.statViewListDiv.destroy();
  896. this.statViewListDiv = new Element("div.statViewListDiv", {
  897. "styles": this.css.statViewListDiv
  898. }).inject(this.contentDiv);
  899. var y = this.contentDiv.getSize().y - this.dateToolbar.getSize().y - this.dateStatListDiv.getSize().y;
  900. this.statViewListDiv.setStyles({"height":(y-50)+"px"});
  901. this.statTable = new Element("table.statTable",{
  902. "styles":this.css.statTable
  903. }).inject(this.statViewListDiv);
  904. //this.statTable.set("border","1")
  905. this.statHeadTr = new Element("tr.statHeadTr",{
  906. "styles":this.css.statHeadTr
  907. }).inject(this.statTable);
  908. for(var o in this.lp.statTable){
  909. var statHeadTd = new Element("td.statHeadTd",{
  910. "styles": this.css.statHeadTd,
  911. "text":this.lp.statTable[o]
  912. }).inject(this.statHeadTr);
  913. }
  914. this.dateStatData.each(function(d,i){
  915. var centerTr = new Element("tr.centerTr").inject(this.statTable);
  916. var centerTd = new Element("td.dateStatCenterTd",{
  917. "styles": this.css.dateStatCenterTd,
  918. "colspan": 9,
  919. "text": d.title
  920. }).inject(centerTr);
  921. if(d.contents && d.contents.length>0){
  922. d.contents.each(function(dd,ii){
  923. var baseTr = new Element("tr.baseTr").inject(this.statTable);
  924. //var baseTd = new Element("td.dateStatBaseTd",{"styles":this.css.dateStatBaseTd,"text":(ii+1),"id":dd.workId}).inject(baseTr)
  925. //baseTd.setStyles({"width":"35px","text-align":"center"})
  926. for(var o in this.lp.statTable){
  927. //if(o!="order"){
  928. var val = "";
  929. if(o=="opinions") {
  930. if(dd[o]){
  931. dd[o].each(function(ddd){
  932. val = val + ddd.processorName.split("@")[0] + ":\n"+ ddd.opinion +"\n"
  933. })
  934. }
  935. }else if(o == "responsibilityUnitName"){
  936. val = dd[o];
  937. val = val.split("@")[0]
  938. }else{
  939. if(dd[o])val = dd[o]
  940. }
  941. var baseTd = new Element("td.dateStatBaseTd",{
  942. "styles": this.css.dateStatBaseTd,
  943. "html": val.length>50?val.substring(0,50)+"...":val,
  944. "title":val
  945. }).inject(baseTr);
  946. if(o=="serialNumber"){
  947. baseTd.setStyles({"width":"35px","padding-left":"15px","min-width":""})
  948. }
  949. if(o=="responsibilityUnitName"){
  950. baseTd.setStyles({"width":"87px"})
  951. }
  952. if(o=="workDetail"){
  953. //baseTd.setStyles({"cursor":"pointer","color":"#3d77c1","text-decoration":"underline"})
  954. //baseTd.addEvents({
  955. // "click":function(){
  956. // this.loadSubStat(id, dd.workId,baseTr);
  957. // //this.actions.getStatByWorkId(id, d.workId,function(json){
  958. // //
  959. // //}.bind(this),function(xhr,text,error){
  960. // // this.showErrorMsg(xhr,text,error)
  961. // //}.bind(this),false)
  962. // }.bind(this)
  963. //})
  964. }
  965. //}
  966. }
  967. }.bind(this))
  968. }
  969. }.bind(this))
  970. }
  971. },
  972. exportDateExcel : function(){
  973. if(this.currentDateData){
  974. var sendData = {};
  975. sendData.statisticTimeFlag = this.currentDateData.datetime;
  976. sendData.reportCycle = this.currentDateData.reportCycle;
  977. sendData.status = this.currentDateData.status;
  978. sendData.centerTitle = this.centerWork == this.lp.centerWorkDefault?"":this.centerWork;
  979. sendData.workTypeName = this.workType;
  980. this.actions.exportByCenterWork(sendData,function(json){
  981. if(json.data && json.data.id){
  982. var address = this.actions.action.address;
  983. var url = address + "/jaxrs/export/statisticreportcontent/"+json.data.id+"/stream";
  984. window.open(o2.filterUrl(url))
  985. }
  986. }.bind(this),
  987. function(xhr,text,error){
  988. this.showErrorMsg(xhr,text,error)
  989. }.bind(this),false)
  990. }
  991. },
  992. //*************************按日期统计结束**************************************
  993. showErrorMessage:function(xhr,text,error){
  994. var errorText = error;
  995. if (xhr) errorMessage = xhr.responseText;
  996. if(errorMessage!=""){
  997. var e = JSON.parse(errorMessage);
  998. if(e.message){
  999. this.app.notice( e.message,"error");
  1000. }else{
  1001. this.app.notice( errorText,"error");
  1002. }
  1003. }else{
  1004. this.app.notice(errorText,"error")
  1005. }
  1006. },
  1007. setScrollBar: function(node, style, offset, callback){
  1008. if (!style) style = "attachment";
  1009. if (!offset){
  1010. offset = {
  1011. "V": {"x": 0, "y": 0},
  1012. "H": {"x": 0, "y": 0}
  1013. };
  1014. }
  1015. MWF.require("MWF.widget.ScrollBar", function(){
  1016. new MWF.widget.ScrollBar(node, {
  1017. "style": style,
  1018. "offset": offset,
  1019. "indent": false
  1020. });
  1021. if (callback) callback();
  1022. });
  1023. return false;
  1024. }
  1025. });
  1026. MWF.xApplication.Execution.WorkStat.WorkView = new Class({
  1027. Extends: MWF.xApplication.Template.Explorer.ComplexView,
  1028. _createDocument: function(data){
  1029. return new MWF.xApplication.Execution.WorkStat.WorkDocument(this.viewNode, data, this.explorer, this);
  1030. },
  1031. _getCurrentPageData: function(callback, count){
  1032. if (!count)count = 20;
  1033. var id = (this.items.length) ? this.items[this.items.length - 1].data.id : "(0)";
  1034. if(id=="(0)")this.app.createShade();
  1035. var filter = this.filterData || {};
  1036. this.actions.getCenterWorkListNext(id, count, filter, function (json) {
  1037. if (callback)callback(json);
  1038. this.app.destroyShade();
  1039. }.bind(this))
  1040. },
  1041. _removeDocument: function(documentData, all){
  1042. //this.actions.deleteSchedule(documentData.id, function(json){
  1043. // this.reload();
  1044. // this.app.notice(this.app.lp.deleteDocumentOK, "success");
  1045. //}.bind(this));
  1046. },
  1047. _create: function(){
  1048. },
  1049. _openDocument: function( documentData ){
  1050. MWF.xDesktop.requireApp("Execution", "StatForm", function(){
  1051. var statForm = new MWF.xApplication.Execution.StatForm( this,this.app.restActions, documentData, {
  1052. "centerWorkId":documentData.id
  1053. });
  1054. statForm.load();
  1055. }.bind(this));
  1056. },
  1057. _queryCreateViewNode: function(){
  1058. },
  1059. _postCreateViewNode: function( viewNode ){
  1060. },
  1061. _queryCreateViewHead:function(){
  1062. },
  1063. _postCreateViewHead: function( headNode ){
  1064. }
  1065. });
  1066. MWF.xApplication.Execution.WorkStat.WorkDocument = new Class({
  1067. Extends: MWF.xApplication.Template.Explorer.ComplexDocument,
  1068. mouseoverDocument : function(){
  1069. this.node.getElements("[styles='documentItemTitleNode']").setStyles(this.css["documentItemTitleNode_over"]);
  1070. this.node.getElements("[styles='documentItemIconNode']").setStyles(this.css["documentItemIconNode_over"]);
  1071. this.node.getElements("[styles='documentItemStatNode']").setStyles(this.css["documentItemStatNode_over"]);
  1072. },
  1073. mouseoutDocument : function(){
  1074. this.node.getElements("[styles='documentItemTitleNode']").setStyles(this.css["documentItemTitleNode"]);
  1075. this.node.getElements("[styles='documentItemIconNode']").setStyles(this.css["documentItemIconNode"]);
  1076. this.node.getElements("[styles='documentItemStatNode']").setStyles(this.css["documentItemStatNode"]);
  1077. },
  1078. _queryCreateDocumentNode:function( itemData ){
  1079. },
  1080. _postCreateDocumentNode: function( itemNode, itemData ){
  1081. },
  1082. removeCenterWork : function(itemData){
  1083. //如果是管理员有删除部署的中心工作的权限
  1084. //if(isAdmin){
  1085. // return true;
  1086. //}
  1087. return false;
  1088. }
  1089. });