ReportGuide.cshtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. @{
  2. ViewBag.Title = "报表开发";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <!--表格组件end-->
  6. <script>
  7. var keyValue = request('keyValue');
  8. $(function () {
  9. initControl();
  10. //加载导向
  11. $('#wizard').wizard().on('change', function (e, data) {
  12. var $finish = $("#btn_finish");
  13. var $next = $("#btn_next");
  14. if (data.direction == "next") {
  15. switch (data.step) {
  16. case 1:
  17. if (!$('#tempform').Validform()) {
  18. return false;
  19. }
  20. break;
  21. case 2:
  22. if (!$('#tempGraphform').Validform()) {
  23. return false;
  24. }
  25. break;
  26. case 3:
  27. if (!$('#tempListform').Validform()) {
  28. return false;
  29. }
  30. $finish.removeAttr('disabled');
  31. $next.attr('disabled', 'disabled');
  32. break;
  33. default:
  34. break;
  35. }
  36. } else {
  37. $finish.attr('disabled', 'disabled');
  38. $next.removeAttr('disabled');
  39. }
  40. });
  41. //完成,保存事件
  42. $("#btn_finish").click(function () {
  43. var tempJson = $("#tempbody").GetWebControls();
  44. tempJson["Description"] = $("#TempDescription").val();
  45. $.SaveForm({
  46. url: "../../ReportManage/Report/SaveForm?keyValue=" + keyValue,
  47. param: { tempJson: JSON.stringify(tempJson), __RequestVerificationToken: tempJson["__RequestVerificationToken"] },
  48. loading: "正在保存数据...",
  49. success: function () {
  50. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  51. }
  52. })
  53. })
  54. //发布报表事件
  55. $("#publish_btn").click(function () {
  56. $("#publish_panel").animate({ top: 50, speed: 2000 });
  57. return false;
  58. });
  59. });
  60. //初始化控件
  61. function initControl() {
  62. //报表类别
  63. $("#TempCategory").ComboBoxTree({
  64. param: { EnCode: "ReportSort" },
  65. url: "../../SystemManage/DataItemDetail/GetDataItemTreeJson",
  66. description: "==请选择==",
  67. height: "230px"
  68. });
  69. //图表类型
  70. $("#TempType").ComboBox({
  71. description: "==请选择==",
  72. height: "200px"
  73. }).bind("change", function () {
  74. type = $(this).attr('data-value');
  75. SetRemark();
  76. });
  77. //模块目标
  78. $("#Target").ComboBox({
  79. description: "==请选择==",
  80. height: "200px"
  81. });
  82. //模块上级
  83. $("#ParentId").ComboBoxTree({
  84. url: "../../AuthorizeManage/Module/GetCatalogTreeJson",
  85. description: "==请选择==",
  86. height: "195px",
  87. allowSearch: true
  88. });
  89. //获取表单
  90. if (!!keyValue) {
  91. $.SetForm({
  92. url: "../../ReportManage/Report/GetFormJson",
  93. param: { keyValue: keyValue },
  94. success: function (data) {
  95. $("#tempbody").SetWebControls(data);
  96. $("#TempDescription").val(data.Description);
  97. var paramjson = JSON.parse(data.ParamJson);
  98. $("#title").val(paramjson.title)
  99. $("#sqlString").val(paramjson.sqlString);
  100. $("#listSqlString").val(paramjson.listSqlString);
  101. $("#ParentId").ComboBoxSetValue(paramjson.ParentId);
  102. $("#Icon").val(paramjson.Icon);
  103. $("#Description").val(paramjson.Description);
  104. type = data.TempType;
  105. SetRemark();
  106. }
  107. });
  108. }
  109. }
  110. function SetRemark() {
  111. var remark = "";
  112. switch (type) {
  113. case 'line':
  114. remark = " <i class='fa fa-question-circle alert-dismissible' style='position: relative; top: 1px; font-size: 15px; padding-right: 5px;'></i>注:折线图的SQL语句至少需要两个字段,name代表项目名称;value代表图例上的值;group代表组。如:select 月份 as name , sum(金额) as value,产品 as group from 订单表 group by 月份,产品"
  115. break;
  116. case 'bar':
  117. remark = " <i class='fa fa-question-circle alert-dismissible' style='position: relative; top: 1px; font-size: 15px; padding-right: 5px;'></i>注:柱型图的SQL语句至少需要两个字段,name代表项目名称;value代表图例上的值;group代表组。如:select 月份 as name , sum(金额) as value,产品 as group from 订单表 group by 月份,产品"
  118. break;
  119. case 'pie':
  120. remark = " <i class='fa fa-question-circle alert-dismissible' style='position: relative; top: 1px; font-size: 15px; padding-right: 5px;'></i>注:饼图的SQL语句至少需要两个字段,name代表项目名称;value代表图例上的值;group代表组。如:select 产品 as name , sum(金额) as value from 订单表 group by 产品"
  121. break;
  122. case 'map':
  123. remark = " <i class='fa fa-question-circle alert-dismissible' style='position: relative; top: 1px; font-size: 15px; padding-right: 5px;'></i>注:地图的SQL语句至少需要两个字段,name代表城市名称;value代表值;group代表组。如:select 城市 as name , sum(金额) as value,产品 as group from 订单表 group by 城市,产品"
  124. break;
  125. default:
  126. }
  127. $("#div_remark").html(remark);
  128. }
  129. function SelectIcon() {
  130. dialogOpen({
  131. id: "SelectIcon",
  132. title: '选取图标',
  133. url: '/AuthorizeManage/Module/Icon?ControlId=Icon',
  134. width: "1000px",
  135. height: "600px",
  136. btn: false
  137. })
  138. }
  139. </script>
  140. <div class="widget-body" id="tempbody">
  141. <div id="wizard" class="wizard" data-target="#wizard-steps" style="border-left: none; border-top: none; border-right: none;">
  142. <ul class="steps">
  143. <li data-target="#step-1" class="active"><span class="step">1</span>基础设置<span class="chevron"></span></li>
  144. <li data-target="#step-2"><span class="step">2</span>图表设置<span class="chevron"></span></li>
  145. <li data-target="#step-3"><span class="step">3</span>列表设置<span class="chevron"></span></li>
  146. <li data-target="#step-4"><span class="step">4</span>自动创建<span class="chevron"></span></li>
  147. </ul>
  148. </div>
  149. <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
  150. <div class="step-pane active" id="step-1" style="margin-left: 0px; margin-top: 15px; margin-right: 30px;">
  151. <table id="tempform" class="form">
  152. <tr>
  153. <th class="formTitle">报表编号<font face="宋体">*</font></th>
  154. <td class="formValue">
  155. <input id="EnCode" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
  156. </td>
  157. </tr>
  158. <tr>
  159. <th class="formTitle">报表名称<font face="宋体">*</font></th>
  160. <td class="formValue">
  161. <input id="FullName" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" />
  162. </td>
  163. </tr>
  164. <tr>
  165. <th class="formTitle">图表类型<font face="宋体">*</font></th>
  166. <td class="formValue">
  167. <div id="TempType" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull">
  168. <ul>
  169. <li data-value="line">折线图</li>
  170. <li data-value="bar">柱形图</li>
  171. <li data-value="pie">饼图</li>
  172. <li data-value="map">地图</li>
  173. </ul>
  174. </div>
  175. </td>
  176. </tr>
  177. <tr>
  178. <th class="formTitle">报表分类<font face="宋体">*</font></th>
  179. <td class="formValue">
  180. <div id="TempCategory" type="selectTree" class="ui-select" isvalid="yes" checkexpession="NotNull"></div>
  181. </td>
  182. </tr>
  183. <tr>
  184. <th class="formTitle" valign="top" style="padding-top: 4px;">报表介绍</th>
  185. <td class="formValue">
  186. <textarea id="TempDescription" class="form-control" style="height: 70px;"></textarea>
  187. </td>
  188. </tr>
  189. </table>
  190. </div>
  191. <div class="step-pane" id="step-2">
  192. <div id="div_remark" class="alert alert-danger" style="text-align: left; margin: 5px; margin-bottom: 10px;"></div>
  193. <div style="margin-top: 15px; margin-right: 30px;">
  194. <table id="tempGraphform" class="form">
  195. <tr>
  196. <th class="formTitle">报表标题</th>
  197. <td class="formValue">
  198. <input id="title" type="text" class="form-control" />
  199. </td>
  200. </tr>
  201. <tr>
  202. <th class="formTitle" valign="top" style="padding-top: 4px;">SQL语句</th>
  203. <td class="formValue">
  204. <textarea id="sqlString" class="form-control" style="height: 210px;"></textarea>
  205. </td>
  206. </tr>
  207. </table>
  208. </div>
  209. </div>
  210. <div class="step-pane" id="step-3" style="margin-top: 15px; margin-right: 30px;">
  211. <table id="tempListform" class="form">
  212. <tr>
  213. <th class="formTitle">列表说明</th>
  214. <td class="formValue">
  215. <input id="desc" type="text" class="form-control" />
  216. </td>
  217. </tr>
  218. <tr>
  219. <th class="formTitle" valign="top" style="padding-top: 4px;">SQL语句</th>
  220. <td class="formValue">
  221. <textarea id="listSqlString" class="form-control" style="height: 210px;"></textarea>
  222. </td>
  223. </tr>
  224. </table>
  225. </div>
  226. <div class="step-pane" id="step-4" style="margin-top: 15px; margin-right: 30px;">
  227. <div style="height: 400px;">
  228. <div class="drag-tip" style="text-align: center; padding-top: 50px;">
  229. <i class="fa fa-check-circle" style="font-size: 204px; color: #0FA74F;"></i>
  230. <div id="finish-msg" style="font-weight: bold; font-size: 24px; color: #0FA74F; margin-top: 20px;">
  231. </div>
  232. <p style="color: #666; font-size: 12px; margin-top: 10px;">
  233. <a href="#" id="publish_btn">发布报表</a>
  234. </p>
  235. </div>
  236. <div id="publish_panel" style="position: absolute; height: 350px; top: 560px; z-index: 100; background: #ffffff; margin-top: 15px; margin-right: 30px;">
  237. <table class="form">
  238. <tr>
  239. <th class="formTitle">上级</th>
  240. <td class="formValue">
  241. <div id="ParentId" type="selectTree" class="ui-select">
  242. </div>
  243. </td>
  244. <th class="formTitle">图标</th>
  245. <td class="formValue">
  246. <input id="Icon" type="text" class="form-control" />
  247. <span class="input-button" onclick="SelectIcon()" title="选取图标">...</span>
  248. </td>
  249. </tr>
  250. <tr>
  251. <th class="formTitle" valign="top" style="padding-top: 4px;">描述
  252. </th>
  253. <td class="formValue" colspan="3">
  254. <textarea id="Description" class="form-control" style="height: 70px;"></textarea>
  255. </td>
  256. </tr>
  257. </table>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. </div>
  263. <div class="form-button" id="wizard-actions">
  264. <a id="btn_last" disabled class="btn btn-default btn-prev">上一步</a>
  265. <a id="btn_next" class="btn btn-default btn-next">下一步</a>
  266. <a id="btn_finish" disabled class="btn btn-success">完成</a>
  267. </div>
  268. <style>
  269. body {
  270. overflow: hidden;
  271. }
  272. </style>