123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
-
- @{
- ViewBag.Title = "AfterSale";
- Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
- }
- <style>
- </style>
- <div id="toolbar" style="padding:3px;">
- <form id="ff">
- <input class="easyui-radiobutton" type="radio" value="1" name="fruit" label="登记日期" labelPosition="after" data-options="onChange:readiochecked">
- <input class="easyui-radiobutton" type="radio" value="2" name="fruit" label="完成日期" labelPosition="after" data-options="onChange:readiochecked">
- <input disabled id="StartDate" type="text" class="easyui-datebox" style="width:180px">-
- <input disabled id="EndDate" type="text" class="easyui-datebox" style="width:180px">
- <div style="margin-left:20px;display:inline-block">
- <input class="easyui-textbox" style="width:150px" id="Deal" label="登记人:" labelPosition="before" labelWidth="57px" />
- <input class="easyui-textbox" style="width:150px" id="Acceptor" label="处理人:" labelPosition="before" labelWidth="57px" />
- </div>
- <a id="btnSelect" href="#" class="easyui-linkbutton c1" style="margin-left:30px"><i class="fa fa-search"></i> 查询记录</a>
- <a id="btnRefresh" href="#" class="easyui-linkbutton c8" data-options="plain:true"><i class="fa fa-refresh"></i> 刷新</a>
- <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>
- </form>
- </div>
- <table id="Table">
- <thead>
- <tr>
- <th colspan="8" align="center">反馈情况</th>
- <th colspan="7" align="center">问题处理情况</th>
- <th colspan="3" align="center">绩效分值情况</th>
- </tr>
- <tr>
- <th field="编号" width="80" align="center">编号</th>
- <th field="登记人" width="80" align="center">登记人</th>
- <th field="项目名称" width="80" align="center">项目名称</th>
- <th field="机构名称" width="80" align="center">机构名称</th>
- <th field="产品" width="80" align="center">产品</th>
- <th field="产品模块" width="80" align="center">产品模块</th>
- <th field="产品版本" width="80" align="center">产品版本</th>
- <th field="登记日期" width="80" align="center">登记日期</th>
- <th field="登记来源" width="80" align="center">登记来源</th>
- <th field="反馈人" width="80" align="center">反馈人</th>
- <th field="问题描述" width="80" align="center">问题描述</th>
- <th field="是否解决" width="80" align="center">是否解决</th>
- <th field="是否终止" width="80" align="center">是否终止</th>
- <th field="处理时间" width="80" align="center">处理时间</th>
- <th field="解决方案" width="80" align="center" formatter="formatterSolve">解决方案</th>
- <th field="问题分类" width="80" align="center">问题分类</th>
- <th field="处理人" width="80" align="center">处理人</th>
- <th field="问题分值" width="80" align="center">问题分值</th>
- <th field="是否验证" width="80" align="center">是否验证</th>
- <th field="验证人" width="80" align="center">验证人</th>
- </tr>
- </thead>
- </table>
- <script>
- var type = "0";
- $(function () {
- var Report = $('#Table');
- Report.datagrid({
- fit: true,
- showFooter: true,
- toolbar: '#toolbar',
- width: '100%',
- pageSize: 20,
- pageList: [10, 20, 30, 40, 50, 1000],
- rownumbers: true,
- pagination: true,
- border: false,
- remoteSort: true,
- singleSelect: true, //单行选择
- loadMsg: "正在查询数据,请稍候...",
- url: '/Report/GetAfterSale',
- method: 'post'
- })
-
- $("#btnSelect").bind('click', function () {
- $('#Table').datagrid('load', {
- startDate: $('#StartDate').datebox('getValue'),
- endDate: $('#EndDate').datebox('getValue'),
- DealPerson: $('#Deal').textbox('getValue'),
- AcceptorPerson: $('#Acceptor').textbox('getValue'),
- timetype: type
- });
- })
- $("#btnRefresh").bind('click', function () {
- $('#Table').datagrid('reload');
- })
- //按钮单击事件
- //$("input[type=radio]").click(function () {
- // $('#StartDate').datebox({ disabled: false});
- // $('#EndDate').datebox({ disabled: false});
- // var sex = $("input[type=radio]:checked").val();
- // type = sex;
- //});
- })
- ///read选中事件
- function readiochecked() {
- var opt = $("input:radio[name='fruit']:checked").val();
- if (opt == "1" || opt == "2") {
- $('#StartDate').datebox({ disabled: false });
- $('#EndDate').datebox({ disabled: false });
- type = $("input[type=radio]:checked").val();
- }
- }
- function formatterSolve(val) {
- if (!val) return "";
- var arrEntities = {
- 'lt': '<',
- 'gt': '>',
- 'nbsp': ' ',
- 'amp': '&',
- 'quot': '"'
- };
- return val.replace(/<[^>]+>/g, "").replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
- return arrEntities[t];
- });
- }
- function getPreMonth(date) {
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中月的天数
- var year2 = year;
- var month2 = parseInt(month) - 1;
- if (month2 == 0) {
- year2 = parseInt(year2) - 1;
- month2 = 12;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if (day2 > days2) {
- day2 = days2;
- }
- if (month2 < 10) {
- month2 = '0' + month2;
- }
- var t2 = year2 + '/' + month2;
- return t2;
- }
- function GetExcel() {
- // var data = $('#Table').datagrid('getData');
- var params = {
- startDate: $('#StartDate').datebox('getValue'),
- endDate: $('#EndDate').datebox('getValue'),
- DealPerson: $('#Deal').textbox('getValue'),
- AcceptorPerson: $('#Acceptor').textbox('getValue'),
- timetype:$("input[type=radio]:checked").val(),
- }
- var location = top.ZLPMS.Loading("导出中,请稍等...");
- $.post("/Report/GetAfterSale", params, function (data) {
- top.ZLPMS.UnLoading(location);
- //大标题
- var Tname = ' <tr><td colspan="8" align="center">反馈情况</td><td colspan="7" align="center">问题处理情况</td><td colspan="3" align="center">绩效分值情况</td></tr>';
- //获取标题
- var name = '<tr>';
- for (let Title in data.rows[0]) {
- //增加\t为了不让表格显示科学计数法或者其他格式
- name += `<td>${Title}</td>`;
- }
- name += '</tr>';
- let str = '';
- //循环遍历,每行加入tr标签,每个单元格加td标签
- for (let i = 0 ; i < data.rows.length ; i++) {
- str += '<tr>';
- for (let item in data.rows[i]) {
- //增加\t为了不让表格显示科学计数法或者其他格式
- str += `<td>${data.rows[i][item] + '\t'}</td>`;
- }
- str += '</tr>';
- }
- //合计
- 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>';
- str = Tname + name + str + Total;
- let worksheet = '售后问题绩效分值评定表'
- let uri = 'data:application/vnd.ms-excel;base64,';
- //下载的表格模板数据
- 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>`;
- //下载模板
- window.location.href = uri + base64(template)
- })
- }
- function base64(s) { return window.btoa(unescape(encodeURIComponent(s))) }
- </script>
|