HMC.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. let str = '';
  2. function geturl() {
  3. x_admin_show(
  4. "在线查看",
  5. encodeURI(
  6. "../admin/look.html"
  7. ),
  8. 1300,
  9. 600,
  10. );
  11. }
  12. $(function() {
  13. var storage = window.localStorage;
  14. let user = window.localStorage.getItem('user');
  15. let userInfo = JSON.parse(user);
  16. let type = '';
  17. let a = true
  18. let b = true
  19. let c = true
  20. $('.search-type span').click((e) => {
  21. // console.log(e.target.id)
  22. type = e.target.id;
  23. $('.search-type span').css({
  24. color: 'black',
  25. // borderBottom: 'black'
  26. });
  27. e.target.style.color = '#09c'
  28. // e.target.style.borderBottom = '1px solid #09c'
  29. })
  30. $('.searchBtn').click(() => {
  31. if ($('.searchInput').val() == "") {} else {
  32. $("#bot").css({
  33. display: 'block'
  34. })
  35. $('.search-box').addClass('search-box-toLeft');
  36. $('.search-data').css({
  37. display: 'block'
  38. });
  39. const data = {
  40. type: type,
  41. keyword: $('.searchInput').val()
  42. };
  43. $.ajax({
  44. type: "get",
  45. url: urlBase + "api/common/find",
  46. async: true,
  47. data: data,
  48. headers: {
  49. // token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIn0.Oik3R7IxeUi9v9d0C7kvFd2gF_xSu4WjspKKeXy3dGw"
  50. token: sessionStorage.getItem('token')
  51. },
  52. success: res => {
  53. if (res.status == 0) {
  54. $('.search-data-list').html();
  55. let data = res.data;
  56. // console.log(data)
  57. let str = '';
  58. var name, path,major,type,system;
  59. let allData = [];
  60. for (var index in data) {
  61. // console.log(index)
  62. for (var i = 0; i < data[index].data.length; i++) {
  63. cData = data[index].data;
  64. // console.log(cData)
  65. if (index == 'repairManual') {
  66. name = cData[i].manual_name;
  67. major = cData[i].major;
  68. type = cData[i].aircraft;
  69. system = cData[i].manual_system;
  70. } else if (index == 'faultRecord') {
  71. name = cData[i].device_name;
  72. major = cData[i].major;
  73. type = cData[i].aircraft_type;
  74. system = cData[i].faultparts_system;
  75. }
  76. var fileType;
  77. var fileType;
  78. var file_path = cData[i].file_path;
  79. sessionStorage.setItem("url1",file_path)
  80. // str += '<li class="search-data-item"><a href=""></a></li>'
  81. str +='<li class="search-data-item"><a href=javascript:geturl()>' + name +'</a><p>机型:<span>' + type +'</span></p><p>专业:<span>' + major +'</span></p><p>系统:<span>' + system +'</span></p></li>'
  82. // console.log(str)
  83. }
  84. }
  85. $('.search-data-list').html(str)
  86. } else {
  87. alert(res.msg);
  88. }
  89. },
  90. error: xhr => {
  91. // console.log(xhr)
  92. }
  93. });
  94. }
  95. });
  96. })