st-comp 0.0.104 → 0.0.105
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/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +174 -146
- package/es/style.css +1 -1
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +46 -46
- package/lib/{index-8bd6c97d.js → index-38c2d1b4.js} +1518 -1490
- package/lib/{python-519e9b4b.js → python-3ba5a0ac.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/FactorWarning/index.vue +62 -30
- package/src/pages/FactorWarning/index.vue +5 -749
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ref, watch } from "vue";
|
|
3
3
|
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const emit = defineEmits(["add", "delete", "enabled", "closed"]);
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
// 弹窗标题
|
|
8
8
|
title: { type: [String, null], default: null },
|
|
@@ -16,7 +16,6 @@ const props = defineProps({
|
|
|
16
16
|
// 个别字段功能是否展示
|
|
17
17
|
showConfig: { type: Object, default: () => ({}) },
|
|
18
18
|
});
|
|
19
|
-
const emit = defineEmits(["add", "delete", "enabled", "closed"]);
|
|
20
19
|
const showConfig = Object.assign(
|
|
21
20
|
{
|
|
22
21
|
ruleFormPrice: true, // 表单-价格范围
|
|
@@ -29,12 +28,12 @@ const showConfig = Object.assign(
|
|
|
29
28
|
props.showConfig
|
|
30
29
|
);
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
const visible = defineModel("visible", { default: false });
|
|
32
|
+
|
|
33
|
+
// 内容类型: [添加-ruleForm, 管理-table]
|
|
33
34
|
const contentType = ref(props.allowOperation ? "ruleForm" : "table");
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
* @description: 添加-表单相关参数和方法
|
|
37
|
-
*/
|
|
36
|
+
// 表单相关参数
|
|
38
37
|
const ruleFormRef = ref(null);
|
|
39
38
|
const ruleForm = ref({
|
|
40
39
|
factorType: 1,
|
|
@@ -49,49 +48,82 @@ const rules = ref({
|
|
|
49
48
|
factorSelectedList: [{ required: true, message: "请选择预警因子", trigger: "blur" }],
|
|
50
49
|
totalCount: [{ required: true, message: "请填写预警次数", trigger: "blur" }],
|
|
51
50
|
});
|
|
51
|
+
|
|
52
|
+
// 表单: 三次多/三次空
|
|
52
53
|
const handleFastControls = async (type) => {
|
|
53
54
|
switch (type) {
|
|
54
55
|
case "threeMore":
|
|
55
56
|
Object.assign(ruleForm.value, {
|
|
56
57
|
factorType: 1,
|
|
57
58
|
factorSelectedList: ["dkx金叉", "dkx黄白线上+双箱单次", "dkx金叉后+单箱突破", "30均线上+向上+单箱"],
|
|
58
|
-
totalCount: 3,
|
|
59
59
|
});
|
|
60
60
|
break;
|
|
61
61
|
case "threeEmpty":
|
|
62
62
|
Object.assign(ruleForm.value, {
|
|
63
63
|
factorType: -1,
|
|
64
64
|
factorSelectedList: ["dkx死叉", "dkx黄白线下+双箱单次", "dkx死叉后+单箱突破", "30均线下+向下+单箱"],
|
|
65
|
-
totalCount: 3,
|
|
66
65
|
});
|
|
67
66
|
break;
|
|
68
67
|
}
|
|
69
|
-
|
|
68
|
+
// 特殊需求 [2025-03-10]: 葛总要求通过3次多3次空添加的, 具备上限10的校验
|
|
69
|
+
const tsParams = {
|
|
70
|
+
factorSelectedList: ruleForm.value.factorSelectedList.map((factorName) => {
|
|
71
|
+
let totalCount = 3;
|
|
72
|
+
// 判断表格里面有没有同因子的数据, 如果有的话需要确保增加以后的有效次数 <= 10
|
|
73
|
+
const repeatData = props.tableData.find(({ factorExtendName }) => factorExtendName === factorName);
|
|
74
|
+
if (repeatData) {
|
|
75
|
+
const diff = repeatData.totalCount - repeatData.currentCount;
|
|
76
|
+
// 如果: 已触发次数 === 触发次数上限, 直接+3, 此时后端会另起一行数据的
|
|
77
|
+
if (diff === 0) totalCount = 3;
|
|
78
|
+
// 确保添加后的diff要小于等于10, 出于兼容老数据1/20类似的情况考虑, 加个容错
|
|
79
|
+
else totalCount = Math.min(3, 10 - diff >= 0 ? 10 - diff : 0);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
factorName,
|
|
83
|
+
...ruleForm.value,
|
|
84
|
+
totalCount,
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
handleSubmit(ruleFormRef.value, false, tsParams);
|
|
70
89
|
};
|
|
71
|
-
|
|
90
|
+
// 表单: 提交
|
|
91
|
+
const handleSubmit = async (formEl, close = true, tsParams) => {
|
|
72
92
|
if (!formEl) return;
|
|
73
93
|
await formEl.validate((valid) => {
|
|
74
94
|
if (!valid) return false;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
// 将表单值抛出
|
|
96
|
+
const params = tsParams ?? {
|
|
97
|
+
factorSelectedList: ruleForm.value.factorSelectedList.map((factorName) => {
|
|
98
|
+
return {
|
|
99
|
+
factorName,
|
|
100
|
+
...ruleForm.value,
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
emit("add", params);
|
|
105
|
+
// 根据是否关闭弹窗, 进行对应的逻辑处理
|
|
106
|
+
switch (close) {
|
|
107
|
+
// 关闭弹窗
|
|
108
|
+
case true: {
|
|
109
|
+
visible.value = false;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
// 重置表单值
|
|
113
|
+
case false: {
|
|
114
|
+
ruleForm.value = {
|
|
115
|
+
factorType: 1,
|
|
116
|
+
factorSelectedList: [],
|
|
117
|
+
totalCount: 1,
|
|
118
|
+
minPrice: null,
|
|
119
|
+
maxPrice: null,
|
|
120
|
+
mark: null,
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
87
124
|
}
|
|
88
125
|
});
|
|
89
126
|
};
|
|
90
|
-
/**
|
|
91
|
-
* @description: 管理-表格相关参数和方法
|
|
92
|
-
*/
|
|
93
|
-
const handleDelete = (row) => emit("delete", row);
|
|
94
|
-
const handleEnabled = (row) => emit("enabled", row);
|
|
95
127
|
|
|
96
128
|
// 监视组件开关
|
|
97
129
|
watch(
|
|
@@ -122,7 +154,7 @@ watch(
|
|
|
122
154
|
destroy-on-close
|
|
123
155
|
@closed="emit('closed')"
|
|
124
156
|
>
|
|
125
|
-
<!--
|
|
157
|
+
<!-- 头部: 标题 + 切换 -->
|
|
126
158
|
<template #header="{ close, titleId, titleClass }">
|
|
127
159
|
<div class="custom-header">
|
|
128
160
|
<div :class="titleClass">
|
|
@@ -331,13 +363,13 @@ watch(
|
|
|
331
363
|
v-if="showConfig.tableEnable"
|
|
332
364
|
:disabled="scope.row.currentCount !== scope.row.totalCount"
|
|
333
365
|
size="small"
|
|
334
|
-
@click="
|
|
366
|
+
@click="emit('enabled', scope.row)"
|
|
335
367
|
>
|
|
336
368
|
启用
|
|
337
369
|
</el-button>
|
|
338
370
|
<el-popconfirm
|
|
339
371
|
title="确定删除?"
|
|
340
|
-
@confirm="
|
|
372
|
+
@confirm="emit('delete', scope.row)"
|
|
341
373
|
>
|
|
342
374
|
<template #reference>
|
|
343
375
|
<el-button size="small">删除</el-button>
|