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.

878 lines
35 KiB

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