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.

913 lines
38 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
1 year 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. switch (LogStr) {
  192. case "等于": if (val == formatcol.SValue) {
  193. if (IsRow) { _formatcols_Row.push(rr); }
  194. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  195. }
  196. break;
  197. case "不等于": if (val != formatcol.SValue) {
  198. if (IsRow) { _formatcols_Row.push(rr); }
  199. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  200. }
  201. break;
  202. case "小于": if (Number(val) < Number(formatcol.SValue)) {
  203. if (IsRow) { _formatcols_Row.push(rr); }
  204. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  205. }
  206. break;
  207. case "大于": if (Number(val) > Number(formatcol.SValue)) {
  208. if (IsRow) { _formatcols_Row.push(rr); }
  209. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  210. }
  211. break;
  212. case "小于等于": if (Number(val) <= Number(formatcol.SValue)) {
  213. if (IsRow) { _formatcols_Row.push(rr); }
  214. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  215. }
  216. break;
  217. case "大于等于": if (Number(val) >= Number(formatcol.SValue)) {
  218. if (IsRow) { _formatcols_Row.push(rr); }
  219. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  220. }
  221. break;
  222. case "范围内": if (Number(val) >= Number(formatcol.SValue) && Number(val) <= Number(formatcol.DValue)) {
  223. if (IsRow) { _formatcols_Row.push(rr); }
  224. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  225. }
  226. break;
  227. case "范围外": if (Number(val) < Number(formatcol.SValue) || Number(val) > Number(formatcol.DValue)) {
  228. if (IsRow) { _formatcols_Row.push(rr); }
  229. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  230. }
  231. break;
  232. case "包含": if (val.indexOf(formatcol.SValue) != -1) {
  233. if (IsRow) { _formatcols_Row.push(rr); }
  234. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  235. }
  236. break;
  237. case "头部包含": if (val.indexOf(formatcol.SValue) == 0) {
  238. if (IsRow) { _formatcols_Row.push(rr); }
  239. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  240. }
  241. break;
  242. case "尾部包含": if (val.indexOf(formatcol.SValue) == formatcol.length - val.length) {
  243. if (IsRow) { _formatcols_Row.push(rr); }
  244. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  245. }
  246. break;
  247. case "不包含": if (val.indexOf(formatcol.SValue) == -1) {
  248. if (IsRow) { _formatcols_Row.push(rr); }
  249. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  250. }
  251. break;
  252. }
  253. }
  254. else {
  255. //日期型
  256. if (val.length >= 10) {
  257. var VV = val.substring(0, 10);
  258. switch (LogStr) {
  259. case "等于":
  260. if (VV == formatcol.SValue) {
  261. if (IsRow) { _formatcols_Row.push(rr); }
  262. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  263. }
  264. break;
  265. case "不等于": if (VV != formatcol.SValue) {
  266. if (IsRow) { _formatcols_Row.push(rr); }
  267. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  268. }
  269. break;
  270. case "小于":
  271. if (VV < formatcol.SValue) {
  272. if (IsRow) { _formatcols_Row.push(rr); }
  273. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  274. }
  275. break;
  276. case "大于": if (VV > formatcol.SValue) {
  277. if (IsRow) { _formatcols_Row.push(rr); }
  278. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  279. }
  280. break;
  281. case "小于等于": if (VV <= formatcol.SValue) {
  282. if (IsRow) { _formatcols_Row.push(rr); }
  283. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  284. }
  285. break;
  286. case "大于等于": if (VV >= formatcol.SValue) {
  287. if (IsRow) { _formatcols_Row.push(rr); }
  288. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  289. }
  290. break;
  291. case "范围内": if (VV >= formatcol.SValue && VV <= formatcol.DValue) {
  292. if (IsRow) { _formatcols_Row.push(rr); }
  293. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  294. }
  295. break;
  296. case "范围外": if (VV < formatcol.SValue || VV > formatcol.DValue) {
  297. if (IsRow) { _formatcols_Row.push(rr); }
  298. else { rr += "style='background-color:" + formatcol.Color + "'"; return rr; }
  299. }
  300. break;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. return rr;
  307. }
  308. //个性化栏位背景色
  309. function addCellAttr_ID(rowId, val, rawObject, cm, rdata) {
  310. var rr = ' id=\'' + cm.name + '' + rowId + "\' ";
  311. return rr;
  312. }
  313. function Getformatcol(formatcols, colname) {
  314. var formatList = new Array();
  315. if (formatcols != null && formatcols.length > 0) {
  316. for (var i = 0; i < formatcols.length; i++) {
  317. if (formatcols[i].ColFiledName == colname) {
  318. formatList.push(formatcols[i]);
  319. }
  320. }
  321. }
  322. return formatList;
  323. }
  324. //生成colModel
  325. function SetCols(datacols) {
  326. var cols = new Array();
  327. if (datacols != null && datacols.length > 0) {
  328. for (var i = 0; i < datacols.length; i++) {
  329. var ColCaption = datacols[i].ColCaption;
  330. var ColFiledName = datacols[i].ColFiledName;
  331. var DataType = datacols[i].DataType;
  332. var DataTypeStr = GetDataTypeByNum(DataType);
  333. var ColWidth = datacols[i].ColWidth;
  334. var DeciamlNum = datacols[i].DeciamlNum;
  335. var sortable = datacols[i].sortable;
  336. var ColMerFlag = datacols[i].ColMerFlag;
  337. var IsFormat = datacols[i].IsFormat;
  338. var obj = new Array();
  339. if (IsFormat == "1") {
  340. obj = {
  341. label: ColCaption,
  342. name: ColFiledName,
  343. width: ColWidth,
  344. align: "left",
  345. sortable: sortable,
  346. cellattr: addCellAttr,
  347. }
  348. }
  349. else {
  350. obj = {
  351. label: ColCaption,
  352. name: ColFiledName,
  353. width: ColWidth,
  354. align: "left",
  355. sortable: sortable,
  356. cellattr: addCellAttr_ID,
  357. }
  358. }
  359. switch (DataTypeStr) {
  360. case "数值型":
  361. var Formatoptions = new { decimalPlaces: DeciamlNum };
  362. obj.push({ formatter: "number" });
  363. obj.push({ formatoptions: Formatoptions });
  364. break;
  365. case "字符型":
  366. case "日期型":
  367. case "布尔值":
  368. break;
  369. }
  370. //if (IsFormat) {
  371. // obj.push({ cellattr: addCellAttr });
  372. //}
  373. cols.push(obj);
  374. }
  375. var collast = { label: "", name: "", width: "20", align: "left", sortable: false };
  376. cols.push(collast);
  377. }
  378. return cols;
  379. }
  380. function gridList() {
  381. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';//重置grid
  382. _formatcols_Row = new Array();
  383. var $gridList = $("#gridList");
  384. var condion = new Array();
  385. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  386. condion = _sqlTxt_Condition;
  387. }
  388. $gridList.dataGrid({
  389. //url: "/SystemManage/CommonReport/GetGridJson",
  390. url: "/SystemManage/CommonReport/GetGridJsonNew",
  391. height: $(window).height() - 132,
  392. // postData: { sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName },
  393. postData: { MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName },
  394. colModel: _Cols,
  395. pager: "#gridPager",
  396. //sortname: ' ',
  397. //sortorder: ' ',
  398. sortname: _XCol,
  399. sortorder: ' ',
  400. viewrecords: true,
  401. multiselect: true,//开启选中行
  402. footerrow: _footerrow,
  403. gridComplete: function () {
  404. var strIds = $("#gridList").jqGrid("getDataIDs");
  405. if (_formatcols_Row.length > 0) {
  406. for (var i = 0; i < _formatcols_Row.length; i++) {
  407. $("#" + strIds[_formatcols_Row[i].rowid] + " td").css("background-color", _formatcols_Row[i].backgroundcolor);
  408. }
  409. }
  410. //$("#"+ids[ii]+ " td").css("background-color","red");
  411. //合并行
  412. if (_Mergercols != undefined && _Mergercols.length > 0) {
  413. for (var i = 0; i < _Mergercols.length; i++) {
  414. Merger("gridList", _Mergercols[i]);
  415. }
  416. }
  417. //合计
  418. if (_footerrow == true) {
  419. var footerData = {};
  420. for (var i = 0; i < _footercols.length; i++) {
  421. var total = 0;
  422. for (var j = 0; j < strIds.length; j++) {
  423. var qty = $("#gridList").jqGrid("getCell", strIds[j], _footercols[i]);
  424. if (qty != "") {
  425. total += parseInt(qty);
  426. }
  427. }
  428. footerData[_footercols[i]] = total;
  429. }
  430. $("#gridList").footerData('set', footerData);
  431. $("#gridList").footerData('set', { "rn": "合计" });
  432. }
  433. //隐藏列(不可见/无权限)
  434. if (_HiddenCols != null && _HiddenCols.length > 0) {
  435. for (var j = 0; j < _HiddenCols.length; j++) {
  436. $("#gridList").setGridParam().hideCol(_HiddenCols[j].ColFiledName);
  437. }
  438. }
  439. },
  440. loadError: function (data) {
  441. alert("异常:");
  442. }
  443. });
  444. $("#btn_search").click(function () {
  445. $gridList.jqGrid('setGridParam', {
  446. //sqlTxt: _sqlTxt_AddCondition, DBName: _DBName, TempName: _TempName
  447. MenuID: _MenuID, sqlTxt_Condition: JSON.stringify(condion), DBName: _DBName, TempName: _TempName
  448. }).trigger('reloadGrid');
  449. });
  450. }
  451. //过滤
  452. function btn_Filter() {
  453. $.modalOpenYC({
  454. id: "Filer",
  455. title: "过滤条件",
  456. url: "/SystemManage/CommonReport/Filter?MenuID=" + _MenuID + "&SourceID=" + _SourceID + "&" + Math.random(),
  457. width: "800px",
  458. height: "570px",
  459. //btn: ['确认', '关闭'],
  460. callBack: function (iframeId) {
  461. _sqlTxt_Condition = eval(top.frames[iframeId].submitForm());
  462. //_sqlTxt_AddCondition = _sqlTxt;
  463. if (_sqlTxt_Condition != undefined) {
  464. // if (_sqlTxt_Condition.length > 0) {
  465. // for (var i = 0; i < _sqlTxt_Condition.length; i++) {
  466. // _sqlTxt_AddCondition = ReplaceALL(_sqlTxt_AddCondition, _sqlTxt_Condition[i].CIndex, _sqlTxt_Condition[i].Content);
  467. // }
  468. // }
  469. top.frames[iframeId].Close();
  470. gridList();
  471. }
  472. }
  473. });
  474. }
  475. //数据源
  476. function btn_DataSource() {
  477. $.modalOpen({
  478. id: "DataSource",
  479. title: "数据源",
  480. url: "/SystemManage/CommonReport/DataSource?MenuID=" + _MenuID,//+ "&" + Math.random(),
  481. width: "1300px",
  482. height: "570px",
  483. btn: ['确认', '关闭'],
  484. callBack: function (iframeId) {
  485. dataRR = top.frames[iframeId].submitForm();
  486. if (dataRR == "Error")
  487. { }
  488. else {
  489. GetMenu();
  490. }
  491. }
  492. });
  493. }
  494. //列设置
  495. function btn_Cols() {
  496. if (_IsExistsDataSource != "1") {
  497. alert("请先设置数据源");
  498. }
  499. else {
  500. $.modalOpen({
  501. id: "Cols",
  502. title: "列设置",
  503. url: "/SystemManage/CommonReport/Cols?SourceID=" + _SourceID + "&MenuID=" + _MenuID + "&" + Math.random(),
  504. width: "1300px",
  505. height: "570px",
  506. btn: ['确认', '关闭'],
  507. callBack: function (iframeId) {
  508. top.frames[iframeId].submitForm();
  509. GetMenu();
  510. }
  511. });
  512. }
  513. }
  514. //个性化设置
  515. function btn_GridFormat() {
  516. if (_IsExistsDataSource != "1") {
  517. alert("请先设置数据源");
  518. }
  519. else {
  520. $.modalOpen({
  521. id: "GridFormat",
  522. title: "个性化设置",
  523. url: "/SystemManage/CommonReport/GridFormat?SourceID=" + _SourceID + "&" + Math.random(),
  524. width: "800px",
  525. height: "570px",
  526. btn: null,
  527. callBack: function (iframeId) {
  528. GetMenu();
  529. }
  530. });
  531. }
  532. }
  533. //多表头设置
  534. function btn_GridHeader() {
  535. if (_IsExistsDataSource != "1") {
  536. alert("请先设置数据源");
  537. }
  538. else {
  539. $.modalOpen({
  540. id: "GridHeader",
  541. title: "多表头设置",
  542. url: "/SystemManage/CommonReport/GridHeader?SourceID=" + _SourceID + "&" + Math.random(),
  543. width: "1300px",
  544. height: "570px",
  545. btn: ['确认', '关闭'],
  546. callBack: function (iframeId) {
  547. top.frames[iframeId].submitForm();
  548. GetMenu();
  549. }
  550. });
  551. }
  552. }
  553. //清空本菜单所有数据源相关设置
  554. function btn_Clear() {
  555. $.deleteForm({
  556. url: "/SystemManage/CommonReport/ClearAll?" + Math.random(),
  557. param: { MenuID: _MenuID },
  558. success: function () {
  559. _SourceID = "";//数据源ID
  560. _sqlTxt = "";//加上参数的sql
  561. _sqlTxt_AddCondition = "";//加上过滤条件的sql
  562. _TempName = "";
  563. _IsExistsDataSource = "";
  564. _DBName = "";//s数据库
  565. _Cols = new Array();//列
  566. _Filter = "";
  567. _footerrow = false;//是否有合计项
  568. _footercols = new Array();//合计项
  569. _formatcols = new Array();//个性化项
  570. _formatcols_Row = new Array();//个性化项的行
  571. _Mergercols = new Array();//合并项
  572. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> <div id="gridPager"></div>';
  573. },
  574. error: function (aa) {
  575. //alert("异常", aa.responseText);
  576. $.modalAlertNew("WMS00015", aa.responseText);
  577. }
  578. });
  579. }
  580. function btn_ExportAll() {
  581. var condion = new Array();
  582. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  583. condion = _sqlTxt_Condition;
  584. }
  585. //var data = "&sqlTxt=" + encodeURIComponent(_sqlTxt_AddCondition) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  586. var data = "&sqlTxt=" + encodeURIComponent(JSON.stringify(condion)) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID + "&XCol=" + _XCol;
  587. $.download("/SystemManage/CommonReport/ExportAllNew?" + Math.random(), data, 'post');
  588. }
  589. function btn_WatchPanel() {
  590. var condion = new Array();
  591. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  592. condion = _sqlTxt_Condition;
  593. }
  594. $.modalOpen({
  595. id: "WatchPanel",
  596. title: _ReportName + "看板显示",
  597. url: "/SystemManage/CommonReport/WatchPanel?_MenuID=" + _MenuID + "&_sqlTxt_Condition=" + escape(JSON.stringify(condion)) + "&TempName=" + escape(_TempName) + "&" + Math.random(),
  598. width: "1300px",
  599. height: "570px",
  600. btn: null,
  601. callBack: function (iframeId) {
  602. top.frames[iframeId].submitForm();
  603. GetMenu();
  604. }
  605. });
  606. }
  607. //角色显示栏位
  608. function btn_ColsVisible() {
  609. $.modalOpen({
  610. id: "ColsVisible",
  611. title: _ReportName + " 角色显示栏位",
  612. url: "/SystemManage/CommonReport/ColsVisible?MenuID=" + _MenuID + "&IsCommon=Y&Cols=&" + Math.random(),
  613. width: "1000px",
  614. height: "570px",
  615. btn: null,
  616. callBack: function (iframeId) {
  617. alert("111");
  618. GetMenu();
  619. }
  620. });
  621. }
  622. //新增类型
  623. function btn_Create() {
  624. debugger;
  625. $.modalOpen({
  626. id: "ICSConfigurationAdd",
  627. title: "新增容器",
  628. url: "/WMS/BasicSettings/ICSContainerAdd" + "?" + Math.random(),
  629. width: "500px",
  630. height: "400px",
  631. callBack: function (iframeId) {
  632. top.frames[iframeId].submitForm();
  633. }
  634. });
  635. }
  636. //删除库位
  637. function btn_Delete() {
  638. debugger;
  639. var objArr = '';
  640. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  641. for (var i = 0; i < objList.length; i++) {
  642. var rowId = objList[i];
  643. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  644. objArr += "'" + rowData.ID + "',";
  645. }
  646. if (objArr == '') {
  647. $.modalAlertNew("WMS00021");
  648. return;
  649. }
  650. debugger;
  651. $.deleteForm({
  652. url: "/WMS/BasicSettings/DeleteICSContainer" + "?" + Math.random(),
  653. param: { keyValue: JSON.stringify(objArr) },
  654. success: function () {
  655. $.currentWindow().$("#gridList").trigger("reloadGrid");
  656. }
  657. })
  658. }
  659. //修改类型
  660. function btn_Update() {
  661. debugger;
  662. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  663. if (ids.length != 1) {
  664. $.modalAlertNew("WMS00006");
  665. return;
  666. }
  667. for (var i in ids) {
  668. var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
  669. //ID
  670. var ID = rowData.ID;
  671. var ContainerID = rowData.ContainerID;
  672. var ContainerCODE = rowData.ContainerCODE;
  673. var ContainerName = rowData.ContainerName;
  674. var Memo = rowData.Memo;
  675. $.modalOpen({
  676. id: "Details",
  677. title: "修改",
  678. url: "/WMS/BasicSettings/ICSContainerAdd?ID=" + ID + "&ContainerID=" + ContainerID + "&ContainerCODE=" + ContainerCODE + "&ContainerName=" + ContainerName + "&Memo=" + Memo + "&" + Math.random(),
  679. width: "500px",
  680. height: "400px",
  681. callBack: function (iframeId) {
  682. top.frames[iframeId].submitForm();
  683. }
  684. });
  685. }
  686. }
  687. //打印库位
  688. function btn_Print() {
  689. debugger;
  690. var objArr = '';
  691. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  692. //if (objList.length != 1) {
  693. // $.modalAlert("一次只能打印一个送货单!");
  694. // return;
  695. //}
  696. for (var i = 0; i < objList.length; i++) {
  697. var rowId = objList[i];
  698. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  699. objArr += "'" + rowData.ID + "',";
  700. }
  701. var strPrintData;
  702. var bIsInstallPrintControl;
  703. var strPrintControlCookie;
  704. $.ajax({
  705. url: "/WMS/BasicSettings/PrintStack",
  706. type: "post",
  707. data: { keyValue: JSON.stringify(objArr) },
  708. dataType: "json",
  709. async: false,
  710. success: function (data) {
  711. strPrintData = data.strPrintData_1;
  712. bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  713. strPrintControlCookie = data.strPrintControlCookie_1;
  714. }
  715. });
  716. if (strPrintData != '') {
  717. var test = "ChuLinPrint:" + strPrintData;
  718. $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  719. }
  720. if (bIsInstallPrintControl == 'False') {
  721. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  722. $("#downPrintControl").click();
  723. }
  724. }
  725. if (bIsInstallPrintControl == 'True') {
  726. var strPrintControlCookie = strPrintControlCookie;
  727. if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  728. setTimeout("checkPrintControlInstall()", 8000);
  729. function checkPrintControlInstall() {
  730. $.ajax({
  731. url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  732. dataType: "json",
  733. async: false,
  734. success: function (strResult) {
  735. if (strResult.indexOf("PrintControlInstall") == -1) {
  736. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  737. $("#downPrintControl").click();
  738. }
  739. }
  740. }
  741. });
  742. }
  743. }
  744. }
  745. $("#btn_search").click();
  746. }
  747. //导入
  748. function btn_Introduction() {
  749. debugger;
  750. $("#FileUp").click();
  751. }
  752. function btn_Clike() {
  753. $.ClickOperate();
  754. }
  755. function UpLoadFile(fileinfo) { //点击确定按钮的时候
  756. debugger;
  757. var files = fileinfo.files;
  758. var fileURL = fileinfo.value;
  759. var fileName = files[0].name;
  760. if (fileName != null && fileName != "") {
  761. var data = new FormData();
  762. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  763. data.append('file-' + i, file);
  764. });
  765. //var info = document.getElementById("form1");
  766. //var formData = new FormData(info);
  767. $.modalConfirm("确定上传文件吗?", function (r) {
  768. if (r) {
  769. $.ajax({
  770. url: "/WMS/BasicSettings/Import" + "?" + Math.random() + "&fileURL=" + fileURL + "",
  771. type: "post",
  772. data: "",
  773. contentType: false,
  774. processData: false,
  775. success: function (data) {
  776. if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
  777. $.modalAlertNew("WMS00014");
  778. $.currentWindow().$("#gridList").trigger("reloadGrid");
  779. }
  780. else {
  781. $.modalAlertNew("WMS00015", data);
  782. }
  783. },
  784. error: function (aa) {
  785. $.modalAlertNew("WMS00016", aa);
  786. }
  787. });
  788. }
  789. });
  790. }
  791. }
  792. </script>
  793. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  794. <div class="topPanel">
  795. <div class="toolbar">
  796. <div class="btn-group">
  797. </div>
  798. <div class="btn-group">
  799. <a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  800. <a id="NF-Seach" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-pencil-square-o"></i>过滤</a>
  801. <a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
  802. <a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
  803. <a id="NF-Update" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Update()"><i class="fa fa-pencil-square-o"></i>修改</a>
  804. <a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
  805. <a id="NF-Print" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Print()"><i class="fa fa-print"></i>打印</a>
  806. <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>
  807. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Introduction()">导入</a>
  808. <a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
  809. @*<a id="NF-GridHeader" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridHeader()"><i class="fa fa-list-alt"></i>多表头设置</a>*@
  810. </div>
  811. <div class="operates">
  812. <ul class="nav nav-pills">
  813. @*<li><a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a></li>*@
  814. <li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
  815. <li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
  816. <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>
  817. <li class="split"></li>
  818. <li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
  819. <li class="split"></li>
  820. <li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
  821. <li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
  822. <li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
  823. </ul>
  824. <a href="javascript:;" class="close"></a>
  825. </div>
  826. <script>$('.toolbar').authorizeButton()</script>
  827. </div>
  828. </div>
  829. <div class="gridPanel" id="gridPanel">
  830. <table id="gridList"></table>
  831. <div id="gridPager"></div>
  832. </div>