You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

467 lines
25 KiB

  1. <script type="text/javascript">
  2. (function ($, learun) {
  3. learun.nav.data["workspace"].jsObj = (function () {
  4. var custmerform = {};
  5. var $scroll = '';
  6. // 统计数据
  7. function target(data, $desktop) {
  8. if (data.length > 0) {
  9. var _html = '\
  10. <div class="lr-black-panel">\
  11. <div class="lr-title">统计数据</div>\
  12. <div class="lr-content lr-flex-content">\
  13. </div>\
  14. </div>';
  15. $desktop.append(_html);
  16. var $content = $desktop.find('.lr-flex-content');
  17. $.each(data, function (_index, _item) {
  18. var _itemHtml = '\
  19. <div class="targetItem">\
  20. <div class="name">'+ _item.F_Name + '</div>\
  21. <div class="number" data-number="'+ _item.F_Id + '" ></div>\
  22. </div>';
  23. $content.append(_itemHtml);
  24. // 获取后台数据
  25. learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'Target', id: _item.F_Id }, function (data) {
  26. if (data) {
  27. $('[data-number="' + data.Id + '"]').text(data.value);
  28. }
  29. });
  30. });
  31. }
  32. }
  33. // 列表数据
  34. function list(data, $desktop) {
  35. if (data.length > 0) {
  36. $.each(data, function (_index, _item) {
  37. var _html = '\
  38. <div class="lr-black-panel">\
  39. <div class="lr-title">'+ _item.F_Name + '</div>\
  40. <div class="lr-content" data-desktop="'+ _item.F_Id + '" ></div>\
  41. </div>';
  42. $desktop.append(_html);
  43. learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'list', id: _item.F_Id }, function (data) {
  44. if (data) {
  45. var $list = $('[data-desktop="' + data.Id + '"]');
  46. //待办
  47. if (_item.F_Name == '待办事项') {
  48. $list.prev().on('tap',
  49. function () {
  50. learun.nav.go({
  51. path: 'nworkflow/myflow',
  52. title: '待办事项',
  53. param: '',
  54. type: 'right'
  55. });
  56. });
  57. }
  58. else {
  59. $list.prev().on('tap',
  60. function () {
  61. learun.nav.go({
  62. path: 'LR_OAModule/Notice',
  63. title: '查看详情',
  64. param: (_item.F_Url.indexOf('=') != -1 ? _item.F_Url.substr(_item.F_Url.indexOf('=') + 1) : ''),
  65. type: 'right'
  66. });
  67. });
  68. }
  69. $.each(data.value, function (_j, _jitem) {
  70. var _itemHtml = '\
  71. <div class="lr-list-item lr-dtlist-item">\
  72. <div class="lr-ellipsis">'+ _jitem.f_title + '</div>\
  73. <div class="date">'+ learun.date.format(_jitem.f_time, 'yyyy-MM-dd') + '</div>\
  74. </div>';
  75. var _$itemHtml = $(_itemHtml);
  76. _$itemHtml[0].item = _jitem;
  77. $list.append(_$itemHtml);
  78. });
  79. $list.find('.lr-dtlist-item').on('tap', function () {
  80. var item = $(this)[0].item;
  81. if (item.f_processname == undefined || item.f_processname == null || item.f_processname == '')
  82. learun.nav.go({ path: 'workspace/listdetaile', title: '详情', param: item, type: 'right' });
  83. else
  84. learun.nav.go({ path: 'nworkflow/audit', title: item.f_processname, type: 'right', param: { processId: item.f_processid, taskId: item.f_id } });
  85. });
  86. $list = null;
  87. }
  88. });
  89. });
  90. }
  91. }
  92. var chartMap = {};
  93. // 图表数据
  94. function chart(data, $desktop) {
  95. if (data.length > 0) {
  96. chartMap = {};
  97. $.each(data, function (_index, _item) {
  98. var _html = '\
  99. <div class="lr-black-panel">\
  100. <div class="lr-title">'+ _item.F_Name + '</div>\
  101. <div class="lr-content lr-chart-content">\
  102. <div class="lr-chart-container" id="'+ _item.F_Id + '" data-desktop="' + _item.F_Type + '" ></div>\
  103. </div>\
  104. </div>';
  105. $desktop.append(_html);
  106. chartMap[_item.F_Id] = echarts.init(document.getElementById(_item.F_Id));
  107. // 获取后台数据
  108. learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'chart', id: _item.F_Id }, function (data) {
  109. if (data) {
  110. var type = $('#' + data.Id).attr('data-desktop');
  111. var legendData = [];
  112. var valueData = [];
  113. $.each(data.value, function (_index, _item) {
  114. legendData.push(_item.name);
  115. valueData.push(_item.value);
  116. });
  117. var option = {};
  118. switch (type) {
  119. case '0'://饼图
  120. option.tooltip = {
  121. trigger: 'item',
  122. formatter: "{a} <br/>{b}: {c} ({d}%)"
  123. };
  124. option.legend = {
  125. orient: 'vertical',
  126. left: 'left',
  127. data: legendData
  128. };
  129. option.series = [{
  130. name: '占比',
  131. type: 'pie',
  132. radius: ['50%', '70%'],
  133. avoidLabelOverlap: false,
  134. label: {
  135. normal: {
  136. show: false,
  137. position: 'center'
  138. },
  139. emphasis: {
  140. show: true,
  141. textStyle: {
  142. fontSize: '30',
  143. fontWeight: 'bold'
  144. }
  145. }
  146. },
  147. labelLine: {
  148. normal: {
  149. show: false
  150. }
  151. },
  152. data: data.value
  153. }];
  154. option.color = ['#df4d4b', '#304552', '#52bbc8', 'rgb(224,134,105)', '#8dd5b4', '#5eb57d', '#d78d2f'];
  155. break;
  156. case '1'://折线图
  157. case '2'://柱状图
  158. option = {
  159. grid: {
  160. top: '20px',
  161. bottom: '10px',
  162. left: '15px',
  163. right: '15px',
  164. containLabel: true
  165. },
  166. xAxis: {
  167. type: 'category',
  168. data: legendData
  169. },
  170. yAxis: {
  171. type: 'value'
  172. },
  173. series: [{
  174. data: valueData,
  175. type: type === '1' ? 'line' : 'bar'
  176. }]
  177. };
  178. break;
  179. }
  180. chartMap[data.Id].setOption(option);
  181. }
  182. });
  183. });
  184. }
  185. }
  186. function refreshDeskTop(self) {
  187. learun.clientdata.get('desktop', {
  188. callback: function (data) {
  189. var $desktop = $('#lr_desktop_msg_content');
  190. $desktop.html('');
  191. var logininfo = learun.storage.get('userinfo');
  192. //if (logininfo.baseinfo.Description != "学生") {
  193. // target(data.target || [], $desktop);
  194. // chart(data.chart || [], $desktop);
  195. //}
  196. list(data.list || [], $desktop);
  197. if (self) {
  198. self.refresh(true);
  199. self.endPulldownToRefresh();
  200. }
  201. }
  202. });
  203. }
  204. var page = {
  205. init: function ($page) {
  206. var _html = '';
  207. // _html += '<div class="scanner">';
  208. // _html += '<i class="iconfont icon-scan"></i>';
  209. // _html += '</div>';
  210. _html += '\
  211. <div class="searchBox">\
  212. <i class="iconfont icon-search"></i>\
  213. <div class="search" >搜索应用</div>\
  214. </div>';
  215. _html += '<div class="message">';
  216. _html += '<i class="iconfont icon-mail"></i>';
  217. _html += '<span class="red"></span>';
  218. _html += '</div>';
  219. $page.parent().find('.f-page-header').addClass('lr-workspace-header').html(_html).css("paddingLeft", "14px");
  220. $page.parent().find('.f-page-header').after('<div><iframe style=" height: 22px;" id="fancybox-frame" name="fancybox-frame1591156769422" frameborder="0" scrolling="no" hspace="0" src="http://i.tianqi.com/index.php?c=code&a=getcode&id=34&h=25&w=280"></iframe></div>')
  221. // 点击搜索框
  222. $page.parent().find('.searchBox').on('tap', function () {
  223. learun.nav.go({ path: 'workspace/search', title: '', isBack: true, isHead: true });
  224. });
  225. // 点击消息图标
  226. $page.parent().find('.message').on('tap', function () {
  227. learun.nav.go({ path: 'message', title: '消息', isBack: true, isHead: true, type: 'right' });
  228. });
  229. // 注册扫描
  230. $page.parent().find('.scanner').on('tap', function () {
  231. learun.code.scan(function (res) {
  232. if (res.status === 'success') {
  233. learun.layer.toast(res.msg);
  234. }
  235. else {
  236. learun.layer.toast('扫描失败:' + res.msg);
  237. }
  238. });
  239. });
  240. // 图片加载
  241. learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
  242. if (data) {
  243. var _list = [];
  244. $.each(data, function (_index, _item) {
  245. _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
  246. });
  247. $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
  248. }
  249. });
  250. // 基础数据初始化
  251. learun.clientdata.init();
  252. refreshDeskTop();
  253. $scroll = $page.find('#lr_desktop_msg').pullRefresh({
  254. down: {
  255. height: 30,
  256. contentinit: '下拉可以刷新',
  257. contentdown: '下拉可以刷新',
  258. contentover: '松开立即刷新',
  259. contentrefresh: '正在刷新...',
  260. callback: function () {
  261. refreshDeskTop(this);
  262. }
  263. }
  264. });
  265. // 加载功能列表
  266. learun.clientdata.get('module', {
  267. callback: function (data) {
  268. learun.myModule.get(data, function (myModules) {
  269. var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
  270. switch (mylen) {
  271. case 1:
  272. $page.find('.lr-workspace-page').css('padding-top', '210px');
  273. break;
  274. case 2:
  275. $page.find('.lr-workspace-page').css('padding-top', '290px');
  276. break;
  277. case 3:
  278. $page.find('.lr-workspace-page').css('padding-top', '370px');
  279. break;
  280. }
  281. var map = {};
  282. $.each(data, function (_index, _item) {
  283. map[_item.F_Id] = _item;
  284. });
  285. var $appbox = $page.find('.appbox');
  286. var $last = null;
  287. $.each(myModules, function (_index, _id) {
  288. var item = map[_id];
  289. if (item) {
  290. var Tips = ''; //审批 提示脚标
  291. if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
  292. var tipCount = 0;
  293. learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
  294. if (data) {
  295. tipCount = data.value.length;
  296. }
  297. });
  298. Tips = '<span style="position: absolute;top: -4px;right: -3px;width: 20px;height: 20px;background: #f86c61;border-radius: 50%;line-height: 20px;color: #fff;font-size: 12px;">' + tipCount + '</span>';
  299. }
  300. var _html = '\
  301. <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
  302. <div style="position:relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
  303. <span>'+ item.F_Name + '</span>\
  304. </div>';
  305. var _$html = $(_html);
  306. _$html[0].item = item;
  307. if ($last === null) {
  308. $appbox.prepend(_$html);
  309. }
  310. else {
  311. $last.after(_$html);
  312. }
  313. $last = _$html;
  314. }
  315. });
  316. $last = null;
  317. });
  318. }
  319. });
  320. // 注册更多功能按钮
  321. $page.find('#lr_more_app').on('tap', function () {
  322. learun.nav.go({ path: 'workspace/modulelist', title: "", type: 'right' });
  323. });
  324. // 点击功能按钮
  325. $page.delegate('.appitem2', 'tap', function () {
  326. var $this = $(this);
  327. var item = $this[0].item;
  328. if (item.F_IsSystem === 1) {// 代码开发功能
  329. learun.nav.go({ path: item.F_Url, title: item.F_Name, isBack: true, isHead: true, type: 'right' });
  330. }
  331. else {// 自定义表单开发功能
  332. learun.nav.go({ path: 'custmerform', title: item.F_Name, param: { formSchemeId: item.F_FormId, girdScheme: item.F_Scheme }, isBack: true, isHead: true, type: 'right' });
  333. }
  334. return false;
  335. });
  336. },
  337. reload: function ($page, pageinfo) {
  338. if (learun.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
  339. learun.isOutLogin = false;
  340. refreshDeskTop();
  341. learun.clientdata.clear('module');
  342. learun.myModule.states = -1;
  343. // 图片加载
  344. learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
  345. if (data) {
  346. var _list = [];
  347. $.each(data, function (_index, _item) {
  348. _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
  349. });
  350. $page.find('.banner').after('<div style="margin-top:20px" class="banner"></div>').remove();
  351. $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
  352. }
  353. });
  354. }
  355. // 加载功能列表
  356. learun.clientdata.get('module', {
  357. callback: function (data) {
  358. learun.myModule.get(data, function (myModules) {
  359. var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
  360. switch (mylen) {
  361. case 1:
  362. $page.find('.lr-workspace-page').css('padding-top', '210px');
  363. break;
  364. case 2:
  365. $page.find('.lr-workspace-page').css('padding-top', '290px');
  366. break;
  367. case 3:
  368. $page.find('.lr-workspace-page').css('padding-top', '370px');
  369. break;
  370. }
  371. var map = {};
  372. $.each(data, function (_index, _item) {
  373. map[_item.F_Id] = _item;
  374. });
  375. var $appbox = $page.find('.appbox');
  376. var $last = null;
  377. $appbox.find(".appitem2").remove();
  378. $.each(myModules, function (_index, _id) {
  379. var item = map[_id];
  380. if (item) {
  381. var Tips = ''; //审批 提示脚标
  382. if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
  383. var tipCount = 0;
  384. learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
  385. if (data) {
  386. tipCount = data.value.length;
  387. }
  388. });
  389. Tips = '<span style="position: absolute;top: -4px;right: -3px;width: 20px;height: 20px;background: #f86c61;border-radius: 50%;line-height: 20px;color: #fff;font-size: 12px;">' + tipCount + '</span>';
  390. }
  391. var _html = '\
  392. <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
  393. <div style="position: relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
  394. <span>'+ item.F_Name + '</span>\
  395. </div>';
  396. var _$html = $(_html);
  397. _$html[0].item = item;
  398. if ($last === null) {
  399. $appbox.prepend(_$html);
  400. }
  401. else {
  402. $last.after(_$html);
  403. }
  404. $last = _$html;
  405. }
  406. });
  407. $last = null;
  408. });
  409. }
  410. });
  411. $.each(chartMap, function (id, obj) {
  412. obj.resize();
  413. });
  414. }
  415. };
  416. return page;
  417. })();
  418. })(window.jQuery, window.lrmui);</script>
  419. <div class="lr-workspace-page">
  420. <div class="head">
  421. <div class="banner"></div>
  422. <!--<div class="news222">
  423. <span class="left"><img src="images/notification.png" alt=""></span>
  424. <span class="middle">年中全新升级,数字化智慧校园</span>
  425. <span class="right">更多</span>
  426. </div>-->
  427. </div>
  428. <div class="appbox">
  429. <div class="appitem" id="lr_more_app">
  430. <div style="background-color:#CCC"><i class="iconfont icon-cascades"></i></div>
  431. <span>更多</span>
  432. </div>
  433. </div>
  434. <div class="lr-desktop-msg" id="lr_desktop_msg">
  435. <div id="lr_desktop_msg_content" style="padding-top:10px;">
  436. </div>
  437. </div>
  438. </div>