Commit ea4399b1d30aa94f1fbc847ffb8f923182dd8bf0
Merge branch 'f-dev' into 'main'
fix:DEFECT-621 DEFECT-622 DEFECT-613 修复时间段显示为一样的时间 设备未填入属性提示修改... See merge request huang/yun-teng-iot-front!280
Showing
7 changed files
with
61 additions
and
26 deletions
1 | 1 | import { FormSchema } from '/@/components/Table'; |
2 | -import { phoneRule, emailRule, chineseAndEnlishRule } from '/@/utils/rules'; | |
2 | +import { phoneRule, emailRule } from '/@/utils/rules'; | |
3 | 3 | |
4 | 4 | export const formSchema: FormSchema[] = [ |
5 | 5 | { |
... | ... | @@ -11,7 +11,6 @@ export const formSchema: FormSchema[] = [ |
11 | 11 | componentProps: { |
12 | 12 | placeholder: '请输入用户昵称', |
13 | 13 | }, |
14 | - rules: chineseAndEnlishRule, | |
15 | 14 | }, |
16 | 15 | { |
17 | 16 | field: 'phoneNumber', | ... | ... |
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | icon="ion:document-text-outline" |
33 | 33 | /> |
34 | 34 | <MenuItem |
35 | + v-if="hasPermission('system:password:view')" | |
35 | 36 | key="changePassword" |
36 | 37 | :text="t('layout.header.dropdownItemChangePassword')" |
37 | 38 | icon="ant-design:unlock-twotone" |
... | ... | @@ -60,9 +61,7 @@ |
60 | 61 | <script lang="ts"> |
61 | 62 | // components |
62 | 63 | import { Dropdown, Menu } from 'ant-design-vue'; |
63 | - | |
64 | 64 | import { defineComponent, computed, ref, reactive } from 'vue'; |
65 | - | |
66 | 65 | import { useUserStore } from '/@/store/modules/user'; |
67 | 66 | import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting'; |
68 | 67 | import { useI18n } from '/@/hooks/web/useI18n'; |
... | ... | @@ -74,7 +73,9 @@ |
74 | 73 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
75 | 74 | import { getAuthCache } from '/@/utils/auth'; |
76 | 75 | import { useRouter } from 'vue-router'; |
77 | - type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal'; | |
76 | + import { usePermission } from '/@/hooks/web/usePermission'; | |
77 | + | |
78 | + type MenuEvent = 'logout' | 'doc' | 'lock' | 'personal' | 'changePassword'; | |
78 | 79 | |
79 | 80 | export default defineComponent({ |
80 | 81 | name: 'UserDropdown', |
... | ... | @@ -89,6 +90,9 @@ |
89 | 90 | theme: propTypes.oneOf(['dark', 'light']), |
90 | 91 | }, |
91 | 92 | setup() { |
93 | + //修复修改密码根据后端返回的权限标识来显隐 | |
94 | + const { hasPermission } = usePermission(); | |
95 | + //修复修改密码根据后端返回的权限标识来显隐 | |
92 | 96 | const refreshPersonlData = reactive({ |
93 | 97 | avatar: '', |
94 | 98 | realName: '', |
... | ... | @@ -175,6 +179,7 @@ |
175 | 179 | getShowDoc, |
176 | 180 | register, |
177 | 181 | getUseLockPage, |
182 | + hasPermission, | |
178 | 183 | }; |
179 | 184 | }, |
180 | 185 | }); | ... | ... |
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 | <BasicForm @register="registerForm"> |
14 | 14 | <template #devices="{ model, field }"> |
15 | 15 | <p style="display: none">{{ field }}</p> |
16 | + <p>{{ queryModeFunc(model['queryMode']) }}</p> | |
16 | 17 | <p>{{ orgFunc(model['organizationId']) }}</p> |
17 | 18 | <Select |
18 | 19 | placeholder="请选择设备" |
... | ... | @@ -81,9 +82,23 @@ |
81 | 82 | let editResData: any = reactive({}); |
82 | 83 | const editDeviceAttr: any = ref([]); |
83 | 84 | const orgFuncId = ref(''); |
85 | + const queryModeStr = ref(''); | |
84 | 86 | const orgFunc = (e) => { |
85 | 87 | orgFuncId.value = e; |
86 | 88 | }; |
89 | + const queryModeFunc = (e) => { | |
90 | + queryModeStr.value = e; | |
91 | + }; | |
92 | + watch( | |
93 | + () => queryModeStr.value, | |
94 | + (newValue: string) => { | |
95 | + if (newValue == 'latest') { | |
96 | + setFieldsValue({ startTs: 1000 }); | |
97 | + setFieldsValue({ interval: 1000 }); | |
98 | + } else { | |
99 | + } | |
100 | + } | |
101 | + ); | |
87 | 102 | watch( |
88 | 103 | () => orgFuncId.value, |
89 | 104 | async (newValue: string) => { |
... | ... | @@ -144,11 +159,6 @@ |
144 | 159 | deviceList.value = deWeightThree(); |
145 | 160 | const findEditValue = deviceList.value.findIndex((f) => f.value == e.value); |
146 | 161 | if (findEditValue !== -1) deviceList.value.splice(findEditValue, 1); |
147 | - // try { | |
148 | - // if (deviceList.value[0]?.attributes.length > 0) { | |
149 | - // deviceList.value.splice(0, 1); | |
150 | - // } | |
151 | - // } catch {} | |
152 | 162 | } else { |
153 | 163 | const eDevice = e.key || e.value; |
154 | 164 | const findValue = deviceList.value.findIndex((f) => f.value == eDevice); |
... | ... | @@ -197,6 +207,7 @@ |
197 | 207 | endTs: editResData.data.queryCondition?.endTs, |
198 | 208 | way: editResData.data?.way, |
199 | 209 | queryMode: editResData.data.queryCondition?.queryMode === 0 ? 'latest' : 'timePeriod', |
210 | + cronTime: editResData.data?.executeContent | |
200 | 211 | }); |
201 | 212 | const endTsTime = editResData.data.queryCondition?.endTs; |
202 | 213 | const startTsTime = editResData.data.queryCondition?.startTs; |
... | ... | @@ -340,15 +351,25 @@ |
340 | 351 | const values = await validate(); |
341 | 352 | if (!values) return; |
342 | 353 | getFormValueFunc(); |
354 | + let hasAttr = false; | |
343 | 355 | if (!unref(isUpdate)) { |
344 | 356 | if (getAttrDevice.value.length === 0) { |
345 | 357 | return createMessage.error('请选择设备及其属性'); |
358 | + } else { | |
359 | + getAttrDevice.value.forEach((f: any) => { | |
360 | + if (f.attributes == undefined) hasAttr = true; | |
361 | + }); | |
346 | 362 | } |
347 | 363 | } else { |
348 | 364 | if (getAttrDevice.value.length === 0) { |
349 | 365 | return createMessage.error('请选择设备及其属性'); |
366 | + } else { | |
367 | + getAttrDevice.value.forEach((f: any) => { | |
368 | + if (f.attributes == undefined) hasAttr = true; | |
369 | + }); | |
350 | 370 | } |
351 | 371 | } |
372 | + if (hasAttr) return createMessage.error('请选择设备属性'); | |
352 | 373 | if (values.executeWay == 0) { |
353 | 374 | executeContent = null; |
354 | 375 | } else { |
... | ... | @@ -364,7 +385,7 @@ |
364 | 385 | queryCondition = { |
365 | 386 | agg: values.agg, |
366 | 387 | interval: values.interval, |
367 | - limit: values.limit1, | |
388 | + limit: values.limit, | |
368 | 389 | ...{ |
369 | 390 | startTs: startTs.value, |
370 | 391 | }, |
... | ... | @@ -373,6 +394,11 @@ |
373 | 394 | }, |
374 | 395 | queryMode: values?.queryMode === 'latest' ? 0 : 1, |
375 | 396 | }; |
397 | + if (queryCondition.queryMode === 1) { | |
398 | + if (queryCondition.startTs == queryCondition.endTs) { | |
399 | + return createMessage.error('自定义周期时间不能选择一样'); | |
400 | + } | |
401 | + } | |
376 | 402 | |
377 | 403 | delete values.devices; |
378 | 404 | delete values.agg; | ... | ... |
... | ... | @@ -50,7 +50,7 @@ export const columns: BasicColumn[] = [ |
50 | 50 | dataIndex: 'dataType', |
51 | 51 | width: 120, |
52 | 52 | format: (_text: string, record: Recordable) => { |
53 | - return record.dataCompare === 0 ? '原始数据' : '聚合数据'; | |
53 | + return record.dataType === 0 ? '原始数据' : '聚合数据'; | |
54 | 54 | }, |
55 | 55 | }, |
56 | 56 | { |
... | ... | @@ -383,7 +383,7 @@ export const formSchema: QFormSchema[] = [ |
383 | 383 | }, |
384 | 384 | }, |
385 | 385 | { |
386 | - field: 'limit1', | |
386 | + field: 'limit', | |
387 | 387 | required: true, |
388 | 388 | label: '最大值', |
389 | 389 | component: 'InputNumber', |
... | ... | @@ -407,13 +407,13 @@ export const formSchema: QFormSchema[] = [ |
407 | 407 | componentProps({ formActionType }) { |
408 | 408 | const { setFieldsValue } = formActionType; |
409 | 409 | return { |
410 | - getPopupContainer: () => document.body, | |
411 | 410 | placeholder: '请选择查询周期', |
412 | 411 | options: [ |
413 | 412 | { label: '固定周期', value: QueryWay.LATEST }, |
414 | 413 | { label: '自定义周期', value: QueryWay.TIME_PERIOD }, |
415 | 414 | ], |
416 | 415 | onChange(value) { |
416 | + console.log(value); | |
417 | 417 | value === QueryWay.LATEST |
418 | 418 | ? setFieldsValue({ |
419 | 419 | [SchemaFiled.DATE_RANGE]: [], | ... | ... |
... | ... | @@ -10,9 +10,14 @@ |
10 | 10 | :showOkBtn="false" |
11 | 11 | > |
12 | 12 | <div class="wrapper"> |
13 | - <div class="inner item" v-for="(item, index) in initChartData" :key="index"> | |
14 | - <p style="display: none">{{ item }}</p> | |
15 | - <div :id="`chart${index}`" :style="{ height, width }"></div> | |
13 | + <div v-if="initChartData.length > 0"> | |
14 | + <div class="inner item" v-for="(item, index) in initChartData" :key="index"> | |
15 | + <p style="display: none">{{ item }}</p> | |
16 | + <div :id="`chart${index}`" :style="{ height, width }"></div> | |
17 | + </div> | |
18 | + </div> | |
19 | + <div v-else style="display: flex; justify-content: center; align-items: center"> | |
20 | + <div style="position: relative; left: 13rem; top: 8rem">暂无数据</div> | |
16 | 21 | </div> |
17 | 22 | </div> |
18 | 23 | </BasicModal> |
... | ... | @@ -126,12 +131,8 @@ |
126 | 131 | axisPointer: { type: 'shadow' }, |
127 | 132 | axisLabel: { |
128 | 133 | color: '#333', |
129 | - // 让x轴文字方向为竖向 | |
130 | 134 | interval: 0, |
131 | 135 | rotate: 90, |
132 | - // formatter: function (value) { | |
133 | - // return value.split('').join('\n'); | |
134 | - // }, | |
135 | 136 | }, |
136 | 137 | }, |
137 | 138 | yAxis: { | ... | ... |
... | ... | @@ -139,6 +139,7 @@ |
139 | 139 | const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')); |
140 | 140 | |
141 | 141 | async function handleSubmit() { |
142 | + setDrawerProps({ loading: true }); | |
142 | 143 | setDrawerProps({ confirmLoading: true }); |
143 | 144 | const { createMessage } = useMessage(); |
144 | 145 | try { |
... | ... | @@ -152,14 +153,17 @@ |
152 | 153 | menu: allCheckedKeys.value.length ? allCheckedKeys.value : originMenus.value, |
153 | 154 | }; |
154 | 155 | if (req.menu == undefined) return createMessage.error('请勾选权限菜单'); |
155 | - saveOrUpdateRoleInfoWithMenu(req).then(() => { | |
156 | + const res = await saveOrUpdateRoleInfoWithMenu(req); | |
157 | + if (res) { | |
156 | 158 | closeDrawer(); |
157 | 159 | emit('success'); |
158 | 160 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); |
159 | - }); | |
160 | - } catch { | |
161 | + setDrawerProps({ loading: false }); | |
162 | + setDrawerProps({ confirmLoading: false }); | |
163 | + } | |
161 | 164 | } finally { |
162 | 165 | setTimeout(() => { |
166 | + setDrawerProps({ loading: false }); | |
163 | 167 | setDrawerProps({ confirmLoading: false }); |
164 | 168 | }, 300); |
165 | 169 | } | ... | ... |