123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
-
- @{
- ViewBag.Title = "MaintenanceInquiry";
- Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
- }
- <style>
- </style>
- <div id="toolbar" style="padding:3px;">
- <form id="ff">
- 服务状态:<input class="easyui-combobox" id="LX" style="width: 70px;">
- 智能搜索:<input class="easyui-textbox" id="KsCx" style="width:200px;" data-options="prompt:'渠道、客户'">
- 渠道:<input id="QDID" name="QDID" panelheight="200px" class="easyui-combobox" style="width:200px;" />
- <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>
- <div id="Table"></div>
- @*<table id="Table">
- <thead>
- <tr>
- <th field="渠道名称" width="150" align="center">渠道名称</th>
- <th field="客户信息" width="150" align="center">客户信息</th>
- <th field="产品名称" width="150" 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>
- </tr>
- </thead>
- </table>*@
- <script>
- var type = "0";
- //原型记录
- var Params = {
- name: "",
- qdid: "",
- 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/GeMaintenanceInquiry',
- method: 'post',
- columns: [[
-
- { field: '渠道名称', title: '渠道名称', width: 150, align: 'left', fixed: true},
- { field: '客户信息', title: '客户信息', align: 'left', fixed: true, width: 150 },
- { field: '产品名称', title: '产品名称', align: 'left', fixed: true, width: 150 },
- {
- field: '服务状态', title: '服务状态', align: 'center', fixed: true, width: 80, styler: function (value, rowData, index) {
- if (rowData.服务状态 == '脱保') {
- return "color:red";
- }
- else {
- return "color: #4cd964";
- }
- },
- },
- { field: '服务开始时间', title: '服务开始时间', align: 'left', fixed: true, width: 150 },
- { field: '服务结束时间', title: '服务结束时间', align: 'left', fixed: true, width: 150 },
- { field: '登记问题数量', title: '问题数量(2月)', align: 'center', fixed: true, width: 100 },
- { field: '维保天数', title: '剩余天数', align: 'center', fixed: true, width: 80 },
- { field: '说明', title: '备注', align: 'left', fixed: true, width: 200 },
- ]]
- })
- $("#btnSelect").bind('click', function () {
- Params.name = $('#KsCx').textbox('getValue');
- Params.qdid = $('#QDID').textbox('getValue');
- $('#Table').datagrid('load', Params);
- })
- $("#btnRefresh").bind('click', function () {
- $('#Table').datagrid('reload');
- })
- //类型
- $("#LX").combobox({
- data: [{ ID: "0", MC: "全部" }, { ID: "1", MC: "在保" }, { ID: "2", MC: "脱保" }],
- valueField: "ID",
- textField: "MC",
- onSelect: function (data) {
- Params.type = data.ID;
- Params.name = $('#KsCx').textbox('getValue');
- Params.qdid = $('#QDID').textbox('getValue');
- $('#Table').datagrid('load', Params);
- },
- onLoadSuccess: function () {
- var data = $(this).combobox('getData')[0];
- if (data) {
- var vf = $(this).combobox('options').valueField;
- $('#LX').combobox('setValue', data.MC);
- }
-
- }
- });
- //项目
- $("#QDID").combobox({
- url: '/ProManager/Datagrid',
- valueField: 'ID',
- textField: '名称',
- limitToList: true,
- onSelect: function (data) {
- Params.qdid = data.ID;
- $('#Table').datagrid('load', Params);
- },
- })
-
- })
-
- 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 GetExcel() {
- var location = top.ZLPMS.Loading("导出中,请稍等...");
- $.post("/Report/GeMaintenanceInquiry", Params, function (data) {
- top.ZLPMS.UnLoading(location);
- //大标题
- /* var Tname = ' <tr><td colspan="1" align="center">项目名称</td><td colspan="12" align="center">详细信息</td></tr>';*/
- var Tname = "";
- //获取标题
- 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="1" align="center">' + data.footer[0].问题分值 + '</td></tr>';*/
- str = Tname + name + str;
- 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>
|