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