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