st-comp 0.0.112 → 0.0.114

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.112",
4
+ "version": "0.0.114",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -9,6 +9,9 @@ const props = defineProps({
9
9
  commonOption: { type: Array, default: () => [] }, // 已选常用选项
10
10
  });
11
11
  const visible = ref(false);
12
+ const rankKey = computed(() => {
13
+ return props.data.find(i => i.radioType === '1')?.key;
14
+ })
12
15
 
13
16
  // 常用指标项数据源 [受到: 品种市场, 常用选项影响]
14
17
  const commonIndicatorOptions = computed(() => {
@@ -88,7 +91,7 @@ const clickIndicator = (item) => {
88
91
  ...baseParams,
89
92
  range: [null, null],
90
93
  unit: item.defaultUnit.length ? [...item.defaultUnit] : [null, null],
91
- radioType: item.defaultRadioType, // 0数值 1排名
94
+ radioType: rankKey.value && rankKey.value !== item.key ? '0' : item.defaultRadioType, // 0数值 1排名
92
95
  rankRange: item.defaultRankRange || [null, null],// 默认排名
93
96
  };
94
97
  }
@@ -154,6 +157,14 @@ const submitDialog = () => {
154
157
  if (["", null].includes(range[0]) && ["", null].includes(range[1])) {
155
158
  return ElMessage.warning("格式错误: 请至少填写一个值");
156
159
  }
160
+ // 排名校验
161
+ if (radioType === '1') {
162
+ const rangeLeft = Number(range[0])
163
+ const rangeRight = Number(range[1])
164
+ if (isNaN(rangeLeft) || isNaN(rangeRight)) return ElMessage.warning("格式错误: 请填写数字");
165
+ if (rangeLeft < 0 || rangeRight < 0) return ElMessage.warning("格式错误: 请填写大于0的数字");
166
+ if (rangeLeft > rangeRight) return ElMessage.warning("格式错误: 请填写正确的排名范围");
167
+ }
157
168
  const unitLeft = radioType === '1' ? "" : (unit[0] ?? "")
158
169
  const unitRight = radioType === '1' ? "" : (unit[1] ?? "")
159
170
  // 格式化文案
@@ -301,7 +312,7 @@ watch(
301
312
  style="vertical-align: 4px; margin-left: 12px;"
302
313
  >
303
314
  <el-radio-button label="数值" value="0" />
304
- <el-radio-button label="排名" value="1" />
315
+ <el-radio-button :disabled="rankKey && rankKey !== nowIndicator.key" label="排名" value="1" />
305
316
  </el-radio-group>
306
317
  </template>
307
318
 
@@ -200,17 +200,16 @@ defineExpose({
200
200
  {
201
201
  const QIQUANKYES = ["expireDays", "virtualRealDegree", "yearProfitRate", "impliedVolatility", "levelMultiplier", "turnover", "volume", "openInterest", "optionsCpType", "optionGear"];
202
202
  // 1.常用指标-基本面(type:undefined的指标, 且[期权]的常用指标不计入基本面)
203
- const rangeDtoList = []; // 期权排序相关筛选
204
203
  const query = data.commonIndicator.reduce((result, item) => {
205
204
  const { key, type, range, unit, radioType, rankRange } = item;
206
205
  // 排名模式
207
206
  if (radioType === '1') {
208
207
  if (QIQUANKYES.includes(key)) {
209
- rangeDtoList.push({
208
+ params.sortBy = {
210
209
  column: item.key,
211
210
  start: rankRange[0] || null,
212
211
  end: rankRange[1] || null,
213
- })
212
+ }
214
213
  } else {
215
214
  result.push({
216
215
  column: item.key,
@@ -268,9 +267,6 @@ defineExpose({
268
267
  }
269
268
  return result;
270
269
  }, []);
271
- if (rangeDtoList.length) {
272
- params.searchOptionDto = { rangeDtoList }
273
- }
274
270
  if (query.length) {
275
271
  params.query = query;
276
272
  }