listPending

注入覆盖用:oa.mengtiandairy.com:7070

当前为 2023-09-14 提交的版本,查看 最新版本

此脚本不应直接安装,它是供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/475244/1249988/listPending.js

  1. console.log.apply(void 0, [
  2. '%c[@inject] %coverride http://oa.mengtiandairy.com:7070/seeyon/apps_res/collaboration/js/listPending.js',
  3. 'color: green',
  4. 'color: gray'
  5. ])
  6. var colModelAppend = [
  7. { display: '序列号', name: 'summaryId', sortable: true, width: 'smallest', align: 'center' },
  8. { display: '收款账户', name: 'supplyName', sortable: true, width: 'medium' },
  9. { display: '申请金额', name: 'accountsPayable', sortable: true, width: 'small', align: 'right' },
  10. // { display: '银行账号', name: 'account', sortable: true, width: 'small' },
  11. // { display: '开户行', name: 'depositBank', sortable: true, width: 'small' }
  12. ]
  13.  
  14. //批处理
  15. function batchDeal() {
  16. var rows = grid.grid.getSelectRows();
  17. if (rows.length == 0) {
  18. $.alert($.i18n('collaboration.listPending.selectBatchData')); //请选择要删除的记录
  19. return;
  20. }
  21. var sendDevelop = $.ctp.trigger('beforeBatchDealColl');
  22. if (!sendDevelop) {
  23. return;
  24. }
  25. var process = new BatchProcess();
  26. for (var i = 0; i < rows.length; i++) {
  27. var affairId = rows[i].affairId;
  28. var subject = rows[i].subject;
  29. var category = rows[i].category || "1";
  30. var summaryId = rows[i].summaryId;
  31. if (process.batchOpinion == "0" || process.batchOpinion == null) {
  32. process.batchOpinion = rows[i].disAgreeOpinionPolicy == null ? "0" : rows[i].disAgreeOpinionPolicy == "1" ? "3" : "0";//意见是否必填,3,不同意时,意见必填
  33. }
  34. process.addData(affairId, summaryId, category, subject);
  35. }
  36.  
  37. if (!process.isEmpty()) {
  38. var r = process.doBatch();
  39. }
  40. //try{window.location.reload();}catch(e){}
  41. }
  42.  
  43.  
  44. //取消加粗
  45. function cancelBold(rowIndex) {
  46. var obj = $("tr:eq(" + rowIndex + ")").find(".font_bold");
  47. if (obj != null && typeof (obj) != 'undefined') obj.removeClass("font_bold");
  48. }
  49. function rend(txt, data, r, c, col) {
  50. //未读 11 加粗显示
  51. var subState = data.subState;
  52. var readState = data.readState;
  53. if (readState == 0 || subState == 11) {
  54. txt = "<span class='font_bold'>" + (txt == undefined ? '' : txt) + "</span>"
  55. }
  56.  
  57. if (col.name == "subject") {
  58. //标题列加深
  59. txt = "<span class='grid_black titleText'>" + txt + "</span>";
  60. //如果是代理 ,颜色变成蓝色
  61. if (data.proxy) {
  62. txt = "<span class='color_blue'>" + txt + "</span>";
  63. }
  64. //加图标
  65. //重要程度
  66. if (data.importantLevel != "" && data.importantLevel != 1) {
  67. txt = "<span style='float: left;' class='ico16 important" + data.importantLevel + "_16 '></span>" + txt;
  68. }
  69. //附件
  70. if (data.hasAttsFlag == true) {
  71. txt = txt + "<span class='ico16 affix_16'></span>";
  72. }
  73. //协同类型
  74. if (data.bodyType != "" && data.bodyType != null && data.bodyType != "10" && data.bodyType != "30" && data.bodyType !== "90") {
  75. txt = txt + "<span class='ico16 office" + data.bodyType + "_16'></span>";
  76. }
  77. //流程状态
  78. if (data.state != null && data.state != "" && data.state != "0" && data.state != "2") {
  79. txt = "<span style='float: left;' class='ico16 flow" + data.state + "_16 '></span>" + txt;
  80. }
  81. //如果设置了处理期限(节点期限),添加超期图标
  82. if (data.nodeDeadLineName != $.i18n('common.default')) {
  83. if (data.isCoverTime) {
  84. //超期图标
  85. txt = txt + "<span class='ico16 extended_red_16'></span>";
  86. } else {
  87. //未超期图标
  88. txt = txt + "<span class='ico16 extended_blue_16'></span>";
  89. }
  90. }
  91. } else if (col.name === "nodeDeadLineName") {
  92. if (data.isCoverTime) {
  93. //超期图标
  94. txt = "<span class='color_red'>" + txt + "</span>";
  95. }
  96. } else if (col.name === "subState") {
  97. var titleTip = subState;
  98. if (subState == 16 || subState == 17 || subState == 18) {
  99. titleTip = 16;
  100. };
  101. var toolTip = $.i18n('collaboration.toolTip.label' + subState);
  102. var backFromId = data.backFromId;
  103. var isBackfrom = false;
  104. if (backFromId != null || (data.subState == "7" || data.subState == "16")) {
  105. isBackfrom = true;
  106. }
  107. //被回退,处理提交后取回,不显示回退图标
  108. if (isBackfrom && subState != 13 && subState != 15 && subState != 17 && subState != 6) {//被回退并且暂存待办后不显示。被回退图标
  109. toolTip = $.i18n('collaboration.toolTip.label' + 16);
  110. return "&nbsp;<span class='ico16 be_rolledback_16' title='" + toolTip + "'></span>&nbsp;";
  111. } else if (subState == 12) {
  112. return "&nbsp;<span class='ico16 viewed_16' title='" + toolTip + "'></span>&nbsp;";
  113. } else if (subState == 6) {
  114. toolTip = $.i18n("common.toolbar.takeBack.label");
  115. return "&nbsp;<span class='ico16 retrieve_16' title='" + toolTip + "'></span>&nbsp;";
  116. } else {
  117. if (subState == 15 || subState == 17) {
  118. toolTip = $.i18n("common.workflow.specialback.label");
  119. if (subState == 17) {
  120. //指定回退中间节点的时候按照指定回退发起方显示图标
  121. subState = 15;
  122. }
  123. }
  124. return "&nbsp;<span class='ico16 pending" + subState + "_16' title='" + toolTip + "'></span>&nbsp;";
  125. }
  126. } else if (col.name === "processId") {
  127. return "&nbsp;<a class='ico16 view_log_16 noClick' href='javascript:void(0)' onclick='showDetailLogDialog(\"" + data.summaryId + "\",\"" + data.processId + "\",2)'></a>&nbsp;";
  128. } else if (col.name === "nodeName") {
  129. return null == data.affairNodeName ? txt : data.affairNodeName + "(" + txt + ")";
  130. } else if (col.name == "hasPrint") {//是否打印
  131. if (data.print > 0) {
  132. txt = "<span class='font_bold'>" + $.i18n('common.yes') + "</span>";
  133. } else {
  134. txt = "<span class='font_bold'>" + $.i18n('common.no') + "</span>";
  135. }
  136.  
  137. }
  138. return txt;
  139. }
  140.  
  141. //点击事件
  142. function dbclickRow(data, rowIndex, colIndex) {
  143. //取消加粗
  144. //cancelBold(rowIndex);
  145. $("#listPending tr").eq(rowIndex).find("span").removeClass("font_bold");
  146.  
  147. if (!isAffairValid(data.affairId)) {
  148. $("#listPending").ajaxgridLoad();
  149. return;
  150. }
  151. var url = _ctxPath + "/collaboration/collaboration.do?method=summary&openFrom=listPending&affairId=" + data.affairId + (window.CsrfGuard ? CsrfGuard.getUrlSurffix() : "");
  152. var title = data.subject;
  153. doubleClick(url, escapeStringToHTML(title));
  154. grid.grid.resizeGridUpDown('down');
  155. //页面底部说明加载
  156. $('#summary').attr("src", _ctxPath + "/collaboration/listDesc.do?method=listDesc&type=listPending&size=" + grid.p.total + "&r=" + Math.random() + CsrfGuard.getUrlSurffix());
  157. }
  158. //删除
  159. function deleteCol() {
  160. deleteItems('pending', grid, 'listPending', paramMethod);
  161. }
  162.  
  163. function transmitCol() {
  164. transmitColFromGrid(grid);
  165. }
  166.  
  167. var grid;
  168. var searchobj;
  169. var isSearch = false;
  170. var layoutObj = null;
  171.  
  172.  
  173. $(document).ready(function () {
  174. var bpmMenuType = $("#bpmMenuType").val();
  175. var tppHeight = 102;
  176. if (!bpmMenuType || bpmMenuType === "false") {
  177. tppHeight = 112;
  178. }
  179. if (isShowStatisticalToolBar == "0") {
  180. tppHeight = 40;
  181. }
  182. layoutObj = new MxtLayout({
  183. 'id': 'layout',
  184. 'northArea': {
  185. 'id': 'north',
  186. 'height': tppHeight,
  187. 'sprit': false,
  188. 'border': false
  189. },
  190. 'centerArea': {
  191. 'id': 'center',
  192. 'border': false,
  193. 'minHeight': 20
  194. }
  195. });
  196. var submenu = new Array();
  197. //判断是否有新建协同的资源权限,如果没有则屏蔽转发协同
  198. if ($.ctx.resources.contains('F01_newColl')) {
  199. //协同
  200. submenu.push({ name: $.i18n('common.toolbar.transmit.col.label'), click: transmitCol });
  201. };
  202. //判断是否有转发邮件的资源权限,如果没有则屏蔽转发协同
  203. if ($.ctx.resources.contains('F12_mailcreate')) {
  204. //邮件
  205. if (emailShow) {
  206. submenu.push({ name: $.i18n('common.toolbar.transmit.mail.label'), click: transmitMail });
  207. }
  208. };
  209. var toolbarArray = new Array();
  210. //转发
  211. toolbarArray.push({ id: "transmit", name: $.i18n('common.toolbar.transmit.label'), className: "ico16 forwarding_16", subMenu: submenu });
  212. //归档
  213. if (isPigeonholeBtn() && hasDoc == "true") {
  214. toolbarArray.push({ id: "pigeonhole", name: $.i18n('common.toolbar.pigeonhole.label'), className: "ico16 filing_16", click: function () { doPigeonhole("pending", grid, "listPending"); } });
  215. }
  216. //删除
  217. if (canDel == "true") {
  218. toolbarArray.push({ id: "delete", name: $.i18n('common.toolbar.delete.label'), className: "ico16 del_16", click: deleteCol });
  219. }
  220. //批处理
  221. toolbarArray.push({ id: "batchDeal", name: $.i18n('common.batch.handle.label'), className: "ico16 batch_16", click: batchDeal });
  222. //toolbar扩展
  223. for (var i = 0; i < addinMenus.length; i++) {
  224. toolbarArray.push(addinMenus[i]);
  225. }
  226. //批量打印
  227. //toolbarArray.push({id: "batchPrint", name: $.i18n('common.toolbar.batch.print.label'), className:"ico16 print_16", click:batchPrint});
  228. //智能排序开关
  229. if (hasAIPlugin == "true") {
  230. var checkValue = false;
  231. if (aiSortValueTemp == "true") {
  232. checkValue = true;
  233. }
  234. toolbarArray.push({ id: "aiSortBtn", type: "checkbox", checked: checkValue, text: $.i18n('ai.sort.labe'), value: "1", click: aiSortClick });
  235. }
  236.  
  237.  
  238. //工具栏
  239. $("#toolbars").toolbar({
  240. toolbar: toolbarArray
  241. });
  242.  
  243.  
  244. //查询条件
  245. var condition = new Array();
  246. //标题
  247. condition.push({ id: 'title', name: 'title', type: 'input', text: $.i18n("common.subject.label"), value: 'subject', maxLength: 100 });
  248. //模板名称
  249. condition.push({ id: 'templateNameSearch', name: 'templateName', type: 'input', text: $.i18n("common.template.label"), value: 'templateName' });
  250. //重要程度
  251. condition.push({
  252. id: 'importent', name: 'importent', type: 'select', text: $.i18n("common.importance.label"), value: 'importantLevel',
  253. items: [{
  254. text: $.i18n("common.importance.putong"),//普通
  255. value: '1'
  256. }, {
  257. text: $.i18n("common.importance.zhongyao"),//重要
  258. value: '2'
  259. }, {
  260. text: $.i18n("common.importance.feichangzhongyao"),//非常重要
  261. value: '3'
  262. }]
  263. });
  264. //发起人
  265. condition.push({ id: 'spender', name: 'spender', type: 'input', text: $.i18n("common.sender.label"), value: 'startMemberName' });
  266. //addby libing 上一处理人
  267. condition.push({ id: 'preApproverNameSearch', name: 'preApproverName', type: 'input', text: $.i18n("cannel.display.column.preApprover.label"), value: 'preApproverName' });
  268. //发起时间
  269. condition.push({ id: 'datetime', name: 'datetime', type: 'datemulti', text: $.i18n("common.date.sendtime.label"), value: 'createDate', ifFormat: '%Y-%m-%d', dateTime: false });
  270. //接受时间
  271. condition.push({ id: 'receivetime', name: 'receivetime', type: 'datemulti', text: $.i18n("cannel.display.column.receiveTime.label"), value: 'receiveDate', ifFormat: '%Y-%m-%d', dateTime: false });
  272. condition.push({ id: 'nodeDeadLine', name: 'nodeDeadLine', type: 'datemulti', text: $.i18n("common.workflow.deadline.date"), value: 'expectprocesstime', ifFormat: '%Y-%m-%d', dateTime: false });
  273. condition.push({
  274. id: 'subStateSearch', name: 'subState', type: 'select', text: $.i18n("common.deal.state"), value: 'subState', ifFormat: '%Y-%m-%d', dateTime: false,
  275. items: [{
  276. text: $.i18n("collaboration.toolTip.label11"),//未读
  277. value: '11'
  278. }, {
  279. text: $.i18n("collaboration.toolTip.label12"),//已读
  280. value: '12'
  281. }, {
  282. text: $.i18n("common.save.and.pause.flow"),//暂存待办
  283. value: '13'
  284. }, {
  285. text: $.i18n("collaboration.toolTip.label16"),//被回退
  286. value: '7'
  287. }, {
  288. text: $.i18n("common.toolbar.takeBack.label"),//取回
  289. value: '6'
  290. }]
  291. });
  292. //是否超期:节点超期查询出来。
  293. condition.push({
  294. id: 'isOverdueSearch',
  295. name: 'isOverdue',
  296. type: 'select',
  297. text: $.i18n('collaboration.condition.affairOverdue'), //节点超期
  298. value: 'isOverdue',
  299. items: [{
  300. text: $.i18n('common.yes'),
  301. value: '1'
  302. }, {
  303. text: $.i18n('common.no'),
  304. value: '0'
  305. }]
  306. });
  307.  
  308. var bpmMenuType = $("#bpmMenuType").val();
  309. var queryTppHeight = 72;
  310. if (!bpmMenuType || bpmMenuType === "false") {
  311. queryTppHeight = 82;
  312. }
  313. if (isShowStatisticalToolBar == "0") {
  314. queryTppHeight = 5;
  315. }
  316.  
  317. var right = 85;
  318. //国际化下 查询区域的位置需要进行动态设置
  319. if (typeof (__getCurSysLang) !== "undefined") {
  320. var lang = __getCurSysLang();
  321. if (lang !== "zh_CN" && lang != "zh_TW") {
  322. right = 110;
  323. }
  324. }
  325. searchobj = $.searchCondition({
  326. right: right,
  327. top: queryTppHeight,
  328. searchHandler: function () {//chenxd
  329.  
  330. var val = searchobj.g.getReturnValue();
  331.  
  332. if (val != null) {
  333. $("#listPending").ajaxgridLoad(getSearchValueObj());
  334. isSearch = true;
  335. var _summarySrc = $('#summary').attr("src");
  336. if (_summarySrc.indexOf("listDesc") != -1) {
  337. setTimeout(function () {
  338. $('#summary').attr("src", "listDesc.do?method=listDesc&type=listPending&size=" + grid.p.total + "&r=" + Math.random() + CsrfGuard.getUrlSurffix());
  339. }, 1000);
  340. }
  341. }
  342. },
  343. conditions: condition
  344. });
  345. var _colModel = [{
  346. display: 'id',
  347. name: 'affairId',
  348. width: 'smallest',
  349. type: 'checkbox',
  350. isToggleHideShow: false,
  351. align: 'center'
  352. }, {
  353. display: $.i18n("common.subject.label"),//标题
  354. name: 'subject',
  355. sortable: true,
  356. width: 'big'
  357. }, {
  358. display: $.i18n("common.sender.label"),//发起人
  359. name: 'startMemberName',
  360. sortable: true,
  361. width: 'small'
  362. }, {
  363. display: $.i18n("cannel.display.column.preApprover.label"),//上一处理人
  364. name: 'preApproverName',
  365. sortable: true,
  366. width: 'small'
  367. }, {
  368. display: $.i18n("common.date.sendtime.label"),//发起时间
  369. name: 'startDate',
  370. sortable: true,
  371. width: 'medium'
  372. }, {
  373. display: $.i18n("cannel.display.column.receiveTime.label"),//接收时间
  374. name: 'receiveTime',
  375. sortable: true,
  376. width: 'medium'
  377. }, {
  378. display: $.i18n("common.workflow.deadline.date"),//处理期限(节点期限)
  379. name: 'nodeDeadLineName',
  380. sortable: true,
  381. width: 'medium'
  382. },/*{
  383. display: $.i18n("cannel.display.column.print.label"),//是否打印
  384. name: 'hasPrint',
  385. sortable : true,
  386. width: 'medium'
  387. },*/ {
  388. display: $.i18n("collaboration.col.hasten.number.label"),//催办次数
  389. name: 'hastenTimes',
  390. sortable: true,
  391. width: 'small'
  392. }, {
  393. display: $.i18n("common.deal.state"),//处理状态
  394. name: 'subState',
  395. width: 'small'
  396. }, {
  397. display: $.i18n("common.workflow.log.label"),//流程日志
  398. name: 'processId',
  399. width: 'small'
  400. }, {
  401. display: $.i18n("collaboration.current.Node.label"),//当前节点
  402. name: 'nodeName',
  403. sortable: true,
  404. width: 'small'
  405. }]
  406. // @inject-start: 添加列
  407. for (let item of colModelAppend)
  408. _colModel.push(item)
  409. // @inject-end
  410. //表格加载
  411. grid = $('#listPending').ajaxgrid({
  412. colModel: _colModel,
  413. click: dbclickRow,
  414. render: rend,
  415. height: 200,
  416. noTotal: isShowTotal == "0" ? true : false,
  417. onChangeSort: disableAISort,
  418. showTableToggleBtn: true,
  419. gridType: 'autoGrid',
  420. parentId: $('.layout_center').eq(0).attr('id'),
  421. vChange: true,
  422. vChangeParam: {
  423. overflow: "hidden",
  424. autoResize: false //表格下方是否自动显示
  425. },
  426. isHaveIframe: true,
  427. slideToggleBtn: true,
  428. callBackTotle: function (data) {
  429. /*if(!isSearch){
  430. $(".query_menu_bar .active_item .item_number").text(data);
  431. } else {
  432. isSearch = false;
  433. }*/
  434. // OA-178592
  435. $(".query_menu_bar .active_item .item_number").text(data);
  436. },
  437. managerName: "colManager",
  438. managerMethod: "getPendingList"
  439. });
  440. //页面底部说明加载
  441. $('#summary').attr("src", _ctxPath + "/collaboration/listDesc.do?method=listDesc&type=listPending&size=" + grid.p.total + "&r=" + Math.random() + CsrfGuard.getUrlSurffix());
  442. var params = {
  443. userId: _wfcurrentUserId,
  444. templeteIds: ""
  445. };
  446. if (isShowStatisticalToolBar == "1") {
  447. $('#statisticalToolBar').show();
  448. if (isShowTotal == "1") {
  449. callBackendMethod("colManager", "getOverdueOrSevenDayOverdueMap", _wfcurrentUserId, _paramTemplateIds, {
  450. success: function (data) {
  451. $("#allPendingNum").text(grid.p.total);
  452. $("#overTimeNum").text(data.overdue);
  453. $("#sevenOverTimeNum").text(data.sevenDayOverdue);
  454. $("#fromleaderNum").text(data.fromleader);
  455. $("#myDepartmentNum").text(data.mydept);
  456. }
  457. });
  458. }
  459. }
  460. if (isShowTotal == "0") {
  461. $("#allPendingNum").hide();
  462. $("#overTimeNum").hide();
  463. $("#sevenOverTimeNum").hide();
  464. $("#fromleaderNum").hide();
  465. $("#myDepartmentNum").hide();
  466. }
  467. });
  468.  
  469. function aiSortClick() {
  470. //智能排序清空右侧查询条件
  471. searchobj.g.clearCondition();
  472. //隐藏高级查询
  473. if ($(".more_query_area").css("display") !== "none" && $("#aiSortBtn").is(":checked")) {
  474. openQueryViews("listPending");
  475. }
  476.  
  477. //智能查询参数
  478. var aiSortCondition = new Object();
  479. var toTab = $(".active_item").attr("id");
  480. if (toTab == 'overTime') {
  481. aiSortCondition.coverTime = "1";
  482. } else if (toTab == 'sevenOverTime') {
  483. aiSortCondition.sevenDayOverdue = "sevenDayOverdue";
  484. } else if (toTab == 'myDepartment') {
  485. aiSortCondition.myDept = "myDept";
  486. } else if (toTab == 'fromleader') {
  487. aiSortCondition.myLeader = "myLeader";
  488. }
  489. aiSortCondition.aiSort = ("checked" == $("#aiSortBtn").attr("checked")) + '';
  490. aiSortCondition.templeteIds = _paramTemplateIds;
  491. $("#listPending").ajaxgridLoad(aiSortCondition);
  492. //更新智能排序开关状态
  493. var params = new Object();
  494. params["aiSortValue"] = aiSortCondition.aiSort;
  495. params["openFrom"] = "listPending";
  496. params["source"] = "listPending";
  497. callBackendMethod("pendingManager", "updateAISortValue", params, {
  498. success: function (data) {
  499. }
  500. });
  501. }
  502.  
  503. //关闭智能排序开关
  504. function disableAISort() {
  505. //取消勾选
  506. $("#aiSortBtn").removeAttr("checked");
  507. //发送请求,更新ai排序状态
  508. var params = new Object();
  509. params["aiSortValue"] = "false";
  510. params["openFrom"] = "listPending";
  511. params["source"] = "listPending";
  512. callBackendMethod("pendingManager", "updateAISortValue", params, {
  513. success: function (data) {
  514. }
  515. });
  516. }
  517. function loadPendingGrid() {
  518. $("#listPending").ajaxgridLoad();
  519. }
  520.  
  521. //判断当前窗口是否打开了
  522. function exitWinOpen(affairId) {
  523. var _wmp = getCtpTop()._windowsMap;
  524. if (_wmp) {
  525. //参考common-debug.js修改
  526. try {
  527. var _wmpKeys = _wmp.keys();
  528. } catch (e) {//兼容处理,为了解决bug:OA-80754公司协同:连续打开2个新闻、2个公告,页签不关闭,这时,首页待办栏目中的标题点不动,栏目空间都可以刷新。
  529. getCtpTop()._windowsMap = new Properties();
  530. _wmp = getCtpTop()._windowsMap;
  531. }
  532.  
  533. //不存在的情况删除之前打开的信息
  534. for (var p = 0; p < _wmp.keys().size(); p++) {
  535. var _kkk = _wmp.keys().get(p);
  536. try {
  537. var _fff = _wmp.get(_kkk);
  538. var _dd = _fff.document;
  539. if (_dd) {
  540. var _p = parseInt(_dd.body.clientHeight);
  541. if (_p == 0) {
  542. _wmp.remove(_kkk);
  543. p--;
  544. }
  545. } else {
  546. _wmp.remove(_kkk);
  547. p--;
  548. }
  549. } catch (e) {
  550. _wmp.remove(_kkk);
  551. p--;
  552. }
  553. }
  554. var exitWin = _wmp.get(affairId);
  555. if (exitWin) {
  556. try {
  557. alert($.i18n("window.already.exit.js"));
  558. exitWin.focus();
  559. return false;
  560. } catch (e) {
  561. }
  562. }
  563. }
  564.  
  565. return true;
  566. }
  567.  
  568. function colseQuery() {
  569. try {
  570. var dialogTemp = window.parentDialogObj['queryDialog'];
  571. dialogTemp.close();
  572. } catch (e) {
  573. }
  574. }
  575.  
  576. //二维码传参chenxd
  577. function precodeCallback() {
  578. var obj = getSearchValueObj();
  579. obj.openFrom = "listPending";
  580. return obj;
  581. }
  582.  
  583. function getSearchValueObj() {
  584. o = new Object();
  585. var templeteIds = $.trim(_paramTemplateIds);
  586. if (templeteIds != "") {
  587. o.templeteIds = templeteIds;
  588. }
  589. var choose = $('#' + searchobj.p.id).find("option:selected").val();
  590. if (choose == 'subject') {
  591. o.subject = $('#title').val();
  592. } else if (choose == 'templateName') {
  593. o.templateName = $('#templateNameSearch').val();
  594. } else if (choose == 'importantLevel') {
  595. o.importantLevel = $('#importent').val();
  596. } else if (choose == 'startMemberName') {
  597. o.startMemberName = $('#spender').val();
  598. } else if (choose == 'preApproverName') {
  599. o.preApproverName = $("#preApproverNameSearch").val();
  600. } else if (choose == 'createDate') {
  601. var fromDate = $('#from_datetime').val();
  602. var toDate = $('#to_datetime').val();
  603. if (fromDate != "" && toDate != "" && fromDate > toDate) {
  604. $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
  605. return;
  606. }
  607. var date = fromDate + '#' + toDate;
  608. o.createDate = date;
  609. } else if (choose == 'receiveDate') {
  610. var fromDate = $('#from_receivetime').val();
  611. var toDate = $('#to_receivetime').val();
  612. if (fromDate != "" && toDate != "" && fromDate > toDate) {
  613. $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
  614. return;
  615. }
  616. var date = fromDate + '#' + toDate;
  617. o.receiveDate = date;
  618. } else if (choose == 'expectprocesstime') {
  619. var fromDate = $('#from_nodeDeadLine').val();
  620. var toDate = $('#to_nodeDeadLine').val();
  621. if (fromDate != "" && toDate != "" && fromDate > toDate) {
  622. $.alert($.i18n('collaboration.rule.date'));//开始时间不能早于结束时间
  623. return;
  624. }
  625. var date = fromDate + '#' + toDate;
  626. o.expectprocesstime = date;
  627. } else if (choose == 'subState') {
  628. o.subState = $('#subStateSearch').val();
  629. } else if (choose == 'isOverdue') {
  630. o.isOverdue = $("#isOverdueSearch").val();
  631. }
  632. if (window.location.href.indexOf("condition=templeteAll&textfield=all") != -1) {
  633. o.templeteAll = "all";
  634. }
  635. //增加智能排序条件
  636. if (hasAIPlugin == "true") {
  637. var chk = $("#aiSortBtn").attr("checked");
  638. //刷新列表,并保存开关状态
  639. if (chk && chk == "checked") {
  640. o.aiSort = "true";
  641. } else {
  642. o.aiSort = "false";
  643. }
  644. }
  645. var toTab = $(".active_item").attr("id");
  646. if (toTab == 'overTime') {
  647. o.coverTime = "1";
  648. } else if (toTab == 'sevenOverTime') {
  649. o.sevenDayOverdue = "sevenDayOverdue";
  650. } else if (toTab == 'myDepartment') {
  651. o.myDept = "myDept";
  652. } else if (toTab == 'fromleader') {
  653. o.myLeader = "myLeader";
  654. }
  655. return o;
  656. }
  657.  
  658. function tabSwitch(toTab) {
  659. tabActive(toTab);
  660. tabSwitchLoadData(toTab);
  661. }
  662.  
  663. function tabActive(toTab) {
  664. if (toTab == 'allPending') {
  665. $("#allPending").addClass("active_item");
  666. $("#overTime").removeClass("active_item");
  667. $("#sevenOverTime").removeClass("active_item");
  668. $("#myDepartment").removeClass("active_item");
  669. $("#fromleader").removeClass("active_item");
  670. } else if (toTab == 'overTime') {
  671. $("#allPending").removeClass("active_item");
  672. $("#overTime").addClass("active_item");
  673. $("#sevenOverTime").removeClass("active_item");
  674. $("#myDepartment").removeClass("active_item");
  675. $("#fromleader").removeClass("active_item");
  676. } else if (toTab == 'sevenOverTime') {
  677. $("#allPending").removeClass("active_item");
  678. $("#overTime").removeClass("active_item");
  679. $("#sevenOverTime").addClass("active_item");
  680. $("#myDepartment").removeClass("active_item");
  681. $("#fromleader").removeClass("active_item");
  682. } else if (toTab == 'myDepartment') {
  683. $("#allPending").removeClass("active_item");
  684. $("#overTime").removeClass("active_item");
  685. $("#sevenOverTime").removeClass("active_item");
  686. $("#myDepartment").addClass("active_item");
  687. $("#fromleader").removeClass("active_item");
  688. } else if (toTab == 'fromleader') {
  689. $("#allPending").removeClass("active_item");
  690. $("#overTime").removeClass("active_item");
  691. $("#sevenOverTime").removeClass("active_item");
  692. $("#myDepartment").removeClass("active_item");
  693. $("#fromleader").addClass("active_item");
  694. }
  695. }
  696.  
  697. function tabSwitchLoadData(toTab) {
  698. var param = new Object();
  699. if (toTab == 'overTime') {
  700. param.coverTime = "1";
  701. } else if (toTab == 'sevenOverTime') {
  702. param.sevenDayOverdue = "sevenDayOverdue";
  703. } else if (toTab == 'myDepartment') {
  704. param.myDept = "myDept";
  705. } else if (toTab == 'fromleader') {
  706. param.myLeader = "myLeader";
  707. }
  708. param.templeteIds = _paramTemplateIds;
  709.  
  710. //切换页签的时候将查询条件带入
  711. var obj = getSearchValueObj();
  712. param = $.extend(obj, param);
  713.  
  714. $("#listPending").ajaxgridLoad(param);
  715. // var params = {templeteIds:,
  716. // userId:};
  717. //现取count从GRID中获取,无需切换页签请求后台
  718. // callBackendMethod("colManager","getOverdueOrSevenDayOverdueMap",_wfcurrentUserId,_paramTemplateIds,{
  719. // success : function (data) {
  720. // $("#allPendingNum").text(data.allpending);
  721. // $("#overTimeNum").text(data.overdue);
  722. // $("#sevenOverTimeNum").text(data.sevenDayOverdue);
  723. // $("#fromleaderNum").text(data.fromleader);
  724. // $("#myDepartmentNum").text(data.mydept);
  725. // }
  726. // });
  727. }
  728.  
  729. function showAdvanceSearch() {
  730. openQueryViews('listPending', !advanceSearchFlag);
  731. }