st-comp 0.0.159 → 0.0.161

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.
Files changed (82) hide show
  1. package/components.d.ts +1 -0
  2. package/es/ChartLayout.js +3 -3
  3. package/es/Dialog.js +12 -12
  4. package/es/FactorWarning.cjs +1 -1
  5. package/es/FactorWarning.js +27 -27
  6. package/es/Kline.js +16 -16
  7. package/es/KlineBasic.cjs +1 -1
  8. package/es/KlineBasic.js +248 -251
  9. package/es/KlineNew.js +14 -14
  10. package/es/MonacoEditor.cjs +1 -1
  11. package/es/MonacoEditor.js +7 -2
  12. package/es/Pagination.cjs +1 -1
  13. package/es/Pagination.js +18 -18
  14. package/es/PasswordPrompt.js +3 -3
  15. package/es/Table.cjs +1 -1
  16. package/es/Table.js +196 -347
  17. package/es/User.cjs +1 -1
  18. package/es/User.js +21 -21
  19. package/es/VarietySearch.cjs +3 -1
  20. package/es/VarietySearch.js +4265 -1071
  21. package/es/VirtualTable.js +12 -12
  22. package/es/_commonjsHelpers-10dfc225.js +8 -0
  23. package/es/_commonjsHelpers-87b0abe8.cjs +1 -0
  24. package/es/{_initCloneObject-e3d8a9ab.js → _initCloneObject-7f4a9bd7.js} +3 -3
  25. package/es/{base-19787dfb.js → base-113d028b.js} +7 -7
  26. package/es/{castArray-8405000b.js → castArray-2b3f27ef.js} +1 -1
  27. package/es/{config-provider-0f6672af.js → config-provider-3ffe8f8f.js} +3 -3
  28. package/es/{debounce-6cb0781f.js → debounce-3517a4c7.js} +1 -1
  29. package/es/{dropdown-17b3ef6a.js → dropdown-ee1240ff.js} +4 -4
  30. package/es/{el-button-0bf1d532.js → el-button-de89fb60.js} +4 -4
  31. package/es/{el-checkbox-group-d53bc316.js → el-checkbox-group-17e4156a.js} +2 -2
  32. package/es/{el-empty-bd5343a7.js → el-empty-546e4106.js} +2 -2
  33. package/es/{el-form-item-05c0e335.js → el-form-item-73ecd9af.js} +8 -8
  34. package/es/{el-input-1e309239.js → el-input-c715d419.js} +9 -8
  35. package/es/{el-input-6a3805c5.cjs → el-input-cb340042.cjs} +1 -1
  36. package/es/{el-input-number-60ebc58f.js → el-input-number-02db11f6.js} +13 -13
  37. package/es/{el-input-number-96ff2e47.cjs → el-input-number-0f194f3f.cjs} +1 -1
  38. package/es/{el-menu-item-6c6236a1.js → el-menu-item-67fac653.js} +8 -8
  39. package/es/{el-message-7d927756.js → el-message-2eae949c.js} +7 -7
  40. package/es/{el-overlay-26bf0945.js → el-overlay-f94c4f3b.js} +8 -8
  41. package/es/{el-popover-17e2e66c.js → el-popconfirm-029f2c00.js} +12 -12
  42. package/es/{el-popover-7bd8a7c3.cjs → el-popconfirm-86503f8a.cjs} +1 -1
  43. package/es/{el-popper-b6527ae2.js → el-popper-b34ec18f.js} +9 -9
  44. package/es/{el-scrollbar-29bcab5f.js → el-scrollbar-c463eaff.js} +7 -7
  45. package/es/{el-select-7395562b.js → el-select-b77506ca.js} +13 -13
  46. package/es/{el-table-column-47d80736.js → el-table-column-4aea6b31.js} +12 -12
  47. package/es/{el-tag-7414e0c7.js → el-tag-1cf8487e.js} +3 -3
  48. package/es/index-2da94fd7.js +159 -0
  49. package/es/{index-273822d1.js → index-440d64f2.js} +7 -7
  50. package/es/{index-75cce588.js → index-496e80be.js} +2 -2
  51. package/es/index-58521b9e.cjs +1 -0
  52. package/es/{index-621b092b.js → index-7125c109.js} +1 -1
  53. package/es/{index-dc22ffe4.js → index-a777a57a.js} +2 -2
  54. package/es/{index-72151b24.js → index-dd5d4ae9.js} +6 -6
  55. package/es/{index-c066fe0d.js → index-f393f2d4.js} +3 -3
  56. package/es/{index-70372cdb.js → index-f905d74d.js} +1 -1
  57. package/es/{index-ad9f40cd.cjs → index.vue_vue_type_script_setup_true_lang-4024853c.cjs} +3 -3
  58. package/es/{index-015c420d.js → index.vue_vue_type_script_setup_true_lang-745718ff.js} +5 -9
  59. package/es/{python-81655341.cjs → python-6a3f6816.cjs} +2 -2
  60. package/es/{python-be1bd6d2.js → python-7fcad568.js} +1 -1
  61. package/es/{raf-a532c514.js → raf-5d53429d.js} +1 -1
  62. package/es/{scroll-d787d648.js → scroll-9ec370f4.js} +1 -1
  63. package/es/style.css +1 -1
  64. package/es/{use-form-common-props-5ff2f51b.js → use-form-common-props-d20ca09c.js} +8 -8
  65. package/es/{vnode-6a0c7411.js → vnode-2d8e2f0e.js} +1 -1
  66. package/es/{zh-cn-f37255ae.js → zh-cn-4d2bbda7.js} +2 -2
  67. package/lib/bundle.js +1 -1
  68. package/lib/bundle.umd.cjs +222 -220
  69. package/lib/{index-819ef426.js → index-c0cfb828.js} +45519 -42330
  70. package/lib/{python-4c5a7f20.js → python-4a34bda1.js} +1 -1
  71. package/lib/style.css +1 -1
  72. package/package.json +2 -1
  73. package/packages/VarietySearch/components/CommonIndicator/index.vue +98 -54
  74. package/packages/VarietySearch/components/FactorScreen/ScriptSelect.vue +300 -0
  75. package/packages/VarietySearch/components/FactorScreen/VarietySelect.vue +78 -0
  76. package/packages/VarietySearch/components/FactorScreen/index.vue +123 -21
  77. package/packages/VarietySearch/config.js +49 -0
  78. package/packages/VarietySearch/index.vue +24 -13
  79. package/src/pages/VarietySearch/api.js +70 -0
  80. package/src/pages/VarietySearch/index.vue +83 -109
  81. package/vitePlugins/createExportFile.ts +0 -101
  82. package/vitePlugins/testRelese.ts +0 -67
@@ -1,9 +1,11 @@
1
1
  <!-- 因子筛选组件 -->
2
2
  <script setup name="FactorScreen">
3
- import { ref } from "vue";
3
+ import { nextTick, ref, watch } from "vue";
4
4
  import { Plus, CircleCloseFilled, InfoFilled } from "@element-plus/icons-vue";
5
5
  import { handleVerifyScore, extractConditionDetails } from "./tools.js";
6
6
  import FactorDescription from "./FactorDescription.vue";
7
+ import ScriptSelect from "./ScriptSelect.vue";
8
+ import MonacoEditor from "../../../MonacoEditor/index.vue"
7
9
 
8
10
  const props = defineProps({
9
11
  config: {
@@ -26,9 +28,12 @@ const data = defineModel("data", {
26
28
  },
27
29
  });
28
30
 
31
+ const monacoEditorRef = ref();
32
+ const scriptSelectRef = ref();
29
33
  // 弹窗开关
30
34
  const visible = ref(false);
31
35
  const visibleDescriptions = ref(false);
36
+ const factorType = ref("模版");
32
37
  // 弹窗表单
33
38
  const dialogFormRef = ref(null);
34
39
  const dialogForm = ref({
@@ -44,43 +49,73 @@ const dialogForm = ref({
44
49
  sqlEnable: 0,
45
50
  // SQL语句
46
51
  sqlValue: null,
52
+ // 脚本语句
53
+ factorSelectExpr: '',
47
54
  });
48
55
 
56
+ watch(() => [factorType.value, visible.value], () => {
57
+ if (factorType.value === '模版' || visible.value === false) {
58
+ scriptSelectRef.value.close();
59
+ }
60
+ }, { deep: true })
61
+
49
62
  // 打开
50
63
  const handleOpenDialog = () => {
51
- const { list, sqlEnable, sqlValue } = data.value;
64
+ const { list, sqlEnable, sqlValue, factorSelectExpr } = data.value;
52
65
  dialogForm.value = {
53
66
  list: JSON.parse(JSON.stringify(list)),
54
67
  sqlEnable,
55
68
  sqlValue,
69
+ factorSelectExpr,
56
70
  };
57
71
  // 保证因子筛选最少一条
58
72
  if (!dialogForm.value.list.length) handleAppendFactor();
59
73
  visible.value = true;
74
+ // 解决初次访问样式错乱问题
75
+ nextTick(() => {
76
+ if (factorSelectExpr) {
77
+ factorType.value = '脚本'
78
+ monacoEditorRef.value.setValue(factorSelectExpr);
79
+ } else factorType.value = '模版';
80
+ monacoEditorRef.value.resize();
81
+ })
60
82
  };
61
83
  // 确定
62
84
  const handleSubmit = () => {
63
- dialogFormRef.value.validate((valid) => {
64
- const { list, sqlEnable, sqlValue } = dialogForm.value;
65
- if (!valid) return;
66
- // 针对开启了SQL功能后的字段校验
67
- if (sqlEnable) {
68
- if (!sqlValue) return ElMessage.error("SQL语句不能为空");
69
- // 提取SQL语句中的条件1, 条件2, ...
70
- const sqlConditions = extractConditionDetails(sqlValue);
71
- // 生成因子表格中的条件1, 条件2, ...
72
- const factorConditions = list.map((item, index) => `条件${index + 1}`);
73
- // 校验SQL中是否全部都能在因子表格中找到
74
- const noSaveConditions = sqlConditions.filter((item) => !factorConditions.includes(item));
75
- if (noSaveConditions.length) return ElMessage.error(`请检查SQL语句, 不存在[${noSaveConditions}]`);
76
- }
85
+ if (factorType.value === '模版') {
86
+ dialogFormRef.value.validate((valid) => {
87
+ const { list, sqlEnable, sqlValue } = dialogForm.value;
88
+ if (!valid) return;
89
+ // 针对开启了SQL功能后的字段校验
90
+ if (sqlEnable) {
91
+ if (!sqlValue) return ElMessage.error("SQL语句不能为空");
92
+ // 提取SQL语句中的条件1, 条件2, ...
93
+ const sqlConditions = extractConditionDetails(sqlValue);
94
+ // 生成因子表格中的条件1, 条件2, ...
95
+ const factorConditions = list.map((item, index) => `条件${index + 1}`);
96
+ // 校验SQL中是否全部都能在因子表格中找到
97
+ const noSaveConditions = sqlConditions.filter((item) => !factorConditions.includes(item));
98
+ if (noSaveConditions.length) return ElMessage.error(`请检查SQL语句, 不存在[${noSaveConditions}]`);
99
+ }
100
+ data.value = {
101
+ list: JSON.parse(JSON.stringify(list)),
102
+ sqlEnable,
103
+ sqlValue,
104
+ factorSelectExpr: '',
105
+ };
106
+ visible.value = false;
107
+ });
108
+ } else {
109
+ const script = monacoEditorRef.value.getValue();
110
+ if (!script) return ElMessage.error("请输入脚本语句");
77
111
  data.value = {
78
- list: JSON.parse(JSON.stringify(list)),
79
- sqlEnable,
80
- sqlValue,
112
+ list: [],
113
+ sqlEnable: 0,
114
+ sqlValue: null,
115
+ factorSelectExpr: script,
81
116
  };
82
117
  visible.value = false;
83
- });
118
+ }
84
119
  };
85
120
 
86
121
  // 表单: 删除因子
@@ -185,8 +220,22 @@ const handleDeleteTag = (aciton, index) => {
185
220
  data.value.list.splice(index, 1);
186
221
  break;
187
222
  }
223
+ case "scriptTag": {
224
+ data.value = {
225
+ list: [],
226
+ sqlEnable: 0,
227
+ sqlValue: null,
228
+ factorSelectExpr: '',
229
+ };
230
+ break;
231
+ }
188
232
  }
189
233
  };
234
+
235
+ // 打开变量选择器
236
+ const open = () => {
237
+ scriptSelectRef.value.open(monacoEditorRef.value);
238
+ }
190
239
  </script>
191
240
 
192
241
  <template>
@@ -221,6 +270,25 @@ const handleDeleteTag = (aciton, index) => {
221
270
  {{ handleFormatTag(tag) }}
222
271
  </el-tag>
223
272
  </template>
273
+ <!-- 脚本模式 -->
274
+ <el-popover
275
+ v-if="data.factorSelectExpr"
276
+ width="500"
277
+ placement="bottom-start"
278
+ >
279
+ <div style="white-space: pre-line;">
280
+ {{ data.factorSelectExpr }}
281
+ </div>
282
+ <template #reference>
283
+ <el-tag
284
+ closable
285
+ type="info"
286
+ @close="handleDeleteTag('scriptTag')"
287
+ >
288
+ 脚本模式
289
+ </el-tag>
290
+ </template>
291
+ </el-popover>
224
292
  <!-- 添加按钮 -->
225
293
  <el-button
226
294
  class="screen-btn"
@@ -236,7 +304,7 @@ const handleDeleteTag = (aciton, index) => {
236
304
  <!-- 因子筛选弹窗 -->
237
305
  <el-dialog
238
306
  v-model="visible"
239
- width="680"
307
+ width="1000"
240
308
  align-center
241
309
  destroy-on-close
242
310
  >
@@ -255,9 +323,27 @@ const handleDeleteTag = (aciton, index) => {
255
323
  >
256
324
  <el-icon @click="visibleDescriptions = true"><InfoFilled /></el-icon>
257
325
  </el-tooltip>
326
+ <el-radio-group
327
+ v-model="factorType"
328
+ size="small"
329
+ style="margin-left: 12px;"
330
+ >
331
+ <el-radio-button label="模版" value="模版" />
332
+ <el-radio-button label="脚本" value="脚本" />
333
+ </el-radio-group>
334
+ <!-- 变量选择器 -->
335
+ <div style="flex: 1; text-align: right;" v-if="factorType === '脚本'">
336
+ <el-button
337
+ size="small"
338
+ type="primary"
339
+ @click="open"
340
+ >变量选择器</el-button>
341
+ </div>
258
342
  </div>
259
343
  </template>
344
+ <!-- 模版模式 -->
260
345
  <el-form
346
+ v-if="factorType === '模版'"
261
347
  ref="dialogFormRef"
262
348
  :model="dialogForm"
263
349
  >
@@ -485,6 +571,20 @@ const handleDeleteTag = (aciton, index) => {
485
571
  </template>
486
572
  </template>
487
573
  </el-form>
574
+ <!-- 脚本模式 -->
575
+ <div
576
+ style="width: 968px; height: 400px"
577
+ :style="
578
+ factorType === '脚本' ?
579
+ null :
580
+ { position: 'fixed', top: '-400px', zIndex: -1 }
581
+ "
582
+ >
583
+ <MonacoEditor
584
+ ref="monacoEditorRef"
585
+ :language="'lua'"
586
+ />
587
+ </div>
488
588
  <template #footer>
489
589
  <div class="dialog-footer">
490
590
  <el-button
@@ -501,6 +601,8 @@ const handleDeleteTag = (aciton, index) => {
501
601
  v-model:visible="visibleDescriptions"
502
602
  :data="config.factorDescriptions?.filter((item) => [1, 3].includes(item.type))"
503
603
  />
604
+ <!-- 变量选择器 -->
605
+ <ScriptSelect ref="scriptSelectRef" />
504
606
  </template>
505
607
 
506
608
  <style lang="scss" scoped>
@@ -387,6 +387,55 @@ export default {
387
387
  commonOptionIds: [4, 6, 12, 14, 15, 16],
388
388
  },
389
389
  },
390
+ // 营业收入增长率
391
+ {
392
+ key: "incrementRevenueLyr",
393
+ label: "营业收入增长率",
394
+ parent: {
395
+ varietyMarketIds: [3, 5, 7],
396
+ commonOptionIds: [4, 6, 12, 14, 15, 16],
397
+ },
398
+ // 默认选中单位
399
+ defaultUnit: ["%", "%"],
400
+ // 单位下拉框选项
401
+ unitOptions: ["%"],
402
+ },
403
+ // 净利润增长率
404
+ {
405
+ key: "netProfitGrowthRatioLyr",
406
+ label: "净利润增长率",
407
+ parent: {
408
+ varietyMarketIds: [3, 5, 7],
409
+ commonOptionIds: [4, 6, 12, 14, 15, 16],
410
+ },
411
+ // 默认选中单位
412
+ defaultUnit: ["%", "%"],
413
+ // 单位下拉框选项
414
+ unitOptions: ["%"],
415
+ },
416
+ // 5年净资产收益率
417
+ {
418
+ key: "fiveYearRoe",
419
+ label: "5年净资产收益率",
420
+ parent: {
421
+ varietyMarketIds: [3, 5, 7],
422
+ commonOptionIds: [4, 6, 12, 14, 15, 16],
423
+ },
424
+ // 默认选中单位
425
+ defaultUnit: ["%", "%"],
426
+ // 单位下拉框选项
427
+ unitOptions: ["%"],
428
+ },
429
+ // 年报审计意见
430
+ {
431
+ key: "auditOpinionType",
432
+ label: "年报审计意见",
433
+ parent: {
434
+ varietyMarketIds: [3, 5, 7],
435
+ commonOptionIds: [4, 6, 12, 14, 15, 16],
436
+ },
437
+ type: "custom",
438
+ },
390
439
 
391
440
  // ----------期权-----------
392
441
 
@@ -26,6 +26,7 @@ searchData.value = Object.assign(searchData.value, {
26
26
  list: [],
27
27
  sqlEnable: 0,
28
28
  sqlValue: null,
29
+ factorSelectExpr: '',
29
30
  },
30
31
  // 常用指标
31
32
  commonIndicator: [],
@@ -114,6 +115,7 @@ const clearRow = (key) => {
114
115
  list: [],
115
116
  sqlEnable: 0,
116
117
  sqlValue: null,
118
+ factorSelectExpr: '',
117
119
  };
118
120
  break;
119
121
  }
@@ -156,7 +158,7 @@ watch(
156
158
  defineExpose({
157
159
  // 生成接口传参结构的数据
158
160
  formatData: (data) => {
159
- console.log("%c[品种池搜索聚合组件]: 正在生成接口传参...", "color: tomato");
161
+ console.log("%c[st-varietySearch]: 正在生成接口传参...", "color: tomato");
160
162
  const params = {};
161
163
  // 1.品种市场
162
164
  if (data.varietyMarket) {
@@ -260,19 +262,27 @@ defineExpose({
260
262
  }
261
263
  // enableSql参数整理
262
264
  params.enableSql = factorScreen.sqlEnable === 1 ? 2 : 1;
265
+ // 2.因子筛选表达式
266
+ if (factorScreen.factorSelectExpr) {
267
+ params.factorSelectExpr = factorScreen.factorSelectExpr;
268
+ }
263
269
  }
264
270
  // 7.常用指标
265
271
  {
266
272
  const QIQUANKYES = ["expireDays", "virtualRealDegree", "yearProfitRate", "impliedVolatility", "levelMultiplier", "turnover", "volume", "openInterest", "optionsCpType", "optionGear"];
267
- // 1.常用指标-基本面(type:undefined的指标, 且[期权]的常用指标不计入基本面)
273
+ // 1.基本面(type: undefined的指标, 且[期权]的常用指标不计入基本面)
268
274
  const query = data.commonIndicator.reduce((result, item) => {
269
275
  const { key, type, range, unit, radioType, radio, rankRange } = item;
270
276
  // 主力净流入资金
271
- if (key === 'mainFlow') {
277
+ if (key === "mainFlow") {
272
278
  let [start, end] = rankRange;
273
- let column = radioType === '0' ? `netInfow${radio}d` : `last${radio}DayMainFlowRank`
279
+ let column = radioType === "0" ? `netInfow${radio}d` : `last${radio}DayMainFlowRank`;
274
280
  result.push({ column, start, end });
275
281
  }
282
+ // 年报审计意见
283
+ if (key === "auditOpinionType") {
284
+ result.push({ column: item.key, enumType: item.enumType });
285
+ }
276
286
  // 排名模式
277
287
  else if (radioType === "1") {
278
288
  params.sortBy = {
@@ -281,8 +291,8 @@ defineExpose({
281
291
  end: rankRange[1] || null,
282
292
  };
283
293
  }
284
- // 股息率
285
- else if (key === "dividendYield") {
294
+ // 需要传递原始值的, 即除100
295
+ else if (["dividendYield", "incrementRevenueLyr", "netProfitGrowthRatioLyr", "fiveYearRoe"].includes(key)) {
286
296
  let [start, end] = range;
287
297
  if (!["", null].includes(start)) start = start / 100;
288
298
  if (!["", null].includes(end)) end = end / 100;
@@ -332,27 +342,27 @@ defineExpose({
332
342
  if (query.length) {
333
343
  params.query = query;
334
344
  }
335
- // 2.常用指标-是否ST
345
+ // 2.是否ST
336
346
  const stIndicator = data.commonIndicator.find(({ key }) => key === "st");
337
347
  if (stIndicator) {
338
348
  params.st = stIndicator.st;
339
349
  }
340
- // 3.常用指标-净利润
350
+ // 3.净利润
341
351
  const netProfitQueryDto = data.commonIndicator.find(({ key }) => key === "tFeaturelncomes");
342
352
  if (netProfitQueryDto) {
343
353
  params.netProfitQueryDto = { ...netProfitQueryDto, netProfit: netProfitQueryDto.netProfit * 100000000.0 };
344
354
  }
345
- // 4.常用指标-股价分位
355
+ // 4.股价分位
346
356
  const priceLevelIndicator = data.commonIndicator.find(({ key }) => key === "priceLevels");
347
357
  if (priceLevelIndicator) {
348
358
  params.priceLevels = priceLevelIndicator.priceLevels;
349
359
  }
350
- // 5.常用指标-市盈率分位
360
+ // 5.市盈率分位
351
361
  const peTtmLevelIndicator = data.commonIndicator.find(({ key }) => key === "peTtmLevels");
352
362
  if (peTtmLevelIndicator) {
353
363
  params.peTtmLevels = peTtmLevelIndicator.peTtmLevels;
354
364
  }
355
- // 6.常用指标-期权相关参数
365
+ // 6.期权相关参数
356
366
  const searchOptionDto = {};
357
367
  data.commonIndicator.forEach((item) => {
358
368
  const { key } = item;
@@ -408,7 +418,7 @@ defineExpose({
408
418
  break;
409
419
  }
410
420
  });
411
- // 7.常用指标-成交量
421
+ // 7.成交量
412
422
  const perVolumnIndicator = data.commonIndicator.find(({ key }) => key === "perVolumn");
413
423
  if (perVolumnIndicator) {
414
424
  params.perVolumn = {
@@ -423,7 +433,7 @@ defineExpose({
423
433
  };
424
434
  }
425
435
  }
426
- console.log("%c[品种池搜索聚合组件]: 接口传参数据生成完毕", "color: green", params);
436
+ console.log("%c[st-varietySearch]: 接口传参数据生成完毕", "color: green", params);
427
437
  return params;
428
438
  },
429
439
  // 重置函数
@@ -447,6 +457,7 @@ defineExpose({
447
457
  list: [],
448
458
  sqlEnable: 0,
449
459
  sqlValue: null,
460
+ factorSelectExpr: '',
450
461
  },
451
462
  // 常用指标
452
463
  commonIndicator: [],
@@ -0,0 +1,70 @@
1
+ import axios from "axios";
2
+ import { getToken, getUserData } from "st-func";
3
+
4
+ const token = getToken();
5
+ const host = "http://192.168.12.38:5173";
6
+
7
+ // 预警系统: 字典汇总
8
+ export const getAlarDict = async () => {
9
+ const params = {
10
+ method: "post",
11
+ headers: { token },
12
+ data: {
13
+ userId: getUserData("id"),
14
+ dictIds: [1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1012, 1013, 1017, 1020, 1021, 1025, 1024, 1027, 1030],
15
+ },
16
+ url: `${host}/middleLayer/post/alarm/deliversign/getDicConfig`,
17
+ };
18
+ const { data } = await axios(params);
19
+ const obj = {};
20
+ for (const key in data.body) {
21
+ if (Object.hasOwnProperty.call(data.body, key)) {
22
+ const element = data.body[key];
23
+ obj[key] = element.map((item) => ({
24
+ ...item,
25
+ label: item.dictName,
26
+ value: item.dictCode,
27
+ }));
28
+ }
29
+ }
30
+ return obj;
31
+ };
32
+
33
+ // 预警系统: 周期
34
+ export const getAlarFreq = async () => {
35
+ const params = {
36
+ method: "post",
37
+ headers: { token },
38
+ url: `${host}/middleLayer/post/alarm/deliversign/getAllFreq`,
39
+ };
40
+ const { data } = await axios(params);
41
+ return data.body
42
+ .sort((a, b) => a.orderInfo - b.orderInfo)
43
+ .map((item) => ({
44
+ ...item,
45
+ label: item.freqName,
46
+ value: item.freqCode,
47
+ }));
48
+ };
49
+
50
+ // 预警系统: 因子
51
+ export const getAlarFactor = async () => {
52
+ const params = {
53
+ method: "post",
54
+ headers: { token },
55
+ data: { pageNum: 1, pageSize: 9999 },
56
+ url: `${host}/middleLayer/post/alarm/deliversign/getFactorConfigByPage`,
57
+ };
58
+ const { data } = await axios(params);
59
+ const { body } = data;
60
+ return body.list.reduce((result, item) => {
61
+ if ([1, 3, 4].includes(item.type)) {
62
+ result.push({
63
+ ...item,
64
+ label: item.factorName,
65
+ value: item.id,
66
+ });
67
+ }
68
+ return result;
69
+ }, []);
70
+ };