Commit 65e24b17dcef179efc67d761a3a52f841185b686

Authored by xp.Huang
2 parents 562c3382 e0cad1d0

Merge branch 'fix/get-device-list-by-productIds' into 'main_dev'

fix: 修复当产品id为空时,http请求携带参数需为空数组

See merge request yunteng/thingskit-scada!173
1   -import { h, render } from 'vue'
2   -import FirstScreenAnmation from './index.vue'
3   -
4   -export function createFirstScreen() {
5   - render(h(FirstScreenAnmation), document.getElementById('geInfo')!)
6   -}
7   -
1   -<script setup lang="ts">
2   -import { onMounted, ref, unref } from 'vue'
3   -import type { ECharts, EChartsOption } from 'echarts'
4   -import { init } from 'echarts'
5   -const firstScreenElRef = ref()
6   -
7   -const instance = ref<ECharts>()
8   -
9   -const options: EChartsOption = {
10   - graphic: {
11   - elements: [
12   - {
13   - type: 'text',
14   - left: 'center',
15   - top: 'center',
16   - style: {
17   - text: 'Apache ECharts',
18   - fontSize: 80,
19   - fontWeight: 'bold',
20   - lineDash: [0, 200],
21   - lineDashOffset: 0,
22   - fill: 'transparent',
23   - stroke: '#000',
24   - lineWidth: 1,
25   - },
26   - keyframeAnimation: {
27   - duration: 3000,
28   - loop: true,
29   - keyframes: [
30   - {
31   - percent: 0.7,
32   - style: {
33   - fill: 'transparent',
34   - lineDashOffset: 200,
35   - lineDash: [200, 0],
36   - },
37   - },
38   - {
39   - // Stop for a while.
40   - percent: 0.8,
41   - style: {
42   - fill: 'transparent',
43   - },
44   - },
45   - {
46   - percent: 1,
47   - style: {
48   - fill: 'black',
49   - },
50   - },
51   - ],
52   - },
53   - },
54   - ],
55   - },
56   -}
57   -
58   -onMounted(() => {
59   - instance.value = init(unref(firstScreenElRef), options)
60   -})
61   -</script>
62   -
63   -<template>
64   - <div ref="firstScreenElRef" class="w-full h-full" />
65   -</template>
... ... @@ -69,7 +69,7 @@ async function getDeviceList() {
69 69 if (!organizationId) return
70 70 const productIds = unref(contentDataStore.getProductIds)
71 71 const result = await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId })
72   - deviceList.value = result.map((item: Recordable) => ({
  72 + deviceList.value = result.map(item => ({
73 73 ...item,
74 74 label: item.alias || item.name,
75 75 value: item.tbDeviceId,
... ...
... ... @@ -49,7 +49,7 @@ export const formSchemas = (componentKey?: string): FormSchema[] => {
49 49 showSearch: true,
50 50 api: getListByDeviceProfileIds,
51 51 params: {
52   - deviceProfileIds: (unref(contentDataStore.getProductAndDevice) || []).map((item: ProductAndDevice) => item?.profileId),
  52 + deviceProfileIds: unref(contentDataStore.getProductIds),
53 53 organizationId,
54 54 },
55 55 aliasField: 'alias',
... ...
... ... @@ -127,7 +127,7 @@ export class VAxios {
127 127 await this.refreshTokenBeforeReq(doRefresh)
128 128 }
129 129 }
130   - catch (error) {}
  130 + catch (error) { }
131 131 }
132 132
133 133 !ignoreCancelToken && axiosCanceler.addPending(config)
... ...
1 1 import type { AxiosInstance, AxiosResponse } from 'axios'
2   -import { clone } from 'lodash-es'
  2 +import { clone, isArray } from 'lodash-es'
3 3 import axios from 'axios'
4 4 import { isString, isUnDef } from '@wry-smile/utils-is'
5 5 import { isShareMode } from '../env'
... ... @@ -77,7 +77,7 @@ const transform: AxiosTransform = {
77 77 if (
78 78 Reflect.has(config, 'data')
79 79 && config.data
80   - && (Object.keys(config.data).length > 0 || config.data instanceof FormData)
  80 + && (Object.keys(config.data).length > 0 || config.data instanceof FormData || isArray(config.data))
81 81 ) {
82 82 config.data = data
83 83 config.params = params
... ...