st-comp 0.0.126 → 0.0.128
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.
- package/es/ChartLayout.js +2 -2
- package/es/Dialog.cjs +1 -1
- package/es/Dialog.js +13 -14
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +74 -74
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +14 -14
- package/es/KlineBasic.cjs +1 -6
- package/es/KlineBasic.js +863 -2449
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +12 -12
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +17 -18
- package/es/Pie.cjs +1 -1
- package/es/Pie.js +1 -1
- package/es/Table.cjs +1 -1
- package/es/Table.js +17 -18
- package/es/User.cjs +1 -1
- package/es/User.js +74 -75
- package/es/VarietySearch.cjs +1 -1
- package/es/VarietySearch.js +34 -34
- package/es/VirtualTable.cjs +1 -1
- package/es/VirtualTable.js +12 -13
- package/es/{base-a8f938bd.js → base-3ecbc734.js} +2 -2
- package/es/{castArray-5c01dae1.js → castArray-7d3fc921.js} +1 -1
- package/es/config-provider-7cdfca4d.cjs +1 -0
- package/es/{config-provider-d3edea8a.js → config-provider-83904b4d.js} +3 -3
- package/es/{debounce-edbff018.js → debounce-7344b088.js} +1 -1
- package/es/{dropdown-7e381525.js → dropdown-7da44c8f.js} +4 -4
- package/es/el-button-196807af.cjs +1 -0
- package/es/{el-button-ce99c64e.js → el-button-24f79286.js} +5 -6
- package/es/{el-empty-ed6c115b.js → el-empty-79c5f7a8.js} +1 -1
- package/es/el-form-item-7d32befa.cjs +12 -0
- package/es/el-form-item-afc3dcf2.js +1324 -0
- package/es/{el-input-21e079e4.js → el-input-ee7db655.js} +5 -5
- package/es/el-input-number-0524d787.cjs +1 -0
- package/es/el-input-number-63c21037.js +282 -0
- package/es/{el-menu-item-9369a2ad.js → el-menu-item-0d92e7dc.js} +7 -7
- package/es/el-message-562e923d.cjs +1 -0
- package/es/{el-message-fd827012.js → el-message-71aa42ca.js} +16 -16
- package/es/{el-overlay-9245ec1e.js → el-overlay-6056c89a.js} +76 -77
- package/es/el-overlay-891dcc40.cjs +1 -0
- package/es/{el-popover-6f48d00b.cjs → el-popover-8735b1fa.cjs} +1 -1
- package/es/{el-popover-6f075cee.js → el-popover-c8b2456c.js} +4 -4
- package/es/{el-popper-8dca8dd4.js → el-popper-d3eef7ed.js} +4 -4
- package/es/{el-scrollbar-906103f8.js → el-scrollbar-66f3bb72.js} +1 -1
- package/es/{el-select-6d6093eb.js → el-select-5fb7d469.js} +10 -10
- package/es/{el-table-column-3f388c44.js → el-table-column-560db3aa.js} +14 -15
- package/es/el-table-column-dd8b62aa.cjs +14 -0
- package/es/{el-tag-cdf0019e.js → el-tag-6a31c968.js} +3 -3
- package/es/index-68ee64fa.js +81 -0
- package/es/{index-f8e448bc.js → index-8542fe24.js} +3924 -3873
- package/es/{use-global-config-ac2dad80.cjs → index-8a0b1c53.cjs} +3 -1
- package/es/{index-53bce290.js → index-a1ecf26c.js} +3 -3
- package/es/{index-d1b7c61e.cjs → index-a96158ae.cjs} +41 -36
- package/es/{index-6ced00c4.js → index-fa07a823.js} +1 -1
- package/es/{raf-b584bce8.js → raf-377cf8f5.js} +1 -1
- package/es/{refs-e1675167.js → refs-46cf8186.js} +1 -1
- package/es/{scroll-25ec9230.js → scroll-1efa8148.js} +1 -1
- package/es/style.css +1 -1
- package/es/{use-form-common-props-f7d2e83c.js → use-form-common-props-9c0363ac.js} +1 -1
- package/es/{vnode-699e61cb.js → vnode-cfcdab70.js} +1 -1
- package/es/{zh-cn-61ca7f91.js → zh-cn-4a476dc8.js} +2 -2
- package/es/{zh-cn-a20960b5.cjs → zh-cn-ab9a583d.cjs} +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +202 -202
- package/lib/{index-0207fed8.js → index-c2cabc8b.js} +32548 -34091
- package/lib/{python-cac37206.js → python-d3e3fec3.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/KlineBasic/api.js +39 -41
- package/packages/KlineBasic/index.vue +207 -159
- package/packages/KlineBasic/utils.js +173 -72
- package/src/pages/KlineBasic/index.vue +1 -0
- package/es/config-provider-4954003d.cjs +0 -1
- package/es/el-button-c7b375c4.cjs +0 -1
- package/es/el-form-item-b686a8bb.js +0 -1599
- package/es/el-form-item-ff0d8d07.cjs +0 -12
- package/es/el-message-e97bdea1.cjs +0 -1
- package/es/el-overlay-7b90d61c.cjs +0 -1
- package/es/el-table-column-26e7f13f.cjs +0 -14
- package/es/index-669a0983.js +0 -14
- package/es/index-c4649a37.cjs +0 -3
- package/es/use-global-config-8429db7d.js +0 -72
package/package.json
CHANGED
|
@@ -1,60 +1,58 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getToken, getUserData } from 'st-func'
|
|
1
|
+
import { initRequest, isLogin, getToken, loginout, getUserData } from "st-func";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let get = null;
|
|
4
|
+
let post = null;
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
export const initRequestByEnv = (env) => {
|
|
7
|
+
const requestFn = initRequest(env, {
|
|
8
|
+
handleReq: (request) => {
|
|
9
|
+
if (isLogin()) {
|
|
10
|
+
request.headers["token"] = getToken();
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
handleRes: (response) => {
|
|
14
|
+
const { data } = response;
|
|
15
|
+
// 登录失效
|
|
16
|
+
if (data.code === 401) {
|
|
17
|
+
if (location.origin.includes("localhost")) {
|
|
18
|
+
location.href = `${location.origin}/#/404`;
|
|
19
|
+
} else {
|
|
20
|
+
loginout();
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
14
25
|
});
|
|
15
|
-
|
|
26
|
+
get = requestFn.get;
|
|
27
|
+
post = requestFn.post;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 获取K线数据以及基础数据
|
|
31
|
+
export const getKlineBasic = (data) => {
|
|
32
|
+
return post("/middleLayer/kline/getKlineBasic", { ...data, userId: getUserData('id')});
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
// 获取K线数据
|
|
19
|
-
export const getKline =
|
|
20
|
-
|
|
21
|
-
method: "post",
|
|
22
|
-
headers: { token },
|
|
23
|
-
url: `${host}/middleLayer/kline/getKline`,
|
|
24
|
-
data,
|
|
25
|
-
});
|
|
26
|
-
return res.data;
|
|
36
|
+
export const getKline = (data) => {
|
|
37
|
+
return post("/middleLayer/kline/getKline", data);
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
// 画线预警
|
|
30
41
|
export const addWarningLine = async (data) => {
|
|
31
|
-
|
|
32
|
-
method: "post",
|
|
33
|
-
headers: { token },
|
|
34
|
-
url: `${host}/middleLayer/post/alarm/deliversign/addAlarmPrice`,
|
|
35
|
-
data: { ...data, userId: getUserData('id')},
|
|
36
|
-
});
|
|
37
|
-
return res.data;
|
|
42
|
+
return post("/alarm/deliversign/addAlarmPrice", { ...data, userId: getUserData('id')});
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
// 获取画线预警列表
|
|
41
46
|
export const getWarningLine = async (data) => {
|
|
42
|
-
|
|
43
|
-
method: "post",
|
|
44
|
-
headers: { token },
|
|
45
|
-
url: `${host}/middleLayer/post/alarm/deliversign/findAlarmPriceByUserId`,
|
|
46
|
-
data: { ...data, userId: getUserData('id')},
|
|
47
|
-
});
|
|
48
|
-
return res.data;
|
|
47
|
+
return post("/alarm/deliversign/findAlarmPriceByUserId", { ...data, userId: getUserData('id')});
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
// 更新画线预警
|
|
52
51
|
export const updateWarningLine = async (data) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
return res.data;
|
|
52
|
+
return post("/alarm/deliversign/updateAlarmPrice", { ...data, userId: getUserData('id')});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// 删除画线预警
|
|
56
|
+
export const deleteWarningLine = async (data) => {
|
|
57
|
+
return post("/alarm/deliversign/deleteAlarmPrice", { ...data, userId: getUserData('id')});
|
|
60
58
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
class="klineBasic-main"
|
|
8
8
|
:style="{ height: config.showSubChart ? '70%' : '100%' }"
|
|
9
9
|
>
|
|
10
|
-
<Contextmenu>
|
|
10
|
+
<Contextmenu @closeContextMenuCallBack="closeContextMenuCallBack">
|
|
11
11
|
<div ref="klineBasicMainRef" style="height: 100%;"></div>
|
|
12
12
|
<template #popover>
|
|
13
13
|
<el-menu
|
|
@@ -40,21 +40,58 @@
|
|
|
40
40
|
:subIndicatorList="indicatorStore?.subIndicatorList"
|
|
41
41
|
/>
|
|
42
42
|
</div>
|
|
43
|
+
<div class="klineBasic-empty" v-if="isEmpty">
|
|
44
|
+
<el-empty
|
|
45
|
+
class="klineBasic-empty-content"
|
|
46
|
+
description="暂无数据"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="klineBasic-error" v-if="isError">
|
|
50
|
+
<div class="klineBasic-error-content">
|
|
51
|
+
加载失败,请刷新重试
|
|
52
|
+
</div>
|
|
53
|
+
<div style="text-align: center;">
|
|
54
|
+
<el-button @click="getMainData">刷新</el-button>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
43
57
|
</div>
|
|
58
|
+
<!-- 画线预警-修改价格弹窗 -->
|
|
59
|
+
<el-dialog
|
|
60
|
+
v-model="warningLineChangeVisible"
|
|
61
|
+
title="画线预警-修改价格"
|
|
62
|
+
width="30%"
|
|
63
|
+
align-center
|
|
64
|
+
>
|
|
65
|
+
<span style="margin-right: 10px">预警价格:</span>
|
|
66
|
+
<el-input-number
|
|
67
|
+
v-model="warningLineChangeValue"
|
|
68
|
+
placeholder="输入预警价格"
|
|
69
|
+
/>
|
|
70
|
+
<template #footer>
|
|
71
|
+
<span class="dialog-footer">
|
|
72
|
+
<el-button @click="warningLineChangeVisible = false">取消</el-button>
|
|
73
|
+
<el-button
|
|
74
|
+
type="primary"
|
|
75
|
+
@click="changeWarningLine"
|
|
76
|
+
>确定</el-button
|
|
77
|
+
>
|
|
78
|
+
</span>
|
|
79
|
+
</template>
|
|
80
|
+
</el-dialog>
|
|
44
81
|
</template>
|
|
45
82
|
|
|
46
83
|
<script setup>
|
|
47
84
|
import { onMounted, onUnmounted, ref, watch, computed } from "vue"
|
|
48
85
|
import * as echarts from "echarts"
|
|
49
86
|
import dayjs from "dayjs"
|
|
50
|
-
import { getKlineBasic, getKline, addWarningLine } from './api'
|
|
51
|
-
import { addResizeListener
|
|
52
|
-
import { getWarningLineOptions } from './utils'
|
|
87
|
+
import { initRequestByEnv, getKlineBasic, getKline, getWarningLine, addWarningLine, updateWarningLine, deleteWarningLine } from './api'
|
|
88
|
+
import { addResizeListener } from 'st-func'
|
|
89
|
+
import { getMainOptions, getWarningLineOptions } from './utils'
|
|
53
90
|
import KlineTips from './components/KlineTips/index.vue'
|
|
54
91
|
import KlineSub from './components/KlineSub/index.vue'
|
|
55
92
|
import Contextmenu from './components/Contextmenu/index.vue'
|
|
56
93
|
|
|
57
|
-
const {
|
|
94
|
+
const defaultMenuData = [{ label: "画线预警", key: "drawWarningLine" }]
|
|
58
95
|
|
|
59
96
|
let resizeRo = null; // dom元素监听事件
|
|
60
97
|
let mainChartIns = null // 主图实例
|
|
@@ -85,11 +122,11 @@ const props = defineProps({
|
|
|
85
122
|
default: () => null
|
|
86
123
|
}, // 合约类型
|
|
87
124
|
cycle: {
|
|
88
|
-
type: String,
|
|
125
|
+
type: [String, Number],
|
|
89
126
|
default: () => null
|
|
90
127
|
}, // 周期id
|
|
91
128
|
mainIndicator: {
|
|
92
|
-
type:
|
|
129
|
+
type: String,
|
|
93
130
|
default: () => ''
|
|
94
131
|
}, // 主图指标名称
|
|
95
132
|
indicatorStore: {
|
|
@@ -105,24 +142,35 @@ const props = defineProps({
|
|
|
105
142
|
default: () => null,
|
|
106
143
|
},
|
|
107
144
|
right: {
|
|
108
|
-
type: Number,
|
|
145
|
+
type: [String, Number],
|
|
109
146
|
default: 1,
|
|
110
147
|
}, // 复权方式,前复权-1,不复权-0
|
|
111
148
|
config: {
|
|
112
149
|
type: Object,
|
|
113
150
|
default: () => ({})
|
|
114
151
|
}, // 配置
|
|
152
|
+
env: {
|
|
153
|
+
type: Object,
|
|
154
|
+
default: () => ({})
|
|
155
|
+
}, // 环境变量
|
|
115
156
|
})
|
|
116
157
|
|
|
158
|
+
const isEmpty = ref(false) // 是否无数据
|
|
159
|
+
const isError = ref(false) // 是否异常
|
|
160
|
+
|
|
117
161
|
const klineBasicMainRef = ref(null) // 主图Dom元素
|
|
118
162
|
const klineSubRef = ref(null) // 副图组件元素
|
|
119
163
|
const subIndicator = ref('VOL') // 副图指标
|
|
120
164
|
const activeIndex = ref(0) // 当前选中的k线
|
|
121
165
|
|
|
122
166
|
const chartData = ref({}) // 图表数据
|
|
167
|
+
|
|
123
168
|
const warningLineData = ref([]) // 预警线数据
|
|
169
|
+
const warningItem = ref({}); // 右键点击的预警线
|
|
170
|
+
const warningLineChangeVisible = ref(false); // 修改预警线价格弹窗visible
|
|
171
|
+
const warningLineChangeValue = ref(''); // 修改预警线价格弹窗value
|
|
124
172
|
|
|
125
|
-
const menuData = ref([
|
|
173
|
+
const menuData = ref([ ...defaultMenuData ]); // 右键菜单
|
|
126
174
|
|
|
127
175
|
const config = computed(() => {
|
|
128
176
|
return {
|
|
@@ -131,6 +179,7 @@ const config = computed(() => {
|
|
|
131
179
|
maxShowCounts: 5000, // 单页最大展示条数
|
|
132
180
|
loadCheckCounts: 500, // 滚动加载检测的条数
|
|
133
181
|
showSubChart: true, // 是否展示副图
|
|
182
|
+
gridTop: 48, // 主图顶部距离
|
|
134
183
|
gridLeft: 80, // 主图左侧距离
|
|
135
184
|
gridRight: 50, // 主图右侧距离
|
|
136
185
|
showWarningLine: true, // 是否展示预警线
|
|
@@ -151,6 +200,7 @@ watch(
|
|
|
151
200
|
)
|
|
152
201
|
|
|
153
202
|
onMounted(() => {
|
|
203
|
+
initRequestByEnv(props.env)
|
|
154
204
|
getMainData()
|
|
155
205
|
})
|
|
156
206
|
|
|
@@ -215,62 +265,76 @@ const addEventListener = () => {
|
|
|
215
265
|
activeIndex.value = index;
|
|
216
266
|
});
|
|
217
267
|
// 右键点击事件
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
268
|
+
let echartsContextMenuTimer = null;
|
|
269
|
+
mainChartIns?.on("contextmenu", (params) => {
|
|
270
|
+
echartsContextMenuTimer = setTimeout(() => {
|
|
271
|
+
if (params.componentType === "graphic") {
|
|
272
|
+
warningItem.value = params.info;
|
|
273
|
+
menuData.value = [
|
|
274
|
+
{ label: "删除画线", key: "deleteWarningLine" },
|
|
275
|
+
{ label: "修改画线", key: "changeWarningLine" },
|
|
276
|
+
];
|
|
277
|
+
}
|
|
278
|
+
clearTimeout(echartsContextMenuTimer);
|
|
279
|
+
echartsContextMenuTimer = null;
|
|
280
|
+
});
|
|
281
|
+
});
|
|
232
282
|
};
|
|
233
283
|
|
|
234
284
|
const getMainData = async () => {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
285
|
+
try {
|
|
286
|
+
if (!props.variety || !props.cycle) return
|
|
287
|
+
const {
|
|
288
|
+
variety, featureId, cycle, indicatorStore, mainIndicator, right, startTime, endTime,
|
|
289
|
+
} = props
|
|
290
|
+
const { defaultShowCounts, addCounts, showWarningLine, getFactorData } = config.value
|
|
291
|
+
const params = {
|
|
292
|
+
variety,
|
|
293
|
+
featureId,
|
|
294
|
+
cycle,
|
|
295
|
+
mainIndicatorList: indicatorStore.getIndicatorParams(mainIndicator),
|
|
296
|
+
subIndicator: subIndicator.value,
|
|
297
|
+
right,
|
|
298
|
+
showWarningLine,
|
|
299
|
+
getFactorData,
|
|
300
|
+
}
|
|
301
|
+
if (startTime && endTime) {
|
|
302
|
+
// 开始时间+结束时间
|
|
303
|
+
params.startTime = startTime
|
|
304
|
+
params.endTime = endTime
|
|
305
|
+
} else if (startTime) {
|
|
306
|
+
// 开始时间
|
|
307
|
+
params.startTime = startTime
|
|
308
|
+
params.limit = defaultShowCounts + addCounts
|
|
309
|
+
} else if (endTime) {
|
|
310
|
+
// 结束时间
|
|
311
|
+
params.endTime = endTime
|
|
312
|
+
params.limit = defaultShowCounts + addCounts
|
|
313
|
+
} else {
|
|
314
|
+
// 未传入时间,使用最新时间作为结束时间请求数据
|
|
315
|
+
params.endTime = dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
316
|
+
params.limit = defaultShowCounts + addCounts
|
|
317
|
+
}
|
|
318
|
+
const res = await getKlineBasic(params)
|
|
319
|
+
if (!res?.body?.kline?.time?.length) {
|
|
320
|
+
isEmpty.value = true;
|
|
321
|
+
isError.value = false;
|
|
322
|
+
return
|
|
323
|
+
} else {
|
|
324
|
+
isEmpty.value = false;
|
|
325
|
+
isError.value = false;
|
|
326
|
+
}
|
|
327
|
+
chartData.value = res?.body?.kline
|
|
328
|
+
warningLineData.value = res?.body?.warningLine || []
|
|
329
|
+
draw()
|
|
330
|
+
drawLine()
|
|
331
|
+
if (getFactorData) {
|
|
332
|
+
emit('getFactorData', res?.body?.factor)
|
|
333
|
+
}
|
|
334
|
+
} catch(err) {
|
|
335
|
+
isError.value = true;
|
|
336
|
+
isEmpty.value = false;
|
|
337
|
+
throw new Error(err)
|
|
274
338
|
}
|
|
275
339
|
}
|
|
276
340
|
|
|
@@ -321,10 +385,10 @@ const getMoreData = async (type) => {
|
|
|
321
385
|
|
|
322
386
|
const draw = (keepDataZoom = false) => {
|
|
323
387
|
initChart()
|
|
324
|
-
const {
|
|
388
|
+
const { time } = chartData.value
|
|
325
389
|
const { gridRight, gridLeft, defaultShowCounts, maxShowCounts, showSubChart } = config.value
|
|
326
|
-
let startValue =
|
|
327
|
-
let endValue =
|
|
390
|
+
let startValue = time.length - 1 - defaultShowCounts
|
|
391
|
+
let endValue = time.length - 1
|
|
328
392
|
// 保持缩放位置
|
|
329
393
|
if (keepDataZoom) {
|
|
330
394
|
const originOption = mainChartIns.getOption()
|
|
@@ -335,94 +399,8 @@ const draw = (keepDataZoom = false) => {
|
|
|
335
399
|
startValue = time.findIndex((item) => item === originStartTime)
|
|
336
400
|
endValue = time.findIndex((item) => item === originEndTime)
|
|
337
401
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
grid: {
|
|
341
|
-
top: '48px',
|
|
342
|
-
right: `${gridRight}px`,
|
|
343
|
-
bottom: showSubChart ? '6px' : '24px',
|
|
344
|
-
left: `${gridLeft}px`,
|
|
345
|
-
},
|
|
346
|
-
dataZoom: [
|
|
347
|
-
{
|
|
348
|
-
type: "inside",
|
|
349
|
-
startValue,
|
|
350
|
-
endValue,
|
|
351
|
-
maxValueSpan: maxShowCounts,
|
|
352
|
-
},
|
|
353
|
-
],
|
|
354
|
-
tooltip: {
|
|
355
|
-
trigger: "axis",
|
|
356
|
-
appendToBody: true,
|
|
357
|
-
confine: true,
|
|
358
|
-
axisPointer: {
|
|
359
|
-
type: "cross",
|
|
360
|
-
label: {
|
|
361
|
-
rich: {},
|
|
362
|
-
formatter: (data) => {
|
|
363
|
-
const { axisDimension, value } = data;
|
|
364
|
-
if (axisDimension === "x") {
|
|
365
|
-
return showSubChart ? "" : value;
|
|
366
|
-
} else {
|
|
367
|
-
return String(round(value));
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
},
|
|
371
|
-
},
|
|
372
|
-
formatter: () => "",
|
|
373
|
-
},
|
|
374
|
-
xAxis: {
|
|
375
|
-
show: showSubChart ? false : true,
|
|
376
|
-
type: "category",
|
|
377
|
-
data: time,
|
|
378
|
-
splitLine: {
|
|
379
|
-
show: false,
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
yAxis: {
|
|
383
|
-
type: "value",
|
|
384
|
-
axisLine: {
|
|
385
|
-
show: true,
|
|
386
|
-
},
|
|
387
|
-
splitLine: {
|
|
388
|
-
show: true,
|
|
389
|
-
lineStyle: {
|
|
390
|
-
type: "dotted",
|
|
391
|
-
color: "#333",
|
|
392
|
-
},
|
|
393
|
-
},
|
|
394
|
-
min: (value) => round(value.min),
|
|
395
|
-
max: (value) => round(value.max),
|
|
396
|
-
},
|
|
397
|
-
series: [
|
|
398
|
-
{
|
|
399
|
-
type: "candlestick",
|
|
400
|
-
data,
|
|
401
|
-
itemStyle: {
|
|
402
|
-
color: "transparent",
|
|
403
|
-
color0: "#00FFFF",
|
|
404
|
-
borderColor: "#FF0000",
|
|
405
|
-
borderColor0: "#00FFFF",
|
|
406
|
-
borderWidth: 1,
|
|
407
|
-
},
|
|
408
|
-
},
|
|
409
|
-
...chartData.value.mainIndicator.map((item) => {
|
|
410
|
-
return {
|
|
411
|
-
name: item.key,
|
|
412
|
-
type: 'line',
|
|
413
|
-
silent: true,
|
|
414
|
-
symbol: 'none',
|
|
415
|
-
data: item.data,
|
|
416
|
-
lineStyle: {
|
|
417
|
-
width: item.width || 1,
|
|
418
|
-
},
|
|
419
|
-
itemStyle: {
|
|
420
|
-
color: item.color,
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
})
|
|
424
|
-
],
|
|
425
|
-
}, true)
|
|
402
|
+
const options = getMainOptions(chartData.value, config.value, startValue, endValue)
|
|
403
|
+
mainChartIns.setOption(options, true)
|
|
426
404
|
activeIndex.value = endValue
|
|
427
405
|
if (showSubChart) {
|
|
428
406
|
klineSubRef.value.draw(
|
|
@@ -441,10 +419,8 @@ const drawLine = () => {
|
|
|
441
419
|
{
|
|
442
420
|
...mainChartOption,
|
|
443
421
|
graphic: [
|
|
444
|
-
...getWarningLineOptions(mainChartIns, warningLineData.value, props, config.value, (
|
|
445
|
-
|
|
446
|
-
drawLine()
|
|
447
|
-
emit('change', 'warningLine', newWarningLineData);
|
|
422
|
+
...getWarningLineOptions(mainChartIns, warningLineData.value, props, config.value, () => {
|
|
423
|
+
updateWarningLineAndDraw()
|
|
448
424
|
})
|
|
449
425
|
],
|
|
450
426
|
},
|
|
@@ -452,7 +428,15 @@ const drawLine = () => {
|
|
|
452
428
|
);
|
|
453
429
|
}
|
|
454
430
|
|
|
455
|
-
|
|
431
|
+
// 更新预警线并绘制
|
|
432
|
+
const updateWarningLineAndDraw = async () => {
|
|
433
|
+
const res = await getWarningLine({ featureId: props.featureId })
|
|
434
|
+
warningLineData.value = res?.body || [];
|
|
435
|
+
drawLine()
|
|
436
|
+
emit('change', 'warningLine', warningLineData.value);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const menuClick = async (item) => {
|
|
456
440
|
const { variety, varietyName, featureId, featureType } = props
|
|
457
441
|
if (item.key === 'drawWarningLine') {
|
|
458
442
|
// 画线预警
|
|
@@ -526,14 +510,41 @@ const menuClick = (item) => {
|
|
|
526
510
|
warnPrice: newWarnPrice,
|
|
527
511
|
});
|
|
528
512
|
ElMessage.success("画线预警成功!");
|
|
513
|
+
updateWarningLineAndDraw()
|
|
529
514
|
};
|
|
530
515
|
// 4.绑定echarts点击事件
|
|
531
516
|
mainChartIns?.getZr().on("mousedown", handleClick);
|
|
517
|
+
} else if (item.key === 'deleteWarningLine') {
|
|
518
|
+
// 删除预警线
|
|
519
|
+
await deleteWarningLine({ id: warningItem.value.id });
|
|
520
|
+
ElMessage.success("画线预警删除成功");
|
|
521
|
+
updateWarningLineAndDraw()
|
|
522
|
+
} else if (item.key === 'changeWarningLine') {
|
|
523
|
+
warningLineChangeVisible.value = true;
|
|
524
|
+
warningLineChangeValue.value = warningItem.value.warnPrice;
|
|
532
525
|
}
|
|
533
526
|
}
|
|
534
527
|
|
|
528
|
+
const changeWarningLine = async () => {
|
|
529
|
+
const { variety, varietyName, featureId, featureType } = props
|
|
530
|
+
await updateWarningLine({
|
|
531
|
+
id: warningItem.value.id,
|
|
532
|
+
featureCode: variety, //品种代码
|
|
533
|
+
featureName: varietyName, //品种名称
|
|
534
|
+
featureId, //品种id
|
|
535
|
+
featureType, //品种类型
|
|
536
|
+
warnPrice: warningLineChangeValue.value,
|
|
537
|
+
});
|
|
538
|
+
ElMessage.success("画线预警修改成功");
|
|
539
|
+
updateWarningLineAndDraw()
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
const closeContextMenuCallBack = () => {
|
|
543
|
+
menuData.value =[ ...defaultMenuData ];
|
|
544
|
+
};
|
|
545
|
+
|
|
535
546
|
defineExpose({
|
|
536
|
-
draw(type, data) {
|
|
547
|
+
draw: (type, data) => {
|
|
537
548
|
if (type === 'warningLine') {
|
|
538
549
|
warningLineData.value = data;
|
|
539
550
|
drawLine()
|
|
@@ -561,5 +572,42 @@ defineExpose({
|
|
|
561
572
|
width: 100%;
|
|
562
573
|
height: 30%;
|
|
563
574
|
}
|
|
575
|
+
&-empty {
|
|
576
|
+
position: absolute;
|
|
577
|
+
top: 0;
|
|
578
|
+
width: 100%;
|
|
579
|
+
height: 100%;
|
|
580
|
+
background: #000;
|
|
581
|
+
&-content {
|
|
582
|
+
height: 100%;
|
|
583
|
+
padding: 0;
|
|
584
|
+
--el-empty-fill-color-0: var(--el-color-black);
|
|
585
|
+
--el-empty-fill-color-1: #4b4b52;
|
|
586
|
+
--el-empty-fill-color-2: #36383d;
|
|
587
|
+
--el-empty-fill-color-3: #1e1e20;
|
|
588
|
+
--el-empty-fill-color-4: #262629;
|
|
589
|
+
--el-empty-fill-color-5: #202124;
|
|
590
|
+
--el-empty-fill-color-6: #212224;
|
|
591
|
+
--el-empty-fill-color-7: #1b1c1f;
|
|
592
|
+
--el-empty-fill-color-8: #1c1d1f;
|
|
593
|
+
--el-empty-fill-color-9: #18181a;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
&-error {
|
|
597
|
+
position: absolute;
|
|
598
|
+
top: 0;
|
|
599
|
+
width: 100%;
|
|
600
|
+
height: 100%;
|
|
601
|
+
background: #000;
|
|
602
|
+
display: flex;
|
|
603
|
+
flex-direction: column;
|
|
604
|
+
justify-content: center;
|
|
605
|
+
&-content {
|
|
606
|
+
color: #fff;
|
|
607
|
+
font-size: 20px;
|
|
608
|
+
text-align: center;
|
|
609
|
+
margin-bottom: 12px;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
564
612
|
}
|
|
565
613
|
</style>
|