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

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