search.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. let api = [];
  2. api.push({
  3. alias: 'AlertControllerWeb',
  4. order: '1',
  5. link: '警情模块',
  6. desc: '警情模块',
  7. list: []
  8. })
  9. api[0].list.push({
  10. order: '1',
  11. desc: '查询当天24小时警情',
  12. });
  13. api[0].list.push({
  14. order: '2',
  15. desc: '查询每年12个月警情',
  16. });
  17. api[0].list.push({
  18. order: '3',
  19. desc: '警情详细信息',
  20. });
  21. api[0].list.push({
  22. order: '4',
  23. desc: '查询不同警情(社会救助,警情,火灾)的占比',
  24. });
  25. api.push({
  26. alias: 'AlFsdAllControllerWeb',
  27. order: '2',
  28. link: '行政许可-消防安检申报总',
  29. desc: '行政许可-消防安检申报总',
  30. list: []
  31. })
  32. api[1].list.push({
  33. order: '1',
  34. desc: '获取行政许可的检查,受理,出文数量',
  35. });
  36. api.push({
  37. alias: 'BmfwEventController',
  38. order: '3',
  39. link: '<p>_项目申报记录</p>',
  40. desc: '<p> 项目申报记录</p>',
  41. list: []
  42. })
  43. api[2].list.push({
  44. order: '1',
  45. desc: '分页',
  46. });
  47. api.push({
  48. alias: 'BmfwFeedbackController',
  49. order: '4',
  50. link: '<p>_用户反馈记录</p>',
  51. desc: '<p> 用户反馈记录</p>',
  52. list: []
  53. })
  54. api[3].list.push({
  55. order: '1',
  56. desc: '分页',
  57. });
  58. api.push({
  59. alias: 'BmfwLawsCatalogController',
  60. order: '5',
  61. link: '<p>_法规目录表</p>',
  62. desc: '<p> 法规目录表</p>',
  63. list: []
  64. })
  65. api[4].list.push({
  66. order: '1',
  67. desc: '分页',
  68. });
  69. api.push({
  70. alias: 'BmfwLawsCatalogInfoController',
  71. order: '6',
  72. link: '<p>_法规详情表</p>',
  73. desc: '<p> 法规详情表</p>',
  74. list: []
  75. })
  76. api[5].list.push({
  77. order: '1',
  78. desc: '分页',
  79. });
  80. api.push({
  81. alias: 'BmfwLawsController',
  82. order: '7',
  83. link: '<p>_法规记录表</p>',
  84. desc: '<p> 法规记录表</p>',
  85. list: []
  86. })
  87. api.push({
  88. alias: 'BmfwLawsNewController',
  89. order: '8',
  90. link: '<p>_普法宣传记录</p>',
  91. desc: '<p> 普法宣传记录</p>',
  92. list: []
  93. })
  94. api[7].list.push({
  95. order: '1',
  96. desc: '分页',
  97. });
  98. api.push({
  99. alias: 'BmfwUserController',
  100. order: '9',
  101. link: '<p>_用户信息</p>',
  102. desc: '<p> 用户信息</p>',
  103. list: []
  104. })
  105. api[8].list.push({
  106. order: '1',
  107. desc: '分页',
  108. });
  109. api.push({
  110. alias: 'RobotQuestionController',
  111. order: '10',
  112. link: '<p>_题目表</p>',
  113. desc: '<p> 题目表</p>',
  114. list: []
  115. })
  116. api[9].list.push({
  117. order: '1',
  118. desc: '分页',
  119. });
  120. api.push({
  121. alias: 'RobotQuestionKeyController',
  122. order: '11',
  123. link: '<p>_关键字信息</p>',
  124. desc: '<p> 关键字信息</p>',
  125. list: []
  126. })
  127. api[10].list.push({
  128. order: '1',
  129. desc: '分页',
  130. });
  131. api.push({
  132. alias: 'RobotQuestionMessageController',
  133. order: '12',
  134. link: '<p>_搜索问题记录表</p>',
  135. desc: '<p> 搜索问题记录表</p>',
  136. list: []
  137. })
  138. api[11].list.push({
  139. order: '1',
  140. desc: '分页',
  141. });
  142. api.push({
  143. alias: 'RobotQuestionMessageRecordController',
  144. order: '13',
  145. link: '<p>_留言记录信息</p>',
  146. desc: '<p> 留言记录信息</p>',
  147. list: []
  148. })
  149. api[12].list.push({
  150. order: '1',
  151. desc: '分页',
  152. });
  153. api.push({
  154. alias: 'FireSiteControllerWeb',
  155. order: '14',
  156. link: '消防站点',
  157. desc: '消防站点',
  158. list: []
  159. })
  160. api[13].list.push({
  161. order: '1',
  162. desc: '分页',
  163. });
  164. api[13].list.push({
  165. order: '2',
  166. desc: 'get one',
  167. });
  168. api[13].list.push({
  169. order: '3',
  170. desc: '站点执勤实力',
  171. });
  172. api.push({
  173. alias: 'FireStatisticsControllerWeb',
  174. order: '15',
  175. link: '火灾详情',
  176. desc: '火灾详情',
  177. list: []
  178. })
  179. api[14].list.push({
  180. order: '1',
  181. desc: '根据年份和地址查看12月份的火灾统计',
  182. });
  183. api[14].list.push({
  184. order: '2',
  185. desc: '分页',
  186. });
  187. api[14].list.push({
  188. order: '3',
  189. desc: 'getOne',
  190. });
  191. api[14].list.push({
  192. order: '4',
  193. desc: '火灾-单位-出警信息',
  194. });
  195. api[14].list.push({
  196. order: '5',
  197. desc: '火灾原因占比',
  198. });
  199. api[14].list.push({
  200. order: '6',
  201. desc: '火灾类型',
  202. });
  203. api[14].list.push({
  204. order: '7',
  205. desc: '',
  206. });
  207. api[14].list.push({
  208. order: '8',
  209. desc: '',
  210. });
  211. api.push({
  212. alias: 'FireWaterControllerWeb',
  213. order: '16',
  214. link: '水源模块',
  215. desc: '水源模块',
  216. list: []
  217. })
  218. api[15].list.push({
  219. order: '1',
  220. desc: '获取水源详细信息',
  221. });
  222. api[15].list.push({
  223. order: '2',
  224. desc: '分页',
  225. });
  226. api[15].list.push({
  227. order: '3',
  228. desc: '水源统计',
  229. });
  230. api.push({
  231. alias: 'ReportComplaintControllerWeb',
  232. order: '17',
  233. link: '举报投诉',
  234. desc: '举报投诉',
  235. list: []
  236. })
  237. api[16].list.push({
  238. order: '1',
  239. desc: '举报投诉分类汇总',
  240. });
  241. api[16].list.push({
  242. order: '2',
  243. desc: '举报情况信息',
  244. });
  245. api.push({
  246. alias: 'SiAeAllControllerWeb',
  247. order: '18',
  248. link: '监督检查行政执法总记录',
  249. desc: '监督检查行政执法总记录',
  250. list: []
  251. })
  252. api[17].list.push({
  253. order: '1',
  254. desc: '行政执法总记录汇总',
  255. });
  256. api.push({
  257. alias: 'UnitBeOnDutyControllerWeb',
  258. order: '19',
  259. link: '支队值班',
  260. desc: '支队值班',
  261. list: []
  262. })
  263. api[18].list.push({
  264. order: '1',
  265. desc: '今日值班表',
  266. });
  267. api[18].list.push({
  268. order: '2',
  269. desc: '',
  270. });
  271. api.push({
  272. alias: 'UnitControllerWeb',
  273. order: '20',
  274. link: '单位信息',
  275. desc: '单位信息',
  276. list: []
  277. })
  278. api[19].list.push({
  279. order: '1',
  280. desc: '获取单个单位信息',
  281. });
  282. api[19].list.push({
  283. order: '2',
  284. desc: '分页',
  285. });
  286. api[19].list.push({
  287. order: '3',
  288. desc: '单位信息及执法情况和历史检查记录',
  289. });
  290. api.push({
  291. alias: 'WeatherControllerWeb',
  292. order: '21',
  293. link: '',
  294. desc: '',
  295. list: []
  296. })
  297. api[20].list.push({
  298. order: '1',
  299. desc: '',
  300. });
  301. api.push({
  302. alias: 'dict',
  303. order: '22',
  304. link: 'dict_list',
  305. desc: '数据字典',
  306. list: []
  307. })
  308. document.onkeydown = keyDownSearch;
  309. function keyDownSearch(e) {
  310. const theEvent = e;
  311. const code = theEvent.keyCode || theEvent.which || theEvent.charCode;
  312. if (code == 13) {
  313. const search = document.getElementById('search');
  314. const searchValue = search.value;
  315. let searchArr = [];
  316. for (let i = 0; i < api.length; i++) {
  317. let apiData = api[i];
  318. const desc = apiData.desc;
  319. if (desc.indexOf(searchValue) > -1) {
  320. searchArr.push({
  321. order: apiData.order,
  322. desc: apiData.desc,
  323. link: apiData.link,
  324. list: apiData.list
  325. });
  326. } else {
  327. let methodList = apiData.list || [];
  328. let methodListTemp = [];
  329. for (let j = 0; j < methodList.length; j++) {
  330. const methodData = methodList[j];
  331. const methodDesc = methodData.desc;
  332. if (methodDesc.indexOf(searchValue) > -1) {
  333. methodListTemp.push(methodData);
  334. break;
  335. }
  336. }
  337. if (methodListTemp.length > 0) {
  338. const data = {
  339. order: apiData.order,
  340. desc: apiData.desc,
  341. link: apiData.link,
  342. list: methodListTemp
  343. };
  344. searchArr.push(data);
  345. }
  346. }
  347. }
  348. let html;
  349. if (searchValue == '') {
  350. const liClass = "";
  351. const display = "display: none";
  352. html = buildAccordion(api,liClass,display);
  353. document.getElementById('accordion').innerHTML = html;
  354. } else {
  355. const liClass = "open";
  356. const display = "display: block";
  357. html = buildAccordion(searchArr,liClass,display);
  358. document.getElementById('accordion').innerHTML = html;
  359. }
  360. const Accordion = function (el, multiple) {
  361. this.el = el || {};
  362. this.multiple = multiple || false;
  363. const links = this.el.find('.dd');
  364. links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown);
  365. };
  366. Accordion.prototype.dropdown = function (e) {
  367. const $el = e.data.el;
  368. $this = $(this), $next = $this.next();
  369. $next.slideToggle();
  370. $this.parent().toggleClass('open');
  371. if (!e.data.multiple) {
  372. $el.find('.submenu').not($next).slideUp("20").parent().removeClass('open');
  373. }
  374. };
  375. new Accordion($('#accordion'), false);
  376. }
  377. }
  378. function buildAccordion(apiData, liClass, display) {
  379. let html = "";
  380. let doc;
  381. if (apiData.length > 0) {
  382. for (let j = 0; j < apiData.length; j++) {
  383. html += '<li class="'+liClass+'">';
  384. html += '<a class="dd" href="#_' + apiData[j].link + '">' + apiData[j].order + '.&nbsp;' + apiData[j].desc + '</a>';
  385. html += '<ul class="sectlevel2" style="'+display+'">';
  386. doc = apiData[j].list;
  387. for (let m = 0; m < doc.length; m++) {
  388. html += '<li><a href="#_' + apiData[j].order + '_' + doc[m].order + '_' + doc[m].desc + '">' + apiData[j].order + '.' + doc[m].order + '.&nbsp;' + doc[m].desc + '</a> </li>';
  389. }
  390. html += '</ul>';
  391. html += '</li>';
  392. }
  393. }
  394. return html;
  395. }