Commit 655799a1f9b99192743b62eac40ef9fc418c7c6b

Authored by xp.Huang
2 parents 69358c3c e2786ef4

Merge branch 'sqy_dev' into 'main'

fix:修改teambition上的几个问题:告警时间范围,消息配置回显错误,首页样式调整以及数据调整

See merge request huang/yun-teng-iot-front!102
1 1 import { alarmLevel, statusType } from '/@/views/device/manage/config/detail.config';
2 2 import { FormSchema } from '/@/components/Form';
3 3 import { BasicColumn } from '/@/components/Table';
  4 +import dayjs from 'moment';
4 5 export const alarmSearchSchemas: FormSchema[] = [
5 6 {
6 7 field: 'status',
... ... @@ -57,6 +58,7 @@ export const alarmSearchSchemas: FormSchema[] = [
57 58 component: 'DatePicker',
58 59 componentProps: {
59 60 valueFormat: 'x',
  61 + showTime: { defaultValue: dayjs('23:59:59', 'HH:mm:ss') },
60 62 },
61 63 colProps: { span: 6 },
62 64 },
... ...
... ... @@ -18,6 +18,7 @@ export const formSchema: FormSchema[] = [
18 18 label: '',
19 19 component: 'ApiTreeSelect',
20 20 componentProps: {
  21 + placeholder: '请选择组织',
21 22 api: async () => {
22 23 const data = await getOrganizationList();
23 24 copyTransFun(data as any as any[]);
... ...
... ... @@ -8,7 +8,11 @@
8 8 <div class="flex-auto">
9 9 <div class="flex justify-between" style="align-items: center">
10 10 <div style="font-size: 1.625rem; color: #333; font-weight: bold">
11   - <CountTo :startVal="1" :endVal="growCardList?.deviceInfo?.sumCount" />
  11 + <CountTo
  12 + v-if="growCardList?.deviceInfo?.sumCount"
  13 + :endVal="growCardList.deviceInfo.sumCount"
  14 + />
  15 + <CountTo v-else :endVal="0" />
12 16 </div>
13 17 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
14 18 </div>
... ... @@ -54,10 +58,18 @@
54 58 <div class="flex-auto">
55 59 <div class="flex justify-between" style="align-items: center">
56 60 <div v-if="!isAdmin(role)" style="font-size: 1.625rem; color: #333; font-weight: bold">
57   - <CountTo :end-val="growCardList?.alarmInfo?.sumCount" />
  61 + <CountTo
  62 + v-if="growCardList?.alarmInfo?.sumCount"
  63 + :end-val="growCardList.alarmInfo.sumCount"
  64 + />
  65 + <CountTo v-else :end-val="0" />
58 66 </div>
59 67 <div style="font-size: 1.625rem; color: #333; font-weight: bold" v-else>
60   - <CountTo :end-val="growCardList?.tenantInfo?.sumCount" />
  68 + <CountTo
  69 + v-if="growCardList?.tenantInfo?.sumCount"
  70 + :end-val="growCardList.tenantInfo.sumCount"
  71 + />
  72 + <CountTo v-else :end-val="0" />
61 73 </div>
62 74 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
63 75 </div>
... ... @@ -84,23 +96,33 @@
84 96 <div>
85 97 <div style="align-items: center">
86 98 <div style="font-size: 1.625rem; color: #333; font-weight: bold">
87   - <CountTo :end-val="growCardList?.messageInfo?.messageCount"
88   - /></div>
  99 + <CountTo
  100 + v-if="growCardList?.messageInfo?.messageCount"
  101 + :end-val="growCardList.messageInfo.messageCount"
  102 + />
  103 + <CountTo v-else :end-val="0" />
  104 + </div>
89 105 消息量(条)
90 106 </div>
91 107 <div>
92 108 <span class="mr-2">数据点</span>
93 109 <CountTo
94 110 style="color: #333; font-weight: bold"
95   - :end-val="growCardList?.messageInfo?.dataPointsCount"
  111 + v-if="growCardList?.messageInfo?.dataPointsCount"
  112 + :end-val="growCardList.messageInfo.dataPointsCount"
96 113 />
  114 + <CountTo style="color: #333; font-weight: bold" :end-val="0" v-else />
97 115 </div>
98 116 </div>
99 117 </div>
100 118 <div class="flex-auto" v-else>
101 119 <div class="flex justify-between" style="align-items: center">
102 120 <div style="font-size: 1.625rem; color: #333; font-weight: bold">
103   - <CountTo :end-val="growCardList?.customerInfo?.sumCount" />
  121 + <CountTo
  122 + v-if="growCardList?.customerInfo?.sumCount"
  123 + :end-val="growCardList.customerInfo.sumCount"
  124 + />
  125 + <CountTo :end-val="0" v-else />
104 126 </div>
105 127 <img src="/src/assets/images/tip.png" style="width: 1.125rem; height: 1.125rem" />
106 128 </div>
... ...
... ... @@ -54,13 +54,9 @@
54 54 </CardMeta>
55 55 </Card>
56 56 </div>
57   -
58 57 <Card v-else :bordered="false" :bodyStyle="{ padding: 0 }" v-bind="$attrs">
59 58 <Skeleton active :paragraph="{ rows: 10 }" :loading="!tenantTop10.length">
60   - <h1 style="color: rgba(0, 0, 0, 0.85); font-weight: bold; font-size: 16px">
61   - 租户消息量TOP10</h1
62   - >
63   - <Descriptions :column="1">
  59 + <Descriptions :column="1" style="min-height: 180px" title="租户消息量TOP10">
64 60 <template v-for="(item, index) in tenantTop10" :key="item.name">
65 61 <DescriptionsItem>
66 62 <span
... ...
... ... @@ -235,7 +235,6 @@
235 235 }
236 236 state.dataPointList = newArray;
237 237 state.messageList = newArray1;
238   - console.log(state.dataPointList, state.messageList);
239 238 }
240 239 }
241 240 },
... ...
... ... @@ -44,6 +44,7 @@
44 44 series: [
45 45 {
46 46 name: '告警数',
  47 + barMaxWidth: '4%',
47 48 type: 'bar',
48 49 stack: 'Total',
49 50 data: props.alarmList,
... ... @@ -78,6 +79,7 @@
78 79 type: 'bar',
79 80 stack: 'Total',
80 81 color: '#3C78FF',
  82 + barMaxWidth: '4%',
81 83 data: newValue,
82 84 },
83 85 ],
... ...
... ... @@ -67,12 +67,14 @@
67 67 type: 'bar',
68 68 stack: 'total',
69 69 data: newValue,
  70 + barMaxWidth: '4%',
70 71 color: '#5AEEED',
71 72 },
72 73 {
73 74 name: '传输消息量',
74 75 type: 'bar',
75 76 stack: 'total',
  77 + barMaxWidth: '4%',
76 78 data: newValue1,
77 79 color: '#3C78FF',
78 80 },
... ...
... ... @@ -3,6 +3,7 @@ import { FormSchema } from '/@/components/Form';
3 3 import { BasicColumn } from '/@/components/Table';
4 4 import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
5 5 import { getCustomerList } from '/@/api/device/deviceManager';
  6 +import dayjs from 'moment';
6 7 export const columns: BasicColumn[] = [
7 8 {
8 9 title: '设备名称',
... ... @@ -99,6 +100,7 @@ export const alarmSearchSchemas: FormSchema[] = [
99 100 component: 'DatePicker',
100 101 componentProps: {
101 102 valueFormat: 'x',
  103 + showTime: { defaultValue: dayjs('23:59:59', 'HH:mm:ss') },
102 104 },
103 105 colProps: { span: 6 },
104 106 },
... ... @@ -217,7 +219,7 @@ export const childDeviceSchemas: FormSchema[] = [
217 219 field: 'icon',
218 220 label: '设备配置',
219 221 component: 'Select',
220   - colProps: { span: 12 },
  222 + colProps: { span: 6 },
221 223 componentProps: {
222 224 maxLength: 255,
223 225 },
... ... @@ -226,7 +228,7 @@ export const childDeviceSchemas: FormSchema[] = [
226 228 field: 'icon',
227 229 label: '设备名称',
228 230 component: 'Input',
229   - colProps: { span: 12 },
  231 + colProps: { span: 6 },
230 232 componentProps: {
231 233 maxLength: 255,
232 234 placeholder: '请输入设备名称',
... ...
... ... @@ -41,13 +41,13 @@ export const columns: BasicColumn[] = [
41 41 {
42 42 title: '最后连接时间',
43 43 dataIndex: 'lastOnlineTime',
44   - format: (text) => formatToDate(text, 'YYYY-MM-DD HH:mm:ss'),
  44 + format: (text) => text && formatToDate(text, 'YYYY-MM-DD HH:mm:ss'),
45 45 width: 180,
46 46 },
47 47 {
48 48 title: '最后断开时间',
49 49 dataIndex: 'lastOfflineTime',
50   - format: (text) => formatToDate(text, 'YYYY-MM-DD HH:mm:ss'),
  50 + format: (text) => text && formatToDate(text, 'YYYY-MM-DD HH:mm:ss'),
51 51 width: 180,
52 52 },
53 53 ];
... ... @@ -84,7 +84,7 @@ export const searchFormSchema: FormSchema[] = [
84 84 field: 'name',
85 85 label: '设备名称',
86 86 component: 'Input',
87   - colProps: { span: 7 },
  87 + colProps: { span: 6 },
88 88 componentProps: {
89 89 maxLength: 255,
90 90 placeholder: '请输入设备名称',
... ...
... ... @@ -163,7 +163,6 @@
163 163 actionColumn: {
164 164 width: 300,
165 165 title: '操作',
166   - dataIndex: 'action',
167 166 slots: { customRender: 'action' },
168 167 fixed: 'right',
169 168 },
... ...
... ... @@ -36,34 +36,13 @@
36 36 setDrawerProps({ confirmLoading: false });
37 37 isUpdate.value = !!data?.isUpdate;
38 38 if (unref(isUpdate)) {
39   - console.log(data);
40   - // const config = data.record.config;
41   - // for (const key in config) {
42   - // Reflect.set(data.record, key + '', config[key]);
43   - // }
44   - // await setFieldsValue({
45   - // ...data.record,
46   - // });
47   - await setFieldsValue({
48   - accessKeyId: data.record.config.accessKeyId,
49   - accessKeySecret: data.record.config.accessKeySecret,
50   - platformTypeDictText: data.record.platformTypeDictText,
51   - messageTypeDictText: data.record.messageTypeDictText,
52   - messageType: data.record.messageType,
53   - platformType: data.record.platformType,
54   - configName: data.record.configName,
55   - createTime: data.record.createTime,
56   - creator: data.record.creator,
57   - enabled: data.record.enabled,
58   - id: data.record.id,
59   - key: data.record.key,
60   - pendingStatus: data.record.pendingStatus,
61   - remark: data.record.remark,
62   - status: data.record.status,
63   - tenantId: data.record.tenantId,
64   - updateTime: data.record.updateTime,
65   - updater: data.record.updater,
66   - });
  39 + const { config } = data.record;
  40 + for (const key in config) {
  41 + Reflect.set(data.record, key + '', config[key]);
  42 + }
  43 + const editRecord = JSON.parse(JSON.stringify(data.record));
  44 + Reflect.deleteProperty(editRecord, 'config');
  45 + await setFieldsValue(editRecord);
67 46 }
68 47 });
69 48
... ...
... ... @@ -90,13 +90,13 @@ export const searchFormSchema: FormSchema[] = [
90 90 field: 'status',
91 91 label: '状态',
92 92 component: 'Select',
  93 + colProps: { span: 6 },
93 94 componentProps: {
94 95 options: [
95 96 { label: '已启用', value: 1 },
96 97 { label: '已禁用', value: 0 },
97 98 ],
98 99 },
99   - colProps: { span: 6 },
100 100 },
101 101 ];
102 102
... ... @@ -156,7 +156,6 @@ export const formSchema: FormSchema[] = [
156 156 maxLength: 36,
157 157 placeholder: '请输入accessKeyId',
158 158 },
159   -
160 159 ifShow: ({ values }) => isMessage(Reflect.get(values, 'messageType')),
161 160 },
162 161 {
... ... @@ -205,7 +204,6 @@ export const formSchema: FormSchema[] = [
205 204 maxLength: 255,
206 205 placeholder: '请输入用户名',
207 206 },
208   -
209 207 component: 'Input',
210 208 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
211 209 },
... ... @@ -213,7 +211,6 @@ export const formSchema: FormSchema[] = [
213 211 field: 'password',
214 212 label: '密码',
215 213 required: true,
216   -
217 214 component: 'InputPassword',
218 215 ifShow: ({ values }) => isEmail(Reflect.get(values, 'messageType')),
219 216 },
... ... @@ -256,7 +253,6 @@ export const formSchema: FormSchema[] = [
256 253 maxLength: 255,
257 254 placeholder: '请输入备注',
258 255 },
259   -
260 256 component: 'InputTextArea',
261 257 },
262 258 {
... ...
... ... @@ -97,7 +97,7 @@
97 97 function showData(record: Recordable) {
98 98 Modal.info({
99 99 title: '当前配置',
100   - width: 480,
  100 + width: 600,
101 101 content: h(JsonPreview, { data: JSON.parse(JSON.stringify(record.config)) }),
102 102 });
103 103 }
... ...