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.
 
 
 
 
 
 

219 lines
7.8 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2018.03.16
  6. * 描 述:功能模块
  7. */
  8. var keyValue = request('keyValue');
  9. var type = request('type');
  10. var acceptClick;
  11. var bootstrap = function ($, learun) {
  12. "use strict";
  13. var lrcomponts = [];
  14. var page = {
  15. init: function () {
  16. page.bind();
  17. page.initData();
  18. },
  19. /*绑定事件和初始化控件*/
  20. bind: function () {
  21. // 列表显示
  22. $('#listTitle').lrselect({
  23. type: 'multiple'
  24. });
  25. $('#listContent1').lrselect({ maxHeight: 160 });
  26. $('#listContent2').lrselect({ maxHeight: 160 });
  27. $('#listContent3').lrselect({ maxHeight: 160 });
  28. // 选择图标
  29. $('#selectIcon').on('click', function () {
  30. learun.layerForm({
  31. id: 'iconForm',
  32. title: '选择图标',
  33. url: top.$.rootUrl + '/Utility/AppIcon',
  34. height: 700,
  35. width: 1000,
  36. btn: null,
  37. maxmin: true,
  38. end: function () {
  39. if (top._learunSelectIcon != '') {
  40. $('#F_Icon').val(top._learunSelectIcon);
  41. }
  42. }
  43. });
  44. });
  45. // 分类
  46. $('#F_Type').lrDataItemSelect({ code: 'function' });
  47. $('#F_Type').lrselectSet(type);
  48. // 选在表单
  49. $('#F_FormId').lrselect({
  50. text: 'F_Name',
  51. value: 'F_Id',
  52. url: top.$.rootUrl + '/LR_FormModule/Custmerform/GetSchemeInfoList',
  53. maxHeight: 180,
  54. allowSearch: true,
  55. select: function (item) {
  56. if (item) {
  57. lrcomponts = [];
  58. $.lrSetForm(top.$.rootUrl + '/LR_FormModule/Custmerform/GetFormData?keyValue=' + item.F_Id, function (data) {
  59. var scheme = JSON.parse(data.schemeEntity.F_Scheme);
  60. for (var i = 0, l = scheme.data.length; i < l; i++) {
  61. var componts = scheme.data[i].componts;
  62. for (var j = 0, jl = componts.length; j < jl; j++) {
  63. var compont = componts[j];
  64. if (compont.type == 'gridtable') {
  65. }
  66. else {
  67. var point = { text: compont.title, id: compont.id };
  68. lrcomponts.push(point);
  69. }
  70. }
  71. }
  72. $('#listTitle').lrselectRefresh({
  73. data: lrcomponts
  74. });
  75. $('#listContent1').lrselectRefresh({
  76. data: lrcomponts
  77. });
  78. $('#listContent2').lrselectRefresh({
  79. data: lrcomponts
  80. });
  81. $('#listContent3').lrselectRefresh({
  82. data: lrcomponts
  83. });
  84. });
  85. } else {
  86. lrcomponts = [];
  87. $('#listTitle').lrselectRefresh({
  88. data: lrcomponts
  89. });
  90. $('#listContent1').lrselectRefresh({
  91. data: lrcomponts
  92. });
  93. $('#listContent2').lrselectRefresh({
  94. data: lrcomponts
  95. });
  96. $('#listContent3').lrselectRefresh({
  97. data: lrcomponts
  98. });
  99. }
  100. }
  101. });
  102. $('#lr_preview').on('click', function () {
  103. var formId = $('#F_FormId').lrselectGet();
  104. if (!!formId) {
  105. learun.layerForm({
  106. id: 'custmerForm_PreviewForm',
  107. title: '预览当前表单',
  108. url: top.$.rootUrl + '/LR_FormModule/Custmerform/PreviewForm?schemeInfoId=' + formId,
  109. width: 800,
  110. height: 600,
  111. maxmin: true,
  112. btn: null
  113. });
  114. }
  115. else {
  116. learun.alert.warning('请选择表单!');
  117. }
  118. });
  119. // 功能类型
  120. $('[name="F_IsSystem"]').on('click', function () {
  121. var value = $(this).val();
  122. if (value == 1) {
  123. $('.system').show();
  124. $('.nosystem').hide();
  125. } else {
  126. $('.system').hide();
  127. $('.nosystem').show();
  128. }
  129. });
  130. },
  131. /*初始化数据*/
  132. initData: function () {
  133. if (!!keyValue) {
  134. $.lrSetForm(top.$.rootUrl + '/AppManager/FunctionManager/GetForm?keyValue=' + keyValue, function (data) {//
  135. $('#form').lrSetFormData(data.entity);
  136. if (data.entity.F_IsSystem != 1 && data.schemeEntity) {
  137. var scheme = JSON.parse(data.schemeEntity.F_Scheme);
  138. $('#listTitle').lrselectSet(scheme.title);
  139. $('#listContent1').lrselectSet(scheme.content[0]);
  140. $('#listContent2').lrselectSet(scheme.content[1]);
  141. $('#listContent3').lrselectSet(scheme.content[2]);
  142. }
  143. });
  144. }
  145. }
  146. };
  147. // 保存数据
  148. acceptClick = function (callBack) {
  149. if (!$('#form').lrValidform()) {
  150. return false;
  151. }
  152. var formData = $('#form').lrGetFormData(keyValue);
  153. formData.F_IsSystem = $('[name="F_IsSystem"]:checked').val();
  154. var entity = {
  155. F_Name: formData.F_Name,
  156. F_Icon: formData.F_Icon,
  157. F_Type: formData.F_Type,
  158. F_SortCode: formData.F_SortCode,
  159. F_FormId: formData.F_FormId,
  160. F_SchemeId: formData.F_SchemeId,
  161. F_Url: formData.F_Url,
  162. F_IsSystem: formData.F_IsSystem,
  163. };
  164. if (formData.F_IsSystem == 1) {
  165. if ($.trim(formData.F_Url || '') == '') {
  166. learun.alert.error('请填写功能地址!');
  167. return false;
  168. }
  169. }
  170. else {
  171. if ($.trim(formData.listTitle || '') == '') {
  172. learun.alert.error('请设置列表展示!');
  173. return false;
  174. }
  175. }
  176. var scheme = {
  177. title: formData.listTitle,
  178. content:['','','']
  179. };
  180. scheme.content[0] = formData.listContent1;
  181. scheme.content[1] = formData.listContent2;
  182. scheme.content[2] = formData.listContent3;
  183. var schemeEntity = {
  184. F_Scheme: JSON.stringify(scheme)
  185. }
  186. // 提交数据
  187. var postData = {
  188. strEntity: JSON.stringify(entity),
  189. strSchemeEntity: JSON.stringify(schemeEntity)
  190. };
  191. $.lrSaveForm(top.$.rootUrl + '/AppManager/FunctionManager/SaveForm?keyValue=' + keyValue, postData, function (res) {
  192. // 保存成功后才回调
  193. if (!!callBack) {
  194. callBack();
  195. }
  196. });
  197. };
  198. page.init();
  199. }