publicConfig.ts 3.0 KB

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