123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- @{
- 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();
- GetGrid110();
- //表格居中显示
- $(".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 GetGrid110(tabledata) {
- jQuery("#gridTable").jqGrid(
- {
- datatype: "local",
- height: $(window).height() - 108.5,
- colModel: [
- { label: 'ID', name: 'ID', hidden: true },
- { label: "IMEI", name: "IMEI", width: 300, align: "left", sortable: false },
- { label: "SIM(ICCID)", name: "SIM", width: 300, align: "left", sortable: false },
- { label: "地址", name: "METERADDR", width: 300, align: "left", sortable: false },
- { label: "注册状态", name: "registerState", width: 300, align: "left", sortable: false, },
- ],
- rownumbers: 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 enteredKbFmatter(cellvalue, options, rowObject) {
- if (cellvalue == 1) {
- return "已注册";
- } else {
- return "未注册";
- }
- }
- function btn_confirm() {
- Loading(true);
- $("#gridTable").jqGrid("clearGridData");
- var file = document.getElementById("file");
- console.log(file.files.length);
- var formData = new FormData($('#uploadForm')[0]);
- if (!file.files.length) {
- Loading(false);
- dialogMsg("请选择文件", 0);
- return;
- }
- $.ajax({
- type: 'post',
- url: '/NBManage/NBEquipmentDebug/ImportExcel',
- data: formData,
- cache: false,
- processData: false,
- contentType: false,
- success: function (data) {
- GetGrid110(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" style="width:100%;">
- <table id="gridTable"></table>
- <div id="gridPager"></div>
- </div>
|