global.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import type { ProjectType } from '@/types/global'
  2. import { defineStore } from 'pinia'
  3. export const useGlobalStore = defineStore(
  4. 'global',
  5. () => {
  6. const projectList = ref<ProjectType[]>([
  7. {
  8. name: '工程1',
  9. id: Date.now() + '',
  10. time: new Date().toLocaleString(),
  11. commandList: [
  12. {
  13. name: '任务1',
  14. id: '11',
  15. time: new Date().toLocaleString(),
  16. parentId: '1',
  17. stepList: [
  18. {
  19. type: 'condition',
  20. list: [
  21. {
  22. id: '111',
  23. type: 'input',
  24. label: 'DI1',
  25. value: '闭合'
  26. },
  27. {
  28. id: '112',
  29. type: 'input',
  30. label: 'AI1',
  31. operation: '=',
  32. value: '0'
  33. },
  34. {
  35. id: '113',
  36. type: 'time',
  37. label: '每天',
  38. value: '08:00',
  39. operation: '等于'
  40. }
  41. ]
  42. },
  43. {
  44. id: '12',
  45. type: 'delay',
  46. value: '5',
  47. unit: 's'
  48. },
  49. {
  50. type: 'exec',
  51. list: [
  52. {
  53. id: '131',
  54. type: 'output',
  55. label: 'DO1',
  56. value: '打开'
  57. },
  58. {
  59. id: '132',
  60. type: 'output',
  61. label: 'AO1',
  62. value: '0'
  63. }
  64. ]
  65. }
  66. ]
  67. }
  68. ],
  69. isCompiled: false,
  70. CompileTime: ''
  71. }
  72. ])
  73. return { projectList }
  74. },
  75. {
  76. persist: true
  77. }
  78. )