bfg-common 1.4.272 → 1.4.273
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.
|
@@ -124,6 +124,29 @@ const userNameErrorText = computed<string>(() => {
|
|
|
124
124
|
const frequencyMethodOptions = computed<UI_I_SelectInputItem[]>(() =>
|
|
125
125
|
frequencyMethodFunc(localization.value)
|
|
126
126
|
)
|
|
127
|
+
|
|
128
|
+
watch(
|
|
129
|
+
model,
|
|
130
|
+
(newValue: UI_I_ScheduleNewTasksForm) => {
|
|
131
|
+
console.log(newValue, '444444')
|
|
132
|
+
const date = newValue.frg_on_time && new Date(newValue.frg_on_time)
|
|
133
|
+
newValue.cron = generateOnceCronExpression(date)
|
|
134
|
+
},
|
|
135
|
+
{ deep: true }
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
const generateOnceCronExpression = (date: Date | null): any => {
|
|
139
|
+
if(!date) return
|
|
140
|
+
const minutes = date.getMinutes()
|
|
141
|
+
const hours = date.getHours()
|
|
142
|
+
const day = date.getDate()
|
|
143
|
+
const month = date.getMonth() + 1 // В cron месяцы начинаются с 1 (январь = 1)
|
|
144
|
+
const dayOfWeek = '*' // Для одноразовой задачи день недели неважен
|
|
145
|
+
|
|
146
|
+
// Генерируем cron-выражение
|
|
147
|
+
const cronExpression = `${minutes} ${hours} ${day} ${month} ${dayOfWeek} once`
|
|
148
|
+
return cronExpression
|
|
149
|
+
}
|
|
127
150
|
</script>
|
|
128
151
|
|
|
129
152
|
<style lang="scss" scoped>
|