api.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. import { http } from "@/common/service/service.js";
  2. import configService from "@/common/service/config.service.js";
  3. import buildURL from "@/common/luch-request/helpers/buildURL.js";
  4. import {AesEncryption, getLoginCipher} from "@/common/util/cipher.js";
  5. const apiService = {
  6. /**
  7. * 登录
  8. */
  9. login(params) {
  10. return http.post("/sys/mLogin", params);
  11. },
  12. /**
  13. * 获取权限菜单
  14. */
  15. getPermission(params) {
  16. return http.get("/sys/permissionNew/getUserPermissionByToken", params);
  17. },
  18. /**
  19. * 单点登录
  20. */
  21. // validateCasLogin(params) {
  22. // var index = 0;
  23. // var url = "/sys/cas/client/validateLogin";
  24. // for(var w in params){
  25. // if(index == 0)
  26. // url = url+"?"+w+"="+params[w];
  27. // else
  28. // url = url+"&"+w+"="+params[w];
  29. // index++;
  30. // }
  31. // return http.get(url);
  32. // },
  33. validateCasLogin(to,params) {
  34. var url = to+"/sys/cas/client/validateLogin"+params;
  35. // var index = 0;
  36. // var url = "/sys/cas/client/validateLogin";
  37. // for(var w in params){
  38. // if(index == 0)
  39. // url = url+"?"+w+"="+params[w];
  40. // else
  41. // url = url+"&"+w+"="+params[w];
  42. // index++;
  43. // }
  44. console.log("validateCasLogin url============"+url)
  45. return http.get(url,{});
  46. },
  47. /**
  48. * 手机号码登录
  49. */
  50. phoneNoLogin(params) {
  51. return http.post("/sys/phoneLogin", params);
  52. },
  53. /**
  54. * 退出
  55. */
  56. logout(params) {
  57. return http.post("/sys/logout", params);
  58. },
  59. // 按系统查询设备分类信息
  60. getDeviceType(params) {
  61. return http.get(
  62. "/safety/ventanalyDeviceInfo/DeviceKind/queryBySystem",
  63. params
  64. );
  65. },
  66. // 查询各类设备的列表表头信息
  67. getShowColum(params) {
  68. return http.get("/safety/ventanalyShowColum/show_colum", params);
  69. },
  70. // 获取工作面煤层下拉选项
  71. getDictItems(params) {
  72. const url = buildURL(
  73. "/sys/api/getDictItems",
  74. params
  75. );
  76. return http.get(url);
  77. },
  78. // 按系统查询设备监测信息
  79. getDeviceMonitor(params) {
  80. return http.post("/monitor/device", params);
  81. },
  82. //查询分页列表信息 通过分类查询 各类设备在app上是否展示的字段
  83. getShowColumList(params) {
  84. // const urlParams = new URLSearchParams(params);
  85. // const url = "/safety/ventanalyShowColum/list?" + urlParams.toString();
  86. const url = buildURL("/safety/ventanalyShowColum/list", params);
  87. return http.get(url);
  88. },
  89. //设备控制
  90. controlDevice(params) {
  91. // 密码加密
  92. const loginCipher = getLoginCipher()
  93. const encryption = new AesEncryption({ key: loginCipher.key, iv: loginCipher.iv });
  94. params.password = encryption.encryptByAES(params.password);
  95. return http.put(
  96. "/ventanaly-device/safety/ventanalyMonitorData/devicecontrol",
  97. params
  98. );
  99. },
  100. //根据设备id 查询该设备关联的视频流url
  101. getCameraById(params) {
  102. // const urlParams = new URLSearchParams(params);
  103. // const url = "/safety/ventanalyCamera/list?" + urlParams.toString();
  104. const url = buildURL("/safety/ventanalyCamera/list", params);
  105. return http.get(url);
  106. },
  107. //如果上面这个接口返回code码 则使用这个接口获取url
  108. getCameraByCode(params) {
  109. // const urlParams = new URLSearchParams(params);
  110. // const url =
  111. // "/ventanaly-device/camera/queryByCameraCode?" + urlParams.toString();
  112. const url = buildURL("/ventanaly-device/camera/queryByCameraCode", params);
  113. return http.get(url);
  114. },
  115. //瓦斯日报列表数据
  116. getGas(params) {
  117. const url = buildURL(
  118. "/safety/gasDayReport/list",
  119. params
  120. );
  121. return http.get(url);
  122. },
  123. //瓦斯日报-下拉选项
  124. getSelect(params) {
  125. const url = buildURL(
  126. "/safety/gasDayReport/getGasAddressList",
  127. params
  128. );
  129. return http.get(url);
  130. },
  131. //瓦斯日报-新增保存
  132. getAdd(params) {
  133. return http.post("/safety/gasDayReport/add", params);
  134. },
  135. //瓦斯日报-编辑保存
  136. getEdit(params) {
  137. return http.post("/safety/gasDayReport/edit", params);
  138. },
  139. //瓦斯日报-删除
  140. delGas(params) {
  141. const url = buildURL("/safety/gasDayReport/delete", params);
  142. return http.delete(url);
  143. },
  144. //获取设备历史数据
  145. getDeviceHistory(params) {
  146. const url = buildURL(
  147. "/ventanaly-device/safety/ventanalyMonitorData/listdays",
  148. params
  149. );
  150. return http.get(url);
  151. },
  152. //获取操作历史
  153. getOpreateHistory(params) {
  154. const url = buildURL(
  155. "/ventanaly-device/safety/ventanalyDevicesetLog/list",
  156. params
  157. );
  158. return http.get(url);
  159. },
  160. //获取文件数据
  161. getFileInfo(params) {
  162. return http.post("/ventanaly-sharefile/fileServer/list", params);
  163. },
  164. //获取预警信息
  165. getWarnInfo(params) {
  166. return http.get("/safety/ventanalyAlarmLog/total", params);
  167. },
  168. //获取通风预警监测详情tab信息
  169. sysTypeWarn(params) {
  170. return http.post("/ventanaly-device/safety/ventanalyAlarmLog/sysTypeWarn", params);
  171. },
  172. //获取通风预警监测详情信息
  173. sysWarn(params) {
  174. return http.post("/ventanaly-device/safety/ventanalyAlarmLog/sysWarn", params);
  175. },
  176. //获取通风预警监测详情信息
  177. getDeviceVent(params) {
  178. return http.post("/ventanaly-device/monitor/device", params);
  179. },
  180. //获取设备预警实时监测数据
  181. warningList(params) {
  182. const url = buildURL("/safety/ventanalyAlarmLog/now_alarmlist", params);
  183. return http.get(url);
  184. },
  185. //获取设备预警历史监测数据
  186. historyList(params) {
  187. const url = buildURL("/safety/ventanalyAlarmLog/list", params);
  188. return http.get(url);
  189. },
  190. getFilePreview(params) {
  191. return http.post("/ventanaly-sharefile/fileServer/preview", params);
  192. },
  193. // 下载文件
  194. downloadFile(params) {
  195. return http.post("/ventanaly-sharefile/fileServer/download", params);
  196. },
  197. // 删除文件
  198. delateFile(params) {
  199. const url = buildURL("/ventanaly-sharefile/fileServer/delete", params);
  200. return http.delete(url);
  201. },
  202. //提交文件
  203. commitFile(params) {
  204. const url = buildURL("/safety/actBusiness/commit", params);
  205. return http.post(url);
  206. },
  207. // 撤回文件
  208. cancelFile(params) {
  209. const url = buildURL("/safety/actBusiness/cancelNew", params);
  210. return http.post(url);
  211. },
  212. // 审批流程
  213. getListFile(params) {
  214. const url = buildURL("/activiti/activiti_process/listData", params);
  215. return http.get(url);
  216. },
  217. //审批进度
  218. gethistoricFlowNew(params) {
  219. const url = buildURL("/safety/actTask/historicFlowNew", params);
  220. return http.get(url);
  221. },
  222. //通过id(巡检卡id)查询
  223. getCardList(params) {
  224. const url = buildURL("/safety/gasInsCard/queryByIdApp", params);
  225. return http.get(url);
  226. },
  227. //nfc卡ID校验
  228. enterCardId(params) {
  229. const url = buildURL("/safety/gasInsCard/enterCardId", params);
  230. return http.get(url);
  231. },
  232. // 获取瓦斯巡检任务统计情况
  233. queryNowGasInfoByUser(params) {
  234. const url = buildURL("/safety/gasInsCard/queryNowGasInfoByUser", params);
  235. return http.post(url);
  236. },
  237. //审批进度
  238. gethistoricFlowNew(params) {
  239. const url = buildURL("/safety/actTask/historicFlowNew", params);
  240. return http.get(url);
  241. },
  242. /**
  243. * 获取文件访问路径
  244. * @param avatar
  245. * @param subStr
  246. * @returns {*}
  247. */
  248. getFileAccessHttpUrl(avatar, subStr) {
  249. if (!subStr) subStr = "http";
  250. if (avatar && avatar.startsWith(subStr)) {
  251. return avatar;
  252. } else {
  253. return configService.staticDomainURL + "/" + avatar;
  254. }
  255. },
  256. };
  257. export default apiService;