bfg-common 1.5.901 → 1.5.903
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/New.vue +45 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/Old.vue +242 -0
- package/components/common/pages/scheduledTasks/modals/common/frequency/on/On.vue +16 -106
- package/components/common/pages/scheduledTasks/modals/common/taskForm/New.vue +6 -49
- package/components/common/pages/scheduledTasks/modals/common/taskForm/Old.vue +0 -48
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="frequency-on-date">
|
|
3
|
+
<div>
|
|
4
|
+
<h2>{{ localization.common.on }}</h2>
|
|
5
|
+
<ui-input-with-datepicker
|
|
6
|
+
id="events-filter-time-range-date-to"
|
|
7
|
+
v-model="scheduledTaskFormLocal.frg_on_time"
|
|
8
|
+
:format="datepickerFormat"
|
|
9
|
+
test-id="frequency-on-date-input"
|
|
10
|
+
time-format="12"
|
|
11
|
+
:error="'dateToErrorText.date'"
|
|
12
|
+
:error-timepicker="'dateToErrorText.time'"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
20
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
21
|
+
import { getUiDatepickerFormatByLanguage } from '~/lib/utils/date'
|
|
22
|
+
|
|
23
|
+
const scheduledTaskFormLocal = defineModel<UI_I_ScheduleNewTasksForm>({
|
|
24
|
+
required: true,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
28
|
+
|
|
29
|
+
const datepickerFormat = computed<string>(
|
|
30
|
+
() => getUiDatepickerFormatByLanguage('en_US') // TODO из пропс должен приходить язык
|
|
31
|
+
)
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<style lang="scss" scoped>
|
|
35
|
+
.frequency-on-date {
|
|
36
|
+
h2 {
|
|
37
|
+
font-family: 'Inter', sans-serif;
|
|
38
|
+
color: var(--title-form-first-color);
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-weight: 500;
|
|
41
|
+
line-height: 18px;
|
|
42
|
+
margin-bottom: 12px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="on-time">
|
|
3
|
+
<label class="on-time__label">
|
|
4
|
+
{{ localization.common.on }}
|
|
5
|
+
</label>
|
|
6
|
+
|
|
7
|
+
<common-pages-scheduled-tasks-modals-common-frequency-on-select-week
|
|
8
|
+
v-if="props.type === 'week'"
|
|
9
|
+
v-model="model"
|
|
10
|
+
/>
|
|
11
|
+
|
|
12
|
+
<div v-if="props.type === 'month'">
|
|
13
|
+
<div class="on-time__radio radio">
|
|
14
|
+
<input
|
|
15
|
+
id="on-time-monthly-by-day"
|
|
16
|
+
v-model="model.frg_monthly_mode"
|
|
17
|
+
data-id="on-time-monthly-by-day"
|
|
18
|
+
type="radio"
|
|
19
|
+
value="day"
|
|
20
|
+
class="custom-radio-button"
|
|
21
|
+
name="name"
|
|
22
|
+
/>
|
|
23
|
+
<label for="on-time-monthly-by-day" class="custom-radio-label">
|
|
24
|
+
{{ localization.scheduledTasks.day }}
|
|
25
|
+
</label>
|
|
26
|
+
|
|
27
|
+
<label
|
|
28
|
+
:class="[
|
|
29
|
+
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
30
|
+
schedulerOnDayErrorText && 'invalid',
|
|
31
|
+
]"
|
|
32
|
+
for="monthly-by-day-field"
|
|
33
|
+
>
|
|
34
|
+
<input
|
|
35
|
+
id="monthly-by-day-field"
|
|
36
|
+
v-model="model.frg_monthly_day"
|
|
37
|
+
:disabled="isDisabledMonthlyDayField"
|
|
38
|
+
data-id="edit-lockout-policy-time-interval-input"
|
|
39
|
+
type="text"
|
|
40
|
+
class="monthly-day-field"
|
|
41
|
+
@input="onInitTimeIntervalValidation"
|
|
42
|
+
@blur="onInitTimeIntervalValidation"
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
<span class="tooltip-content">
|
|
46
|
+
{{ schedulerOnDayErrorText }}
|
|
47
|
+
</span>
|
|
48
|
+
</label>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="on-time__radio radio">
|
|
52
|
+
<input
|
|
53
|
+
id="on-time-monthly-by-week"
|
|
54
|
+
v-model="model.frg_monthly_mode"
|
|
55
|
+
data-id="on-time-monthly-by-week"
|
|
56
|
+
type="radio"
|
|
57
|
+
value="week"
|
|
58
|
+
class="custom-radio-button"
|
|
59
|
+
name="name"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<label for="on-time-monthly-by-week" class="custom-radio-label mr-6">
|
|
63
|
+
{{ localization.scheduledTasks.the }}
|
|
64
|
+
</label>
|
|
65
|
+
<common-select-input
|
|
66
|
+
v-model="model.frq_ordinal_number"
|
|
67
|
+
:data="frequencyOnOrdinalNumber"
|
|
68
|
+
:class="[
|
|
69
|
+
'radio__select ordinary-day',
|
|
70
|
+
!isDisabledMonthlyDayField && 'disabled',
|
|
71
|
+
]"
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<common-select-input
|
|
75
|
+
v-model="model.frq_week_day"
|
|
76
|
+
:data="frequencyOnWeeksDays"
|
|
77
|
+
:class="[
|
|
78
|
+
'radio__select week-days',
|
|
79
|
+
!isDisabledMonthlyDayField && 'disabled',
|
|
80
|
+
]"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<label
|
|
86
|
+
v-if="props.type === 'once'"
|
|
87
|
+
:class="[
|
|
88
|
+
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
89
|
+
schedulerAtOnceErrorText && 'invalid',
|
|
90
|
+
]"
|
|
91
|
+
for="frequency-on-date"
|
|
92
|
+
>
|
|
93
|
+
<input
|
|
94
|
+
id="frequency-on-date"
|
|
95
|
+
v-model.lazy="model.frg_on_time"
|
|
96
|
+
data-id="frequency-on-date-input"
|
|
97
|
+
type="datetime-local"
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
<span class="tooltip-content">
|
|
101
|
+
{{ schedulerAtOnceErrorText }}
|
|
102
|
+
</span>
|
|
103
|
+
</label>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script lang="ts" setup>
|
|
108
|
+
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
109
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
110
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
111
|
+
import {
|
|
112
|
+
frequencyOnOrdinalNumberFunc,
|
|
113
|
+
frequencyOnWeeksDaysFunc,
|
|
114
|
+
} from '~/components/common/pages/scheduledTasks/modals/common/frequency/on/lib/config/options'
|
|
115
|
+
import {
|
|
116
|
+
validateDate,
|
|
117
|
+
validateField,
|
|
118
|
+
} from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
|
|
119
|
+
|
|
120
|
+
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
121
|
+
const props = defineProps<{
|
|
122
|
+
type: string
|
|
123
|
+
}>()
|
|
124
|
+
|
|
125
|
+
const { $formattedDatetime }: any = useNuxtApp()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
129
|
+
|
|
130
|
+
const frequencyOnWeeksDays = computed<UI_I_SelectInputItem[]>(() => {
|
|
131
|
+
return frequencyOnWeeksDaysFunc(localization.value)
|
|
132
|
+
})
|
|
133
|
+
const frequencyOnOrdinalNumber = computed<UI_I_SelectInputItem[]>(() => {
|
|
134
|
+
return frequencyOnOrdinalNumberFunc(localization.value)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
const isDisabledMonthlyDayField = computed<boolean>(
|
|
138
|
+
() => model.value.frg_monthly_mode === 'week'
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
const isInitTimeIntervalValidation = ref<boolean>(false)
|
|
142
|
+
const onInitTimeIntervalValidation = (): void => {
|
|
143
|
+
isInitTimeIntervalValidation.value = true
|
|
144
|
+
}
|
|
145
|
+
const schedulerOnDayErrorText = computed<string>(() => {
|
|
146
|
+
if (!isInitTimeIntervalValidation.value || isDisabledMonthlyDayField.value)
|
|
147
|
+
return ''
|
|
148
|
+
|
|
149
|
+
return validateField(
|
|
150
|
+
localization.value,
|
|
151
|
+
model.value.frg_monthly_day,
|
|
152
|
+
true,
|
|
153
|
+
true
|
|
154
|
+
)
|
|
155
|
+
})
|
|
156
|
+
watch(
|
|
157
|
+
schedulerOnDayErrorText,
|
|
158
|
+
(newValue: string) => {
|
|
159
|
+
model.value.isValid = !!newValue
|
|
160
|
+
},
|
|
161
|
+
{ immediate: true }
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
const schedulerAtOnceErrorText = computed<string>(() => {
|
|
165
|
+
return !model.value.frg_on_time
|
|
166
|
+
? localization.value.common.fieldRequired
|
|
167
|
+
: validateDate(localization.value, model.value.frg_on_time)
|
|
168
|
+
})
|
|
169
|
+
watch(
|
|
170
|
+
schedulerAtOnceErrorText,
|
|
171
|
+
(newValue: string) => {
|
|
172
|
+
model.value.isValid = !!newValue
|
|
173
|
+
},
|
|
174
|
+
{ immediate: true }
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
onMounted(() => {
|
|
178
|
+
props.type === 'once' && setDefaultDateTime()
|
|
179
|
+
})
|
|
180
|
+
const setDefaultDateTime = () => {
|
|
181
|
+
model.value.frg_on_time = $formattedDatetime(new Date(), {
|
|
182
|
+
formatDate: 'yyyy-MM-dd',
|
|
183
|
+
separator: ' ',
|
|
184
|
+
formatTime: 'HH:mm',
|
|
185
|
+
})
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<style lang="scss" scoped>
|
|
190
|
+
@import 'bfg-common/assets/scss/common/mixins.scss';
|
|
191
|
+
.on-time {
|
|
192
|
+
display: flex;
|
|
193
|
+
margin-top: 25px;
|
|
194
|
+
&__label {
|
|
195
|
+
font-weight: 400;
|
|
196
|
+
padding-left: 0;
|
|
197
|
+
margin-right: 15px;
|
|
198
|
+
}
|
|
199
|
+
&__radio {
|
|
200
|
+
@include flex($align: center);
|
|
201
|
+
.monthly-day-field {
|
|
202
|
+
width: 110px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
.radio {
|
|
207
|
+
&__select {
|
|
208
|
+
width: 100%;
|
|
209
|
+
margin-top: 10px;
|
|
210
|
+
:deep(.select-input__inner) {
|
|
211
|
+
max-width: 100% !important;
|
|
212
|
+
min-width: max-content;
|
|
213
|
+
}
|
|
214
|
+
&.ordinary-day :deep(select) {
|
|
215
|
+
min-width: 80px;
|
|
216
|
+
}
|
|
217
|
+
&.week-days {
|
|
218
|
+
margin-left: 15px;
|
|
219
|
+
:deep(select) {
|
|
220
|
+
min-width: 110px;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
select {
|
|
224
|
+
width: 80px;
|
|
225
|
+
}
|
|
226
|
+
&.disabled {
|
|
227
|
+
opacity: 0.6;
|
|
228
|
+
pointer-events: none;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.tooltip {
|
|
234
|
+
& > .tooltip-content {
|
|
235
|
+
width: 200px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
input[type='radio']:focus:checked + label::before,
|
|
239
|
+
input[type='radio']:focus + label::before {
|
|
240
|
+
box-shadow: inset 0 0 0 0.25rem #0094d2;
|
|
241
|
+
}
|
|
242
|
+
</style>
|
|
@@ -1,107 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
v-model="model"
|
|
10
|
-
/>
|
|
11
|
-
|
|
12
|
-
<div v-if="props.type === 'month'">
|
|
13
|
-
<div class="on-time__radio radio">
|
|
14
|
-
<input
|
|
15
|
-
id="on-time-monthly-by-day"
|
|
16
|
-
v-model="model.frg_monthly_mode"
|
|
17
|
-
data-id="on-time-monthly-by-day"
|
|
18
|
-
type="radio"
|
|
19
|
-
value="day"
|
|
20
|
-
class="custom-radio-button"
|
|
21
|
-
name="name"
|
|
22
|
-
/>
|
|
23
|
-
<label for="on-time-monthly-by-day" class="custom-radio-label">
|
|
24
|
-
{{ localization.scheduledTasks.day }}
|
|
25
|
-
</label>
|
|
26
|
-
|
|
27
|
-
<label
|
|
28
|
-
:class="[
|
|
29
|
-
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
30
|
-
schedulerOnDayErrorText && 'invalid',
|
|
31
|
-
]"
|
|
32
|
-
for="monthly-by-day-field"
|
|
33
|
-
>
|
|
34
|
-
<input
|
|
35
|
-
id="monthly-by-day-field"
|
|
36
|
-
v-model="model.frg_monthly_day"
|
|
37
|
-
:disabled="isDisabledMonthlyDayField"
|
|
38
|
-
data-id="edit-lockout-policy-time-interval-input"
|
|
39
|
-
type="text"
|
|
40
|
-
class="monthly-day-field"
|
|
41
|
-
@input="onInitTimeIntervalValidation"
|
|
42
|
-
@blur="onInitTimeIntervalValidation"
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
<span class="tooltip-content">
|
|
46
|
-
{{ schedulerOnDayErrorText }}
|
|
47
|
-
</span>
|
|
48
|
-
</label>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div class="on-time__radio radio">
|
|
52
|
-
<input
|
|
53
|
-
id="on-time-monthly-by-week"
|
|
54
|
-
v-model="model.frg_monthly_mode"
|
|
55
|
-
data-id="on-time-monthly-by-week"
|
|
56
|
-
type="radio"
|
|
57
|
-
value="week"
|
|
58
|
-
class="custom-radio-button"
|
|
59
|
-
name="name"
|
|
60
|
-
/>
|
|
61
|
-
|
|
62
|
-
<label for="on-time-monthly-by-week" class="custom-radio-label mr-6">
|
|
63
|
-
{{ localization.scheduledTasks.the }}
|
|
64
|
-
</label>
|
|
65
|
-
<common-select-input
|
|
66
|
-
v-model="model.frq_ordinal_number"
|
|
67
|
-
:data="frequencyOnOrdinalNumber"
|
|
68
|
-
:class="[
|
|
69
|
-
'radio__select ordinary-day',
|
|
70
|
-
!isDisabledMonthlyDayField && 'disabled',
|
|
71
|
-
]"
|
|
72
|
-
/>
|
|
73
|
-
|
|
74
|
-
<common-select-input
|
|
75
|
-
v-model="model.frq_week_day"
|
|
76
|
-
:data="frequencyOnWeeksDays"
|
|
77
|
-
:class="[
|
|
78
|
-
'radio__select week-days',
|
|
79
|
-
!isDisabledMonthlyDayField && 'disabled',
|
|
80
|
-
]"
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<label
|
|
86
|
-
v-if="props.type === 'once'"
|
|
87
|
-
:class="[
|
|
88
|
-
'tooltip tooltip-validation tooltip-xs tooltip-top-left',
|
|
89
|
-
schedulerAtOnceErrorText && 'invalid',
|
|
90
|
-
]"
|
|
91
|
-
for="frequency-on-date"
|
|
92
|
-
>
|
|
93
|
-
<input
|
|
94
|
-
id="frequency-on-date"
|
|
95
|
-
v-model.lazy="model.frg_on_time"
|
|
96
|
-
data-id="frequency-on-date-input"
|
|
97
|
-
type="datetime-local"
|
|
98
|
-
/>
|
|
99
|
-
|
|
100
|
-
<span class="tooltip-content">
|
|
101
|
-
{{ schedulerAtOnceErrorText }}
|
|
102
|
-
</span>
|
|
103
|
-
</label>
|
|
104
|
-
</div>
|
|
2
|
+
<component
|
|
3
|
+
:is="currentComponent"
|
|
4
|
+
v-model="model"
|
|
5
|
+
:frequency-on-weeks-days="frequencyOnWeeksDays"
|
|
6
|
+
:frequency-on-ordinal-number="frequencyOnOrdinalNumber"
|
|
7
|
+
:type="type"
|
|
8
|
+
/>
|
|
105
9
|
</template>
|
|
106
10
|
|
|
107
11
|
<script lang="ts" setup>
|
|
@@ -117,15 +21,21 @@ import {
|
|
|
117
21
|
validateField,
|
|
118
22
|
} from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/utils'
|
|
119
23
|
|
|
24
|
+
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
120
25
|
const props = defineProps<{
|
|
121
26
|
type: string
|
|
122
27
|
}>()
|
|
123
28
|
|
|
29
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
124
30
|
const { $formattedDatetime }: any = useNuxtApp()
|
|
31
|
+
const { $store }: any = useNuxtApp()
|
|
125
32
|
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
33
|
+
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
34
|
+
const currentComponent = computed(() =>
|
|
35
|
+
isNewView.value
|
|
36
|
+
? defineAsyncComponent(() => import('./new/New.vue'))
|
|
37
|
+
: defineAsyncComponent(() => import('./old/Old.vue'))
|
|
38
|
+
)
|
|
129
39
|
|
|
130
40
|
const frequencyOnWeeksDays = computed<UI_I_SelectInputItem[]>(() => {
|
|
131
41
|
return frequencyOnWeeksDaysFunc(localization.value)
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
class="form__description"
|
|
36
36
|
/>
|
|
37
37
|
|
|
38
|
-
<div>
|
|
38
|
+
<div class="form__run">
|
|
39
39
|
<h2>{{ localization.common.run }}</h2>
|
|
40
40
|
|
|
41
41
|
<h2 class="frequency">{{ localization.scheduledTasks.frequency }}</h2>
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
select-width="100%"
|
|
49
49
|
class="mt-3"
|
|
50
50
|
/>
|
|
51
|
+
<common-pages-scheduled-tasks-modals-common-frequency
|
|
52
|
+
v-model="model"
|
|
53
|
+
:type="model.frequency"
|
|
54
|
+
/>
|
|
51
55
|
</div>
|
|
52
56
|
|
|
53
57
|
<div class="form__email">
|
|
@@ -71,8 +75,6 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
|
71
75
|
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
72
76
|
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
73
77
|
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/models/interfaces'
|
|
74
|
-
import type { UI_T_FrequencyType } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/models/types'
|
|
75
|
-
import * as cron from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/utils'
|
|
76
78
|
|
|
77
79
|
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
78
80
|
const props = defineProps<{
|
|
@@ -110,52 +112,6 @@ const frequencyMethodOptionsLocal = computed<UI_I_Dropdown[]>(() =>
|
|
|
110
112
|
text: item.label,
|
|
111
113
|
}))
|
|
112
114
|
)
|
|
113
|
-
|
|
114
|
-
watch(
|
|
115
|
-
model,
|
|
116
|
-
(newValue: UI_I_ScheduleNewTasksForm) => {
|
|
117
|
-
newValue.cron = generateCronExpression(newValue.frequency, newValue)
|
|
118
|
-
},
|
|
119
|
-
{ deep: true }
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
const generateCronExpression = (
|
|
123
|
-
runType: UI_T_FrequencyType,
|
|
124
|
-
interval: UI_I_ScheduleNewTasksForm
|
|
125
|
-
): string => {
|
|
126
|
-
let cronExpression
|
|
127
|
-
|
|
128
|
-
// Генерируем cron-выражение на основе runType
|
|
129
|
-
switch (runType) {
|
|
130
|
-
case 'once':
|
|
131
|
-
const timestamp = Math.floor(
|
|
132
|
-
new Date(interval.frg_on_time).getTime() / 1000
|
|
133
|
-
)
|
|
134
|
-
cronExpression = `* * * * * ${timestamp}:0-0-0-0:once`
|
|
135
|
-
break
|
|
136
|
-
case 'after-startup':
|
|
137
|
-
const suffixDelay =
|
|
138
|
-
interval.frg_after_startup === 0 ? '' : `-${interval.frg_after_startup}`
|
|
139
|
-
cronExpression = `* * * * * after_procurator_startup${suffixDelay}` // Выполняется после запуска procurator_startup с задержой N минут
|
|
140
|
-
break
|
|
141
|
-
case 'hour':
|
|
142
|
-
cronExpression = cron.generateHourlyCronExpression(interval)
|
|
143
|
-
break
|
|
144
|
-
case 'day':
|
|
145
|
-
cronExpression = cron.generateDailyCronExpression(interval)
|
|
146
|
-
break
|
|
147
|
-
case 'week':
|
|
148
|
-
cronExpression = cron.generateWeeklyCronExpression(interval)
|
|
149
|
-
break
|
|
150
|
-
case 'month':
|
|
151
|
-
cronExpression = cron.generateMonthlyCronExpression(interval)
|
|
152
|
-
break
|
|
153
|
-
default:
|
|
154
|
-
cronExpression = '* * * * *'
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return cronExpression
|
|
158
|
-
}
|
|
159
115
|
</script>
|
|
160
116
|
|
|
161
117
|
<style lang="scss" scoped>
|
|
@@ -190,6 +146,7 @@ const generateCronExpression = (
|
|
|
190
146
|
}
|
|
191
147
|
}
|
|
192
148
|
|
|
149
|
+
&__run,
|
|
193
150
|
&__email {
|
|
194
151
|
border-top: 1px solid var(--horizontal-line);
|
|
195
152
|
padding-top: 16px;
|
|
@@ -102,8 +102,6 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
|
102
102
|
import type { UI_I_SelectInputItem } from '~/components/common/select/input/lib/models/interfaces'
|
|
103
103
|
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
|
104
104
|
import type { UI_I_InitialValidationFields } from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/models/interfaces'
|
|
105
|
-
import type { UI_T_FrequencyType } from '~/components/common/pages/scheduledTasks/modals/common/frequency/lib/models/types'
|
|
106
|
-
import * as cron from '~/components/common/pages/scheduledTasks/modals/common/taskForm/lib/utils'
|
|
107
105
|
|
|
108
106
|
const model = defineModel<UI_I_ScheduleNewTasksForm>({ required: true })
|
|
109
107
|
const props = defineProps<{
|
|
@@ -121,52 +119,6 @@ const localization = computed<UI_I_Localization>(() => useLocal())
|
|
|
121
119
|
const onInitValidation = (types: string[]): void => {
|
|
122
120
|
emits('init-validation', types)
|
|
123
121
|
}
|
|
124
|
-
|
|
125
|
-
watch(
|
|
126
|
-
model,
|
|
127
|
-
(newValue: UI_I_ScheduleNewTasksForm) => {
|
|
128
|
-
newValue.cron = generateCronExpression(newValue.frequency, newValue)
|
|
129
|
-
},
|
|
130
|
-
{ deep: true }
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
const generateCronExpression = (
|
|
134
|
-
runType: UI_T_FrequencyType,
|
|
135
|
-
interval: UI_I_ScheduleNewTasksForm
|
|
136
|
-
): string => {
|
|
137
|
-
let cronExpression
|
|
138
|
-
|
|
139
|
-
// Генерируем cron-выражение на основе runType
|
|
140
|
-
switch (runType) {
|
|
141
|
-
case 'once':
|
|
142
|
-
const timestamp = Math.floor(
|
|
143
|
-
new Date(interval.frg_on_time).getTime() / 1000
|
|
144
|
-
)
|
|
145
|
-
cronExpression = `* * * * * ${timestamp}:0-0-0-0:once`
|
|
146
|
-
break
|
|
147
|
-
case 'after-startup':
|
|
148
|
-
const suffixDelay =
|
|
149
|
-
interval.frg_after_startup === 0 ? '' : `-${interval.frg_after_startup}`
|
|
150
|
-
cronExpression = `* * * * * after_procurator_startup${suffixDelay}` // Выполняется после запуска procurator_startup с задержой N минут
|
|
151
|
-
break
|
|
152
|
-
case 'hour':
|
|
153
|
-
cronExpression = cron.generateHourlyCronExpression(interval)
|
|
154
|
-
break
|
|
155
|
-
case 'day':
|
|
156
|
-
cronExpression = cron.generateDailyCronExpression(interval)
|
|
157
|
-
break
|
|
158
|
-
case 'week':
|
|
159
|
-
cronExpression = cron.generateWeeklyCronExpression(interval)
|
|
160
|
-
break
|
|
161
|
-
case 'month':
|
|
162
|
-
cronExpression = cron.generateMonthlyCronExpression(interval)
|
|
163
|
-
break
|
|
164
|
-
default:
|
|
165
|
-
cronExpression = '* * * * *'
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return cronExpression
|
|
169
|
-
}
|
|
170
122
|
</script>
|
|
171
123
|
|
|
172
124
|
<style lang="scss" scoped>
|