ReportExport.cshtml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. @using Bowin.Web.Controls.Mvc;
  2. @using EMIS.Entities;
  3. @using EMIS.Web.Controls;
  4. @{
  5. ViewBag.Title = "ReportExport";
  6. }
  7. <link href="~/Content/Bowin.Control.Core/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
  8. <link href="~/Content/Bowin.Control.Core/themes/default/easyui.css" rel="stylesheet" type="text/css" />
  9. <link href="~/Content/Bowin.Control.Core/themes/icon.css" rel="stylesheet" type="text/css" />
  10. <script src="../../Scripts/jquery-ui.min.js" type="text/javascript"></script>
  11. <script src="~/Scripts/jquery.min.js" type="text/javascript"></script>
  12. <script src="~/Scripts/Bowin.Control.Core/Plugins/EasyUI/jquery.easyui.min.js" type="text/javascript"></script>
  13. <style type="text/css">
  14. .drag{
  15. padding:4px;
  16. margin:2px;
  17. border:1px solid #ccc;
  18. background:#AACCFF;
  19. }
  20. .dp{
  21. opacity:0.5;
  22. filter:alpha(opacity=50);
  23. }
  24. .over{
  25. background:#FBEC88;
  26. }
  27. .indicator{
  28. position:absolute;
  29. font-size:9px;
  30. width:10px;
  31. height:10px;
  32. display:none;
  33. color:red;
  34. }
  35. .drag-item{
  36. padding:4px;
  37. margin:2px;
  38. border:1px solid #ccc;
  39. background:#AACCFF;
  40. }
  41. input[type=button]
  42. {
  43. background-color:#f0f0f0;
  44. }
  45. </style>
  46. @section scripts{
  47. <script type="text/javascript">
  48. var windowID = "";
  49. var fileUrl = "";
  50. $(function () {
  51. windowID = $.SystemGeneral.getUrlParam("WindowID");
  52. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='StudentColumnName']");
  53. if (customerUrl.attr("value")) {
  54. fileUrl = "../.." + customerUrl.attr("value");
  55. } else {
  56. fileUrl = "../../Config/ConfigTemplateFile/StudentColumnName.json";
  57. }
  58. setLeftDiv();
  59. });
  60. function setdraggableanddroppable() {
  61. $('.drag').draggable({
  62. proxy: 'clone',
  63. revert: true,
  64. cursor: 'auto',
  65. onStartDrag: function () {
  66. $(this).draggable('options').cursor = 'not-allowed';
  67. $(this).draggable('proxy').addClass('dp');
  68. },
  69. onStopDrag: function () {
  70. $(this).draggable('options').cursor = 'auto';
  71. }
  72. });
  73. $('#target').droppable({
  74. deltaX: 0,
  75. deltaY: 0,
  76. onDragEnter: function (e, source) {
  77. $(source).draggable('options').cursor = 'auto';
  78. $(source).draggable('proxy').css('border', '1px solid red');
  79. $(this).addClass('over');
  80. },
  81. onDragLeave: function (e, source) {
  82. $(source).draggable('options').cursor = 'not-allowed';
  83. $(source).draggable('proxy').css('border', '1px solid #ccc');
  84. $(this).removeClass('over');
  85. },
  86. onDrop: function (e, source) {
  87. source.className = "drag";
  88. var x = event.clientX;
  89. var y = event.clientY;
  90. var lis = $("#target").find("div");
  91. if (lis.length > 0) {
  92. var number = 0;
  93. $.each(lis, function (index, item) {
  94. var divtop = lis.eq(index).position().top;
  95. //var thistop = lis.eq(index).offset().top;
  96. var scrollTop = $(this).parent().scrollTop();
  97. var targettop = $(this).parent().position().top;
  98. var divheight = $(this).height();
  99. if (source.id == item.id) {
  100. return true;
  101. }
  102. if (divtop + scrollTop - targettop + divheight - (y - targettop + scrollTop) >= 0) {
  103. number = index + 1;
  104. return false;
  105. }
  106. });
  107. if (number == 0) {
  108. $(this).append(source);
  109. } else {
  110. var nametext = lis.eq(number - 1).attr("name");
  111. $("[name='" + nametext + "']").before(source);
  112. //$(lis.eq(2)).append(source);
  113. }
  114. }
  115. else {
  116. $(this).append(source);
  117. }
  118. $(this).removeClass('over');
  119. }
  120. });
  121. $('#source').droppable({
  122. //accept: '#d1,#d3',
  123. onDragEnter: function (e, source) {
  124. $(source).draggable('options').cursor = 'auto';
  125. $(source).draggable('proxy').css('border', '1px solid red');
  126. $(this).addClass('over');
  127. },
  128. onDragLeave: function (e, source) {
  129. $(source).draggable('options').cursor = 'not-allowed';
  130. $(source).draggable('proxy').css('border', '1px solid #ccc');
  131. $(this).removeClass('over');
  132. },
  133. onDrop: function (e, source) {
  134. $(this).append(source);
  135. $(this).removeClass('over');
  136. }
  137. });
  138. };
  139. //查询LeftDiv
  140. function setLeftDiv() {
  141. $.getJSON(fileUrl, function (result) {
  142. $.each(result.all, function (i, field) {
  143. var colList = eval(field);
  144. for (var key in colList) {
  145. var str = '<div id="' + i + '" class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  146. $('#source').append(str);
  147. }
  148. });
  149. setdraggableanddroppable();
  150. });
  151. };
  152. //全部
  153. function getAll() {
  154. $('#target').find('div').remove();
  155. $.getJSON(fileUrl, function (result) {
  156. $.each(result.all, function (i, field) {
  157. var colList = eval(field);
  158. for (var key in colList) {
  159. var str = '<div id="' + i + '"class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  160. $('#source #' + i).remove();
  161. $('#target').append(str);
  162. }
  163. });
  164. setdraggableanddroppable();
  165. });
  166. };
  167. //新生学籍电子注册上报
  168. function getNewStudentReport() {
  169. $('#target').find('div').remove();
  170. $('#source').find('div').remove();
  171. setLeftDiv();
  172. $.getJSON(fileUrl, function (result) {
  173. $.each(result.stu_newStudentReport, function (i, field) {
  174. var colList = eval(field);
  175. for (var key in colList) {
  176. var str = '<div id="' + i + '"class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  177. $('#source #' + i).remove();
  178. $('#target').append(str);
  179. }
  180. });
  181. setdraggableanddroppable();
  182. });
  183. };
  184. //在校生数据批量修改上报
  185. function getInSchoolEditReport() {
  186. $('#target').find('div').remove();
  187. $('#source').find('div').remove();
  188. setLeftDiv();
  189. $.getJSON(fileUrl, function (result) {
  190. $.each(result.stu_inSchoolEditReport, function (i, field) {
  191. var colList = eval(field);
  192. for (var key in colList) {
  193. var str = '<div id="' + i + '"class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  194. $('#source #' + i).remove();
  195. $('#target').append(str);
  196. }
  197. });
  198. setdraggableanddroppable();
  199. });
  200. };
  201. //在校生学年电子注册上报
  202. function getInSchoolReport() {
  203. $('#target').find('div').remove();
  204. $('#source').find('div').remove();
  205. setLeftDiv();
  206. $.getJSON(fileUrl, function (result) {
  207. $.each(result.stu_inSchoolReport, function (i, field) {
  208. var colList = eval(field);
  209. for (var key in colList) {
  210. var str = '<div id="' + i + '"class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  211. $('#source #' + i).remove();
  212. $('#target').append(str);
  213. }
  214. });
  215. setdraggableanddroppable();
  216. });
  217. };
  218. //毕业生学历电子注册上报
  219. function getGradReport() {
  220. $('#target').find('div').remove();
  221. $('#source').find('div').remove();
  222. setLeftDiv();
  223. $.getJSON(fileUrl, function (result) {
  224. $.each(result.stu_gradReport, function (i, field) {
  225. var colList = eval(field);
  226. for (var key in colList) {
  227. var str = '<div id="' + i + '"class="drag" name="' + key + '">' + i + '(' + colList[key] + ') </div>'
  228. $('#source #' + i).remove();
  229. $('#target').append(str);
  230. }
  231. });
  232. setdraggableanddroppable();
  233. });
  234. };
  235. //清空
  236. function removeRight() {
  237. $('#target').find('div').remove();
  238. $('#source').find('div').remove();
  239. setLeftDiv();
  240. }
  241. //查询Request
  242. function GetRequest() {
  243. var url = location.search; //获取url中"?"符后的字串
  244. var theRequest = new Object();
  245. if (url.indexOf("?") != -1) {
  246. var str = url.substr(1);
  247. strs = str.split("&");
  248. for (var i = 0; i < strs.length; i++) {
  249. theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
  250. }
  251. }
  252. return theRequest;
  253. }
  254. //DBF
  255. function Student_ReportDBFExport() {
  256. var Request = new Object();
  257. Request = GetRequest();
  258. $("#userIDs").val(Request["userIDs"]);
  259. var dgStudentList = top.$("#" + windowID).data("inputData");
  260. $("#queryParamsDatas").val(dgStudentList.QueryParamsDatas);
  261. var colnames = "";
  262. var shownames = "";
  263. $('#target').children('div').each(function () {
  264. colnames = colnames + $(this).attr('id') + ",";
  265. });
  266. $('#target').children('div').each(function () {
  267. shownames = shownames + $(this).attr('name') + ",";
  268. });
  269. $("#colnames").val(colnames);
  270. $("#shownames").val(shownames);
  271. if (colnames == null || colnames == "" || shownames == null || shownames == "") {
  272. $.messager.alert("系统提示", "请选择需要打印的字段。");
  273. return;
  274. }
  275. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/Student/ReportDBFExport");
  276. //$(document.forms[0]).submitWithLoading();
  277. $(document.forms[0]).submit();
  278. }
  279. //Excel
  280. function Student_ReportExcelExport() {
  281. var Request = new Object();
  282. Request = GetRequest();
  283. $("#userIDs").val(Request["userIDs"]);
  284. var dgStudentList = top.$("#" + windowID).data("inputData");
  285. $("#queryParamsDatas").val(dgStudentList.QueryParamsDatas);
  286. var colnames = "";
  287. var shownames = "";
  288. $('#target').children('div').each(function () {
  289. colnames = colnames + $(this).attr('id') + ",";
  290. });
  291. $('#target').children('div').each(function () {
  292. shownames = shownames + $(this).attr('name') + ",";
  293. });
  294. $("#colnames").val(colnames);
  295. $("#shownames").val(shownames);
  296. if (colnames == null || colnames == "" || shownames == null || shownames == "") {
  297. $.messager.alert("系统提示", "请选择需要打印的字段。");
  298. return;
  299. }
  300. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/Student/ReportExcelExport");
  301. $(document.forms[0]).submit();
  302. }
  303. </script>
  304. }
  305. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  306. <div class="p_title">
  307. <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;"></div>
  308. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("ReportExport")</div>
  309. </div>
  310. <form id="formQuery" method="post" action="@Url.Content("~/Student/ReportExcelExport")">
  311. @Html.Hidden("queryParamsDatas")
  312. @Html.Hidden("userIDs")
  313. @Html.Hidden("colnames")
  314. @Html.Hidden("shownames")
  315. </form>
  316. <div id="bodycss">
  317. <div style="margin:2px 0;"></div>
  318. <div id="buttondiv" style="margin-left:20px;">
  319. <div style="float:left;margin:0 4px"><input type="button" onclick="getAll()" class = "all" value="全部字段" /></div>
  320. <div style="float:left;margin:0 4px" ><input type="button" onclick="getNewStudentReport()" class ="stru_xjzc" value="新生学籍电子注册上报" /></div>
  321. <div style="float:left;margin:0 4px"><input type="button" onclick="getInSchoolEditReport()" class="stru_sjxg" value="在校生数据批量修改上报" /></div>
  322. <div style="float:left;margin:0 4px"><input type="button" onclick="getInSchoolReport()" class="stru_xnzc" value="在校生学年电子注册上报" /></div>
  323. <div style="float:left;margin:0 4px"><input type="button" onclick="getGradReport()" class="stru_jszc" value="毕业生学历电子注册上报" /></div>
  324. <div><input style="margin:0 4px;color:red;" type="button" onclick="removeRight()" class="stru_jszc" value="清空" /></div>
  325. </div>
  326. <div id="selectdiv">
  327. <div id="source" style="border:1px solid #ccc;width:300px;height:450px;float:left;margin:5px 90px;overflow:auto">
  328. 候选字段
  329. </div>
  330. <div id="target" style="border:1px solid #ccc;width:300px;height:450px;float:left;margin:5px 0px;overflow:auto">
  331. 需打印字段
  332. </div>
  333. <div style="clear:both;"></div>
  334. </div>
  335. </div>
  336. </div>