|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- <script type="text/javascript">
- (function ($, learun) {
- learun.nav.data["workspace"].jsObj = (function () {
-
- var custmerform = {};
- var $scroll = '';
-
- // 统计数据
- function target(data, $desktop) {
- if (data.length > 0) {
- var _html = '\
- <div class="lr-black-panel">\
- <div class="lr-title">统计数据</div>\
- <div class="lr-content lr-flex-content">\
- </div>\
- </div>';
- $desktop.append(_html);
- var $content = $desktop.find('.lr-flex-content');
- $.each(data, function (_index, _item) {
- var _itemHtml = '\
- <div class="targetItem">\
- <div class="name">'+ _item.F_Name + '</div>\
- <div class="number" data-number="'+ _item.F_Id + '" ></div>\
- </div>';
- $content.append(_itemHtml);
- // 获取后台数据
- learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'Target', id: _item.F_Id }, function (data) {
- if (data) {
- $('[data-number="' + data.Id + '"]').text(data.value);
- }
- });
-
- });
-
- }
- }
- // 列表数据
- function list(data, $desktop) {
- if (data.length > 0) {
- $.each(data, function (_index, _item) {
- var _html = '\
- <div class="lr-black-panel">\
- <div class="lr-title">'+ _item.F_Name + '</div>\
- <div class="lr-content" data-desktop="'+ _item.F_Id + '" ></div>\
- </div>';
- $desktop.append(_html);
-
- learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'list', id: _item.F_Id }, function (data) {
- if (data) {
- var $list = $('[data-desktop="' + data.Id + '"]');
- //待办
- if (_item.F_Name == '待办事项') {
- $list.prev().on('tap',
- function () {
- learun.nav.go({
- path: 'nworkflow/myflow',
- title: '待办事项',
- param: '',
- type: 'right'
- });
- });
- }
- else {
- $list.prev().on('tap',
- function () {
- learun.nav.go({
- path: 'LR_OAModule/Notice',
- title: '查看详情',
- param: (_item.F_Url.indexOf('=') != -1 ? _item.F_Url.substr(_item.F_Url.indexOf('=') + 1) : ''),
- type: 'right'
- });
- });
- }
- $.each(data.value, function (_j, _jitem) {
- var _itemHtml = '\
- <div class="lr-list-item lr-dtlist-item">\
- <div class="lr-ellipsis">'+ _jitem.f_title + '</div>\
- <div class="date">'+ learun.date.format(_jitem.f_time, 'yyyy-MM-dd') + '</div>\
- </div>';
- var _$itemHtml = $(_itemHtml);
- _$itemHtml[0].item = _jitem;
- $list.append(_$itemHtml);
- });
- $list.find('.lr-dtlist-item').on('tap', function () {
- var item = $(this)[0].item;
- if (item.f_processname == undefined || item.f_processname == null || item.f_processname == '')
- learun.nav.go({ path: 'workspace/listdetaile', title: '详情', param: item, type: 'right' });
- else
- learun.nav.go({ path: 'nworkflow/audit', title: item.f_processname, type: 'right', param: { processId: item.f_processid, taskId: item.f_id } });
- });
-
- $list = null;
- }
- });
- });
- }
- }
- var chartMap = {};
- // 图表数据
- function chart(data, $desktop) {
-
- if (data.length > 0) {
- chartMap = {};
- $.each(data, function (_index, _item) {
- var _html = '\
- <div class="lr-black-panel">\
- <div class="lr-title">'+ _item.F_Name + '</div>\
- <div class="lr-content lr-chart-content">\
- <div class="lr-chart-container" id="'+ _item.F_Id + '" data-desktop="' + _item.F_Type + '" ></div>\
- </div>\
- </div>';
-
- $desktop.append(_html);
- chartMap[_item.F_Id] = echarts.init(document.getElementById(_item.F_Id));
-
- // 获取后台数据
- learun.httpget(config.webapi + "learun/adms/desktop/data", { type: 'chart', id: _item.F_Id }, function (data) {
- if (data) {
- var type = $('#' + data.Id).attr('data-desktop');
- var legendData = [];
- var valueData = [];
- $.each(data.value, function (_index, _item) {
- legendData.push(_item.name);
- valueData.push(_item.value);
- });
-
- var option = {};
- switch (type) {
- case '0'://饼图
- option.tooltip = {
- trigger: 'item',
- formatter: "{a} <br/>{b}: {c} ({d}%)"
- };
-
- option.legend = {
- orient: 'vertical',
- left: 'left',
- data: legendData
- };
- option.series = [{
- name: '占比',
- type: 'pie',
- radius: ['50%', '70%'],
- avoidLabelOverlap: false,
- label: {
- normal: {
- show: false,
- position: 'center'
- },
- emphasis: {
- show: true,
- textStyle: {
- fontSize: '30',
- fontWeight: 'bold'
- }
- }
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- data: data.value
- }];
- option.color = ['#df4d4b', '#304552', '#52bbc8', 'rgb(224,134,105)', '#8dd5b4', '#5eb57d', '#d78d2f'];
- break;
- case '1'://折线图
- case '2'://柱状图
- option = {
- grid: {
- top: '20px',
- bottom: '10px',
- left: '15px',
- right: '15px',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- data: legendData
- },
- yAxis: {
- type: 'value'
- },
- series: [{
- data: valueData,
- type: type === '1' ? 'line' : 'bar'
- }]
- };
- break;
- }
- chartMap[data.Id].setOption(option);
- }
- });
- });
- }
- }
-
- function refreshDeskTop(self) {
- learun.clientdata.get('desktop', {
- callback: function (data) {
- var $desktop = $('#lr_desktop_msg_content');
- $desktop.html('');
- var logininfo = learun.storage.get('userinfo');
- if (logininfo.baseinfo.Description != "学生") {
- //target(data.target || [], $desktop);
- //chart(data.chart || [], $desktop);
- list(data.list || [], $desktop);
- }
-
- if (self) {
- self.refresh(true);
- self.endPulldownToRefresh();
- }
- }
- });
- }
-
- var page = {
- init: function ($page) {
- //主被动修改密码判断
- if (learun.storage.get('pwd') === true) {
- learun.nav.go({ path: 'my/modifypassword', isBack: false, isHead: true, title:'修改密码' });
- }
- var _html = '';
- // _html += '<div class="scanner">';
- // _html += '<i class="iconfont icon-scan"></i>';
- // _html += '</div>';
-
- _html += '\
- <div class="searchBox">\
- <i class="iconfont icon-search"></i>\
- <div class="search" >搜索应用</div>\
- </div>';
-
-
- _html += '<div class="message">';
- _html += '<i class="iconfont icon-mail"></i>';
- _html += '<span class="red"></span>';
- _html += '</div>';
-
- $page.parent().find('.f-page-header').addClass('lr-workspace-header').html(_html).css("paddingLeft", "14px");
- $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>')
- // 点击搜索框
- $page.parent().find('.searchBox').on('tap', function () {
- learun.nav.go({ path: 'workspace/search', title: '', isBack: true, isHead: true });
- });
- // 点击消息图标
- $page.parent().find('.message').on('tap', function () {
- learun.nav.go({ path: 'message', title: '消息', isBack: true, isHead: true, type: 'right' });
- });
- // 注册扫描
- $page.parent().find('.scanner').on('tap', function () {
- learun.code.scan(function (res) {
- if (res.status === 'success') {
- learun.layer.toast(res.msg);
- }
- else {
- learun.layer.toast('扫描失败:' + res.msg);
- }
- });
- });
- // 图片加载
- learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
- if (data) {
- var _list = [];
- $.each(data, function (_index, _item) {
- _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
- });
- $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
- }
- });
-
- // 基础数据初始化
- learun.clientdata.init();
- refreshDeskTop();
-
- $scroll = $page.find('#lr_desktop_msg').pullRefresh({
- down: {
- height: 30,
- contentinit: '下拉可以刷新',
- contentdown: '下拉可以刷新',
- contentover: '松开立即刷新',
- contentrefresh: '正在刷新...',
- callback: function () {
- refreshDeskTop(this);
- }
- }
- });
-
- // 加载功能列表
- learun.clientdata.get('module', {
- callback: function (data) {
- learun.myModule.get(data, function (myModules) {
- var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
- switch (mylen) {
- case 1:
- $page.find('.lr-workspace-page').css('padding-top', '210px');
- break;
- case 2:
- $page.find('.lr-workspace-page').css('padding-top', '290px');
- break;
- case 3:
- $page.find('.lr-workspace-page').css('padding-top', '370px');
- break;
- }
-
- var map = {};
- $.each(data, function (_index, _item) {
- map[_item.F_Id] = _item;
- });
- var $appbox = $page.find('.appbox');
- var $last = null;
-
- $.each(myModules, function (_index, _id) {
- var item = map[_id];
- if (item) {
-
- var Tips = ''; //审批 提示脚标
- if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
- var tipCount = 0;
- learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
- if (data) {
- tipCount = data.value.length;
- }
- });
- 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>';
- }
- var _html = '\
- <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
- <div style="position:relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
- <span>'+ item.F_Name + '</span>\
- </div>';
- var _$html = $(_html);
- _$html[0].item = item;
- if ($last === null) {
- $appbox.prepend(_$html);
- }
- else {
- $last.after(_$html);
- }
- $last = _$html;
-
- }
- });
- $last = null;
- });
- }
- });
- // 注册更多功能按钮
- $page.find('#lr_more_app').on('tap', function () {
- learun.nav.go({ path: 'workspace/modulelist', title: "", type: 'right' });
- });
- // 点击功能按钮
- $page.delegate('.appitem2', 'tap', function () {
- var $this = $(this);
- var item = $this[0].item;
- if (item.F_IsSystem === 1) {// 代码开发功能
- learun.nav.go({ path: item.F_Url, title: item.F_Name, isBack: true, isHead: true, type: 'right' });
- }
- else {// 自定义表单开发功能
-
- learun.nav.go({ path: 'custmerform', title: item.F_Name, param: { formSchemeId: item.F_FormId, girdScheme: item.F_Scheme }, isBack: true, isHead: true, type: 'right' });
- }
- return false;
- });
- },
- reload: function ($page, pageinfo) {
- if (learun.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
- learun.isOutLogin = false;
- refreshDeskTop();
- learun.clientdata.clear('module');
- learun.myModule.states = -1;
- // 图片加载
- learun.httpget(config.webapi + "learun/adms/desktop/imgid", null, function (data) {
- if (data) {
- var _list = [];
- $.each(data, function (_index, _item) {
- _list.push(config.webapi + "learun/adms/desktop/img?data=" + _item);
- });
- $page.find('.banner').after('<div style="margin-top:20px" class="banner"></div>').remove();
- $page.find('.banner').slider({ data: _list, indicator: true, interval: 10000 });
- }
- });
- }
- // 加载功能列表
- learun.clientdata.get('module', {
- callback: function (data) {
- learun.myModule.get(data, function (myModules) {
- var mylen = parseInt((myModules.length + 1) / 4) + ((myModules.length + 1) % 4 > 0 ? 1 : 0);
- switch (mylen) {
- case 1:
- $page.find('.lr-workspace-page').css('padding-top', '210px');
- break;
- case 2:
- $page.find('.lr-workspace-page').css('padding-top', '290px');
- break;
- case 3:
- $page.find('.lr-workspace-page').css('padding-top', '370px');
- break;
- }
-
- var map = {};
- $.each(data, function (_index, _item) {
- map[_item.F_Id] = _item;
- });
- var $appbox = $page.find('.appbox');
- var $last = null;
- $appbox.find(".appitem2").remove();
- $.each(myModules, function (_index, _id) {
- var item = map[_id];
- if (item) {
-
- var Tips = ''; //审批 提示脚标
- if (item.F_Id == '49b3860f-a2ec-4677-b863-fb611604c477') {
- var tipCount = 0;
- learun.httpgetnosy(config.webapi + "learun/adms/desktop/data", { type: 'list', id: '33d50f1a-a64d-4b86-a6d4-2d937226de95' }, function (data) {
- if (data) {
- tipCount = data.value.length;
- }
- });
- 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>';
- }
- var _html = '\
- <div class="appitem appitem2" data-value="'+ item.F_Id + '">\
- <div style="position: relative;">'+ Tips + '<i class="' + item.F_Icon + '"></i></div>\
- <span>'+ item.F_Name + '</span>\
- </div>';
- var _$html = $(_html);
- _$html[0].item = item;
- if ($last === null) {
- $appbox.prepend(_$html);
- }
- else {
- $last.after(_$html);
- }
- $last = _$html;
-
- }
- });
- $last = null;
- });
- }
- });
- $.each(chartMap, function (id, obj) {
- obj.resize();
- });
- }
- };
- return page;
- })();
- })(window.jQuery, window.lrmui);</script>
- <div class="lr-workspace-page">
- <div class="head">
- <div class="banner"></div>
- <!--<div class="news222">
- <span class="left"><img src="images/notification.png" alt=""></span>
- <span class="middle">年中全新升级,数字化智慧校园</span>
- <span class="right">更多</span>
- </div>-->
- </div>
- <div class="appbox">
- <div class="appitem" id="lr_more_app">
- <div style="background-color:#CCC"><i class="iconfont icon-cascades"></i></div>
- <span>更多</span>
- </div>
- </div>
- <div class="lr-desktop-msg" id="lr_desktop_msg">
- <div id="lr_desktop_msg_content" style="padding-top:10px;">
- </div>
- </div>
- </div>
|