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.

447 lines
12 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <script setup lang="ts">
  2. import { FtMessage } from 'libs/message'
  3. import { sendControl } from 'libs/utils'
  4. import { reactive } from 'vue'
  5. const form = reactive({
  6. x: {
  7. current: undefined,
  8. position: undefined,
  9. speed: undefined,
  10. direction: 'forward',
  11. },
  12. y: {
  13. current: undefined,
  14. position: undefined,
  15. speed: undefined,
  16. direction: 'forward',
  17. },
  18. z: {
  19. current: undefined,
  20. position: undefined,
  21. speed: undefined,
  22. direction: 'forward',
  23. },
  24. direction: 'forward',
  25. speed: undefined,
  26. voltage: undefined,
  27. })
  28. const motorMove = async (device: 'x' | 'y' | 'z') => {
  29. if (!form[device].position || !form[device].speed) {
  30. FtMessage.error('请补全参数')
  31. return
  32. }
  33. const params = {
  34. cmdCode: { x: 'motor_x_to_position', y: 'motor_y_to_position', z: 'motor_z_to_position' }[device],
  35. cmdId: '',
  36. params: form[device],
  37. }
  38. await sendControl(params, 'debug')
  39. }
  40. const motorStop = async (device: 'x' | 'y' | 'z') => {
  41. const params = {
  42. cmdCode: { x: 'motor_x_stop', y: 'motor_y_stop', z: 'motor_z_stop' }[device],
  43. cmdId: '',
  44. params: form[device],
  45. }
  46. await sendControl(params, 'debug')
  47. }
  48. const motorToHome = async (device: 'x' | 'y' | 'z') => {
  49. const params = {
  50. cmdCode: { x: 'motor_x_origin', y: 'motor_y_origin', z: 'motor_z_origin' }[device],
  51. cmdId: '',
  52. params: form[device],
  53. }
  54. await sendControl(params, 'debug')
  55. }
  56. const threeWayValveOpenSyringePipeline = async () => {
  57. const params = {
  58. cmdCode: 'three_way_valve_open_syringe_pipeline',
  59. cmdId: '',
  60. }
  61. await sendControl(params, 'debug')
  62. }
  63. const threeWayValveOpenNozzlePipeline = async () => {
  64. const params = {
  65. cmdCode: 'three_way_valve_open_nozzle_pipeline',
  66. cmdId: '',
  67. }
  68. await sendControl(params, 'debug')
  69. }
  70. const threeWayValveCloseAll = async () => {
  71. const params = {
  72. cmdCode: 'three_way_valve_close_all',
  73. cmdId: '',
  74. }
  75. await sendControl(params, 'debug')
  76. }
  77. const lightingPanelOpen = async () => {
  78. const params = {
  79. cmdCode: 'lighting_panel_open',
  80. cmdId: '',
  81. }
  82. await sendControl(params, 'debug')
  83. }
  84. const lightingPanelClose = async () => {
  85. const params = {
  86. cmdCode: 'lighting_panel_close',
  87. cmdId: '',
  88. }
  89. await sendControl(params, 'debug')
  90. }
  91. const washValveOpen = async () => {
  92. const params = {
  93. cmdCode: 'wash_valve_open',
  94. cmdId: '',
  95. }
  96. await sendControl(params, 'debug')
  97. }
  98. const washValveClose = async () => {
  99. const params = {
  100. cmdCode: 'wash_valve_close',
  101. cmdId: '',
  102. }
  103. await sendControl(params, 'debug')
  104. }
  105. const nozzleValveOpen = async () => {
  106. const params = {
  107. cmdCode: 'nozzle_valve_open',
  108. cmdId: '',
  109. }
  110. await sendControl(params, 'debug')
  111. }
  112. const nozzleValveClose = async () => {
  113. const params = {
  114. cmdCode: 'nozzle_valve_close',
  115. cmdId: '',
  116. }
  117. await sendControl(params, 'debug')
  118. }
  119. const dehumidifierValveOpen = async () => {
  120. const params = {
  121. cmdCode: 'dehumidifier_valve_open',
  122. cmdId: '',
  123. }
  124. await sendControl(params, 'debug')
  125. }
  126. const dehumidifierValveClose = async () => {
  127. const params = {
  128. cmdCode: 'dehumidifier_valve_close',
  129. cmdId: '',
  130. }
  131. await sendControl(params, 'debug')
  132. }
  133. const syringePumpInjectionVolumeSet = async () => {
  134. if (!form.speed) {
  135. FtMessage.error('请输入注射泵速度')
  136. return
  137. }
  138. const params = {
  139. cmdCode: 'syringe_pump_start',
  140. cmdId: '',
  141. params: {
  142. direction: form.direction,
  143. speed: form.speed,
  144. },
  145. }
  146. await sendControl(params, 'debug')
  147. }
  148. const syringePumpStop = async () => {
  149. const params = {
  150. cmdCode: 'syringe_pump_stop',
  151. cmdId: '',
  152. }
  153. await sendControl(params, 'debug')
  154. }
  155. const highVoltageOpen = async () => {
  156. if (!form.voltage) {
  157. FtMessage.error('请输入电压值')
  158. return
  159. }
  160. if (form.voltage > 6000) {
  161. FtMessage.error('电压值最大为6000V')
  162. return
  163. }
  164. const params = {
  165. cmdCode: 'high_voltage_open',
  166. cmdId: '',
  167. params: {
  168. voltage: form.voltage,
  169. },
  170. }
  171. await sendControl(params, 'debug')
  172. }
  173. const highVoltageClose = async () => {
  174. const params = {
  175. cmdCode: 'high_voltage_close',
  176. cmdId: '',
  177. }
  178. await sendControl(params, 'debug')
  179. }
  180. </script>
  181. <template>
  182. <div>
  183. <el-card>
  184. <el-form label-width="auto" label-suffix=":">
  185. <el-form-item label="X轴">
  186. <div style="display: flex; align-items: center;margin: 5px 0">
  187. <div style="margin: 0 5px">
  188. <span>移动</span>
  189. <el-input v-model="form.x.position" style="width: 100px" type="number" />
  190. <span>mm</span>
  191. </div>
  192. <div style="margin: 0 5px">
  193. <span>速度</span>
  194. <el-input v-model="form.x.speed" style="width: 100px" type="number" />
  195. <span>mm/s</span>
  196. </div>
  197. <el-radio-group v-model="form.x.direction" style="margin: 10px">
  198. <div style="display: flex">
  199. <el-radio value="forward">
  200. 前进
  201. </el-radio>
  202. <el-radio value="backward">
  203. 后退
  204. </el-radio>
  205. </div>
  206. </el-radio-group>
  207. <ft-button type="primary" :click-handle="() => motorMove('x')">
  208. 执行
  209. </ft-button>
  210. <ft-button type="primary" :click-handle="() => motorStop('x')">
  211. 停止
  212. </ft-button>
  213. <ft-button :click-handle="() => motorToHome('x')">
  214. 回原点
  215. </ft-button>
  216. </div>
  217. </el-form-item>
  218. <el-form-item label="Y轴">
  219. <div style="display: flex; align-items: center;margin: 5px 0">
  220. <div style="margin: 0 5px">
  221. <span>移动</span>
  222. <el-input v-model="form.y.position" style="width: 100px" type="number" />
  223. <span>mm</span>
  224. </div>
  225. <div style="margin: 0 5px">
  226. <span>速度</span>
  227. <el-input v-model="form.y.speed" style="width: 100px" type="number" />
  228. <span>mm/s</span>
  229. </div>
  230. <el-radio-group v-model="form.y.direction" style="margin: 10px">
  231. <div style="display: flex">
  232. <el-radio value="forward">
  233. 前进
  234. </el-radio>
  235. <el-radio value="backward">
  236. 后退
  237. </el-radio>
  238. </div>
  239. </el-radio-group>
  240. <ft-button type="primary" :click-handle="() => motorMove('y')">
  241. 执行
  242. </ft-button>
  243. <ft-button type="primary" :click-handle="() => motorStop('y')">
  244. 停止
  245. </ft-button>
  246. <ft-button :click-handle="() => motorToHome('y')">
  247. 回原点
  248. </ft-button>
  249. </div>
  250. </el-form-item>
  251. <el-form-item label="Z轴">
  252. <div style="display: flex; align-items: center;margin: 5px 0">
  253. <div style="margin: 0 5px">
  254. <span>移动</span>
  255. <el-input v-model="form.z.position" style="width: 100px" type="number" />
  256. <span>mm</span>
  257. </div>
  258. <div style="margin: 0 5px">
  259. <span>速度</span>
  260. <el-input v-model="form.z.speed" style="width: 100px" type="number" />
  261. <span>mm/s</span>
  262. </div>
  263. <el-radio-group v-model="form.z.direction" style="margin: 10px">
  264. <div style="display: flex">
  265. <el-radio value="forward">
  266. 前进
  267. </el-radio>
  268. <el-radio value="backward">
  269. 后退
  270. </el-radio>
  271. </div>
  272. </el-radio-group>
  273. <ft-button type="primary" :click-handle="() => motorMove('z')">
  274. 执行
  275. </ft-button>
  276. <ft-button type="primary" :click-handle="() => motorStop('z')">
  277. 停止
  278. </ft-button>
  279. <ft-button :click-handle="() => motorToHome('z')">
  280. 回原点
  281. </ft-button>
  282. </div>
  283. </el-form-item>
  284. </el-form>
  285. </el-card>
  286. <el-card>
  287. <el-form label-width="auto" label-suffix=":">
  288. <el-form-item label="注射泵">
  289. <div style="display: flex; align-items: center; margin: 5px 0">
  290. <el-input v-model="form.speed" type="number" style="width: 100px;" />
  291. <span>ul/min</span>
  292. <el-radio-group v-model="form.direction" style="margin: 10px">
  293. <div style="display: flex">
  294. <el-radio value="forward">
  295. 前进
  296. </el-radio>
  297. <el-radio value="backward">
  298. 后退
  299. </el-radio>
  300. </div>
  301. </el-radio-group>
  302. <ft-button type="primary" style="margin-left: 10px" :click-handle="syringePumpInjectionVolumeSet">
  303. 开始
  304. </ft-button>
  305. <ft-button :click-handle="syringePumpStop">
  306. 停止
  307. </ft-button>
  308. </div>
  309. </el-form-item>
  310. <el-form-item label="电压控制器">
  311. <div style="display: flex; align-items: center; margin: 5px 0">
  312. <el-input v-model="form.voltage" type="number" style="width: 100px;" />
  313. <span>V</span>
  314. <ft-button type="primary" style="margin-left: 10px" :click-handle="highVoltageOpen">
  315. 开启
  316. </ft-button>
  317. <ft-button :click-handle="highVoltageClose">
  318. 关闭
  319. </ft-button>
  320. </div>
  321. </el-form-item>
  322. </el-form>
  323. </el-card>
  324. <el-row :gutter="20">
  325. <el-col :span="12">
  326. <el-card style="display: flex;justify-content: center">
  327. <ft-button type="primary" :click-handle="lightingPanelOpen">
  328. 开启照明灯
  329. </ft-button>
  330. <ft-button :click-handle="lightingPanelClose">
  331. 关闭照明灯
  332. </ft-button>
  333. <div style="margin-top: 10px;display: flex;justify-content: center">
  334. <ft-button type="primary" :click-handle="threeWayValveOpenSyringePipeline">
  335. 打开喷嘴管路
  336. </ft-button>
  337. <ft-button type="primary" :click-handle="threeWayValveOpenNozzlePipeline">
  338. 打开注射器管路
  339. </ft-button>
  340. <ft-button :click-handle="threeWayValveCloseAll">
  341. 全部关闭
  342. </ft-button>
  343. </div>
  344. </el-card>
  345. </el-col>
  346. <el-col :span="12">
  347. <el-card style="display: flex;justify-content: center">
  348. <ft-button type="primary" :click-handle="washValveOpen">
  349. 打开清洗阀
  350. </ft-button>
  351. <ft-button type="primary" :click-handle="nozzleValveOpen">
  352. 打开喷嘴阀
  353. </ft-button>
  354. <ft-button type="primary" :click-handle="dehumidifierValveOpen">
  355. 打开除湿阀
  356. </ft-button>
  357. <div style="margin-top: 10px;display: flex;justify-content: center">
  358. <ft-button :click-handle="washValveClose">
  359. 关闭清洗阀
  360. </ft-button>
  361. <ft-button :click-handle="nozzleValveClose">
  362. 关闭喷嘴阀
  363. </ft-button>
  364. <ft-button :click-handle="dehumidifierValveClose">
  365. 关闭除湿阀
  366. </ft-button>
  367. </div>
  368. </el-card>
  369. </el-col>
  370. </el-row>
  371. </div>
  372. </template>
  373. <style scoped lang="scss">
  374. .el-card {
  375. margin: 30px 0;
  376. border-radius: 20px;
  377. color: var(--el-color-primary);
  378. }
  379. :deep(.el-card__body) {
  380. padding: 50px;
  381. }
  382. .card-header {
  383. display: flex;
  384. align-items: center;
  385. }
  386. .num-box {
  387. margin: 0 20px;
  388. width: 50px;
  389. height: 50px;
  390. border-radius: 50%;
  391. background: var(--el-color-primary);
  392. font-size: 30px;
  393. color: #ffffff;
  394. display: flex;
  395. justify-content: center;
  396. align-items: center;
  397. }
  398. .button-footer {
  399. display: flex;
  400. justify-content: flex-end;
  401. margin: 50px;
  402. }
  403. .hint-text {
  404. display: flex;
  405. height: 400px;
  406. flex-direction: column;
  407. justify-content: center;
  408. align-items: center;
  409. font-size: 50px;
  410. color: var(--el-color-primary);
  411. }
  412. .num-text {
  413. color: var(--el-color-primary);
  414. font-weight: 900;
  415. font-size: 70px;
  416. }
  417. :deep(.el-form-item) {
  418. --font-size: 40px;
  419. margin-bottom: 10px
  420. }
  421. .el-input {
  422. margin: 0 15px
  423. }
  424. </style>