Showing
10 changed files
with
266 additions
and
192 deletions
src/api/personal/index.ts
0 → 100644
| 1 | +import { UploadApiResult } from './model/uploadModel'; | ||
| 2 | +import { IPutPersonal } from './model/index'; | ||
| 3 | +import { defHttp } from '/@/utils/http/axios'; | ||
| 4 | +import { UploadFileParams } from '/#/axios'; | ||
| 5 | + | ||
| 6 | +enum API { | ||
| 7 | + BaseUploadUrl = '/api/yt/oss/upload', | ||
| 8 | + PutPersonalUrl = '/user', | ||
| 9 | + GetPersonalUrl = '/user/', | ||
| 10 | +} | ||
| 11 | +/** | ||
| 12 | + * @description: Upload interface | ||
| 13 | + */ | ||
| 14 | +export const uploadApi = ( | ||
| 15 | + params: UploadFileParams, | ||
| 16 | + onUploadProgress: (progressEvent: ProgressEvent) => void | ||
| 17 | +) => { | ||
| 18 | + return defHttp.uploadFile<UploadApiResult>( | ||
| 19 | + { | ||
| 20 | + url: API.BaseUploadUrl, | ||
| 21 | + onUploadProgress, | ||
| 22 | + }, | ||
| 23 | + params | ||
| 24 | + ); | ||
| 25 | +}; | ||
| 26 | + | ||
| 27 | +export const personalGet = (id: string) => { | ||
| 28 | + return defHttp.get({ | ||
| 29 | + url: `${API.GetPersonalUrl}${id}`, | ||
| 30 | + }); | ||
| 31 | +}; | ||
| 32 | + | ||
| 33 | +export const personalPut = (params: IPutPersonal) => { | ||
| 34 | + return defHttp.post<IPutPersonal>({ | ||
| 35 | + url: API.PutPersonalUrl, | ||
| 36 | + params, | ||
| 37 | + }); | ||
| 38 | +}; |
src/api/personal/model/index.ts
0 → 100644
| 1 | +export interface FileUploadResponse { | ||
| 2 | + fileName: string; | ||
| 3 | + fileDownloadUri: string; | ||
| 4 | + fileType: string; | ||
| 5 | + size: number; | ||
| 6 | + fileStaticUri: string; | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +export interface IPutPersonal { | ||
| 10 | + accountExpireTime?: string; | ||
| 11 | + activateToken?: string; | ||
| 12 | + avatar?: string; | ||
| 13 | + createTime?: string; | ||
| 14 | + creator?: string; | ||
| 15 | + deptId?: string; | ||
| 16 | + email?: string; | ||
| 17 | + enabled?: true; | ||
| 18 | + hasPassword?: true; | ||
| 19 | + id?: string; | ||
| 20 | + level?: 0; | ||
| 21 | + organizationIds?: [string]; | ||
| 22 | + password?: string; | ||
| 23 | + phoneNumber?: string; | ||
| 24 | + realName?: string; | ||
| 25 | + roleIds?: [string]; | ||
| 26 | + roles?: [ | ||
| 27 | + { | ||
| 28 | + roleId: string; | ||
| 29 | + roleName: string; | ||
| 30 | + } | ||
| 31 | + ]; | ||
| 32 | + tenantId?: string; | ||
| 33 | + tenantName?: string; | ||
| 34 | + updateTime?: string; | ||
| 35 | + updater?: string; | ||
| 36 | + userStatusEnum?: string; | ||
| 37 | + username?: string; | ||
| 38 | +} |
src/api/personal/model/uploadModel.ts
0 → 100644
| @@ -2,9 +2,9 @@ import { FormSchema } from '/@/components/Table'; | @@ -2,9 +2,9 @@ import { FormSchema } from '/@/components/Table'; | ||
| 2 | 2 | ||
| 3 | export const formSchema: FormSchema[] = [ | 3 | export const formSchema: FormSchema[] = [ |
| 4 | { | 4 | { |
| 5 | - field: 'name', | 5 | + field: 'creator', |
| 6 | label: '用户昵称', | 6 | label: '用户昵称', |
| 7 | - colProps: { span: 24 }, | 7 | + colProps: { span: 13 }, |
| 8 | required: true, | 8 | required: true, |
| 9 | component: 'Input', | 9 | component: 'Input', |
| 10 | componentProps: { | 10 | componentProps: { |
| @@ -12,9 +12,9 @@ export const formSchema: FormSchema[] = [ | @@ -12,9 +12,9 @@ export const formSchema: FormSchema[] = [ | ||
| 12 | }, | 12 | }, |
| 13 | }, | 13 | }, |
| 14 | { | 14 | { |
| 15 | - field: 'phone', | 15 | + field: 'phoneNumber', |
| 16 | label: '手机号码', | 16 | label: '手机号码', |
| 17 | - colProps: { span: 24 }, | 17 | + colProps: { span: 13 }, |
| 18 | required: true, | 18 | required: true, |
| 19 | component: 'Input', | 19 | component: 'Input', |
| 20 | componentProps: { | 20 | componentProps: { |
| @@ -24,7 +24,7 @@ export const formSchema: FormSchema[] = [ | @@ -24,7 +24,7 @@ export const formSchema: FormSchema[] = [ | ||
| 24 | { | 24 | { |
| 25 | field: 'email', | 25 | field: 'email', |
| 26 | label: '邮箱', | 26 | label: '邮箱', |
| 27 | - colProps: { span: 24 }, | 27 | + colProps: { span: 13 }, |
| 28 | required: true, | 28 | required: true, |
| 29 | component: 'Input', | 29 | component: 'Input', |
| 30 | componentProps: { | 30 | componentProps: { |
| @@ -32,21 +32,21 @@ export const formSchema: FormSchema[] = [ | @@ -32,21 +32,21 @@ export const formSchema: FormSchema[] = [ | ||
| 32 | }, | 32 | }, |
| 33 | }, | 33 | }, |
| 34 | { | 34 | { |
| 35 | - field: 'sex', | 35 | + field: 'enabled', |
| 36 | component: 'RadioGroup', | 36 | component: 'RadioGroup', |
| 37 | label: '性别', | 37 | label: '性别', |
| 38 | colProps: { | 38 | colProps: { |
| 39 | - span: 24, | 39 | + span: 13, |
| 40 | }, | 40 | }, |
| 41 | componentProps: { | 41 | componentProps: { |
| 42 | options: [ | 42 | options: [ |
| 43 | { | 43 | { |
| 44 | label: '男', | 44 | label: '男', |
| 45 | - value: 'male', | 45 | + value: 'true', |
| 46 | }, | 46 | }, |
| 47 | { | 47 | { |
| 48 | label: '女', | 48 | label: '女', |
| 49 | - value: 'female', | 49 | + value: 'false', |
| 50 | }, | 50 | }, |
| 51 | ], | 51 | ], |
| 52 | }, | 52 | }, |
| 1 | <template> | 1 | <template> |
| 2 | <BasicModal | 2 | <BasicModal |
| 3 | :useWrapper="true" | 3 | :useWrapper="true" |
| 4 | - width="65rem" | 4 | + width="80vw" |
| 5 | + :height="compHeight" | ||
| 5 | v-bind="$attrs" | 6 | v-bind="$attrs" |
| 6 | @register="registerModal" | 7 | @register="registerModal" |
| 7 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
| 8 | > | 9 | > |
| 9 | <div | 10 | <div |
| 10 | style=" | 11 | style=" |
| 11 | - margin-top: -20px; | ||
| 12 | - width: 100vw; | ||
| 13 | - height: 50vh; | 12 | + height: 62vh; |
| 13 | + width: 120vw; | ||
| 14 | display: flex; | 14 | display: flex; |
| 15 | flex-direction: row; | 15 | flex-direction: row; |
| 16 | align-items: center; | 16 | align-items: center; |
| 17 | justify-content: space-between; | 17 | justify-content: space-between; |
| 18 | " | 18 | " |
| 19 | > | 19 | > |
| 20 | - <div style="width: 30vw; height: 20vh"> | ||
| 21 | - <p>个人信息</p> | ||
| 22 | - <div class="change-avatar"> | 20 | + <div style="width: 29vw; height: 62vh; border: 1px solid #e9edf6; box-shadow: 0 0 5px -5px"> |
| 21 | + <div style="width: 29vw; height: 4vh; border: 1px solid #e9edf6" | ||
| 22 | + ><p style="font-size: 17px; margin-top: 7px; margin-left: 10px">个人信息</p></div | ||
| 23 | + > | ||
| 24 | + <div class="change-avatar" style="text-align: center"> | ||
| 23 | <div class="mb-2">头像</div> | 25 | <div class="mb-2">头像</div> |
| 24 | <CropperAvatar | 26 | <CropperAvatar |
| 27 | + :uploadApi="uploadApi" | ||
| 25 | :value="avatar" | 28 | :value="avatar" |
| 26 | btnText="更换头像" | 29 | btnText="更换头像" |
| 27 | :btnProps="{ preIcon: 'ant-design:cloud-upload-outlined' }" | 30 | :btnProps="{ preIcon: 'ant-design:cloud-upload-outlined' }" |
| @@ -30,75 +33,80 @@ | @@ -30,75 +33,80 @@ | ||
| 30 | /> | 33 | /> |
| 31 | </div> | 34 | </div> |
| 32 | <Description | 35 | <Description |
| 33 | - class="mt-4" | ||
| 34 | - layout="vertical" | ||
| 35 | - :collapseOptions="{ canExpand: true, helpMessage: 'help me' }" | ||
| 36 | - :column="2" | 36 | + class="mt-8" |
| 37 | + :column="1" | ||
| 37 | :schema="schema" | 38 | :schema="schema" |
| 38 | - :data="descData" | 39 | + :bordered="true" |
| 40 | + :data="getPersonalDetailValue" | ||
| 39 | @register="registerDesc" | 41 | @register="registerDesc" |
| 40 | /> | 42 | /> |
| 41 | </div> | 43 | </div> |
| 42 | - <div style="width: 70vw; height: 20vh"> | ||
| 43 | - <p>基本资料</p> | ||
| 44 | - <BasicForm @register="registerForm" /> | 44 | + <div |
| 45 | + style=" | ||
| 46 | + width: 90vw; | ||
| 47 | + height: 60vh; | ||
| 48 | + border: 1px solid #e9edf6; | ||
| 49 | + margin-top: -15px; | ||
| 50 | + box-shadow: 0 0 5px -5px; | ||
| 51 | + " | ||
| 52 | + > | ||
| 53 | + <div style="width: 90vw; height: 4vh; border: 1px solid #e9edf6" | ||
| 54 | + ><p style="font-size: 17px; margin-top: 7px; margin-left: 20px">基本资料</p></div | ||
| 55 | + > | ||
| 56 | + <div style="margin-left: 20px"> | ||
| 57 | + <BasicForm @register="registerForm" /> | ||
| 58 | + </div> | ||
| 45 | </div> | 59 | </div> |
| 46 | </div> | 60 | </div> |
| 47 | </BasicModal> | 61 | </BasicModal> |
| 48 | </template> | 62 | </template> |
| 49 | <script lang="ts"> | 63 | <script lang="ts"> |
| 50 | - import { defineComponent, ref, computed } from 'vue'; | 64 | + import { defineComponent, ref, computed, onMounted } from 'vue'; |
| 51 | import { BasicModal, useModalInner } from '/@/components/Modal/index'; | 65 | import { BasicModal, useModalInner } from '/@/components/Modal/index'; |
| 52 | import { BasicForm, useForm } from '/@/components/Form/index'; | 66 | import { BasicForm, useForm } from '/@/components/Form/index'; |
| 53 | import { formSchema } from './config'; | 67 | import { formSchema } from './config'; |
| 54 | import { Description, DescItem, useDescription } from '/@/components/Description/index'; | 68 | import { Description, DescItem, useDescription } from '/@/components/Description/index'; |
| 55 | import { CropperAvatar } from '/@/components/Cropper'; | 69 | import { CropperAvatar } from '/@/components/Cropper'; |
| 56 | import defaultImage from '/@/assets/images/logo.png'; | 70 | import defaultImage from '/@/assets/images/logo.png'; |
| 71 | + import { uploadApi, personalPut, personalGet } from '/@/api/personal/index'; | ||
| 72 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 73 | + import { USER_INFO_KEY } from '/@/enums/cacheEnum'; | ||
| 74 | + import { getAuthCache } from '/@/utils/auth'; | ||
| 57 | 75 | ||
| 58 | const schema: DescItem[] = [ | 76 | const schema: DescItem[] = [ |
| 59 | { | 77 | { |
| 60 | - field: 'name', | ||
| 61 | - label: '用户名称', | 78 | + field: 'creator', |
| 79 | + label: '用户名称:', | ||
| 62 | }, | 80 | }, |
| 63 | { | 81 | { |
| 64 | - field: 'phone', | ||
| 65 | - label: '手机号码', | ||
| 66 | - render: (curVal, data) => { | ||
| 67 | - return `${data.username}-${curVal}`; | ||
| 68 | - }, | 82 | + field: 'phoneNumber', |
| 83 | + label: '手机号码:', | ||
| 69 | }, | 84 | }, |
| 70 | { | 85 | { |
| 71 | field: 'email', | 86 | field: 'email', |
| 72 | - label: '用户邮箱', | 87 | + label: '用户邮箱:', |
| 73 | }, | 88 | }, |
| 74 | { | 89 | { |
| 75 | - field: 'name1', | ||
| 76 | - label: '用户昵称', | 90 | + field: 'realName', |
| 91 | + label: '用户昵称:', | ||
| 77 | }, | 92 | }, |
| 78 | { | 93 | { |
| 79 | - field: 'timeout', | ||
| 80 | - label: '过期时间', | 94 | + field: 'createTime', |
| 95 | + label: '过期时间:', | ||
| 81 | }, | 96 | }, |
| 82 | { | 97 | { |
| 83 | field: 'createTime', | 98 | field: 'createTime', |
| 84 | - label: '创建时间', | 99 | + label: '创建时间:', |
| 85 | }, | 100 | }, |
| 86 | ]; | 101 | ]; |
| 87 | - | ||
| 88 | - const descData = { | ||
| 89 | - name: '测试', | ||
| 90 | - phone: 'xxxx', | ||
| 91 | - email: 'dddddd', | ||
| 92 | - name1: 'ddd', | ||
| 93 | - timeout: '2021-90=90', | ||
| 94 | - createTime: '2021-90=90', | ||
| 95 | - }; | ||
| 96 | - | ||
| 97 | export default defineComponent({ | 102 | export default defineComponent({ |
| 98 | name: 'index', | 103 | name: 'index', |
| 99 | components: { BasicModal, BasicForm, Description, CropperAvatar }, | 104 | components: { BasicModal, BasicForm, Description, CropperAvatar }, |
| 100 | setup() { | 105 | setup() { |
| 106 | + const userInfo = getAuthCache(USER_INFO_KEY); | ||
| 107 | + const { createMessage } = useMessage(); | ||
| 101 | const getPersonalValue: any = ref({}); | 108 | const getPersonalValue: any = ref({}); |
| 109 | + const getPersonalDetailValue: any = ref({}); | ||
| 102 | const [registerDesc] = useDescription({ | 110 | const [registerDesc] = useDescription({ |
| 103 | title: '个人详情', | 111 | title: '个人详情', |
| 104 | schema: schema, | 112 | schema: schema, |
| @@ -110,26 +118,40 @@ | @@ -110,26 +118,40 @@ | ||
| 110 | schemas: formSchema, | 118 | schemas: formSchema, |
| 111 | }); | 119 | }); |
| 112 | const avatar = computed(() => { | 120 | const avatar = computed(() => { |
| 113 | - // :uploadApi="uploadApi" | ||
| 114 | - // const { avatar } = userStore.getUserInfo; | ||
| 115 | return defaultImage; | 121 | return defaultImage; |
| 116 | }); | 122 | }); |
| 117 | const handleSubmit = async () => { | 123 | const handleSubmit = async () => { |
| 118 | getPersonalValue.value = await validate(); | 124 | getPersonalValue.value = await validate(); |
| 119 | - console.log(getPersonalValue.value); | ||
| 120 | - //TODO 后端接口 | 125 | + await personalPut(getPersonalValue.value); |
| 126 | + createMessage.success('修改成功'); | ||
| 121 | }; | 127 | }; |
| 122 | - const updateAvatar = (src: string) => { | ||
| 123 | - console.log('src' + src); | ||
| 124 | - // const userinfo = userStore.getUserInfo; | ||
| 125 | - // userinfo.avatar = src; | ||
| 126 | - // userStore.setUserInfo(userinfo); | 128 | + const updateAvatar = async (v) => { |
| 129 | + console.log('v' + v); | ||
| 130 | + await personalPut({ avatar: v }); | ||
| 127 | }; | 131 | }; |
| 132 | + const getPersonalDetail = async () => { | ||
| 133 | + try { | ||
| 134 | + const getUserInfo = await userInfo; | ||
| 135 | + const getBackendData = await personalGet(getUserInfo.userId); | ||
| 136 | + getPersonalDetailValue.value = getBackendData; | ||
| 137 | + console.log(getPersonalDetailValue.value); | ||
| 138 | + } catch (e) { | ||
| 139 | + return e; | ||
| 140 | + } | ||
| 141 | + }; | ||
| 142 | + onMounted(() => { | ||
| 143 | + getPersonalDetail(); | ||
| 144 | + }); | ||
| 145 | + const compHeight = computed(() => { | ||
| 146 | + return 1000; | ||
| 147 | + }); | ||
| 128 | return { | 148 | return { |
| 149 | + uploadApi, | ||
| 150 | + compHeight, | ||
| 129 | updateAvatar, | 151 | updateAvatar, |
| 130 | avatar, | 152 | avatar, |
| 131 | handleSubmit, | 153 | handleSubmit, |
| 132 | - descData, | 154 | + getPersonalDetailValue, |
| 133 | registerDesc, | 155 | registerDesc, |
| 134 | schema, | 156 | schema, |
| 135 | registerModal, | 157 | registerModal, |
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | <MenuItem | 32 | <MenuItem |
| 33 | key="personal" | 33 | key="personal" |
| 34 | :text="t('layout.header.dropdownItemPersonal')" | 34 | :text="t('layout.header.dropdownItemPersonal')" |
| 35 | - icon="ion:power-outline" | 35 | + icon="ion:build-outlined" |
| 36 | /> | 36 | /> |
| 37 | </Menu> | 37 | </Menu> |
| 38 | </template> | 38 | </template> |
| @@ -121,7 +121,9 @@ | @@ -121,7 +121,9 @@ | ||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | const openPersonalFunc = () => { | 123 | const openPersonalFunc = () => { |
| 124 | - openModalPersonal(true); | 124 | + setTimeout(() => { |
| 125 | + openModalPersonal(true); | ||
| 126 | + }, 10); | ||
| 125 | }; | 127 | }; |
| 126 | 128 | ||
| 127 | return { | 129 | return { |
src/views/device/profile/step/1.json
deleted
100644 → 0
| 1 | -{ | ||
| 2 | - "name": "测试abcd", | ||
| 3 | - "defaultRuleChainId": "354c7210-5d97-11ec-8ac9-f38ed935ea2a", | ||
| 4 | - "defaultQueueName": "HighPriority", | ||
| 5 | - "description": "测试abcd", | ||
| 6 | - "transportType": "DEFAULT", | ||
| 7 | - "profileData": { | ||
| 8 | - "alarms": [ | ||
| 9 | - { | ||
| 10 | - "alarmType": "测试abcd", | ||
| 11 | - "propagate": true, | ||
| 12 | - "propagateRelationTypes": [ | ||
| 13 | - "测试abcd" | ||
| 14 | - ], | ||
| 15 | - "createRules": { | ||
| 16 | - "MAJOR": { | ||
| 17 | - "alarmDetails": "测试abcd", | ||
| 18 | - "schedule": { | ||
| 19 | - "type": "ANY_TIME" | ||
| 20 | - }, | ||
| 21 | - "condition": { | ||
| 22 | - "condition": [ | ||
| 23 | - { | ||
| 24 | - "key": { | ||
| 25 | - "type": "TIME_SERIES", | ||
| 26 | - "key": "temp" | ||
| 27 | - }, | ||
| 28 | - "valueType": "NUMERIC", | ||
| 29 | - "predicate": { | ||
| 30 | - "operation": "EQUAL", | ||
| 31 | - "value": { | ||
| 32 | - "defaultValue": 1 | ||
| 33 | - }, | ||
| 34 | - "type": "NUMERIC" | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | - ], | ||
| 38 | - "spec": { | ||
| 39 | - "type": "SIMPLE" | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - }, | ||
| 44 | - "clearRule": { | ||
| 45 | - "alarmDetails": "测", | ||
| 46 | - "schedule": { | ||
| 47 | - "type": "ANY_TIME" | ||
| 48 | - }, | ||
| 49 | - "condition": { | ||
| 50 | - "condition": [ | ||
| 51 | - { | ||
| 52 | - "key": { | ||
| 53 | - "type": "TIME_SERIES", | ||
| 54 | - "key": "CO2" | ||
| 55 | - }, | ||
| 56 | - "valueType": "NUMERIC", | ||
| 57 | - "predicate": { | ||
| 58 | - "operation": "NOT_EQUAL", | ||
| 59 | - "value": { | ||
| 60 | - "defaultValue": 2 | ||
| 61 | - }, | ||
| 62 | - "type": "NUMERIC" | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - ], | ||
| 66 | - "spec": { | ||
| 67 | - "type": "SIMPLE" | ||
| 68 | - } | ||
| 69 | - } | ||
| 70 | - }, | ||
| 71 | - "id": "4e299769-24d1-4cef-91ad-f206f5fb234b" | ||
| 72 | - } | ||
| 73 | - ] | ||
| 74 | - }, | ||
| 75 | - "alarmProfile": { | ||
| 76 | - "alarmContactId": "a3004ddd-db8f-487c-aea0-4f6f3efc59a9", | ||
| 77 | - "messageMode": "EMAIL_MESSAGE" | ||
| 78 | - } | ||
| 79 | -} |
| @@ -176,13 +176,7 @@ | @@ -176,13 +176,7 @@ | ||
| 176 | dashboardFormScheme, | 176 | dashboardFormScheme, |
| 177 | isWhereType, | 177 | isWhereType, |
| 178 | } from './data'; | 178 | } from './data'; |
| 179 | - import { | ||
| 180 | - DeleteOutlined, | ||
| 181 | - // MinusCircleOutlined, | ||
| 182 | - PlusCircleOutlined, | ||
| 183 | - PlusOutlined, | ||
| 184 | - EditOutlined, | ||
| 185 | - } from '@ant-design/icons-vue'; | 179 | + import { PlusCircleOutlined } from '@ant-design/icons-vue'; |
| 186 | import { Checkbox } from 'ant-design-vue'; | 180 | import { Checkbox } from 'ant-design-vue'; |
| 187 | import { useModal } from '/@/components/Modal'; | 181 | import { useModal } from '/@/components/Modal'; |
| 188 | import DetailTemplate from './cpns/detailtemplate/index.vue'; | 182 | import DetailTemplate from './cpns/detailtemplate/index.vue'; |
| @@ -190,17 +184,14 @@ | @@ -190,17 +184,14 @@ | ||
| 190 | import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; | 184 | import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; |
| 191 | import { Button } from '/@/components/Button'; | 185 | import { Button } from '/@/components/Button'; |
| 192 | 186 | ||
| 187 | + export const isWhereTypeValueDisabled = ref(false); | ||
| 188 | + | ||
| 193 | export default defineComponent({ | 189 | export default defineComponent({ |
| 194 | components: { | 190 | components: { |
| 195 | BasicForm, | 191 | BasicForm, |
| 196 | CollapseContainer, | 192 | CollapseContainer, |
| 197 | - DeleteOutlined, | ||
| 198 | - // MinusCircleOutlined, | ||
| 199 | PlusCircleOutlined, | 193 | PlusCircleOutlined, |
| 200 | - PlusOutlined, | ||
| 201 | - EditOutlined, | ||
| 202 | Checkbox, | 194 | Checkbox, |
| 203 | - // Tooltip, | ||
| 204 | DetailTemplate, | 195 | DetailTemplate, |
| 205 | EnableRule, | 196 | EnableRule, |
| 206 | AlarmRuleConditions, | 197 | AlarmRuleConditions, |
| @@ -390,13 +381,18 @@ | @@ -390,13 +381,18 @@ | ||
| 390 | }; | 381 | }; |
| 391 | watch(isWhereType, (nV) => { | 382 | watch(isWhereType, (nV) => { |
| 392 | isWhereTypeValue.value = nV; | 383 | isWhereTypeValue.value = nV; |
| 384 | + if (isWhereTypeValue.value == nV) { | ||
| 385 | + isWhereTypeValueDisabled.value = true; | ||
| 386 | + } else { | ||
| 387 | + // isWhereTypeValueDisabled.value = false; | ||
| 388 | + } | ||
| 393 | }); | 389 | }); |
| 394 | //详情模板 | 390 | //详情模板 |
| 395 | const getAllFieldsFunc = (v) => { | 391 | const getAllFieldsFunc = (v) => { |
| 396 | detailObj.value = v; | 392 | detailObj.value = v; |
| 397 | detailTemplateData.value = ` | 393 | detailTemplateData.value = ` |
| 398 | - 报警详细信息:${v.alarmDetails} | ||
| 399 | - `; | 394 | + 报警详细信息:${v.alarmDetails} |
| 395 | + `; | ||
| 400 | }; | 396 | }; |
| 401 | //启用规则 | 397 | //启用规则 |
| 402 | const getAllFieldsEnabFunc = (v) => { | 398 | const getAllFieldsEnabFunc = (v) => { |
| @@ -440,10 +436,12 @@ | @@ -440,10 +436,12 @@ | ||
| 440 | console.log(e); | 436 | console.log(e); |
| 441 | } | 437 | } |
| 442 | }); | 438 | }); |
| 443 | - | ||
| 444 | - enableTemplateData.value = ` | ||
| 445 | - 开始时间:${v.startsOn}结束时间:${v.endsOn}天数:${findDayByValue} | ||
| 446 | - `; | 439 | + enableTemplateData.value = |
| 440 | + v.startsOn == undefined | ||
| 441 | + ? `始终启用` | ||
| 442 | + : ` | ||
| 443 | + 开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} | ||
| 444 | + `; | ||
| 447 | }; | 445 | }; |
| 448 | //规则条件 | 446 | //规则条件 |
| 449 | const getAllFieldsRuleFunc = (v, v1) => { | 447 | const getAllFieldsRuleFunc = (v, v1) => { |
| @@ -468,8 +466,8 @@ | @@ -468,8 +466,8 @@ | ||
| 468 | } | 466 | } |
| 469 | }); | 467 | }); |
| 470 | ruleTemplateData.value = ` | 468 | ruleTemplateData.value = ` |
| 471 | - 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} | ||
| 472 | - `; | 469 | + 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} |
| 470 | + `; | ||
| 473 | 471 | ||
| 474 | ruleLastObj.value = v1; | 472 | ruleLastObj.value = v1; |
| 475 | const predicate = { | 473 | const predicate = { |
| @@ -514,8 +512,8 @@ | @@ -514,8 +512,8 @@ | ||
| 514 | const getAllClearFieldsFunc = (v) => { | 512 | const getAllClearFieldsFunc = (v) => { |
| 515 | detailClearObj.value = v; | 513 | detailClearObj.value = v; |
| 516 | detailClearTemplateData.value = ` | 514 | detailClearTemplateData.value = ` |
| 517 | - 报警详细信息:${v.alarmDetails} | ||
| 518 | - `; | 515 | + 报警详细信息:${v.alarmDetails} |
| 516 | + `; | ||
| 519 | }; | 517 | }; |
| 520 | //启用规则 | 518 | //启用规则 |
| 521 | const getAllClearFieldsEnabFunc = (v) => { | 519 | const getAllClearFieldsEnabFunc = (v) => { |
| @@ -559,9 +557,11 @@ | @@ -559,9 +557,11 @@ | ||
| 559 | console.log(e); | 557 | console.log(e); |
| 560 | } | 558 | } |
| 561 | }); | 559 | }); |
| 562 | - enableClearTemplateData.value = ` | ||
| 563 | - 开始时间:${v.startsOn}结束时间:${v.endsOn}天数:${findDayByValue} | ||
| 564 | - `; | 560 | + enableClearTemplateData.value = |
| 561 | + v.startsOn == undefined | ||
| 562 | + ? `始终启用` | ||
| 563 | + : `开始时间:${v.startsOn},结束时间:${v.endsOn},天数:${findDayByValue} | ||
| 564 | + `; | ||
| 565 | }; | 565 | }; |
| 566 | //规则条件 | 566 | //规则条件 |
| 567 | const getAllClearFieldsRuleFunc = (v, v1) => { | 567 | const getAllClearFieldsRuleFunc = (v, v1) => { |
| @@ -586,8 +586,8 @@ | @@ -586,8 +586,8 @@ | ||
| 586 | } | 586 | } |
| 587 | }); | 587 | }); |
| 588 | ruleClearTemplateData.value = ` | 588 | ruleClearTemplateData.value = ` |
| 589 | - 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} | ||
| 590 | - `; | 589 | + 键名:${v.key1}...操作:${findRuleByValue?.label}...值:${v.value1} |
| 590 | + `; | ||
| 591 | 591 | ||
| 592 | ruleLastObj.value = v1; | 592 | ruleLastObj.value = v1; |
| 593 | const predicate = { | 593 | const predicate = { |
| @@ -28,6 +28,7 @@ export const formSchema: FormSchema[] = [ | @@ -28,6 +28,7 @@ export const formSchema: FormSchema[] = [ | ||
| 28 | colProps: { span: 12 }, | 28 | colProps: { span: 12 }, |
| 29 | required: true, | 29 | required: true, |
| 30 | component: 'Select', | 30 | component: 'Select', |
| 31 | + defaultValue: 'ANY_TIME', | ||
| 31 | componentProps: { | 32 | componentProps: { |
| 32 | placeholder: '请选择报警日程表', | 33 | placeholder: '请选择报警日程表', |
| 33 | options: [ | 34 | options: [ |
| @@ -5,6 +5,7 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | @@ -5,6 +5,7 @@ import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; | ||
| 5 | import { ref } from 'vue'; | 5 | import { ref } from 'vue'; |
| 6 | import { findDictItemByCode } from '/@/api/system/dict'; | 6 | import { findDictItemByCode } from '/@/api/system/dict'; |
| 7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; | 7 | import { alarmContactGetPage } from '/@/api/device/deviceConfigApi'; |
| 8 | +import { isWhereTypeValueDisabled } from './DeviceProfileStep3.vue'; | ||
| 8 | 9 | ||
| 9 | export const step1Schemas: FormSchema[] = [ | 10 | export const step1Schemas: FormSchema[] = [ |
| 10 | { | 11 | { |
| @@ -146,39 +147,85 @@ export const isWhereType = ref(null); | @@ -146,39 +147,85 @@ export const isWhereType = ref(null); | ||
| 146 | 147 | ||
| 147 | export const step3CreateAlarm: FormSchema[] = [ | 148 | export const step3CreateAlarm: FormSchema[] = [ |
| 148 | { | 149 | { |
| 149 | - field: 'WARNING', | 150 | + field: 'default', |
| 150 | component: 'Select', | 151 | component: 'Select', |
| 151 | label: '严重程度', | 152 | label: '严重程度', |
| 152 | colProps: { | 153 | colProps: { |
| 153 | span: 16, | 154 | span: 16, |
| 154 | }, | 155 | }, |
| 155 | - componentProps: { | ||
| 156 | - placeholder: '请选择严重程度', | ||
| 157 | - options: [ | ||
| 158 | - { | ||
| 159 | - value: 'CRITICAL', | ||
| 160 | - label: '危险', | ||
| 161 | - }, | ||
| 162 | - { | ||
| 163 | - value: 'MAJOR', | ||
| 164 | - label: '重要', | ||
| 165 | - }, | ||
| 166 | - { | ||
| 167 | - value: 'MINOR', | ||
| 168 | - label: '次要', | 156 | + componentProps({ formModel, formActionType }) { |
| 157 | + console.log(formModel.default); | ||
| 158 | + return { | ||
| 159 | + filterOptions: (i, v) => { | ||
| 160 | + console.log(i, v); | ||
| 169 | }, | 161 | }, |
| 170 | - { | ||
| 171 | - value: 'WARNING', | ||
| 172 | - label: '警告', | 162 | + placeholder: '请选择严重程度', |
| 163 | + options: [ | ||
| 164 | + { | ||
| 165 | + value: 'CRITICAL', | ||
| 166 | + label: '危险', | ||
| 167 | + disabled: formModel.default == 'CRITICAL', | ||
| 168 | + }, | ||
| 169 | + { | ||
| 170 | + value: 'MAJOR', | ||
| 171 | + label: '重要', | ||
| 172 | + disabled: formModel.default == 'MAJOR', | ||
| 173 | + }, | ||
| 174 | + { | ||
| 175 | + value: 'MINOR', | ||
| 176 | + label: '次要', | ||
| 177 | + // disabled: formModel.default == 'MINOR', | ||
| 178 | + }, | ||
| 179 | + { | ||
| 180 | + value: 'WARNING', | ||
| 181 | + label: '警告', | ||
| 182 | + // disabled: formModel.default == 'WARNING', | ||
| 183 | + }, | ||
| 184 | + { | ||
| 185 | + value: 'INDETERMINATE', | ||
| 186 | + label: '不确定', | ||
| 187 | + // disabled: formModel.default == 'INDETERMINATE', | ||
| 188 | + }, | ||
| 189 | + ], | ||
| 190 | + onChange: (v) => { | ||
| 191 | + // const newFiletr = [ | ||
| 192 | + // { | ||
| 193 | + // value: 'CRITICAL', | ||
| 194 | + // label: '危险', | ||
| 195 | + // // disabled: formModel.default == 'CRITICAL', | ||
| 196 | + // }, | ||
| 197 | + // { | ||
| 198 | + // value: 'MAJOR', | ||
| 199 | + // label: '重要', | ||
| 200 | + // // disabled: formModel.default == 'MAJOR', | ||
| 201 | + // }, | ||
| 202 | + // { | ||
| 203 | + // value: 'MINOR', | ||
| 204 | + // label: '次要', | ||
| 205 | + // // disabled: formModel.default == 'MINOR', | ||
| 206 | + // }, | ||
| 207 | + // { | ||
| 208 | + // value: 'WARNING', | ||
| 209 | + // label: '警告', | ||
| 210 | + // // disabled: formModel.default == 'WARNING', | ||
| 211 | + // }, | ||
| 212 | + // { | ||
| 213 | + // value: 'INDETERMINATE', | ||
| 214 | + // label: '不确定', | ||
| 215 | + // // disabled: formModel.default == 'INDETERMINATE', | ||
| 216 | + // }, | ||
| 217 | + // ]; | ||
| 218 | + // const { updateSchema } = formActionType; | ||
| 219 | + // const newFileterFunc = newFiletr.filter((f) => f.value != v); | ||
| 220 | + // updateSchema({ | ||
| 221 | + // field: 'default', | ||
| 222 | + // componentProps: { | ||
| 223 | + // options: newFileterFunc, | ||
| 224 | + // }, | ||
| 225 | + // }); | ||
| 226 | + isWhereType.value = v ? v : 'INDETERMINATE'; | ||
| 173 | }, | 227 | }, |
| 174 | - { | ||
| 175 | - value: 'INDETERMINATE', | ||
| 176 | - label: '不确定', | ||
| 177 | - }, | ||
| 178 | - ], | ||
| 179 | - onChange: (v) => { | ||
| 180 | - isWhereType.value = v ? v : 'INDETERMINATE'; | ||
| 181 | - }, | 228 | + }; |
| 182 | }, | 229 | }, |
| 183 | }, | 230 | }, |
| 184 | ]; | 231 | ]; |