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

250 lines
5.7 KiB

3 years ago
  1. 
  2. // 等于 = 0,
  3. //不等于 = 1,
  4. //小于 = 2,
  5. //大于 = 3,
  6. //小于等于 = 4,
  7. //大于等于 = 5,
  8. //范围内 = 6,
  9. //范围外 = 7,
  10. //包含 = 8,
  11. //头部包含 = 9,
  12. //尾部包含 = 10,
  13. //不包含 = 11
  14. //数值型 = 0,
  15. //字符型 = 1,
  16. //日期型 = 2,
  17. //布尔值 = 3
  18. function GetDataTypeString() {
  19. var obj = new Array();
  20. var ii = { value: 0, Str: "数值型" }; obj.push(ii);
  21. var ii = { value: 1, Str: "字符型" }; obj.push(ii);
  22. var ii = { value: 2, Str: "日期型" }; obj.push(ii);
  23. var ii = { value: 3, Str: "布尔值" }; obj.push(ii);
  24. return obj;
  25. }
  26. function GetDataTypeByNum(Num) {
  27. var Str="";
  28. switch(Num)
  29. {
  30. case "0": Str = "数值型";
  31. break;
  32. case "1": Str = "字符型";
  33. break;
  34. case "2": Str = "日期型";
  35. break;
  36. case "3": Str = "布尔值";
  37. break;
  38. }
  39. return Str;
  40. }
  41. function ReplaceALL(str, f, e) {//吧f替换成e
  42. var reg = new RegExp(f, "g")
  43. var newstr = str.replace(reg, e);
  44. return newstr;
  45. }
  46. function GetLogStringALL() {
  47. var obj = new Array();
  48. var ii = { value: 0, Str: "等于" }; obj.push(ii);
  49. var ii = { value: 1, Str: "不等于" }; obj.push(ii);
  50. var ii = { value: 2, Str: "小于" }; obj.push(ii);
  51. var ii = { value: 3, Str: "大于" }; obj.push(ii);
  52. var ii = { value: 4, Str: "小于等于" }; obj.push(ii);
  53. var ii = { value: 5, Str: "大于等于" }; obj.push(ii);
  54. var ii = { value: 6, Str: "范围内" }; obj.push(ii);
  55. var ii = { value: 7, Str: "范围外" }; obj.push(ii);
  56. var ii = { value: 8, Str: "包含" }; obj.push(ii);
  57. var ii = { value: 9, Str: "头部包含" }; obj.push(ii);
  58. var ii = { value: 10, Str: "尾部包含" }; obj.push(ii);
  59. var ii = { value: 11, Str: "不包含" }; obj.push(ii);
  60. return obj;
  61. }
  62. function GetLogStringByNum(Num) {
  63. switch (Num)
  64. {
  65. case 0: return "等于";
  66. case 1: return "不等于";
  67. case 2: return "小于";
  68. case 3: return "大于";
  69. case 4: return "小于等于";
  70. case 5: return "大于等于";
  71. case 6: return "范围内";
  72. case 7: return "范围外";
  73. case 8: return "包含";
  74. case 9: return "头部包含";
  75. case 10: return "尾部包含";
  76. case 11: return "不包含";
  77. }
  78. return "";
  79. }
  80. function GetLogString(str) {
  81. var obj = new Array();
  82. var LogALL = GetLogStringALL();
  83. switch (str) {
  84. case "字符型":
  85. for (var i = 0; i <= 11; i++) {
  86. obj.push(LogALL[i]);
  87. }
  88. break;
  89. case "日期型":
  90. case "数值型":
  91. for (var i = 0; i <= 7; i++) {
  92. obj.push(LogALL[i]);
  93. }
  94. break;
  95. case "布尔值":
  96. obj.push(LogALL[0]);
  97. obj.push(LogALL[1]);
  98. break;
  99. }
  100. return obj;
  101. }
  102. function GetCLogString(str) {
  103. switch (str) {
  104. case "1"://字符型
  105. return "0,1,2,3,4,5,6,7,8,9,10,11";
  106. case "2"://日期型
  107. case "0"://数值型
  108. return "0,1,2,3,4,5,6,7";
  109. case "3"://布尔值
  110. return "0,1";
  111. }
  112. return "";
  113. }
  114. function checkboxToNumStr(checkbox)
  115. {
  116. if (checkbox.checked) {
  117. return '1';
  118. }
  119. else { return '0';}
  120. }
  121. //合并单元格
  122. function Merger(gridName, CellName) {
  123. //得到显示到界面的id集合
  124. var mya = $("#" + gridName + "").getDataIDs();
  125. //当前显示多少条
  126. var length = mya.length;
  127. for (var i = 0; i < length; i++) {
  128. //从上到下获取一条信息
  129. var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
  130. //定义合并行数
  131. var rowSpanTaxCount = 1;
  132. for (j = i + 1; j <= length; j++) {
  133. //和上边的信息对比 如果值一样就合并行数+1 然后设置rowspan 让当前单元格隐藏
  134. var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
  135. if (before[CellName] == end[CellName]) {
  136. rowSpanTaxCount++;
  137. $("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
  138. }
  139. else {
  140. rowSpanTaxCount = 1;
  141. break;
  142. }
  143. $("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
  144. }
  145. }
  146. }
  147. /*
  148. * 浏览器全屏
  149. */
  150. function fullScreen() {
  151. var el = document.documentElement;
  152. var rfs = el.requestFullScreen || el.webkitRequestFullScreen;
  153. if (typeof rfs != "undefined" && rfs) {
  154. rfs.call(el);
  155. } else if (typeof window.ActiveXObject != "undefined") {
  156. var wscript = new ActiveXObject("WScript.Shell");
  157. if (wscript != null) {
  158. wscript.SendKeys("{F11}");
  159. }
  160. } else if (el.msRequestFullscreen) {
  161. el.msRequestFullscreen();
  162. } else if (el.oRequestFullscreen) {
  163. el.oRequestFullscreen();
  164. } else {
  165. alert("浏览器不支持全屏调用,请按F11键切换全屏!");
  166. }
  167. }
  168. /*
  169. * 浏览器退出全屏
  170. */
  171. function exitFullScreen() {
  172. var el = document;
  173. var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullScreen;
  174. if (typeof cfs != "undefined" && cfs) {
  175. cfs.call(el);
  176. } else if (typeof window.ActiveXObject != "undefined") {
  177. var wscript = new ActiveXObject("WScript.Shell");
  178. if (wscript != null) {
  179. wscript.SendKeys("{F11}");
  180. }
  181. } else if (el.msExitFullscreen) {
  182. el.msExitFullscreen();
  183. } else if (el.oRequestFullscreen) {
  184. el.oCancelFullScreen();
  185. } else {
  186. alert( "浏览器不支持全屏调用,请按F11键切换全屏!" );
  187. }
  188. }