纽威
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.

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