AfterSale.cshtml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. 
  2. @{
  3. ViewBag.Title = "AfterSale";
  4. Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
  5. }
  6. <style>
  7. </style>
  8. <div id="toolbar" style="padding:3px;">
  9. <form id="ff">
  10. <input class="easyui-radiobutton" type="radio" value="1" name="fruit" label="登记日期" labelPosition="after" data-options="onChange:readiochecked">
  11. <input class="easyui-radiobutton" type="radio" value="2" name="fruit" label="完成日期" labelPosition="after" data-options="onChange:readiochecked">
  12. <input disabled id="StartDate" type="text" class="easyui-datebox" style="width:180px">-
  13. <input disabled id="EndDate" type="text" class="easyui-datebox" style="width:180px">
  14. <div style="margin-left:20px;display:inline-block">
  15. <input class="easyui-textbox" style="width:150px" id="Deal" label="登记人:" labelPosition="before" labelWidth="57px" />
  16. <input class="easyui-textbox" style="width:150px" id="Acceptor" label="处理人:" labelPosition="before" labelWidth="57px" />
  17. </div>
  18. <a id="btnSelect" href="#" class="easyui-linkbutton c1" style="margin-left:30px"><i class="fa fa-search"></i> 查询记录</a>
  19. <a id="btnRefresh" href="#" class="easyui-linkbutton c8" data-options="plain:true"><i class="fa fa-refresh"></i> 刷新</a>
  20. <a onclick="GetExcel()" id="btn_Class" href="#" class="easyui-linkbutton c2" data-options="plain:true"><i class="fa fa-file-text-o"> 导出excel</i></a>
  21. </form>
  22. </div>
  23. <table id="Table">
  24. <thead>
  25. <tr>
  26. <th colspan="8" align="center">反馈情况</th>
  27. <th colspan="7" align="center">问题处理情况</th>
  28. <th colspan="3" align="center">绩效分值情况</th>
  29. </tr>
  30. <tr>
  31. <th field="编号" width="80" align="center">编号</th>
  32. <th field="登记人" width="80" align="center">登记人</th>
  33. <th field="项目名称" width="80" align="center">项目名称</th>
  34. <th field="机构名称" width="80" align="center">机构名称</th>
  35. <th field="产品" width="80" align="center">产品</th>
  36. <th field="产品模块" width="80" align="center">产品模块</th>
  37. <th field="产品版本" width="80" align="center">产品版本</th>
  38. <th field="登记日期" width="80" align="center">登记日期</th>
  39. <th field="登记来源" width="80" align="center">登记来源</th>
  40. <th field="反馈人" width="80" align="center">反馈人</th>
  41. <th field="问题描述" width="80" align="center">问题描述</th>
  42. <th field="是否解决" width="80" align="center">是否解决</th>
  43. <th field="是否终止" width="80" align="center">是否终止</th>
  44. <th field="处理时间" width="80" align="center">处理时间</th>
  45. <th field="解决方案" width="80" align="center" formatter="formatterSolve">解决方案</th>
  46. <th field="问题分类" width="80" align="center">问题分类</th>
  47. <th field="处理人" width="80" align="center">处理人</th>
  48. <th field="问题分值" width="80" align="center">问题分值</th>
  49. <th field="是否验证" width="80" align="center">是否验证</th>
  50. <th field="验证人" width="80" align="center">验证人</th>
  51. </tr>
  52. </thead>
  53. </table>
  54. <script>
  55. var type = "0";
  56. $(function () {
  57. var Report = $('#Table');
  58. Report.datagrid({
  59. fit: true,
  60. showFooter: true,
  61. toolbar: '#toolbar',
  62. width: '100%',
  63. pageSize: 20,
  64. pageList: [10, 20, 30, 40, 50, 1000],
  65. rownumbers: true,
  66. pagination: true,
  67. border: false,
  68. remoteSort: true,
  69. singleSelect: true, //单行选择
  70. loadMsg: "正在查询数据,请稍候...",
  71. url: '/Report/GetAfterSale',
  72. method: 'post'
  73. })
  74. $("#btnSelect").bind('click', function () {
  75. $('#Table').datagrid('load', {
  76. startDate: $('#StartDate').datebox('getValue'),
  77. endDate: $('#EndDate').datebox('getValue'),
  78. DealPerson: $('#Deal').textbox('getValue'),
  79. AcceptorPerson: $('#Acceptor').textbox('getValue'),
  80. timetype: type
  81. });
  82. })
  83. $("#btnRefresh").bind('click', function () {
  84. $('#Table').datagrid('reload');
  85. })
  86. //按钮单击事件
  87. //$("input[type=radio]").click(function () {
  88. // $('#StartDate').datebox({ disabled: false});
  89. // $('#EndDate').datebox({ disabled: false});
  90. // var sex = $("input[type=radio]:checked").val();
  91. // type = sex;
  92. //});
  93. })
  94. ///read选中事件
  95. function readiochecked() {
  96. var opt = $("input:radio[name='fruit']:checked").val();
  97. if (opt == "1" || opt == "2") {
  98. $('#StartDate').datebox({ disabled: false });
  99. $('#EndDate').datebox({ disabled: false });
  100. type = $("input[type=radio]:checked").val();
  101. }
  102. }
  103. function formatterSolve(val) {
  104. if (!val) return "";
  105. var arrEntities = {
  106. 'lt': '<',
  107. 'gt': '>',
  108. 'nbsp': ' ',
  109. 'amp': '&',
  110. 'quot': '"'
  111. };
  112. return val.replace(/<[^>]+>/g, "").replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
  113. return arrEntities[t];
  114. });
  115. }
  116. function getPreMonth(date) {
  117. var arr = date.split('-');
  118. var year = arr[0]; //获取当前日期的年份
  119. var month = arr[1]; //获取当前日期的月份
  120. var day = arr[2]; //获取当前日期的日
  121. var days = new Date(year, month, 0);
  122. days = days.getDate(); //获取当前日期中月的天数
  123. var year2 = year;
  124. var month2 = parseInt(month) - 1;
  125. if (month2 == 0) {
  126. year2 = parseInt(year2) - 1;
  127. month2 = 12;
  128. }
  129. var day2 = day;
  130. var days2 = new Date(year2, month2, 0);
  131. days2 = days2.getDate();
  132. if (day2 > days2) {
  133. day2 = days2;
  134. }
  135. if (month2 < 10) {
  136. month2 = '0' + month2;
  137. }
  138. var t2 = year2 + '/' + month2;
  139. return t2;
  140. }
  141. function GetExcel() {
  142. // var data = $('#Table').datagrid('getData');
  143. var params = {
  144. startDate: $('#StartDate').datebox('getValue'),
  145. endDate: $('#EndDate').datebox('getValue'),
  146. DealPerson: $('#Deal').textbox('getValue'),
  147. AcceptorPerson: $('#Acceptor').textbox('getValue'),
  148. timetype:$("input[type=radio]:checked").val(),
  149. }
  150. var location = top.ZLPMS.Loading("导出中,请稍等...");
  151. $.post("/Report/GetAfterSale", params, function (data) {
  152. top.ZLPMS.UnLoading(location);
  153. //大标题
  154. var Tname = ' <tr><td colspan="8" align="center">反馈情况</td><td colspan="7" align="center">问题处理情况</td><td colspan="3" align="center">绩效分值情况</td></tr>';
  155. //获取标题
  156. var name = '<tr>';
  157. for (let Title in data.rows[0]) {
  158. //增加\t为了不让表格显示科学计数法或者其他格式
  159. name += `<td>${Title}</td>`;
  160. }
  161. name += '</tr>';
  162. let str = '';
  163. //循环遍历,每行加入tr标签,每个单元格加td标签
  164. for (let i = 0 ; i < data.rows.length ; i++) {
  165. str += '<tr>';
  166. for (let item in data.rows[i]) {
  167. //增加\t为了不让表格显示科学计数法或者其他格式
  168. str += `<td>${data.rows[i][item] + '\t'}</td>`;
  169. }
  170. str += '</tr>';
  171. }
  172. //合计
  173. var Total = ' <tr><td colspan="1" align="center">合计</td><td colspan="15" align="center"></td><td colspan="1" align="center">' + data.footer[0].问题分值 + '</td></tr>';
  174. str = Tname + name + str + Total;
  175. let worksheet = '售后问题绩效分值评定表'
  176. let uri = 'data:application/vnd.ms-excel;base64,';
  177. //下载的表格模板数据
  178. let template = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet> <x:Name>${worksheet}</x:Name> <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet> </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--> </head><body><table>${str}</table></body></html>`;
  179. //下载模板
  180. window.location.href = uri + base64(template)
  181. })
  182. }
  183. function base64(s) { return window.btoa(unescape(encodeURIComponent(s))) }
  184. </script>