纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 lines
34 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <style>
  6. .btn-primary {
  7. margin-right: 2px;
  8. }
  9. .topPanel .toolbar {
  10. float: left;
  11. }
  12. /*.ui-jqgrid tr.jqgrow td {
  13. white-space: normal !important;
  14. height: auto;
  15. }*/
  16. </style>
  17. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  18. <script>
  19. //var _MenuCaption = "";
  20. var _MenuTag = "";
  21. var _MenuID = "";//菜单ID
  22. var _SourceID = "";//数据源ID
  23. var _sqlTxt = "";//加上参数的sql
  24. var _sqlTxt_Condition = new Array();//加上过滤条件的sql
  25. var _sqlTxt_AddCondition = "";//加上过滤条件的sql
  26. var _IsExistsDataSource = "";
  27. var _DBName = "";//s数据库
  28. var _Cols = new Array();//列
  29. var _ReportName = "";
  30. var _Filter = "";
  31. var _TempName = "";
  32. var _footerrow = false;//是否有合计项
  33. var _footercols = new Array();//合计项
  34. var _formatcols = new Array();//个性化项
  35. var _formatcols_Row = new Array();//个性化项的行
  36. var _Mergercols = new Array();//合并项
  37. var _XCol = "";
  38. var dataRR = "";
  39. var _HiddenCols = new Array();
  40. $(function () {
  41. debugger;
  42. //1、获取当前页菜单名
  43. GetMenuID();
  44. //2、获取菜单设置
  45. GetMenu();
  46. //gridList();
  47. $(window).resize(function () {
  48. $("#gridList").setGridWidth($(window).width() * 0.99);
  49. $("#gridList").setGridWidth(document.body.clientWidth * 0.99);
  50. $("#gridList").setGridHeight($(window).height() - 132);
  51. $("#gridList").setGridHeight(document.body.clientHeight - 132);
  52. });
  53. });
  54. //1、获取当前页菜单名
  55. function GetMenuID() {
  56. debugger;
  57. var cc = self.frameElement.getAttribute('id');
  58. _MenuID = cc.replace("iframe", "");
  59. //_MenuTag = $.request("MenuTag");
  60. //$.ajax({
  61. // url: "/SystemManage/CommonReport/GetMenuID?MenuTag=" + _MenuTag + "&" + Math.random(),
  62. // dataType: "json",
  63. // async: false,
  64. // success: function (data) {
  65. // if (data != false && data != null && data.length > 0) {
  66. // _MenuID = data[0].MenuID;
  67. // }
  68. // else {
  69. // alert("获取菜单ID异常,请查看菜单配置并刷新:" + data);
  70. // }
  71. // },
  72. // error: function (aa) {
  73. // alert("异常:" + aa.responseText);
  74. // }
  75. //});
  76. }
  77. //2、获取菜单设置 URL 列 等
  78. function GetMenu() {
  79. debugger;
  80. $.ajax({
  81. url: "/SystemManage/CommonReport/GetMenu?MenuID=" + _MenuID + "&" + Math.random(),
  82. dataType: "json",
  83. async: false,
  84. success: function (data) {
  85. if (data != false && data != null) {
  86. _sqlTxt = data.sqlTxt;
  87. _sqlTxt_AddCondition = data.sqlTxt;
  88. _DBName = data.DBName;
  89. _SourceID = data.SourceID;
  90. _IsExistsDataSource = data.IsExistsDataSource;
  91. _ReportName = data.ReportName;
  92. _XCol = data.XCol;
  93. _Mergercols = eval(data.Mergercols);
  94. _formatcols = data.formatcols;
  95. _TempName = data.TempName;
  96. _footerrow = data.footerrow;
  97. _footercols = eval(data.footercols);
  98. _Cols = SetCols(eval(data.Cols));
  99. _HiddenCols = eval(data.HiddenCols);
  100. btn_Filter();
  101. }
  102. else {
  103. alert("获取菜单栏位等信息异常。" + data);
  104. }
  105. },
  106. error: function (aa) {
  107. alert("异常:" + aa.responseText);
  108. }
  109. });
  110. }
  111. //个性化栏位背景色
  112. function addCellAttr(rowId, val, rawObject, cm, rdata) {
  113. var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
  114. var formatList = Getformatcol(_formatcols, cm.name);//获取format所有条件
  115. if (formatList != null && formatList.length > 0) {
  116. for (var i = 0; i < formatList.length; i++) {
  117. var formatcol = formatList[i];//条件
  118. var IsRow = false;
  119. if (formatcol.AllRowFlag) {
  120. IsRow = true;
  121. var rr = {
  122. rowid: rowId - 1,
  123. backgroundcolor: formatcol.Color,
  124. }
  125. }
  126. var FormatDataType = formatcol.DataType;
  127. var LogStr = GetLogStringByNum(parseInt(formatcol.LogStr));
  128. if (FormatDataType != "日期型") {
  129. switch (LogStr) {
  130. case "等于": if (val == formatcol.SValue) {
  131. if (IsRow) { _formatcols_Row.push(rr); }
  132. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  133. }
  134. break;
  135. case "不等于": if (val != formatcol.SValue) {
  136. if (IsRow) { _formatcols_Row.push(rr); }
  137. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  138. }
  139. break;
  140. case "小于": if (val < formatcol.SValue) {
  141. if (IsRow) { _formatcols_Row.push(rr); }
  142. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  143. }
  144. break;
  145. case "大于": if (val > formatcol.SValue) {
  146. if (IsRow) { _formatcols_Row.push(rr); }
  147. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  148. }
  149. break;
  150. case "小于等于": if (val <= formatcol.SValue) {
  151. if (IsRow) { _formatcols_Row.push(rr); }
  152. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  153. }
  154. break;
  155. case "大于等于": if (val >= formatcol.SValue) {
  156. if (IsRow) { _formatcols_Row.push(rr); }
  157. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  158. }
  159. break;
  160. case "范围内": if (val >= formatcol.SValue && val <= formatcol.DValue) {
  161. if (IsRow) { _formatcols_Row.push(rr); }
  162. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  163. }
  164. break;
  165. case "范围外": if (val < formatcol.SValue || val > formatcol.DValue) {
  166. if (IsRow) { _formatcols_Row.push(rr); }
  167. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  168. }
  169. break;
  170. case "包含": if (val.indexOf(formatcol.SValue) != -1) {
  171. if (IsRow) { _formatcols_Row.push(rr); }
  172. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  173. }
  174. break;
  175. case "头部包含": if (val.indexOf(formatcol.SValue) == 0) {
  176. if (IsRow) { _formatcols_Row.push(rr); }
  177. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  178. }
  179. break;
  180. case "尾部包含": if (val.indexOf(formatcol.SValue) == formatcol.length - val.length) {
  181. if (IsRow) { _formatcols_Row.push(rr); }
  182. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  183. }
  184. break;
  185. case "不包含": if (val.indexOf(formatcol.SValue) == -1) {
  186. if (IsRow) { _formatcols_Row.push(rr); }
  187. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  188. }
  189. break;
  190. }
  191. }
  192. else {
  193. //日期型
  194. if (val.length >= 10) {
  195. var VV = val.substring(0, 10);
  196. switch (LogStr) {
  197. case "等于":
  198. if (VV == formatcol.SValue) {
  199. if (IsRow) { _formatcols_Row.push(rr); }
  200. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  201. }
  202. break;
  203. case "不等于": if (VV != formatcol.SValue) {
  204. if (IsRow) { _formatcols_Row.push(rr); }
  205. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  206. }
  207. break;
  208. case "小于":
  209. if (VV < formatcol.SValue) {
  210. if (IsRow) { _formatcols_Row.push(rr); }
  211. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  212. }
  213. break;
  214. case "大于": if (VV > formatcol.SValue) {
  215. if (IsRow) { _formatcols_Row.push(rr); }
  216. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  217. }
  218. break;
  219. case "小于等于": if (VV <= formatcol.SValue) {
  220. if (IsRow) { _formatcols_Row.push(rr); }
  221. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  222. }
  223. break;
  224. case "大于等于": if (VV >= formatcol.SValue) {
  225. if (IsRow) { _formatcols_Row.push(rr); }
  226. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  227. }
  228. break;
  229. case "范围内": if (VV >= formatcol.SValue && VV <= formatcol.DValue) {
  230. if (IsRow) { _formatcols_Row.push(rr); }
  231. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  232. }
  233. break;
  234. case "范围外": if (VV < formatcol.SValue || VV > formatcol.DValue) {
  235. if (IsRow) { _formatcols_Row.push(rr); }
  236. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  237. }
  238. break;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. return rr;
  245. }
  246. //个性化栏位背景色
  247. function addCellAttr_ID(rowId, val, rawObject, cm, rdata) {
  248. var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
  249. return rr;
  250. }
  251. function Getformatcol(formatcols, colname) {
  252. var formatList = new Array();
  253. if (formatcols != null && formatcols.length > 0) {
  254. for (var i = 0; i < formatcols.length; i++) {
  255. if (formatcols[i].ColFiledName == colname) {
  256. formatList.push(formatcols[i]);
  257. }
  258. }
  259. }
  260. return formatList;
  261. }
  262. //生成colModel
  263. function SetCols(datacols) {
  264. debugger;
  265. var cols = new Array();
  266. if (datacols != null && datacols.length > 0) {
  267. for (var i = 0; i < datacols.length; i++) {
  268. var ColCaption = datacols[i].ColCaption;
  269. var ColFiledName = datacols[i].ColFiledName;
  270. var DataType = datacols[i].DataType;
  271. var DataTypeStr = GetDataTypeByNum(DataType);
  272. var ColWidth = datacols[i].ColWidth;
  273. var DeciamlNum = datacols[i].DeciamlNum;
  274. var sortable = datacols[i].sortable;
  275. var ColMerFlag = datacols[i].ColMerFlag;
  276. var IsFormat = datacols[i].IsFormat;
  277. var obj = new Array();
  278. if (IsFormat == "1") {
  279. obj = {
  280. label: ColCaption,
  281. name: ColFiledName,
  282. width: ColWidth,
  283. align: "left",
  284. sortable: sortable,
  285. cellattr: addCellAttr,
  286. }
  287. }
  288. else if (ColCaption == '文件名') {
  289. obj = {
  290. label: ColCaption,
  291. name: ColFiledName,
  292. width: ColWidth,
  293. align: "left",
  294. sortable: sortable,
  295. formatter: function (cellvalue, options, rowObject) {
  296. var html = "";
  297. if (cellvalue != "" && cellvalue != null) {
  298. html = " <a href='../../../File/UPLoadFile/" + cellvalue + "' download='" + cellvalue + "' style='color:blue;'>" + cellvalue + "</a>";
  299. }
  300. return html;
  301. }
  302. }
  303. }
  304. else {
  305. obj = {
  306. label: ColCaption,
  307. name: ColFiledName,
  308. width: ColWidth,
  309. align: "left",
  310. sortable: sortable,
  311. cellattr: addCellAttr_ID,
  312. }
  313. }
  314. switch (DataTypeStr) {
  315. case "数值型":
  316. var Formatoptions = new { decimalPlaces: DeciamlNum };
  317. obj.push({ formatter: "number" });
  318. obj.push({ formatoptions: Formatoptions });
  319. break;
  320. case "字符型":
  321. case "日期型":
  322. case "布尔值":
  323. break;
  324. }
  325. //if (IsFormat) {
  326. // obj.push({ cellattr: addCellAttr });
  327. //}
  328. cols.push(obj);
  329. }
  330. var collast = { label: "", name: "", width: "20", align: "left", sortable: false };
  331. cols.push(collast);
  332. }
  333. return cols;
  334. }
  335. function gridList() {
  336. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';//重置grid
  337. _formatcols_Row = new Array();
  338. var $gridList = $("#gridList");
  339. var condion = new Array();
  340. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  341. condion = _sqlTxt_Condition;
  342. }
  343. $gridList.dataGrid({
  344. //url: "/SystemManage/CommonReport/GetGridJson",
  345. url: "/SystemManage/CommonReport/GetGridJsonNew",
  346. height: $(window).height() - 132,
  347. // postData: { sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName },
  348. postData: { MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName },
  349. colModel: _Cols,
  350. pager: "#gridPager",
  351. //sortname: ' ',
  352. //sortorder: ' ',
  353. sortname: _XCol,
  354. sortorder: ' ',
  355. viewrecords: true,
  356. multiselect: true,//开启选中行
  357. footerrow: _footerrow,
  358. beforeSelectRow: function (rowid, e) {
  359. $("#gridList").jqGrid('resetSelection');
  360. return (true);
  361. },
  362. gridComplete: function (rowid, cellname, value) {
  363. var strIds = $("#gridList").jqGrid("getDataIDs");
  364. if (_formatcols_Row.length > 0) {
  365. for (var i = 0; i < _formatcols_Row.length; i++) {
  366. $("#" + strIds[_formatcols_Row[i].rowid] + " td").css("background-color", _formatcols_Row[i].backgroundcolor);
  367. }
  368. }
  369. //$("#"+ids[ii]+ " td").css("background-color","red");
  370. //合并行
  371. if (_Mergercols != undefined && _Mergercols.length > 0) {
  372. for (var i = 0; i < _Mergercols.length; i++) {
  373. Merger("gridList", _Mergercols[i]);
  374. }
  375. }
  376. //合计
  377. if (_footerrow == true) {
  378. var footerData = {};
  379. for (var i = 0; i < _footercols.length; i++) {
  380. var total = 0;
  381. for (var j = 0; j < strIds.length; j++) {
  382. var qty = $("#gridList").jqGrid("getCell", strIds[j], _footercols[i]);
  383. if (qty != "") {
  384. total += parseInt(qty);
  385. }
  386. }
  387. footerData[_footercols[i]] = total;
  388. }
  389. $("#gridList").footerData('set', footerData);
  390. $("#gridList").footerData('set', { "rn": "合计" });
  391. }
  392. //隐藏列(不可见/无权限)
  393. if (_HiddenCols != null && _HiddenCols.length > 0) {
  394. for (var j = 0; j < _HiddenCols.length; j++) {
  395. $("#gridList").setGridParam().hideCol(_HiddenCols[j].ColFiledName);
  396. }
  397. }
  398. },
  399. loadError: function (data) {
  400. alert("异常:");
  401. }
  402. });
  403. $("#btn_search").click(function () {
  404. $gridList.jqGrid('setGridParam', {
  405. //sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName
  406. MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName
  407. }).trigger('reloadGrid');
  408. });
  409. }
  410. //过滤
  411. function btn_Filter() {
  412. $.modalOpen({
  413. id: "Filer",
  414. title: "过滤条件",
  415. url: "/SystemManage/CommonReport/Filter?MenuID=" + _MenuID + "&SourceID=" + _SourceID + "&" + Math.random(),
  416. width: "800px",
  417. height: "570px",
  418. btn: ['确认', '关闭'],
  419. callBack: function (iframeId) {
  420. _sqlTxt_Condition = eval(top.frames[iframeId].submitForm());
  421. //_sqlTxt_AddCondition = _sqlTxt;
  422. if (_sqlTxt_Condition != undefined) {
  423. // if (_sqlTxt_Condition.length > 0) {
  424. // for (var i = 0; i < _sqlTxt_Condition.length; i++) {
  425. // _sqlTxt_AddCondition = ReplaceALL(_sqlTxt_AddCondition, _sqlTxt_Condition[i].CIndex, _sqlTxt_Condition[i].Content);
  426. // }
  427. // }
  428. top.frames[iframeId].Close();
  429. gridList();
  430. }
  431. }
  432. });
  433. }
  434. //数据源
  435. function btn_DataSource() {
  436. $.modalOpen({
  437. id: "DataSource",
  438. title: "数据源",
  439. url: "/SystemManage/CommonReport/DataSource?MenuID=" + _MenuID,//+ "&" + Math.random(),
  440. width: "1300px",
  441. height: "570px",
  442. btn: ['确认', '关闭'],
  443. callBack: function (iframeId) {
  444. dataRR = top.frames[iframeId].submitForm();
  445. if (dataRR == "Error")
  446. { }
  447. else {
  448. GetMenu();
  449. }
  450. }
  451. });
  452. }
  453. //列设置
  454. function btn_Cols() {
  455. if (_IsExistsDataSource != "1") {
  456. alert("请先设置数据源");
  457. }
  458. else {
  459. $.modalOpen({
  460. id: "Cols",
  461. title: "列设置",
  462. url: "/SystemManage/CommonReport/Cols?SourceID=" + _SourceID + "&MenuID=" + _MenuID + "&" + Math.random(),
  463. width: "1300px",
  464. height: "570px",
  465. btn: ['确认', '关闭'],
  466. callBack: function (iframeId) {
  467. top.frames[iframeId].submitForm();
  468. GetMenu();
  469. }
  470. });
  471. }
  472. }
  473. //个性化设置
  474. function btn_GridFormat() {
  475. if (_IsExistsDataSource != "1") {
  476. alert("请先设置数据源");
  477. }
  478. else {
  479. $.modalOpen({
  480. id: "GridFormat",
  481. title: "个性化设置",
  482. url: "/SystemManage/CommonReport/GridFormat?SourceID=" + _SourceID + "&" + Math.random(),
  483. width: "800px",
  484. height: "570px",
  485. btn: null,
  486. callBack: function (iframeId) {
  487. GetMenu();
  488. }
  489. });
  490. }
  491. }
  492. //多表头设置
  493. function btn_GridHeader() {
  494. if (_IsExistsDataSource != "1") {
  495. alert("请先设置数据源");
  496. }
  497. else {
  498. $.modalOpen({
  499. id: "GridHeader",
  500. title: "多表头设置",
  501. url: "/SystemManage/CommonReport/GridHeader?SourceID=" + _SourceID + "&" + Math.random(),
  502. width: "1300px",
  503. height: "570px",
  504. btn: ['确认', '关闭'],
  505. callBack: function (iframeId) {
  506. top.frames[iframeId].submitForm();
  507. GetMenu();
  508. }
  509. });
  510. }
  511. }
  512. //清空本菜单所有数据源相关设置
  513. function btn_Clear() {
  514. $.deleteForm({
  515. url: "/SystemManage/CommonReport/ClearAll?" + Math.random(),
  516. param: { MenuID: _MenuID },
  517. success: function () {
  518. _SourceID = "";//数据源ID
  519. _sqlTxt = "";//加上参数的sql
  520. _sqlTxt_AddCondition = "";//加上过滤条件的sql
  521. _TempName = "";
  522. _IsExistsDataSource = "";
  523. _DBName = "";//s数据库
  524. _Cols = new Array();//列
  525. _Filter = "";
  526. _footerrow = false;//是否有合计项
  527. _footercols = new Array();//合计项
  528. _formatcols = new Array();//个性化项
  529. _formatcols_Row = new Array();//个性化项的行
  530. _Mergercols = new Array();//合并项
  531. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';
  532. },
  533. error: function (aa) {
  534. //alert("异常", aa.responseText);
  535. $.modalAlertNew("WMS00015", aa.responseText);
  536. }
  537. });
  538. }
  539. function btn_ExportAll() {
  540. var condion = new Array();
  541. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  542. condion = _sqlTxt_Condition;
  543. }
  544. //var data = "&sqlTxt=" + encodeURIComponent(_sqlTxt_AddCondition) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  545. var data = "&sqlTxt=" + encodeURIComponent(JSON.stringify(condion)) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  546. $.download("/SystemManage/CommonReport/ExportAllNew?" + Math.random(), data, 'post');
  547. }
  548. function btn_WatchPanel() {
  549. var condion = new Array();
  550. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  551. condion = _sqlTxt_Condition;
  552. }
  553. $.modalOpen({
  554. id: "WatchPanel",
  555. title: _ReportName + "看板显示",
  556. url: "/SystemManage/CommonReport/WatchPanel?_MenuID=" + _MenuID + "&_sqlTxt_Condition=" + escape(JSON.stringify(condion)) + "&TempName=" + escape(_TempName) + "&" + Math.random(),
  557. width: "1300px",
  558. height: "570px",
  559. btn: null,
  560. callBack: function (iframeId) {
  561. top.frames[iframeId].submitForm();
  562. GetMenu();
  563. }
  564. });
  565. }
  566. //角色显示栏位
  567. function btn_ColsVisible() {
  568. $.modalOpen({
  569. id: "ColsVisible",
  570. title: _ReportName + " 角色显示栏位",
  571. url: "/SystemManage/CommonReport/ColsVisible?MenuID=" + _MenuID + "&IsCommon=Y&Cols=&" + Math.random(),
  572. width: "1000px",
  573. height: "570px",
  574. btn: null,
  575. callBack: function (iframeId) {
  576. alert("111");
  577. GetMenu();
  578. }
  579. });
  580. }
  581. //维护条码时间`
  582. function btn_Maintain() {
  583. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  584. if (ids.length != 1) {
  585. $.modalAlertNew("WMS00006");
  586. return;
  587. }
  588. for (var i in ids) {
  589. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  590. //ID
  591. var ID = rowData.ID;
  592. }
  593. $.modalOpen({
  594. id: "Details",
  595. title: "过期物料检验维护",
  596. url: "/WMS/BasicSettings/MaintainBarcodeTimeUpdate?ID=" + ID + "&" + Math.random(),
  597. width: "500px",
  598. height: "400px",
  599. callBack: function (iframeId) {
  600. top.frames[iframeId].submitForm();
  601. }
  602. });
  603. }
  604. function UpLoadClick() {
  605. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  606. if (ids.length != 1) {
  607. $.modalAlertNew("WMS00050");
  608. return;
  609. }
  610. $("#FileUp").click();
  611. }
  612. function UpLoadLabelFile(fileinfo) {
  613. debugger;
  614. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  615. for (var i = 0; i < objList.length; i++) {
  616. var rowId = objList[i];
  617. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  618. var LotNo = rowData.LotNo;
  619. }
  620. var files = fileinfo.files;
  621. var fileName = files[0].name;
  622. if (fileName != null && fileName != "") {
  623. var data = new FormData();
  624. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  625. data.append('file-' + i, file);
  626. });
  627. data.append("LotNo", LotNo);
  628. $.modalConfirm("确定上传文件吗?", function (r) {
  629. if (r) {
  630. $.ajax({
  631. url: "/WMS/BasicSettings/UpLoadFileTxT?" + Math.random(),
  632. type: "post",
  633. data: data,
  634. contentType: false,
  635. processData: false,
  636. success: function (data) {
  637. if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
  638. $.modalAlertNew("WMS00014");
  639. $.currentWindow().$("#gridList").trigger("reloadGrid");
  640. }
  641. else {
  642. $.modalAlertNew("WMS00015", data);
  643. }
  644. },
  645. error: function (aa) {
  646. $.modalAlertNew("WMS00016", aa);
  647. }
  648. });
  649. }
  650. });
  651. }
  652. }
  653. //打印库位
  654. function btnPrint() {
  655. var objArr = '';
  656. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  657. if (objList.length != 1) {
  658. $.modalAlertNew("WMS00051");
  659. return;
  660. }
  661. for (var i = 0; i < objList.length; i++) {
  662. var rowId = objList[i];
  663. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  664. objArr += "'" + rowData.STNO + "',";
  665. }
  666. var strPrintData;
  667. var bIsInstallPrintControl;
  668. var strPrintControlCookie;
  669. $.ajax({
  670. url: "/SRM/ASNManage/PrintItemLot",
  671. type: "post",
  672. data: { keyValue: JSON.stringify(objArr) },
  673. dataType: "json",
  674. async: false,
  675. success: function (data) {
  676. strPrintData = data.strPrintData_1;
  677. bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  678. strPrintControlCookie = data.strPrintControlCookie_1;
  679. }
  680. });
  681. if (strPrintData != '') {
  682. var test = "ChuLinPrint:" + strPrintData;
  683. $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  684. }
  685. if (bIsInstallPrintControl == 'False') {
  686. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  687. $("#downPrintControl").click();
  688. }
  689. }
  690. if (bIsInstallPrintControl == 'True') {
  691. var strPrintControlCookie = strPrintControlCookie;
  692. if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  693. setTimeout("checkPrintControlInstall()", 8000);
  694. function checkPrintControlInstall() {
  695. $.ajax({
  696. url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  697. dataType: "json",
  698. async: false,
  699. success: function (strResult) {
  700. if (strResult.indexOf("PrintControlInstall") == -1) {
  701. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  702. $("#downPrintControl").click();
  703. }
  704. }
  705. }
  706. });
  707. }
  708. }
  709. }
  710. $("#btn_search").click();
  711. }
  712. //导入
  713. function btn_Introduction() {
  714. $.ClickOperate();
  715. }
  716. function btn_Clike() {
  717. $.ClickOperate();
  718. }
  719. </script>
  720. <form id="form1">
  721. <input id='FileUp' type='file' style="display: none" onchange="UpLoadLabelFile(this)" />
  722. </form>
  723. <div class="topPanel">
  724. <div class="toolbar">
  725. <div class="btn-group">
  726. </div>
  727. <div class="btn-group">
  728. <a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
  729. <a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
  730. <a id="NF-Update" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  731. <a id="NF-Maintain" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Maintain()"><i class="fa fa-pencil-square-o"></i>维护过期时间</a>
  732. <a id="NF-Print" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Print()"><i class="fa fa-print"></i>打印</a>
  733. <a href="~/File/Stack/库位资料导入模板.xlsx" id="NF-IntroductionMould" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
  734. <a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()"><i class="fa fa-file-excel-o"></i>上传</a>
  735. <a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  736. <a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
  737. </div>
  738. <div class="operates">
  739. <ul class="nav nav-pills">
  740. <li><a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a></li>
  741. <li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
  742. <li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
  743. <li><a id="NF-Cols" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Cols()"><i class="fa fa-text-width"></i>列设置</a></li>
  744. <li class="split"></li>
  745. <li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
  746. <li class="split"></li>
  747. <li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
  748. <li><a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a></li>
  749. <li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
  750. <li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
  751. </ul>
  752. <a href="javascript:;" class="close"></a>
  753. </div>
  754. <script>$('.toolbar').authorizeButton()</script>
  755. </div>
  756. </div>
  757. <div class="gridPanel" id="gridPanel">
  758. <table id="gridList"></table>
  759. <div id="gridPager"></div>
  760. </div>