AttentionManage.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. var workbentch={
  2. days:7,
  3. height:0.5,
  4. width: 0.5,
  5. setWidth: function(width){
  6. this.width = width;
  7. },
  8. setHeight: function(height){
  9. this.height = height;
  10. },
  11. setDays:function(days){
  12. this.days=days;
  13. },
  14. WorkDaily:function(){
  15. var me = this.workbench || this;
  16. return Ext.create('Ext.panel.Panel', {
  17. title: '<font color=green>工作日报</font>'+
  18. '<div class="div-right"><a href="javascript:openTable(null,\'Diary\',\'工作日报\',\'jsps/common/datalist.jsp\',null,null,\'di_emid=' + emid + '\');">更多工作日报</a></div>',
  19. bodyStyle: 'background: #f1f1f1',
  20. id: 'WorkDaily',
  21. iconCls: 'main-news',
  22. contentEl:'mydairy',
  23. columnWidth: 1/3,
  24. height: me.height*0.4
  25. });
  26. },
  27. Agenda:function(){
  28. var me = this.workbench || this;
  29. return Ext.create('Ext.panel.Panel', {
  30. title: '<font color=green>工作计划</font>'+
  31. '<div class="div-right"><a href="javascript:openTable(null,\'Plan\',\'工作计划\',\'jsps/common/datalist.jsp\',null,null,\'pl_emid=' + emid + '\');">更多工作计划</a></div>',
  32. bodyStyle: 'background: #f1f1f1',
  33. id: 'plan',
  34. contentEl:'myworkplan',
  35. iconCls: 'main-news',
  36. columnWidth: 1/3,
  37. height: me.height*0.4
  38. });
  39. },
  40. WorkAttendance:function(){
  41. var me = this.workbench || this;
  42. return Ext.create('Ext.panel.Panel', {
  43. title: '<font color=green>考勤</font>',
  44. bodyStyle: 'background: #f1f1f1',
  45. id: 'WorkAttendance',
  46. iconCls: 'main-news',
  47. columnWidth: 1/3,
  48. height: me.height*0.4
  49. });
  50. },
  51. JProcess2DealByMe:function(){
  52. var me = this.workbench || this;
  53. return Ext.create('Ext.panel.Panel', {
  54. title: '<font color=green>待审批的流程</font>',
  55. bodyStyle: 'background: #f1f1f1',
  56. id: 'JProcess2DealByMe',
  57. iconCls: 'main-news',
  58. columnWidth: 1/3,
  59. height: me.height*0.4
  60. });
  61. },
  62. JProcessDeal:function(){
  63. var me = this.workbench || this;
  64. return Ext.create('Ext.panel.Panel', {
  65. title: '<font color=green>发起的流程</font>',
  66. bodyStyle: 'background: #f1f1f1',
  67. id: 'JProcessDeal',
  68. iconCls: 'main-news',
  69. columnWidth: 1/3,
  70. height: me.height*0.4
  71. });
  72. },
  73. ProjectPlan:function(){
  74. var me = this.workbench || this;
  75. return Ext.create('Ext.panel.Panel', {
  76. title: '<font color=green>未完成的项目</font>',
  77. bodyStyle: 'background: #f1f1f1',
  78. id: 'ProjectPlan',
  79. iconCls: 'main-news',
  80. columnWidth: 1/3,
  81. height: me.height*0.4
  82. });
  83. },
  84. WorkRecord: function(){
  85. var me = this.workbench||this;
  86. return Ext.create('Ext.panel.Panel', {
  87. title:'<font color=green>任务报告(最近'+me.workbentch.days+'天)</font>'+
  88. '<div class="div-right"><a href="javascript:openTable(null,\'WorkRecord\',\'任务日报\',\'jsps/common/datalist.jsp\',null,null,\'wr_recorderemid=' + emid + '\');">更多任务日报</a></div>',
  89. bodyStyle: 'background: #f1f1f1',
  90. //style:'margin: 1px;',
  91. id: 'WR',
  92. contentEl: 'mytask',
  93. iconCls: 'main-todo',
  94. autoScroll: true,
  95. columnWidth: 1/3,
  96. height: me.height*0.4
  97. });
  98. },
  99. newSynergy:function(){
  100. var me = this.workbench || this;
  101. return Ext.create('Ext.panel.Panel', {
  102. title: '<font color=green> 内部协同</font>',
  103. bodyStyle: 'background: #f1f1f1',
  104. id: 'newSynergy',
  105. iconCls: 'main-news',
  106. contentEl:'mySynergy',
  107. columnWidth: 1/3,
  108. height: me.height*0.4
  109. });
  110. },
  111. ProjectFeePlease:function(days){
  112. var me = this.workbench || this;
  113. return Ext.create('Ext.panel.Panel', {
  114. title: '<font color=green>发出的费用申请单(最近'+me.workbentch.days+'天)</font>',
  115. bodyStyle: 'background: #f1f1f1',
  116. id: 'bench_email9',
  117. iconCls: 'main-news',
  118. columnWidth: 1/3,
  119. height: me.height*0.4
  120. });
  121. },
  122. ProjectFeeClaim:function(days){
  123. var me = this.workbench || this;
  124. return Ext.create('Ext.panel.Panel', {
  125. title: '<font color=green>发出的费用报销单(最近'+me.workbentch.days+'天)</font>',
  126. bodyStyle: 'background: #f1f1f1',
  127. id: 'bench_email99',
  128. iconCls: 'main-news',
  129. columnWidth: 1/3,
  130. height: me.height*0.4
  131. });
  132. },
  133. Meeting:function(){
  134. var me = this.workbench || this;
  135. return Ext.create('Ext.panel.Panel', {
  136. title: '<font color=green>参加的会议</font>',
  137. bodyStyle: 'background: #f1f1f1',
  138. id: 'bench_email91',
  139. iconCls: 'main-news',
  140. columnWidth: 1/3,
  141. height: me.height*0.4
  142. });
  143. },
  144. ToDoTask:function(){
  145. var me = this.workbench || this;
  146. Ext.Ajax.request({
  147. url : basePath + 'common/datalist.action',
  148. params: {
  149. caller: 'ResourceAssignment',
  150. condition: 'ra_emid=' + emid,
  151. page: 1,
  152. pageSize: parseInt(height*0.2/12)
  153. },
  154. method : 'post',
  155. callback : function(options,success,response){
  156. var res = new Ext.decode(response.responseText);
  157. if(res.exception || res.exceptionInfo){
  158. showError(res.exceptionInfo);
  159. return;
  160. }
  161. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  162. if(task == [] || task.length == 0){
  163. Ext.get("myToDo").insertHtml('afterBegin', '<span style="color:gray;font-size:26px; padding: 5 5 5 5;">(暂无任务)</span>');
  164. } else {
  165. Ext.create('Ext.grid.Panel', {
  166. autoScroll: true,
  167. store: Ext.create('Ext.data.Store', {
  168. fields:['ra_id', 'ra_taskname', 'ra_startdate', 'ra_enddate', 'surplus', 'ra_taskpercentdone'],
  169. data: task
  170. }),
  171. height: me.height*0.5,
  172. bodyStyle: 'background: #f1f1f1;border: none;',
  173. columns: [
  174. { header: 'ID', dataIndex: 'ra_id', hidden: true},
  175. { header: '任务名称', dataIndex: 'ra_taskname', flex: 2 , renderer: taskItem},
  176. { header: '开始时间', dataIndex: 'ra_startdate', flex: 1 },
  177. { header: '结束时间', dataIndex: 'ra_enddate', flex: 1 },
  178. { header: '剩余时间', dataIndex: 'surplus', flex: 1.5, renderer: getSurPlus },
  179. { header: '完成率(%)', dataIndex: 'ra_taskpercentdone', flex: 1, renderer: percentdone}
  180. ],
  181. renderTo: Ext.get("myToDo")
  182. });
  183. }
  184. }
  185. });
  186. },
  187. _WorkRecord: function(){
  188. var me = this.workbench || this;
  189. Ext.Ajax.request({
  190. url : basePath + 'common/datalist.action',
  191. params: {
  192. caller: 'WorkRecord',
  193. condition: 'wr_recorderemid=' + emid,
  194. page: 1,
  195. pageSize: parseInt(100*0.3/12)
  196. },
  197. method : 'post',
  198. callback : function(options,success,response){
  199. var res = new Ext.decode(response.responseText);
  200. if(res.exception || res.exceptionInfo){
  201. showError(res.exceptionInfo);
  202. return;
  203. }
  204. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  205. if(task == [] || task.length == 0){
  206. Ext.get("mytask").insertHtml('afterBegin', '<span style="color:gray;font-size:26px; padding: 5 5 5 5;">(暂无任务报告)</span>');
  207. } else {
  208. Ext.create('Ext.grid.Panel', {
  209. autoScroll: true,
  210. store: Ext.create('Ext.data.Store', {
  211. fields:['wr_id', 'wr_taskname', 'wr_recorddate', 'wr_percentdone', 'wr_taskpercentdone'],
  212. data: task
  213. }),
  214. height: me.height*1/3,
  215. bodyStyle: 'background: #f1f1f1;border: none;',
  216. columns: [
  217. { header: 'ID', dataIndex: ' wr_id', hidden: true},
  218. { header: '任务名称', dataIndex: 'wr_taskname', flex: 2 ,renderer:workrecord},
  219. { header: '提交日期', dataIndex: 'wr_recorddate', flex: 1 },
  220. { header: '提交完成率', dataIndex: 'wr_percentdone', flex: 1 },
  221. /** { header: '任务已完成率', dataIndex: 'wr_taskpercentdone', flex: 1.5 },**/
  222. ],
  223. renderTo: Ext.get("mytask")
  224. });
  225. }
  226. }
  227. });
  228. },
  229. _WorkDaily:function(){
  230. Ext.Ajax.request({
  231. url : basePath + 'common/datalist.action',
  232. params: {
  233. caller: 'Diary',
  234. condition: 'di_emid=' + emid,
  235. page: 1,
  236. pageSize: parseInt(height*0.27/23)
  237. },
  238. method : 'post',
  239. callback : function(options,success,response){
  240. var res = new Ext.decode(response.responseText);
  241. if(res.exception || res.exceptionInfo){
  242. showError(res.exceptionInfo);
  243. return;
  244. }
  245. var notes = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : [];
  246. var html = '<ul>';
  247. Ext.each(notes, function(n){
  248. html += '<li>' + n.di_time .substring(0, 10) + '&nbsp;<img src="' + basePath +
  249. 'resource/images/mainpage/icon_headerFooter.gif"/>&nbsp;<a href="javascript:openTable('
  250. + n.di_id + ',\'Diary\',\'工作日记\',\'jsps/oa/persontask/Diary/DiaryR.jsp\',\'di_id\',null' + ')">'
  251. +n.di_thoughts.substring(0, 10) + '...</a></li>';
  252. });
  253. if(notes.length == 0){
  254. html = '<ul>没有记录';
  255. }
  256. html += '</ul>';
  257. Ext.get("mydairy").insertHtml('afterBegin', html);
  258. }
  259. });
  260. },
  261. _Agenda:function(){
  262. Ext.Ajax.request({
  263. url : basePath + 'common/datalist.action',
  264. params: {
  265. caller: 'Plan',
  266. condition: 'pl_emid=' + emid,
  267. contentEl: 'Plan',
  268. page: 1,
  269. pageSize: parseInt(height*0.3/27)
  270. },
  271. method : 'post',
  272. callback : function(options,success,response){
  273. var res = new Ext.decode(response.responseText);
  274. if(res.exception || res.exceptionInfo){
  275. showError(res.exceptionInfo);
  276. return;
  277. }
  278. var task = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  279. Ext.create('Ext.grid.Panel', {
  280. autoScroll: true,
  281. store: Ext.create('Ext.data.Store', {
  282. fields:['pl_id', 'pl_title', 'pl_start', 'pl_end', 'pl_emergency', 'pl_received'],
  283. data: task
  284. }),
  285. columns: [
  286. { header: 'ID', dataIndex: 'pl_id', hidden: true},
  287. { header: '计划标题', dataIndex: 'pl_title', flex: 1,renderer:workplan},
  288. { header: '开始时间', dataIndex: 'pl_start', flex: 1 },
  289. { header: '结束时间', dataIndex: 'pl_end', flex: 1 },
  290. { header: '紧急程度', dataIndex: 'pl_emergency', flex: 0.5 }
  291. ],
  292. renderTo: Ext.get("myworkplan")
  293. });
  294. if(task == [] || task.length == 0){
  295. Ext.get("myworkplan").insertHtml('afterEnd', '<font color=red>(暂无计划)</font>');
  296. }
  297. }
  298. });
  299. },
  300. _newSynergy:function(){
  301. Ext.Ajax.request({
  302. url : basePath + 'common/datalist.action',
  303. params: {
  304. caller: 'Synergy!Data',
  305. condition: 'sy_releaser_id=' + emid,
  306. page: 1,
  307. pageSize: parseInt(height*0.3/27)
  308. },
  309. method : 'post',
  310. callback : function(options,success,response){
  311. var res = new Ext.decode(response.responseText);
  312. if(res.exception || res.exceptionInfo){
  313. showError(res.exceptionInfo);
  314. return;
  315. }
  316. var data = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  317. Ext.create('Ext.grid.Panel', {
  318. autoScroll: true,
  319. store: Ext.create('Ext.data.Store', {
  320. fields:['sy_id', 'sy_title', 'sy_process','sy_type','sy_date'],
  321. data: data
  322. }),
  323. columns: [
  324. { header: 'ID', dataIndex: 'sy_id', hidden: true},
  325. { header: '协同标题', dataIndex: 'sy_title', flex: 1,renderer:Synergy},
  326. { header: '流程名称', dataIndex:'sy_process',flex:1},
  327. { header: '协同类型', dataIndex: 'sy_type', flex: 1 },
  328. { header: '时间', dataIndex: 'sy_date', flex: 1 },
  329. ],
  330. renderTo: Ext.get("mySynergy")
  331. });
  332. if(data == [] || data.length == 0){
  333. Ext.get("newSynergy").insertHtml('afterEnd', '<font color=red>(暂无协同)</font>');
  334. }
  335. }
  336. });
  337. }
  338. };
  339. function getColumn(){
  340. Ext.Ajax.request({//拿到grid的columns
  341. url : basePath +'oa/attention/getAttentionByEmId.action',
  342. params:{
  343. emid:emid
  344. },
  345. method : 'get',
  346. callback : function(options,success,response){
  347. var res = new Ext.decode(response.responseText);
  348. var records=res.data;
  349. //默认添加一个模块 用来查看员工信息
  350. getDefault();
  351. Ext.Array.each(records,function(data){
  352. workbentch.setDays(data.currentMap.AP_DAYS);
  353. var panel=workbentch[data.currentMap.AP_SUBCODE].apply();
  354. Ext.getCmp('bench').add(panel);
  355. });
  356. Ext.each(res.data,function(data){
  357. if(workbentch["_"+data.currentMap.AP_SUBCODE]){
  358. workbentch["_"+data.currentMap.AP_SUBCODE].apply();
  359. }
  360. });
  361. }
  362. });
  363. }
  364. function getDefault(){
  365. var me = this.workbench || this;
  366. var data=null;
  367. Ext.Ajax.request({
  368. url : basePath + 'common/getAttentionEmployee.action',
  369. params: {
  370. caller: 'AttentionEmployee',
  371. emid: emid,
  372. },
  373. method : 'post',
  374. async: false,
  375. callback : function(options,success,response){
  376. var res = new Ext.decode(response.responseText);
  377. console.log(res);
  378. if(res.exception || res.exceptionInfo){
  379. showError(res.exceptionInfo);
  380. return;
  381. }
  382. data = res.data != null ? Ext.decode(res.data.replace(/,}/g, '}').replace(/,]/g, ']')) : new Array();
  383. }
  384. });
  385. var panel= Ext.create('Ext.form.Panel', {
  386. title: '<font color=green>员工信息</font>',
  387. bodyPadding: 5,
  388. iconCls: 'main-activeuser',
  389. layout: 'column',
  390. id:'form',
  391. defaults: {
  392. anchor: '100%',
  393. readOnly:true,
  394. columnWidth:0.5,
  395. fieldStyle : 'background:#f0f0f0;border-bottom:none;padding:2px 2px;vertical-align:middle;border-top:none;border-right:none;color:#CD661D;border-bottom-style:1px solid;border-left:none;font-weight: bold; ',
  396. },
  397. columnWidth: 0.5,
  398. height: me.height*0.6,
  399. frame:true,
  400. defaultType: 'textfield',
  401. items: [{
  402. html:'<div style="font-weight:bold; font-size:15px">基本信息</div>',
  403. columnWidth:1
  404. },{
  405. fieldLabel: '姓名',
  406. name: 'em_name',
  407. id:'em_name',
  408. columnWidth:0.4
  409. },{
  410. id:'online',
  411. columnWidth:0.2,
  412. fieldStyle:'color:green;font-weight: bold;background:#f0f0f0;border:none'
  413. },{
  414. xtype:'button',
  415. layout:'fit',
  416. columnWidth:0,
  417. iconCls:'x-button-icon-paging',
  418. listeners:{
  419. click:function(btn,e){
  420. var othername=Ext.getCmp('em_name').getValue();
  421. showDialogBox(e,null,emid,othername);
  422. }
  423. }
  424. },{
  425. fieldLabel:'照片',
  426. name:'em_photourl',
  427. xtype:'photofield',
  428. value:data.em_photourl,
  429. },{
  430. fieldLabel: '编号',
  431. name: 'em_code',
  432. },{
  433. fieldLabel:'性别',
  434. name:'em_sex',
  435. },{
  436. fieldLabel:'出生年月',
  437. name:'em_birthday'
  438. },{
  439. fieldLabel:'联系电话',
  440. name:'em_tel',
  441. },{
  442. fieldLabel: '移动电话',
  443. name: 'em_mobile',
  444. },{
  445. fieldLabel: '默认邮箱',
  446. name: 'em_email',
  447. },{
  448. fieldLabel:'籍贯',
  449. name:'em_native'
  450. },{
  451. fieldLabel:'工作年限',
  452. name:'em_worktime',
  453. },{
  454. html:'<div style="font-weight:bold; font-size:15px">组织信息</div>',
  455. columnWidth:1
  456. },{
  457. fieldLabel:'所属组织',
  458. name:'em_worktime',
  459. },{
  460. fieldLabel:'所属部门',
  461. name:'em_birthday'
  462. },{
  463. fieldLabel:'部门负责人',
  464. name:'or_headmanname'
  465. }],
  466. renderTo: Ext.getCmp('mydata'),
  467. listeners:{
  468. afterrender:function(btn,e){
  469. Ext.getCmp('photobutton').hide();
  470. }
  471. }
  472. });
  473. panel.getForm().setValues(data);
  474. Ext.getCmp('bench').add(panel);
  475. var ToDo = Ext.create('Ext.panel.Panel', {
  476. title:'<font color=green>待办事宜</font>' +
  477. '<div class="div-right"><a href="javascript:openTable(null,\'ResourceAssignment\',\'任务列表\',\'jsps/common/datalist.jsp\',null,null,\'ra_emid=' + data.em_id + '\');">发布任务</a></div>' +
  478. '<div class="div-right"><a href="javascript:openTable(null,\'ResourceAssignment\',\'任务列表\',\'jsps/common/datalist.jsp\',null,null,\'ra_emid=' + data.em_id + '\');">更多任务</a>|</div>' +
  479. '<div class="div-right"><a href="javascript:openTable(null,\'ResourceAssignment\',\'任务列表\',\'jsps/common/datalist.jsp\',null,null,\'ra_emid=' + data.em_id + '\');">下属任务</a>|</div>',
  480. bodyStyle: 'background: #f1f1f1',
  481. //style:'margin: 1px;',
  482. id: 'ToDo',
  483. contentEl: 'myToDo',
  484. iconCls: 'main-todo',
  485. autoScroll: true,
  486. columnWidth: 0.5,
  487. height: me.height*0.6,
  488. });
  489. Ext.getCmp('bench').add(ToDo);
  490. workbentch['ToDoTask'].apply();
  491. checkOnline();
  492. }
  493. function checkOnline(){
  494. Ext.Ajax.request({
  495. url: basePath + 'oa/attention/CheckISOnline.action',
  496. params: {
  497. emid:emid
  498. },
  499. method: 'POST',
  500. callback : function(options,success,response){
  501. var res = Ext.decode(response.responseText);
  502. var data = res.data;
  503. if(data=='YES'){
  504. Ext.getCmp('online').setValue('在线');
  505. }else {
  506. Ext.getCmp('online').setValue('不在线');
  507. }
  508. }
  509. });
  510. }
  511. function openTable(id, caller, title, link, key, detailKey, condition){
  512. var main = parent.Ext.getCmp("content-panel");
  513. var panel = Ext.getCmp('' + id);
  514. var url = link;
  515. if(caller){
  516. panel = Ext.getCmp(caller);
  517. url = link + '?whoami=' + caller;
  518. }
  519. if(id){
  520. if(caller){
  521. panel = Ext.getCmp(caller + id);
  522. url = link + '?whoami=' + caller + '&formCondition=' + key + '=' + id + '&gridCondition=' + detailKey + '=' + id;
  523. }
  524. } else {
  525. if(condition != null){
  526. url += '&urlcondition=' + condition;
  527. }
  528. }
  529. if(!panel){
  530. panel = {
  531. title : title.substring(0, title.toString().length > 5 ? 5 : title.toString().length),
  532. tag : 'iframe',
  533. tabConfig:{tooltip: title},
  534. frame : true,
  535. border : false,
  536. layout : 'fit',
  537. iconCls : 'x-tree-icon-tab-tab',
  538. html : '<iframe id="iframe" src="' + basePath + url + '" height="100%" width="100%" frameborder="0" scrolling="auto"></iframe>',
  539. closable : true,
  540. listeners : {
  541. close : function(){
  542. main.setActiveTab(main.getActiveTab().id);
  543. }
  544. }
  545. };
  546. openTab(panel, panel.id);
  547. }else{
  548. main.setActiveTab(panel);
  549. }
  550. }
  551. function openTab(panel, id){
  552. var o = (typeof panel == "string" ? panel : id || panel.id);
  553. var main = parent.Ext.getCmp("content-panel");
  554. var tab = main.getComponent(o);
  555. if (tab) {
  556. main.setActiveTab(tab);
  557. } else if(typeof panel!="string"){
  558. panel.id = o;
  559. var p = main.add(panel);
  560. main.setActiveTab(p);
  561. }
  562. }
  563. function taskItem(val, meta, record){
  564. return '<a href="javascript:openTable(' + record.data['ra_id'] + ',\'ResourceAssignment\',\'任务\',\'jsps/plm/record/workrecord.jsp\',\'ra_id\',\'wr_raid\'' + ');">' + val + '</a>';
  565. }
  566. function Synergy(val,meta,record){
  567. return '<a href="javascript:openTable(' + record.data['sy_id'] + ',\'Synergy\',\'协同\',\'jsps/oa/myProcess/synergy/newSynergy.jsp\',\'sy_id\',\'\'' + ');">' + val + '</a>';
  568. }
  569. function workrecord(val,meta,record){
  570. return '<a href="javascript:openTable(' + record.data['wr_id'] + ',\'WorkRecord\',\'工作日报\',\'jsps/plm/record/recordlog.jsp\',\'wr_id\',\'\'' + ');">' + val + '</a>';
  571. }
  572. function getSurPlus(val, meta, record){
  573. if(record.data.ra_taskpercentdone == 100){
  574. return '<img src="' + basePath + 'resource/images/renderer/award2.png">' + '<span style="color:green;padding-left:2px">已完成</span>';
  575. } else {
  576. var bTime = new Date().getTime();
  577. var eTime = Ext.Date.parse(record.data['ra_enddate'].substring(0, 10) + ' 23:59:59','Y-m-d H:i:s').getTime();
  578. var allHour = (eTime - bTime)/(60*60*1000);
  579. if(allHour < 0){
  580. if(allHour < -24){
  581. val = "<font color =red>过期" + Math.floor(Math.abs(allHour)/24) + "天" + Math.floor(Math.abs(allHour)%24) + "小时";
  582. } else {
  583. val = "<font color =red>过期" + Math.floor(Math.abs(allHour)) + "小时";
  584. }
  585. } else {
  586. val = "<font color =blue>剩余" + Math.floor(allHour/24) + "天" + Math.floor(allHour%24) + "小时";
  587. }
  588. return val;
  589. }
  590. }
  591. function percentdone(val, meta, record){
  592. val == null || 0;
  593. if(val < 30)
  594. return '<img src="' + basePath + 'resource/images/renderer/remind2.png">'+'<span style="color:#436EEE;padding-left:2px">' + val + '</span>';
  595. else if(val > 30 && val < 50)
  596. return '<img src="' + basePath + 'resource/images/renderer/remind.png">'+'<span style="color:#5F9EA0;padding-left:2px">' + val + '</span>';
  597. else if(val == 100){
  598. return '<img src="' + basePath + 'resource/images/renderer/award1.png">'+'<span style="color:blue;padding-left:2px">' + val + '</span>';
  599. }else if(val > 80){
  600. return '<img src="' + basePath + 'resource/images/renderer/award2.png">'+'<span style="color:green;padding-left:2px">' + val + '</span>';
  601. }
  602. else
  603. return val;
  604. }
  605. function workplan(val,meta,record){
  606. return '<a href="javascript:openTable(' + record.data['pl_id'] + ',\'Plan\',\'工作计划\',\'jsps/oa/persontask/workPlan/register.jsp\',\'pl_id\',\'\'' + ');">' + val + '</a>';
  607. }
  608. function showDialogBox(e,id, otherId, other, date, context){
  609. var panel = Ext.getCmp('dialog-win-' + otherId);
  610. if(!panel){
  611. panel = Ext.create('erp.view.core.window.DialogBox', {
  612. other: other,
  613. autoShow: false,
  614. otherId: otherId
  615. });
  616. panel.showAt(e.getXY());
  617. }
  618. if(!Ext.isEmpty(id)){
  619. panel.insertDialogItem(other, date, context);
  620. if(Ext.getCmp('dialog-min-' + otherId)){
  621. Ext.getCmp('dialog-min-' + otherId).setText("<font color=red>有新消息...</font>" );
  622. } else {
  623. updatePagingStatus(id, 1);
  624. }
  625. }
  626. }