cnhis-design-vue 2.1.29 → 2.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/es/affix/index.js +8 -8
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/anchor/index.js +8 -8
  6. package/es/auto-complete/index.js +8 -8
  7. package/es/avatar/index.js +8 -8
  8. package/es/back-top/index.js +8 -8
  9. package/es/badge/index.js +8 -8
  10. package/es/base/index.js +8 -8
  11. package/es/big-table/index.js +164 -164
  12. package/es/breadcrumb/index.js +8 -8
  13. package/es/button/index.js +31 -31
  14. package/es/calendar/index.js +8 -8
  15. package/es/captcha/index.js +3 -3
  16. package/es/card/index.js +8 -8
  17. package/es/carousel/index.js +8 -8
  18. package/es/cascader/index.js +8 -8
  19. package/es/checkbox/index.js +9 -9
  20. package/es/col/index.js +8 -8
  21. package/es/collapse/index.js +8 -8
  22. package/es/color-picker/index.js +1 -1
  23. package/es/comment/index.js +8 -8
  24. package/es/config-provider/index.js +8 -8
  25. package/es/date-picker/index.js +8 -8
  26. package/es/descriptions/index.js +8 -8
  27. package/es/divider/index.js +8 -8
  28. package/es/drag-layout/index.js +3 -3
  29. package/es/drawer/index.js +8 -8
  30. package/es/dropdown/index.js +8 -8
  31. package/es/editor/index.js +1 -1
  32. package/es/empty/index.js +8 -8
  33. package/es/fabric-chart/index.js +21 -30
  34. package/es/form/index.js +8 -8
  35. package/es/form-model/index.js +8 -8
  36. package/es/form-table/index.js +62 -62
  37. package/es/index/index.js +1283 -1085
  38. package/es/index/style.css +1 -1
  39. package/es/input/index.js +9 -9
  40. package/es/input-number/index.js +8 -8
  41. package/es/layout/index.js +8 -8
  42. package/es/list/index.js +8 -8
  43. package/es/locale-provider/index.js +8 -8
  44. package/es/map/index.js +9 -9
  45. package/es/mentions/index.js +8 -8
  46. package/es/menu/index.js +8 -8
  47. package/es/message/index.js +8 -8
  48. package/es/multi-chat/index.js +759 -562
  49. package/es/multi-chat/style.css +1 -1
  50. package/es/multi-chat-client/index.js +352 -220
  51. package/es/multi-chat-client/style.css +1 -1
  52. package/es/multi-chat-history/index.js +278 -38
  53. package/es/multi-chat-history/style.css +1 -1
  54. package/es/multi-chat-record/index.js +54 -18
  55. package/es/multi-chat-setting/index.js +75 -33
  56. package/es/multi-chat-sip/index.js +1 -1
  57. package/es/notification/index.js +8 -8
  58. package/es/page-header/index.js +8 -8
  59. package/es/pagination/index.js +8 -8
  60. package/es/popconfirm/index.js +8 -8
  61. package/es/popover/index.js +8 -8
  62. package/es/progress/index.js +8 -8
  63. package/es/radio/index.js +9 -9
  64. package/es/rate/index.js +8 -8
  65. package/es/result/index.js +8 -8
  66. package/es/row/index.js +8 -8
  67. package/es/scale-view/index.js +33 -33
  68. package/es/select/index.js +11 -11
  69. package/es/select-label/index.js +11 -11
  70. package/es/select-person/index.js +36 -28
  71. package/es/select-person/style.css +1 -1
  72. package/es/shortcut-setter/index.js +10 -10
  73. package/es/skeleton/index.js +8 -8
  74. package/es/slider/index.js +8 -8
  75. package/es/space/index.js +8 -8
  76. package/es/spin/index.js +8 -8
  77. package/es/statistic/index.js +8 -8
  78. package/es/steps/index.js +8 -8
  79. package/es/switch/index.js +8 -8
  80. package/es/table-filter/index.js +74 -74
  81. package/es/tabs/index.js +8 -8
  82. package/es/tag/index.js +9 -9
  83. package/es/time-picker/index.js +8 -8
  84. package/es/timeline/index.js +8 -8
  85. package/es/tooltip/index.js +8 -8
  86. package/es/transfer/index.js +8 -8
  87. package/es/tree/index.js +8 -8
  88. package/es/tree-select/index.js +8 -8
  89. package/es/upload/index.js +8 -8
  90. package/es/utils/UniRTCv2.js +77 -11
  91. package/es/utils/trtc.js +19025 -0
  92. package/es/verification-code/index.js +2 -2
  93. package/lib/cui.common.js +26349 -6267
  94. package/lib/cui.umd.js +26349 -6267
  95. package/lib/cui.umd.min.js +149 -147
  96. package/package.json +1 -1
  97. package/packages/big-table/src/BigTable.vue +3044 -3044
  98. package/packages/big-table/src/utils/batchEditing.js +610 -610
  99. package/packages/big-table/src/utils/bigTableProps.js +95 -95
  100. package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +181 -181
  101. package/packages/button/src/ButtonPrint/index.vue +739 -739
  102. package/packages/fabric-chart/src/components/TimeScaleValue.vue +113 -113
  103. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  104. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +3 -11
  105. package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +135 -135
  106. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +558 -558
  107. package/packages/fabric-chart/src/fabric-chart2/FabricTop.vue +172 -172
  108. package/packages/multi-chat/chat/audio.vue +18 -5
  109. package/packages/multi-chat/chat/chatFooter.vue +1594 -1594
  110. package/packages/multi-chat/chat/chatHeader.vue +4 -1
  111. package/packages/multi-chat/chat/chatHistory.vue +10 -2
  112. package/packages/multi-chat/chat/chatMain.vue +5 -0
  113. package/packages/multi-chat/chat/index.vue +29 -0
  114. package/packages/multi-chat/chat/mixins/uniRTCAPI.js +10 -7
  115. package/packages/multi-chat/chat/multiVideo.vue +16 -4
  116. package/packages/multi-chat/chat/quickReply.vue +439 -439
  117. package/packages/multi-chat/chat/scrollList.vue +9 -3
  118. package/packages/multi-chat/components/avatar.vue +64 -26
  119. package/packages/multi-chat/setting/baseInfo/index.vue +1316 -1316
  120. package/packages/multi-chat/store/actions.js +8 -4
  121. package/packages/multi-chat/store/state.js +112 -112
  122. package/packages/multi-chat/utils/index.js +25 -0
  123. package/packages/multi-chat/utils/rtc-client.js +23 -3
  124. package/packages/scale-view/formitem/r-choice.vue +714 -714
  125. package/packages/scale-view/scaleView.vue +2010 -2010
  126. package/packages/select-person/select-person.vue +9 -4
  127. package/packages/table-filter/src/components/c-tree-select/tree-select.vue +336 -336
  128. package/packages/table-filter/src/components/multi-select/multi-select.vue +219 -219
  129. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +340 -340
  130. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +1825 -1825
  131. package/packages/table-filter/src/const/dataOptions.js +43 -43
  132. package/src/directive/preventReClick.js +12 -12
  133. package/src/utils/UniRTCv2.js +46 -13
  134. package/src/utils/trtc.js +1 -0
@@ -1,113 +1,113 @@
1
- <template>
2
- <div v-show="isShow" class="c-time-scalevalue" :style="{ '--left': popupStyle.left, '--top': popupStyle.top, '--height': popupStyle.height, '--width': popupStyle.width }">
3
- <span
4
- class="c-time-scalevalue-list"
5
- v-show="index % 2 == 0"
6
- v-for="(item, index) in times"
7
- :key="item.left"
8
- :style="{ left: `${item.left - item.width / 2}px`, '--font-size': popupStyle.fontSize }"
9
- >
10
- {{ item.time }}
11
- </span>
12
- </div>
13
- </template>
14
-
15
- <script>
16
- // import Vue from 'vue';
17
- // import DomPortal from 'vue-dom-portal';
18
- import vexutils from '@/utils/vexutils';
19
- import fabricCommon from '../mixins/fabricCommon';
20
-
21
- export default {
22
- mixins: [fabricCommon],
23
- props: {
24
- times: {
25
- type: Array,
26
- required: true
27
- }
28
- // to: {
29
- // type: String,
30
- // default: 'body'
31
- // }
32
- },
33
- // beforeCreate() {
34
- // Vue.use(DomPortal);
35
- // },
36
- data() {
37
- return {
38
- cFabricChart: null,
39
- scrollEvent: null,
40
- top: 0,
41
- popupStyle: {
42
- width: '1000px',
43
- height: '80px',
44
- left: 0,
45
- top: 0,
46
- fontSize: '12px'
47
- },
48
- isShow: false
49
- };
50
- },
51
- mounted() {
52
- this.$nextTick(() => {
53
- setTimeout(() => {
54
- this.init();
55
- }, 0);
56
- });
57
- },
58
- methods: {
59
- init() {
60
- // this.to = this.templateData.top?.xScalevalue?.to || 'body';
61
- const { xScalevalue } = this.$attrs.templateData.top || {};
62
- const { canvasWidth, spaceHeight, xCellWidth } = this.propItems;
63
- this.cFabricChart = document.querySelector('.c-fabric-chart');
64
- // this.bodyHeight = document.body.getBoundingClientRect().height;
65
- this.top = this.cFabricChart.getBoundingClientRect().top;
66
- this.popupStyle = {
67
- left: `${this.cFabricChart.getBoundingClientRect().left}px`,
68
- top: `${xScalevalue?.popupTop || 0}px`,
69
- width: `${canvasWidth}px`,
70
- height: `${spaceHeight}px`,
71
- fontSize: `${xScalevalue.style?.fontSize || 12}px`
72
- };
73
- // const spaceGridNumber = xScalevalue.spaceGridNumber || 3;
74
- // this.marginLeft = `${xCellWidth * spaceGridNumber}px`;
75
- // 节流的间隔时间不宜太大,因为实际top值不准,会造成判断条件不准确
76
- this.scrollEvent = vexutils.throttle(this.scroll, 100);
77
- window.addEventListener('scroll', this.scrollEvent, true);
78
- },
79
- scroll() {
80
- if (this.cFabricChart) {
81
- const { originY, spaceHeight } = this.propItems;
82
- const top = this.cFabricChart.getBoundingClientRect().top;
83
- const newOriginY = originY - spaceHeight;
84
- const { xScalevalue } = this.$attrs.templateData.top || {};
85
- const popupTop = xScalevalue?.popupTop || 0;
86
- this.isShow = top + newOriginY < popupTop ? true : false;
87
- }
88
- }
89
- },
90
- beforeDestroy() {
91
- window.removeEventListener('scroll', this.scroll, true);
92
- }
93
- };
94
- </script>
95
-
96
- <style lang="less" scoped>
97
- .c-time-scalevalue {
98
- position: fixed;
99
- z-index: 999;
100
- left: var(--left);
101
- top: var(--top);
102
- width: var(--width);
103
- height: var(--height);
104
- background: rgba(0, 0, 0, 0.6);
105
- color: #fff;
106
- &-list {
107
- position: absolute;
108
- line-height: var(--height);
109
- transform-origin: center;
110
- font-size: var(--font-size);
111
- }
112
- }
113
- </style>
1
+ <template>
2
+ <div v-show="isShow" class="c-time-scalevalue" :style="{ '--left': popupStyle.left, '--top': popupStyle.top, '--height': popupStyle.height, '--width': popupStyle.width }">
3
+ <span
4
+ class="c-time-scalevalue-list"
5
+ v-show="index % 2 == 0"
6
+ v-for="(item, index) in times"
7
+ :key="item.left"
8
+ :style="{ left: `${item.left - item.width / 2}px`, '--font-size': popupStyle.fontSize }"
9
+ >
10
+ {{ item.time }}
11
+ </span>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ // import Vue from 'vue';
17
+ // import DomPortal from 'vue-dom-portal';
18
+ import vexutils from '@/utils/vexutils';
19
+ import fabricCommon from '../mixins/fabricCommon';
20
+
21
+ export default {
22
+ mixins: [fabricCommon],
23
+ props: {
24
+ times: {
25
+ type: Array,
26
+ required: true
27
+ }
28
+ // to: {
29
+ // type: String,
30
+ // default: 'body'
31
+ // }
32
+ },
33
+ // beforeCreate() {
34
+ // Vue.use(DomPortal);
35
+ // },
36
+ data() {
37
+ return {
38
+ cFabricChart: null,
39
+ scrollEvent: null,
40
+ top: 0,
41
+ popupStyle: {
42
+ width: '1000px',
43
+ height: '80px',
44
+ left: 0,
45
+ top: 0,
46
+ fontSize: '12px'
47
+ },
48
+ isShow: false
49
+ };
50
+ },
51
+ mounted() {
52
+ this.$nextTick(() => {
53
+ setTimeout(() => {
54
+ this.init();
55
+ }, 0);
56
+ });
57
+ },
58
+ methods: {
59
+ init() {
60
+ // this.to = this.templateData.top?.xScalevalue?.to || 'body';
61
+ const { xScalevalue } = this.$attrs.templateData.top || {};
62
+ const { canvasWidth, spaceHeight, xCellWidth } = this.propItems;
63
+ this.cFabricChart = document.querySelector('.c-fabric-chart');
64
+ // this.bodyHeight = document.body.getBoundingClientRect().height;
65
+ this.top = this.cFabricChart.getBoundingClientRect().top;
66
+ this.popupStyle = {
67
+ left: `${this.cFabricChart.getBoundingClientRect().left}px`,
68
+ top: `${xScalevalue?.popupTop || 0}px`,
69
+ width: `${canvasWidth}px`,
70
+ height: `${spaceHeight}px`,
71
+ fontSize: `${xScalevalue.style?.fontSize || 12}px`
72
+ };
73
+ // const spaceGridNumber = xScalevalue.spaceGridNumber || 3;
74
+ // this.marginLeft = `${xCellWidth * spaceGridNumber}px`;
75
+ // 节流的间隔时间不宜太大,因为实际top值不准,会造成判断条件不准确
76
+ this.scrollEvent = vexutils.throttle(this.scroll, 100);
77
+ window.addEventListener('scroll', this.scrollEvent, true);
78
+ },
79
+ scroll() {
80
+ if (this.cFabricChart) {
81
+ const { originY, spaceHeight } = this.propItems;
82
+ const top = this.cFabricChart.getBoundingClientRect().top;
83
+ const newOriginY = originY - spaceHeight;
84
+ const { xScalevalue } = this.$attrs.templateData.top || {};
85
+ const popupTop = xScalevalue?.popupTop || 0;
86
+ this.isShow = top + newOriginY < popupTop ? true : false;
87
+ }
88
+ }
89
+ },
90
+ beforeDestroy() {
91
+ window.removeEventListener('scroll', this.scroll, true);
92
+ }
93
+ };
94
+ </script>
95
+
96
+ <style lang="less" scoped>
97
+ .c-time-scalevalue {
98
+ position: fixed;
99
+ z-index: 999;
100
+ left: var(--left);
101
+ top: var(--top);
102
+ width: var(--width);
103
+ height: var(--height);
104
+ background: rgba(0, 0, 0, 0.6);
105
+ color: #fff;
106
+ &-list {
107
+ position: absolute;
108
+ line-height: var(--height);
109
+ transform-origin: center;
110
+ font-size: var(--font-size);
111
+ }
112
+ }
113
+ </style>
@@ -1,59 +1,59 @@
1
- const data = {
2
- style: {
3
- evented: false,
4
- selectable: false
5
- },
6
- rectStyle: {
7
- fill: 'transparent',
8
- stroke: '#999',
9
- strokeWidth: 1
10
- },
11
- textStyle: {
12
- fontFamily: '微软雅黑',
13
- fontSize: 12,
14
- fill: '#000',
15
- lineHeight: 1
16
- },
17
- borderStyle: {
18
- stroke: '#999',
19
- strokeWidth: 1,
20
- selectable: false,
21
- evented: false
22
- },
23
- // 折线图中的点
24
- pointStyle: {
25
- fill: '#ffffff', // 填充色
26
- stroke: '#000000', // 描边色
27
- originX: 'center',
28
- originY: 'center'
29
- },
30
- // 折线图中的线
31
- lineStyle: {
32
- stroke: '#000', // 描边色
33
- strokeWidth: 1, // 描边宽度
34
- originX: 'center',
35
- originY: 'center'
36
- },
37
- topSpaceHeight: 10, // templateData.top.spaceHeight
38
- topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
- leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
- rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
- topTotal: {
42
- title: '总量',
43
- width: 0,
44
- style: {
45
- fontFamily: '微软雅黑',
46
- fontSize: 12,
47
- fill: '#000',
48
- lineHeight: 1
49
- }
50
- },
51
- criticalStyle: { // 危急值样式
52
- stroke: 'purple', // 颜色 默认 #999
53
- strokeWidth: 1, // 线宽 默认 1
54
- strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
- },
56
- bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
- };
58
-
59
- export default data;
1
+ const data = {
2
+ style: {
3
+ evented: false,
4
+ selectable: false
5
+ },
6
+ rectStyle: {
7
+ fill: 'transparent',
8
+ stroke: '#999',
9
+ strokeWidth: 1
10
+ },
11
+ textStyle: {
12
+ fontFamily: '微软雅黑',
13
+ fontSize: 12,
14
+ fill: '#000',
15
+ lineHeight: 1
16
+ },
17
+ borderStyle: {
18
+ stroke: '#999',
19
+ strokeWidth: 1,
20
+ selectable: false,
21
+ evented: false
22
+ },
23
+ // 折线图中的点
24
+ pointStyle: {
25
+ fill: '#ffffff', // 填充色
26
+ stroke: '#000000', // 描边色
27
+ originX: 'center',
28
+ originY: 'center'
29
+ },
30
+ // 折线图中的线
31
+ lineStyle: {
32
+ stroke: '#000', // 描边色
33
+ strokeWidth: 1, // 描边宽度
34
+ originX: 'center',
35
+ originY: 'center'
36
+ },
37
+ topSpaceHeight: 10, // templateData.top.spaceHeight
38
+ topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
+ leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
+ rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
+ topTotal: {
42
+ title: '总量',
43
+ width: 0,
44
+ style: {
45
+ fontFamily: '微软雅黑',
46
+ fontSize: 12,
47
+ fill: '#000',
48
+ lineHeight: 1
49
+ }
50
+ },
51
+ criticalStyle: { // 危急值样式
52
+ stroke: 'purple', // 颜色 默认 #999
53
+ strokeWidth: 1, // 线宽 默认 1
54
+ strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
+ },
56
+ bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
+ };
58
+
59
+ export default data;
@@ -705,6 +705,8 @@ export default {
705
705
  let cloneObj = JSON.parse(JSON.stringify(pointObj));
706
706
  cloneObj.value.time = this.getXValue(curLeft);
707
707
  cloneObj.left = curLeft;
708
+ // 补充的节点会和滑动的线条对应不上
709
+ // await this.clonePoint(point, [curLeft, cloneObj.top, cloneObj.left, cloneObj.top])
708
710
  this.addPointList.splice(index, 0, cloneObj);
709
711
  }
710
712
  }
@@ -718,9 +720,7 @@ export default {
718
720
  if (conditionNoLine2 || conditionHasLine2) {
719
721
  // point.line1 && this.removePolyline(point.line1.id);
720
722
  setPointLineColor(point, 'transparent', conditionHasLine2);
721
- // if (i === 1) {
722
723
  this.addPointList.length == 0 && (await this.clonePoint(point, [point.line1 ? point.line1.x1 : originLeft, point.line1 ? point.line1.y1 : originTop, originLeft, originTop]));
723
- // }
724
724
  if (this.addPointList.every(v => v.left !== left)) {
725
725
  // const points1 = i === 1 ? [originLeft, originTop] : point.prePoints;
726
726
  const points1 = this.addPointList.length == 0 ? [originLeft, originTop] : point.prePoints;
@@ -876,11 +876,6 @@ export default {
876
876
  evented: false,
877
877
  ...others
878
878
  });
879
- // line.hasControls = line.hasBorders = false;
880
- // line.on('mouseover', () => {
881
- // // 将当条线段以及点层级置顶
882
- // // 此处有问题,线段定位是斜角形成的整个矩形,会挡住其他点或线段的mouseover事件
883
- // });
884
879
 
885
880
  return line;
886
881
  },
@@ -1019,10 +1014,7 @@ export default {
1019
1014
  const point = this.canvas.getObjects().filter(item => item[pointId] === id);
1020
1015
  if (point && point.length > 0) {
1021
1016
  point.forEach(v => {
1022
- if (left && v.left >= left) {
1023
- this.canvas.remove(v);
1024
- v.line1 && this.canvas.remove(v.line1);
1025
- } else if (!left) {
1017
+ if ((left && v.left >= left) || !left) {
1026
1018
  this.canvas.remove(v);
1027
1019
  v.line1 && this.canvas.remove(v.line1);
1028
1020
  }
@@ -1,135 +1,135 @@
1
- <template>
2
- <TimeScaleValue v-if="templateData.top.xScalevalue.popupTop" :times="timeList" :templateData="templateData" />
3
- </template>
4
-
5
- <script>
6
- import fabricCommon from '../mixins/fabricCommon';
7
- import defaultVaule from '../const/defaultVaule';
8
- import TimeScaleValue from '../components/TimeScaleValue.vue';
9
-
10
- export default {
11
- name: 'fabric-scale-value',
12
- mixins: [fabricCommon],
13
- components: {
14
- TimeScaleValue
15
- },
16
- props: {
17
- templateData: {
18
- type: Object,
19
- required: true
20
- }
21
- },
22
- data() {
23
- return {
24
- timeList: []
25
- };
26
- },
27
- computed: {
28
- defaultTextStyle() {
29
- return {
30
- ...defaultVaule.textStyle,
31
- centeredRotation: true,
32
- originX: 'center',
33
- originY: 'center'
34
- };
35
- }
36
- },
37
- mounted() {
38
- this.$nextTick(() => {
39
- this.topScaleValue(this.templateData.top);
40
- this.rightScaleValue(this.templateData.right);
41
- this.leftScaleValue(this.templateData.left);
42
- this.canvas.renderAll();
43
- });
44
- },
45
- methods: {
46
- // x轴时间刻度绘制
47
- topScaleValue(obj) {
48
- const { originX, originY, xCellWidth, spaceHeight } = this.propItems;
49
- const spaceGridNumber = obj.xScalevalue.spaceGridNumber || 3;
50
- const defaultSpaceMinute = obj.xScalevalue.defaultSpaceTime || 15;
51
- const defaultSpaceTime = defaultSpaceMinute * 60 * 1000;
52
- const style = obj.xScalevalue.style || {};
53
- const customStyle = obj.xScalevalue.customStyle || {};
54
- const top = originY - Math.floor(spaceHeight / 2);
55
- let textList = [];
56
- const list = obj.xScalevalue.list || [];
57
- list.reduce((pre, cur, i) => {
58
- const newStyle = pre && new Date(cur).getTime() - new Date(pre).getTime() < defaultSpaceTime ? { ...style, ...customStyle } : style;
59
- const text = this.createText(cur.slice(-5), originX + i * spaceGridNumber * xCellWidth, top, 'center', newStyle);
60
- textList.push(text);
61
- this.timeList.push({
62
- time: cur.slice(-5),
63
- left: originX + i * spaceGridNumber * xCellWidth,
64
- width: text.width
65
- });
66
- return cur;
67
- }, '');
68
- const group = new this.fabric.Group([...textList], {
69
- evented: false,
70
- selectable: false
71
- });
72
- this.canvas.add(group);
73
- this.canvas.sendBackwards(group);
74
- },
75
- rightScaleValue(obj) {
76
- if (!obj) return;
77
- const spaceGridNumber = obj.rightYScalevalue.spaceGridNumber || 2;
78
- const marginLeft = obj.rightYScalevalue.marginLeft || 3;
79
- const originX = this.propItems.endX + marginLeft;
80
- const style = obj.rightYScalevalue.style ? obj.rightYScalevalue.style : {};
81
- let textList = [];
82
- obj.rightYScalevalue.list.forEach((item, index) => {
83
- textList.push(this.createText(item, originX, this.propItems.endY - index * this.propItems.yCellHeight * spaceGridNumber, 'left', style));
84
- });
85
- // 添加单位
86
- if (obj.rightYScalevalue.unit) {
87
- const top = this.propItems.endY - obj.rightYScalevalue.list.length * this.propItems.yCellHeight * spaceGridNumber + this.propItems.yCellHeight;
88
- textList.push(this.createText(obj.rightYScalevalue.unit, originX, top, 'left', style));
89
- }
90
- const group = new this.fabric.Group([...textList], {
91
- evented: false,
92
- selectable: false
93
- });
94
- this.canvas.add(group);
95
- this.canvas.sendBackwards(group);
96
- },
97
- leftScaleValue(obj) {
98
- const { endY, yCellHeight } = this.propItems;
99
- const spaceGridNumber = obj.leftYScalevalue.spaceGridNumber || 2;
100
- const [titleMarginRight, titleMarginButton] = obj.leftYScalevalue?.titleMargin || [5, 30];
101
- const listMarginRight = obj.leftYScalevalue.listMarginRight || 3;
102
- const style = obj.leftYScalevalue.style || {};
103
- const originX = this.propItems.originX;
104
- let textList = [];
105
- obj.leftYScalevalue.list.forEach((item, index) => {
106
- textList.push(this.createText(item, originX - listMarginRight, endY - index * yCellHeight * spaceGridNumber, 'right', style));
107
- });
108
-
109
- // 添加标题和单位
110
- let txt = '';
111
- txt = obj.leftYScalevalue.name || '';
112
- if (obj.leftYScalevalue.unit) txt += '\n' + obj.leftYScalevalue.unit;
113
- if (txt) {
114
- const top = endY - (obj.leftYScalevalue.list.length - 1) * yCellHeight * spaceGridNumber - titleMarginButton;
115
- textList.push(this.createText(txt, originX - titleMarginRight, top, 'right', { ...style, textAlign: 'right', originY: 'bottom' }));
116
- }
117
- const group = new this.fabric.Group([...textList], {
118
- evented: false,
119
- selectable: false
120
- });
121
- this.canvas.add(group);
122
- this.canvas.sendBackwards(group);
123
- },
124
- createText(text, left, top, originX, style) {
125
- return new this.fabric.Text(String(text), {
126
- ...this.defaultTextStyle,
127
- left,
128
- top,
129
- ...style,
130
- originX
131
- });
132
- }
133
- }
134
- };
135
- </script>
1
+ <template>
2
+ <TimeScaleValue v-if="templateData.top.xScalevalue.popupTop" :times="timeList" :templateData="templateData" />
3
+ </template>
4
+
5
+ <script>
6
+ import fabricCommon from '../mixins/fabricCommon';
7
+ import defaultVaule from '../const/defaultVaule';
8
+ import TimeScaleValue from '../components/TimeScaleValue.vue';
9
+
10
+ export default {
11
+ name: 'fabric-scale-value',
12
+ mixins: [fabricCommon],
13
+ components: {
14
+ TimeScaleValue
15
+ },
16
+ props: {
17
+ templateData: {
18
+ type: Object,
19
+ required: true
20
+ }
21
+ },
22
+ data() {
23
+ return {
24
+ timeList: []
25
+ };
26
+ },
27
+ computed: {
28
+ defaultTextStyle() {
29
+ return {
30
+ ...defaultVaule.textStyle,
31
+ centeredRotation: true,
32
+ originX: 'center',
33
+ originY: 'center'
34
+ };
35
+ }
36
+ },
37
+ mounted() {
38
+ this.$nextTick(() => {
39
+ this.topScaleValue(this.templateData.top);
40
+ this.rightScaleValue(this.templateData.right);
41
+ this.leftScaleValue(this.templateData.left);
42
+ this.canvas.renderAll();
43
+ });
44
+ },
45
+ methods: {
46
+ // x轴时间刻度绘制
47
+ topScaleValue(obj) {
48
+ const { originX, originY, xCellWidth, spaceHeight } = this.propItems;
49
+ const spaceGridNumber = obj.xScalevalue.spaceGridNumber || 3;
50
+ const defaultSpaceMinute = obj.xScalevalue.defaultSpaceTime || 15;
51
+ const defaultSpaceTime = defaultSpaceMinute * 60 * 1000;
52
+ const style = obj.xScalevalue.style || {};
53
+ const customStyle = obj.xScalevalue.customStyle || {};
54
+ const top = originY - Math.floor(spaceHeight / 2);
55
+ let textList = [];
56
+ const list = obj.xScalevalue.list || [];
57
+ list.reduce((pre, cur, i) => {
58
+ const newStyle = pre && new Date(cur).getTime() - new Date(pre).getTime() < defaultSpaceTime ? { ...style, ...customStyle } : style;
59
+ const text = this.createText(cur.slice(-5), originX + i * spaceGridNumber * xCellWidth, top, 'center', newStyle);
60
+ textList.push(text);
61
+ this.timeList.push({
62
+ time: cur.slice(-5),
63
+ left: originX + i * spaceGridNumber * xCellWidth,
64
+ width: text.width
65
+ });
66
+ return cur;
67
+ }, '');
68
+ const group = new this.fabric.Group([...textList], {
69
+ evented: false,
70
+ selectable: false
71
+ });
72
+ this.canvas.add(group);
73
+ this.canvas.sendBackwards(group);
74
+ },
75
+ rightScaleValue(obj) {
76
+ if (!obj) return;
77
+ const spaceGridNumber = obj.rightYScalevalue.spaceGridNumber || 2;
78
+ const marginLeft = obj.rightYScalevalue.marginLeft || 3;
79
+ const originX = this.propItems.endX + marginLeft;
80
+ const style = obj.rightYScalevalue.style ? obj.rightYScalevalue.style : {};
81
+ let textList = [];
82
+ obj.rightYScalevalue.list.forEach((item, index) => {
83
+ textList.push(this.createText(item, originX, this.propItems.endY - index * this.propItems.yCellHeight * spaceGridNumber, 'left', style));
84
+ });
85
+ // 添加单位
86
+ if (obj.rightYScalevalue.unit) {
87
+ const top = this.propItems.endY - obj.rightYScalevalue.list.length * this.propItems.yCellHeight * spaceGridNumber + this.propItems.yCellHeight;
88
+ textList.push(this.createText(obj.rightYScalevalue.unit, originX, top, 'left', style));
89
+ }
90
+ const group = new this.fabric.Group([...textList], {
91
+ evented: false,
92
+ selectable: false
93
+ });
94
+ this.canvas.add(group);
95
+ this.canvas.sendBackwards(group);
96
+ },
97
+ leftScaleValue(obj) {
98
+ const { endY, yCellHeight } = this.propItems;
99
+ const spaceGridNumber = obj.leftYScalevalue.spaceGridNumber || 2;
100
+ const [titleMarginRight, titleMarginButton] = obj.leftYScalevalue?.titleMargin || [5, 30];
101
+ const listMarginRight = obj.leftYScalevalue.listMarginRight || 3;
102
+ const style = obj.leftYScalevalue.style || {};
103
+ const originX = this.propItems.originX;
104
+ let textList = [];
105
+ obj.leftYScalevalue.list.forEach((item, index) => {
106
+ textList.push(this.createText(item, originX - listMarginRight, endY - index * yCellHeight * spaceGridNumber, 'right', style));
107
+ });
108
+
109
+ // 添加标题和单位
110
+ let txt = '';
111
+ txt = obj.leftYScalevalue.name || '';
112
+ if (obj.leftYScalevalue.unit) txt += '\n' + obj.leftYScalevalue.unit;
113
+ if (txt) {
114
+ const top = endY - (obj.leftYScalevalue.list.length - 1) * yCellHeight * spaceGridNumber - titleMarginButton;
115
+ textList.push(this.createText(txt, originX - titleMarginRight, top, 'right', { ...style, textAlign: 'right', originY: 'bottom' }));
116
+ }
117
+ const group = new this.fabric.Group([...textList], {
118
+ evented: false,
119
+ selectable: false
120
+ });
121
+ this.canvas.add(group);
122
+ this.canvas.sendBackwards(group);
123
+ },
124
+ createText(text, left, top, originX, style) {
125
+ return new this.fabric.Text(String(text), {
126
+ ...this.defaultTextStyle,
127
+ left,
128
+ top,
129
+ ...style,
130
+ originX
131
+ });
132
+ }
133
+ }
134
+ };
135
+ </script>