1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- @{
- ViewBag.Title = "同步数据";
- Layout = "~/Views/Shared/_Index.cshtml";
- }
- <style>
- .button {
- width: auto;
- padding: 9px 15px;
- background: #617798;
- border: 0;
- font-size: 14px;
- color: #FFFFFF;
- }
- </style>
- <script>
- $(document).ready(function () {
- initialPage();
- GetGrid();
- //表格表头居中显示
- $(".ui-th-column").css("text-align", "center");
- });
- //重设(表格)宽高
- function initialPage() {
- //resize重设(表格、树形)宽高
- $(window).resize(function (e) {
- window.setTimeout(function () {
- $('#gridTable').setGridWidth(($('.gridPanel').width()));
- $("#gridTable").setGridHeight($(window).height() - 108.5);
- }, 200);
- e.stopPropagation();
- });
- }
- //加载表格
- function GetGrid(tabledata) {
- jQuery("#gridTable").jqGrid({
- datatype: "local",
- height: $(window).height() - 108.5,
- colModel: [
- { label: "小区", name: "小区", width: 130, align: "left", sortable: false, fixed: true },
- { label: "楼宇", name: "楼宇", width: 130, align: "left", sortable: false, fixed: true },
- { label: "单元", name: "单元", width: 130, align: "left", sortable: false, fixed: true },
- { label: "户号", name: "户号", width: 130, align: "left", sortable: false, fixed: true },
- { label: "表地址", name: "表地址", width: 150, align: "right", sortable: false, fixed: true },
- { label: "IMEI", name: "IMEI", width: 200, align: "left", sortable: false, fixed: true },
- { label: "ICCID", name: "ICCID", width: 250, align: "right", sortable: false, fixed: true },
- { label: "DeviceID", name: "DeviceID", width: 300, align: "left", sortable: false, fixed: true },
- { label: "同步状态", name: "syncState", width: 300, align: "left", sortable: false, fixed: true }
- ]
- });
- if (tabledata != null) {
- var mydata = JSON.parse(tabledata);
- for (var i = 0; i <= mydata.length; i++) {
- jQuery("#gridTable").jqGrid('addRowData', i + 1, mydata[i]);
- }
- }
- }
- //上传文件
- function btn_confirm() {
- Loading(true);
- $("#gridTable").jqGrid("clearGridData");
- var formData = new FormData($('#uploadForm')[0]);
- $.ajax({
- type: 'post',
- url: '/NBManage/NBEquipmentDebug/ImportExcelForSync',
- data: formData,
- cache: false,
- processData: false,
- contentType: false,
- success: function (data) {
- GetGrid(data);
- Loading(false);
- }
- })
- }
- </script>
- <div style="background: #fff;padding-left:15px;">
- <form id="uploadForm" enctype="multipart/form-data" style="display: inline">
- 文件 :
- <input id="file" type="file" name="file" style="display: inline" />
- </form>
- <button id="upload" onclick="btn_confirm()" class="button" style="display: inline">上传文件</button>
- <br />
- </div>
- <div class="gridPanel">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|