Commit 2c122df004ee7a6a83aaf23253c1f0c1da4d0aaa

Authored by xp.Huang
2 parents 368b6655 9fda834c

Merge branch 'ft-dev' into 'main'

设备配置待完善报警规则处理

See merge request huang/yun-teng-iot-front!39
@@ -76,7 +76,6 @@ export function createPermissionGuard(router: Router) { @@ -76,7 +76,6 @@ export function createPermissionGuard(router: Router) {
76 to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME) 76 to.fullPath !== (userStore.getUserInfo.homePath || PageEnum.BASE_HOME)
77 ) { 77 ) {
78 // Jump to the 404 page after processing the login 78 // Jump to the 404 page after processing the login
79 - console.log(router);  
80 getMenuList().then((res) => { 79 getMenuList().then((res) => {
81 if (res) { 80 if (res) {
82 console.log(res); 81 console.log(res);
@@ -22,11 +22,6 @@ export const columns: BasicColumn[] = [ @@ -22,11 +22,6 @@ export const columns: BasicColumn[] = [
22 width: 180, 22 width: 180,
23 }, 23 },
24 { 24 {
25 - title: '绑定规则链',  
26 - dataIndex: 'defaultRuleChainId',  
27 - width: 180,  
28 - },  
29 - {  
30 title: '描述', 25 title: '描述',
31 dataIndex: 'description', 26 dataIndex: 'description',
32 width: 180, 27 width: 180,
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 class="cursor-pointer ml-4" 42 class="cursor-pointer ml-4"
43 style="font-size: 20px" 43 style="font-size: 20px"
44 /></p> 44 /></p>
45 - <p class="mt-4 ml-4">dashboard:</p> 45 + <BasicForm @register="dashboardForm" />
46 </div> 46 </div>
47 </div> 47 </div>
48 <div class="w-1/4 flex justify-center"> 48 <div class="w-1/4 flex justify-center">
@@ -60,9 +60,47 @@ @@ -60,9 +60,47 @@
60 ><PlusCircleOutlined />添加创建条件</a-button 60 ><PlusCircleOutlined />添加创建条件</a-button
61 > 61 >
62 <p>清除报警规则</p> 62 <p>清除报警规则</p>
63 - <BasicForm @register="registerFormClearAlarm">  
64 - <template #formHeader> </template>  
65 - </BasicForm> 63 + <template v-for="(childItem, createIndex) in item.alarms" :key="childItem.id">
  64 + <div class="aic mb-4" style="border: 1px solid #bfbfbf">
  65 + <div class="w-3/4">
  66 + <div>
  67 + <p style="color: #f5594e" class="mt-4 ml-4"
  68 + >请添加报警规则条件
  69 + <PlusOutlined
  70 + @click="handleOpenAlaramRuleConditions"
  71 + class="cursor-pointer ml-4"
  72 + style="font-size: 20px"
  73 + /></p>
  74 + <p class="mt-4 ml-4"
  75 + >启用规则:始终启用
  76 + <EditOutlined
  77 + @click="handleOpenEnableRule"
  78 + class="cursor-pointer ml-4"
  79 + style="font-size: 20px"
  80 + /></p>
  81 + <p class="mt-4 ml-4"
  82 + >详情模板:<EditOutlined
  83 + @click="handleOpenDetailTemplate"
  84 + class="cursor-pointer ml-4"
  85 + style="font-size: 20px"
  86 + /></p>
  87 + <BasicForm @register="dashboardForm" />
  88 + </div>
  89 + </div>
  90 + <div class="w-1/4 flex justify-center">
  91 + <Tooltip title="移除">
  92 + <MinusCircleOutlined
  93 + style="font-size: 25px; color: #305680"
  94 + class="cursor-pointer"
  95 + @click="deleteCondition(index, createIndex)"
  96 + />
  97 + </Tooltip>
  98 + </div>
  99 + </div>
  100 + </template>
  101 + <a-button class="mt-5" @click="addCreateRole(index)"
  102 + ><PlusCircleOutlined />添加清除条件</a-button
  103 + >
66 </CollapseContainer> 104 </CollapseContainer>
67 </template> 105 </template>
68 </div> 106 </div>
@@ -94,11 +132,17 @@ @@ -94,11 +132,17 @@
94 </template> 132 </template>
95 133
96 <script lang="ts"> 134 <script lang="ts">
97 - import { defineComponent, ref, unref, getCurrentInstance } from 'vue'; 135 + import { defineComponent, ref, unref, getCurrentInstance, watch, onMounted } from 'vue';
98 import type { alarmListItem } from '../types/index'; 136 import type { alarmListItem } from '../types/index';
99 import { CollapseContainer } from '/@/components/Container/index'; 137 import { CollapseContainer } from '/@/components/Container/index';
100 import { BasicForm, useForm } from '/@/components/Form'; 138 import { BasicForm, useForm } from '/@/components/Form';
101 - import { step3Schemas, step3HighSetting, step3CreateAlarm, step3ClearAlarm } from './data'; 139 + import {
  140 + step3Schemas,
  141 + step3HighSetting,
  142 + step3CreateAlarm,
  143 + dashboardFormScheme,
  144 + isWhereType,
  145 + } from './data';
102 import { 146 import {
103 DeleteOutlined, 147 DeleteOutlined,
104 MinusCircleOutlined, 148 MinusCircleOutlined,
@@ -130,7 +174,6 @@ @@ -130,7 +174,6 @@
130 emits: ['prev', 'next'], 174 emits: ['prev', 'next'],
131 setup(_, { emit }) { 175 setup(_, { emit }) {
132 const { proxy } = getCurrentInstance(); 176 const { proxy } = getCurrentInstance();
133 - // const isDetailTemplateEnableRuleAlarmRuleConditions = ref(true);  
134 const getChildData1 = ref(null); 177 const getChildData1 = ref(null);
135 const getChildData2 = ref(null); 178 const getChildData2 = ref(null);
136 const getChildData3 = ref(null); 179 const getChildData3 = ref(null);
@@ -138,6 +181,11 @@ @@ -138,6 +181,11 @@
138 const getAllFormData: any = ref({}); 181 const getAllFormData: any = ref({});
139 const alarmss: any = ref([]); 182 const alarmss: any = ref([]);
140 const emptyObj: any = ref({}); 183 const emptyObj: any = ref({});
  184 + const detailObj: any = ref({});
  185 + const ruleObj: any = ref({});
  186 + const enableObj: any = ref({});
  187 + const additionalObj: any = ref({});
  188 + const isWhereTypeValue = ref(null);
141 //告警列表 189 //告警列表
142 let profileData = ref<alarmListItem[]>([]); 190 let profileData = ref<alarmListItem[]>([]);
143 const log = (e) => { 191 const log = (e) => {
@@ -153,25 +201,11 @@ @@ -153,25 +201,11 @@
153 }; 201 };
154 const addAlarmRule = () => { 202 const addAlarmRule = () => {
155 unref(profileData).push({ 203 unref(profileData).push({
156 - // id: Date.now(),  
157 - // messageMode: '',  
158 - // propagate: false,  
159 - // propagateRelationTypes: [''],  
160 configuration: {}, 204 configuration: {},
161 transportConfiguration: {}, 205 transportConfiguration: {},
162 provisionConfiguration: { 206 provisionConfiguration: {
163 provisionDeviceSecret: '', 207 provisionDeviceSecret: '',
164 }, 208 },
165 - // alarms: [  
166 - // {  
167 - // id: Date.now() + Math.random(),  
168 - // alarmVisible: false,  
169 - // addKeyFilterVisible: false,  
170 - // detailVisible: false,  
171 - // detail: '',  
172 - // },  
173 - // ],  
174 - // clearRule: [],  
175 alarms: [ 209 alarms: [
176 { 210 {
177 id: Date.now() + Math.random(), 211 id: Date.now() + Math.random(),
@@ -184,7 +218,13 @@ @@ -184,7 +218,13 @@
184 ], 218 ],
185 }); 219 });
186 }; 220 };
187 - 221 + //Mobile dashboard:
  222 + const [dashboardForm] = useForm({
  223 + labelWidth: 120,
  224 + schemas: dashboardFormScheme,
  225 + showResetButton: false,
  226 + showSubmitButton: false,
  227 + });
188 // 表单部分 报警类型 228 // 表单部分 报警类型
189 const [registerForm, { validate: validateRegisterForm }] = useForm({ 229 const [registerForm, { validate: validateRegisterForm }] = useForm({
190 labelWidth: 120, 230 labelWidth: 120,
@@ -215,17 +255,6 @@ @@ -215,17 +255,6 @@
215 }, 255 },
216 }); 256 });
217 257
218 - // 清除条件表单  
219 - const [registerFormClearAlarm, { validate: validateRegisterFormClearAlarm }] = useForm({  
220 - labelWidth: 120,  
221 - schemas: step3ClearAlarm,  
222 - showResetButton: false,  
223 - showSubmitButton: false,  
224 - actionColOptions: {  
225 - span: 24,  
226 - },  
227 - });  
228 -  
229 // 添加‘创建条件’ 258 // 添加‘创建条件’
230 const addCreateRole = (index: number) => { 259 const addCreateRole = (index: number) => {
231 unref(profileData)[index].alarms.push({ 260 unref(profileData)[index].alarms.push({
@@ -241,49 +270,92 @@ @@ -241,49 +270,92 @@
241 const deleteCondition = (index: number, createIndex: number) => { 270 const deleteCondition = (index: number, createIndex: number) => {
242 profileData.value[index].alarms.splice(createIndex, 1); 271 profileData.value[index].alarms.splice(createIndex, 1);
243 }; 272 };
  273 + watch(isWhereType, (nV) => {
  274 + isWhereTypeValue.value = nV;
  275 + });
244 const getAllFieldsFunc = (v) => { 276 const getAllFieldsFunc = (v) => {
245 - console.log(v); 277 + detailObj.value = v;
246 }; 278 };
247 const getAllFieldsEnabFunc = (v) => { 279 const getAllFieldsEnabFunc = (v) => {
248 - console.log(v); 280 + enableObj.value = v;
  281 + console.log(enableObj.value);
249 }; 282 };
250 const getAllFieldsRuleFunc = (v) => { 283 const getAllFieldsRuleFunc = (v) => {
251 - console.log(v);  
252 - }; 284 + ruleObj.value = v;
  285 + const value = {
  286 + value: ruleObj.value?.value,
  287 + };
  288 + const predicate = {
  289 + predicate: ruleObj.value?.predicate,
  290 + };
  291 + const getCondition = {
  292 + condition: [
  293 + {
  294 + key: {
  295 + type: ruleObj.value?.type,
  296 + key: ruleObj.value?.type,
  297 + },
  298 + valueType: ruleObj.value?.valueType,
  299 + value,
  300 + predicate,
  301 + },
  302 + ],
  303 + };
  304 +
  305 + const spec = {
  306 + spec: ruleObj.value?.spec,
  307 + };
253 308
  309 + const getValueConditon = {
  310 + spec,
  311 + condition: getCondition,
  312 + };
  313 + Object.assign(additionalObj.value, getValueConditon);
  314 + };
254 const handleFormStep3toStep4Next = async () => { 315 const handleFormStep3toStep4Next = async () => {
255 try { 316 try {
256 - // const values = 1; 317 + const scheduleValue = {
  318 + type: enableObj.value.schedule,
  319 + daysOfWeek: enableObj.value.daysOfWeek,
  320 + endsOn: enableObj.value.endsOn,
  321 + startsOn: enableObj.value.startOn,
  322 + timezone: enableObj.value.timezone,
  323 + };
  324 + const getSchedule = {
  325 + schedule: scheduleValue,
  326 + };
  327 + const getAdditionalProp = Object.assign({}, detailObj.value, getSchedule);
  328 + const getScheduleAndAlarmDetails = Object.assign(
  329 + {},
  330 + getAdditionalProp,
  331 + additionalObj.value
  332 + );
  333 + const getIsWhereTypeValue: any = isWhereTypeValue.value;
  334 + const getAdditionalPropObj = {
  335 + [getIsWhereTypeValue]: getScheduleAndAlarmDetails,
  336 + };
  337 + const getCreateRulesAllObj = {
  338 + createRules: getAdditionalPropObj,
  339 + };
257 const valueRegisterForm = await validateRegisterForm(); 340 const valueRegisterForm = await validateRegisterForm();
258 const valueRegisterFormHighSetting = await validateRegisterFormHighSetting(); 341 const valueRegisterFormHighSetting = await validateRegisterFormHighSetting();
259 const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm(); 342 const valueRegisterFormCreateAlarm = await validateRegisterFormCreateAlarm();
260 - const valueRegisterFormClearAlarm = await validateRegisterFormClearAlarm();  
261 const getValueRegisterFormHighSetting = { 343 const getValueRegisterFormHighSetting = {
262 propagate: valueRegisterFormHighSetting?.propagate, 344 propagate: valueRegisterFormHighSetting?.propagate,
263 propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes], 345 propagateRelationTypes: [valueRegisterFormHighSetting?.propagateRelationTypes],
264 }; 346 };
265 - // console.log(proxy.$refs.getChildData1);  
266 - // console.log(proxy.$refs.getChildData2);  
267 - // console.log(proxy.$refs.getChildData3);  
268 - // let getChildValues1 = proxy.$refs.getChildData1.getAllFields();  
269 - // console.log('详情模板', getChildValues1);  
270 - // let getChildValues2 = proxy.$refs.getChildData2.getAllFieldsEnab();  
271 - // console.log('启用规则', getChildValues2);  
272 - // let getChildValues3 = proxy.$refs.getChildData3.getAllFieldsRule();  
273 - // console.log('报警规则条件', getChildValues3);  
274 347
275 - Object.assign(emptyObj.value, valueRegisterForm, getValueRegisterFormHighSetting); 348 + Object.assign(
  349 + emptyObj.value,
  350 + valueRegisterForm,
  351 + getValueRegisterFormHighSetting,
  352 + getCreateRulesAllObj
  353 + );
276 alarmss.value.push(emptyObj.value); 354 alarmss.value.push(emptyObj.value);
277 const getAlarms = { 355 const getAlarms = {
278 alarms: alarmss.value, 356 alarms: alarmss.value,
279 }; 357 };
280 - Object.assign(  
281 - getAllFormData.value,  
282 - getAlarms  
283 - // valueRegisterFormCreateAlarm,  
284 - // valueRegisterFormClearAlarm  
285 - // profileData.value  
286 - ); 358 + Object.assign(getAllFormData.value, getAlarms);
287 console.log('第三步的数据', getAllFormData.value); 359 console.log('第三步的数据', getAllFormData.value);
288 emit('next', getAllFormData.value); 360 emit('next', getAllFormData.value);
289 } catch (error) {} 361 } catch (error) {}
@@ -295,18 +367,25 @@ @@ -295,18 +367,25 @@
295 367
296 const handleOpenDetailTemplate = () => { 368 const handleOpenDetailTemplate = () => {
297 isRuleAlarmRuleConditions.value = 1; 369 isRuleAlarmRuleConditions.value = 1;
298 - openModal1(true); 370 + setTimeout(() => {
  371 + openModal1(true);
  372 + }, 10);
299 }; 373 };
300 const handleOpenEnableRule = () => { 374 const handleOpenEnableRule = () => {
301 isRuleAlarmRuleConditions.value = 2; 375 isRuleAlarmRuleConditions.value = 2;
302 - openModal2(true); 376 + setTimeout(() => {
  377 + openModal2(true);
  378 + }, 10);
303 }; 379 };
304 const handleOpenAlaramRuleConditions = () => { 380 const handleOpenAlaramRuleConditions = () => {
305 isRuleAlarmRuleConditions.value = 3; 381 isRuleAlarmRuleConditions.value = 3;
306 - openModal3(true); 382 + setTimeout(() => {
  383 + openModal3(true);
  384 + }, 10);
307 }; 385 };
308 386
309 return { 387 return {
  388 + dashboardForm,
310 getAllFieldsRuleFunc, 389 getAllFieldsRuleFunc,
311 getAllFieldsEnabFunc, 390 getAllFieldsEnabFunc,
312 getAllFieldsFunc, 391 getAllFieldsFunc,
@@ -331,7 +410,6 @@ @@ -331,7 +410,6 @@
331 registerFormCreateAlarm, 410 registerFormCreateAlarm,
332 addCreateRole, 411 addCreateRole,
333 deleteCondition, 412 deleteCondition,
334 - registerFormClearAlarm,  
335 }; 413 };
336 }, 414 },
337 }); 415 });
1 <template> 1 <template>
2 <div> 2 <div>
3 - <span>请选择告警通知联系人:</span>  
4 - <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> 3 + <!-- <span>请选择告警通知联系人:</span> -->
  4 + <!-- <Tag v-for="(item, index) in 15" closable :key="index"> 冯涛+{{ item }}</Tag> -->
5 <BasicForm :showSubmitButton="false" @register="register" /> 5 <BasicForm :showSubmitButton="false" @register="register" />
6 </div> 6 </div>
7 </template> 7 </template>
8 <script lang="ts"> 8 <script lang="ts">
9 import { defineComponent, ref } from 'vue'; 9 import { defineComponent, ref } from 'vue';
10 - import { Tag } from 'ant-design-vue'; 10 + // import { Tag } from 'ant-design-vue';
11 import { BasicForm, useForm } from '/@/components/Form/index'; 11 import { BasicForm, useForm } from '/@/components/Form/index';
12 import { alertContactsSchemas } from '../cpns/config'; 12 import { alertContactsSchemas } from '../cpns/config';
13 13
14 export default defineComponent({ 14 export default defineComponent({
15 components: { 15 components: {
16 - Tag,  
17 BasicForm, 16 BasicForm,
18 }, 17 },
19 emits: ['prev'], 18 emits: ['prev'],
@@ -41,6 +41,10 @@ @@ -41,6 +41,10 @@
41 { 41 {
42 "id": "highTemperatureAlarmID", 42 "id": "highTemperatureAlarmID",
43 "alarmType": "High Temperature Alarm", 43 "alarmType": "High Temperature Alarm",
  44 + "propagate": true,
  45 + "propagateRelationTypes": [
  46 + "string"
  47 + ],
44 "createRules": { 48 "createRules": {
45 "additionalProp1": { 49 "additionalProp1": {
46 "condition": { 50 "condition": {
@@ -138,11 +142,7 @@ @@ -138,11 +142,7 @@
138 "id": "784f394c-42b6-435a-983c-b7beff2784f9", 142 "id": "784f394c-42b6-435a-983c-b7beff2784f9",
139 "entityType": "DASHBOARD" 143 "entityType": "DASHBOARD"
140 } 144 }
141 - },  
142 - "propagate": true,  
143 - "propagateRelationTypes": [  
144 - "string"  
145 - ] 145 + }
146 } 146 }
147 ] 147 ]
148 }, 148 },
1 { 1 {
2 - "name": "hhhhh", 2 + "name": "设备配置1",
  3 + "description": "设备配置1",
3 "transportType": "COAP", 4 "transportType": "COAP",
4 "profileData": { 5 "profileData": {
5 "alarms": [ 6 "alarms": [
6 { 7 {
7 - "alarmType": "1", 8 + "alarmType": "设备配置1",
8 "propagate": true, 9 "propagate": true,
9 "propagateRelationTypes": [ 10 "propagateRelationTypes": [
10 - "1"  
11 - ] 11 + "设备配置1"
  12 + ],
  13 + "createRules": {
  14 + "WARNING": {
  15 + "alarmDetails": "设备配置1",
  16 + "schedule": {
  17 + "type": "SPECIFIC_TIME"
  18 + },
  19 + "spec": {
  20 + "spec": "HOURS"
  21 + },
  22 + "condition": {
  23 + "condition": [
  24 + {
  25 + "key": {
  26 + "type": "TIME_SERIES",
  27 + "key": "TIME_SERIES"
  28 + },
  29 + "valueType": "CURRENT_DEVICE",
  30 + "value": {
  31 + "value": "设备配置1"
  32 + },
  33 + "predicate": {
  34 + "predicate": "设备配置1"
  35 + }
  36 + }
  37 + ]
  38 + }
  39 + }
  40 + }
12 } 41 }
13 ] 42 ]
14 }, 43 },
15 "alarmProfile": { 44 "alarmProfile": {
16 "alarmContactId": "ce350734-9504-48c2-82d2-277e3fe5583f", 45 "alarmContactId": "ce350734-9504-48c2-82d2-277e3fe5583f",
17 - "messageMode": "DING_TALK_MESSAGE" 46 + "messageMode": "PHONE_MESSAGE"
18 } 47 }
19 } 48 }
  1 +{
  2 + "name": "设备配置",
  3 + "description": "设备配置",
  4 + "transportType": "COAP",
  5 + "profileData": {
  6 + "alarms": [
  7 + {
  8 + "alarmType": "设备配置",
  9 + "propagate": true,
  10 + "propagateRelationTypes": [
  11 + "设备配置"
  12 + ],
  13 + "createRules": {
  14 + "MINOR": {
  15 + "schedule": {
  16 + "type": "SPECIFIC_TIME"
  17 + }
  18 + }
  19 + }
  20 + }
  21 + ]
  22 + },
  23 + "alarmProfile": {
  24 + "alarmContactId": "ce350734-9504-48c2-82d2-277e3fe5583f",
  25 + "messageMode": "DING_TALK_MESSAGE"
  26 + }
  27 +}
1 -import { FormSchema } from '/@/components/Table'; 1 +import { FormSchema, BasicColumn } from '/@/components/Table';
2 2
3 /** 3 /**
4 * 所使用的枚举值 4 * 所使用的枚举值
5 */ 5 */
6 6
7 export enum TriggerEnum { 7 export enum TriggerEnum {
8 - IS_DEVICE_ACT = 'DEVICE_ACT',  
9 - IS_TIME_ACT = 'TIME_ACT',  
10 - IS_SCENE_ACT = 'SCENE_ACT', 8 + IS_DEVICE_ACT = '',
  9 + IS_TIME_ACT = 'TIME_SERIES',
  10 + IS_SCENE_ACT = 'CONSTANT',
11 } 11 }
12 12
13 export const isShiDu = (type: string) => { 13 export const isShiDu = (type: string) => {
@@ -21,101 +21,114 @@ export const isTimeAll = (type: string) => { @@ -21,101 +21,114 @@ export const isTimeAll = (type: string) => {
21 return type === TriggerEnum.IS_SCENE_ACT; 21 return type === TriggerEnum.IS_SCENE_ACT;
22 }; 22 };
23 23
  24 +export const columns: BasicColumn[] = [
  25 + {
  26 + title: '键名',
  27 + dataIndex: 'key',
  28 + width: 200,
  29 + },
  30 + {
  31 + title: '键类型',
  32 + dataIndex: 'value',
  33 + width: 200,
  34 + },
  35 +];
  36 +
24 export const formSchema: FormSchema[] = [ 37 export const formSchema: FormSchema[] = [
25 { 38 {
26 - field: 'detail', 39 + field: 'type',
27 label: '条件类型', 40 label: '条件类型',
28 colProps: { span: 24 }, 41 colProps: { span: 24 },
29 component: 'Select', 42 component: 'Select',
30 componentProps: { 43 componentProps: {
31 placeholder: '请选择报警日程表', 44 placeholder: '请选择报警日程表',
32 options: [ 45 options: [
33 - { label: '简单', value: 'DEVICE_ACT' },  
34 - { label: '持续时间', value: 'TIME_ACT' },  
35 - { label: '重复', value: 'SCENE_ACT' }, 46 + { label: '简单', value: '' },
  47 + { label: '持续时间', value: 'TIME_SERIES' },
  48 + { label: '重复', value: 'CONSTANT' },
36 ], 49 ],
37 }, 50 },
38 }, 51 },
39 { 52 {
40 - field: 'type1', 53 + field: 'valueType',
41 label: '动态源类型', 54 label: '动态源类型',
42 colProps: { span: 24 }, 55 colProps: { span: 24 },
43 component: 'Select', 56 component: 'Select',
44 componentProps: { 57 componentProps: {
45 placeholder: '请选择动态源类型', 58 placeholder: '请选择动态源类型',
46 options: [ 59 options: [
47 - { label: '无动态值', value: 'second' },  
48 - { label: '当前租户', value: 'minute' },  
49 - { label: '当前客户', value: 'hour' },  
50 - { label: '当前设备', value: 'day' }, 60 + { label: '无动态值', value: '' },
  61 + { label: '当前租户', value: 'CURRENT_CUSTOMER' },
  62 + { label: '当前客户', value: 'CURRENT_CUSTOMER' },
  63 + { label: '当前设备', value: 'CURRENT_DEVICE' },
51 ], 64 ],
52 }, 65 },
53 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 66 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
54 }, 67 },
55 { 68 {
56 - field: 'time1', 69 + field: 'value',
57 label: '源属性', 70 label: '源属性',
58 colProps: { span: 24 }, 71 colProps: { span: 24 },
59 component: 'Input', 72 component: 'Input',
60 componentProps: { 73 componentProps: {
61 placeholder: '源属性', 74 placeholder: '源属性',
62 }, 75 },
63 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 76 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
64 }, 77 },
65 { 78 {
66 - field: 'type1', 79 + field: 'valueType',
67 label: '动态源类型', 80 label: '动态源类型',
68 colProps: { span: 24 }, 81 colProps: { span: 24 },
69 component: 'Select', 82 component: 'Select',
70 componentProps: { 83 componentProps: {
71 placeholder: '请选择动态源类型', 84 placeholder: '请选择动态源类型',
72 options: [ 85 options: [
73 - { label: '无动态值', value: 'second' },  
74 - { label: '当前租户', value: 'minute' },  
75 - { label: '当前客户', value: 'hour' },  
76 - { label: '当前设备', value: 'day' }, 86 + { label: '无动态值', value: '' },
  87 + { label: '当前租户', value: 'CURRENT_TENANT' },
  88 + { label: '当前客户', value: 'CURRENT_CUSTOMER' },
  89 + { label: '当前设备', value: 'CURRENT_DEVICE' },
77 ], 90 ],
78 }, 91 },
79 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 92 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
80 }, 93 },
81 { 94 {
82 - field: 'time1', 95 + field: 'value',
83 label: '源属性', 96 label: '源属性',
84 colProps: { span: 24 }, 97 colProps: { span: 24 },
85 component: 'Input', 98 component: 'Input',
86 componentProps: { 99 componentProps: {
87 placeholder: '源属性', 100 placeholder: '源属性',
88 }, 101 },
89 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 102 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
90 }, 103 },
91 { 104 {
92 - field: 'time', 105 + field: 'predicate',
93 label: '持续时间值', 106 label: '持续时间值',
94 colProps: { span: 24 }, 107 colProps: { span: 24 },
95 component: 'Input', 108 component: 'Input',
96 componentProps: { 109 componentProps: {
97 placeholder: '请输入持续时间值', 110 placeholder: '请输入持续时间值',
98 }, 111 },
99 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 112 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
100 }, 113 },
101 { 114 {
102 - field: 'r', 115 + field: 'spec',
103 label: '时间单位', 116 label: '时间单位',
104 colProps: { span: 24 }, 117 colProps: { span: 24 },
105 component: 'Select', 118 component: 'Select',
106 componentProps: { 119 componentProps: {
107 placeholder: '请选择报警日程表', 120 placeholder: '请选择报警日程表',
108 options: [ 121 options: [
109 - { label: '秒', value: 'second' },  
110 - { label: '分钟', value: 'minute' },  
111 - { label: '小时', value: 'hour' },  
112 - { label: '天', value: 'day' }, 122 + { label: '秒', value: 'SECONDS' },
  123 + { label: '分钟', value: 'MINUTES' },
  124 + { label: '小时', value: 'HOURS' },
  125 + { label: '天', value: 'DAYS' },
113 ], 126 ],
114 }, 127 },
115 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 128 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
116 }, 129 },
117 { 130 {
118 - field: 'time', 131 + field: '',
119 label: '事件计数值必填', 132 label: '事件计数值必填',
120 colProps: { span: 24 }, 133 colProps: { span: 24 },
121 component: 'Input', 134 component: 'Input',
@@ -123,6 +136,6 @@ export const formSchema: FormSchema[] = [ @@ -123,6 +136,6 @@ export const formSchema: FormSchema[] = [
123 placeholder: '请输入事件计数值必填', 136 placeholder: '请输入事件计数值必填',
124 }, 137 },
125 rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }], 138 rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }],
126 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 139 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
127 }, 140 },
128 ]; 141 ];
  1 +import { FormSchema } from '/@/components/Table';
  2 +
  3 +/**
  4 + * 所使用的枚举值
  5 + */
  6 +
  7 +export enum TriggerEnum {
  8 + IS_DEVICE_ACT = '1',
  9 + IS_TIME_ACT = '2',
  10 + IS_SCENE_ACT = '3',
  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: 'default',
  27 + label: '键类型',
  28 + colProps: { span: 24 },
  29 + component: 'Select',
  30 + componentProps: {
  31 + placeholder: '请选择键类型',
  32 + options: [
  33 + { label: '属性', value: '1' },
  34 + { label: 'Timeseries', value: '2' },
  35 + { label: '常量', value: '3' },
  36 + ],
  37 + },
  38 + },
  39 + {
  40 + field: '2',
  41 + label: '键名',
  42 + colProps: { span: 24 },
  43 + component: 'Select',
  44 + componentProps: {
  45 + placeholder: '请选择键名',
  46 + options: [
  47 + { label: 'active', value: '' },
  48 + { label: 'inactivityAlarmTime', value: '' },
  49 + { label: 'lastActivityTime', value: '' },
  50 + { label: 'lastConnectTime', value: '' },
  51 + { label: 'lastDisconnectTime', value: '' },
  52 + ],
  53 + },
  54 + ifShow: ({ values }) => isShiDu(Reflect.get(values, 'default')),
  55 + },
  56 + {
  57 + field: '21',
  58 + label: '键名',
  59 + colProps: { span: 24 },
  60 + component: 'Select',
  61 + componentProps: {
  62 + placeholder: '请选择键名',
  63 + options: [
  64 + { label: 'CO2', value: '' },
  65 + { label: 'temp', value: '' },
  66 + { label: 'temp', value: '' },
  67 + ],
  68 + },
  69 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'default')),
  70 + },
  71 + {
  72 + field: '22',
  73 + label: '键名',
  74 + colProps: { span: 24 },
  75 + component: 'Input',
  76 + componentProps: {
  77 + placeholder: '请输入键名',
  78 + },
  79 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'default')),
  80 + },
  81 + {
  82 + field: '3',
  83 + label: '值类型',
  84 + colProps: { span: 24 },
  85 + component: 'Select',
  86 + componentProps: {
  87 + placeholder: '请选择值类型',
  88 + options: [
  89 + { label: '字符串', value: '' },
  90 + { label: '数字', value: '' },
  91 + { label: '布尔值', value: '' },
  92 + { label: '日期时间', value: '' },
  93 + ],
  94 + },
  95 + },
  96 +];
  1 +<template>
  2 + <BasicModal
  3 + v-bind="$attrs"
  4 + width="55rem"
  5 + @register="register"
  6 + :title="getTitle"
  7 + @ok="handleSubmit"
  8 + @cancel="handleCancel"
  9 + >
  10 + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
  11 + </BasicModal>
  12 +</template>
  13 +<script lang="ts">
  14 + import { defineComponent, ref, computed, unref } from 'vue';
  15 + import { BasicModal, useModalInner } from '/@/components/Modal';
  16 + import { BasicForm, useForm } from '/@/components/Form';
  17 + import { formSchema } from './config';
  18 + // import { useMessage } from '/@/hooks/web/useMessage';
  19 +
  20 + export default defineComponent({
  21 + name: 'index',
  22 + components: { BasicModal, BasicForm },
  23 + emits: ['success', 'register'],
  24 + setup() {
  25 + // const { createMessage } = useMessage();
  26 + const isUpdate = ref(true);
  27 + const getTitle = computed(() => (!unref(isUpdate) ? '新增键名筛选器' : '编辑键名筛选器'));
  28 + const [register] = useModalInner((data) => {
  29 + isUpdate.value = !!data?.isUpdate;
  30 + });
  31 + const [registerForm] = useForm({
  32 + labelWidth: 120,
  33 + schemas: formSchema,
  34 + });
  35 + const handleSubmit = () => {
  36 + console.log(1);
  37 + };
  38 + const handleCancel = () => {
  39 + console.log(1);
  40 + };
  41 + return {
  42 + registerForm,
  43 + handleCancel,
  44 + handleSubmit,
  45 + register,
  46 + getTitle,
  47 + };
  48 + },
  49 + });
  50 +</script>
@@ -6,50 +6,107 @@ @@ -6,50 +6,107 @@
6 :title="getTitle" 6 :title="getTitle"
7 @ok="handleSubmit" 7 @ok="handleSubmit"
8 > 8 >
  9 + <CollapseContainer title="键名筛选器" class="border mb-8">
  10 + <BasicTable @register="registerTable">
  11 + <template #toolbar>
  12 + <a-button type="primary" @click="handleAddKey"> 新增键名筛选器 </a-button>
  13 + </template>
  14 + <template #action="{ record }">
  15 + <TableAction
  16 + :actions="[
  17 + {
  18 + label: '编辑',
  19 + icon: 'clarity:note-edit-line',
  20 + onClick: handleEdit.bind(null, record),
  21 + },
  22 + {
  23 + label: '删除',
  24 + icon: 'ant-design:delete-outlined',
  25 + color: 'error',
  26 + popConfirm: {
  27 + title: '是否确认删除',
  28 + confirm: handleDelete.bind(null, record),
  29 + },
  30 + },
  31 + ]"
  32 + />
  33 + </template>
  34 + </BasicTable>
  35 + </CollapseContainer>
  36 + <CollapseContainer title="筛选器预览" class="border mb-8"><div>1</div> </CollapseContainer>
9 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" /> 37 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
10 </BasicModal> 38 </BasicModal>
  39 + <KeyValueModal @register="registerModal" />
11 </template> 40 </template>
12 <script lang="ts"> 41 <script lang="ts">
13 import { defineComponent, ref, computed, unref } from 'vue'; 42 import { defineComponent, ref, computed, unref } from 'vue';
14 import { BasicModal, useModalInner } from '/@/components/Modal'; 43 import { BasicModal, useModalInner } from '/@/components/Modal';
15 import { BasicForm, useForm } from '/@/components/Form'; 44 import { BasicForm, useForm } from '/@/components/Form';
16 - import { formSchema } from './config'; 45 + import { formSchema, columns } from './config';
  46 + import { CollapseContainer } from '/@/components/Container/index';
  47 + import { BasicTable, useTable } from '/@/components/Table';
  48 + import { useModal } from '/@/components/Modal';
  49 + import KeyValueModal from './cpns/index.vue';
17 50
18 export default defineComponent({ 51 export default defineComponent({
19 name: 'DetailTemplate', 52 name: 'DetailTemplate',
20 components: { 53 components: {
  54 + KeyValueModal,
21 BasicModal, 55 BasicModal,
22 BasicForm, 56 BasicForm,
  57 + CollapseContainer,
  58 + BasicTable,
23 }, 59 },
24 emits: ['success', 'register', 'getAllFieldsRule'], 60 emits: ['success', 'register', 'getAllFieldsRule'],
25 setup(_, { emit }) { 61 setup(_, { emit }) {
26 - // const getValueData: any = ref({});  
27 -  
28 const isUpdate = ref(true); 62 const isUpdate = ref(true);
29 const [registerForm, { getFieldsValue }] = useForm({ 63 const [registerForm, { getFieldsValue }] = useForm({
30 labelWidth: 120, 64 labelWidth: 120,
31 schemas: formSchema, 65 schemas: formSchema,
32 }); 66 });
  67 + const [registerModal, { openModal }] = useModal();
  68 +
33 const getTitle = computed(() => (!unref(isUpdate) ? '添加报警规则条件' : '编辑报警规则条件')); 69 const getTitle = computed(() => (!unref(isUpdate) ? '添加报警规则条件' : '编辑报警规则条件'));
34 const [register, { closeModal }] = useModalInner((data) => { 70 const [register, { closeModal }] = useModalInner((data) => {
35 isUpdate.value = !!data?.isUpdate; 71 isUpdate.value = !!data?.isUpdate;
36 }); 72 });
  73 + const [registerTable] = useTable({
  74 + title: '键名筛选器',
  75 + // api: deviceConfigGetQuery,
  76 + columns,
  77 + bordered: true,
  78 + showIndexColumn: false,
  79 + actionColumn: {
  80 + width: 180,
  81 + title: '操作',
  82 + dataIndex: 'action',
  83 + slots: { customRender: 'action' },
  84 + },
  85 + });
37 const handleSubmit = () => { 86 const handleSubmit = () => {
38 const values = getFieldsValue(); 87 const values = getFieldsValue();
39 emit('getAllFieldsRule', values); 88 emit('getAllFieldsRule', values);
40 - // console.log(1);  
41 - // let getV = {};  
42 - // getAllFieldsRule(getV);  
43 closeModal(); 89 closeModal();
44 }; 90 };
45 - // function getAllFieldsRule(getV) {  
46 - // const values = getFieldsValue();  
47 - // getValueData.value = values;  
48 - // getV = getValueData.value;  
49 - // return getV;  
50 - // } 91 + const handleAddKey = () => {
  92 + openModal(true, {
  93 + isUpdate: false,
  94 + });
  95 + };
  96 + const handleEdit = () => {
  97 + openModal(true, {
  98 + isUpdate: true,
  99 + });
  100 + };
  101 + const handleDelete = () => {
  102 + console.log(1);
  103 + };
51 return { 104 return {
52 - // getAllFieldsRule, 105 + handleEdit,
  106 + handleDelete,
  107 + registerModal,
  108 + registerTable,
  109 + handleAddKey,
53 registerForm, 110 registerForm,
54 handleSubmit, 111 handleSubmit,
55 register, 112 register,
@@ -2,7 +2,7 @@ import { FormSchema } from '/@/components/Table'; @@ -2,7 +2,7 @@ import { FormSchema } from '/@/components/Table';
2 2
3 export const formSchema: FormSchema[] = [ 3 export const formSchema: FormSchema[] = [
4 { 4 {
5 - field: 'detail', 5 + field: 'alarmDetails',
6 label: '报警详细信息', 6 label: '报警详细信息',
7 colProps: { span: 24 }, 7 colProps: { span: 24 },
8 required: true, 8 required: true,
@@ -5,9 +5,9 @@ import { FormSchema } from '/@/components/Table'; @@ -5,9 +5,9 @@ import { FormSchema } from '/@/components/Table';
5 */ 5 */
6 6
7 export enum TriggerEnum { 7 export enum TriggerEnum {
8 - IS_DEVICE_ACT = 'DEVICE_ACT',  
9 - IS_TIME_ACT = 'TIME_ACT',  
10 - IS_SCENE_ACT = 'SCENE_ACT', 8 + IS_DEVICE_ACT = 'ANY_TIME',
  9 + IS_TIME_ACT = 'SPECIFIC_TIME',
  10 + IS_SCENE_ACT = 'CUSTOM',
11 } 11 }
12 12
13 export const isShiDu = (type: string) => { 13 export const isShiDu = (type: string) => {
@@ -23,7 +23,7 @@ export const isTimeAll = (type: string) => { @@ -23,7 +23,7 @@ export const isTimeAll = (type: string) => {
23 23
24 export const formSchema: FormSchema[] = [ 24 export const formSchema: FormSchema[] = [
25 { 25 {
26 - field: 'detail', 26 + field: 'schedule',
27 label: '报警日程表', 27 label: '报警日程表',
28 colProps: { span: 24 }, 28 colProps: { span: 24 },
29 required: true, 29 required: true,
@@ -31,225 +31,231 @@ export const formSchema: FormSchema[] = [ @@ -31,225 +31,231 @@ export const formSchema: FormSchema[] = [
31 componentProps: { 31 componentProps: {
32 placeholder: '请选择报警日程表', 32 placeholder: '请选择报警日程表',
33 options: [ 33 options: [
34 - { label: '始终启用', value: 'DEVICE_ACT' },  
35 - { label: '定时启用', value: 'TIME_ACT' },  
36 - { label: '自定义启用', value: 'SCENE_ACT' }, 34 + { label: '始终启用', value: 'ANY_TIME' },
  35 + { label: '定时启用', value: 'SPECIFIC_TIME' },
  36 + { label: '自定义启用', value: 'CUSTOM' },
37 ], 37 ],
38 }, 38 },
39 }, 39 },
40 { 40 {
41 - field: 'time', 41 + field: 'timezone',
42 label: '时区', 42 label: '时区',
43 colProps: { span: 24 }, 43 colProps: { span: 24 },
44 required: true, 44 required: true,
45 - component: 'Input', 45 + component: 'Select',
46 componentProps: { 46 componentProps: {
47 - placeholder: 'Asia/Shanghai (UTC+08:00)', 47 + placeholder: '请选择时区',
  48 + options: [
  49 + { label: 'Africa/Abidjan (UTC+00:00)', value: 'Africa/Abidjan (UTC+00:00)' },
  50 + { label: 'Africa/Accra (UTC+00:00)', value: 'Africa/Accra (UTC+00:00)' },
  51 + { label: 'Africa/Addis Ababa (UTC+03:00)', value: 'Africa/Addis Ababa (UTC+03:00)' },
  52 + { label: 'Africa/Asmara (UTC+03:00)', value: 'Africa/Asmara (UTC+03:00)' },
  53 + ],
48 }, 54 },
49 ifShow: ({ values }) => 55 ifShow: ({ values }) =>
50 - isWenDu(Reflect.get(values, 'detail')) || isTimeAll(Reflect.get(values, 'detail')), 56 + isWenDu(Reflect.get(values, 'schedule')) || isTimeAll(Reflect.get(values, 'schedule')),
51 }, 57 },
52 58
53 { 59 {
54 - field: 'data1', 60 + field: 'daysOfWeek',
55 component: 'Checkbox', 61 component: 'Checkbox',
56 label: '星期一', 62 label: '星期一',
57 colProps: { 63 colProps: {
58 span: 8, 64 span: 8,
59 }, 65 },
60 renderComponentContent: '', 66 renderComponentContent: '',
61 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 67 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
62 }, 68 },
63 { 69 {
64 - field: 'time1', 70 + field: 'startsOn',
65 component: 'TimePicker', 71 component: 'TimePicker',
66 label: '时间选择', 72 label: '时间选择',
67 colProps: { 73 colProps: {
68 span: 8, 74 span: 8,
69 }, 75 },
70 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 76 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
71 }, 77 },
72 { 78 {
73 - field: 'time2', 79 + field: 'endsOn',
74 component: 'TimePicker', 80 component: 'TimePicker',
75 label: '时间选择', 81 label: '时间选择',
76 colProps: { 82 colProps: {
77 span: 8, 83 span: 8,
78 }, 84 },
79 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 85 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
80 }, 86 },
81 87
82 { 88 {
83 - field: 'data2', 89 + field: 'daysOfWeek',
84 component: 'Checkbox', 90 component: 'Checkbox',
85 label: '星期二', 91 label: '星期二',
86 colProps: { 92 colProps: {
87 span: 8, 93 span: 8,
88 }, 94 },
89 renderComponentContent: '', 95 renderComponentContent: '',
90 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 96 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
91 }, 97 },
92 { 98 {
93 - field: 'time3', 99 + field: 'startsOn',
94 component: 'TimePicker', 100 component: 'TimePicker',
95 label: '时间选择', 101 label: '时间选择',
96 colProps: { 102 colProps: {
97 span: 8, 103 span: 8,
98 }, 104 },
99 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 105 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
100 }, 106 },
101 { 107 {
102 - field: 'time4', 108 + field: 'endsOn',
103 component: 'TimePicker', 109 component: 'TimePicker',
104 label: '时间选择', 110 label: '时间选择',
105 colProps: { 111 colProps: {
106 span: 8, 112 span: 8,
107 }, 113 },
108 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 114 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
109 }, 115 },
110 { 116 {
111 - field: 'data3', 117 + field: 'daysOfWeek',
112 component: 'Checkbox', 118 component: 'Checkbox',
113 label: '星期三', 119 label: '星期三',
114 colProps: { 120 colProps: {
115 span: 8, 121 span: 8,
116 }, 122 },
117 renderComponentContent: '', 123 renderComponentContent: '',
118 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 124 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
119 }, 125 },
120 { 126 {
121 - field: 'time5', 127 + field: 'startsOn',
122 component: 'TimePicker', 128 component: 'TimePicker',
123 label: '时间选择', 129 label: '时间选择',
124 colProps: { 130 colProps: {
125 span: 8, 131 span: 8,
126 }, 132 },
127 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 133 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
128 }, 134 },
129 { 135 {
130 - field: 'time6', 136 + field: 'endsOn',
131 component: 'TimePicker', 137 component: 'TimePicker',
132 label: '时间选择', 138 label: '时间选择',
133 colProps: { 139 colProps: {
134 span: 8, 140 span: 8,
135 }, 141 },
136 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 142 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
137 }, 143 },
138 { 144 {
139 - field: 'data4', 145 + field: 'daysOfWeek',
140 component: 'Checkbox', 146 component: 'Checkbox',
141 label: '星期四', 147 label: '星期四',
142 colProps: { 148 colProps: {
143 span: 8, 149 span: 8,
144 }, 150 },
145 renderComponentContent: '', 151 renderComponentContent: '',
146 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 152 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
147 }, 153 },
148 { 154 {
149 - field: 'time7', 155 + field: 'startsOn',
150 component: 'TimePicker', 156 component: 'TimePicker',
151 label: '时间选择', 157 label: '时间选择',
152 colProps: { 158 colProps: {
153 span: 8, 159 span: 8,
154 }, 160 },
155 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 161 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
156 }, 162 },
157 { 163 {
158 - field: 'time8', 164 + field: 'endsOn',
159 component: 'TimePicker', 165 component: 'TimePicker',
160 label: '时间选择', 166 label: '时间选择',
161 colProps: { 167 colProps: {
162 span: 8, 168 span: 8,
163 }, 169 },
164 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 170 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
165 }, 171 },
166 { 172 {
167 - field: 'data5', 173 + field: 'daysOfWeek',
168 component: 'Checkbox', 174 component: 'Checkbox',
169 label: '星期五', 175 label: '星期五',
170 colProps: { 176 colProps: {
171 span: 8, 177 span: 8,
172 }, 178 },
173 renderComponentContent: '', 179 renderComponentContent: '',
174 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 180 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
175 }, 181 },
176 { 182 {
177 - field: 'time9', 183 + field: 'startsOn',
178 component: 'TimePicker', 184 component: 'TimePicker',
179 label: '时间选择', 185 label: '时间选择',
180 colProps: { 186 colProps: {
181 span: 8, 187 span: 8,
182 }, 188 },
183 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 189 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
184 }, 190 },
185 { 191 {
186 - field: 'time33', 192 + field: 'endsOn',
187 component: 'TimePicker', 193 component: 'TimePicker',
188 label: '时间选择', 194 label: '时间选择',
189 colProps: { 195 colProps: {
190 span: 8, 196 span: 8,
191 }, 197 },
192 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 198 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
193 }, 199 },
194 { 200 {
195 - field: 'data6', 201 + field: 'daysOfWeek',
196 component: 'Checkbox', 202 component: 'Checkbox',
197 label: '星期六', 203 label: '星期六',
198 colProps: { 204 colProps: {
199 span: 8, 205 span: 8,
200 }, 206 },
201 renderComponentContent: '', 207 renderComponentContent: '',
202 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 208 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
203 }, 209 },
204 { 210 {
205 - field: 'time333', 211 + field: 'startsOn',
206 component: 'TimePicker', 212 component: 'TimePicker',
207 label: '时间选择', 213 label: '时间选择',
208 colProps: { 214 colProps: {
209 span: 8, 215 span: 8,
210 }, 216 },
211 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 217 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
212 }, 218 },
213 { 219 {
214 - field: 'time131', 220 + field: 'endsOn',
215 component: 'TimePicker', 221 component: 'TimePicker',
216 label: '时间选择', 222 label: '时间选择',
217 colProps: { 223 colProps: {
218 span: 8, 224 span: 8,
219 }, 225 },
220 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 226 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
221 }, 227 },
222 { 228 {
223 - field: 'data7', 229 + field: 'daysOfWeek',
224 component: 'Checkbox', 230 component: 'Checkbox',
225 label: '星期七', 231 label: '星期七',
226 colProps: { 232 colProps: {
227 span: 8, 233 span: 8,
228 }, 234 },
229 renderComponentContent: '', 235 renderComponentContent: '',
230 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 236 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
231 }, 237 },
232 { 238 {
233 - field: 'time3423', 239 + field: 'startsOn',
234 component: 'TimePicker', 240 component: 'TimePicker',
235 label: '时间选择', 241 label: '时间选择',
236 colProps: { 242 colProps: {
237 span: 8, 243 span: 8,
238 }, 244 },
239 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 245 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
240 }, 246 },
241 { 247 {
242 - field: 'time3431', 248 + field: 'endsOn',
243 component: 'TimePicker', 249 component: 'TimePicker',
244 label: '时间选择', 250 label: '时间选择',
245 colProps: { 251 colProps: {
246 span: 8, 252 span: 8,
247 }, 253 },
248 - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')), 254 + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'schedule')),
249 }, 255 },
250 256
251 { 257 {
252 - field: 'weekday', 258 + field: 'daysOfWeek',
253 component: 'CheckboxGroup', 259 component: 'CheckboxGroup',
254 label: '天', 260 label: '天',
255 colProps: { 261 colProps: {
@@ -293,24 +299,24 @@ export const formSchema: FormSchema[] = [ @@ -293,24 +299,24 @@ export const formSchema: FormSchema[] = [
293 }, 299 },
294 ], 300 ],
295 }, 301 },
296 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 302 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')),
297 }, 303 },
298 { 304 {
299 - field: 'timerrw', 305 + field: 'startsOn',
300 component: 'TimePicker', 306 component: 'TimePicker',
301 label: '时间选择', 307 label: '时间选择',
302 colProps: { 308 colProps: {
303 span: 8, 309 span: 8,
304 }, 310 },
305 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 311 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')),
306 }, 312 },
307 { 313 {
308 - field: 'timewwq', 314 + field: 'endsOn',
309 component: 'TimePicker', 315 component: 'TimePicker',
310 label: '时间选择', 316 label: '时间选择',
311 colProps: { 317 colProps: {
312 span: 8, 318 span: 8,
313 }, 319 },
314 - ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')), 320 + ifShow: ({ values }) => isWenDu(Reflect.get(values, 'schedule')),
315 }, 321 },
316 ]; 322 ];
@@ -3,6 +3,7 @@ import { findDictItemByCode } from '/@/api/system/dict'; @@ -3,6 +3,7 @@ import { findDictItemByCode } from '/@/api/system/dict';
3 // import { getOrganizationList } from '/@/api/system/system'; 3 // import { getOrganizationList } from '/@/api/system/system';
4 // import { copyTransFun } from '/@/utils/fnUtils'; 4 // import { copyTransFun } from '/@/utils/fnUtils';
5 import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; 5 import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi';
  6 +import { ref } from 'vue';
6 7
7 export const step1Schemas: FormSchema[] = [ 8 export const step1Schemas: FormSchema[] = [
8 { 9 {
@@ -108,35 +109,40 @@ export const step3HighSetting: FormSchema[] = [ @@ -108,35 +109,40 @@ export const step3HighSetting: FormSchema[] = [
108 }, 109 },
109 ]; 110 ];
110 111
  112 +export const isWhereType = ref(null);
  113 +
111 export const step3CreateAlarm: FormSchema[] = [ 114 export const step3CreateAlarm: FormSchema[] = [
112 { 115 {
113 - field: 'alarmType', 116 + field: '',
114 component: 'Select', 117 component: 'Select',
115 label: '严重程度', 118 label: '严重程度',
116 componentProps: { 119 componentProps: {
117 placeholder: '请选择严重程度', 120 placeholder: '请选择严重程度',
118 options: [ 121 options: [
119 { 122 {
120 - value: '1', 123 + value: 'CRITICAL',
121 label: '危险', 124 label: '危险',
122 }, 125 },
123 { 126 {
124 - value: '2', 127 + value: 'MAJOR',
125 label: '重要', 128 label: '重要',
126 }, 129 },
127 { 130 {
128 - value: '3', 131 + value: 'MINOR',
129 label: '次要', 132 label: '次要',
130 }, 133 },
131 { 134 {
132 - value: '4', 135 + value: 'WARNING',
133 label: '警告', 136 label: '警告',
134 }, 137 },
135 { 138 {
136 - value: '5', 139 + value: 'INDETERMINATE',
137 label: '不确定', 140 label: '不确定',
138 }, 141 },
139 ], 142 ],
  143 + onChange: (v) => {
  144 + isWhereType.value = v ? v : 'INDETERMINATE';
  145 + },
140 }, 146 },
141 }, 147 },
142 ]; 148 ];
@@ -151,3 +157,19 @@ export const step3ClearAlarm: FormSchema[] = [ @@ -151,3 +157,19 @@ export const step3ClearAlarm: FormSchema[] = [
151 // }, 157 // },
152 // }, 158 // },
153 ]; 159 ];
  160 +
  161 +export const dashboardFormScheme: FormSchema[] = [
  162 + {
  163 + field: 'dashboardId',
  164 + component: 'Select',
  165 + label: 'Mobile dashboard:',
  166 + componentProps: {
  167 + placeholder: '请选择Mobile dashboard',
  168 + options: [
  169 + { label: 'DASHBOARD', value: 'DASHBOARD' },
  170 + { label: 'DASHBOARD1', value: 'DASHBOARD' },
  171 + { label: 'DASHBOARD2', value: 'DASHBOARD' },
  172 + ],
  173 + },
  174 + },
  175 +];