A8000
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.

264 lines
6.3 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
8 months ago
7 months ago
7 months ago
7 months ago
  1. import apiClient from '../../../utils/axios'
  2. export const setDateAndTime = async (data: any) => {
  3. try {
  4. const res = await apiClient.post(
  5. `/api/v1/app/DeviceSetting/setDateAndTime?datetime=${data}`,
  6. )
  7. return res.data
  8. } catch (error) {
  9. console.log('修改时间出错', error)
  10. }
  11. }
  12. // 设置设备温度
  13. export const setAllTemperature = async (data: any) => {
  14. try {
  15. const res = await apiClient.post(
  16. `/api/v1/app/DeviceSetting/setIncubateBoxTemperature?val=${data}`,
  17. )
  18. await apiClient.post(
  19. `/api/v1/app/DeviceSetting/setPlateBoxTemperature?val=${data}`,
  20. )
  21. return res.data
  22. } catch (error) {
  23. console.log('修改温度出错', error)
  24. }
  25. }
  26. export const setIncubateBoxTemperature = async (data: any) => {
  27. try {
  28. const res = await apiClient.post(
  29. `/api/v1/app/DeviceSetting/setIncubateBoxTemperature?val=${data}`,
  30. )
  31. return res.data
  32. } catch (error) {
  33. console.log('修改温度出错', error)
  34. }
  35. }
  36. export const setPlateBoxTemperature = async (data: any) => {
  37. try {
  38. const res = await apiClient.post(
  39. `/api/v1/app/DeviceSetting/setPlateBoxTemperature?val=${data}`,
  40. )
  41. return res.data
  42. } catch (error) {
  43. console.log('修改温度出错', error)
  44. }
  45. }
  46. // 设置语言
  47. export const setLanguage = async (language: 'zh_CN' | 'en_US') => {
  48. console.log('修改语言', language)
  49. try {
  50. const res = await apiClient.post(
  51. `/api/v1/app/DeviceSetting/setLanguage?val=${language}`,
  52. )
  53. return res.data
  54. } catch (error) {
  55. console.log('修改语言出错', error)
  56. }
  57. }
  58. export const setDHCP = async (enable: boolean) => {
  59. try {
  60. const res = await apiClient.post(
  61. `/api/v1/app/DeviceSetting/setDHCCP?val=${enable}`,
  62. )
  63. return res.data
  64. } catch (error) {
  65. console.log('修改DHCP出错', error)
  66. }
  67. }
  68. // data : number[]
  69. export const getTemperatureRange = async () => {
  70. try {
  71. const res = await apiClient.post(
  72. `/api/v1/app/DeviceSetting/getTemperatureAvailableRange`,
  73. )
  74. return res.data
  75. } catch (error) {
  76. console.log('修改DHCP出错', error)
  77. }
  78. }
  79. export const setLocalIP = async (ip: string) => {
  80. try {
  81. const res = await apiClient.post(
  82. `/api/v1/app/DeviceSetting/setLocalIp?val=${ip}`,
  83. )
  84. return res.data
  85. } catch (error) {
  86. console.log('修改localIP出错', error)
  87. }
  88. }
  89. // 设置自动打印报告
  90. export const setAutoPrint = async (data: any) => {
  91. try {
  92. const res = await apiClient.post(
  93. `/api/v1/app/DeviceSetting/setAutoPrint?val=${data}`,
  94. )
  95. return res.data
  96. } catch (error) {
  97. console.log('设置自动打印出错', error)
  98. }
  99. }
  100. // 设置自动登出
  101. export const setAutoLogout = async (data: boolean) => {
  102. try {
  103. const res = await apiClient.post(
  104. `/api/v1/app/DeviceSetting/setAutoLogout?val=${data}`,
  105. )
  106. return res.data
  107. } catch (error) {
  108. console.log('设置自动登出出错', error)
  109. }
  110. }
  111. export const setAutoLogoutTime = async (data: number) => {
  112. try {
  113. const res = await apiClient.post(
  114. `/api/v1/app/DeviceSetting/setAutoLogoutTimeout?val=${data}`,
  115. )
  116. return res.data
  117. } catch (error) {
  118. console.log('设置自动登出出错', error)
  119. }
  120. }
  121. //获取系统设置
  122. export const getSystemSettings = async () => {
  123. try {
  124. const res = await apiClient.post('/api/v1/app/DeviceSetting/getSetting')
  125. return res.data
  126. } catch (error) {
  127. console.log('获取系统设置出错', error)
  128. }
  129. }
  130. // LIS 相关
  131. export type LISType = 'SINGLE_TRACK' | 'DOUBLE_TRACK'
  132. export const LISTypeMap = {
  133. SINGLE_TRACK: '单向',
  134. DOUBLE_TRACK: '双向',
  135. }
  136. // 设置LIS类型
  137. export const setLISType = async (data: LISType) => {
  138. try {
  139. const res = await apiClient.post(
  140. `/api/v1/app/LISSetting/setLISType?val=${data}`,
  141. )
  142. return res.data
  143. } catch (error) {
  144. console.log('设置LIS类型出错', error)
  145. }
  146. }
  147. export type LISSerialBaudrate = 'B9600' | 'B12800' | 'B19200' | 'B115200'
  148. export const LISSerialBaudrateMap = {
  149. B9600: '9,600bps',
  150. B12800: '12,800bps',
  151. B19200: '19,200bps',
  152. B115200: '115,200bps',
  153. }
  154. // 设置LIS串口波特率
  155. export const setLISSerialBaudrate = async (data: LISSerialBaudrate) => {
  156. try {
  157. const res = await apiClient.post(
  158. `/api/v1/app/LISSetting/setLISSerialBaudrate?val=${data}`,
  159. data,
  160. )
  161. return res.data
  162. } catch (error) {
  163. console.log('设置LIS串口波特率出错', error)
  164. }
  165. }
  166. export type LISProtocol = 'Boditech' | 'Simens'
  167. // 设置LIS协议
  168. export const setLISProtocol = async (data: LISProtocol) => {
  169. try {
  170. const res = await apiClient.post(
  171. `/api/v1/app/LISSetting/setLISProtocol?val=${data}`,
  172. )
  173. return res.data
  174. } catch (error) {
  175. console.log('设置LIS协议出错', error)
  176. }
  177. }
  178. // 设置LIS端口
  179. export const setLISNetPort = async (data: number | string) => {
  180. try {
  181. const res = await apiClient.post(
  182. `/api/v1/app/LISSetting/setLISNetPort?val=${data}`,
  183. )
  184. return res.data
  185. } catch (error) {
  186. console.log('设置LIS端口出错', error)
  187. }
  188. }
  189. // 设置LIS IP
  190. export const setLISNetIp = async (data: string) => {
  191. try {
  192. const res = await apiClient.post(
  193. `/api/v1/app/LISSetting/setLISNetIp?val=${data}`,
  194. )
  195. return res.data
  196. } catch (error) {
  197. console.log('设置LIS IP出错', error)
  198. }
  199. }
  200. // 设置LIS是否自动上传报告
  201. export const setLISAutoExport = async (data: boolean) => {
  202. try {
  203. const res = await apiClient.post(
  204. `/api/v1/app/LISSetting/setLISAutoExport?val=${data}`,
  205. )
  206. return res.data
  207. } catch (error) {
  208. console.log('设置LIS自动上传出错', error)
  209. }
  210. }
  211. export type LISInterface = 'SERIAL' | 'NETWORK'
  212. export const LISInterfaceMap = {
  213. SERIAL: 'Serial',
  214. NETWORK: 'TCP/IP',
  215. }
  216. // 设置LIS接口
  217. export const setLISInterface = async (data: LISInterface) => {
  218. try {
  219. const res = await apiClient.post(
  220. `/api/v1/app/LISSetting/setLIFIf?val=${data}`,
  221. )
  222. return res.data
  223. } catch (error) {
  224. console.log('设置LIS接口出错', error)
  225. }
  226. }
  227. export type LISSettings = {
  228. LISType: LISType
  229. LISProtocol: LISProtocol
  230. LIFIf: LISInterface
  231. LISAutoExport: boolean
  232. LISSerialBaudrate: LISSerialBaudrate
  233. LISNetIp: string
  234. LISNetPort: number
  235. }
  236. export const getLISSetting = async () => {
  237. try {
  238. const res = await apiClient.post(`/api/v1/app/LISSetting/getSetting`)
  239. return res.data
  240. } catch (error) {
  241. console.log('设置LIS配置出错', error)
  242. }
  243. }