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