(function () { var page = { isScroll: true, init: function ($page) { var _html = '\ '; $page.parent().find('.f-page-header').addClass('lr-modulelist-header').append(_html).find('.f-page-title').remove(); // 点击搜索框 $page.parent().find('.searchBox').on('tap', function () { renlian.nav.go({ path: 'workspace/search', title: '', isBack: true, isHead: true }); }); renlian.clientdata.get('module', { callback: function (data) { var map = {}; var TypeMap = {}; $.each(data, function (_index, _item) { map[_item.F_Id] = _item; TypeMap[_item.F_Type] = TypeMap[_item.F_Type] || []; TypeMap[_item.F_Type].push(_item); }); // 加载我的应用 renlian.myModule.get(data, function (myModules) { var $appbox = $page.find('#lr_modulelist_mymodule'); $.each(myModules, function (_index, _id) { var item = map[_id]; if (item) { var _html = '\
\
\ '+ item.F_Name + '\
'; var _$html = $(_html); _$html[0].item = item; $appbox.append(_$html); } }); }); // 加载全部应用 var $app = $page.find('.lr-modulelist-page'); $.each(TypeMap, function (_type, _modules) { var _html = '\
\
\
\
'; $app.append(_html); var $content = $app.find('[data-app="' + _type + '"] .content'); renlian.clientdata.get('dataItem', { code: 'function', key: _type, callback: function (data, op) { $app.find('[data-app="' + op.key + '"] .title').text(data.text); } }); $.each(_modules, function (_index, _item) { var __html = '\
\
\ '+ _item.F_Name + '\
'; var __$html = $(__html); __$html[0].item = _item; $content.append(__$html); }); }); } }); // 注册编辑我的应用 $page.find('#lr_edit_myapp').on('tap', function () { renlian.nav.go({ path: 'workspace/modulelist/edit', title: "我的应用编辑" }); }); // 点击功能按钮 $page.delegate('.appitem', 'tap', function () { var $this = $(this); var item = $this[0].item; if (item.F_IsSystem === 1) {// 代码开发功能 renlian.nav.go({ path: item.F_Url, title: item.F_Name, isBack: true, isHead: true, type: 'right' }); } else {// 自定义表单开发功能 renlian.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) { renlian.clientdata.get('module', { callback: function (data) { var map = {}; $.each(data, function (_index, _item) { map[_item.F_Id] = _item; }); // 加载我的应用 renlian.myModule.get(data, function (myModules) { var $appbox = $page.find('#lr_modulelist_mymodule'); $appbox.html(""); $.each(myModules, function (_index, _id) { var item = map[_id]; if (item) { var _html = '\
\
\ '+ item.F_Name + '\
'; var _$html = $(_html); _$html[0].item = item; $appbox.append(_$html); } }); }); } }); } }; return page; })();