選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

471 行
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. list(data.list || [], $desktop);
  196. }
  197. if (self) {
  198. self.refresh(true);
  199. self.endPulldownToRefresh();
  200. }
  201. }
  202. });
  203. }
  204. var page = {
  205. init: function ($page) {
  206. //主被动修改密码判断
  207. if (learun.storage.get('pwd') === true) {
  208. learun.nav.go({ path: 'my/modifypassword', isBack: false, isHead: true, title:'修改密码' });
  209. }
  210. var _html = '';
  211. // _html += '<div class="scanner">';
  212. // _html += '<i class="iconfont icon-scan"></i>';
  213. // _html += '</div>';
  214. _html += '\
  215. <div class="searchBox">\
  216. <i class="iconfont icon-search"></i>\
  217. <div class="search" >搜索应用</div>\
  218. </div>';
  219. _html += '<div class="message">';
  220. _html += '<i class="iconfont icon-mail"></i>';
  221. _html += '<span class="red"></span>';
  222. _html += '</div>';
  223. $page.parent().find('.f-page-header').addClass('lr-workspace-header').html(_html).css("paddingLeft", "14px");
  224. $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>')
  225. // 点击搜索框
  226. $page.parent().find('.searchBox').on('tap', function () {
  227. learun.nav.go({ path: 'workspace/search', title: '', isBack: true, isHead: true });
  228. });
  229. // 点击消息图标
  230. $page.parent().find('.message').on('tap', function () {
  231. learun.nav.go({ path: 'message', title: '消息', isBack: true, isHead: true, type: 'right' });
  232. });
  233. // 注册扫描
  234. $page.parent().find('.scanner').on('tap', function () {
  235. learun.code.scan(function (res) {
  236. if (res.status === 'success') {
  237. learun.layer.toast(res.msg);
  238. }
  239. else {
  240. learun.layer.toast('扫描失败:' + res.msg);
  241. }
  242. });
  243. });
  244. // 图片加载
  245. learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
  246. if (data) {
  247. var _list = [];
  248. $.each(data, function (_index, _item) {
  249. _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
  250. });
  251. $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
  252. }
  253. });
  254. // 基础数据初始化
  255. learun.clientdata.init();
  256. refreshDeskTop();
  257. $scroll = $page.find('#lr_desktop_msg').pullRefresh({
  258. down: {
  259. height: 30,
  260. contentinit: '下拉可以刷新',
  261. contentdown: '下拉可以刷新',
  262. contentover: '松开立即刷新',
  263. contentrefresh: '正在刷新...',
  264. callback: function () {
  265. refreshDeskTop(this);
  266. }
  267. }
  268. });
  269. // 加载功能列表
  270. learun.clientdata.get('module', {
  271. callback: function (data) {
  272. learun.myModule.get(data, function (myModules) {
  273. var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
  274. switch (mylen) {
  275. case 1:
  276. $page.find('.lr-workspace-page').css('padding-top', '210px');
  277. break;
  278. case 2:
  279. $page.find('.lr-workspace-page').css('padding-top', '290px');
  280. break;
  281. case 3:
  282. $page.find('.lr-workspace-page').css('padding-top', '370px');
  283. break;
  284. }
  285. var map = {};
  286. $.each(data, function (_index, _item) {
  287. map[_item.F_Id] = _item;
  288. });
  289. var $appbox = $page.find('.appbox');
  290. var $last = null;
  291. $.each(myModules, function (_index, _id) {
  292. var item = map[_id];
  293. if (item) {
  294. var Tips = ''; //审批 提示脚标
  295. if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
  296. var tipCount = 0;
  297. learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
  298. if (data) {
  299. tipCount = data.value.length;
  300. }
  301. });
  302. 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>';
  303. }
  304. var _html = '\
  305. <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
  306. <div style="position:relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
  307. <span>'+ item.F_Name + '</span>\
  308. </div>';
  309. var _$html = $(_html);
  310. _$html[0].item = item;
  311. if ($last === null) {
  312. $appbox.prepend(_$html);
  313. }
  314. else {
  315. $last.after(_$html);
  316. }
  317. $last = _$html;
  318. }
  319. });
  320. $last = null;
  321. });
  322. }
  323. });
  324. // 注册更多功能按钮
  325. $page.find('#lr_more_app').on('tap', function () {
  326. learun.nav.go({ path: 'workspace/modulelist', title: "", type: 'right' });
  327. });
  328. // 点击功能按钮
  329. $page.delegate('.appitem2', 'tap', function () {
  330. var $this = $(this);
  331. var item = $this[0].item;
  332. if (item.F_IsSystem === 1) {// 代码开发功能
  333. learun.nav.go({ path: item.F_Url, title: item.F_Name, isBack: true, isHead: true, type: 'right' });
  334. }
  335. else {// 自定义表单开发功能
  336. learun.nav.go({ path: 'custmerform', title: item.F_Name, param: { formSchemeId: item.F_FormId, girdScheme: item.F_Scheme }, isBack: true, isHead: true, type: 'right' });
  337. }
  338. return false;
  339. });
  340. },
  341. reload: function ($page, pageinfo) {
  342. if (learun.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
  343. learun.isOutLogin = false;
  344. refreshDeskTop();
  345. learun.clientdata.clear('module');
  346. learun.myModule.states = -1;
  347. // 图片加载
  348. learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
  349. if (data) {
  350. var _list = [];
  351. $.each(data, function (_index, _item) {
  352. _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
  353. });
  354. $page.find('.banner').after('<div style="margin-top:20px" class="banner"></div>').remove();
  355. $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
  356. }
  357. });
  358. }
  359. // 加载功能列表
  360. learun.clientdata.get('module', {
  361. callback: function (data) {
  362. learun.myModule.get(data, function (myModules) {
  363. var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
  364. switch (mylen) {
  365. case 1:
  366. $page.find('.lr-workspace-page').css('padding-top', '210px');
  367. break;
  368. case 2:
  369. $page.find('.lr-workspace-page').css('padding-top', '290px');
  370. break;
  371. case 3:
  372. $page.find('.lr-workspace-page').css('padding-top', '370px');
  373. break;
  374. }
  375. var map = {};
  376. $.each(data, function (_index, _item) {
  377. map[_item.F_Id] = _item;
  378. });
  379. var $appbox = $page.find('.appbox');
  380. var $last = null;
  381. $appbox.find(".appitem2").remove();
  382. $.each(myModules, function (_index, _id) {
  383. var item = map[_id];
  384. if (item) {
  385. var Tips = ''; //审批 提示脚标
  386. if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
  387. var tipCount = 0;
  388. learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
  389. if (data) {
  390. tipCount = data.value.length;
  391. }
  392. });
  393. 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>';
  394. }
  395. var _html = '\
  396. <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
  397. <div style="position: relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
  398. <span>'+ item.F_Name + '</span>\
  399. </div>';
  400. var _$html = $(_html);
  401. _$html[0].item = item;
  402. if ($last === null) {
  403. $appbox.prepend(_$html);
  404. }
  405. else {
  406. $last.after(_$html);
  407. }
  408. $last = _$html;
  409. }
  410. });
  411. $last = null;
  412. });
  413. }
  414. });
  415. $.each(chartMap, function (id, obj) {
  416. obj.resize();
  417. });
  418. }
  419. };
  420. return page;
  421. })();
  422. })(window.jQuery, window.lrmui);</script>
  423. <div class="lr-workspace-page">
  424. <div class="head">
  425. <div class="banner"></div>
  426. <!--<div class="news222">
  427. <span class="left"><img src="images/notification.png" alt=""></span>
  428. <span class="middle">年中全新升级,数字化智慧校园</span>
  429. <span class="right">更多</span>
  430. </div>-->
  431. </div>
  432. <div class="appbox">
  433. <div class="appitem" id="lr_more_app">
  434. <div style="background-color:#CCC"><i class="iconfont icon-cascades"></i></div>
  435. <span>更多</span>
  436. </div>
  437. </div>
  438. <div class="lr-desktop-msg" id="lr_desktop_msg">
  439. <div id="lr_desktop_msg_content" style="padding-top:10px;">
  440. </div>
  441. </div>
  442. </div>