Showing
7 changed files
with
70 additions
and
27 deletions
@@ -99,6 +99,7 @@ | @@ -99,6 +99,7 @@ | ||
99 | import Action from './cpns/Action.vue'; | 99 | import Action from './cpns/Action.vue'; |
100 | import { useUserStore } from '/@/store/modules/user'; | 100 | import { useUserStore } from '/@/store/modules/user'; |
101 | import { findOperation } from './config/formatData.ts'; | 101 | import { findOperation } from './config/formatData.ts'; |
102 | + import { formatToDateTime } from '/@/utils/dateUtil'; | ||
102 | 103 | ||
103 | const emit = defineEmits(['register', 'success']); | 104 | const emit = defineEmits(['register', 'success']); |
104 | 105 | ||
@@ -230,12 +231,25 @@ | @@ -230,12 +231,25 @@ | ||
230 | trigger.triggerCondition.condition.condition.forEach((item, index) => { | 231 | trigger.triggerCondition.condition.condition.forEach((item, index) => { |
231 | const formItem = { | 232 | const formItem = { |
232 | operation: item.predicate.operation, | 233 | operation: item.predicate.operation, |
233 | - value: String(item.predicate.value.defaultValue), | 234 | + value: |
235 | + valueType === 'DATE_TIME' | ||
236 | + ? formatToDateTime( | ||
237 | + Number(item.predicate.value.defaultValue), | ||
238 | + 'YYYY-MM-DD HH:mm:ss' | ||
239 | + ) | ||
240 | + : String(item.predicate.value.defaultValue), | ||
241 | + ignoreCase: item.valueType === 'STRING' ? item.predicate.ignoreCase : undefined, | ||
234 | }; | 242 | }; |
235 | richTextList.push({ | 243 | richTextList.push({ |
236 | // 查询中文操作符 | 244 | // 查询中文操作符 |
237 | operation: findOperation(valueType, item.predicate.operation).label, | 245 | operation: findOperation(valueType, item.predicate.operation).label, |
238 | - value: String(item.predicate.value.defaultValue), | 246 | + value: |
247 | + valueType === 'DATE_TIME' | ||
248 | + ? formatToDateTime( | ||
249 | + Number(item.predicate.value.defaultValue), | ||
250 | + 'YYYY-MM-DD HH:mm:ss' | ||
251 | + ) | ||
252 | + : String(item.predicate.value.defaultValue), | ||
239 | attribute: trigger.triggerCondition?.condition.condition[0]?.key?.key, | 253 | attribute: trigger.triggerCondition?.condition.condition[0]?.key?.key, |
240 | }); | 254 | }); |
241 | ConditionScreeningForm.value[index].setFieldsValue(formItem); | 255 | ConditionScreeningForm.value[index].setFieldsValue(formItem); |
@@ -289,12 +303,25 @@ | @@ -289,12 +303,25 @@ | ||
289 | condition.triggerCondition.condition.condition.forEach((item, index) => { | 303 | condition.triggerCondition.condition.condition.forEach((item, index) => { |
290 | const formItem = { | 304 | const formItem = { |
291 | operation: item.predicate.operation, | 305 | operation: item.predicate.operation, |
292 | - value: String(item.predicate.value.defaultValue), | 306 | + value: |
307 | + valueType === 'DATE_TIME' | ||
308 | + ? formatToDateTime( | ||
309 | + Number(item.predicate.value.defaultValue), | ||
310 | + 'YYYY-MM-DD HH:mm:ss' | ||
311 | + ) | ||
312 | + : String(item.predicate.value.defaultValue), | ||
313 | + ignoreCase: item.valueType === 'STRING' ? item.predicate.ignoreCase : undefined, | ||
293 | }; | 314 | }; |
294 | richTextList.push({ | 315 | richTextList.push({ |
295 | // 查询中文操作符 | 316 | // 查询中文操作符 |
296 | operation: findOperation(valueType, item.predicate.operation).label, | 317 | operation: findOperation(valueType, item.predicate.operation).label, |
297 | - value: String(item.predicate.value.defaultValue), | 318 | + value: |
319 | + valueType === 'DATE_TIME' | ||
320 | + ? formatToDateTime( | ||
321 | + Number(item.predicate.value.defaultValue), | ||
322 | + 'YYYY-MM-DD HH:mm:ss' | ||
323 | + ) | ||
324 | + : String(item.predicate.value.defaultValue), | ||
298 | attribute: condition.triggerCondition?.condition.condition[0]?.key?.key, | 325 | attribute: condition.triggerCondition?.condition.condition[0]?.key?.key, |
299 | }); | 326 | }); |
300 | ConditionScreeningForm.value[index].setFieldsValue(formItem); | 327 | ConditionScreeningForm.value[index].setFieldsValue(formItem); |
@@ -389,12 +416,26 @@ | @@ -389,12 +416,26 @@ | ||
389 | rule.triggerCondition.condition.condition.forEach((item, conditionIndex) => { | 416 | rule.triggerCondition.condition.condition.forEach((item, conditionIndex) => { |
390 | const formItem = { | 417 | const formItem = { |
391 | operation: item.predicate.operation, | 418 | operation: item.predicate.operation, |
392 | - value: String(item.predicate.value.defaultValue), | 419 | + value: |
420 | + item.valueType === 'DATE_TIME' | ||
421 | + ? formatToDateTime( | ||
422 | + Number(item.predicate.value.defaultValue), | ||
423 | + 'YYYY-MM-DD HH:mm:ss' | ||
424 | + ) | ||
425 | + : String(item.predicate.value.defaultValue), | ||
426 | + ignoreCase: | ||
427 | + item.valueType === 'STRING' ? item.predicate.ignoreCase : undefined, | ||
393 | }; | 428 | }; |
394 | richTextList.push({ | 429 | richTextList.push({ |
395 | // 查询中文操作符 | 430 | // 查询中文操作符 |
396 | operation: findOperation(item.valueType, item.predicate.operation).label, | 431 | operation: findOperation(item.valueType, item.predicate.operation).label, |
397 | - value: String(item.predicate.value.defaultValue), | 432 | + value: |
433 | + item.valueType === 'DATE_TIME' | ||
434 | + ? formatToDateTime( | ||
435 | + Number(item.predicate.value.defaultValue), | ||
436 | + 'YYYY-MM-DD HH:mm:ss' | ||
437 | + ) | ||
438 | + : String(item.predicate.value.defaultValue), | ||
398 | attribute: item?.key?.key, | 439 | attribute: item?.key?.key, |
399 | }); | 440 | }); |
400 | ConditionScreeningForm[ruleIndex].value[conditionIndex].setFieldsValue( | 441 | ConditionScreeningForm[ruleIndex].value[conditionIndex].setFieldsValue( |
@@ -404,8 +404,7 @@ export const alarmScheduleSchemas: FormSchema[] = [ | @@ -404,8 +404,7 @@ export const alarmScheduleSchemas: FormSchema[] = [ | ||
404 | return { | 404 | return { |
405 | options: scheduleOptions, | 405 | options: scheduleOptions, |
406 | allowClear: false, | 406 | allowClear: false, |
407 | - onChange(value) { | ||
408 | - console.log(value); | 407 | + onChange() { |
409 | resetFields(); | 408 | resetFields(); |
410 | }, | 409 | }, |
411 | }; | 410 | }; |
@@ -28,6 +28,7 @@ export const genTriggerOrConditionData = (triggerData) => { | @@ -28,6 +28,7 @@ export const genTriggerOrConditionData = (triggerData) => { | ||
28 | predicate: { | 28 | predicate: { |
29 | type: operationType === 'DATE_TIME' ? 'NUMERIC' : operationType, | 29 | type: operationType === 'DATE_TIME' ? 'NUMERIC' : operationType, |
30 | operation: item.operation, | 30 | operation: item.operation, |
31 | + ignoreCase: operationType === 'STRING' ? item.ignoreCase : undefined, | ||
31 | value: { | 32 | value: { |
32 | defaultValue: | 33 | defaultValue: |
33 | operationType === 'DATE_TIME' ? Number(formatToDateTime(item.value, 'x')) : item.value, | 34 | operationType === 'DATE_TIME' ? Number(formatToDateTime(item.value, 'x')) : item.value, |
@@ -75,7 +76,6 @@ export const genActionData = (actionData) => { | @@ -75,7 +76,6 @@ export const genActionData = (actionData) => { | ||
75 | device, | 76 | device, |
76 | deviceId, | 77 | deviceId, |
77 | } = actionData; | 78 | } = actionData; |
78 | - console.log(actionData); | ||
79 | const clearRule = clearRules.map((item) => { | 79 | const clearRule = clearRules.map((item) => { |
80 | const mapPredicate = item.predicate.map((pred) => { | 80 | const mapPredicate = item.predicate.map((pred) => { |
81 | return { | 81 | return { |
@@ -88,6 +88,7 @@ export const genActionData = (actionData) => { | @@ -88,6 +88,7 @@ export const genActionData = (actionData) => { | ||
88 | predicate: { | 88 | predicate: { |
89 | type: item.operationType, | 89 | type: item.operationType, |
90 | operation: pred.operation, | 90 | operation: pred.operation, |
91 | + ignoreCase: item.operationType === 'STRING' ? pred.ignoreCase : undefined, | ||
91 | value: { | 92 | value: { |
92 | defaultValue: pred.value, | 93 | defaultValue: pred.value, |
93 | // userValue: null, | 94 | // userValue: null, |
@@ -205,6 +206,8 @@ export function findOperation(valueType, operation) { | @@ -205,6 +206,8 @@ export function findOperation(valueType, operation) { | ||
205 | switch (valueType) { | 206 | switch (valueType) { |
206 | case 'NUMERIC' || 'DATE_TIME': | 207 | case 'NUMERIC' || 'DATE_TIME': |
207 | return operationNumber_OR_TIME.find((item) => item.value === operation); | 208 | return operationNumber_OR_TIME.find((item) => item.value === operation); |
209 | + case 'DATE_TIME': | ||
210 | + return operationNumber_OR_TIME.find((item) => item.value === operation); | ||
208 | case 'STRING': | 211 | case 'STRING': |
209 | return operationString.find((item) => item.value === operation); | 212 | return operationString.find((item) => item.value === operation); |
210 | case 'BOOLEAN': | 213 | case 'BOOLEAN': |
@@ -244,9 +247,8 @@ export function isType(operationType) { | @@ -244,9 +247,8 @@ export function isType(operationType) { | ||
244 | field: 'ignoreCase', | 247 | field: 'ignoreCase', |
245 | label: '忽略大小写', | 248 | label: '忽略大小写', |
246 | component: 'Checkbox', | 249 | component: 'Checkbox', |
247 | - labelWidth: 150, | ||
248 | colProps: { | 250 | colProps: { |
249 | - span: 7, | 251 | + span: 6, |
250 | }, | 252 | }, |
251 | }, | 253 | }, |
252 | { | 254 | { |
@@ -254,6 +256,7 @@ export function isType(operationType) { | @@ -254,6 +256,7 @@ export function isType(operationType) { | ||
254 | label: '执行操作', | 256 | label: '执行操作', |
255 | component: 'Select', | 257 | component: 'Select', |
256 | required: true, | 258 | required: true, |
259 | + | ||
257 | componentProps: { | 260 | componentProps: { |
258 | options: operationString, | 261 | options: operationString, |
259 | }, | 262 | }, |
@@ -265,6 +268,7 @@ export function isType(operationType) { | @@ -265,6 +268,7 @@ export function isType(operationType) { | ||
265 | field: 'value', | 268 | field: 'value', |
266 | label: '操作值', | 269 | label: '操作值', |
267 | required: true, | 270 | required: true, |
271 | + | ||
268 | component: 'Input', | 272 | component: 'Input', |
269 | colProps: { | 273 | colProps: { |
270 | span: 7, | 274 | span: 7, |
@@ -318,7 +322,7 @@ export function isType(operationType) { | @@ -318,7 +322,7 @@ export function isType(operationType) { | ||
318 | options: operationNumber_OR_TIME, | 322 | options: operationNumber_OR_TIME, |
319 | }, | 323 | }, |
320 | colProps: { | 324 | colProps: { |
321 | - span: 8, | 325 | + span: 7, |
322 | }, | 326 | }, |
323 | }, | 327 | }, |
324 | { | 328 | { |
@@ -330,7 +334,7 @@ export function isType(operationType) { | @@ -330,7 +334,7 @@ export function isType(operationType) { | ||
330 | showTime: true, | 334 | showTime: true, |
331 | }, | 335 | }, |
332 | colProps: { | 336 | colProps: { |
333 | - span: 8, | 337 | + span: 10, |
334 | }, | 338 | }, |
335 | }, | 339 | }, |
336 | ]; | 340 | ]; |
@@ -11,19 +11,19 @@ | @@ -11,19 +11,19 @@ | ||
11 | <BasicForm @register="registerForm" ref="basicFormRef"> | 11 | <BasicForm @register="registerForm" ref="basicFormRef"> |
12 | <template #customEnable> | 12 | <template #customEnable> |
13 | <template v-for="(item, optionIndex) in options" :key="item.flag"> | 13 | <template v-for="(item, optionIndex) in options" :key="item.flag"> |
14 | - <div :class="optionIndex >= 1 ? 'mt-4' : ''"> | ||
15 | - <Checkbox v-model:checked="item.enabled">星期{{ item.flag }}</Checkbox> | 14 | + <div :class="optionIndex >= 1 ? 'mt-4' : ''" class="flex"> |
15 | + <div class="ml-4 mr-4 flex items-center"> | ||
16 | + <Checkbox v-model:checked="item.enabled">星期{{ item.flag }}</Checkbox> | ||
17 | + </div> | ||
16 | <TimePicker | 18 | <TimePicker |
17 | - size="small" | ||
18 | placeholder="开始时间" | 19 | placeholder="开始时间" |
19 | v-model:value="item.startsOn" | 20 | v-model:value="item.startsOn" |
20 | value-format="x" | 21 | value-format="x" |
21 | format="HH:mm" | 22 | format="HH:mm" |
22 | :disabled="!item.enabled" | 23 | :disabled="!item.enabled" |
23 | /> | 24 | /> |
24 | - ~ | 25 | + <span class="ml-4 mr-4 flex items-center">~</span> |
25 | <TimePicker | 26 | <TimePicker |
26 | - size="small" | ||
27 | placeholder="结束时间" | 27 | placeholder="结束时间" |
28 | v-model:value="item.endsOn" | 28 | v-model:value="item.endsOn" |
29 | value-format="x" | 29 | value-format="x" |
@@ -34,15 +34,13 @@ | @@ -34,15 +34,13 @@ | ||
34 | </template> | 34 | </template> |
35 | <template #timing> | 35 | <template #timing> |
36 | <TimePicker | 36 | <TimePicker |
37 | - size="small" | ||
38 | placeholder="开始时间" | 37 | placeholder="开始时间" |
39 | v-model:value="timeState.startsOn" | 38 | v-model:value="timeState.startsOn" |
40 | value-format="x" | 39 | value-format="x" |
41 | format="HH:mm" | 40 | format="HH:mm" |
42 | /> | 41 | /> |
43 | - ~ | 42 | + <span class="ml-4 mr-4">~</span> |
44 | <TimePicker | 43 | <TimePicker |
45 | - size="small" | ||
46 | placeholder="结束时间" | 44 | placeholder="结束时间" |
47 | v-model:value="timeState.endsOn" | 45 | v-model:value="timeState.endsOn" |
48 | value-format="x" | 46 | value-format="x" |
@@ -59,6 +57,7 @@ | @@ -59,6 +57,7 @@ | ||
59 | import { BasicForm, useForm } from '/@/components/Form'; | 57 | import { BasicForm, useForm } from '/@/components/Form'; |
60 | import { alarmScheduleSchemas } from '../config/config.data.ts'; | 58 | import { alarmScheduleSchemas } from '../config/config.data.ts'; |
61 | import { Checkbox, TimePicker } from 'ant-design-vue'; | 59 | import { Checkbox, TimePicker } from 'ant-design-vue'; |
60 | + | ||
62 | const emit = defineEmits(['register', 'cancel']); | 61 | const emit = defineEmits(['register', 'cancel']); |
63 | const [registerForm, { setFieldsValue, getFieldsValue }] = useForm({ | 62 | const [registerForm, { setFieldsValue, getFieldsValue }] = useForm({ |
64 | showActionButtonGroup: false, | 63 | showActionButtonGroup: false, |
@@ -238,4 +237,8 @@ | @@ -238,4 +237,8 @@ | ||
238 | }); | 237 | }); |
239 | </script> | 238 | </script> |
240 | 239 | ||
241 | -<style lang="less" scoped></style> | 240 | +<style lang="less" scoped> |
241 | + :deep(.ant-time-picker) { | ||
242 | + width: 12rem; | ||
243 | + } | ||
244 | +</style> |
@@ -92,7 +92,6 @@ | @@ -92,7 +92,6 @@ | ||
92 | const predicate = conditionScreeningRef?.value?.refItem?.conditionScreeningRefs?.value?.map( | 92 | const predicate = conditionScreeningRef?.value?.refItem?.conditionScreeningRefs?.value?.map( |
93 | (item) => item.getFieldsValue() | 93 | (item) => item.getFieldsValue() |
94 | ); | 94 | ); |
95 | - | ||
96 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; | 95 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; |
97 | }; | 96 | }; |
98 | const updateFieldDeviceId = (deviceList: any[]) => { | 97 | const updateFieldDeviceId = (deviceList: any[]) => { |