publicConfig.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import { getUUID } from '@/utils'
  2. import { RequestConfigType } from '@/store/modules/chartEditStore/chartEditStore.d'
  3. import { groupTitle } from '@/settings/designSetting'
  4. import {
  5. RequestHttpEnum,
  6. RequestDataTypeEnum,
  7. RequestHttpIntervalEnum,
  8. RequestContentTypeEnum,
  9. RequestBodyEnum
  10. } from '@/enums/httpEnum'
  11. import {
  12. BaseEvent,
  13. EventLife,
  14. ChartFrameEnum,
  15. PublicConfigType,
  16. CreateComponentType,
  17. CreateComponentGroupType
  18. } from '@/packages/index.d'
  19. import { chartInitConfig } from '@/settings/designSetting'
  20. import cloneDeep from 'lodash/cloneDeep'
  21. // 请求基础属性
  22. const requestConfig: RequestConfigType = {
  23. requestDataType: RequestDataTypeEnum.STATIC,
  24. requestHttpType: RequestHttpEnum.GET,
  25. requestUrl: '',
  26. requestInterval: undefined,
  27. requestIntervalUnit: RequestHttpIntervalEnum.SECOND,
  28. requestContentType: RequestContentTypeEnum.DEFAULT,
  29. requestParamsBodyType: RequestBodyEnum.NONE,
  30. requestSQLContent: {
  31. sql: 'select * from where'
  32. },
  33. requestParams: {
  34. Body: {
  35. 'form-data': {},
  36. 'x-www-form-urlencoded': {},
  37. json: '',
  38. xml: ''
  39. },
  40. Header: {},
  41. Params: {}
  42. }
  43. }
  44. // 单实例类
  45. export class PublicConfigClass implements PublicConfigType {
  46. public id = getUUID()
  47. public isGroup = false
  48. // 基本信息
  49. public attr = { ...chartInitConfig, zIndex: -1 }
  50. // 基本样式
  51. public styles = {
  52. // 使用滤镜
  53. filterShow: false,
  54. // 色相
  55. hueRotate: 0,
  56. // 饱和度
  57. saturate: 1,
  58. // 对比度
  59. contrast: 1,
  60. // 亮度
  61. brightness: 1,
  62. // 透明
  63. opacity: 1,
  64. // 旋转
  65. rotateZ: 0,
  66. rotateX: 0,
  67. rotateY: 0,
  68. // 倾斜
  69. skewX: 0,
  70. skewY: 0,
  71. // 混合模式
  72. blendMode: 'normal',
  73. // 动画
  74. animations: []
  75. }
  76. // 状态
  77. public status = {
  78. lock: false,
  79. hide: false
  80. }
  81. // 请求
  82. public request = cloneDeep(requestConfig)
  83. // 数据过滤
  84. public filter = undefined
  85. // 事件
  86. public events = {
  87. baseEvent: {
  88. [BaseEvent.ON_CLICK]: undefined,
  89. [BaseEvent.ON_DBL_CLICK]: undefined,
  90. [BaseEvent.ON_MOUSE_ENTER]: undefined,
  91. [BaseEvent.ON_MOUSE_LEAVE]: undefined
  92. },
  93. advancedEvents: {
  94. [EventLife.VNODE_MOUNTED]: undefined,
  95. [EventLife.VNODE_BEFORE_MOUNT]: undefined
  96. }
  97. }
  98. }
  99. // 多选成组类
  100. export class PublicGroupConfigClass extends PublicConfigClass implements CreateComponentGroupType {
  101. // 成组
  102. public isGroup = true
  103. // 名称
  104. public chartConfig = {
  105. key: 'group',
  106. chartKey: 'group',
  107. conKey: 'group',
  108. category: 'group',
  109. categoryName: 'group',
  110. package: 'group',
  111. chartFrame: ChartFrameEnum.COMMON,
  112. title: groupTitle,
  113. image: ''
  114. }
  115. // 组成员列表
  116. public groupList: Array<CreateComponentType> = []
  117. // ---- 原有 ---
  118. // key
  119. public key = 'group'
  120. // 配置
  121. public option = {}
  122. // 标识
  123. public id = getUUID()
  124. // 基本信息
  125. public attr = { w: 0, h: 0, x: 0, y: 0, offsetX: 0, offsetY: 0, zIndex: -1 }
  126. }