Showing
14 changed files
with
707 additions
and
64 deletions
| ... | ... | @@ -10,6 +10,7 @@ export type TDeviceConfigParams = { |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | export interface IDeviceConfigAddOrEditModel { |
| 13 | + defaultQueueName?: string; //处理队列 | |
| 13 | 14 | alarmProfile?: { |
| 14 | 15 | alarmContactId: string; |
| 15 | 16 | createTime: '2021-12-15T02:17:26.644Z'; |
| ... | ... | @@ -45,6 +46,7 @@ export interface IDeviceConfigAddOrEditModel { |
| 45 | 46 | provisionConfiguration: { |
| 46 | 47 | provisionDeviceSecret: string; |
| 47 | 48 | }; |
| 49 | + //报警类型字段 | |
| 48 | 50 | alarms: [ |
| 49 | 51 | { |
| 50 | 52 | id: 'highTemperatureAlarmID'; | ... | ... |
| ... | ... | @@ -37,8 +37,8 @@ export enum PageEnum { |
| 37 | 37 | // basic login path |
| 38 | 38 | BASE_LOGIN = '/login', |
| 39 | 39 | // basic home path |
| 40 | - BASE_HOME = '/system/account', | |
| 41 | - // BASE_HOME = '/dashboard', | |
| 40 | + // BASE_HOME = '/system/account', | |
| 41 | + BASE_HOME = '/dashboard', | |
| 42 | 42 | // error page path |
| 43 | 43 | ERROR_PAGE = '/exception', |
| 44 | 44 | // error log page path | ... | ... |
| ... | ... | @@ -74,7 +74,8 @@ |
| 74 | 74 | const getStepTwoData: any = ref({}); |
| 75 | 75 | const getStepThreeData: any = ref({}); |
| 76 | 76 | const editEchoData: any = ref({}); |
| 77 | - const isGetStepFourData: any = ref({}); | |
| 77 | + const alarmProfileData: any = ref({}); | |
| 78 | + // const isGetStepThreeData: any = ref({}); | |
| 78 | 79 | const isGetStepThreeData: any = ref({}); |
| 79 | 80 | const postEditId = ref(''); |
| 80 | 81 | const current = ref(0); |
| ... | ... | @@ -113,17 +114,15 @@ |
| 113 | 114 | } |
| 114 | 115 | const handleSubmit = async () => { |
| 115 | 116 | if (!unref(isUpdate)) { |
| 116 | - isGetStepThreeData.value.alarmProfile = getStepThreeData.value; | |
| 117 | - let getStep4Data = proxy.$refs.getStepData.getAllFields(); | |
| 118 | - isGetStepFourData.value.alarmProfile = getStep4Data; | |
| 117 | + isGetStepThreeData.value.profileData = getStepThreeData.value; | |
| 118 | + alarmProfileData.value.alarmProfile = await proxy.$refs.getStepData.getAllFields(); | |
| 119 | 119 | Object.assign( |
| 120 | 120 | postDeviceConfogData.value, |
| 121 | 121 | getStepOneData.value, |
| 122 | 122 | getStepTwoData.value, |
| 123 | - isGetStepFourData.value, | |
| 124 | - isGetStepThreeData.value | |
| 123 | + isGetStepThreeData.value, | |
| 124 | + alarmProfileData.value | |
| 125 | 125 | ); |
| 126 | - console.log('搜集的所有数据', postDeviceConfogData.value); | |
| 127 | 126 | await deviceConfigAddOrEdit(postDeviceConfogData.value); |
| 128 | 127 | createMessage.success('新增设备配置成功'); |
| 129 | 128 | closeModal(); |
| ... | ... | @@ -132,18 +131,16 @@ |
| 132 | 131 | if (unref(isUpdate)) { |
| 133 | 132 | postDeviceConfogData.value.id = postEditId.value; |
| 134 | 133 | isGetStepThreeData.value.alarmProfile = getStepThreeData.value; |
| 135 | - let getStep4Data = proxy.$refs.getStepData.getAllFields(); | |
| 136 | - isGetStepFourData.value.alarmProfile = getStep4Data; | |
| 134 | + alarmProfileData.value.alarmProfile = await proxy.$refs.getStepData.getAllFields(); | |
| 137 | 135 | Object.assign( |
| 138 | 136 | postDeviceConfogData.value, |
| 139 | 137 | getStepOneData.value, |
| 140 | 138 | getStepTwoData.value, |
| 141 | - isGetStepFourData.value, | |
| 139 | + alarmProfileData.value, | |
| 142 | 140 | isGetStepThreeData.value |
| 143 | 141 | ); |
| 144 | - console.log('搜集的所有数据', postDeviceConfogData.value); | |
| 145 | 142 | await deviceConfigAddOrEdit(postDeviceConfogData.value); |
| 146 | - createMessage.success('新增设备配置成功'); | |
| 143 | + createMessage.success('编辑设备配置成功'); | |
| 147 | 144 | closeModal(); |
| 148 | 145 | emit('success'); |
| 149 | 146 | } | ... | ... |
| ... | ... | @@ -24,14 +24,23 @@ |
| 24 | 24 | <div> |
| 25 | 25 | <p style="color: #f5594e" class="mt-4 ml-4" |
| 26 | 26 | >请添加报警规则条件 |
| 27 | - <PlusOutlined class="cursor-pointer ml-4" style="font-size: 20px" | |
| 27 | + <PlusOutlined | |
| 28 | + @click="handleOpenAlaramRuleConditions" | |
| 29 | + class="cursor-pointer ml-4" | |
| 30 | + style="font-size: 20px" | |
| 28 | 31 | /></p> |
| 29 | 32 | <p class="mt-4 ml-4" |
| 30 | 33 | >启用规则:始终启用 |
| 31 | - <EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | |
| 34 | + <EditOutlined | |
| 35 | + @click="handleOpenEnableRule" | |
| 36 | + class="cursor-pointer ml-4" | |
| 37 | + style="font-size: 20px" | |
| 32 | 38 | /></p> |
| 33 | 39 | <p class="mt-4 ml-4" |
| 34 | - >详情:<EditOutlined class="cursor-pointer ml-4" style="font-size: 20px" | |
| 40 | + >详情模板:<EditOutlined | |
| 41 | + @click="handleOpenDetailTemplate" | |
| 42 | + class="cursor-pointer ml-4" | |
| 43 | + style="font-size: 20px" | |
| 35 | 44 | /></p> |
| 36 | 45 | <p class="mt-4 ml-4">dashboard:</p> |
| 37 | 46 | </div> |
| ... | ... | @@ -62,6 +71,12 @@ |
| 62 | 71 | <a-button @click="handleFormStep3toStep4Next">下一步</a-button> |
| 63 | 72 | <a-button style="margin-left: 20px" type="primary" @click="addAlarmRule">添加报警规则</a-button> |
| 64 | 73 | </div> |
| 74 | + <!-- 详情模板 --> | |
| 75 | + <DetailTemplate v-if="isDetailTemplateEnableRuleAlarmRuleConditions" @register="registerModal" /> | |
| 76 | + <!-- 启用规则 --> | |
| 77 | + <EnableRule v-if="!isDetailTemplateEnableRuleAlarmRuleConditions" @register="registerModal" /> | |
| 78 | + <!-- 报警规则条件 --> | |
| 79 | + <AlarmRuleConditions v-if="isRuleAlarmRuleConditions == 1" @register="registerModal" /> | |
| 65 | 80 | </template> |
| 66 | 81 | |
| 67 | 82 | <script lang="ts"> |
| ... | ... | @@ -78,6 +93,10 @@ |
| 78 | 93 | EditOutlined, |
| 79 | 94 | } from '@ant-design/icons-vue'; |
| 80 | 95 | import { Tooltip, Checkbox } from 'ant-design-vue'; |
| 96 | + import { useModal } from '/@/components/Modal'; | |
| 97 | + import DetailTemplate from './cpns/detailtemplate/index.vue'; | |
| 98 | + import EnableRule from './cpns/enablerule/index.vue'; | |
| 99 | + import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; | |
| 81 | 100 | |
| 82 | 101 | export default defineComponent({ |
| 83 | 102 | components: { |
| ... | ... | @@ -90,9 +109,14 @@ |
| 90 | 109 | EditOutlined, |
| 91 | 110 | Checkbox, |
| 92 | 111 | Tooltip, |
| 112 | + DetailTemplate, | |
| 113 | + EnableRule, | |
| 114 | + AlarmRuleConditions, | |
| 93 | 115 | }, |
| 94 | 116 | emits: ['prev', 'next'], |
| 95 | 117 | setup(_, { emit }) { |
| 118 | + const isDetailTemplateEnableRuleAlarmRuleConditions = ref(true); | |
| 119 | + const isRuleAlarmRuleConditions = ref(1); | |
| 96 | 120 | const getAllFormData: any = ref({}); |
| 97 | 121 | //告警列表 |
| 98 | 122 | let alarms = ref<alarmListItem[]>([]); |
| ... | ... | @@ -111,7 +135,8 @@ |
| 111 | 135 | unref(alarms).push({ |
| 112 | 136 | id: Date.now(), |
| 113 | 137 | messageMode: '', |
| 114 | - enabled: false, | |
| 138 | + propagate: false, | |
| 139 | + propagateRelationTypes: [''], | |
| 115 | 140 | createRule: [ |
| 116 | 141 | { |
| 117 | 142 | id: Date.now() + Math.random(), |
| ... | ... | @@ -124,6 +149,7 @@ |
| 124 | 149 | ], |
| 125 | 150 | clearRule: [], |
| 126 | 151 | }); |
| 152 | + console.log(alarms.value); | |
| 127 | 153 | }; |
| 128 | 154 | |
| 129 | 155 | // 表单部分 报警类型 |
| ... | ... | @@ -195,14 +221,45 @@ |
| 195 | 221 | valueRegisterForm, |
| 196 | 222 | valueRegisterFormHighSetting, |
| 197 | 223 | valueRegisterFormCreateAlarm, |
| 198 | - valueRegisterFormClearAlarm | |
| 224 | + valueRegisterFormClearAlarm, | |
| 225 | + alarms.value | |
| 199 | 226 | ); |
| 200 | 227 | console.log('第三步的数据', getAllFormData.value); |
| 201 | 228 | emit('next', getAllFormData.value); |
| 202 | 229 | } catch (error) {} |
| 203 | 230 | }; |
| 204 | 231 | |
| 232 | + const [registerModal, { openModal }] = useModal(); | |
| 233 | + | |
| 234 | + const handleOpenDetailTemplate = () => { | |
| 235 | + openModal(true, { | |
| 236 | + isUpdate: false, | |
| 237 | + }); | |
| 238 | + isDetailTemplateEnableRuleAlarmRuleConditions.value = true; | |
| 239 | + console.log(isDetailTemplateEnableRuleAlarmRuleConditions.value); | |
| 240 | + }; | |
| 241 | + const handleOpenEnableRule = () => { | |
| 242 | + openModal(true, { | |
| 243 | + isUpdate: false, | |
| 244 | + }); | |
| 245 | + isDetailTemplateEnableRuleAlarmRuleConditions.value = false; | |
| 246 | + console.log(isDetailTemplateEnableRuleAlarmRuleConditions.value); | |
| 247 | + }; | |
| 248 | + const handleOpenAlaramRuleConditions = () => { | |
| 249 | + openModal(true, { | |
| 250 | + isUpdate: false, | |
| 251 | + }); | |
| 252 | + isRuleAlarmRuleConditions.value = 1; | |
| 253 | + console.log(isRuleAlarmRuleConditions.value); | |
| 254 | + }; | |
| 255 | + | |
| 205 | 256 | return { |
| 257 | + isRuleAlarmRuleConditions, | |
| 258 | + isDetailTemplateEnableRuleAlarmRuleConditions, | |
| 259 | + registerModal, | |
| 260 | + handleOpenEnableRule, | |
| 261 | + handleOpenAlaramRuleConditions, | |
| 262 | + handleOpenDetailTemplate, | |
| 206 | 263 | handleFormStep3toStep4Next, |
| 207 | 264 | log, |
| 208 | 265 | alarms, | ... | ... |
| 1 | +import { FormSchema } from '/@/components/Table'; | |
| 2 | + | |
| 3 | +export const formSchema: FormSchema[] = [ | |
| 4 | + { | |
| 5 | + field: 'detail', | |
| 6 | + label: '报警详细信息', | |
| 7 | + colProps: { span: 24 }, | |
| 8 | + required: true, | |
| 9 | + component: 'Input', | |
| 10 | + componentProps: { | |
| 11 | + placeholder: '请输入报警详细信息', | |
| 12 | + }, | |
| 13 | + }, | |
| 14 | +]; | ... | ... |
| 1 | +<template> | |
| 2 | + <BasicModal | |
| 3 | + v-bind="$attrs" | |
| 4 | + width="55rem" | |
| 5 | + @register="register" | |
| 6 | + :title="getTitle" | |
| 7 | + @ok="handleSubmit" | |
| 8 | + > | |
| 9 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 10 | + </BasicModal> | |
| 11 | +</template> | |
| 12 | +<script lang="ts"> | |
| 13 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 14 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
| 15 | + import { BasicForm, useForm } from '/@/components/Form'; | |
| 16 | + import { formSchema } from './config'; | |
| 17 | + | |
| 18 | + export default defineComponent({ | |
| 19 | + name: 'DetailTemplate', | |
| 20 | + components: { | |
| 21 | + BasicModal, | |
| 22 | + BasicForm, | |
| 23 | + }, | |
| 24 | + emits: ['success', 'register'], | |
| 25 | + setup() { | |
| 26 | + const isUpdate = ref(true); | |
| 27 | + const [registerForm] = useForm({ | |
| 28 | + labelWidth: 120, | |
| 29 | + schemas: formSchema, | |
| 30 | + }); | |
| 31 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增报警规则条件' : '编辑报警规则条件')); | |
| 32 | + const [register] = useModalInner((data) => { | |
| 33 | + isUpdate.value = !!data?.isUpdate; | |
| 34 | + }); | |
| 35 | + const handleSubmit = () => { | |
| 36 | + console.log(1); | |
| 37 | + }; | |
| 38 | + return { | |
| 39 | + registerForm, | |
| 40 | + handleSubmit, | |
| 41 | + register, | |
| 42 | + getTitle, | |
| 43 | + }; | |
| 44 | + }, | |
| 45 | + }); | |
| 46 | +</script> | ... | ... |
| 1 | +import { FormSchema } from '/@/components/Table'; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 所使用的枚举值 | |
| 5 | + */ | |
| 6 | + | |
| 7 | +export enum TriggerEnum { | |
| 8 | + IS_DEVICE_ACT = 'DEVICE_ACT', | |
| 9 | + IS_TIME_ACT = 'TIME_ACT', | |
| 10 | + IS_SCENE_ACT = 'SCENE_ACT', | |
| 11 | +} | |
| 12 | + | |
| 13 | +export const isShiDu = (type: string) => { | |
| 14 | + return type === TriggerEnum.IS_DEVICE_ACT; | |
| 15 | +}; | |
| 16 | +export const isWenDu = (type: string) => { | |
| 17 | + return type === TriggerEnum.IS_TIME_ACT; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +export const isTimeAll = (type: string) => { | |
| 21 | + return type === TriggerEnum.IS_SCENE_ACT; | |
| 22 | +}; | |
| 23 | + | |
| 24 | +export const formSchema: FormSchema[] = [ | |
| 25 | + { | |
| 26 | + field: 'detail', | |
| 27 | + label: '条件类型', | |
| 28 | + colProps: { span: 24 }, | |
| 29 | + component: 'Select', | |
| 30 | + componentProps: { | |
| 31 | + placeholder: '请选择报警日程表', | |
| 32 | + options: [ | |
| 33 | + { label: '简单', value: 'DEVICE_ACT' }, | |
| 34 | + { label: '持续时间', value: 'TIME_ACT' }, | |
| 35 | + { label: '重复', value: 'SCENE_ACT' }, | |
| 36 | + ], | |
| 37 | + }, | |
| 38 | + }, | |
| 39 | + { | |
| 40 | + field: 'type1', | |
| 41 | + label: '动态源类型', | |
| 42 | + colProps: { span: 24 }, | |
| 43 | + component: 'Select', | |
| 44 | + componentProps: { | |
| 45 | + placeholder: '请选择动态源类型', | |
| 46 | + options: [ | |
| 47 | + { label: '无动态值', value: 'second' }, | |
| 48 | + { label: '当前租户', value: 'minute' }, | |
| 49 | + { label: '当前客户', value: 'hour' }, | |
| 50 | + { label: '当前设备', value: 'day' }, | |
| 51 | + ], | |
| 52 | + }, | |
| 53 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 54 | + }, | |
| 55 | + { | |
| 56 | + field: 'time1', | |
| 57 | + label: '源属性', | |
| 58 | + colProps: { span: 24 }, | |
| 59 | + component: 'Input', | |
| 60 | + componentProps: { | |
| 61 | + placeholder: '源属性', | |
| 62 | + }, | |
| 63 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 64 | + }, | |
| 65 | + { | |
| 66 | + field: 'type1', | |
| 67 | + label: '动态源类型', | |
| 68 | + colProps: { span: 24 }, | |
| 69 | + component: 'Select', | |
| 70 | + componentProps: { | |
| 71 | + placeholder: '请选择动态源类型', | |
| 72 | + options: [ | |
| 73 | + { label: '无动态值', value: 'second' }, | |
| 74 | + { label: '当前租户', value: 'minute' }, | |
| 75 | + { label: '当前客户', value: 'hour' }, | |
| 76 | + { label: '当前设备', value: 'day' }, | |
| 77 | + ], | |
| 78 | + }, | |
| 79 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 80 | + }, | |
| 81 | + { | |
| 82 | + field: 'time1', | |
| 83 | + label: '源属性', | |
| 84 | + colProps: { span: 24 }, | |
| 85 | + component: 'Input', | |
| 86 | + componentProps: { | |
| 87 | + placeholder: '源属性', | |
| 88 | + }, | |
| 89 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 90 | + }, | |
| 91 | + { | |
| 92 | + field: 'time', | |
| 93 | + label: '持续时间值', | |
| 94 | + colProps: { span: 24 }, | |
| 95 | + component: 'Input', | |
| 96 | + componentProps: { | |
| 97 | + placeholder: '请输入持续时间值', | |
| 98 | + }, | |
| 99 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 100 | + }, | |
| 101 | + { | |
| 102 | + field: 'r', | |
| 103 | + label: '时间单位', | |
| 104 | + colProps: { span: 24 }, | |
| 105 | + component: 'Select', | |
| 106 | + componentProps: { | |
| 107 | + placeholder: '请选择报警日程表', | |
| 108 | + options: [ | |
| 109 | + { label: '秒', value: 'second' }, | |
| 110 | + { label: '分钟', value: 'minute' }, | |
| 111 | + { label: '小时', value: 'hour' }, | |
| 112 | + { label: '天', value: 'day' }, | |
| 113 | + ], | |
| 114 | + }, | |
| 115 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 116 | + }, | |
| 117 | + { | |
| 118 | + field: 'time', | |
| 119 | + label: '事件计数值必填', | |
| 120 | + colProps: { span: 24 }, | |
| 121 | + component: 'Input', | |
| 122 | + componentProps: { | |
| 123 | + placeholder: '请输入事件计数值必填', | |
| 124 | + }, | |
| 125 | + rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }], | |
| 126 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 127 | + }, | |
| 128 | +]; | ... | ... |
| 1 | +<template> | |
| 2 | + <BasicModal | |
| 3 | + v-bind="$attrs" | |
| 4 | + width="55rem" | |
| 5 | + @register="register" | |
| 6 | + :title="getTitle" | |
| 7 | + @ok="handleSubmit" | |
| 8 | + > | |
| 9 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 10 | + </BasicModal> | |
| 11 | +</template> | |
| 12 | +<script lang="ts"> | |
| 13 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 14 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
| 15 | + import { BasicForm, useForm } from '/@/components/Form'; | |
| 16 | + import { formSchema } from './config'; | |
| 17 | + | |
| 18 | + export default defineComponent({ | |
| 19 | + name: 'DetailTemplate', | |
| 20 | + components: { | |
| 21 | + BasicModal, | |
| 22 | + BasicForm, | |
| 23 | + }, | |
| 24 | + emits: ['success', 'register'], | |
| 25 | + setup() { | |
| 26 | + const isUpdate = ref(true); | |
| 27 | + const [registerForm] = useForm({ | |
| 28 | + labelWidth: 120, | |
| 29 | + schemas: formSchema, | |
| 30 | + }); | |
| 31 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增详情模板' : '编辑详情模板')); | |
| 32 | + const [register] = useModalInner((data) => { | |
| 33 | + isUpdate.value = !!data?.isUpdate; | |
| 34 | + }); | |
| 35 | + const handleSubmit = () => { | |
| 36 | + console.log(1); | |
| 37 | + }; | |
| 38 | + return { | |
| 39 | + registerForm, | |
| 40 | + handleSubmit, | |
| 41 | + register, | |
| 42 | + getTitle, | |
| 43 | + }; | |
| 44 | + }, | |
| 45 | + }); | |
| 46 | +</script> | ... | ... |
| 1 | +import { FormSchema } from '/@/components/Table'; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 所使用的枚举值 | |
| 5 | + */ | |
| 6 | + | |
| 7 | +export enum TriggerEnum { | |
| 8 | + IS_DEVICE_ACT = 'DEVICE_ACT', | |
| 9 | + IS_TIME_ACT = 'TIME_ACT', | |
| 10 | + IS_SCENE_ACT = 'SCENE_ACT', | |
| 11 | +} | |
| 12 | + | |
| 13 | +export const isShiDu = (type: string) => { | |
| 14 | + return type === TriggerEnum.IS_DEVICE_ACT; | |
| 15 | +}; | |
| 16 | +export const isWenDu = (type: string) => { | |
| 17 | + return type === TriggerEnum.IS_TIME_ACT; | |
| 18 | +}; | |
| 19 | + | |
| 20 | +export const isTimeAll = (type: string) => { | |
| 21 | + return type === TriggerEnum.IS_SCENE_ACT; | |
| 22 | +}; | |
| 23 | + | |
| 24 | +export const formSchema: FormSchema[] = [ | |
| 25 | + { | |
| 26 | + field: 'detail', | |
| 27 | + label: '报警日程表', | |
| 28 | + colProps: { span: 24 }, | |
| 29 | + required: true, | |
| 30 | + component: 'Select', | |
| 31 | + componentProps: { | |
| 32 | + placeholder: '请选择报警日程表', | |
| 33 | + options: [ | |
| 34 | + { label: '始终启用', value: 'DEVICE_ACT' }, | |
| 35 | + { label: '定时启用', value: 'TIME_ACT' }, | |
| 36 | + { label: '自定义启用', value: 'SCENE_ACT' }, | |
| 37 | + ], | |
| 38 | + }, | |
| 39 | + }, | |
| 40 | + { | |
| 41 | + field: 'time', | |
| 42 | + label: '时区', | |
| 43 | + colProps: { span: 24 }, | |
| 44 | + required: true, | |
| 45 | + component: 'Input', | |
| 46 | + componentProps: { | |
| 47 | + placeholder: 'Asia/Shanghai (UTC+08:00)', | |
| 48 | + }, | |
| 49 | + ifShow: ({ values }) => | |
| 50 | + isWenDu(Reflect.get(values, 'detail')) || isTimeAll(Reflect.get(values, 'detail')), | |
| 51 | + }, | |
| 52 | + | |
| 53 | + { | |
| 54 | + field: 'data1', | |
| 55 | + component: 'Checkbox', | |
| 56 | + label: '星期一', | |
| 57 | + colProps: { | |
| 58 | + span: 8, | |
| 59 | + }, | |
| 60 | + renderComponentContent: '', | |
| 61 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 62 | + }, | |
| 63 | + { | |
| 64 | + field: 'time', | |
| 65 | + component: 'TimePicker', | |
| 66 | + label: '时间选择', | |
| 67 | + colProps: { | |
| 68 | + span: 8, | |
| 69 | + }, | |
| 70 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 71 | + }, | |
| 72 | + { | |
| 73 | + field: 'time', | |
| 74 | + component: 'TimePicker', | |
| 75 | + label: '时间选择', | |
| 76 | + colProps: { | |
| 77 | + span: 8, | |
| 78 | + }, | |
| 79 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 80 | + }, | |
| 81 | + | |
| 82 | + { | |
| 83 | + field: 'data2', | |
| 84 | + component: 'Checkbox', | |
| 85 | + label: '星期二', | |
| 86 | + colProps: { | |
| 87 | + span: 8, | |
| 88 | + }, | |
| 89 | + renderComponentContent: '', | |
| 90 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 91 | + }, | |
| 92 | + { | |
| 93 | + field: 'time', | |
| 94 | + component: 'TimePicker', | |
| 95 | + label: '时间选择', | |
| 96 | + colProps: { | |
| 97 | + span: 8, | |
| 98 | + }, | |
| 99 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 100 | + }, | |
| 101 | + { | |
| 102 | + field: 'time', | |
| 103 | + component: 'TimePicker', | |
| 104 | + label: '时间选择', | |
| 105 | + colProps: { | |
| 106 | + span: 8, | |
| 107 | + }, | |
| 108 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 109 | + }, | |
| 110 | + { | |
| 111 | + field: 'data3', | |
| 112 | + component: 'Checkbox', | |
| 113 | + label: '星期三', | |
| 114 | + colProps: { | |
| 115 | + span: 8, | |
| 116 | + }, | |
| 117 | + renderComponentContent: '', | |
| 118 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 119 | + }, | |
| 120 | + { | |
| 121 | + field: 'time', | |
| 122 | + component: 'TimePicker', | |
| 123 | + label: '时间选择', | |
| 124 | + colProps: { | |
| 125 | + span: 8, | |
| 126 | + }, | |
| 127 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 128 | + }, | |
| 129 | + { | |
| 130 | + field: 'time', | |
| 131 | + component: 'TimePicker', | |
| 132 | + label: '时间选择', | |
| 133 | + colProps: { | |
| 134 | + span: 8, | |
| 135 | + }, | |
| 136 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 137 | + }, | |
| 138 | + { | |
| 139 | + field: 'data4', | |
| 140 | + component: 'Checkbox', | |
| 141 | + label: '星期四', | |
| 142 | + colProps: { | |
| 143 | + span: 8, | |
| 144 | + }, | |
| 145 | + renderComponentContent: '', | |
| 146 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 147 | + }, | |
| 148 | + { | |
| 149 | + field: 'time', | |
| 150 | + component: 'TimePicker', | |
| 151 | + label: '时间选择', | |
| 152 | + colProps: { | |
| 153 | + span: 8, | |
| 154 | + }, | |
| 155 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 156 | + }, | |
| 157 | + { | |
| 158 | + field: 'time', | |
| 159 | + component: 'TimePicker', | |
| 160 | + label: '时间选择', | |
| 161 | + colProps: { | |
| 162 | + span: 8, | |
| 163 | + }, | |
| 164 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 165 | + }, | |
| 166 | + { | |
| 167 | + field: 'data5', | |
| 168 | + component: 'Checkbox', | |
| 169 | + label: '星期五', | |
| 170 | + colProps: { | |
| 171 | + span: 8, | |
| 172 | + }, | |
| 173 | + renderComponentContent: '', | |
| 174 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 175 | + }, | |
| 176 | + { | |
| 177 | + field: 'time', | |
| 178 | + component: 'TimePicker', | |
| 179 | + label: '时间选择', | |
| 180 | + colProps: { | |
| 181 | + span: 8, | |
| 182 | + }, | |
| 183 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 184 | + }, | |
| 185 | + { | |
| 186 | + field: 'time', | |
| 187 | + component: 'TimePicker', | |
| 188 | + label: '时间选择', | |
| 189 | + colProps: { | |
| 190 | + span: 8, | |
| 191 | + }, | |
| 192 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 193 | + }, | |
| 194 | + { | |
| 195 | + field: 'data6', | |
| 196 | + component: 'Checkbox', | |
| 197 | + label: '星期六', | |
| 198 | + colProps: { | |
| 199 | + span: 8, | |
| 200 | + }, | |
| 201 | + renderComponentContent: '', | |
| 202 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 203 | + }, | |
| 204 | + { | |
| 205 | + field: 'time', | |
| 206 | + component: 'TimePicker', | |
| 207 | + label: '时间选择', | |
| 208 | + colProps: { | |
| 209 | + span: 8, | |
| 210 | + }, | |
| 211 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 212 | + }, | |
| 213 | + { | |
| 214 | + field: 'time', | |
| 215 | + component: 'TimePicker', | |
| 216 | + label: '时间选择', | |
| 217 | + colProps: { | |
| 218 | + span: 8, | |
| 219 | + }, | |
| 220 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 221 | + }, | |
| 222 | + { | |
| 223 | + field: 'data7', | |
| 224 | + component: 'Checkbox', | |
| 225 | + label: '星期七', | |
| 226 | + colProps: { | |
| 227 | + span: 8, | |
| 228 | + }, | |
| 229 | + renderComponentContent: '', | |
| 230 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 231 | + }, | |
| 232 | + { | |
| 233 | + field: 'time', | |
| 234 | + component: 'TimePicker', | |
| 235 | + label: '时间选择', | |
| 236 | + colProps: { | |
| 237 | + span: 8, | |
| 238 | + }, | |
| 239 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 240 | + }, | |
| 241 | + { | |
| 242 | + field: 'time', | |
| 243 | + component: 'TimePicker', | |
| 244 | + label: '时间选择', | |
| 245 | + colProps: { | |
| 246 | + span: 8, | |
| 247 | + }, | |
| 248 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), | |
| 249 | + }, | |
| 250 | + | |
| 251 | + { | |
| 252 | + field: 'weekday', | |
| 253 | + component: 'CheckboxGroup', | |
| 254 | + label: '天', | |
| 255 | + colProps: { | |
| 256 | + span: 24, | |
| 257 | + }, | |
| 258 | + rules: [ | |
| 259 | + { | |
| 260 | + message: '每周至少选择一天', | |
| 261 | + trigger: 'blur', | |
| 262 | + }, | |
| 263 | + ], | |
| 264 | + componentProps: { | |
| 265 | + options: [ | |
| 266 | + { | |
| 267 | + label: '星期一', | |
| 268 | + value: '1', | |
| 269 | + }, | |
| 270 | + { | |
| 271 | + label: '星期二', | |
| 272 | + value: '2', | |
| 273 | + }, | |
| 274 | + { | |
| 275 | + label: '星期三', | |
| 276 | + value: '3', | |
| 277 | + }, | |
| 278 | + { | |
| 279 | + label: '星期四', | |
| 280 | + value: '4', | |
| 281 | + }, | |
| 282 | + { | |
| 283 | + label: '星期五', | |
| 284 | + value: '5', | |
| 285 | + }, | |
| 286 | + { | |
| 287 | + label: '星期六', | |
| 288 | + value: '6', | |
| 289 | + }, | |
| 290 | + { | |
| 291 | + label: '星期七', | |
| 292 | + value: '7', | |
| 293 | + }, | |
| 294 | + ], | |
| 295 | + }, | |
| 296 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 297 | + }, | |
| 298 | + { | |
| 299 | + field: 'time', | |
| 300 | + component: 'TimePicker', | |
| 301 | + label: '时间选择', | |
| 302 | + colProps: { | |
| 303 | + span: 8, | |
| 304 | + }, | |
| 305 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 306 | + }, | |
| 307 | + { | |
| 308 | + field: 'time', | |
| 309 | + component: 'TimePicker', | |
| 310 | + label: '时间选择', | |
| 311 | + colProps: { | |
| 312 | + span: 8, | |
| 313 | + }, | |
| 314 | + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), | |
| 315 | + }, | |
| 316 | +]; | ... | ... |
| 1 | +<template> | |
| 2 | + <BasicModal | |
| 3 | + v-bind="$attrs" | |
| 4 | + width="55rem" | |
| 5 | + @register="register" | |
| 6 | + :title="getTitle" | |
| 7 | + @ok="handleSubmit" | |
| 8 | + > | |
| 9 | + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> | |
| 10 | + </BasicModal> | |
| 11 | +</template> | |
| 12 | +<script lang="ts"> | |
| 13 | + import { defineComponent, ref, computed, unref } from 'vue'; | |
| 14 | + import { BasicModal, useModalInner } from '/@/components/Modal'; | |
| 15 | + import { BasicForm, useForm } from '/@/components/Form'; | |
| 16 | + import { formSchema } from './config'; | |
| 17 | + | |
| 18 | + export default defineComponent({ | |
| 19 | + name: 'DetailTemplate', | |
| 20 | + components: { | |
| 21 | + BasicModal, | |
| 22 | + BasicForm, | |
| 23 | + }, | |
| 24 | + emits: ['success', 'register'], | |
| 25 | + setup() { | |
| 26 | + const isUpdate = ref(true); | |
| 27 | + const [registerForm] = useForm({ | |
| 28 | + labelWidth: 120, | |
| 29 | + schemas: formSchema, | |
| 30 | + }); | |
| 31 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增报警日程表' : '编辑报警日程表')); | |
| 32 | + const [register] = useModalInner((data) => { | |
| 33 | + isUpdate.value = !!data?.isUpdate; | |
| 34 | + }); | |
| 35 | + const handleSubmit = () => { | |
| 36 | + console.log(1); | |
| 37 | + }; | |
| 38 | + return { | |
| 39 | + registerForm, | |
| 40 | + handleSubmit, | |
| 41 | + register, | |
| 42 | + getTitle, | |
| 43 | + }; | |
| 44 | + }, | |
| 45 | + }); | |
| 46 | +</script> | ... | ... |
| 1 | 1 | import { FormSchema } from '/@/components/Form'; |
| 2 | -// import { findDictItemByCode } from '/@/api/system/dict'; | |
| 3 | -import { getOrganizationList } from '/@/api/system/system'; | |
| 4 | -import { copyTransFun } from '/@/utils/fnUtils'; | |
| 2 | +import { findDictItemByCode } from '/@/api/system/dict'; | |
| 3 | +// import { getOrganizationList } from '/@/api/system/system'; | |
| 4 | +// import { copyTransFun } from '/@/utils/fnUtils'; | |
| 5 | 5 | import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; |
| 6 | 6 | |
| 7 | 7 | export const step1Schemas: FormSchema[] = [ |
| ... | ... | @@ -14,19 +14,7 @@ export const step1Schemas: FormSchema[] = [ |
| 14 | 14 | maxLength: 30, |
| 15 | 15 | }, |
| 16 | 16 | }, |
| 17 | - { | |
| 18 | - required: true, | |
| 19 | - field: 'organizationId', | |
| 20 | - label: '请选择组织', | |
| 21 | - component: 'ApiTreeSelect', | |
| 22 | - componentProps: { | |
| 23 | - api: async () => { | |
| 24 | - const data = await getOrganizationList(); | |
| 25 | - copyTransFun(data as any as any[]); | |
| 26 | - return data; | |
| 27 | - }, | |
| 28 | - }, | |
| 29 | - }, | |
| 17 | + //规则链(string) | |
| 30 | 18 | { |
| 31 | 19 | field: 'defaultRuleChainId', |
| 32 | 20 | label: '请选择规则链', |
| ... | ... | @@ -49,19 +37,19 @@ export const step1Schemas: FormSchema[] = [ |
| 49 | 37 | // // api: uploadApi, |
| 50 | 38 | // }, |
| 51 | 39 | // }, |
| 52 | - // { | |
| 53 | - // field: 'defaultConfig', | |
| 54 | - // label: '队列优先级', | |
| 55 | - // component: 'ApiSelect', | |
| 56 | - // componentProps: { | |
| 57 | - // api: findDictItemByCode, | |
| 58 | - // params: { | |
| 59 | - // dictCode: 'queen_execute_sequence', | |
| 60 | - // }, | |
| 61 | - // labelField: 'itemText', | |
| 62 | - // valueField: 'itemValue', | |
| 63 | - // }, | |
| 64 | - // }, | |
| 40 | + { | |
| 41 | + field: 'defaultQueueName', | |
| 42 | + label: '处理队列', | |
| 43 | + component: 'ApiSelect', | |
| 44 | + componentProps: { | |
| 45 | + api: findDictItemByCode, | |
| 46 | + params: { | |
| 47 | + dictCode: 'queen_execute_sequence', | |
| 48 | + }, | |
| 49 | + labelField: 'itemText', | |
| 50 | + valueField: 'itemValue', | |
| 51 | + }, | |
| 52 | + }, | |
| 65 | 53 | { |
| 66 | 54 | label: '描述', |
| 67 | 55 | field: 'description', |
| ... | ... | @@ -79,7 +67,9 @@ export const step2Schemas: FormSchema[] = [ |
| 79 | 67 | options: [ |
| 80 | 68 | { label: 'MQTT', value: 'MQTT' }, |
| 81 | 69 | { label: 'TCP', value: 'TCP' }, |
| 82 | - { label: 'COAP', value: 'COAP' }, | |
| 70 | + { label: 'CoAP', value: 'CoAP' }, | |
| 71 | + { label: 'LWM2M', value: 'LWM2M' }, | |
| 72 | + { label: 'SNMP', value: 'SNMP' }, | |
| 83 | 73 | ], |
| 84 | 74 | }, |
| 85 | 75 | }, |
| ... | ... | @@ -87,7 +77,7 @@ export const step2Schemas: FormSchema[] = [ |
| 87 | 77 | |
| 88 | 78 | export const step3Schemas: FormSchema[] = [ |
| 89 | 79 | { |
| 90 | - field: 'description', | |
| 80 | + field: 'alarmType', | |
| 91 | 81 | component: 'Input', |
| 92 | 82 | label: '报警类型', |
| 93 | 83 | colProps: { |
| ... | ... | @@ -102,19 +92,19 @@ export const step3Schemas: FormSchema[] = [ |
| 102 | 92 | |
| 103 | 93 | export const step3HighSetting: FormSchema[] = [ |
| 104 | 94 | { |
| 105 | - field: 'enabled', | |
| 95 | + field: 'propagate', | |
| 106 | 96 | component: 'Checkbox', |
| 107 | 97 | label: '', |
| 108 | 98 | slot: 'checkBox', |
| 109 | 99 | }, |
| 110 | 100 | { |
| 111 | - field: 'defaultConfig', | |
| 101 | + field: 'propagateRelationTypes', | |
| 112 | 102 | component: 'Input', |
| 113 | 103 | label: '关联类型', |
| 114 | 104 | componentProps: { |
| 115 | 105 | placeholder: '要传递的关联类型', |
| 116 | 106 | }, |
| 117 | - ifShow: ({ values }) => !!values.enabled, | |
| 107 | + ifShow: ({ values }) => !!values.propagate, | |
| 118 | 108 | }, |
| 119 | 109 | ]; |
| 120 | 110 | ... | ... |
| ... | ... | @@ -15,11 +15,10 @@ interface clearRule { |
| 15 | 15 | } |
| 16 | 16 | export interface alarmListItem { |
| 17 | 17 | id?: number; |
| 18 | - messageMode?: string; | |
| 19 | 18 | alarmType?: string; |
| 20 | - enabled?: boolean; | |
| 21 | - createRule?: createRule[]; | |
| 22 | - clearRule?: clearRule[]; | |
| 19 | + messageMode?: string; | |
| 23 | 20 | propagate?: boolean; |
| 24 | 21 | propagateRelationTypes?: string[]; |
| 22 | + createRule?: createRule[]; | |
| 23 | + clearRule?: clearRule[]; | |
| 25 | 24 | } | ... | ... |
| ... | ... | @@ -126,13 +126,14 @@ export const formSchema: FormSchema[] = [ |
| 126 | 126 | api: async () => { |
| 127 | 127 | const data = await getOrganizationList(); |
| 128 | 128 | copyTransFun(data as any as any[]); |
| 129 | - const filterData = data.map((m) => { | |
| 130 | - return { | |
| 131 | - label: m.label, | |
| 132 | - value: m.value, | |
| 133 | - }; | |
| 134 | - }); | |
| 135 | - return filterData; | |
| 129 | + // const filterData = data.map((m) => { | |
| 130 | + // return { | |
| 131 | + // label: m.label, | |
| 132 | + // value: m.value, | |
| 133 | + // }; | |
| 134 | + // }); | |
| 135 | + // return filterData; | |
| 136 | + return data; | |
| 136 | 137 | }, |
| 137 | 138 | onChange: (v) => { |
| 138 | 139 | isDeptId.value = v; | ... | ... |