mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2026-01-19 01:13:13 +08:00
refactor: 调整 eslint.config.js,优化代码格式
This commit is contained in:
@@ -193,7 +193,7 @@ const { job_trigger_type_enum, job_task_type_enum, job_route_strategy_enum, job_
|
||||
'job_trigger_type_enum',
|
||||
'job_task_type_enum',
|
||||
'job_route_strategy_enum',
|
||||
'job_block_strategy_enum'
|
||||
'job_block_strategy_enum',
|
||||
)
|
||||
|
||||
const dataId = ref()
|
||||
@@ -212,7 +212,7 @@ const rules: FormInstance['rules'] = {
|
||||
executorTimeout: [{ required: true, message: '请输入超时时间' }],
|
||||
maxRetryTimes: [{ required: true, message: '请输入最大重试次数' }],
|
||||
retryInterval: [{ required: true, message: '请输入重试间隔' }],
|
||||
parallelNum: [{ required: true, message: '请输入并行数' }]
|
||||
parallelNum: [{ required: true, message: '请输入并行数' }],
|
||||
}
|
||||
|
||||
const { form, resetForm } = useForm({
|
||||
@@ -224,7 +224,7 @@ const { form, resetForm } = useForm({
|
||||
executorTimeout: 60,
|
||||
maxRetryTimes: 3,
|
||||
retryInterval: 1,
|
||||
parallelNum: 1
|
||||
parallelNum: 1,
|
||||
})
|
||||
|
||||
const args = ref<any[]>([])
|
||||
@@ -241,7 +241,7 @@ const getGroupList = async () => {
|
||||
const { data } = await listGroup()
|
||||
groupList.value = data?.map((item: string) => ({
|
||||
label: item,
|
||||
value: item
|
||||
value: item,
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ const { job_status_enum, job_trigger_type_enum, job_task_type_enum, job_route_st
|
||||
'job_trigger_type_enum',
|
||||
'job_task_type_enum',
|
||||
'job_route_strategy_enum',
|
||||
'job_block_strategy_enum'
|
||||
'job_block_strategy_enum',
|
||||
)
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
<template #content>
|
||||
<a-textarea :model-value="parseCron(record.triggerInterval)" :auto-size="true" style="margin-top: 10px" />
|
||||
</template>
|
||||
<a-link>{{ record.triggerInterval }}</a-link>
|
||||
<a-link>{{ record.triggerInterval }}</a-link>
|
||||
</a-popover>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<template #taskType="{ record }">
|
||||
<GiCellTag :value="record.taskType" :dict="job_task_type_enum" />
|
||||
@@ -95,14 +95,14 @@ defineOptions({ name: 'ScheduleJob' })
|
||||
const { job_status_enum, job_trigger_type_enum, job_task_type_enum } = useDict('job_status_enum', 'job_trigger_type_enum', 'job_task_type_enum')
|
||||
|
||||
const queryForm = reactive<JobQuery>({
|
||||
groupName: ''
|
||||
groupName: '',
|
||||
})
|
||||
const {
|
||||
tableData: dataList,
|
||||
loading,
|
||||
pagination,
|
||||
search,
|
||||
handleDelete
|
||||
handleDelete,
|
||||
} = useTable((page) => listJob({ ...queryForm, ...page }), { immediate: false })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
@@ -110,7 +110,7 @@ const columns: TableInstanceColumns[] = [
|
||||
title: '序号',
|
||||
width: 66,
|
||||
align: 'center',
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize)
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
|
||||
},
|
||||
{ title: '任务名称', dataIndex: 'jobName', slotName: 'jobName', width: 100, ellipsis: true, tooltip: true },
|
||||
{ title: '调度类型', dataIndex: 'triggerType', slotName: 'triggerType', width: 130 },
|
||||
@@ -125,8 +125,8 @@ const columns: TableInstanceColumns[] = [
|
||||
width: 130,
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
show: has.hasPermOr(['schedule:job:trigger', 'schedule:job:update', 'schedule:job:delete'])
|
||||
}
|
||||
show: has.hasPermOr(['schedule:job:trigger', 'schedule:job:update', 'schedule:job:delete']),
|
||||
},
|
||||
]
|
||||
|
||||
const groupList = ref()
|
||||
@@ -135,7 +135,7 @@ const getGroupList = async () => {
|
||||
const { data } = await listGroup()
|
||||
groupList.value = data?.map((item: string) => ({
|
||||
label: item,
|
||||
value: item
|
||||
value: item,
|
||||
}))
|
||||
queryForm.groupName = groupList.value[0].label
|
||||
search()
|
||||
@@ -152,7 +152,7 @@ const reset = () => {
|
||||
const onDelete = (record: JobResp) => {
|
||||
return handleDelete(() => deleteJob(record.id), {
|
||||
content: `是否确定删除任务 [${record.jobName}]?`,
|
||||
showModal: true
|
||||
showModal: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
<template>
|
||||
<a-modal v-model:visible="visible" title="任务日志详情" :body-style="{ maxHeight: '80vh', overflow: 'auto' }"
|
||||
:width="width >= 1500 ? 1500 : '100%'" :footer="false" @close="closed">
|
||||
<a-modal
|
||||
v-model:visible="visible" title="任务日志详情" :body-style="{ maxHeight: '80vh', overflow: 'auto' }"
|
||||
:width="width >= 1500 ? 1500 : '100%'" :footer="false" @close="closed"
|
||||
>
|
||||
<div style="display: flex;">
|
||||
<div style="padding: 10px 10px;">
|
||||
<div class="job_list">
|
||||
<div v-for="item in dataList" :key="item.id" :class="`job_list_item ${item.id === activeId ? 'active' : ''}`"
|
||||
@click="onStartInfo(item)">
|
||||
<div
|
||||
v-for="item in dataList" :key="item.id" :class="`job_list_item ${item.id === activeId ? 'active' : ''}`"
|
||||
@click="onStartInfo(item)"
|
||||
>
|
||||
<div class="content">
|
||||
<span class="title">{{ item.clientInfo.split('@')[1] }}</span>
|
||||
<span class="status">
|
||||
<a-tag bordered :color="statusList[item.taskStatus].color">{{ statusList[item.taskStatus].title
|
||||
}}</a-tag>
|
||||
}}</a-tag>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -20,7 +24,7 @@
|
||||
<GiCodeView :code-json="content" />
|
||||
</div>
|
||||
</div>
|
||||
</a-modal>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -37,33 +41,33 @@ const statusList = {
|
||||
1: {
|
||||
title: '待处理',
|
||||
color: 'gray',
|
||||
isRun: false
|
||||
isRun: false,
|
||||
},
|
||||
2: {
|
||||
title: '运行中',
|
||||
color: 'cyan',
|
||||
isRun: true
|
||||
isRun: true,
|
||||
},
|
||||
3: {
|
||||
title: '成功',
|
||||
color: 'green',
|
||||
isRun: false
|
||||
isRun: false,
|
||||
},
|
||||
4: {
|
||||
title: '已失败',
|
||||
color: 'red',
|
||||
isRun: false
|
||||
isRun: false,
|
||||
},
|
||||
5: {
|
||||
title: '已停止',
|
||||
color: 'purple',
|
||||
isRun: false
|
||||
isRun: false,
|
||||
},
|
||||
6: {
|
||||
title: '已取消',
|
||||
color: 'orange',
|
||||
isRun: false
|
||||
}
|
||||
isRun: false,
|
||||
},
|
||||
}
|
||||
|
||||
const visible = ref(false)
|
||||
@@ -82,15 +86,6 @@ const formatLog = (log: any) => {
|
||||
const content = ref('')
|
||||
const setIntervalNode = ref<NodeJS.Timeout>()
|
||||
|
||||
// 详情
|
||||
const onDetail = (record: JobLogResp) => {
|
||||
visible.value = true
|
||||
// 更新 queryForm
|
||||
queryForm.jobId = record.jobId
|
||||
queryForm.taskBatchId = record.id
|
||||
getInstanceList()
|
||||
}
|
||||
|
||||
// 日志输出
|
||||
const onLogDetail = async (record: JobInstanceResp) => {
|
||||
activeId.value = record?.id
|
||||
@@ -102,7 +97,7 @@ const onLogDetail = async (record: JobInstanceResp) => {
|
||||
taskId: record.id,
|
||||
startId: 0,
|
||||
fromIndex: 0,
|
||||
size: 50
|
||||
size: 50,
|
||||
})
|
||||
if (res.data?.finished) {
|
||||
clearInterval(setIntervalNode.value)
|
||||
@@ -135,6 +130,16 @@ const getInstanceList = async (query: JobInstanceQuery = { ...queryForm }) => {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 详情
|
||||
const onDetail = (record: JobLogResp) => {
|
||||
visible.value = true
|
||||
// 更新 queryForm
|
||||
queryForm.jobId = record.jobId
|
||||
queryForm.taskBatchId = record.id
|
||||
getInstanceList()
|
||||
}
|
||||
|
||||
const closed = () => {
|
||||
clearInterval(setIntervalNode.value)
|
||||
}
|
||||
|
||||
@@ -82,14 +82,14 @@ const { job_execute_reason_enum, job_execute_status_enum } = useDict('job_execut
|
||||
const queryForm = reactive<JobLogQuery>({
|
||||
datetimeRange: [
|
||||
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
]
|
||||
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
],
|
||||
})
|
||||
const {
|
||||
tableData: dataList,
|
||||
pagination,
|
||||
loading,
|
||||
search
|
||||
search,
|
||||
} = useTable((page) => listJobLog({ ...queryForm, ...page }), { immediate: false })
|
||||
|
||||
const columns: TableInstanceColumns[] = [
|
||||
@@ -97,7 +97,7 @@ const columns: TableInstanceColumns[] = [
|
||||
title: '序号',
|
||||
width: 66,
|
||||
align: 'center',
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize)
|
||||
render: ({ rowIndex }) => h('span', {}, rowIndex + 1 + (pagination.current - 1) * pagination.pageSize),
|
||||
},
|
||||
{ title: '任务组', dataIndex: 'groupName', width: 80, ellipsis: true, tooltip: true },
|
||||
{ title: '任务名称', dataIndex: 'jobName', width: 80, ellipsis: true, tooltip: true },
|
||||
@@ -111,8 +111,8 @@ const columns: TableInstanceColumns[] = [
|
||||
width: 60,
|
||||
align: 'center',
|
||||
fixed: !isMobile() ? 'right' : undefined,
|
||||
show: has.hasPermOr(['schedule:log:stop', 'schedule:log:retry'])
|
||||
}
|
||||
show: has.hasPermOr(['schedule:log:stop', 'schedule:log:retry']),
|
||||
},
|
||||
]
|
||||
|
||||
const groupList = ref()
|
||||
@@ -121,7 +121,7 @@ const getGroupList = async () => {
|
||||
const { data } = await listGroup()
|
||||
groupList.value = data?.map((item: string) => ({
|
||||
label: item,
|
||||
value: item
|
||||
value: item,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ const reset = () => {
|
||||
queryForm.taskBatchStatus = undefined
|
||||
queryForm.datetimeRange = [
|
||||
dayjs().subtract(6, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
||||
dayjs().endOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
||||
]
|
||||
search()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user