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

844 lines
34 KiB

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. }
  494. });
  495. }
  496. function btn_ExportAll() {
  497. var condion = new Array();
  498. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  499. condion = _sqlTxt_Condition;
  500. }
  501. //var data = "&sqlTxt=" + encodeURIComponent(_sqlTxt_AddCondition) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  502. var data = "&sqlTxt=" + encodeURIComponent(JSON.stringify(condion)) + "&DBName=" + _DBName + "&TempName=" + _TempName + "&MenuID=" + _MenuID;
  503. $.download("/SystemManage/CommonReport/ExportAllNew?" + Math.random(), data, 'post');
  504. }
  505. function btn_WatchPanel() {
  506. var condion = new Array();
  507. if (_sqlTxt_Condition != undefined && _sqlTxt_Condition.length > 0) {
  508. condion = _sqlTxt_Condition;
  509. }
  510. $.modalOpen({
  511. id: "WatchPanel",
  512. title: _ReportName + "看板显示",
  513. url: "/SystemManage/CommonReport/WatchPanel?_MenuID=" + _MenuID + "&_sqlTxt_Condition=" + escape(JSON.stringify(condion)) + "&TempName=" + escape(_TempName) + "&" + Math.random(),
  514. width: "1300px",
  515. height: "570px",
  516. btn: null,
  517. callBack: function (iframeId) {
  518. top.frames[iframeId].submitForm();
  519. GetMenu();
  520. }
  521. });
  522. }
  523. //角色显示栏位
  524. function btn_ColsVisible() {
  525. $.modalOpen({
  526. id: "ColsVisible",
  527. title: _ReportName + " 角色显示栏位",
  528. url: "/SystemManage/CommonReport/ColsVisible?MenuID=" + _MenuID + "&IsCommon=Y&Cols=&" + Math.random(),
  529. width: "1000px",
  530. height: "570px",
  531. btn: null,
  532. callBack: function (iframeId) {
  533. alert("111");
  534. GetMenu();
  535. }
  536. });
  537. }
  538. //新增类型
  539. function btn_Create() {
  540. debugger;
  541. $.modalOpen({
  542. id: "ICSInventoryBatchEnableAdd",
  543. title: "新增料品仓库批次关系",
  544. url: "/WMS/BasicSettings/ICSInventoryBatchEnableAdd" + "?" + Math.random(),
  545. width: "1600px",
  546. height: "1200px",
  547. callBack: function (iframeId) {
  548. top.frames[iframeId].submitForm();
  549. }
  550. });
  551. }
  552. //删除库位
  553. function btn_Delete() {
  554. debugger;
  555. var objArr = '';
  556. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  557. for (var i = 0; i < objList.length; i++) {
  558. var rowId = objList[i];
  559. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  560. objArr += "'" + rowData.ID + "',";
  561. }
  562. if (objArr == '') {
  563. $.modalAlert("请选择需要删除料品仓库批次关系!");
  564. return;
  565. }
  566. debugger;
  567. $.deleteForm({
  568. url: "/WMS/BasicSettings/DeleteICSInventoryBatchEnable" + "?" + Math.random(),
  569. param: { keyValue: JSON.stringify(objArr) },
  570. success: function () {
  571. $.currentWindow().$("#gridList").trigger("reloadGrid");
  572. }
  573. })
  574. }
  575. //启用
  576. function btn_Enable() {
  577. debugger;
  578. var objArr = '';
  579. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  580. for (var i = 0; i < objList.length; i++) {
  581. var rowId = objList[i];
  582. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  583. objArr += "'" + rowData.ID + "',";
  584. }
  585. if (objArr == '') {
  586. $.modalAlert("请选择需要启用的料品仓库绑定关系!");
  587. return;
  588. }
  589. debugger;
  590. $.submitForm({
  591. url: "/WMS/BasicSettings/EnableBatchEnable" + "?" + Math.random(),
  592. param: { keyValue: JSON.stringify(objArr) },
  593. success: function () {
  594. $.currentWindow().$("#gridList").trigger("reloadGrid");
  595. }
  596. })
  597. }
  598. //禁用
  599. function btn_Forbidden() {
  600. debugger;
  601. var objArr = '';
  602. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  603. for (var i = 0; i < objList.length; i++) {
  604. var rowId = objList[i];
  605. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  606. objArr += "'" + rowData.ID + "',";
  607. }
  608. if (objArr == '') {
  609. $.modalAlert("请选择需要禁用的料品仓库绑定关系!");
  610. return;
  611. }
  612. debugger;
  613. $.submitForm({
  614. url: "/WMS/BasicSettings/ForbiddenBatchEnable" + "?" + Math.random(),
  615. param: { keyValue: JSON.stringify(objArr) },
  616. success: function () {
  617. $.currentWindow().$("#gridList").trigger("reloadGrid");
  618. }
  619. })
  620. }
  621. //打印库位
  622. function btn_Print() {
  623. debugger;
  624. var objArr = '';
  625. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  626. //if (objList.length != 1) {
  627. // $.modalAlert("一次只能打印一个送货单!");
  628. // return;
  629. //}
  630. for (var i = 0; i < objList.length; i++) {
  631. var rowId = objList[i];
  632. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  633. objArr += "'" + rowData.ID + "',";
  634. }
  635. var strPrintData;
  636. var bIsInstallPrintControl;
  637. var strPrintControlCookie;
  638. $.ajax({
  639. url: "/WMS/BasicSettings/PrintStack",
  640. type: "post",
  641. data: { keyValue: JSON.stringify(objArr) },
  642. dataType: "json",
  643. async: false,
  644. success: function (data) {
  645. strPrintData = data.strPrintData_1;
  646. bIsInstallPrintControl = data.bIsInstallPrintControl_1;
  647. strPrintControlCookie = data.strPrintControlCookie_1;
  648. }
  649. });
  650. if (strPrintData != '') {
  651. var test = "ChuLinPrint:" + strPrintData;
  652. $("#ifrm")[0].src = "ChuLinPrint:" + strPrintData;
  653. }
  654. if (bIsInstallPrintControl == 'False') {
  655. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  656. $("#downPrintControl").click();
  657. }
  658. }
  659. if (bIsInstallPrintControl == 'True') {
  660. var strPrintControlCookie = strPrintControlCookie;
  661. if (strPrintControlCookie != '') { //延时3秒后再次检测打印控件是否安装
  662. setTimeout("checkPrintControlInstall()", 8000);
  663. function checkPrintControlInstall() {
  664. $.ajax({
  665. url: "/SRM/ASNManage/IsCheckInstall?checkInstall=" + strPrintControlCookie,
  666. dataType: "json",
  667. async: false,
  668. success: function (strResult) {
  669. if (strResult.indexOf("PrintControlInstall") == -1) {
  670. if (confirm("检测到打印控件未安装,您是否下载安装?")) {
  671. $("#downPrintControl").click();
  672. }
  673. }
  674. }
  675. });
  676. }
  677. }
  678. }
  679. $("#btn_search").click();
  680. }
  681. //导入
  682. function btn_Introduction() {
  683. debugger;
  684. $("#FileUp").click();
  685. }
  686. function btn_Clike() {
  687. $.ClickOperate();
  688. }
  689. function UpLoadFile(fileinfo) { //点击确定按钮的时候
  690. debugger;
  691. var files = fileinfo.files;
  692. var fileURL = fileinfo.value;
  693. var fileName = files[0].name;
  694. if (fileName != null && fileName != "") {
  695. var data = new FormData();
  696. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  697. data.append('file-' + i, file);
  698. });
  699. //var info = document.getElementById("form1");
  700. //var formData = new FormData(info);
  701. $.modalConfirm("确定上传文件吗?", function (r) {
  702. if (r) {
  703. $.ajax({
  704. url: "/WMS/BasicSettings/Import" + "?" + Math.random() + "&fileURL=" + fileURL + "",
  705. type: "post",
  706. data: "",
  707. contentType: false,
  708. processData: false,
  709. success: function (data) {
  710. if (data != "" && data != "获取文件失败" && data != "上传文件失败") {
  711. $.modalAlert("上传成功");
  712. $.currentWindow().$("#gridList").trigger("reloadGrid");
  713. }
  714. else {
  715. $.modalAlert("异常:" + data);
  716. }
  717. },
  718. error: function (aa) {
  719. $.modalAlert("上传失败:" + aa);
  720. }
  721. });
  722. }
  723. });
  724. }
  725. }
  726. </script>
  727. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  728. <div class="topPanel">
  729. <div class="toolbar">
  730. <div class="btn-group">
  731. </div>
  732. <div class="btn-group">
  733. <a class="btn btn-primary" style="margin-left:3px;" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  734. <a id="NF-Create" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Create()"><i class="fa fa-pencil-square-o"></i>新增</a>
  735. <a id="NF-Delete" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Delete()"><i class="fa fa-pencil-square-o"></i>删除</a>
  736. <a id="NF-Enable" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Enable()"><i class="fa fa-pencil-square-o"></i>启用</a>
  737. <a id="NF-Forbidden" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Forbidden()"><i class="fa fa-pencil-square-o"></i>禁用</a>
  738. <a id="NF-ExportAll" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ExportAll()"><i class="fa fa-download"></i>全部导出</a>
  739. <a id="NF-Print" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Print()"><i class="fa fa-print"></i>打印</a>
  740. <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>
  741. <a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Introduction()">导入</a>
  742. <a id="NF-Clike" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clike()"><i class="fa fa-eject"></i>...</a>
  743. </div>
  744. <div class="operates">
  745. <ul class="nav nav-pills">
  746. <li><a class="btn btn-primary dropdown-text" onclick="btn_Filter()"><i class="fa fa-filter"></i>过滤</a></li>
  747. <li><a id="NF-DataSource" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_DataSource()"><i class="fa fa-database"></i>设置数据源</a></li>
  748. <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>
  749. <li class="split"></li>
  750. <li><a id="NF-GridFormat" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_GridFormat()"><i class="fa fa-bars"></i>个性化设置</a></li>
  751. <li class="split"></li>
  752. <li><a id="NF-Clear" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_Clear()"><i class="fa fa-times"></i>清空本菜单所有设置</a></li>
  753. <li><a id="NF-WatchPanel" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_WatchPanel()"><i class="fa fa-download"></i>看板显示</a></li>
  754. <li><a id="NF-ColsVisible" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_ColsVisible()"><i class="fa fa-user"></i>角色显示栏位</a></li>
  755. </ul>
  756. <a href="javascript:;" class="close"></a>
  757. </div>
  758. <script>$('.toolbar').authorizeButton()</script>
  759. </div>
  760. </div>
  761. <div class="gridPanel" id="gridPanel">
  762. <table id="gridList"></table>
  763. <div id="gridPager"></div>
  764. </div>