global.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. msgList: []
  72. }
  73. ])
  74. return { projectList }
  75. },
  76. {
  77. persist: true
  78. }
  79. )