Commit 0d3efb551af38b57860917dba7497d72c5662dda
1 parent
b4676b5f
fix:修复登录界面后端返回的错误信息,feat:个人中心接口联调,fix:待修复设备配置个别字段回显问题
Showing
10 changed files
with
222 additions
and
380 deletions
| ... | ... | @@ -5,7 +5,7 @@ import { UploadFileParams } from '/#/axios'; |
| 5 | 5 | |
| 6 | 6 | enum API { |
| 7 | 7 | BaseUploadUrl = '/api/yt/oss/upload', |
| 8 | - PutPersonalUrl = '/user', | |
| 8 | + PutPersonalUrl = '/user/center', | |
| 9 | 9 | GetPersonalUrl = '/user/', |
| 10 | 10 | } |
| 11 | 11 | /** |
| ... | ... | @@ -31,7 +31,7 @@ export const personalGet = (id: string) => { |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | export const personalPut = (params: IPutPersonal) => { |
| 34 | - return defHttp.post<IPutPersonal>({ | |
| 34 | + return defHttp.put<IPutPersonal>({ | |
| 35 | 35 | url: API.PutPersonalUrl, |
| 36 | 36 | params, |
| 37 | 37 | }); | ... | ... |
| ... | ... | @@ -2,7 +2,7 @@ import { FormSchema } from '/@/components/Table'; |
| 2 | 2 | |
| 3 | 3 | export const formSchema: FormSchema[] = [ |
| 4 | 4 | { |
| 5 | - field: 'creator', | |
| 5 | + field: 'nickName', | |
| 6 | 6 | label: '用户昵称', |
| 7 | 7 | colProps: { span: 13 }, |
| 8 | 8 | required: true, |
| ... | ... | @@ -31,24 +31,4 @@ export const formSchema: FormSchema[] = [ |
| 31 | 31 | placeholder: '请输入邮箱', |
| 32 | 32 | }, |
| 33 | 33 | }, |
| 34 | - { | |
| 35 | - field: 'enabled', | |
| 36 | - component: 'RadioGroup', | |
| 37 | - label: '性别', | |
| 38 | - colProps: { | |
| 39 | - span: 13, | |
| 40 | - }, | |
| 41 | - componentProps: { | |
| 42 | - options: [ | |
| 43 | - { | |
| 44 | - label: '男', | |
| 45 | - value: 'true', | |
| 46 | - }, | |
| 47 | - { | |
| 48 | - label: '女', | |
| 49 | - value: 'false', | |
| 50 | - }, | |
| 51 | - ], | |
| 52 | - }, | |
| 53 | - }, | |
| 54 | 34 | ]; | ... | ... |
| ... | ... | @@ -68,10 +68,11 @@ |
| 68 | 68 | import { Description, DescItem, useDescription } from '/@/components/Description/index'; |
| 69 | 69 | import { CropperAvatar } from '/@/components/Cropper'; |
| 70 | 70 | import defaultImage from '/@/assets/images/logo.png'; |
| 71 | - import { uploadApi, personalPut, personalGet } from '/@/api/personal/index'; | |
| 71 | + import { uploadApi, personalPut } from '/@/api/personal/index'; | |
| 72 | 72 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 73 | 73 | import { USER_INFO_KEY } from '/@/enums/cacheEnum'; |
| 74 | 74 | import { getAuthCache } from '/@/utils/auth'; |
| 75 | + import { useUserStore } from '/@/store/modules/user'; | |
| 75 | 76 | |
| 76 | 77 | const schema: DescItem[] = [ |
| 77 | 78 | { |
| ... | ... | @@ -91,7 +92,7 @@ |
| 91 | 92 | label: '用户昵称:', |
| 92 | 93 | }, |
| 93 | 94 | { |
| 94 | - field: 'createTime', | |
| 95 | + field: 'accountExpireTime', | |
| 95 | 96 | label: '过期时间:', |
| 96 | 97 | }, |
| 97 | 98 | { |
| ... | ... | @@ -103,43 +104,54 @@ |
| 103 | 104 | name: 'index', |
| 104 | 105 | components: { BasicModal, BasicForm, Description, CropperAvatar }, |
| 105 | 106 | setup() { |
| 107 | + const userStore = useUserStore(); | |
| 106 | 108 | const userInfo = getAuthCache(USER_INFO_KEY); |
| 107 | 109 | const { createMessage } = useMessage(); |
| 108 | 110 | const getPersonalValue: any = ref({}); |
| 109 | 111 | const getPersonalDetailValue: any = ref({}); |
| 112 | + const avatarUrl: any = ref(''); | |
| 113 | + const getBackendV: any = ref({}); | |
| 110 | 114 | const [registerDesc] = useDescription({ |
| 111 | 115 | title: '个人详情', |
| 112 | 116 | schema: schema, |
| 113 | 117 | }); |
| 114 | 118 | |
| 115 | - const [registerModal] = useModalInner(); | |
| 116 | - const [registerForm, { validate }] = useForm({ | |
| 119 | + const [registerModal, { closeModal }] = useModalInner(); | |
| 120 | + const [registerForm, { validate, resetFields }] = useForm({ | |
| 117 | 121 | showActionButtonGroup: false, |
| 118 | 122 | schemas: formSchema, |
| 119 | 123 | }); |
| 120 | 124 | const avatar = computed(() => { |
| 121 | - return defaultImage; | |
| 125 | + const { avatar } = userStore.getUserInfo; | |
| 126 | + return avatar || defaultImage; | |
| 122 | 127 | }); |
| 123 | 128 | const handleSubmit = async () => { |
| 129 | + // console.log(userStore.getUserInfo); | |
| 130 | + const getUserInfo = await userInfo; | |
| 131 | + // console.log(getUserInfo); | |
| 124 | 132 | getPersonalValue.value = await validate(); |
| 133 | + getPersonalValue.value.id = getUserInfo.userId; | |
| 134 | + getPersonalValue.value.username = getBackendV.value.username; | |
| 135 | + getPersonalValue.value.avatar = avatarUrl.value; | |
| 125 | 136 | await personalPut(getPersonalValue.value); |
| 126 | 137 | createMessage.success('修改成功'); |
| 138 | + closeModal(); | |
| 139 | + resetFields(); | |
| 127 | 140 | }; |
| 128 | 141 | const updateAvatar = async (v) => { |
| 129 | - console.log('v' + v); | |
| 130 | - await personalPut({ avatar: v }); | |
| 142 | + avatarUrl.value = v.data.fileStaticUri; | |
| 143 | + console.log(avatarUrl.value); | |
| 144 | + // await personalPut({ avatar: v }); | |
| 131 | 145 | }; |
| 132 | 146 | const getPersonalDetail = async () => { |
| 133 | 147 | try { |
| 134 | 148 | const getUserInfo = await userInfo; |
| 135 | - const getBackendData = await personalGet(getUserInfo.userId); | |
| 136 | - getPersonalDetailValue.value = getBackendData; | |
| 137 | - console.log(getPersonalDetailValue.value); | |
| 149 | + getPersonalDetailValue.value = getUserInfo; | |
| 138 | 150 | } catch (e) { |
| 139 | 151 | return e; |
| 140 | 152 | } |
| 141 | 153 | }; |
| 142 | - onMounted(() => { | |
| 154 | + onMounted(async () => { | |
| 143 | 155 | getPersonalDetail(); |
| 144 | 156 | }); |
| 145 | 157 | const compHeight = computed(() => { | ... | ... |
| ... | ... | @@ -129,6 +129,7 @@ export const useUserStore = defineStore({ |
| 129 | 129 | try { |
| 130 | 130 | const { goHome = true, mode, ...loginParams } = params; |
| 131 | 131 | const data = await loginApi(loginParams, mode); |
| 132 | + console.log(data); | |
| 132 | 133 | return this.process(data, goHome); |
| 133 | 134 | } catch (error) { |
| 134 | 135 | return Promise.reject(error); | ... | ... |
| ... | ... | @@ -15,18 +15,53 @@ import { setObjToUrlParams, deepMerge } from '/@/utils'; |
| 15 | 15 | import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; |
| 16 | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 17 | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
| 18 | -// import { PageEnum } from '/@/enums/pageEnum'; | |
| 18 | +import { PageEnum } from '/@/enums/pageEnum'; | |
| 19 | 19 | import { REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; |
| 20 | 20 | import { router } from '/@/router'; |
| 21 | + | |
| 21 | 22 | // import { useUserStore } from '/@/store/modules/user'; |
| 22 | 23 | // const userStore = useUserStore(); |
| 23 | 24 | // console.log(userStore.userInfo); |
| 24 | 25 | |
| 25 | 26 | // YUNTENG IOT__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__ |
| 27 | + | |
| 28 | +function timestampToTime(timestamp) { | |
| 29 | + const date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 | |
| 30 | + const Y = date.getFullYear() + '-'; | |
| 31 | + const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; | |
| 32 | + const D = date.getDate() + ' '; | |
| 33 | + const h = date.getHours() + ':'; | |
| 34 | + const m = date.getMinutes() + ':'; | |
| 35 | + const s = date.getSeconds(); | |
| 36 | + return Y + M + D + h + m + s; | |
| 37 | +} | |
| 38 | + | |
| 39 | +function convertToDate() { | |
| 40 | + const date = new Date(); | |
| 41 | + const y = date.getFullYear(); | |
| 42 | + let m = date.getMonth() + 1; | |
| 43 | + let d = date.getDate(); | |
| 44 | + let h = date.getHours(); | |
| 45 | + let min = date.getMinutes(); | |
| 46 | + let s = date.getSeconds(); | |
| 47 | + m = m < 10 ? '0' + m : m; //月小于10,加0 | |
| 48 | + d = d < 10 ? '0' + d : d; //day小于10,加0 | |
| 49 | + h = h < 10 ? '0' + h : h; | |
| 50 | + min = min < 10 ? '0' + min : min; | |
| 51 | + s = s < 10 ? '0' + s : s; | |
| 52 | + return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s; | |
| 53 | +} | |
| 54 | + | |
| 26 | 55 | const globSetting = useGlobSetting(); |
| 27 | 56 | const urlPrefix = globSetting.urlPrefix; |
| 28 | 57 | const { createMessage, createErrorModal } = useMessage(); |
| 29 | 58 | const getJwtTokenInfo = getAuthCache(REFRESH_TOKEN_KEY); |
| 59 | +const getExiper = window.localStorage.getItem( | |
| 60 | + 'UNDEFINED__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__' | |
| 61 | +); | |
| 62 | +const getExiperValue = JSON.parse(getExiper); | |
| 63 | +const expireTime = timestampToTime(getExiperValue.expire); | |
| 64 | +const nowTime = convertToDate(); | |
| 30 | 65 | |
| 31 | 66 | /** |
| 32 | 67 | * @description: 数据处理,方便区分多种处理方式 |
| ... | ... | @@ -130,16 +165,25 @@ const transform: AxiosTransform = { |
| 130 | 165 | |
| 131 | 166 | try { |
| 132 | 167 | if (response.data.code === '401' || response.data.msg === 'tenant has expired') { |
| 133 | - createMessage.error('token已过期,退回登录'); | |
| 134 | - // router.push(PageEnum.BASE_LOGIN); | |
| 135 | - router.beforeEach((to, from, next) => { | |
| 136 | - if (getJwtTokenInfo) { | |
| 137 | - if (to.path === '/login' || to.path !== '/login') { | |
| 138 | - // doRefresh(); | |
| 139 | - next({ path: '/' }); | |
| 140 | - } | |
| 168 | + if (expireTime < nowTime) { | |
| 169 | + // console.log('过期'); | |
| 170 | + createMessage.error('token已经过期,请退回登录'); | |
| 171 | + } else { | |
| 172 | + // console.log('未过期'); | |
| 173 | + } | |
| 174 | + if (getJwtTokenInfo) { | |
| 175 | + if (PageEnum.BASE_LOGIN) { | |
| 176 | + router.push(PageEnum.BASE_LOGIN); | |
| 141 | 177 | } |
| 142 | - }); | |
| 178 | + } | |
| 179 | + // router.beforeEach((to, from, next) => { | |
| 180 | + // if (getJwtTokenInfo) { | |
| 181 | + // if (to.path !== '/login') { | |
| 182 | + // // doRefresh(); | |
| 183 | + // next({ path: '/' }); | |
| 184 | + // } | |
| 185 | + // } | |
| 186 | + // }); | |
| 143 | 187 | } else { |
| 144 | 188 | // doRefresh(); |
| 145 | 189 | } | ... | ... |
| ... | ... | @@ -78,12 +78,12 @@ |
| 78 | 78 | step3ViewHighSetting, |
| 79 | 79 | step3CreateAlarm, |
| 80 | 80 | alertContactsSchemas, |
| 81 | - echoFormSchema, | |
| 82 | 81 | } from './step/data'; |
| 83 | 82 | |
| 84 | 83 | import { formSchema as conditionFormSchema } from './step/cpns/alarmruleconditions/config'; |
| 85 | 84 | import { formSchema as enableSchema } from './step/cpns/enablerule/config'; |
| 86 | 85 | import { formSchema as detailSchema } from './step/cpns/detailtemplate/config'; |
| 86 | + import { formSchema as echoFormSchema } from './step/cpns/alarmruleconditions/cpns/config'; | |
| 87 | 87 | |
| 88 | 88 | export default defineComponent({ |
| 89 | 89 | name: 'ConfigDrawer', |
| ... | ... | @@ -162,86 +162,73 @@ |
| 162 | 162 | descInfo.value = await deviceConfigGetDetail(data.record.id); |
| 163 | 163 | try { |
| 164 | 164 | await setRegisterDetail({ ...descInfo.value }); |
| 165 | - // await setRegisterTrans({ | |
| 166 | - // transportType: descInfo.value.profileData.transportConfiguration.type, | |
| 167 | - // }); | |
| 168 | - // await setRegisterStep3Schemas({ | |
| 169 | - // alarmType: descInfo.value.profileData.alarms[0].alarmType, | |
| 170 | - // }); | |
| 171 | - // await setRegisterStep3HighSetting({ | |
| 172 | - // propagate: descInfo.value.profileData.alarms[0].propagate, | |
| 173 | - // propagateRelationTypes: descInfo.value.profileData.alarms[0].propagateRelationTypes[0], | |
| 174 | - // }); | |
| 175 | - // await setRegisterStep3CreateAlarm({ ...descInfo.value }); | |
| 176 | - // await setRegisterStep3RuleAlarm({ ...descInfo.value }); | |
| 177 | - // await setRegisterContact({ ...descInfo.value }); | |
| 178 | - // await setRegisterStep3Condition({ ...descInfo.value }); | |
| 179 | - // await setRegisterStep3Enable({ ...descInfo.value }); | |
| 180 | - // await setRegisterStep3TemplateDetail({ ...descInfo.value }); | |
| 181 | 165 | } catch (e) { |
| 182 | 166 | return e; |
| 183 | 167 | } |
| 184 | 168 | }); |
| 185 | 169 | const handleChange = (v) => { |
| 186 | - switch (v) { | |
| 187 | - case '1': | |
| 188 | - setRegisterDetail({ ...descInfo.value }); | |
| 189 | - break; | |
| 190 | - case '2': | |
| 191 | - setRegisterTrans({ | |
| 192 | - transportType: descInfo.value.profileData?.transportConfiguration.type, | |
| 193 | - }); | |
| 194 | - break; | |
| 195 | - case '3': | |
| 196 | - setRegisterStep3Schemas({ | |
| 197 | - alarmType: descInfo.value.profileData?.alarms[0].alarmType, | |
| 198 | - }); | |
| 199 | - setRegisterStep3HighSetting({ | |
| 200 | - propagate: descInfo.value.profileData?.alarms[0].propagate, | |
| 201 | - propagateRelationTypes: descInfo.value.profileData?.alarms[0].propagateRelationTypes, | |
| 202 | - }); | |
| 203 | - const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules); | |
| 204 | - console.log(descInfo.value.profileData?.alarms[0].createRules[getKey[0]]); | |
| 205 | - // console.log(descInfo.value.profileData.alarms[0].createRules.MAJOR); | |
| 206 | - // console.log(descInfo.value.profileData.alarms[0].createRules['MAJOR']); | |
| 207 | - setRegisterStep3CreateAlarm({ | |
| 208 | - WARNING: descInfo.value.profileData?.alarms[0].createRules[getKey[0]], | |
| 209 | - }); | |
| 210 | - setRegisterStep3RuleAlarm({ | |
| 211 | - type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 212 | - .condition[0].key.type, | |
| 213 | - key: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 214 | - .condition[0].key.key, | |
| 215 | - valueType: | |
| 216 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0] | |
| 217 | - .valueType, | |
| 218 | - value: | |
| 219 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0] | |
| 220 | - .value, | |
| 221 | - predicate: | |
| 222 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.condition[0] | |
| 223 | - .predicate, | |
| 224 | - }); | |
| 225 | - setRegisterStep3Condition({ | |
| 226 | - conditionType: | |
| 227 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec.type, | |
| 228 | - }); | |
| 229 | - setRegisterStep3Enable({ | |
| 230 | - schedule: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule, | |
| 231 | - }); | |
| 232 | - setRegisterStep3TemplateDetail({ | |
| 233 | - alarmDetails: | |
| 234 | - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | |
| 235 | - }); | |
| 236 | - break; | |
| 237 | - case '4': | |
| 238 | - setRegisterContact({ | |
| 239 | - alarmContactId: descInfo.value.alarmProfile.alarmContactId, | |
| 240 | - messageMode: descInfo.value.alarmProfile.messageMode, | |
| 241 | - }); | |
| 242 | - break; | |
| 170 | + try { | |
| 171 | + switch (v) { | |
| 172 | + case '1': | |
| 173 | + setRegisterDetail({ ...descInfo.value }); | |
| 174 | + break; | |
| 175 | + case '2': | |
| 176 | + setRegisterTrans({ | |
| 177 | + transportType: descInfo.value.profileData?.transportConfiguration.type, | |
| 178 | + }); | |
| 179 | + break; | |
| 180 | + case '3': | |
| 181 | + setRegisterStep3Schemas({ | |
| 182 | + alarmType: descInfo.value.profileData?.alarms[0].alarmType, | |
| 183 | + }); | |
| 184 | + setRegisterStep3HighSetting({ | |
| 185 | + propagate: descInfo.value.profileData?.alarms[0].propagate, | |
| 186 | + propagateRelationTypes: | |
| 187 | + descInfo.value.profileData?.alarms[0].propagateRelationTypes, | |
| 188 | + }); | |
| 189 | + const getKey = Object.keys(descInfo.value.profileData?.alarms[0].createRules); | |
| 190 | + setRegisterStep3CreateAlarm({ | |
| 191 | + default: getKey[0], | |
| 192 | + }); | |
| 193 | + setRegisterStep3RuleAlarm({ | |
| 194 | + type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 195 | + .condition[0].key.type, | |
| 196 | + key: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 197 | + .condition[0].key.key, | |
| 198 | + valueType: | |
| 199 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 200 | + .condition[0].valueType, | |
| 201 | + value: | |
| 202 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 203 | + .condition[0].value, | |
| 204 | + operation: | |
| 205 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition | |
| 206 | + .condition[0].predicate.operation, | |
| 207 | + }); | |
| 208 | + setRegisterStep3Condition({ | |
| 209 | + conditionType: | |
| 210 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec.type, | |
| 211 | + }); | |
| 212 | + setRegisterStep3Enable({ | |
| 213 | + schedule: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule, | |
| 214 | + }); | |
| 215 | + setRegisterStep3TemplateDetail({ | |
| 216 | + alarmDetails: | |
| 217 | + descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails, | |
| 218 | + }); | |
| 219 | + break; | |
| 220 | + case '4': | |
| 221 | + setRegisterContact({ | |
| 222 | + alarmContactId: descInfo.value.alarmProfile.alarmContactId, | |
| 223 | + messageMode: descInfo.value.alarmProfile.messageMode, | |
| 224 | + }); | |
| 225 | + break; | |
| 226 | + } | |
| 227 | + } catch (e) { | |
| 228 | + return e; | |
| 243 | 229 | } |
| 244 | 230 | }; |
| 231 | + | |
| 245 | 232 | watch( |
| 246 | 233 | () => activeKey.value, |
| 247 | 234 | (v) => { | ... | ... |
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | <template v-for="(item, index) in profileData" :key="item.id"> |
| 4 | 4 | <CollapseContainer class="border mb-1" :canExpan="false"> |
| 5 | 5 | <template #action> |
| 6 | - <div @click="deleteAlarmRule(index)" class="cursor-pointer"> | |
| 6 | + <div class="cursor-pointer"> | |
| 7 | 7 | <img |
| 8 | 8 | style="cursor: pointer" |
| 9 | 9 | @click="deleteAlarmRule(index)" |
| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | <div style="height: 20px"></div> |
| 79 | 79 | <p>清除报警规则</p> |
| 80 | 80 | <template |
| 81 | - v-for="(childClearItem, createIndex) in item.alarms[0].clearRule" | |
| 81 | + v-for="(childClearItem, clearIndexItem) in item.alarms[clearIndex].clearRule" | |
| 82 | 82 | :key="childClearItem.id" |
| 83 | 83 | > |
| 84 | 84 | <div class="aic mb-1" style="border: 1px solid #bfbfbf"> |
| ... | ... | @@ -222,12 +222,13 @@ |
| 222 | 222 | const ruleClearTemplateData: any = ref(null); |
| 223 | 223 | const enableClearTemplateData: any = ref(null); |
| 224 | 224 | const detailClearTemplateData: any = ref(null); |
| 225 | + const clearIndex = ref(-1); | |
| 225 | 226 | //告警列表 |
| 226 | 227 | let profileData = ref<IProfileData[]>([]); |
| 227 | 228 | const log = (e) => { |
| 228 | 229 | console.log(e); |
| 229 | 230 | }; |
| 230 | - // 添加和删除告警配置 | |
| 231 | + //删除告警配置 | |
| 231 | 232 | const deleteAlarmRule = (index: number) => { |
| 232 | 233 | unref(profileData).splice(index, 1); |
| 233 | 234 | }; |
| ... | ... | @@ -235,8 +236,9 @@ |
| 235 | 236 | const prevStep = () => { |
| 236 | 237 | emit('prev'); |
| 237 | 238 | }; |
| 238 | - | |
| 239 | + //添加报警规则 | |
| 239 | 240 | const addAlarmRule = () => { |
| 241 | + clearIndex.value++; | |
| 240 | 242 | unref(profileData).push({ |
| 241 | 243 | configuration: { |
| 242 | 244 | type: '', |
| ... | ... | @@ -319,6 +321,7 @@ |
| 319 | 321 | setFieldsValue: setRegisterFormCreateAlarm, |
| 320 | 322 | resetFields: resetRegisterFormCreateAlarm, |
| 321 | 323 | validate: validateRegisterFormCreateAlarm, |
| 324 | + updateSchema, | |
| 322 | 325 | }, |
| 323 | 326 | ] = useForm({ |
| 324 | 327 | labelWidth: 120, |
| ... | ... | @@ -349,8 +352,55 @@ |
| 349 | 352 | const retryRegisterFormCreateAlarmFunc = (v) => { |
| 350 | 353 | setRegisterFormCreateAlarm(v); |
| 351 | 354 | }; |
| 355 | + const tempValue1: string = ref<string>(''); | |
| 352 | 356 | // 添加‘创建条件’ |
| 353 | 357 | const addCreateRole = (index: number) => { |
| 358 | + updateSchema({ | |
| 359 | + field: 'default', | |
| 360 | + componentProps: ({ formModel }) => { | |
| 361 | + if (formModel.default == 'CRITICAL') { | |
| 362 | + tempValue1.value = formModel.default; | |
| 363 | + } else if (formModel.default == 'MAJOR') { | |
| 364 | + tempValue1.value = formModel.default; | |
| 365 | + } else if (formModel.default == 'MINOR') { | |
| 366 | + tempValue1.value = formModel.default; | |
| 367 | + } else if (formModel.default == 'WARNING') { | |
| 368 | + tempValue1.value = formModel.default; | |
| 369 | + } else if (formModel.default == 'INDETERMINATE') { | |
| 370 | + tempValue1.value = formModel.default; | |
| 371 | + } | |
| 372 | + return { | |
| 373 | + options: [ | |
| 374 | + { | |
| 375 | + value: 'CRITICAL', | |
| 376 | + label: '危险', | |
| 377 | + disabled: tempValue1.value == 'CRITICAL', | |
| 378 | + }, | |
| 379 | + { | |
| 380 | + value: 'MAJOR', | |
| 381 | + label: '重要', | |
| 382 | + disabled: tempValue1.value == 'MAJOR', | |
| 383 | + }, | |
| 384 | + { | |
| 385 | + value: 'MINOR', | |
| 386 | + label: '次要', | |
| 387 | + disabled: tempValue1.value == 'MINOR', | |
| 388 | + }, | |
| 389 | + { | |
| 390 | + value: 'WARNING', | |
| 391 | + label: '警告', | |
| 392 | + disabled: tempValue1.value == 'WARNING', | |
| 393 | + }, | |
| 394 | + { | |
| 395 | + value: 'INDETERMINATE', | |
| 396 | + label: '不确定', | |
| 397 | + disabled: tempValue1.value == 'INDETERMINATE', | |
| 398 | + }, | |
| 399 | + ], | |
| 400 | + }; | |
| 401 | + }, | |
| 402 | + }); | |
| 403 | + | |
| 354 | 404 | unref(profileData)[index].alarms.push({ |
| 355 | 405 | id: Date.now() + Math.random() + '', |
| 356 | 406 | alarmType: '', |
| ... | ... | @@ -762,7 +812,9 @@ |
| 762 | 812 | proxy.$refs.getChildData3.resetDataFunc(); |
| 763 | 813 | }, 50); |
| 764 | 814 | }; |
| 815 | + | |
| 765 | 816 | return { |
| 817 | + clearIndex, | |
| 766 | 818 | retryRegisterFormFunc, |
| 767 | 819 | retryRegisterFormHighSettingmFunc, |
| 768 | 820 | retryRegisterFormCreateAlarmFunc, | ... | ... |
| ... | ... | @@ -153,73 +153,31 @@ export const step3CreateAlarm: FormSchema[] = [ |
| 153 | 153 | span: 16, |
| 154 | 154 | }, |
| 155 | 155 | componentProps({ formModel }) { |
| 156 | - const optionsFilter = [ | |
| 157 | - { | |
| 158 | - value: 'CRITICAL', | |
| 159 | - label: '危险', | |
| 160 | - // disabled: formModel.default == 'CRITICAL', | |
| 161 | - }, | |
| 162 | - { | |
| 163 | - value: 'MAJOR', | |
| 164 | - label: '重要', | |
| 165 | - // disabled: formModel.default == 'MAJOR', | |
| 166 | - }, | |
| 167 | - { | |
| 168 | - value: 'MINOR', | |
| 169 | - label: '次要', | |
| 170 | - // disabled: formModel.default == 'MINOR', | |
| 171 | - }, | |
| 172 | - { | |
| 173 | - value: 'WARNING', | |
| 174 | - label: '警告', | |
| 175 | - // disabled: formModel.default == 'WARNING', | |
| 176 | - }, | |
| 177 | - { | |
| 178 | - value: 'INDETERMINATE', | |
| 179 | - label: '不确定', | |
| 180 | - // disabled: formModel.default == 'INDETERMINATE', | |
| 181 | - }, | |
| 182 | - ]; | |
| 183 | - const newOptions = optionsFilter.filter((f) => f.value != formModel.default); | |
| 184 | 156 | return { |
| 185 | 157 | placeholder: '请选择严重程度', |
| 186 | - options: newOptions.length == 0 ? optionsFilter : newOptions, | |
| 158 | + options: [ | |
| 159 | + { | |
| 160 | + value: 'CRITICAL', | |
| 161 | + label: '危险', | |
| 162 | + }, | |
| 163 | + { | |
| 164 | + value: 'MAJOR', | |
| 165 | + label: '重要', | |
| 166 | + }, | |
| 167 | + { | |
| 168 | + value: 'MINOR', | |
| 169 | + label: '次要', | |
| 170 | + }, | |
| 171 | + { | |
| 172 | + value: 'WARNING', | |
| 173 | + label: '警告', | |
| 174 | + }, | |
| 175 | + { | |
| 176 | + value: 'INDETERMINATE', | |
| 177 | + label: '不确定', | |
| 178 | + }, | |
| 179 | + ], | |
| 187 | 180 | onChange: (v) => { |
| 188 | - // const newFiletr = [ | |
| 189 | - // { | |
| 190 | - // value: 'CRITICAL', | |
| 191 | - // label: '危险', | |
| 192 | - // // disabled: formModel.default == 'CRITICAL', | |
| 193 | - // }, | |
| 194 | - // { | |
| 195 | - // value: 'MAJOR', | |
| 196 | - // label: '重要', | |
| 197 | - // // disabled: formModel.default == 'MAJOR', | |
| 198 | - // }, | |
| 199 | - // { | |
| 200 | - // value: 'MINOR', | |
| 201 | - // label: '次要', | |
| 202 | - // // disabled: formModel.default == 'MINOR', | |
| 203 | - // }, | |
| 204 | - // { | |
| 205 | - // value: 'WARNING', | |
| 206 | - // label: '警告', | |
| 207 | - // // disabled: formModel.default == 'WARNING', | |
| 208 | - // }, | |
| 209 | - // { | |
| 210 | - // value: 'INDETERMINATE', | |
| 211 | - // label: '不确定', | |
| 212 | - // // disabled: formModel.default == 'INDETERMINATE', | |
| 213 | - // }, | |
| 214 | - // ]; | |
| 215 | - // const { updateSchema } = formActionType; | |
| 216 | - // const newFileterFunc = newFiletr.filter((f) => f.value != v); | |
| 217 | - // updateSchema({ | |
| 218 | - // field: 'default', | |
| 219 | - // componentProps: { | |
| 220 | - // options: newFileterFunc, | |
| 221 | - // }, | |
| 222 | - // }); | |
| 223 | 181 | isWhereType.value = v ? v : 'INDETERMINATE'; |
| 224 | 182 | }, |
| 225 | 183 | }; |
| ... | ... | @@ -280,195 +238,3 @@ export const alertContactsSchemas: FormSchema[] = [ |
| 280 | 238 | }, |
| 281 | 239 | }, |
| 282 | 240 | ]; |
| 283 | - | |
| 284 | -/** | |
| 285 | - * 所使用的枚举值 | |
| 286 | - */ | |
| 287 | - | |
| 288 | -export enum TriggerEnum { | |
| 289 | - IS_DEVICE_ACT = '属性', | |
| 290 | - IS_TIME_ACT = 'TIME_SERIES', | |
| 291 | - IS_SCENE_ACT = '常量', | |
| 292 | - IS_STRING = 'STRING', | |
| 293 | - IS_NUMERIC = 'NUMERIC', | |
| 294 | - IS_BOOLEAN = 'BOOLEAN', | |
| 295 | - IS_COMPLEX = 'COMPLEX', | |
| 296 | -} | |
| 297 | - | |
| 298 | -export const isShiDu = (type: string) => { | |
| 299 | - return type === TriggerEnum.IS_DEVICE_ACT; | |
| 300 | -}; | |
| 301 | -export const isWenDu = (type: string) => { | |
| 302 | - return type === TriggerEnum.IS_TIME_ACT; | |
| 303 | -}; | |
| 304 | - | |
| 305 | -export const isTimeAll = (type: string) => { | |
| 306 | - return type === TriggerEnum.IS_SCENE_ACT; | |
| 307 | -}; | |
| 308 | - | |
| 309 | -export const isString = (type: string) => { | |
| 310 | - return type === TriggerEnum.IS_STRING; | |
| 311 | -}; | |
| 312 | - | |
| 313 | -export const isNumeric = (type: string) => { | |
| 314 | - return type === TriggerEnum.IS_NUMERIC; | |
| 315 | -}; | |
| 316 | - | |
| 317 | -export const isBoolean = (type: string) => { | |
| 318 | - return type === TriggerEnum.IS_BOOLEAN; | |
| 319 | -}; | |
| 320 | - | |
| 321 | -export const isComplex = (type: string) => { | |
| 322 | - return type === TriggerEnum.IS_COMPLEX; | |
| 323 | -}; | |
| 324 | - | |
| 325 | -export const echoFormSchema: FormSchema[] = [ | |
| 326 | - { | |
| 327 | - field: 'type', | |
| 328 | - label: '键类型', | |
| 329 | - colProps: { span: 24 }, | |
| 330 | - component: 'Select', | |
| 331 | - componentProps: { | |
| 332 | - placeholder: '请选择键类型', | |
| 333 | - options: [ | |
| 334 | - { label: '属性', value: '属性' }, | |
| 335 | - { label: 'Timeseries', value: 'TIME_SERIES' }, | |
| 336 | - { label: '常量', value: '常量' }, | |
| 337 | - ], | |
| 338 | - }, | |
| 339 | - }, | |
| 340 | - { | |
| 341 | - field: 'key', | |
| 342 | - label: '键名', | |
| 343 | - colProps: { span: 24 }, | |
| 344 | - component: 'Select', | |
| 345 | - componentProps: { | |
| 346 | - placeholder: '请选择键名', | |
| 347 | - options: [ | |
| 348 | - { label: 'active', value: 'active' }, | |
| 349 | - { label: 'inactivityAlarmTime', value: 'inactivityAlarmTime' }, | |
| 350 | - { label: 'lastActivityTime', value: 'lastActivityTime' }, | |
| 351 | - { label: 'lastConnectTime', value: 'lastConnectTime' }, | |
| 352 | - { label: 'lastDisconnectTime', value: 'lastDisconnectTime' }, | |
| 353 | - ], | |
| 354 | - }, | |
| 355 | - ifShow: ({ values }) => isShiDu(Reflect.get(values, 'type')), | |
| 356 | - }, | |
| 357 | - { | |
| 358 | - field: 'key', | |
| 359 | - label: '键名', | |
| 360 | - colProps: { span: 24 }, | |
| 361 | - component: 'Select', | |
| 362 | - componentProps: { | |
| 363 | - placeholder: '请选择键名', | |
| 364 | - options: [ | |
| 365 | - { label: 'CO2', value: 'CO2' }, | |
| 366 | - { label: 'temp', value: 'temp' }, | |
| 367 | - { label: 'wet', value: 'wet' }, | |
| 368 | - ], | |
| 369 | - }, | |
| 370 | - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')), | |
| 371 | - }, | |
| 372 | - { | |
| 373 | - field: 'key', | |
| 374 | - label: '键名', | |
| 375 | - colProps: { span: 24 }, | |
| 376 | - component: 'Input', | |
| 377 | - componentProps: { | |
| 378 | - placeholder: '请输入键名', | |
| 379 | - }, | |
| 380 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')), | |
| 381 | - }, | |
| 382 | - { | |
| 383 | - field: 'type1', | |
| 384 | - label: '值类型', | |
| 385 | - colProps: { span: 24 }, | |
| 386 | - component: 'Select', | |
| 387 | - componentProps: { | |
| 388 | - placeholder: '请选择值类型', | |
| 389 | - options: [ | |
| 390 | - { label: '字符串', value: 'STRING' }, | |
| 391 | - { label: '数字', value: 'NUMERIC' }, | |
| 392 | - { label: '布尔值', value: 'BOOLEAN' }, | |
| 393 | - { label: '日期时间', value: 'COMPLEX' }, | |
| 394 | - ], | |
| 395 | - }, | |
| 396 | - }, | |
| 397 | - { | |
| 398 | - field: 'operation', | |
| 399 | - label: '操作', | |
| 400 | - colProps: { span: 24 }, | |
| 401 | - component: 'Select', | |
| 402 | - componentProps: { | |
| 403 | - placeholder: '请选择操作', | |
| 404 | - options: [ | |
| 405 | - { label: '等于', value: 'EQUAL' }, | |
| 406 | - { label: '不等于', value: 'NOT_EQUAL' }, | |
| 407 | - { label: '开始于', value: 'STARTS_WITH' }, | |
| 408 | - { label: '结束于', value: 'ENDS_WITH' }, | |
| 409 | - { label: '包含', value: 'CONTAINS' }, | |
| 410 | - { label: '不包含', value: 'NOT_CONTAINS' }, | |
| 411 | - ], | |
| 412 | - }, | |
| 413 | - ifShow: ({ values }) => isString(Reflect.get(values, 'type1')), | |
| 414 | - }, | |
| 415 | - { | |
| 416 | - field: 'operation', | |
| 417 | - label: '操作', | |
| 418 | - colProps: { span: 24 }, | |
| 419 | - component: 'Select', | |
| 420 | - componentProps: { | |
| 421 | - placeholder: '请选择操作', | |
| 422 | - options: [ | |
| 423 | - { label: '等于', value: 'EQUAL' }, | |
| 424 | - { label: '不等于', value: 'NOT_EQUAL' }, | |
| 425 | - { label: '大于', value: 'GREATER' }, | |
| 426 | - { label: '小于', value: 'LESS' }, | |
| 427 | - { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | |
| 428 | - { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | |
| 429 | - ], | |
| 430 | - }, | |
| 431 | - ifShow: ({ values }) => isNumeric(Reflect.get(values, 'type1')), | |
| 432 | - }, | |
| 433 | - { | |
| 434 | - field: 'operation', | |
| 435 | - label: '操作', | |
| 436 | - colProps: { span: 24 }, | |
| 437 | - component: 'Select', | |
| 438 | - componentProps: { | |
| 439 | - placeholder: '请选择操作', | |
| 440 | - options: [ | |
| 441 | - { label: '等于', value: 'EQUAL' }, | |
| 442 | - { label: '不等于', value: 'NOT_EQUAL' }, | |
| 443 | - ], | |
| 444 | - }, | |
| 445 | - ifShow: ({ values }) => isBoolean(Reflect.get(values, 'type1')), | |
| 446 | - }, | |
| 447 | - { | |
| 448 | - field: 'operation', | |
| 449 | - label: '操作', | |
| 450 | - colProps: { span: 24 }, | |
| 451 | - component: 'Select', | |
| 452 | - componentProps: { | |
| 453 | - placeholder: '请选择操作', | |
| 454 | - options: [ | |
| 455 | - { label: '等于', value: 'EQUAL' }, | |
| 456 | - { label: '不等于', value: 'NOT_EQUAL' }, | |
| 457 | - { label: '大于', value: 'GREATER' }, | |
| 458 | - { label: '小于', value: 'LESS' }, | |
| 459 | - { label: '大于或等于', value: 'GREATER_OR_EQUAL' }, | |
| 460 | - { label: '小于或等于', value: 'LESS_OR_EQUAL' }, | |
| 461 | - ], | |
| 462 | - }, | |
| 463 | - ifShow: ({ values }) => isComplex(Reflect.get(values, 'type1')), | |
| 464 | - }, | |
| 465 | - { | |
| 466 | - field: 'value1', | |
| 467 | - label: '默认值', | |
| 468 | - colProps: { span: 24 }, | |
| 469 | - component: 'Input', | |
| 470 | - componentProps: { | |
| 471 | - placeholder: '请输入默认值(数字)', | |
| 472 | - }, | |
| 473 | - }, | |
| 474 | -]; | ... | ... |
| ... | ... | @@ -133,7 +133,7 @@ |
| 133 | 133 | title: t('sys.api.loginFailed'), |
| 134 | 134 | content: |
| 135 | 135 | error.response && error.response.status == 401 |
| 136 | - ? t('sys.api.passwordOrUserNameError') | |
| 136 | + ? error.response.data.message | |
| 137 | 137 | : error.code == 'ECONNABORTED' |
| 138 | 138 | ? t('sys.api.timeoutMessage') |
| 139 | 139 | : t('sys.api.apiRequestFailed'), | ... | ... |