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.

291 lines
9.3 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. import { logout } from 'apis/login'
  2. import { delToken } from 'libs/token'
  3. import { defineStore } from 'pinia'
  4. import router from '@/router'
  5. export const useSystemStore = defineStore('system', {
  6. state: (): System.SystemStore => ({
  7. systemStatus: {
  8. virtual: false,
  9. initComplete: true,
  10. selfTest: true,
  11. emergencyStop: false,
  12. currentUser: {
  13. id: 1,
  14. username: 'admin',
  15. nickname: '管理员',
  16. fixedUser: 'ENABLE',
  17. },
  18. currentTasks: null,
  19. doorModule: {
  20. open: false,
  21. },
  22. transferModule: {
  23. idle: true,
  24. trayStatus: false,
  25. },
  26. solutionModule: {
  27. idle: true,
  28. feedAreaTrayStatus: false,
  29. pumping: false,
  30. valveState: {
  31. state: 1,
  32. },
  33. solutionContainer: [
  34. {
  35. containerCode: 1,
  36. type: 'solution',
  37. empty: false,
  38. full: false,
  39. filledSolution: false,
  40. },
  41. {
  42. containerCode: 2,
  43. type: 'solution',
  44. empty: false,
  45. full: false,
  46. filledSolution: false,
  47. },
  48. {
  49. containerCode: 3,
  50. type: 'solution',
  51. empty: false,
  52. full: false,
  53. filledSolution: false,
  54. },
  55. {
  56. containerCode: 4,
  57. type: 'solution',
  58. empty: false,
  59. full: false,
  60. filledSolution: false,
  61. },
  62. ],
  63. },
  64. heatModule: [
  65. {
  66. moduleCode: 'heat_module_01',
  67. enable: true,
  68. trayStatus: true,
  69. heatingType: 'heating',
  70. fanOpen: false,
  71. targetTemperature: 0,
  72. temperature: 0,
  73. startHeatTime: 1749126403564,
  74. targetTime: 1800,
  75. },
  76. {
  77. moduleCode: 'heat_module_02',
  78. enable: true,
  79. trayStatus: true,
  80. heatingType: 'stop',
  81. fanOpen: true,
  82. dryTemperature: 0,
  83. annealTemperature: 0,
  84. heatTemperature: 0,
  85. targetTemperature: 0,
  86. temperature: 0,
  87. },
  88. {
  89. moduleCode: 'heat_module_03',
  90. enable: true,
  91. trayStatus: true,
  92. heatingType: 'drying',
  93. fanOpen: false,
  94. dryTemperature: 0,
  95. annealTemperature: 0,
  96. heatTemperature: 0,
  97. targetTemperature: 0,
  98. temperature: 0,
  99. },
  100. {
  101. moduleCode: 'heat_module_04',
  102. enable: true,
  103. trayStatus: true,
  104. heatingType: 'annealing',
  105. fanOpen: false,
  106. dryTemperature: 0,
  107. annealTemperature: 0,
  108. heatTemperature: 0,
  109. targetTemperature: 0,
  110. temperature: 0,
  111. },
  112. ],
  113. trays: [
  114. {
  115. uuid: '22',
  116. heatModuleCode: 'heat_module_01',
  117. inFeedArea: false,
  118. inSolutionPositon: false,
  119. inHeatModule: true,
  120. useArm: true,
  121. tubes: [
  122. {
  123. columnNum: 1,
  124. addSolution: true,
  125. exists: true,
  126. },
  127. {
  128. columnNum: 2,
  129. addSolution: true,
  130. exists: true,
  131. },
  132. {
  133. columnNum: 3,
  134. addSolution: true,
  135. exists: false,
  136. },
  137. {
  138. columnNum: 4,
  139. addSolution: true,
  140. exists: true,
  141. },
  142. {
  143. columnNum: 5,
  144. addSolution: true,
  145. exists: true,
  146. },
  147. ],
  148. crafts: {
  149. craft: {
  150. id: 1,
  151. name: '菱锌矿硫酸溶解法',
  152. steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
  153. },
  154. state: 'RUNNING',
  155. currentIndex: 1,
  156. },
  157. },
  158. {
  159. uuid: '3',
  160. heatModuleCode: 'heat_module_02',
  161. inFeedArea: false,
  162. inSolutionPositon: true,
  163. inHeatModule: false,
  164. tubes: [
  165. {
  166. columnNum: 1,
  167. addSolution: true,
  168. exists: true,
  169. },
  170. {
  171. columnNum: 2,
  172. addSolution: true,
  173. exists: true,
  174. },
  175. {
  176. columnNum: 3,
  177. addSolution: true,
  178. exists: false,
  179. },
  180. {
  181. columnNum: 4,
  182. addSolution: true,
  183. exists: true,
  184. },
  185. {
  186. columnNum: 5,
  187. addSolution: true,
  188. exists: true,
  189. },
  190. ],
  191. // crafts: {
  192. // craft: {
  193. // id: 1,
  194. // name: '菱锌矿硫酸溶解法',
  195. // steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
  196. // },
  197. // state: 'RUNNING',
  198. // currentIndex: 1,
  199. // },
  200. },
  201. {
  202. uuid: '5',
  203. heatModuleCode: 'heat_module_03',
  204. inFeedArea: false,
  205. inSolutionPositon: false,
  206. inHeatModule: true,
  207. tubes: [
  208. {
  209. columnNum: 1,
  210. addSolution: true,
  211. exists: true,
  212. },
  213. ],
  214. // crafts: {
  215. // craft: {
  216. // id: 1,
  217. // name: '菱锌矿硫酸溶解法',
  218. // steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
  219. // },
  220. // state: 'RUNNING',
  221. // currentIndex: 1,
  222. // },
  223. },
  224. {
  225. uuid: '5',
  226. heatModuleCode: 'heat_module_04',
  227. inFeedArea: false,
  228. inSolutionPositon: false,
  229. inHeatModule: true,
  230. tubes: [
  231. ],
  232. // crafts: {
  233. // craft: {
  234. // id: 1,
  235. // name: '菱锌矿硫酸溶解法',
  236. // steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
  237. // },
  238. // state: 'RUNNING',
  239. // currentIndex: 1,
  240. // },
  241. },
  242. ],
  243. },
  244. systemUser: {
  245. username: '111',
  246. },
  247. loginForm: {
  248. username: import.meta.env.FT_NODE_ENV !== 'prod' ? 'admin' : '',
  249. password: import.meta.env.FT_NODE_ENV !== 'prod' ? '123456' : '',
  250. },
  251. menuExpand: true,
  252. isDebug: import.meta.env.FT_NODE_ENV !== 'prod',
  253. streamVisible: false,
  254. errorCraft: false,
  255. systemList: [],
  256. systemLogList: [],
  257. currentTime: '0000-00-00 00:00:00',
  258. }),
  259. actions: {
  260. insertLog(log: System.SystemLog) {
  261. this.systemLogList.unshift(log)
  262. this.systemLogList = this.systemLogList.slice(0, 200)
  263. },
  264. updateDebug() {
  265. this.isDebug = !this.isDebug
  266. },
  267. updateSystemStatus(data: System.SystemStatus) {
  268. this.systemStatus = data
  269. },
  270. updateStreamVisible(bool: boolean) {
  271. this.streamVisible = bool
  272. },
  273. updateMenuExpand() {
  274. this.menuExpand = !this.menuExpand
  275. },
  276. updateSystemUser(data: System.SystemUser) {
  277. this.systemUser = data
  278. },
  279. pushSystemList(text: any) {
  280. this.systemList.push(text)
  281. },
  282. logout() {
  283. logout().then(() => {
  284. delToken()
  285. router.push('/login').then(() => {})
  286. })
  287. },
  288. },
  289. persist: import.meta.env.FT_NODE_ENV === 'prod',
  290. })