定时任务
parent
695a0b2dfe
commit
d4a521aaf0
|
|
@ -12,12 +12,15 @@
|
||||||
placeholder="任务执行函数"/>
|
placeholder="任务执行函数"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="调度方式">
|
<ElFormItem label="调度方式">
|
||||||
<ElSelect v-model="searchForm.scheduleType" clearable placeholder="请选择调度方式" style="width: 150px" @clear="paging">
|
<ElSelect
|
||||||
|
v-model="searchForm.scheduleType"
|
||||||
|
clearable placeholder="请选择调度方式" style="width: 150px" @change="paging" @clear="paging">
|
||||||
<ElOption v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
<ElOption v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</ElSelect>
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="内部任务">
|
<ElFormItem label="内部任务">
|
||||||
<ElCheckbox
|
<ElCheckbox
|
||||||
|
@change="paging"
|
||||||
v-model="searchForm.builtin"
|
v-model="searchForm.builtin"
|
||||||
placeholder="内部任务"/>
|
placeholder="内部任务"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
|
@ -115,7 +118,7 @@ import ScheduleRecodePanel from '@/pages/sys/task/schedule-recode/ScheduleRecode
|
||||||
import Times from '@/common/utils/times.ts'
|
import Times from '@/common/utils/times.ts'
|
||||||
|
|
||||||
const tableData = ref<TaskTypes.SearchTaskResult[]>([])
|
const tableData = ref<TaskTypes.SearchTaskResult[]>([])
|
||||||
const searchForm = reactive<TaskTypes.SearchTaskParam>({
|
const searchForm = ref<TaskTypes.SearchTaskParam>({
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 20,
|
size: 20,
|
||||||
builtin: false,
|
builtin: false,
|
||||||
|
|
@ -138,8 +141,8 @@ const scheduleTypeList = [
|
||||||
]
|
]
|
||||||
|
|
||||||
function pageChangeHandler(currentPage: number, pageSize: number) {
|
function pageChangeHandler(currentPage: number, pageSize: number) {
|
||||||
searchForm.current = currentPage
|
searchForm.value.current = currentPage
|
||||||
searchForm.size = pageSize
|
searchForm.value.size = pageSize
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,13 +186,17 @@ function addHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(searchForm, {})
|
searchForm.value = {
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
builtin: false,
|
||||||
|
}
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
function paging() {
|
function paging() {
|
||||||
searching.value = true
|
searching.value = true
|
||||||
TaskApi.paging(searchForm)
|
TaskApi.paging(searchForm.value)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
tableData.value = res.data?.records ?? []
|
tableData.value = res.data?.records ?? []
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
end-placeholder="结束"
|
end-placeholder="结束"
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始"
|
start-placeholder="开始"
|
||||||
type="daterange"
|
type="datetimerange"
|
||||||
unlink-panels
|
unlink-panels
|
||||||
/>
|
/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
|
@ -109,6 +109,8 @@
|
||||||
import TaskExecuteLogApi from '@/pages/sys/task/execute-log/execute-log-api.ts'
|
import TaskExecuteLogApi from '@/pages/sys/task/execute-log/execute-log-api.ts'
|
||||||
import { elIcons } from '@/common/element/element.ts'
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
import Strings from '@/common/utils/strings.ts'
|
import Strings from '@/common/utils/strings.ts'
|
||||||
|
import Colls from '@/common/utils/colls.ts'
|
||||||
|
import Times from '@/common/utils/times.ts'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
scheduleId: string
|
scheduleId: string
|
||||||
|
|
@ -125,7 +127,6 @@ const searching = ref(false)
|
||||||
const deling = ref(false)
|
const deling = ref(false)
|
||||||
const showSearchForm = ref(true)
|
const showSearchForm = ref(true)
|
||||||
const pagination = reactive<G.Pagination>({
|
const pagination = reactive<G.Pagination>({
|
||||||
total: 0,
|
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 1,
|
size: 1,
|
||||||
})
|
})
|
||||||
|
|
@ -191,13 +192,25 @@ function delHandler({row}: { row: TaskExecuteLogTypes.SearchTaskExecuteLogResult
|
||||||
|
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
searchForm.value = {}
|
searchForm.value = {
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
}
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
function paging() {
|
function paging() {
|
||||||
searching.value = true
|
searching.value = true
|
||||||
TaskExecuteLogApi.paging({...searchForm.value, scheduleId: props.scheduleId})
|
const {
|
||||||
|
logLevel,
|
||||||
|
logTime,
|
||||||
|
} = searchForm.value
|
||||||
|
TaskExecuteLogApi.paging({
|
||||||
|
logLevel,
|
||||||
|
startLogTime: Colls.isEmpty(logTime) ? undefined : Times.format(logTime[0]),
|
||||||
|
endLogTime: Colls.isEmpty(logTime) ? undefined : Times.format(logTime[1]),
|
||||||
|
scheduleId: props.scheduleId,
|
||||||
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
tableData.value = res.data?.records ?? []
|
tableData.value = res.data?.records ?? []
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,24 +3,14 @@ export {}
|
||||||
declare global {
|
declare global {
|
||||||
namespace TaskExecuteLogTypes {
|
namespace TaskExecuteLogTypes {
|
||||||
interface SearchTaskExecuteLogParam extends G.PageParam {
|
interface SearchTaskExecuteLogParam extends G.PageParam {
|
||||||
// Id
|
|
||||||
id?: string
|
|
||||||
// 调度 Id;sys_task_schedule_recode.id
|
// 调度 Id;sys_task_schedule_recode.id
|
||||||
scheduleId?: string
|
scheduleId?: string
|
||||||
// 日志等级
|
// 日志等级
|
||||||
logLevel?: string
|
logLevel?: string
|
||||||
// 日志时间
|
// 日志时间
|
||||||
logTime?: string
|
logTime?: string
|
||||||
// 位置
|
startLogTime?: string
|
||||||
place?: string
|
endLogTime?: string
|
||||||
// 行号
|
|
||||||
line?: number
|
|
||||||
// 日志信息
|
|
||||||
msg?: string
|
|
||||||
// 错误信息
|
|
||||||
err?: string
|
|
||||||
// 创建时间
|
|
||||||
createTime?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SearchTaskExecuteLogResult {
|
interface SearchTaskExecuteLogResult {
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,25 @@
|
||||||
end-placeholder="结束"
|
end-placeholder="结束"
|
||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始"
|
start-placeholder="开始"
|
||||||
type="daterange"
|
type="datetimerange"
|
||||||
unlink-panels
|
unlink-panels
|
||||||
/>
|
/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
<ElFormItem label="调度方式">
|
||||||
|
<ElSelect v-model="searchForm.scheduleType" clearable placeholder="请选择调度方式" style="width: 150px" @clear="paging">
|
||||||
|
<ElOption v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</ElSelect>
|
||||||
|
</ElFormItem>
|
||||||
<ElFormItem label="任务状态">
|
<ElFormItem label="任务状态">
|
||||||
<ElSelect v-model="searchForm.taskStatus" placeholder="请选择任务状态" style="width: 150px;">
|
<ElSelect v-model="searchForm.taskStatus" placeholder="请选择任务状态" style="width: 150px;">
|
||||||
<ElOption v-for="item in status" :key="item.value" :label="item.label" :value="item.value"/>
|
<ElOption v-for="item in status" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</ElSelect>
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
<ElFormItem label="手动触发">
|
||||||
|
<ElCheckbox
|
||||||
|
v-model="searchForm.manually"
|
||||||
|
placeholder="手动触发"/>
|
||||||
|
</ElFormItem>
|
||||||
<ElFormItem>
|
<ElFormItem>
|
||||||
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
||||||
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
||||||
|
|
@ -33,7 +43,7 @@
|
||||||
row-key="id">
|
row-key="id">
|
||||||
<ElTableColumn label="任务名称" prop="taskName"/>
|
<ElTableColumn label="任务名称" prop="taskName"/>
|
||||||
|
|
||||||
<ElTableColumn label="任务执行函数" prop="fn"/>
|
<ElTableColumn label="任务执行函数" prop="fn" show-overflow-tooltip width="150"/>
|
||||||
|
|
||||||
<ElTableColumn label="调度方式" prop="scheduleType">
|
<ElTableColumn label="调度方式" prop="scheduleType">
|
||||||
|
|
||||||
|
|
@ -119,12 +129,18 @@ import TaskScheduleRecodeApi from '@/pages/sys/task/schedule-recode/schedule-rec
|
||||||
import { elIcons } from '@/common/element/element.ts'
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
import Times from '@/common/utils/times.ts'
|
import Times from '@/common/utils/times.ts'
|
||||||
import ExecuteLogPanel from '@/pages/sys/task/execute-log/ExecuteLogPanel.vue'
|
import ExecuteLogPanel from '@/pages/sys/task/execute-log/ExecuteLogPanel.vue'
|
||||||
|
import Colls from '@/common/utils/colls.ts'
|
||||||
|
|
||||||
const executeLogPanelIns = useTemplateRef<InstanceType<typeof ExecuteLogPanel>>('executeLogPanel')
|
const executeLogPanelIns = useTemplateRef<InstanceType<typeof ExecuteLogPanel>>('executeLogPanel')
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
taskId: string
|
taskId: string
|
||||||
}>()
|
}>()
|
||||||
|
const scheduleTypeList = [
|
||||||
|
{value: 'Manually', label: '手动'},
|
||||||
|
{value: 'Fixed', label: '固定周期'},
|
||||||
|
{value: 'Cron', label: '自定义'},
|
||||||
|
]
|
||||||
const shortcuts = [
|
const shortcuts = [
|
||||||
{
|
{
|
||||||
text: '上周',
|
text: '上周',
|
||||||
|
|
@ -176,7 +192,7 @@ const status = [
|
||||||
]
|
]
|
||||||
|
|
||||||
const tableData = ref<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult[]>([])
|
const tableData = ref<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult[]>([])
|
||||||
const searchForm = reactive<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeParam>({
|
const searchForm = ref<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeParam>({
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 20,
|
size: 20,
|
||||||
})
|
})
|
||||||
|
|
@ -191,8 +207,8 @@ const pagination = reactive<G.Pagination>({
|
||||||
})
|
})
|
||||||
|
|
||||||
function pageChangeHandler(currentPage: number, pageSize: number) {
|
function pageChangeHandler(currentPage: number, pageSize: number) {
|
||||||
searchForm.current = currentPage
|
searchForm.value.current = currentPage
|
||||||
searchForm.size = pageSize
|
searchForm.value.size = pageSize
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,13 +225,29 @@ function delHandler({row}: { row: TaskScheduleRecodeTypes.SearchTaskScheduleReco
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(searchForm, {})
|
searchForm.value = {
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
}
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
function paging() {
|
function paging() {
|
||||||
searching.value = true
|
searching.value = true
|
||||||
TaskScheduleRecodeApi.paging({...searchForm, taskId: props.taskId})
|
const {
|
||||||
|
scheduleType,
|
||||||
|
scheduleTime,
|
||||||
|
taskStatus,
|
||||||
|
manually,
|
||||||
|
} = searchForm.value
|
||||||
|
TaskScheduleRecodeApi.paging({
|
||||||
|
taskId: props.taskId,
|
||||||
|
scheduleType,
|
||||||
|
taskStatus,
|
||||||
|
manually,
|
||||||
|
startTime: Colls.isEmpty(scheduleTime) ? undefined : Times.format(scheduleTime[0]),
|
||||||
|
endTime: Colls.isEmpty(scheduleTime) ? undefined : Times.format(scheduleTime[1]),
|
||||||
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
tableData.value = res.data?.records ?? []
|
tableData.value = res.data?.records ?? []
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,10 @@ export {}
|
||||||
declare global {
|
declare global {
|
||||||
namespace TaskScheduleRecodeTypes {
|
namespace TaskScheduleRecodeTypes {
|
||||||
interface SearchTaskScheduleRecodeParam extends G.PageParam {
|
interface SearchTaskScheduleRecodeParam extends G.PageParam {
|
||||||
// Id
|
|
||||||
id?: string
|
|
||||||
// 任务 Id
|
// 任务 Id
|
||||||
taskId?: string
|
taskId?: string
|
||||||
// 任务名称
|
|
||||||
taskName?: string
|
|
||||||
// 任务执行函数
|
|
||||||
fn?: string
|
|
||||||
// 调度方式
|
// 调度方式
|
||||||
scheduleType?: string
|
scheduleType?: string
|
||||||
// 调度配置
|
|
||||||
scheduleConf?: string
|
|
||||||
// 调度时间
|
// 调度时间
|
||||||
scheduleTime?: string
|
scheduleTime?: string
|
||||||
// 任务开始时间
|
// 任务开始时间
|
||||||
|
|
@ -22,12 +14,8 @@ declare global {
|
||||||
endTime?: string
|
endTime?: string
|
||||||
// 任务状态
|
// 任务状态
|
||||||
taskStatus?: string
|
taskStatus?: string
|
||||||
// 是否为内内置任务
|
|
||||||
builtin?: boolean
|
|
||||||
// 本次调度是否为手动触发
|
// 本次调度是否为手动触发
|
||||||
manually?: boolean
|
manually?: boolean
|
||||||
// 备注
|
|
||||||
memo?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SearchTaskScheduleRecodeResult {
|
interface SearchTaskScheduleRecodeResult {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue