st-comp 0.0.146 → 0.0.147

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 (148) hide show
  1. package/components.d.ts +0 -3
  2. package/es/ChartLayout.cjs +1 -1
  3. package/es/ChartLayout.js +2 -2
  4. package/es/Dialog.cjs +1 -1
  5. package/es/Dialog.js +22 -26
  6. package/es/FactorWarning.cjs +1 -1
  7. package/es/FactorWarning.js +103 -112
  8. package/es/KlineBasic.cjs +1 -1
  9. package/es/KlineBasic.js +1426 -671
  10. package/es/KlineNew.cjs +3 -1
  11. package/es/KlineNew.js +2736 -314
  12. package/es/Pagination.cjs +1 -1
  13. package/es/Pagination.js +96 -102
  14. package/es/Table.cjs +1 -1
  15. package/es/Table.js +60 -66
  16. package/es/User.cjs +1 -1
  17. package/es/User.js +96 -103
  18. package/es/VarietySearch.cjs +1 -1
  19. package/es/VarietySearch.js +32 -41
  20. package/es/VirtualTable.cjs +1 -13
  21. package/es/VirtualTable.js +1 -2801
  22. package/es/_initCloneObject-7493ecd5.cjs +1 -0
  23. package/es/{_initCloneObject-14b53c6f.js → _initCloneObject-a8dcd058.js} +26 -26
  24. package/es/{base-ec05f348.cjs → base-00ce90ec.cjs} +3 -3
  25. package/es/{base-437d17f3.js → base-674a354a.js} +63 -64
  26. package/es/config-provider-419ffbf2.js +120 -0
  27. package/es/config-provider-68414290.cjs +3 -0
  28. package/es/dropdown-127a8c0d.cjs +1 -0
  29. package/es/{dropdown-634b5e27.js → dropdown-ce30ada6.js} +30 -31
  30. package/es/el-button-7b9f5933.js +745 -0
  31. package/es/el-button-c00975e1.cjs +1 -0
  32. package/es/{el-checkbox-group-e8fece80.js → el-checkbox-group-0554b352.js} +10 -10
  33. package/es/el-checkbox-group-7a313d34.cjs +1 -0
  34. package/es/{el-empty-bacc6613.js → el-empty-39b3aed7.js} +5 -5
  35. package/es/{el-empty-19ea04f4.cjs → el-empty-87154b6d.cjs} +1 -1
  36. package/es/el-form-item-7867f64d.cjs +12 -0
  37. package/es/{el-form-item-af1855f0.js → el-form-item-fc6f80ab.js} +78 -79
  38. package/es/el-input-2ff1628c.cjs +1 -0
  39. package/es/{el-input-4961b99f.js → el-input-d249ac86.js} +82 -84
  40. package/es/{el-input-number-610fc8ba.js → el-input-number-2066fbb7.js} +35 -36
  41. package/es/el-input-number-d6801a5c.cjs +1 -0
  42. package/es/{el-message-c3b3ac96.js → el-message-9859835d.js} +79 -81
  43. package/es/el-message-ffcf690c.cjs +1 -0
  44. package/es/el-overlay-91784be2.cjs +1 -0
  45. package/es/el-overlay-f0757cc4.js +525 -0
  46. package/es/el-popover-4db657e2.cjs +1 -0
  47. package/es/{el-popover-0aa071f2.js → el-popover-b7b43c1f.js} +18 -18
  48. package/es/el-scrollbar-35bac6b3.js +2452 -0
  49. package/es/el-scrollbar-ec09bbd3.cjs +1 -0
  50. package/es/el-select-0785c35a.cjs +1 -0
  51. package/es/{el-select-9381b156.js → el-select-bcbb7e55.js} +329 -333
  52. package/es/el-table-column-2478adf8.cjs +14 -0
  53. package/es/{el-table-column-55bffba5.js → el-table-column-c1e1a206.js} +346 -350
  54. package/es/el-tag-13ee17b3.cjs +1 -0
  55. package/es/el-tag-73372c6c.js +359 -0
  56. package/es/index-07b61d12.cjs +1 -0
  57. package/es/{index-39ec9741.js → index-45de4a12.js} +7 -7
  58. package/es/index-65b719a4.cjs +1 -0
  59. package/es/index-8b5fbc11.js +66 -0
  60. package/es/index-8c85d7c5.js +858 -0
  61. package/es/index-a49f4743.cjs +2 -0
  62. package/es/{scroll-387fcfdb.js → scroll-cb696ed2.js} +1 -1
  63. package/es/{scroll-41224831.cjs → scroll-cca17da0.cjs} +1 -1
  64. package/es/style.css +1 -1
  65. package/es/{zh-cn-ab9a583d.cjs → zh-cn-37af467d.cjs} +1 -1
  66. package/es/{zh-cn-eb9c2820.js → zh-cn-ef7d7220.js} +2 -2
  67. package/lib/bundle.js +1 -1
  68. package/lib/bundle.umd.cjs +206 -206
  69. package/lib/{index-9b8ff62a.js → index-24f8572c.js} +31450 -33319
  70. package/lib/{python-a9c3d9e5.js → python-2143eee4.js} +1 -1
  71. package/lib/style.css +1 -1
  72. package/package.json +1 -1
  73. package/packages/KlineBasic/components/KlineSub/index.vue +17 -3
  74. package/packages/KlineBasic/index.vue +2 -1
  75. package/packages/KlineBasic/utils.js +20 -2
  76. package/packages/index.ts +0 -2
  77. package/src/pages/KlineBasic/api.js +1 -1
  78. package/src/router/routes.ts +0 -5
  79. package/es/Kline.cjs +0 -1
  80. package/es/Kline.js +0 -1901
  81. package/es/_initCloneObject-441db749.cjs +0 -1
  82. package/es/castArray-4251bbe4.js +0 -10
  83. package/es/castArray-a45823fe.cjs +0 -1
  84. package/es/config-provider-55482a43.js +0 -47
  85. package/es/config-provider-7cdfca4d.cjs +0 -1
  86. package/es/debounce-ac30be50.js +0 -83
  87. package/es/debounce-b2ff12bd.cjs +0 -1
  88. package/es/dropdown-d7c59a21.cjs +0 -1
  89. package/es/el-button-196807af.cjs +0 -1
  90. package/es/el-button-e1665717.js +0 -235
  91. package/es/el-checkbox-group-492b95cc.cjs +0 -1
  92. package/es/el-form-item-5bdffd07.cjs +0 -12
  93. package/es/el-input-23e2bac3.cjs +0 -1
  94. package/es/el-input-number-40a81eb5.cjs +0 -1
  95. package/es/el-menu-item-78b858f2.cjs +0 -1
  96. package/es/el-menu-item-7d04c11a.js +0 -771
  97. package/es/el-message-d4df8136.cjs +0 -1
  98. package/es/el-overlay-12dd9b35.js +0 -519
  99. package/es/el-overlay-bc0790a2.cjs +0 -1
  100. package/es/el-popover-8a77e015.cjs +0 -1
  101. package/es/el-popper-50100766.js +0 -2262
  102. package/es/el-popper-746070ba.cjs +0 -1
  103. package/es/el-scrollbar-562d0595.js +0 -201
  104. package/es/el-scrollbar-d1c3e7f7.cjs +0 -1
  105. package/es/el-select-b162dffc.cjs +0 -1
  106. package/es/el-table-column-6d761fce.cjs +0 -14
  107. package/es/el-tag-985d9aff.js +0 -279
  108. package/es/el-tag-c51a6490.cjs +0 -1
  109. package/es/index-09e01b1d.js +0 -81
  110. package/es/index-0cb48e01.js +0 -306
  111. package/es/index-3bf8d597.cjs +0 -1
  112. package/es/index-657047bb.js +0 -513
  113. package/es/index-8a0b1c53.cjs +0 -3
  114. package/es/index-a387515d.cjs +0 -1
  115. package/es/index-a902a0d9.js +0 -59
  116. package/es/index-deb8de52.cjs +0 -1
  117. package/es/index-eea0bcb3.cjs +0 -1
  118. package/es/index.esm-8d9a2abe.js +0 -2432
  119. package/es/index.esm-94a95a2a.cjs +0 -3
  120. package/es/raf-8fc301fd.cjs +0 -1
  121. package/es/raf-b128c7b7.js +0 -6
  122. package/es/typescript-7ae59c4c.js +0 -4
  123. package/es/typescript-b63f8e83.cjs +0 -1
  124. package/es/use-form-common-props-1b84d8f4.cjs +0 -2
  125. package/es/use-form-common-props-f377e500.js +0 -587
  126. package/es/vnode-7dfd4ed5.js +0 -14
  127. package/es/vnode-7fbc61e1.cjs +0 -1
  128. package/packages/Kline/components/Contextmenu/index.vue +0 -110
  129. package/packages/Kline/components/Tips/index.vue +0 -40
  130. package/packages/Kline/componentsNew/KlineSlide/index.vue +0 -155
  131. package/packages/Kline/componentsNew/KlineSub/index.vue +0 -297
  132. package/packages/Kline/componentsNew/KlineTips/index.vue +0 -66
  133. package/packages/Kline/componentsNew/KlineUtils/index.vue +0 -84
  134. package/packages/Kline/componentsNew/Tips/index.vue +0 -33
  135. package/packages/Kline/formatKlineData.ts +0 -109
  136. package/packages/Kline/images/buy.svg +0 -1
  137. package/packages/Kline/images/pen.png +0 -0
  138. package/packages/Kline/images/sell.svg +0 -1
  139. package/packages/Kline/images/t.svg +0 -1
  140. package/packages/Kline/index.ts +0 -16
  141. package/packages/Kline/index.vue +0 -891
  142. package/packages/Kline/option.ts +0 -539
  143. package/packages/Kline/type.d.ts +0 -219
  144. package/packages/Kline/utils.ts +0 -682
  145. package/src/pages/Kline/api.ts +0 -127
  146. package/src/pages/Kline/components/MultiCycleSingleVariety.vue +0 -701
  147. package/src/pages/Kline/components/SingleCycleSingleVariety.vue +0 -924
  148. package/src/pages/Kline/index.vue +0 -90
@@ -1,701 +0,0 @@
1
- <!-- 单品种多周期K线组件-Demo -->
2
- <script setup lang="ts">
3
- import { RefreshRight } from "@element-plus/icons-vue";
4
- import { ref, onMounted, onUnmounted, watch } from "vue";
5
- import dayjs from "dayjs";
6
- import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
7
- import { ElMessage } from "element-plus";
8
- import "element-plus/dist/index.css";
9
- import { formatValue } from "../../../../packages/Kline/utils";
10
- import { getSingleCycleSingleVariety, getDict } from "../api.ts";
11
- import { mainIndicatorList } from "st-func";
12
-
13
- dayjs.extend(isSameOrAfter);
14
-
15
- const props = defineProps({
16
- deBugValue: {
17
- type: Number,
18
- },
19
- });
20
-
21
- // K线组件数组[多周期]
22
- interface multiCycleKlineType {
23
- loading: boolean;
24
- isSelect: boolean;
25
- cycle: string; // 周期
26
- cycleName: string; // 周期名称
27
- sellBuyType: number; // 开平/买卖类型
28
- sellBuyTypeName: string; // 开平/买卖
29
- klineData: any[]; // K线接口数据
30
- markData: any[]; // 点位接口数据
31
- netWorkErrorMsg: string;
32
- indicatorName: string;
33
- indicator: object;
34
- }
35
- const multiCycleKline = ref<multiCycleKlineType[]>([]);
36
-
37
- // 筛选条件相关参数
38
- const sellBuyTypeOptions = ref<any>([
39
- { label: "开平", value: 1 },
40
- { label: "买卖", value: 2 },
41
- ]);
42
-
43
- // 接口原生-点位数据
44
- const originPointData = ref<any>([]);
45
-
46
- // K线组件统一入参
47
- const lineData = ref<any>([]);
48
- const brushRange = ref<any>(["2024-01-04 10:10:00", "2024-01-04 21:40:00"]);
49
- const defaultMenuData = ref([
50
- {
51
- label: "画线预警",
52
- callBack: (echartsInstance: any, cursorPenVisible: any) => createWarning(echartsInstance, cursorPenVisible),
53
- },
54
- ]);
55
- const config = ref({
56
- totalBarCount: 1900,
57
- preBarCount: 100,
58
- dynamicLoadConfig: {
59
- historyVisible: false,
60
- historyLoadCallBack: () => {},
61
- futureVisible: false,
62
- },
63
- });
64
-
65
- onMounted(() => {
66
- console.log("---------单品种多周期组件: onMounted挂载成功---------");
67
- });
68
-
69
- // 初始化
70
- const componentInit = async () => {
71
- try {
72
- await getDictCycle();
73
- await getKlineData();
74
- await getKlineExtendData();
75
- } catch (error) {
76
- console.log(error);
77
- }
78
- };
79
-
80
- /**
81
- * @description: 获取通用字典[周期],初始化多周期结构
82
- */
83
- const getDictCycle = async () => {
84
- const params = {
85
- dictIds: [1002],
86
- };
87
- const res = await getDict(params);
88
- multiCycleKline.value = res.data.body[1002].map((item: any) => {
89
- return {
90
- loading: true,
91
- cycle: Number(item.dictCode),
92
- cycleName: item.dictName,
93
- sellBuyType: 1,
94
- sellBuyTypeName: "开平",
95
- klineData: [],
96
- markData: [],
97
- netWorkErrorMsg: "",
98
- indicator: mainIndicatorList.find((i: any) => i.value === "DKX_EMA"),
99
- indicatorName: "DKX_EMA",
100
- };
101
- });
102
- };
103
- /**
104
- * @description: 获取K线数据 / 点位数据
105
- */
106
- const getKlineData = async () => {
107
- multiCycleKline.value.forEach(async (item: any) => {
108
- item.loading = true;
109
-
110
- // ---------K线数据逻辑----------
111
- const params = {
112
- right: 1, // 复权方式
113
- variety: "au8888", // 品种
114
- cycle: item.cycle, // 周期
115
- endTime: "2024-01-04 23:59:59", // 结束时间
116
- limit: config.value.totalBarCount + config.value.preBarCount, // 总条数
117
- queryType: 1, // 0-按时间,1-按结束时间,2-按开始时间
118
- };
119
- const res = await getSingleCycleSingleVariety(params);
120
- item.klineData = res.data.body;
121
- // ---------点位数据逻辑---------
122
- const resultApi = [
123
- {
124
- key: "sellBuy",
125
- data: [
126
- {
127
- tradeAction: "开", // 交易动作
128
- direction: "多", // 交易方向
129
- tradeType: "开多", // 交易类型
130
- amount: 2, // 手数
131
- part: 2, // 份数
132
- time: "2024-01-04 22:30:00", // 交易时间
133
- tooltip: "<div>买卖点1</div>",
134
- },
135
- {
136
- tradeAction: "平", // 交易动作
137
- direction: "空", // 交易方向
138
- tradeType: "平空", // 交易类型
139
- amount: 2, // 手数
140
- part: 2, // 份数
141
- time: "2024-01-04 22:40:00", // 交易时间
142
- tooltip: "<div>买卖点2</div>",
143
- },
144
- {
145
- tradeAction: "开", // 交易动作
146
- direction: "空", // 交易方向
147
- tradeType: "开空", // 交易类型
148
- amount: 2, // 手数
149
- part: 2, // 份数
150
- time: "2024-01-04 23:50:00", // 交易时间
151
- tooltip: "<div>买卖点3</div>",
152
- },
153
- ],
154
- },
155
- {
156
- key: "openClose",
157
- data: [
158
- {
159
- tradeAction: "开", // 交易动作
160
- direction: "多", // 交易方向
161
- tradeType: "开多", // 交易类型
162
- amount: 2, // 手数
163
- part: 2, // 份数
164
- time: "2024-01-04 22:30:00", // 交易时间
165
- tooltip: "<div>开平点1</div>",
166
- },
167
- {
168
- tradeAction: "平", // 交易动作
169
- direction: "空", // 交易方向
170
- tradeType: "平空", // 交易类型
171
- amount: 2, // 手数
172
- part: 2, // 份数
173
- time: "2024-01-04 22:40:00", // 交易时间
174
- tooltip: "<div>开平点2</div>",
175
- },
176
- {
177
- tradeAction: "开", // 交易动作
178
- direction: "空", // 交易方向
179
- tradeType: "开空", // 交易类型
180
- amount: 2, // 手数
181
- part: 2, // 份数
182
- time: "2024-01-04 23:50:00", // 交易时间
183
- tooltip: "<div>买卖点3</div>",
184
- },
185
- ],
186
- },
187
- {
188
- key: "signal",
189
- data: [],
190
- },
191
- ];
192
- const klineTimeAry = item.klineData.map((item: any) => item[0]);
193
- originPointData.value = resultApi.reduce((result: any, next) => {
194
- const { data } = next;
195
- result.push({
196
- key: next.key,
197
- data: data.map((i: any) => {
198
- const time = klineTimeAry.find((klineTime: string) => dayjs(klineTime).isSameOrAfter(i.time));
199
- return {
200
- ...i,
201
- time,
202
- };
203
- }),
204
- });
205
- return result;
206
- }, []);
207
- sellBuyTypeChange(item);
208
-
209
- item.loading = false;
210
- });
211
- };
212
- /**
213
- * @description: 获取K线额外画线数据
214
- */
215
- const getKlineExtendData = async () => {
216
- lineData.value = [
217
- {
218
- key: "warning",
219
- data: [
220
- {
221
- value: 479,
222
- text: 479,
223
- // 自定义信息
224
- info: {},
225
- // 自定义配置
226
- config: {
227
- draggable: true,
228
- },
229
- },
230
- ],
231
- ondragstart: (params: any, info: any) => {
232
- console.log("拖拽开始", params, info);
233
- },
234
- ondragend: (params: any, info: any, yAxisValue: number) => {
235
- console.log("拖拽结束", params, info, yAxisValue);
236
- ElMessage.success("预警线修改更新成功!");
237
- },
238
- oncontextmenu: (params: any, info: any, menuData: any) => {
239
- console.log("右击了", params, info);
240
- menuData.value = [
241
- {
242
- label: "删除画线",
243
- callBack: () => ElMessage.success("预警线删除成功!"),
244
- },
245
- {
246
- label: "修改画线",
247
- callBack: () => ElMessage.success("预警线修改成功!"),
248
- },
249
- ];
250
- },
251
- },
252
- {
253
- key: "position",
254
- data: [
255
- {
256
- value: 480,
257
- text: "持仓:192.14万(1份) 数量:4手 方向:多 浮动盈亏:-1280.00",
258
- // 自定义信息
259
- info: {},
260
- // 自定义配置
261
- config: {},
262
- },
263
- ],
264
- },
265
- {
266
- key: "condition",
267
- data: [
268
- {
269
- value: 482,
270
- text: "[多损][多盈] 开多↓2269 1份(22手)",
271
- profitValue: 483,
272
- profitText: "上破484",
273
- lossValue: 481,
274
- lossText: "下破482",
275
- // 自定义信息
276
- info: {},
277
- // 自定义配置
278
- config: {},
279
- },
280
- ],
281
- },
282
- ];
283
- };
284
- /**
285
- * @description: 买卖点,开平点切换
286
- */
287
- const sellBuyTypeChange = (item: any) => {
288
- if (sellBuyTypeOptions.value.length > 0) {
289
- item.sellBuyTypeName = sellBuyTypeOptions.value.find((i: any) => i.value === item.sellBuyType).label ?? null;
290
- }
291
- if (item.sellBuyType === 1) {
292
- item.markData = originPointData.value.filter((i: any) => {
293
- return i.key !== "sellBuy";
294
- });
295
- } else {
296
- item.markData = originPointData.value.filter((i: any) => {
297
- return i.key !== "openClose";
298
- });
299
- }
300
- };
301
- /**
302
- * @description: 切换指标
303
- */
304
- const indicatorChange = (item: any) => {
305
- item.indicator = mainIndicatorList.find((i: any) => i.value === item.indicatorName);
306
- };
307
-
308
- // 画线预警
309
- const createWarning = (echartsInstance: any, cursorPenVisible: any) => {
310
- // 1.打开画笔模式,并修改指示器样式[画预览线]
311
- cursorPenVisible.value = true;
312
- const echartsOptions = echartsInstance.getOption();
313
- const oldTooltip = (echartsOptions.tooltip as Array<any>)[0];
314
- echartsInstance.setOption({
315
- ...echartsOptions,
316
- // 指示器样式
317
- tooltip: {
318
- ...oldTooltip,
319
- // 坐标轴指示器
320
- axisPointer: {
321
- // 保留原有部分配置
322
- ...oldTooltip.axisPointer,
323
- // X轴指示线的宽度
324
- lineStyle: {
325
- width: 0,
326
- },
327
- // Y轴指示线的宽度
328
- crossStyle: {
329
- width: 2,
330
- },
331
- // 文本标签
332
- label: {
333
- // 保留原有部分配置
334
- ...oldTooltip.axisPointer.label,
335
- // 颜色改为透明
336
- backgroundColor: "transparent",
337
- // 仅显示Y轴值
338
- formatter: (data: any) => {
339
- const { axisDimension, value } = data;
340
- if (axisDimension === "y") {
341
- return String(formatValue(value));
342
- }
343
- return "";
344
- },
345
- },
346
- },
347
- },
348
- });
349
- // 2.获取当前列数据并发送请求至后端记录
350
- const handleClick = (el: any) => {
351
- // 关闭画笔模式,并移除echarts点击事件
352
- cursorPenVisible.value = false;
353
- echartsInstance.getZr().off("mousedown", handleClick);
354
- const yAxisValue = echartsInstance.convertFromPixel({ yAxisIndex: 0 }, el.offsetY);
355
- const newWarnPrice = Math.round(yAxisValue * 1000) / 1000;
356
- // 3.恢复指示器样式
357
- echartsInstance.setOption({
358
- ...echartsOptions,
359
- // 指示器样式
360
- tooltip: {
361
- ...oldTooltip,
362
- axisPointer: {
363
- ...oldTooltip.axisPointer,
364
- lineStyle: {
365
- width: 1,
366
- },
367
- crossStyle: {
368
- width: 1,
369
- },
370
- label: {
371
- ...oldTooltip.axisPointer.label,
372
- backgroundColor: null,
373
- },
374
- },
375
- },
376
- });
377
- // 4.发送保存预警线请求
378
- lineData.value[0].data.push({
379
- value: newWarnPrice,
380
- text: newWarnPrice,
381
- // 自定义信息
382
- info: {},
383
- // 自定义配置
384
- config: {
385
- draggable: true,
386
- },
387
- });
388
- ElMessage.success("画线预警成功!");
389
- };
390
- // 绑定echarts点击事件
391
- echartsInstance.getZr().on("mousedown", handleClick);
392
- };
393
-
394
- watch(
395
- () => props.deBugValue,
396
- (newValue: any) => {
397
- if (newValue === 1) {
398
- // 正常模式
399
- componentInit();
400
- } else {
401
- multiCycleKline.value.forEach((item: any) => {
402
- if (newValue === 2) {
403
- // 网络故障
404
- item.loading = true;
405
- setTimeout(() => {
406
- item.netWorkErrorMsg = "网络加载失败,请刷新重试";
407
- item.loading = false;
408
- }, 1000);
409
- } else if (newValue === 3) {
410
- // 空数据
411
- item.netWorkErrorMsg = "";
412
- item.loading = true;
413
- setTimeout(() => {
414
- item.klineData = [];
415
- item.loading = false;
416
- }, 1000);
417
- }
418
- });
419
- }
420
- },
421
- {
422
- immediate: true,
423
- }
424
- );
425
-
426
- onUnmounted(() => {
427
- console.log("---------单品种多周期组件: onUnmounted卸载成功---------");
428
- });
429
-
430
- const reFresh = async (item: any) => {
431
- item.netWorkErrorMsg = "";
432
- item.loading = true;
433
-
434
- // ---------K线数据逻辑----------
435
- const params = {
436
- right: 1, // 复权方式
437
- variety: "au8888", // 品种
438
- cycle: item.cycle, // 周期
439
- endTime: "2024-01-04 23:59:59", // 结束时间
440
- limit: config.value.totalBarCount + config.value.preBarCount, // 总条数
441
- queryType: 1, // 0-按时间,1-按结束时间,2-按开始时间
442
- };
443
- const res = await getSingleCycleSingleVariety(params);
444
- item.klineData = res.data.body;
445
- // ---------点位数据逻辑---------
446
- const resultApi = [
447
- {
448
- key: "sellBuy",
449
- data: [
450
- {
451
- tradeAction: "开", // 交易动作
452
- direction: "多", // 交易方向
453
- tradeType: "开多", // 交易类型
454
- amount: 2, // 手数
455
- part: 2, // 份数
456
- time: "2024-01-04 22:30:00", // 交易时间
457
- tooltip: "<div>买卖点1</div>",
458
- },
459
- {
460
- tradeAction: "平", // 交易动作
461
- direction: "空", // 交易方向
462
- tradeType: "平空", // 交易类型
463
- amount: 2, // 手数
464
- part: 2, // 份数
465
- time: "2024-01-04 22:40:00", // 交易时间
466
- tooltip: "<div>买卖点2</div>",
467
- },
468
- {
469
- tradeAction: "开", // 交易动作
470
- direction: "空", // 交易方向
471
- tradeType: "开空", // 交易类型
472
- amount: 2, // 手数
473
- part: 2, // 份数
474
- time: "2024-01-04 23:50:00", // 交易时间
475
- tooltip: "<div>买卖点3</div>",
476
- },
477
- ],
478
- },
479
- {
480
- key: "openClose",
481
- data: [
482
- {
483
- tradeAction: "开", // 交易动作
484
- direction: "多", // 交易方向
485
- tradeType: "开多", // 交易类型
486
- amount: 2, // 手数
487
- part: 2, // 份数
488
- time: "2024-01-04 22:30:00", // 交易时间
489
- tooltip: "<div>开平点1</div>",
490
- },
491
- {
492
- tradeAction: "平", // 交易动作
493
- direction: "空", // 交易方向
494
- tradeType: "平空", // 交易类型
495
- amount: 2, // 手数
496
- part: 2, // 份数
497
- time: "2024-01-04 22:40:00", // 交易时间
498
- tooltip: "<div>开平点2</div>",
499
- },
500
- {
501
- tradeAction: "开", // 交易动作
502
- direction: "空", // 交易方向
503
- tradeType: "开空", // 交易类型
504
- amount: 2, // 手数
505
- part: 2, // 份数
506
- time: "2024-01-04 23:50:00", // 交易时间
507
- tooltip: "<div>买卖点3</div>",
508
- },
509
- ],
510
- },
511
- {
512
- key: "signal",
513
- data: [],
514
- },
515
- ];
516
- const klineTimeAry = item.klineData.map((item: any) => item[0]);
517
- originPointData.value = resultApi.reduce((result: any, next) => {
518
- const { data } = next;
519
- result.push({
520
- key: next.key,
521
- data: data.map((i: any) => {
522
- const time = klineTimeAry.find((klineTime: string) => dayjs(klineTime).isSameOrAfter(i.time));
523
- return {
524
- ...i,
525
- time,
526
- };
527
- }),
528
- });
529
- return result;
530
- }, []);
531
- sellBuyTypeChange(item);
532
-
533
- item.loading = false;
534
-
535
- getKlineExtendData();
536
- };
537
- </script>
538
-
539
- <template>
540
- <div id="single-cycle-single-variety">
541
- <template v-if="multiCycleKline.length">
542
- <div
543
- v-for="(item, index) in multiCycleKline"
544
- @mousemove="item.isSelect = true"
545
- @mouseout="item.isSelect = false"
546
- :key="index"
547
- class="st-Kline"
548
- v-loading="item.loading"
549
- element-loading-text="正在加载数据中,请稍等..."
550
- >
551
- <!-- 功能区 -->
552
- <div class="kline-header">
553
- <!-- 品种名称 -->
554
- <div class="kline-header-item">黄金 au8888</div>
555
- <!-- 周期名称 -->
556
- <div class="kline-header-item">
557
- <span>{{ item.cycleName }}</span>
558
- </div>
559
- <!-- 指标展示 + 选择 -->
560
- <div class="kline-header-item sellBuySelect">
561
- <span>{{ item.indicatorName }}</span>
562
- <el-select v-model="item.indicatorName" popper-class="element-dark" @change="indicatorChange(item)">
563
- <el-option
564
- v-for="(item, index) in mainIndicatorList"
565
- :key="index"
566
- :label="item.label"
567
- :value="item.value"
568
- />
569
- </el-select>
570
- </div>
571
- <!-- 开平/买卖展示 + 选择 -->
572
- <div class="kline-header-item sellBuySelect">
573
- <span>{{ item.sellBuyTypeName }}</span>
574
- <el-select v-model="item.sellBuyType" popper-class="element-dark" @change="sellBuyTypeChange(item)">
575
- <el-option
576
- v-for="(item, index) in sellBuyTypeOptions"
577
- :key="index"
578
- :label="item.label"
579
- :value="item.value"
580
- />
581
- </el-select>
582
- </div>
583
- </div>
584
- <!-- K线本体 -->
585
- <st-kline
586
- v-if="!item.loading && item.klineData.length && !item.netWorkErrorMsg"
587
- class="kline"
588
- :indicator="item.indicator"
589
- :klineData="item.klineData"
590
- :markData="item.markData"
591
- :lineData="lineData"
592
- :brushRange="brushRange"
593
- :defaultMenuData="defaultMenuData"
594
- :isSelect="item.isSelect"
595
- :config="config"
596
- />
597
- <!-- 网络请求错误时 -->
598
- <div v-if="item.netWorkErrorMsg" class="netWorkError">
599
- <span>{{ item.netWorkErrorMsg }}</span>
600
- <el-button size="small" @click="reFresh(item)" :icon="RefreshRight">刷新</el-button>
601
- </div>
602
- <!-- 空数据时 -->
603
- <div class="empty" v-else-if="!item.loading && item.klineData.length === 0">
604
- <el-empty description="暂无数据" />
605
- </div>
606
- </div>
607
- </template>
608
- </div>
609
- </template>
610
-
611
- <style lang="scss" scoped>
612
- #single-cycle-single-variety {
613
- margin: auto;
614
- width: 100%;
615
- height: 100%;
616
- display: grid;
617
- grid-template-columns: repeat(3, 33%);
618
- grid-template-rows: repeat(6, 33%);
619
- grid-gap: 4px;
620
- overflow: hidden;
621
- .st-Kline {
622
- display: flex;
623
- flex-direction: column;
624
- border-radius: 2px;
625
- box-sizing: border-box;
626
- background-color: black;
627
- color-scheme: dark;
628
- --el-mask-color: rgba(0, 0, 0, 0.8);
629
- .kline-header {
630
- font-size: 12px;
631
- display: flex;
632
- align-items: center;
633
- color: white;
634
- border-bottom: 1px solid rgb(153, 153, 153);
635
- .kline-header-item {
636
- display: flex;
637
- align-items: center;
638
- border-right: 1px solid rgb(153, 153, 153);
639
- padding: 6px;
640
- box-sizing: border-box;
641
- }
642
- // 功能区: 开平/买卖
643
- .sellBuySelect {
644
- :deep(.el-select) {
645
- margin-left: 6px;
646
- width: 12px;
647
- .el-input__wrapper {
648
- height: 12px;
649
- padding: 0;
650
- border-radius: 50%;
651
- background-color: #ccc;
652
- }
653
- .el-input__inner {
654
- width: 0;
655
- }
656
- .el-select__icon {
657
- color: black;
658
- width: 12px;
659
- height: 12px;
660
- margin-left: 0;
661
- }
662
- }
663
- }
664
- }
665
- .kline {
666
- flex: 1;
667
- }
668
- .netWorkError {
669
- color: white;
670
- font-weight: 600;
671
- display: flex;
672
- flex-direction: column;
673
- align-items: center;
674
- justify-content: center;
675
- width: 100%;
676
- height: 100%;
677
- font-size: 18px;
678
- .el-button {
679
- margin-top: 10px;
680
- background-color: rgb(0, 0, 0);
681
- color: white;
682
- }
683
- }
684
- .empty {
685
- color: white;
686
- font-weight: 600;
687
- display: flex;
688
- flex-direction: column;
689
- align-items: center;
690
- justify-content: center;
691
- width: 100%;
692
- height: 100%;
693
- :deep(.el-empty__image) {
694
- svg {
695
- width: 100px;
696
- }
697
- }
698
- }
699
- }
700
- }
701
- </style>