publicConfig.ts 2.6 KB

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