st-comp 0.0.224 → 0.0.225

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.224",
4
+ "version": "0.0.225",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -37,13 +37,11 @@ const ruleForm = reactive({
37
37
  });
38
38
 
39
39
  // 测试日志相关参数
40
- const testVariety = ref("");
41
40
  const testResult = reactive({
42
41
  result: null,
43
42
  detail: "",
44
43
  code: "",
45
44
  });
46
- const testVarietyVisible = ref(false);
47
45
  const testLogVisible = ref(false);
48
46
 
49
47
  // 函数: 新建
@@ -53,7 +51,6 @@ const handleAdd = () => {
53
51
  funcName: "",
54
52
  funcExpression: "",
55
53
  });
56
- testVariety.value = "";
57
54
  stMonacoEditorRef.value?.setValue(ruleForm.funcExpression);
58
55
  };
59
56
  // 函数: 编辑
@@ -63,7 +60,6 @@ const handleEdit = (item) => {
63
60
  funcName: item.funcName,
64
61
  funcExpression: item.funcExpression,
65
62
  });
66
- testVariety.value = "";
67
63
  stMonacoEditorRef.value?.setValue(ruleForm.funcExpression);
68
64
  };
69
65
  // 函数: 复制
@@ -73,7 +69,6 @@ const handleCopy = (item) => {
73
69
  funcName: `${item.funcName}-复制`,
74
70
  funcExpression: item.funcExpression,
75
71
  });
76
- testVariety.value = "";
77
72
  stMonacoEditorRef.value?.setValue(ruleForm.funcExpression);
78
73
  };
79
74
 
@@ -210,23 +205,9 @@ const replaceVariables = (expression, variableValues) => {
210
205
  return variableValues[variableName] !== undefined ? variableValues[variableName] : match;
211
206
  });
212
207
  };
213
- const extractCodesFromString = (str) => {
214
- if (!str) return [];
215
- return str.split("\n").reduce((result, next) => {
216
- const code = next.trim().replace(/\s+/gi, " ").split(" ")[0];
217
- code && result.push(code);
218
- return result;
219
- }, []);
220
- };
221
- // 测试: 打开/确认/日志
208
+ // 测试: 提交/日志
222
209
  const handleTest = async (action) => {
223
210
  switch (action) {
224
- case "open": {
225
- // 基础校验
226
- if (!stMonacoEditorRef.value.getValue()) return ElMessage.error("函数内容不可为空");
227
- testVarietyVisible.value = true;
228
- break;
229
- }
230
211
  case "submit": {
231
212
  let testContent = stMonacoEditorRef.value.getValue();
232
213
  if (!testContent) return ElMessage.error("函数内容不可为空");
@@ -237,16 +218,11 @@ const handleTest = async (action) => {
237
218
  if (!variableValues) return;
238
219
  testContent = replaceVariables(testContent, variableValues);
239
220
  }
240
- testVarietyVisible.value = false;
241
221
  try {
242
222
  loading.test = true;
243
- const params = {
244
- codes: extractCodesFromString(testVariety.value),
245
- factorSelectExpr: testContent,
246
- };
247
- const { body } = await request.post("/common/qt/testFactorSelect", params);
223
+ const { body } = await request.post("/common/qt/testFactorSelect", { factorSelectExpr: testContent });
248
224
  const { result, detail } = body;
249
- Object.assign(testResult, { result, detail, code: params.factorSelectExpr });
225
+ Object.assign(testResult, { result, detail, code: testContent });
250
226
  if (result === 1) {
251
227
  ElMessage.success("测试通过");
252
228
  } else {
@@ -279,7 +255,6 @@ watch(
279
255
  if (!newValue) {
280
256
  // 确保内嵌窗口全部关闭
281
257
  stVarSelectDialogRef.value.close();
282
- testVarietyVisible.value = false;
283
258
  testLogVisible.value = false;
284
259
  }
285
260
  },
@@ -407,7 +382,7 @@ defineExpose({
407
382
  </el-button>
408
383
  <el-button
409
384
  :loading="loading.test"
410
- @click="handleTest('open')"
385
+ @click="handleTest('submit')"
411
386
  >
412
387
  测试
413
388
  </el-button>
@@ -439,55 +414,6 @@ defineExpose({
439
414
  <!-- 变量选择器 -->
440
415
  <st-varSelectDialog ref="stVarSelectDialogRef" />
441
416
 
442
- <!-- 窗口: 选择测试所用的品种 -->
443
- <el-dialog
444
- modal-class="test-variety-dialog"
445
- v-model="testVarietyVisible"
446
- width="500"
447
- align-center
448
- append-to-body
449
- overflow
450
- :modal="false"
451
- :modal-penetrable="true"
452
- :show-close="false"
453
- >
454
- <template #header="{ titleId, titleClass }">
455
- <div class="custom-header">
456
- <div class="left">
457
- <span
458
- :id="titleId"
459
- :class="titleClass"
460
- >
461
- 测试品种
462
- </span>
463
- </div>
464
- <div class="right">
465
- <st-varietyAutoComplete
466
- label=""
467
- @select="({ name, code }) => (testVariety += `${code} ${name} \n`)"
468
- />
469
- <el-icon @click="testVarietyVisible = false"><Close /></el-icon>
470
- </div>
471
- </div>
472
- </template>
473
- <el-input
474
- class="full-height-textarea"
475
- v-model="testVariety"
476
- resize="none"
477
- type="textarea"
478
- :placeholder="`不填写时, 默认为000001 平安银行\n格式示例:\nhc8888\xa0\xa0\xa0\xa0热轧卷板期货指数\nsp8888\xa0\xa0\xa0\xa0纸浆期货指数\nbu8888\xa0\xa0\xa0\xa0石油沥青期货指数`"
479
- />
480
- <template #footer>
481
- <div class="dialog-footer">
482
- <el-button
483
- type="primary"
484
- @click="handleTest('submit')"
485
- >
486
- 确认
487
- </el-button>
488
- </div>
489
- </template>
490
- </el-dialog>
491
417
  <!-- 窗口: 日志明细 -->
492
418
  <el-dialog
493
419
  modal-class="log-dialog"
@@ -29,9 +29,11 @@
29
29
  if (props.data?.[index]?.label === '涨跌') {
30
30
  widthList.value[index] = '85px'
31
31
  } else if(props.data?.[index]?.label === '至今涨跌') {
32
- widthList.value[index] = '100px'
32
+ widthList.value[index] = '105px'
33
33
  } else if(props.data?.[index]?.label === '额') {
34
34
  widthList.value[index] = '75px'
35
+ } else if(['开', '高', '低', '收'].includes(props.data?.[index]?.label)) {
36
+ widthList.value[index] = `${item.offsetWidth + 20}px`
35
37
  } else {
36
38
  widthList.value[index] = `${item.offsetWidth + 30}px`
37
39
  }