消毒机设备
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.

102 lines
2.6 KiB

  1. import { debugControl } from 'apis/system'
  2. import { FtMessage } from 'libs/message'
  3. import { cmdNameMap } from 'libs/utils'
  4. import { defineStore } from 'pinia'
  5. import { useSystemStore } from 'stores/systemStore'
  6. export const useDebugStore = defineStore('debug', {
  7. state: (): Debug.DebugStore => ({
  8. formData: {
  9. // 加液机械臂
  10. liquidArmData: {
  11. largeArmAngle: undefined,
  12. smallArmAngle: undefined,
  13. largeArmRotationVelocity: undefined,
  14. smallArmRotationVelocity: undefined,
  15. },
  16. // 加液泵
  17. liquidPumpData: {
  18. index: undefined,
  19. // direction: 'forward',
  20. volume: 20,
  21. velocity: 3,
  22. },
  23. // 摇匀速度
  24. shakeSpeed: {
  25. velocity: undefined,
  26. },
  27. // 加热区
  28. heatArea: {
  29. index: 'heat_module_01',
  30. heatMotorData: {
  31. distance: undefined,
  32. velocity: undefined,
  33. times: undefined,
  34. },
  35. heatTemperature: {
  36. temperature: undefined,
  37. },
  38. coldTrap: {
  39. temperature: undefined,
  40. },
  41. },
  42. // 转运模组
  43. transferModule: {
  44. // X轴
  45. xMotorData: {
  46. xDimDistance: undefined,
  47. xDimVelocity: undefined,
  48. times: undefined,
  49. direction: 'backward',
  50. },
  51. // y轴
  52. yMotorData: {
  53. yDimDistance: undefined,
  54. yDimVelocity: undefined,
  55. times: undefined,
  56. direction: 'backward',
  57. },
  58. // z轴
  59. zMotorData: {
  60. zDimDistance: undefined,
  61. zDimVelocity: undefined,
  62. times: undefined,
  63. direction: 'forward',
  64. },
  65. // 夹爪
  66. JawData: {
  67. velocity: undefined,
  68. openDistance: undefined,
  69. closeDistance: undefined,
  70. times: undefined,
  71. },
  72. },
  73. // 拍子模组
  74. lidData: {
  75. velocity: undefined,
  76. distance: undefined,
  77. },
  78. },
  79. }),
  80. actions: {
  81. async sendControl(params: System.CmdControlParams<{ [key: string]: any }>) {
  82. if (!params.commandId) {
  83. params.commandId = Date.now().toString()
  84. }
  85. const systemStore = useSystemStore()
  86. systemStore.systemList = []
  87. // 提取 params.command 中的 xxx 部分
  88. const commandKey = params.command.replace(/^debug_/, '')
  89. // 使用提取的 key 匹配 cmdNameMap
  90. const cmdName = cmdNameMap[commandKey as keyof typeof cmdNameMap] || params.command
  91. await debugControl(params)
  92. systemStore.updateStreamVisible(true)
  93. FtMessage.success(`[${cmdName}]已发送`)
  94. },
  95. },
  96. persist: true,
  97. })