定时任务
parent
15e88541bf
commit
695a0b2dfe
|
|
@ -1,12 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<el-config-provider :button="buttonConfig" >
|
<ElConfigProvider :button="buttonConfig" :locale="zhCn">
|
||||||
<router-view #="{ Component }">
|
<router-view #="{ Component }">
|
||||||
<component :is="Component"/>
|
<component :is="Component"/>
|
||||||
</router-view>
|
</router-view>
|
||||||
</el-config-provider>
|
</ElConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||||
|
|
||||||
const buttonConfig = reactive({
|
const buttonConfig = reactive({
|
||||||
autoInsertSpace: true,
|
autoInsertSpace: true,
|
||||||
type: 'default',
|
type: 'default',
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export class FMT {
|
||||||
*
|
*
|
||||||
* @return luxon 库的时间对象
|
* @return luxon 库的时间对象
|
||||||
*/
|
*/
|
||||||
export function now() {
|
function now() {
|
||||||
return DateTime.now()
|
return DateTime.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ export function now() {
|
||||||
* @param fmt 时间格式(仅时间字符串需要此参数,默认:yyyy-MM-dd HH:mm:ss)
|
* @param fmt 时间格式(仅时间字符串需要此参数,默认:yyyy-MM-dd HH:mm:ss)
|
||||||
* @return luxon 库的时间对象
|
* @return luxon 库的时间对象
|
||||||
*/
|
*/
|
||||||
export function parse(date: Date | number | string | DateObjectUnits, fmt: string = FMT.date_time_sec) {
|
function parse(date: Date | number | string | DateObjectUnits, fmt: string = FMT.date_time_sec) {
|
||||||
if (isDate(date)) {
|
if (isDate(date)) {
|
||||||
return DateTime.fromJSDate(date as Date)
|
return DateTime.fromJSDate(date as Date)
|
||||||
} else if (isNumber(date) || isNumStr(date)) {
|
} else if (isNumber(date) || isNumStr(date)) {
|
||||||
|
|
@ -61,7 +61,7 @@ export function parse(date: Date | number | string | DateObjectUnits, fmt: strin
|
||||||
* @param date luxon 库的时间对象、JS 时间对象
|
* @param date luxon 库的时间对象、JS 时间对象
|
||||||
* @param fmt 时间格式(仅时间字符串需要此参数,默认:yyyy-MM-dd HH:mm:ss)
|
* @param fmt 时间格式(仅时间字符串需要此参数,默认:yyyy-MM-dd HH:mm:ss)
|
||||||
*/
|
*/
|
||||||
export function format(date: DateTime<true | false> | Date, fmt: string = FMT.date_time_sec) {
|
function format(date: DateTime<true | false> | Date, fmt: string = FMT.date_time_sec) {
|
||||||
if (isDate(date)) {
|
if (isDate(date)) {
|
||||||
return DateTime.fromJSDate(date as Date).toFormat(fmt)
|
return DateTime.fromJSDate(date as Date).toFormat(fmt)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -73,11 +73,15 @@ export function format(date: DateTime<true | false> | Date, fmt: string = FMT.da
|
||||||
* 时间美化(如:1年前)
|
* 时间美化(如:1年前)
|
||||||
*
|
*
|
||||||
* @param date luxon 库的时间对象、JS 时间对象、时间戳(数字、字符串)、时间字符串、时间描述对象
|
* @param date luxon 库的时间对象、JS 时间对象、时间戳(数字、字符串)、时间字符串、时间描述对象
|
||||||
|
* @param other 另一个时间
|
||||||
*/
|
*/
|
||||||
export function pretty(date: DateTime<true | false> | Date | number | string) {
|
function pretty(date: DateTime<true | false> | Date | number | string, other: DateTime<true | false> | Date | number | string = DateTime.now()) {
|
||||||
if (!(date instanceof DateTime)) {
|
if (!(date instanceof DateTime)) {
|
||||||
date = parse(date)
|
date = parse(date)
|
||||||
}
|
}
|
||||||
|
if (!(other instanceof DateTime)) {
|
||||||
|
other = parse(other)
|
||||||
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
seconds,
|
seconds,
|
||||||
|
|
@ -87,7 +91,7 @@ export function pretty(date: DateTime<true | false> | Date | number | string) {
|
||||||
weeks,
|
weeks,
|
||||||
months,
|
months,
|
||||||
years,
|
years,
|
||||||
} = date.diff(DateTime.now(), [ 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' ])
|
} = date.diff(other, [ 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' ])
|
||||||
|
|
||||||
if (years > 0) {
|
if (years > 0) {
|
||||||
return `${years}年后`
|
return `${years}年后`
|
||||||
|
|
@ -124,7 +128,7 @@ export function pretty(date: DateTime<true | false> | Date | number | string) {
|
||||||
} else if (minutes > -5 && minutes <= -1) {
|
} else if (minutes > -5 && minutes <= -1) {
|
||||||
return '刚刚'
|
return '刚刚'
|
||||||
} else if (minutes <= -5) {
|
} else if (minutes <= -5) {
|
||||||
return `${minutes}分钟前`
|
return `${-minutes}分钟前`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (seconds > 0) {
|
if (seconds > 0) {
|
||||||
|
|
@ -136,21 +140,82 @@ export function pretty(date: DateTime<true | false> | Date | number | string) {
|
||||||
return '现在'
|
return '现在'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function endOfMonth(date?: DateTime<true | false>) {
|
function prettyDuration(date: DateTime<true | false> | Date | number | string, other: DateTime<true | false> | Date | number | string = DateTime.now()) {
|
||||||
|
if (!(date instanceof DateTime)) {
|
||||||
|
date = parse(date)
|
||||||
|
}
|
||||||
|
if (!(other instanceof DateTime)) {
|
||||||
|
other = parse(other)
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
seconds,
|
||||||
|
minutes,
|
||||||
|
hours,
|
||||||
|
days,
|
||||||
|
weeks,
|
||||||
|
months,
|
||||||
|
years,
|
||||||
|
} = date.diff(other, [ 'seconds', 'minutes', 'hours', 'days', 'weeks', 'months', 'years' ])
|
||||||
|
|
||||||
|
if (years > 0) {
|
||||||
|
return `${years}年`
|
||||||
|
} else if (years < 0) {
|
||||||
|
return `${-years}年`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (months > 0) {
|
||||||
|
return `${months}个月`
|
||||||
|
} else if (months < 0) {
|
||||||
|
return `${-months}个月`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (weeks > 0) {
|
||||||
|
return `${weeks}周`
|
||||||
|
} else if (weeks < 0) {
|
||||||
|
return `${-weeks}周`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (days > 0) {
|
||||||
|
return `${days}天`
|
||||||
|
} else if (days < 0) {
|
||||||
|
return `${-days}天`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hours > 0) {
|
||||||
|
return `${hours}小时`
|
||||||
|
} else if (hours < 0) {
|
||||||
|
return `${-hours}小时`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minutes > 0) {
|
||||||
|
return `${minutes}分钟`
|
||||||
|
} else if (minutes < 0) {
|
||||||
|
return `${minutes}分钟`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds > 0) {
|
||||||
|
return `${seconds}秒`
|
||||||
|
} else {
|
||||||
|
return '小于 1 秒'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function endOfMonth(date?: DateTime<true | false>) {
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
return date = now()
|
return date = now()
|
||||||
}
|
}
|
||||||
return date.endOf('month')
|
return date.endOf('month')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function beginOfMonth(date?: DateTime<true | false>) {
|
function beginOfMonth(date?: DateTime<true | false>) {
|
||||||
if (date == null) {
|
if (date == null) {
|
||||||
return date = now()
|
return date = now()
|
||||||
}
|
}
|
||||||
return date.startOf('month')
|
return date.startOf('month')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toDate(date: DateTime<true | false>) {
|
function toDate(date: DateTime<true | false>) {
|
||||||
return date.toJSDate()
|
return date.toJSDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,4 +228,5 @@ export default {
|
||||||
endOfMonth,
|
endOfMonth,
|
||||||
beginOfMonth,
|
beginOfMonth,
|
||||||
toDate,
|
toDate,
|
||||||
|
prettyDuration,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ declare module 'vue' {
|
||||||
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||||
ElContainer: typeof import('element-plus/es')['ElContainer']
|
ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||||
|
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
ElDivider: typeof import('element-plus/es')['ElDivider']
|
ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
|
|
@ -49,6 +50,7 @@ declare module 'vue' {
|
||||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||||
ElTabsPane: typeof import('element-plus/es')['ElTabsPane']
|
ElTabsPane: typeof import('element-plus/es')['ElTabsPane']
|
||||||
ElTag: typeof import('element-plus/es')['ElTag']
|
ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
|
ElText: typeof import('element-plus/es')['ElText']
|
||||||
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
||||||
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
|
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
|
||||||
|
|
@ -73,6 +75,7 @@ declare global {
|
||||||
const ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
const ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
|
||||||
const ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
const ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||||
const ElContainer: typeof import('element-plus/es')['ElContainer']
|
const ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||||
|
const ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
|
||||||
const ElDialog: typeof import('element-plus/es')['ElDialog']
|
const ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||||
const ElDivider: typeof import('element-plus/es')['ElDivider']
|
const ElDivider: typeof import('element-plus/es')['ElDivider']
|
||||||
const ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
const ElDropdown: typeof import('element-plus/es')['ElDropdown']
|
||||||
|
|
@ -100,6 +103,7 @@ declare global {
|
||||||
const ElTabs: typeof import('element-plus/es')['ElTabs']
|
const ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||||
const ElTabsPane: typeof import('element-plus/es')['ElTabsPane']
|
const ElTabsPane: typeof import('element-plus/es')['ElTabsPane']
|
||||||
const ElTag: typeof import('element-plus/es')['ElTag']
|
const ElTag: typeof import('element-plus/es')['ElTag']
|
||||||
|
const ElText: typeof import('element-plus/es')['ElText']
|
||||||
const ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
const ElTooltip: typeof import('element-plus/es')['ElTooltip']
|
||||||
const ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
const ElTransfer: typeof import('element-plus/es')['ElTransfer']
|
||||||
const ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
|
const ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,7 @@ interface ImportMeta {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.vue' {
|
declare module '*.vue' {
|
||||||
import {
|
import type { DefineComponent } from 'vue'
|
||||||
ComponentOptions,
|
const component: DefineComponent<{}, {}, any>
|
||||||
Directive,
|
export default component
|
||||||
} from 'vue'
|
|
||||||
const componentOptions: ComponentOptions
|
|
||||||
|
|
||||||
interface ComponentOptions {
|
|
||||||
directives?: {
|
|
||||||
print: Directive
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default componentOptions
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,35 +11,21 @@
|
||||||
v-model="searchForm.fn"
|
v-model="searchForm.fn"
|
||||||
placeholder="任务执行函数"/>
|
placeholder="任务执行函数"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="日志等级">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.logLevel"
|
|
||||||
placeholder="日志等级"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度方式">
|
<ElFormItem label="调度方式">
|
||||||
<ElInput
|
<ElSelect v-model="searchForm.scheduleType" clearable placeholder="请选择调度方式" style="width: 150px" @clear="paging">
|
||||||
v-model="searchForm.scheduleType"
|
<ElOption v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
placeholder="调度方式"/>
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="调度配置">
|
<ElFormItem label="内部任务">
|
||||||
<ElInput
|
<ElCheckbox
|
||||||
v-model="searchForm.scheduleConf"
|
v-model="searchForm.builtin"
|
||||||
placeholder="调度配置"/>
|
placeholder="内部任务"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="临界时间">
|
<ElFormItem v-if="!searchForm.builtin" label="状态">
|
||||||
<ElInput
|
<ElSelect v-model="searchForm.disabled" clearable placeholder="请选择状态" style="width: 150px" @clear="paging">
|
||||||
v-model="searchForm.criticalTiming"
|
<ElOption :value="true" label="禁用"/>
|
||||||
placeholder="临界时间"/>
|
<ElOption :value="false" label="启用"/>
|
||||||
</ElFormItem>
|
</ElSelect>
|
||||||
<!-- <ElFormItem label="是否禁用">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.disabled"
|
|
||||||
placeholder="是否禁用"/>
|
|
||||||
</ElFormItem> -->
|
|
||||||
<ElFormItem label="备注">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.memo"
|
|
||||||
placeholder="备注"/>
|
|
||||||
</ElFormItem>
|
</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>
|
||||||
|
|
@ -58,7 +44,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="logLevelTxt"/>
|
<ElTableColumn label="日志等级" prop="logLevelTxt"/>
|
||||||
|
|
||||||
|
|
@ -66,14 +52,19 @@
|
||||||
|
|
||||||
<ElTableColumn label="调度配置" prop="scheduleConf"/>
|
<ElTableColumn label="调度配置" prop="scheduleConf"/>
|
||||||
|
|
||||||
<ElTableColumn label="临界时间" prop="criticalTiming"/>
|
<ElTableColumn label="临界时间" prop="criticalTiming" width="170">
|
||||||
|
<template #default="{row}">
|
||||||
|
<span>
|
||||||
|
{{ row.criticalTiming != null && row.criticalTiming > 0 ? Times.format(Times.parse(row.criticalTiming * 1000)) : '' }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
<ElTableColumn label="是否禁用" width="180">
|
<ElTableColumn label="是否禁用" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div>
|
<span>
|
||||||
{{ scope.disabled?'是':'否' }}
|
{{ scope.row.disabled ? '是' : '否' }}
|
||||||
<!-- <ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton> -->
|
</span>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
|
|
||||||
|
|
@ -83,6 +74,7 @@
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="action-btn">
|
<div class="action-btn">
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
|
v-if="!scope.row.builtin"
|
||||||
cancel-button-type="primary"
|
cancel-button-type="primary"
|
||||||
cancel-button-text="否"
|
cancel-button-text="否"
|
||||||
confirm-button-type="danger"
|
confirm-button-type="danger"
|
||||||
|
|
@ -95,7 +87,9 @@
|
||||||
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
<ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
<ElButton v-if="!scope.row.builtin" text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
||||||
|
<ElButton v-if="!scope.row.builtin" text type="primary" @click="disable(scope)">{{ scope.row.disabled ? '启用' : '禁用' }}</ElButton>
|
||||||
|
<ElButton v-if="!scope.row.disabled" text type="primary" @click="trigger(scope)">执行一次</ElButton>
|
||||||
<ElButton text type="primary" @click="showRecode(scope.row.id)">调度记录</ElButton>
|
<ElButton text type="primary" @click="showRecode(scope.row.id)">调度记录</ElButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -108,7 +102,7 @@
|
||||||
:total="pagination.total"
|
:total="pagination.total"
|
||||||
@change="pageChangeHandler"/>
|
@change="pageChangeHandler"/>
|
||||||
<TaskForm ref="taskForm" @edit-succ="paging"/>
|
<TaskForm ref="taskForm" @edit-succ="paging"/>
|
||||||
<SchedulerecodeList ref="schedulerecode"/>
|
<ScheduleRecodePanel ref="scheduleRecodePanel"/>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
|
@ -116,24 +110,33 @@ import TaskApi from '@/pages/sys/task/task-api.ts'
|
||||||
import Page from '@/components/page/Page.vue'
|
import Page from '@/components/page/Page.vue'
|
||||||
import { elIcons } from '@/common/element/element.ts'
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
import TaskForm from '@/pages/sys/task/TaskForm.vue'
|
import TaskForm from '@/pages/sys/task/TaskForm.vue'
|
||||||
import SchedulerecodeList from '@/pages/sys/task/schedule-recode/SchedulerecodeList.vue'
|
import ScheduleRecode from '@/pages/sys/task/schedule-recode/ScheduleRecode.vue'
|
||||||
|
import ScheduleRecodePanel from '@/pages/sys/task/schedule-recode/ScheduleRecodePanel.vue'
|
||||||
|
import Times from '@/common/utils/times.ts'
|
||||||
|
|
||||||
const tableData = ref<TaskTypes.SearchTaskResult[]>([])
|
const tableData = ref<TaskTypes.SearchTaskResult[]>([])
|
||||||
const searchForm = reactive<TaskTypes.SearchTaskParam>({
|
const searchForm = reactive<TaskTypes.SearchTaskParam>({
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 20,
|
size: 20,
|
||||||
|
builtin: false,
|
||||||
})
|
})
|
||||||
const searching = ref(false)
|
const searching = ref(false)
|
||||||
const deling = ref(false)
|
const deling = ref(false)
|
||||||
const showSearchForm = ref(true)
|
const showSearchForm = ref(true)
|
||||||
const taskFormIns = useTemplateRef<InstanceType<typeof TaskForm>>('taskForm')
|
const taskFormIns = useTemplateRef<InstanceType<typeof TaskForm>>('taskForm')
|
||||||
const SchedulerecodeListIns = useTemplateRef<InstanceType<typeof SchedulerecodeList>>('schedulerecode')
|
const scheduleRecodePanelIns = useTemplateRef<InstanceType<typeof ScheduleRecode>>('scheduleRecodePanel')
|
||||||
const pagination = reactive<G.Pagination>({
|
const pagination = reactive<G.Pagination>({
|
||||||
total: 0,
|
total: 0,
|
||||||
pages: 0,
|
pages: 0,
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 1,
|
size: 1,
|
||||||
})
|
})
|
||||||
|
const scheduleTypeList = [
|
||||||
|
{value: 'Manually', label: '手动'},
|
||||||
|
{value: 'Fixed', label: '固定周期'},
|
||||||
|
{value: 'Cron', label: '自定义'},
|
||||||
|
]
|
||||||
|
|
||||||
function pageChangeHandler(currentPage: number, pageSize: number) {
|
function pageChangeHandler(currentPage: number, pageSize: number) {
|
||||||
searchForm.current = currentPage
|
searchForm.current = currentPage
|
||||||
searchForm.size = pageSize
|
searchForm.size = pageSize
|
||||||
|
|
@ -159,13 +162,31 @@ function delHandler({row}: { row: TaskTypes.SearchTaskResult }) {
|
||||||
function modifyHandler({row}: { row: TaskTypes.SearchTaskResult }) {
|
function modifyHandler({row}: { row: TaskTypes.SearchTaskResult }) {
|
||||||
showDialog(row)
|
showDialog(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trigger({row}: { row: TaskTypes.SearchTaskResult }) {
|
||||||
|
TaskApi.trigger(row.id!)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('已提交触发请求')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function disable({row}: { row: TaskTypes.SearchTaskResult }) {
|
||||||
|
TaskApi.disable(row.id!, !row.disabled!)
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success(row.disabled ? '启用成功' : '禁用成功')
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function addHandler() {
|
function addHandler() {
|
||||||
showDialog()
|
showDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(searchForm, {})
|
Object.assign(searchForm, {})
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
function paging() {
|
function paging() {
|
||||||
searching.value = true
|
searching.value = true
|
||||||
TaskApi.paging(searchForm)
|
TaskApi.paging(searchForm)
|
||||||
|
|
@ -177,10 +198,8 @@ function paging() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRecode(id:string) {
|
function showRecode(id: string) {
|
||||||
console.log(id,'idd')
|
scheduleRecodePanelIns.value?.open(id)
|
||||||
SchedulerecodeListIns.value?.open(id)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
@ -191,17 +210,21 @@ onMounted(() => {
|
||||||
.table-list {
|
.table-list {
|
||||||
flex 1;
|
flex 1;
|
||||||
width 100%
|
width 100%
|
||||||
|
|
||||||
:deep(.table-header) {
|
:deep(.table-header) {
|
||||||
color #454C59
|
color #454C59
|
||||||
|
|
||||||
th {
|
th {
|
||||||
background-color #EDF1F7
|
background-color #EDF1F7
|
||||||
font-weight 500
|
font-weight 500
|
||||||
position relative
|
position relative
|
||||||
|
|
||||||
& > div {
|
& > div {
|
||||||
display flex
|
display flex
|
||||||
gap 5px
|
gap 5px
|
||||||
align-items center
|
align-items center
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:first-child) > div::before {
|
&:not(:first-child) > div::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
|
|
@ -214,23 +237,28 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.table-cell) {
|
:deep(.table-cell) {
|
||||||
color #2F3540
|
color #2F3540
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
width 100%
|
width 100%
|
||||||
display flex
|
display flex
|
||||||
flex-wrap wrap
|
flex-wrap wrap
|
||||||
|
|
||||||
& > button {
|
& > button {
|
||||||
margin 0
|
margin 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tool-bar {
|
.tool-bar {
|
||||||
display flex
|
display flex
|
||||||
justify-content space-between
|
justify-content space-between
|
||||||
margin 0 0 20px 0
|
margin 0 0 20px 0
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination {
|
.pagination {
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
|
|
|
||||||
|
|
@ -7,35 +7,26 @@
|
||||||
<ElInput v-model="taskFormData.taskName" :disabled="status === 'view'" placeholder="任务名称"/>
|
<ElInput v-model="taskFormData.taskName" :disabled="status === 'view'" placeholder="任务名称"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="任务执行函数">
|
<ElFormItem label="任务执行函数">
|
||||||
<ElInput v-model="taskFormData.fn" :disabled="status === 'view'" placeholder="任务执行函数"/>
|
<ElSelect v-model="taskFormData.fn" :disabled="status === 'view'" placeholder="请选择任务执行函数">
|
||||||
|
<ElOption v-for="item in fnList" :key="item.fn" :label="item.fn" :value="item.fn!"/>
|
||||||
|
</ElSelect>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="日志等级">
|
<ElFormItem label="日志等级">
|
||||||
<el-select v-model="taskFormData.logLevel" placeholder="请选择日志等级">
|
<ElSelect v-model="taskFormData.logLevel" placeholder="请选择日志等级">
|
||||||
<el-option v-for="item in logLevelList" :key="item.value" :label="item.label" :value="item.value"/>
|
<ElOption v-for="item in logLevelList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</ElSelect>
|
||||||
<!-- <ElInput v-model="taskFormData.logLevel" :disabled="status === 'view'" placeholder="日志等级" /> -->
|
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="调度方式">
|
<ElFormItem label="调度方式">
|
||||||
<!-- <ElInput v-model="taskFormData.scheduleType" :disabled="status === 'view'" placeholder="调度方式" /> -->
|
<ElSelect v-model="taskFormData.scheduleType" placeholder="请选择调度方式" @change="taskFormData.scheduleConf = ''">
|
||||||
<el-select @change="taskFormData.scheduleConf = ''" v-model="taskFormData.scheduleType" placeholder="请选择调度方式">
|
<ElOption v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
<el-option v-for="item in scheduleTypeList" :key="item.value" :label="item.label" :value="item.value"/>
|
</ElSelect>
|
||||||
</el-select>
|
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="调度配置" v-if="taskFormData.scheduleType != 'Manually'">
|
<ElFormItem label="调度配置" v-if="taskFormData.scheduleType != 'Manually'">
|
||||||
<ElInput v-model="taskFormData.scheduleConf" :disabled="status === 'view'" placeholder="调度配置"/>
|
<ElInput v-model="taskFormData.scheduleConf" :disabled="status === 'view'" placeholder="调度配置"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<!-- <ElFormItem label="临界时间">
|
|
||||||
<ElInput v-model="taskFormData.criticalTiming" :disabled="status === 'view'" placeholder="临界时间" />
|
|
||||||
</ElFormItem> -->
|
|
||||||
<ElFormItem label="是否禁用">
|
<ElFormItem label="是否禁用">
|
||||||
<!-- <ElInput
|
<ElSwitch v-model="taskFormData.disabled" active-text="禁用" inactive-text="启用"/>
|
||||||
v-model="taskFormData.disabled"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="是否禁用"/> -->
|
|
||||||
|
|
||||||
<el-switch v-model="taskFormData.disabled" active-text="禁用" inactive-text="启用"/>
|
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
|
||||||
<ElFormItem label="备注">
|
<ElFormItem label="备注">
|
||||||
<ElInput v-model="taskFormData.memo" :disabled="status === 'view'" placeholder="备注"/>
|
<ElInput v-model="taskFormData.memo" :disabled="status === 'view'" placeholder="备注"/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
|
|
@ -68,6 +59,7 @@ const showDialog = ref(false)
|
||||||
const submiting = ref(false)
|
const submiting = ref(false)
|
||||||
const status = ref<'add' | 'view' | 'modify'>('add')
|
const status = ref<'add' | 'view' | 'modify'>('add')
|
||||||
let taskFormData = ref<TaskTypes.SearchTaskResult>({})
|
let taskFormData = ref<TaskTypes.SearchTaskResult>({})
|
||||||
|
const fnList = ref<TaskTypes.FnHandle[]>([])
|
||||||
|
|
||||||
function dialogCloseHandler() {
|
function dialogCloseHandler() {
|
||||||
taskFormData.value = {}
|
taskFormData.value = {}
|
||||||
|
|
@ -102,6 +94,9 @@ function submitHandler() {
|
||||||
defineExpose({
|
defineExpose({
|
||||||
open(data: TaskTypes.SearchTaskResult = {}) {
|
open(data: TaskTypes.SearchTaskResult = {}) {
|
||||||
showDialog.value = true
|
showDialog.value = true
|
||||||
|
TaskApi.fn().then(res => {
|
||||||
|
fnList.value = res.data
|
||||||
|
})
|
||||||
if (!Strings.isBlank(data.id)) {
|
if (!Strings.isBlank(data.id)) {
|
||||||
status.value = 'modify'
|
status.value = 'modify'
|
||||||
TaskApi.detail(data.id!).then((res) => {
|
TaskApi.detail(data.id!).then((res) => {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<template>
|
||||||
|
<ElDialog v-model="showDialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
width="80vw"
|
||||||
|
@close="dialogCloseHandler">
|
||||||
|
<ExecuteLog :schedule-id="scheduleId"/>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton @click="showDialog = false">关闭</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import ExecuteLog from '@/pages/sys/task/execute-log/ExecuteLog.vue'
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const scheduleId = ref<string>('')
|
||||||
|
|
||||||
|
function dialogCloseHandler() {
|
||||||
|
scheduleId.value = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open(data: string) {
|
||||||
|
showDialog.value = true
|
||||||
|
scheduleId.value = data
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
</style>
|
||||||
|
|
@ -1,78 +1,67 @@
|
||||||
<template>
|
<template>
|
||||||
<Page>
|
<div>
|
||||||
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
||||||
<ElFormItem label="调度 Id">
|
<ElFormItem label="日志时间">
|
||||||
<ElInput
|
<ElDatePicker
|
||||||
v-model="searchForm.scheduleId"
|
v-model="searchForm.logTime"
|
||||||
placeholder="调度 Id"/>
|
:shortcuts="shortcuts"
|
||||||
|
end-placeholder="结束"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始"
|
||||||
|
type="daterange"
|
||||||
|
unlink-panels
|
||||||
|
/>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
<ElFormItem label="日志等级">
|
<ElFormItem label="日志等级">
|
||||||
<ElInput
|
<ElSelect v-model="searchForm.logLevel" placeholder="请选择日志等级" style="width: 150px;">
|
||||||
v-model="searchForm.logLevel"
|
<ElOption v-for="item in logLevelList" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
placeholder="日志等级"/>
|
</ElSelect>
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="日志时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.logTime"
|
|
||||||
placeholder="日志时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="位置">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.place"
|
|
||||||
placeholder="位置"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="行号">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.line"
|
|
||||||
placeholder="行号"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="日志信息">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.msg"
|
|
||||||
placeholder="日志信息"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="错误信息">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.err"
|
|
||||||
placeholder="错误信息"/>
|
|
||||||
</ElFormItem>
|
</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>
|
||||||
</ElFormItem>
|
</ElFormItem>
|
||||||
</ElForm>
|
</ElForm>
|
||||||
|
|
||||||
<div class="tool-bar">
|
<div class="tool-bar">
|
||||||
<ElButton :icon="elIcons.Plus" type="primary" @click="addHandler">新建</ElButton>
|
|
||||||
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ElTable v-loading="searching" :data="tableData"
|
<ElTable v-loading="searching" :data="tableData"
|
||||||
cell-class-name="table-cell"
|
cell-class-name="table-cell"
|
||||||
class="table-list"
|
class="table-list"
|
||||||
empty-text="暂无数据"
|
empty-text="暂无数据"
|
||||||
header-row-class-name="table-header"
|
header-row-class-name="table-header"
|
||||||
row-key="id">
|
row-key="id">
|
||||||
<ElTableColumn label="调度 Id" prop="scheduleId"/>
|
<ElTableColumn label="日志等级" prop="logLevel" width="100">
|
||||||
|
<template #default="{row}">
|
||||||
<ElTableColumn label="日志等级" prop="logLevel"/>
|
<ElTag v-if="row.logLevel === 'DEBUG'" type="success">调试</ElTag>
|
||||||
|
<ElTag v-else-if="row.logLevel === 'INFO'" type="primary">普通</ElTag>
|
||||||
|
<ElTag v-else-if="row.logLevel === 'WARN'" type="warning">警告</ElTag>
|
||||||
|
<ElTag v-else type="danger">错误</ElTag>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
<ElTableColumn label="日志时间" prop="logTime"/>
|
<ElTableColumn label="日志时间" prop="logTime"/>
|
||||||
|
<!-- <ElTableColumn label="位置" prop="place" width="240" show-overflow-tooltip/> -->
|
||||||
<ElTableColumn label="位置" prop="place"/>
|
<!-- <ElTableColumn label="行号" prop="line"/> -->
|
||||||
|
<ElTableColumn label="日志信息" prop="msg">
|
||||||
<ElTableColumn label="行号" prop="line"/>
|
<template #default="{row}">
|
||||||
|
<span>{{ Strings.isBlank(row.msg) ? '' : (row.msg.length > 40 ? row.msg.substring(0, 40) + '...' : row.msg) }}</span>
|
||||||
<ElTableColumn label="日志信息" prop="msg"/>
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
<ElTableColumn label="错误信息" prop="err"/>
|
<ElTableColumn label="错误信息" prop="err">
|
||||||
|
<template #default="{row}">
|
||||||
|
<span>{{ Strings.isBlank(row.err) ? '' : (row.err.length > 40 ? row.err.substring(0, 40) + '...' : row.err) }}</span>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
<ElTableColumn label="操作" width="180">
|
<ElTableColumn label="操作" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="action-btn">
|
<div class="action-btn">
|
||||||
<el-popconfirm
|
<ElPopconfirm
|
||||||
cancel-button-text="否"
|
|
||||||
cancel-button-type="primary"
|
|
||||||
confirm-button-text="是"
|
confirm-button-text="是"
|
||||||
|
cancel-button-text="否"
|
||||||
confirm-button-type="danger"
|
confirm-button-type="danger"
|
||||||
|
cancel-button-type="primary"
|
||||||
placement="top"
|
placement="top"
|
||||||
title="是否删除当前数据?"
|
title="是否删除当前数据?"
|
||||||
width="180"
|
width="180"
|
||||||
|
|
@ -80,56 +69,117 @@
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
||||||
</template>
|
</template>
|
||||||
</el-popconfirm>
|
</ElPopconfirm>
|
||||||
<ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
<ElButton text type="primary" @click="showMsg(scope.row)">详情</ElButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ElTableColumn>
|
</ElTableColumn>
|
||||||
</ElTable>
|
</ElTable>
|
||||||
<ElPagination
|
<ElPagination
|
||||||
:page-size="pagination.size"
|
|
||||||
:total="pagination.total"
|
|
||||||
class="pagination"
|
class="pagination"
|
||||||
layout="prev, pager, next"
|
layout="prev, pager, next"
|
||||||
|
:page-size="pagination.size"
|
||||||
|
:total="pagination.total"
|
||||||
@change="pageChangeHandler"/>
|
@change="pageChangeHandler"/>
|
||||||
<Task_execute_logForm ref="task_execute_logForm" @edit-succ="paging"/>
|
<ElDialog v-model="showDialog"
|
||||||
</Page>
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
width="80vw">
|
||||||
|
<div class="msg-box">
|
||||||
|
<div class="msg-box-title">
|
||||||
|
<ElTag v-if="content.logLevel === 'DEBUG'" type="success">调试</ElTag>
|
||||||
|
<ElTag v-else-if="content.logLevel === 'INFO'" type="primary">普通</ElTag>
|
||||||
|
<ElTag v-else-if="content.logLevel === 'WARN'" type="warning">警告</ElTag>
|
||||||
|
<ElTag v-else type="danger">错误</ElTag>
|
||||||
|
<div>{{ content.logTime }}</div>
|
||||||
|
</div>
|
||||||
|
<ElText :type="content.logLevel === 'DEBUG'?'success':(content.logLevel === 'INFO'?'primary':(content.logLevel === 'WARN'?'warning':'danger'))">
|
||||||
|
<pre style="line-height: 21px;">{{ (Strings.isBlank(content.place) ? '' : (content.place + ' ')) + (content.line == null ? '' : ('(第' + content.line + '行)\n\n')) + (Strings.isBlank(content.msg) ? '' : (content.msg)) + (Strings.isBlank(content.err) ? '' : ('\n' + content.err)) }}</pre>
|
||||||
|
</ElText>
|
||||||
|
<!-- <ElInput type="textarea" resize="none" rows="20" :model-value="(Strings.isBlank(content.place) ? '':(content.place+'\n'))+(Strings.isBlank(content.line) ? '':(content.line+'\n')) + (Strings.isBlank(content.msg) ? '':(content.msg+'\n'))+'\n'+(Strings.isBlank(content.err) ? '':(content.err+'\n'))"/> -->
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton @click="showDialog = false">关闭</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
|
||||||
import executeLogApi from './execute-log-api.ts'
|
|
||||||
import Page from '@/components/page/Page.vue'
|
|
||||||
import { elIcons } from '@/common/element/element.ts'
|
|
||||||
import Task_execute_logForm from '@/pages/sys/task/execute-log/ExecutelogForm.vue'
|
|
||||||
|
|
||||||
const tableData = ref<Task_execute_logTypes.SearchTask_execute_logResult[]>([])
|
<script lang="ts" setup>
|
||||||
const searchForm = reactive<Task_execute_logTypes.SearchTask_execute_logParam>({
|
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'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
scheduleId: string
|
||||||
|
}>()
|
||||||
|
const showDialog = ref(false)
|
||||||
|
const content = ref<TaskExecuteLogTypes.SearchTaskExecuteLogResult>({})
|
||||||
|
|
||||||
|
const tableData = ref<TaskExecuteLogTypes.SearchTaskExecuteLogResult[]>([])
|
||||||
|
const searchForm = ref<TaskExecuteLogTypes.SearchTaskExecuteLogParam>({
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 20,
|
size: 20,
|
||||||
})
|
})
|
||||||
const searching = ref(false)
|
const searching = ref(false)
|
||||||
const deling = ref(false)
|
const deling = ref(false)
|
||||||
const showSearchForm = ref(true)
|
const showSearchForm = ref(true)
|
||||||
const task_execute_logFormIns = useTemplateRef<InstanceType<typeof Task_execute_logForm>>('task_execute_logForm')
|
|
||||||
const pagination = reactive<G.Pagination>({
|
const pagination = reactive<G.Pagination>({
|
||||||
total: 0,
|
total: 0,
|
||||||
pages: 0,
|
|
||||||
current: 1,
|
current: 1,
|
||||||
size: 1,
|
size: 1,
|
||||||
})
|
})
|
||||||
|
const shortcuts = [
|
||||||
|
{
|
||||||
|
text: '上周',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '上个月',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '最近三个月',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
const logLevelList = [
|
||||||
|
{value: 'DEBUG', label: '调试'},
|
||||||
|
{value: 'INFO', label: '普通'},
|
||||||
|
{value: 'WARN', label: '警告'},
|
||||||
|
{value: 'ERROR', label: '错误'},
|
||||||
|
{value: 'OFF', label: '关闭'},
|
||||||
|
]
|
||||||
|
|
||||||
|
function showMsg(data: TaskExecuteLogTypes.SearchTaskExecuteLogResult) {
|
||||||
|
showDialog.value = true
|
||||||
|
content.value = data
|
||||||
|
}
|
||||||
|
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDialog(data?: Task_execute_logTypes.SearchTask_execute_logResult) {
|
function delHandler({row}: { row: TaskExecuteLogTypes.SearchTaskExecuteLogResult }) {
|
||||||
task_execute_logFormIns.value?.open(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
function delHandler({row}: { row: Task_execute_logTypes.SearchTask_execute_logResult }) {
|
|
||||||
deling.value = true
|
deling.value = true
|
||||||
executeLogApi.del([ row.id! ])
|
TaskExecuteLogApi.del([ row.id! ])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
ElMessage.success('删除成功')
|
ElMessage.success('删除成功')
|
||||||
paging()
|
paging()
|
||||||
|
|
@ -139,22 +189,15 @@ function delHandler({row}: { row: Task_execute_logTypes.SearchTask_execute_logRe
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyHandler({row}: { row: Task_execute_logTypes.SearchTask_execute_logResult }) {
|
|
||||||
showDialog(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
function addHandler() {
|
|
||||||
showDialog()
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
Object.assign(searchForm, {})
|
searchForm.value = {}
|
||||||
paging()
|
paging()
|
||||||
}
|
}
|
||||||
|
|
||||||
function paging() {
|
function paging() {
|
||||||
searching.value = true
|
searching.value = true
|
||||||
executeLogApi.paging(searchForm)
|
TaskExecuteLogApi.paging({...searchForm.value, scheduleId: props.scheduleId})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
tableData.value = res.data?.records ?? []
|
tableData.value = res.data?.records ?? []
|
||||||
})
|
})
|
||||||
|
|
@ -166,10 +209,12 @@ function paging() {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
paging()
|
paging()
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
.table-list {
|
.table-list {
|
||||||
flex 1;
|
height 50vh;
|
||||||
width 100%
|
width 100%
|
||||||
|
|
||||||
:deep(.table-header) {
|
:deep(.table-header) {
|
||||||
|
|
@ -224,4 +269,23 @@ onMounted(() => {
|
||||||
justify-content: end;
|
justify-content: end;
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-box {
|
||||||
|
display flex
|
||||||
|
flex-direction column
|
||||||
|
gap 20px
|
||||||
|
|
||||||
|
.msg-box-title {
|
||||||
|
display flex
|
||||||
|
gap 20px
|
||||||
|
}
|
||||||
|
|
||||||
|
& > span {
|
||||||
|
display: block;
|
||||||
|
height: 60vh;
|
||||||
|
text-align: start;
|
||||||
|
width: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
<template>
|
|
||||||
<ElDialog v-model="showDialog"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
destroy-on-close
|
|
||||||
width="25vw">
|
|
||||||
<ElForm :model="task_execute_logFormData"
|
|
||||||
class="sys_task_execute_log-form"
|
|
||||||
label-width="auto">
|
|
||||||
<ElFormItem label="调度 Id">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.scheduleId"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="调度 Id"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="日志等级">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.logLevel"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="日志等级"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="日志时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.logTime"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="日志时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="位置">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.place"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="位置"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="行号">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.line"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="行号"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="日志信息">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.msg"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="日志信息"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="错误信息">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_execute_logFormData.err"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="错误信息"/>
|
|
||||||
</ElFormItem>
|
|
||||||
</ElForm>
|
|
||||||
<template #footer>
|
|
||||||
<ElButton @click="showDialog = false">{{ status === 'view' ? '关闭' : '取消' }}</ElButton>
|
|
||||||
<ElButton v-if="status !== 'view'" :loading="submiting" type="primary" @click="submitHandler">提交</ElButton>
|
|
||||||
</template>
|
|
||||||
</ElDialog>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Task_execute_logApi from './execute-log-api.ts'
|
|
||||||
import Strings from '@/common/utils/strings.ts'
|
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
|
|
||||||
const emits = defineEmits([ 'editSucc' ])
|
|
||||||
const showDialog = ref(false)
|
|
||||||
const submiting = ref(false)
|
|
||||||
const status = ref<'add' | 'view' | 'modify'>('add')
|
|
||||||
const task_execute_logFormData = reactive<Task_execute_logTypes.SearchTask_execute_logResult>({})
|
|
||||||
|
|
||||||
function submitHandler() {
|
|
||||||
if (status.value === 'view') return
|
|
||||||
submiting.value = true
|
|
||||||
if (task_execute_logFormData.id != null) {
|
|
||||||
Task_execute_logApi.modify(task_execute_logFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success('修改成功')
|
|
||||||
emits('editSucc')
|
|
||||||
showDialog.value = false
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Task_execute_logApi.add(task_execute_logFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success('添加成功')
|
|
||||||
emits('editSucc')
|
|
||||||
showDialog.value = false
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open(data: Task_execute_logTypes.SearchTask_execute_logResult = {}) {
|
|
||||||
showDialog.value = true
|
|
||||||
if (!Strings.isBlank(data.id)) {
|
|
||||||
status.value = 'modify'
|
|
||||||
Task_execute_logApi.detail(data.id!)
|
|
||||||
.then(res => {
|
|
||||||
Object.assign(task_execute_logFormData, res.data)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
status.value = 'add'
|
|
||||||
Object.assign(task_execute_logFormData, {})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
.sys_task_execute_log-form {
|
|
||||||
padding 20px
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -4,16 +4,16 @@ import {
|
||||||
} from '@/common/utils/http-util.ts'
|
} from '@/common/utils/http-util.ts'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
paging(data: Task_execute_logTypes.SearchTask_execute_logParam) {
|
paging(data: TaskExecuteLogTypes.SearchTaskExecuteLogParam) {
|
||||||
return get<G.PageResult<Task_execute_logTypes.SearchTask_execute_logResult>>('/task_execute_log/paging', data)
|
return get<G.PageResult<TaskExecuteLogTypes.SearchTaskExecuteLogResult>>('/task_execute_log/paging', data)
|
||||||
},
|
},
|
||||||
detail(id: string) {
|
detail(id: string) {
|
||||||
return get<Task_execute_logTypes.SearchTask_execute_logResult>('/task_execute_log/detail', {id})
|
return get<TaskExecuteLogTypes.SearchTaskExecuteLogResult>('/task_execute_log/detail', {id})
|
||||||
},
|
},
|
||||||
add(data: Task_execute_logTypes.AddTask_execute_logParam) {
|
add(data: TaskExecuteLogTypes.AddTaskExecuteLogParam) {
|
||||||
return post('/task_execute_log/add', data)
|
return post('/task_execute_log/add', data)
|
||||||
},
|
},
|
||||||
modify(data: Task_execute_logTypes.ModifyTask_execute_logParam) {
|
modify(data: TaskExecuteLogTypes.ModifyTaskExecuteLogParam) {
|
||||||
return post('/task_execute_log/modify', data)
|
return post('/task_execute_log/modify', data)
|
||||||
},
|
},
|
||||||
del(ids: string[]) {
|
del(ids: string[]) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
export {}
|
export {}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
namespace Task_execute_logTypes {
|
namespace TaskExecuteLogTypes {
|
||||||
interface SearchTask_execute_logParam extends G.PageParam {
|
interface SearchTaskExecuteLogParam extends G.PageParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 调度 Id
|
// 调度 Id;sys_task_schedule_recode.id
|
||||||
scheduleId?: string
|
scheduleId?: string
|
||||||
// 日志等级
|
// 日志等级
|
||||||
logLevel?: string
|
logLevel?: string
|
||||||
|
|
@ -18,12 +19,14 @@ declare global {
|
||||||
msg?: string
|
msg?: string
|
||||||
// 错误信息
|
// 错误信息
|
||||||
err?: string
|
err?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SearchTask_execute_logResult {
|
interface SearchTaskExecuteLogResult {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 调度 Id
|
// 调度 Id;sys_task_schedule_recode.id
|
||||||
scheduleId?: string
|
scheduleId?: string
|
||||||
// 日志等级
|
// 日志等级
|
||||||
logLevel?: string
|
logLevel?: string
|
||||||
|
|
@ -37,12 +40,14 @@ declare global {
|
||||||
msg?: string
|
msg?: string
|
||||||
// 错误信息
|
// 错误信息
|
||||||
err?: string
|
err?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AddTask_execute_logParam {
|
interface AddTaskExecuteLogParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 调度 Id
|
// 调度 Id;sys_task_schedule_recode.id
|
||||||
scheduleId?: string
|
scheduleId?: string
|
||||||
// 日志等级
|
// 日志等级
|
||||||
logLevel?: string
|
logLevel?: string
|
||||||
|
|
@ -56,12 +61,14 @@ declare global {
|
||||||
msg?: string
|
msg?: string
|
||||||
// 错误信息
|
// 错误信息
|
||||||
err?: string
|
err?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ModifyTask_execute_logParam {
|
interface ModifyTaskExecuteLogParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 调度 Id
|
// 调度 Id;sys_task_schedule_recode.id
|
||||||
scheduleId?: string
|
scheduleId?: string
|
||||||
// 日志等级
|
// 日志等级
|
||||||
logLevel?: string
|
logLevel?: string
|
||||||
|
|
@ -75,6 +82,8 @@ declare global {
|
||||||
msg?: string
|
msg?: string
|
||||||
// 错误信息
|
// 错误信息
|
||||||
err?: string
|
err?: string
|
||||||
|
// 创建时间
|
||||||
|
createTime?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export default {
|
|
||||||
component: () => import("@/pages/sys/task/execute-log/Executelog.vue"),
|
|
||||||
} as RouterTypes.RouteConfig;
|
|
||||||
|
|
@ -0,0 +1,288 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
||||||
|
<ElFormItem label="调度时间">
|
||||||
|
<ElDatePicker
|
||||||
|
v-model="searchForm.scheduleTime"
|
||||||
|
:shortcuts="shortcuts"
|
||||||
|
end-placeholder="结束"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始"
|
||||||
|
type="daterange"
|
||||||
|
unlink-panels
|
||||||
|
/>
|
||||||
|
</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>
|
||||||
|
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
||||||
|
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
||||||
|
</ElFormItem>
|
||||||
|
</ElForm>
|
||||||
|
<div class="tool-bar">
|
||||||
|
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
||||||
|
</div>
|
||||||
|
<ElTable v-loading="searching" :data="tableData"
|
||||||
|
cell-class-name="table-cell"
|
||||||
|
class="table-list"
|
||||||
|
empty-text="暂无数据"
|
||||||
|
header-row-class-name="table-header"
|
||||||
|
row-key="id">
|
||||||
|
<ElTableColumn label="任务名称" prop="taskName"/>
|
||||||
|
|
||||||
|
<ElTableColumn label="任务执行函数" prop="fn"/>
|
||||||
|
|
||||||
|
<ElTableColumn label="调度方式" prop="scheduleType">
|
||||||
|
|
||||||
|
<template #default="{row}">
|
||||||
|
{{ scheduleType(row.scheduleType) }}
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="调度配置" prop="scheduleConf"/>
|
||||||
|
|
||||||
|
<ElTableColumn label="调度时间" prop="scheduleTime">
|
||||||
|
<template #default="{row}">
|
||||||
|
<ElTooltip :content="row.scheduleTime" effect="dark" placement="top">
|
||||||
|
<span>{{ Times.pretty(row.scheduleTime) }}</span>
|
||||||
|
</ElTooltip>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="执行时间" prop="startTime">
|
||||||
|
<template #default="{row}">
|
||||||
|
<ElTooltip :content="row.startTime + ' 至 ' + row.endTime" effect="dark" placement="top">
|
||||||
|
<span>{{ Times.prettyDuration(row.startTime, row.endTime) }}</span>
|
||||||
|
</ElTooltip>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="任务状态" prop="taskStatus">
|
||||||
|
<template #default="{row}">
|
||||||
|
<ElTag v-if="row.taskStatus === 'Waiting'" type="info">等待调度</ElTag>
|
||||||
|
<ElTag v-if="row.taskStatus === 'Pending'" type="warning">排队中</ElTag>
|
||||||
|
<ElTag v-if="row.taskStatus === 'Running'" type="primary">运行中</ElTag>
|
||||||
|
<ElTag v-if="row.taskStatus === 'Completed'" type="success">已完成</ElTag>
|
||||||
|
<ElTag v-if="row.taskStatus === 'Error'" type="danger">错误</ElTag>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="内置任务" prop="builtin">
|
||||||
|
<template #default="{row}">
|
||||||
|
{{ row.builtin ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="手动触发" prop="manually">
|
||||||
|
<template #default="{row}">
|
||||||
|
{{ row.manually ? '是' : '否' }}
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
|
||||||
|
<ElTableColumn label="备注" prop="memo"/>
|
||||||
|
|
||||||
|
<ElTableColumn label="操作" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="action-btn">
|
||||||
|
<el-popconfirm
|
||||||
|
cancel-button-text="否"
|
||||||
|
cancel-button-type="primary"
|
||||||
|
confirm-button-text="是"
|
||||||
|
confirm-button-type="danger"
|
||||||
|
placement="top"
|
||||||
|
title="是否删除当前数据?"
|
||||||
|
width="180"
|
||||||
|
@confirm="delHandler(scope)">
|
||||||
|
<template #reference>
|
||||||
|
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
||||||
|
</template>
|
||||||
|
</el-popconfirm>
|
||||||
|
<ElButton text type="primary" @click="showLog(scope.row.id!)">查看日志</ElButton>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ElTableColumn>
|
||||||
|
</ElTable>
|
||||||
|
<ElPagination
|
||||||
|
:page-size="pagination.size"
|
||||||
|
:total="pagination.total"
|
||||||
|
class="pagination"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
@change="pageChangeHandler"/>
|
||||||
|
<ExecuteLogPanel ref="executeLogPanel"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import TaskScheduleRecodeApi from '@/pages/sys/task/schedule-recode/schedule-recode-api.ts'
|
||||||
|
import { elIcons } from '@/common/element/element.ts'
|
||||||
|
import Times from '@/common/utils/times.ts'
|
||||||
|
import ExecuteLogPanel from '@/pages/sys/task/execute-log/ExecuteLogPanel.vue'
|
||||||
|
|
||||||
|
const executeLogPanelIns = useTemplateRef<InstanceType<typeof ExecuteLogPanel>>('executeLogPanel')
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
taskId: string
|
||||||
|
}>()
|
||||||
|
const shortcuts = [
|
||||||
|
{
|
||||||
|
text: '上周',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '上个月',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '最近三个月',
|
||||||
|
value: () => {
|
||||||
|
const end = new Date()
|
||||||
|
const start = new Date()
|
||||||
|
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
||||||
|
return [ start, end ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
function showLog(id: string) {
|
||||||
|
executeLogPanelIns.value?.open(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
function scheduleType(type: string) {
|
||||||
|
return [
|
||||||
|
{value: 'Manually', label: '手动'},
|
||||||
|
{value: 'Fixed', label: '固定周期'},
|
||||||
|
{value: 'Cron', label: '自定义'},
|
||||||
|
].find(it => it.value === type)?.label
|
||||||
|
}
|
||||||
|
|
||||||
|
const status = [
|
||||||
|
{value: 'Waiting', label: '等待调度'},
|
||||||
|
{value: 'Pending', label: '排队中'},
|
||||||
|
{value: 'Running', label: '运行中'},
|
||||||
|
{value: 'Completed', label: '已完成'},
|
||||||
|
{value: 'Error', label: '错误'},
|
||||||
|
]
|
||||||
|
|
||||||
|
const tableData = ref<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult[]>([])
|
||||||
|
const searchForm = reactive<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeParam>({
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
})
|
||||||
|
const searching = ref(false)
|
||||||
|
const deling = ref(false)
|
||||||
|
const showSearchForm = ref(true)
|
||||||
|
const pagination = reactive<G.Pagination>({
|
||||||
|
total: 0,
|
||||||
|
pages: 0,
|
||||||
|
current: 1,
|
||||||
|
size: 20,
|
||||||
|
})
|
||||||
|
|
||||||
|
function pageChangeHandler(currentPage: number, pageSize: number) {
|
||||||
|
searchForm.current = currentPage
|
||||||
|
searchForm.size = pageSize
|
||||||
|
paging()
|
||||||
|
}
|
||||||
|
|
||||||
|
function delHandler({row}: { row: TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult }) {
|
||||||
|
deling.value = true
|
||||||
|
TaskScheduleRecodeApi.del([ row.id! ])
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success('删除成功')
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
deling.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
Object.assign(searchForm, {})
|
||||||
|
paging()
|
||||||
|
}
|
||||||
|
|
||||||
|
function paging() {
|
||||||
|
searching.value = true
|
||||||
|
TaskScheduleRecodeApi.paging({...searchForm, taskId: props.taskId})
|
||||||
|
.then(res => {
|
||||||
|
tableData.value = res.data?.records ?? []
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
searching.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
paging()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
.table-list {
|
||||||
|
height 50vh;
|
||||||
|
width 100%
|
||||||
|
|
||||||
|
:deep(.table-header) {
|
||||||
|
color #454C59
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color #EDF1F7
|
||||||
|
font-weight 500
|
||||||
|
position relative
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display flex
|
||||||
|
gap 5px
|
||||||
|
align-items center
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(:first-child) > div::before {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 1px;
|
||||||
|
width: 1px;
|
||||||
|
background-color: #D3D7DE;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
content: "";
|
||||||
|
height 50%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.table-cell) {
|
||||||
|
color #2F3540
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn {
|
||||||
|
width 100%
|
||||||
|
display flex
|
||||||
|
flex-wrap wrap
|
||||||
|
|
||||||
|
& > button {
|
||||||
|
margin 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool-bar {
|
||||||
|
display flex
|
||||||
|
justify-content space-between
|
||||||
|
margin 0 0 20px 0
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
justify-content: end;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<template>
|
||||||
|
<ElDialog v-model="showDialog"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
width="80vw">
|
||||||
|
<ScheduleRecode :task-id="taskId"/>
|
||||||
|
<template #footer>
|
||||||
|
<ElButton @click="showDialog = false">关闭</ElButton>
|
||||||
|
</template>
|
||||||
|
</ElDialog>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import ScheduleRecode from '@/pages/sys/task/schedule-recode/ScheduleRecode.vue'
|
||||||
|
|
||||||
|
const showDialog = ref(false)
|
||||||
|
|
||||||
|
const taskId = ref('')
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open(data: string) {
|
||||||
|
showDialog.value = true
|
||||||
|
taskId.value = data
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
</style>
|
||||||
|
|
@ -1,262 +0,0 @@
|
||||||
<template>
|
|
||||||
<Page>
|
|
||||||
<ElForm v-show="showSearchForm" inline @submit.prevent="paging">
|
|
||||||
<ElFormItem label="任务 Id">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.taskId"
|
|
||||||
placeholder="任务 Id"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务名称">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.taskName"
|
|
||||||
placeholder="任务名称"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务执行函数">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.fn"
|
|
||||||
placeholder="任务执行函数"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度方式">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.scheduleType"
|
|
||||||
placeholder="调度方式"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度配置">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.scheduleConf"
|
|
||||||
placeholder="调度配置"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.scheduleTime"
|
|
||||||
placeholder="调度时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务开始时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.startTime"
|
|
||||||
placeholder="任务开始时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务结束时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.endTime"
|
|
||||||
placeholder="任务结束时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务状态">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.taskStatus"
|
|
||||||
placeholder="任务状态"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="是否为内内置任务">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.builtin"
|
|
||||||
placeholder="是否为内内置任务"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="本次调度是否为手动触发">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.manually"
|
|
||||||
placeholder="本次调度是否为手动触发"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="备注">
|
|
||||||
<ElInput
|
|
||||||
v-model="searchForm.memo"
|
|
||||||
placeholder="备注"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem>
|
|
||||||
<ElButton :icon="elIcons.Search" :loading="searching" native-type="submit" type="primary">搜索</ElButton>
|
|
||||||
<ElButton :icon="elIcons.Refresh" :loading="searching" @click="reset">重置</ElButton>
|
|
||||||
</ElFormItem>
|
|
||||||
</ElForm>
|
|
||||||
<div class="tool-bar">
|
|
||||||
<ElButton :icon="elIcons.Plus" type="primary" @click="addHandler">新建</ElButton>
|
|
||||||
<ElButton :icon="elIcons.Filter" type="default" @click="showSearchForm = !showSearchForm"/>
|
|
||||||
</div>
|
|
||||||
<ElTable v-loading="searching" :data="tableData"
|
|
||||||
cell-class-name="table-cell"
|
|
||||||
class="table-list"
|
|
||||||
empty-text="暂无数据"
|
|
||||||
header-row-class-name="table-header"
|
|
||||||
row-key="id">
|
|
||||||
<ElTableColumn label="任务 Id" prop="taskId"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="任务名称" prop="taskName"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="任务执行函数" prop="fn"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="调度方式" prop="scheduleType"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="调度配置" prop="scheduleConf"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="调度时间" prop="scheduleTime"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="任务开始时间" prop="startTime"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="任务结束时间" prop="endTime"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="任务状态" prop="taskStatus"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="是否为内内置任务" prop="builtin"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="本次调度是否为手动触发" prop="manually"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="备注" prop="memo"/>
|
|
||||||
|
|
||||||
<ElTableColumn label="操作" width="180">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="action-btn">
|
|
||||||
<el-popconfirm
|
|
||||||
cancel-button-text="否"
|
|
||||||
cancel-button-type="primary"
|
|
||||||
confirm-button-text="是"
|
|
||||||
confirm-button-type="danger"
|
|
||||||
placement="top"
|
|
||||||
title="是否删除当前数据?"
|
|
||||||
width="180"
|
|
||||||
@confirm="delHandler(scope)">
|
|
||||||
<template #reference>
|
|
||||||
<ElButton :loading="deling" text type="danger">删除</ElButton>
|
|
||||||
</template>
|
|
||||||
</el-popconfirm>
|
|
||||||
<ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</ElTableColumn>
|
|
||||||
</ElTable>
|
|
||||||
<ElPagination
|
|
||||||
:page-size="pagination.size"
|
|
||||||
:total="pagination.total"
|
|
||||||
class="pagination"
|
|
||||||
layout="prev, pager, next"
|
|
||||||
@change="pageChangeHandler"/>
|
|
||||||
<Task_schedule_recodeForm ref="task_schedule_recodeForm" @edit-succ="paging"/>
|
|
||||||
</Page>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Task_schedule_recodeApi from '@/pages/sys/task_schedule_recode/task_schedule_recode-api.ts'
|
|
||||||
import Page from '@/components/page/Page.vue'
|
|
||||||
import { elIcons } from '@/common/element/element.ts'
|
|
||||||
import Task_schedule_recodeForm from '@/pages/sys/task_schedule_recode/Task_schedule_recodeForm.vue'
|
|
||||||
|
|
||||||
const tableData = ref<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult[]>([])
|
|
||||||
const searchForm = reactive<Task_schedule_recodeTypes.SearchTask_schedule_recodeParam>({
|
|
||||||
current: 1,
|
|
||||||
size: 20,
|
|
||||||
})
|
|
||||||
const searching = ref(false)
|
|
||||||
const deling = ref(false)
|
|
||||||
const showSearchForm = ref(true)
|
|
||||||
const task_schedule_recodeFormIns = useTemplateRef<InstanceType<typeof Task_schedule_recodeForm>>('task_schedule_recodeForm')
|
|
||||||
const pagination = reactive<G.Pagination>({
|
|
||||||
total: 0,
|
|
||||||
pages: 0,
|
|
||||||
current: 1,
|
|
||||||
size: 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
function pageChangeHandler(currentPage: number, pageSize: number) {
|
|
||||||
searchForm.current = currentPage
|
|
||||||
searchForm.size = pageSize
|
|
||||||
paging()
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDialog(data?: Task_schedule_recodeTypes.SearchTask_schedule_recodeResult) {
|
|
||||||
task_schedule_recodeFormIns.value?.open(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
function delHandler({row}: { row: Task_schedule_recodeTypes.SearchTask_schedule_recodeResult }) {
|
|
||||||
deling.value = true
|
|
||||||
Task_schedule_recodeApi.del([ row.id! ])
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success('删除成功')
|
|
||||||
paging()
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
deling.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function modifyHandler({row}: { row: Task_schedule_recodeTypes.SearchTask_schedule_recodeResult }) {
|
|
||||||
showDialog(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
function addHandler() {
|
|
||||||
showDialog()
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
|
||||||
Object.assign(searchForm, {})
|
|
||||||
paging()
|
|
||||||
}
|
|
||||||
|
|
||||||
function paging() {
|
|
||||||
searching.value = true
|
|
||||||
Task_schedule_recodeApi.paging(searchForm)
|
|
||||||
.then(res => {
|
|
||||||
tableData.value = res.data?.records ?? []
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
searching.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
paging()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
.table-list {
|
|
||||||
flex 1;
|
|
||||||
width 100%
|
|
||||||
|
|
||||||
:deep(.table-header) {
|
|
||||||
color #454C59
|
|
||||||
|
|
||||||
th {
|
|
||||||
background-color #EDF1F7
|
|
||||||
font-weight 500
|
|
||||||
position relative
|
|
||||||
|
|
||||||
& > div {
|
|
||||||
display flex
|
|
||||||
gap 5px
|
|
||||||
align-items center
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(:first-child) > div::before {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 1px;
|
|
||||||
width: 1px;
|
|
||||||
background-color: #D3D7DE;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
content: "";
|
|
||||||
height 50%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.table-cell) {
|
|
||||||
color #2F3540
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-btn {
|
|
||||||
width 100%
|
|
||||||
display flex
|
|
||||||
flex-wrap wrap
|
|
||||||
|
|
||||||
& > button {
|
|
||||||
margin 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.tool-bar {
|
|
||||||
display flex
|
|
||||||
justify-content space-between
|
|
||||||
margin 0 0 20px 0
|
|
||||||
}
|
|
||||||
|
|
||||||
.pagination {
|
|
||||||
justify-content: end;
|
|
||||||
margin: 8px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,145 +0,0 @@
|
||||||
<template>
|
|
||||||
<ElDialog v-model="showDialog"
|
|
||||||
:close-on-click-modal="false"
|
|
||||||
destroy-on-close
|
|
||||||
width="25vw">
|
|
||||||
<ElForm :model="task_schedule_recodeFormData"
|
|
||||||
class="sys_task_schedule_recode-form"
|
|
||||||
label-width="auto">
|
|
||||||
<ElFormItem label="任务 Id">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.taskId"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务 Id"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务名称">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.taskName"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务名称"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务执行函数">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.fn"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务执行函数"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度方式">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.scheduleType"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="调度方式"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度配置">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.scheduleConf"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="调度配置"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="调度时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.scheduleTime"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="调度时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务开始时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.startTime"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务开始时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务结束时间">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.endTime"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务结束时间"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="任务状态">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.taskStatus"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="任务状态"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="是否为内内置任务">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.builtin"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="是否为内内置任务"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="本次调度是否为手动触发">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.manually"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="本次调度是否为手动触发"/>
|
|
||||||
</ElFormItem>
|
|
||||||
<ElFormItem label="备注">
|
|
||||||
<ElInput
|
|
||||||
v-model="task_schedule_recodeFormData.memo"
|
|
||||||
:disabled="status === 'view'"
|
|
||||||
placeholder="备注"/>
|
|
||||||
</ElFormItem>
|
|
||||||
</ElForm>
|
|
||||||
<template #footer>
|
|
||||||
<ElButton @click="showDialog = false">{{ status === 'view' ? '关闭' : '取消' }}</ElButton>
|
|
||||||
<ElButton v-if="status !== 'view'" :loading="submiting" type="primary" @click="submitHandler">提交</ElButton>
|
|
||||||
</template>
|
|
||||||
</ElDialog>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Task_schedule_recodeApi from '@/pages/sys/task_schedule_recode/task_schedule_recode-api.ts'
|
|
||||||
import Strings from '@/common/utils/strings.ts'
|
|
||||||
import { ElMessage } from 'element-plus'
|
|
||||||
|
|
||||||
const emits = defineEmits([ 'editSucc' ])
|
|
||||||
const showDialog = ref(false)
|
|
||||||
const submiting = ref(false)
|
|
||||||
const status = ref<'add' | 'view' | 'modify'>('add')
|
|
||||||
const task_schedule_recodeFormData = reactive<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult>({})
|
|
||||||
|
|
||||||
function submitHandler() {
|
|
||||||
if (status.value === 'view') return
|
|
||||||
submiting.value = true
|
|
||||||
if (task_schedule_recodeFormData.id != null) {
|
|
||||||
Task_schedule_recodeApi.modify(task_schedule_recodeFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success('修改成功')
|
|
||||||
emits('editSucc')
|
|
||||||
showDialog.value = false
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Task_schedule_recodeApi.add(task_schedule_recodeFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success('添加成功')
|
|
||||||
emits('editSucc')
|
|
||||||
showDialog.value = false
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open(data: Task_schedule_recodeTypes.SearchTask_schedule_recodeResult = {}) {
|
|
||||||
showDialog.value = true
|
|
||||||
if (!Strings.isBlank(data.id)) {
|
|
||||||
status.value = 'modify'
|
|
||||||
Task_schedule_recodeApi.detail(data.id!)
|
|
||||||
.then(res => {
|
|
||||||
Object.assign(task_schedule_recodeFormData, res.data)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
status.value = 'add'
|
|
||||||
Object.assign(task_schedule_recodeFormData, {})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
.sys_task_schedule_recode-form {
|
|
||||||
padding 20px
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
<template>
|
|
||||||
<ElDialog v-model="showDialog" :close-on-click-modal="false" destroy-on-close width="75vw">
|
|
||||||
<ElTable :data="tableData" cell-class-name="table-cell" class="table-list" empty-text="暂无数据" header-row-class-name="table-header" row-key="id">
|
|
||||||
<ElTableColumn label="任务 Id" prop="taskId" width="80" />
|
|
||||||
|
|
||||||
<ElTableColumn label="任务名称" prop="taskName" />
|
|
||||||
|
|
||||||
<ElTableColumn label="任务执行函数" prop="fn" />
|
|
||||||
|
|
||||||
<ElTableColumn label="调度方式" prop="scheduleType" />
|
|
||||||
|
|
||||||
<ElTableColumn label="调度配置" prop="scheduleConf" />
|
|
||||||
|
|
||||||
<ElTableColumn label="调度时间" prop="scheduleTime" />
|
|
||||||
|
|
||||||
<ElTableColumn label="任务开始时间" prop="startTime" />
|
|
||||||
|
|
||||||
<ElTableColumn label="任务结束时间" prop="endTime" />
|
|
||||||
|
|
||||||
<ElTableColumn label="任务状态" prop="taskStatus" />
|
|
||||||
|
|
||||||
<ElTableColumn label="是否为内内置任务" prop="builtin" />
|
|
||||||
|
|
||||||
<ElTableColumn label="本次调度是否为手动触发" prop="manually" />
|
|
||||||
|
|
||||||
<ElTableColumn label="备注" prop="memo" />
|
|
||||||
|
|
||||||
<ElTableColumn label="操作" width="180">
|
|
||||||
<template #default="scope">
|
|
||||||
<div class="action-btn">
|
|
||||||
<!-- <ElButton text type="primary" @click="modifyHandler(scope)">修改</ElButton> -->
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</ElTableColumn>
|
|
||||||
</ElTable>
|
|
||||||
<template #footer>
|
|
||||||
<ElButton @click="showDialog = false">{{ status === "view" ? "关闭" : "取消" }}</ElButton>
|
|
||||||
<ElButton v-if="status !== 'view'" :loading="submiting" type="primary" @click="submitHandler">提交</ElButton>
|
|
||||||
</template>
|
|
||||||
</ElDialog>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import Task_schedule_recodeApi from "@/pages/sys/task/schedule-recode/schedule-recode-api.ts";
|
|
||||||
import Strings from "@/common/utils/strings.ts";
|
|
||||||
import { ElMessage } from "element-plus";
|
|
||||||
|
|
||||||
const emits = defineEmits(["editSucc"]);
|
|
||||||
const showDialog = ref(false);
|
|
||||||
const submiting = ref(false);
|
|
||||||
const status = ref<"add" | "view" | "modify">("add");
|
|
||||||
const task_schedule_recodeFormData = reactive<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult>({});
|
|
||||||
const tableData = ref<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult[]>([]);
|
|
||||||
|
|
||||||
function submitHandler() {
|
|
||||||
if (status.value === "view") return;
|
|
||||||
submiting.value = true;
|
|
||||||
if (task_schedule_recodeFormData.id != null) {
|
|
||||||
Task_schedule_recodeApi.modify(task_schedule_recodeFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success("修改成功");
|
|
||||||
emits("editSucc");
|
|
||||||
showDialog.value = false;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Task_schedule_recodeApi.add(task_schedule_recodeFormData)
|
|
||||||
.then(() => {
|
|
||||||
ElMessage.success("添加成功");
|
|
||||||
emits("editSucc");
|
|
||||||
showDialog.value = false;
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
submiting.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
open(id: string) {
|
|
||||||
console.log(id, "idd");
|
|
||||||
showDialog.value = true;
|
|
||||||
Task_schedule_recodeApi.paging({ taskId: id }).then((res) => {
|
|
||||||
console.log(res.data);
|
|
||||||
// tableData.value=res.data.list
|
|
||||||
// Object.assign(task_schedule_recodeFormData, res.data)
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style lang="stylus" scoped>
|
|
||||||
.sys_task_schedule_recode-form {
|
|
||||||
padding 20px
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
export default {
|
|
||||||
component: () => import("@/pages/sys/task/schedule-recode/Schedulerecode.vue"),
|
|
||||||
} as RouterTypes.RouteConfig;
|
|
||||||
|
|
@ -4,16 +4,16 @@ import {
|
||||||
} from '@/common/utils/http-util.ts'
|
} from '@/common/utils/http-util.ts'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
paging(data: Task_schedule_recodeTypes.SearchTask_schedule_recodeParam) {
|
paging(data: TaskScheduleRecodeTypes.SearchTaskScheduleRecodeParam) {
|
||||||
return get<G.PageResult<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult>>('/task_schedule_recode/paging', data)
|
return get<G.PageResult<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult>>('/task_schedule_recode/paging', data)
|
||||||
},
|
},
|
||||||
detail(id: string) {
|
detail(id: string) {
|
||||||
return get<Task_schedule_recodeTypes.SearchTask_schedule_recodeResult>('/task_schedule_recode/detail', {id})
|
return get<TaskScheduleRecodeTypes.SearchTaskScheduleRecodeResult>('/task_schedule_recode/detail', {id})
|
||||||
},
|
},
|
||||||
add(data: Task_schedule_recodeTypes.AddTask_schedule_recodeParam) {
|
add(data: TaskScheduleRecodeTypes.AddTaskScheduleRecodeParam) {
|
||||||
return post('/task_schedule_recode/add', data)
|
return post('/task_schedule_recode/add', data)
|
||||||
},
|
},
|
||||||
modify(data: Task_schedule_recodeTypes.ModifyTask_schedule_recodeParam) {
|
modify(data: TaskScheduleRecodeTypes.ModifyTaskScheduleRecodeParam) {
|
||||||
return post('/task_schedule_recode/modify', data)
|
return post('/task_schedule_recode/modify', data)
|
||||||
},
|
},
|
||||||
del(ids: string[]) {
|
del(ids: string[]) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
export {}
|
export {}
|
||||||
declare global {
|
declare global {
|
||||||
namespace Task_schedule_recodeTypes {
|
namespace TaskScheduleRecodeTypes {
|
||||||
interface SearchTask_schedule_recodeParam extends G.PageParam {
|
interface SearchTaskScheduleRecodeParam extends G.PageParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 任务 Id
|
// 任务 Id
|
||||||
|
|
@ -30,7 +30,7 @@ declare global {
|
||||||
memo?: string
|
memo?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SearchTask_schedule_recodeResult {
|
interface SearchTaskScheduleRecodeResult {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 任务 Id
|
// 任务 Id
|
||||||
|
|
@ -59,7 +59,7 @@ declare global {
|
||||||
memo?: string
|
memo?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AddTask_schedule_recodeParam {
|
interface AddTaskScheduleRecodeParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 任务 Id
|
// 任务 Id
|
||||||
|
|
@ -88,7 +88,7 @@ declare global {
|
||||||
memo?: string
|
memo?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ModifyTask_schedule_recodeParam {
|
interface ModifyTaskScheduleRecodeParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
// 任务 Id
|
// 任务 Id
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,15 @@ export default {
|
||||||
detail(id: string) {
|
detail(id: string) {
|
||||||
return get<TaskTypes.SearchTaskResult>('/task/detail', {id})
|
return get<TaskTypes.SearchTaskResult>('/task/detail', {id})
|
||||||
},
|
},
|
||||||
|
fn(keywords?: string) {
|
||||||
|
return get<TaskTypes.FnHandle[]>('/task/fn', {keywords})
|
||||||
|
},
|
||||||
|
trigger(id: string) {
|
||||||
|
return get<boolean>('/task/trigger', {id})
|
||||||
|
},
|
||||||
|
disable(id: string, disable: boolean) {
|
||||||
|
return get<boolean>('/task/disable', {id, disable})
|
||||||
|
},
|
||||||
add(data: TaskTypes.AddTaskParam) {
|
add(data: TaskTypes.AddTaskParam) {
|
||||||
return post('/task/add', data)
|
return post('/task/add', data)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ declare global {
|
||||||
criticalTiming?: string
|
criticalTiming?: string
|
||||||
// 是否禁用
|
// 是否禁用
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
builtin?: boolean
|
||||||
// 备注
|
// 备注
|
||||||
memo?: string
|
memo?: string
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +44,13 @@ declare global {
|
||||||
memo?: string
|
memo?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface FnHandle {
|
||||||
|
// Id
|
||||||
|
fn?: string
|
||||||
|
// 任务名称
|
||||||
|
defineName?: string
|
||||||
|
}
|
||||||
|
|
||||||
interface AddTaskParam {
|
interface AddTaskParam {
|
||||||
// Id
|
// Id
|
||||||
id?: string
|
id?: string
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts",
|
"src/**/*.ts",
|
||||||
"src/**/*.tsx",
|
"src/**/*.tsx",
|
||||||
|
"src/**/*.d.ts",
|
||||||
"src/**/*.vue"
|
"src/**/*.vue"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue