style: 调度任务多语言

This commit is contained in:
TsMask
2023-11-10 19:12:43 +08:00
parent d72ba4622e
commit 7ffcc2f881
10 changed files with 467 additions and 175 deletions

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
import { reactive, watch, onBeforeMount } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['update:value']);
const props = defineProps({
value: {
@@ -85,9 +88,11 @@ onBeforeMount(() => {
<template>
<a-radio-group size="small" v-model:value="data.type">
<a-space direction="vertical" :size="18">
<a-radio value="1">每一天</a-radio>
<a-radio value="1">
{{ t('components.CronModal.day1') }}
</a-radio>
<a-radio value="2">
每隔
{{ t('components.CronModal.day21') }}
<a-input-number
size="small"
v-model:value="data.increment"
@@ -95,7 +100,7 @@ onBeforeMount(() => {
:max="31"
placeholder="1-31"
></a-input-number>
天执行一次
{{ t('components.CronModal.day22') }}
<a-input-number
size="small"
v-model:value="data.incrementStart"
@@ -103,10 +108,10 @@ onBeforeMount(() => {
:max="31"
placeholder="1-31"
></a-input-number>
日开始
{{ t('components.CronModal.day23') }}
</a-radio>
<a-radio value="3">
周期从
{{ t('components.CronModal.day31') }}
<a-input-number
size="small"
v-model:value="data.rangeStart"
@@ -114,7 +119,7 @@ onBeforeMount(() => {
:max="31"
placeholder="1-31"
></a-input-number>
{{ t('components.CronModal.day32') }}
<a-input-number
size="small"
v-model:value="data.rangeEnd"
@@ -122,18 +127,22 @@ onBeforeMount(() => {
:max="31"
placeholder="1-31"
></a-input-number>
{{ t('components.CronModal.day33') }}
</a-radio>
<a-radio value="4">
{{ t('components.CronModal.day4') }}
</a-radio>
<a-radio value="4">指定日(可多选)</a-radio>
<a-select
v-model:value="data.specific"
size="small"
mode="multiple"
style="width: 100%"
placeholder="指定日(可多选)"
:placeholder="t('components.CronModal.day4')"
:options="optionsSpecific"
></a-select>
<a-radio value="5">本月最后一天</a-radio>
<a-radio value="5">
{{ t('components.CronModal.day5') }}
</a-radio>
</a-space>
</a-radio-group>
</template>

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
import { reactive, watch, onBeforeMount } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['update:value']);
const props = defineProps({
value: {
@@ -82,9 +85,11 @@ onBeforeMount(() => {
<template>
<a-radio-group size="small" v-model:value="data.type">
<a-space direction="vertical" :size="18">
<a-radio value="1">每一小时</a-radio>
<a-radio value="1">
{{ t('components.CronModal.hour1') }}
</a-radio>
<a-radio value="2">
每隔
{{ t('components.CronModal.hour21') }}
<a-input-number
size="small"
v-model:value="data.increment"
@@ -92,7 +97,7 @@ onBeforeMount(() => {
:max="23"
placeholder="0-23"
></a-input-number>
小时执行一次
{{ t('components.CronModal.hour22') }}
<a-input-number
size="small"
v-model:value="data.incrementStart"
@@ -100,10 +105,10 @@ onBeforeMount(() => {
:max="23"
placeholder="0-23"
></a-input-number>
时开始
{{ t('components.CronModal.hour23') }}
</a-radio>
<a-radio value="3">
周期从
{{ t('components.CronModal.hour31') }}
<a-input-number
size="small"
v-model:value="data.rangeStart"
@@ -111,7 +116,7 @@ onBeforeMount(() => {
:max="23"
placeholder="1-23"
></a-input-number>
{{ t('components.CronModal.hour32') }}
<a-input-number
size="small"
v-model:value="data.rangeEnd"
@@ -119,15 +124,17 @@ onBeforeMount(() => {
:max="23"
placeholder="0-23"
></a-input-number>
小时
{{ t('components.CronModal.hour33') }}
</a-radio>
<a-radio value="4">
{{ t('components.CronModal.hour4') }}
</a-radio>
<a-radio value="4">指定小时(可多选)</a-radio>
<a-select
v-model:value="data.specific"
size="small"
mode="multiple"
style="width: 100%"
placeholder="指定小时(可多选)"
:placeholder="t('components.CronModal.hour4')"
:options="optionsSpecific"
></a-select>
</a-space>

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
import { reactive, watch, onBeforeMount } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['update:value']);
const props = defineProps({
value: {
@@ -84,9 +87,11 @@ onBeforeMount(() => {
<template>
<a-radio-group size="small" v-model:value="data.type">
<a-space direction="vertical" :size="18">
<a-radio value="1">每一分钟</a-radio>
<a-radio value="1">
{{ t('components.CronModal.minute1') }}
</a-radio>
<a-radio value="2">
每隔
{{ t('components.CronModal.minute21') }}
<a-input-number
size="small"
v-model:value="data.increment"
@@ -94,7 +99,7 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
分钟执行一次
{{ t('components.CronModal.minute22') }}
<a-input-number
size="small"
v-model:value="data.incrementStart"
@@ -102,10 +107,10 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
分钟开始
{{ t('components.CronModal.minute23') }}
</a-radio>
<a-radio value="3">
周期从
{{ t('components.CronModal.minute31') }}
<a-input-number
size="small"
v-model:value="data.rangeStart"
@@ -113,7 +118,7 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
{{ t('components.CronModal.minute32') }}
<a-input-number
size="small"
v-model:value="data.rangeEnd"
@@ -121,15 +126,17 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
分钟
{{ t('components.CronModal.minute33') }}
</a-radio>
<a-radio value="4">
{{ t('components.CronModal.minute4') }}
</a-radio>
<a-radio value="4">指定分钟(可多选)</a-radio>
<a-select
v-model:value="data.specific"
size="small"
mode="multiple"
style="width: 100%"
placeholder="指定分钟(可多选)"
:placeholder="t('components.CronModal.minute4')"
:options="optionsSpecific"
></a-select>
</a-space>

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
import { reactive, watch, onBeforeMount } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['update:value']);
const props = defineProps({
value: {
@@ -86,9 +89,11 @@ onBeforeMount(() => {
<template>
<a-radio-group size="small" v-model:value="data.type">
<a-space direction="vertical" :size="18">
<a-radio value="1">每一月</a-radio>
<a-radio value="1">
{{ t('components.CronModal.month1') }}
</a-radio>
<a-radio value="2">
每隔
{{ t('components.CronModal.month21') }}
<a-input-number
size="small"
v-model:value="data.increment"
@@ -96,7 +101,7 @@ onBeforeMount(() => {
:max="12"
placeholder="1-12"
></a-input-number>
月执行
{{ t('components.CronModal.month22') }}
<a-input-number
size="small"
v-model:value="data.incrementStart"
@@ -104,10 +109,10 @@ onBeforeMount(() => {
:max="12"
placeholder="1-12"
></a-input-number>
月开始
{{ t('components.CronModal.month23') }}
</a-radio>
<a-radio value="3">
周期从
{{ t('components.CronModal.month31') }}
<a-input-number
size="small"
v-model:value="data.rangeStart"
@@ -115,7 +120,7 @@ onBeforeMount(() => {
:max="12"
placeholder="1-12"
></a-input-number>
{{ t('components.CronModal.month32') }}
<a-input-number
size="small"
v-model:value="data.rangeEnd"
@@ -123,15 +128,17 @@ onBeforeMount(() => {
:max="12"
placeholder="1-12"
></a-input-number>
月之间的每个月
{{ t('components.CronModal.month33') }}
</a-radio>
<a-radio value="4">
{{ t('components.CronModal.month4') }}
</a-radio>
<a-radio value="4">指定月(可多选)</a-radio>
<a-select
v-model:value="data.specific"
size="small"
mode="multiple"
style="width: 100%"
placeholder="指定月(可多选)"
:placeholder="t('components.CronModal.month4')"
:options="optionsSpecific"
></a-select>
</a-space>

View File

@@ -1,5 +1,8 @@
<script setup lang="ts">
import { reactive, watch, onBeforeMount } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['update:value']);
const props = defineProps({
value: {
@@ -83,9 +86,11 @@ onBeforeMount(() => {
<template>
<a-radio-group size="small" v-model:value="data.type">
<a-space direction="vertical" :size="18">
<a-radio value="1">每一秒钟</a-radio>
<a-radio value="1">
{{ t('components.CronModal.second1') }}
</a-radio>
<a-radio value="2">
每隔
{{ t('components.CronModal.second21') }}
<a-input-number
size="small"
v-model:value="data.increment"
@@ -93,7 +98,7 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
秒执行一次
{{ t('components.CronModal.second22') }}
<a-input-number
size="small"
v-model:value="data.incrementStart"
@@ -101,10 +106,10 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
秒开始
{{ t('components.CronModal.second23') }}
</a-radio>
<a-radio value="3">
周期从
{{ t('components.CronModal.second31') }}
<a-input-number
size="small"
v-model:value="data.rangeStart"
@@ -112,7 +117,7 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
{{ t('components.CronModal.second32') }}
<a-input-number
size="small"
v-model:value="data.rangeEnd"
@@ -120,15 +125,17 @@ onBeforeMount(() => {
:max="59"
placeholder="0-59"
></a-input-number>
{{ t('components.CronModal.second33') }}
</a-radio>
<a-radio value="4">
{{ t('components.CronModal.second4') }}
</a-radio>
<a-radio value="4">指定秒数(可多选)</a-radio>
<a-select
v-model:value="data.specific"
size="small"
mode="multiple"
style="width: 100%"
placeholder="指定秒数(可多选)"
:placeholder="t('components.CronModal.second4')"
:options="optionsSpecific"
></a-select>
</a-space>

View File

@@ -1,6 +1,6 @@
<template>
<a-modal
title="Cron表达式生成"
:title="t('components.CronModal.title')"
:visible="props.visible"
:body-style="{ padding: '0 24px' }"
:destroy-on-close="true"
@@ -8,26 +8,26 @@
@ok="fnCronModal(true)"
>
<a-tabs tab-position="top" type="line">
<a-tab-pane key="1" tab="">
<a-tab-pane key="1" :tab="t('common.units.second')">
<CronSecond v-model:value="cronValue.second"></CronSecond>
</a-tab-pane>
<a-tab-pane key="2" tab="分钟">
<a-tab-pane key="2" :tab="t('common.units.minute')">
<CronMinute v-model:value="cronValue.minute"></CronMinute>
</a-tab-pane>
<a-tab-pane key="3" tab="小时">
<a-tab-pane key="3" :tab="t('common.units.hour')">
<CronHour v-model:value="cronValue.hour"></CronHour>
</a-tab-pane>
<a-tab-pane key="4" tab="">
<a-tab-pane key="4" :tab="t('common.units.day')">
<CronDay v-model:value="cronValue.day"></CronDay>
</a-tab-pane>
<a-tab-pane key="5" tab="">
<a-tab-pane key="5" :tab="t('common.units.month')">
<CronMonth v-model:value="cronValue.month"></CronMonth>
</a-tab-pane>
</a-tabs>
<a-input
class="reultBox"
addon-before="表达式预览"
:addon-before="t('components.CronModal.addon')"
v-model:value="cronStr"
disabled
/>
@@ -40,6 +40,8 @@ import CronHour from './components/Hour.vue';
import CronDay from './components/Day.vue';
import CronMonth from './components/Month.vue';
import { reactive, computed, watch } from 'vue';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['cancel', 'ok', 'update:visible']);
const props = defineProps({

View File

@@ -66,6 +66,51 @@ export default {
// 组件
components: {
CronModal: {
title: "Cron Expression Generator",
addon: "Expression Preview:",
day1: "Every day",
day21: "Execute every",
day22: "days, starting from the",
day23: "day",
day31: "Cycle from",
day32: "to",
day33: "days",
day4: "Designated day (optional)",
day5: "Last day of the month",
hour1: "Hourly",
hour21: "Execute every",
hour22: "hours, starting from the",
hour23: "hour",
hour31: "Cycle time from",
hour32: "to",
hour33: "hours",
hour4: "Specified hours (multiple options available)",
minute1: "Every minute",
minute21: "Execute every",
minute22: "minutes, starting from the",
minute23: "minute",
minute31: "Cycle time from",
minute32: "to",
minute33: "minutes",
minute4: "Specified minutes (multiple options available)",
month1: "Every month",
month21: "Execute every",
month22: "months, starting from the",
month23: "month",
month31: "Cycle time from",
month32: "to",
month33: "months",
month4: "Specified months (multiple options available)",
second1: "Every second",
second21: "Execute every",
second22: "seconds, starting from the",
second23: "second",
second31: "Cycle time from",
second32: "to",
second33: "seconds",
second4: "Specify the number of seconds (multiple selectable)",
},
UploadModal:{
uploadTitle:'Data Import',
uploadTip:'Click to select or drag the file into the border area to upload',
@@ -610,7 +655,54 @@ export default {
loginTime:'Log in time',
getOut:'Forced retreat',
getOutSure:'Confirm the forced logout of the user whose login account is {userName} ?',
}
},
job: {
jobName: "JobName",
jobNamePlease: 'Please enter the task name correctly, limited to 2-20 characters',
jobGroup: "JobGroup",
invokeTarget: "invoke target",
invokeTargetPlease: 'Please enter the call target correctly, limited to 2-20 characters.',
invokeTargetTip: "Parameter description: support for preset incoming parameters, serialized processing parameters in the processor",
cronExpression: "cron expressions",
cronExpressionPlease: 'Please enter or generate a cron execution expression',
cronExpressionTip: "Example of an expression:0/20 * * * * ?",
cronExpressionTip1: "Illustrative example: Execute tasks every 20 seconds",
cronExpressionNew: "Generating Expressions",
status: "statuses",
status0: "disable",
status1: "opens",
status00: "pause",
status01: "normalcy",
statusChange: "Are you sure you want the {text} {num} task?",
saveLog: "Recording log",
tipRowErr: "Errors in the recording of tasks",
viewInfoErr: "Failed to get task information",
viewJob: "Task information",
addJob: "Add Tasks",
editJob: "Modify tasks",
runOne: "execute once",
runOneTip: "Are you sure you want to perform a [{num}] task right away?",
runOneOk: "{num} Executed successfully",
delTip: "Are you sure you want to delete task number [{num}]?",
delOk: "Deleted successfully",
resetTip: "Sure you want to reset and refresh the scheduling task?",
resetOk: "Reset Successful",
exportTip: "Confirm exporting xlsx table files based on search criteria?",
exportOk: "Completed export",
resetQueue: "Reset Queue",
jobLog: "Task log",
createTime: "CreateTime",
targetParams: "TargetParams",
targetParamsPlease: 'Call target incoming parameters, only support json strings',
misfirePolicy: "Error strategy",
misfirePolicy1: "immediate implementation",
misfirePolicy2: "execute once",
misfirePolicy3: "Waiver of implementation",
concurrent: "Concurrency",
concurrent0: "prohibit",
concurrent1: "allowed",
remark: "Remarks",
},
},
system:{
user: {

View File

@@ -66,6 +66,51 @@ export default {
// 组件
components: {
CronModal: {
title: "Cron表达式生成",
addon: "表达式预览:",
day1: "每一天",
day21: "每隔",
day22: "天执行一次,从",
day23: "日开始",
day31: "周期从",
day32: "到",
day33: "日",
day4: "指定日(可多选)",
day5: "本月最后一天",
hour1: "每一小时",
hour21: "每隔",
hour22: "小时执行一次,从",
hour23: "时开始",
hour31: "周期从",
hour32: "到",
hour33: "小时",
hour4: "指定小时(可多选)",
minute1: "每一分钟",
minute21: "每隔",
minute22: "分钟执行一次,从",
minute23: "分钟开始",
minute31: "周期从",
minute32: "到",
minute33: "分钟",
minute4: "指定分钟(可多选)",
month1: "每一月",
month21: "每隔",
month22: "月执行,从",
month23: "月开始",
month31: "周期从",
month32: "到",
month33: "月之间的每个月",
month4: "指定月(可多选)",
second1: "每一秒钟",
second21: "每隔",
second22: "秒执行一次,从",
second23: "秒开始",
second31: "周期从",
second32: "到",
second33: "秒",
second4: "指定秒数(可多选)",
},
UploadModal:{
uploadTitle:'数据导入',
uploadTip:'点击选择或将文件拖入边框区域进行上传',
@@ -610,7 +655,54 @@ export default {
loginTime:'登录时间',
getOut:'强退',
getOutSure:'确认强退登录账号为 {userName} 的用户?',
}
},
job: {
jobName: "任务名称",
jobNamePlease: '请正确输入任务名称限2-20个字符',
jobGroup: "任务组名",
invokeTarget: "调用目标",
invokeTargetPlease: '请正确输入调用目标限2-20个字符',
invokeTargetTip: "参数说明:支持预设传入参数,在处理器中进行序列化处理参数",
cronExpression: "cron表达式",
cronExpressionPlease: '请输入或生成cron执行表达式',
cronExpressionTip: "表达式示例0/20 * * * * ?",
cronExpressionTip1: "示例说明每20秒执行任务",
cronExpressionNew: "生成表达式",
status: "状态",
status0: "关闭",
status1: "开启",
status00: "暂停",
status01: "正常",
statusChange: "确定要{text} {num} 任务吗?",
saveLog: "记录日志",
tipRowErr: "任务记录存在错误",
viewInfoErr: "获取任务信息失败",
viewJob: "任务信息",
addJob: "添加任务",
editJob: "修改任务",
runOne: "执行一次",
runOneTip: "确定要立即执行一次 【{num}】 任务吗?",
runOneOk: "{num} 执行成功",
delTip: "确认删除定时任务编号为 【{num}】 任务吗?",
delOk: "删除成功",
resetTip: "确定要重置并刷新调度任务吗?",
resetOk: "重置成功",
exportTip: "确认根据搜索条件导出xlsx表格文件吗?",
exportOk: "已完成导出",
resetQueue: "重置队列",
jobLog: "任务日志",
createTime: "创建时间",
targetParams: "传入参数",
targetParamsPlease: '调用目标传入参数仅支持json字符串',
misfirePolicy: "出错策略",
misfirePolicy1: "立即执行",
misfirePolicy2: "执行一次",
misfirePolicy3: "放弃执行",
concurrent: "是否并发",
concurrent0: "禁止",
concurrent1: "允许",
remark: "备注说明",
},
},
system:{
user:{

View File

@@ -101,45 +101,45 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '任务编号',
title: t('common.rowId'),
dataIndex: 'jobId',
align: 'center',
},
{
title: '任务名称',
title: t('views.monitor.job.jobName'),
dataIndex: 'jobName',
align: 'center',
},
{
title: '任务组名',
title: t('views.monitor.job.jobGroup'),
dataIndex: 'jobGroup',
key: 'jobGroup',
align: 'center',
},
{
title: '调用目标',
title: t('views.monitor.job.invokeTarget'),
dataIndex: 'invokeTarget',
align: 'center',
},
{
title: 'cron表达式',
title: t('views.monitor.job.cronExpression'),
dataIndex: 'cronExpression',
align: 'center',
},
{
title: '状态',
title: t('views.monitor.job.status'),
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '记录日志',
title: t('views.monitor.job.saveLog'),
dataIndex: 'saveLog',
key: 'saveLog',
align: 'center',
},
{
title: '操作',
title: t('common.operate'),
key: 'jobId',
align: 'center',
},
@@ -163,7 +163,8 @@ let tablePagination = reactive({
showSizeChanger: true,
/**数据总数 */
total: 0,
showTotal: (total: number) => `总共 ${total}`,
showTotal: (total: number) =>
t('common.tablePaginationTotal', { total: total }),
onChange: (page: number, pageSize: number) => {
tablePagination.current = page;
tablePagination.pageSize = pageSize;
@@ -235,7 +236,7 @@ const modalStateFrom = Form.useForm(
required: true,
min: 2,
max: 20,
message: '请正确输入任务名称限2-20个字符',
message: t('views.monitor.job.jobNamePlease'),
},
],
invokeTarget: [
@@ -243,14 +244,14 @@ const modalStateFrom = Form.useForm(
required: true,
min: 2,
max: 20,
message: '请正确输入调用目标限2-20个字符',
message: t('views.monitor.job.invokeTargetPlease'),
},
],
cronExpression: [
{
required: true,
min: 6,
message: '请输入或生成cron执行表达式',
message: t('views.monitor.job.cronExpressionPlease'),
},
],
})
@@ -262,7 +263,7 @@ const modalStateFrom = Form.useForm(
*/
function fnModalVisibleByVive(jobId: string | number) {
if (!jobId) {
message.error(`任务记录存在错误`, 2);
message.error(t('views.monitor.job.tipRowErr'), 2);
return;
}
if (modalState.confirmLoading) return;
@@ -273,10 +274,10 @@ function fnModalVisibleByVive(jobId: string | number) {
hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '任务信息';
modalState.title = t('views.monitor.job.viewJob');
modalState.visibleByView = true;
} else {
message.error(`获取任务信息失败`, 2);
message.error(t('views.monitor.job.viewInfoErr'), 2);
}
});
}
@@ -288,7 +289,7 @@ function fnModalVisibleByVive(jobId: string | number) {
function fnModalVisibleByEdit(jobId?: string | number) {
if (!jobId) {
modalStateFrom.resetFields();
modalState.title = '添加任务';
modalState.title = t('views.monitor.job.addJob');
modalState.visibleByEdit = true;
} else {
if (modalState.confirmLoading) return;
@@ -299,10 +300,10 @@ function fnModalVisibleByEdit(jobId?: string | number) {
hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改任务';
modalState.title = t('views.monitor.job.editJob');
modalState.visibleByEdit = true;
} else {
message.error(`获取任务信息失败`, 2);
message.error(t('views.monitor.job.viewInfoErr'), 2);
}
});
}
@@ -325,13 +326,13 @@ function fnModalOk() {
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${modalState.title}成功`,
content: t('common.msgSuccess', { msg: modalState.title }),
key,
duration: 2,
});
modalState.visibleByEdit = false;
modalStateFrom.resetFields();
fnGetList();
fnGetList(1);
} else {
message.error({
content: `${res.msg}`,
@@ -345,7 +346,7 @@ function fnModalOk() {
});
})
.catch(e => {
message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2);
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
});
}
@@ -374,17 +375,20 @@ function fnModalCron(opt: boolean, cronStr?: string) {
* @param row 任务信息对象
*/
function fnRecordStatus(row: Record<string, string>) {
const text = row.status === '1' ? '开启' : '关闭';
const text =
row.status === '1'
? t('views.monitor.job.status1')
: t('views.monitor.job.status0');
Modal.confirm({
title: t('common.tipTitle'),
content: `确定要${text} ${row.jobName} 任务吗?`,
content: t('views.monitor.job.statusChange', { text, num: row.jobName }),
onOk() {
const key = 'changeJobStatus';
message.loading({ content: t('common.loading'), key });
changeJobStatus(row.jobId, row.status).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${row.jobName} ${text}成功`,
content: t('common.msgSuccess', { msg: `${row.jobName} ${text}` }),
key,
duration: 2,
});
@@ -411,14 +415,14 @@ function fnRecordStatus(row: Record<string, string>) {
function fnRecordRunOne(row: Record<string, string>) {
Modal.confirm({
title: t('common.tipTitle'),
content: `确定要立即执行一次 【${row.jobName}】 任务吗?`,
content: t('views.monitor.job.runOneTip', { num: row.jobName }),
onOk() {
const key = 'runJob';
message.loading({ content: t('common.loading'), key });
runJob(row.jobId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `${row.jobName} 执行成功`,
content: t('views.monitor.job.runOneOk', { num: row.jobName }),
key,
duration: 2,
});
@@ -444,14 +448,14 @@ function fnRecordDelete(jobId: string = '0') {
}
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除定时任务编号为 【${jobId}】 任务吗?`,
content: t('views.monitor.job.runOneTip', { num: jobId }),
onOk() {
const key = 'delJob';
message.loading({ content: t('common.loading'), key });
delJob(jobId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('views.monitor.job.delOk'),
key,
duration: 2,
});
@@ -474,14 +478,14 @@ function fnRecordDelete(jobId: string = '0') {
function fnResetQueueJob() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确定要重置并刷新调度任务吗?`,
content: t('views.monitor.job.resetTip'),
onOk() {
const key = 'resetQueueJob';
message.loading({ content: t('common.loading'), key });
resetQueueJob().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `重置成功`,
content: t('views.monitor.job.resetOk'),
key,
duration: 2,
});
@@ -501,14 +505,14 @@ function fnResetQueueJob() {
function fnExportList() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认根据搜索条件导出xlsx表格文件吗?`,
content: t('views.monitor.job.exportTip'),
onOk() {
const key = 'exportJob';
message.loading({ content: t('common.loading'), key });
exportJob(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
content: t('views.monitor.job.exportOk'),
key,
duration: 2,
});
@@ -583,31 +587,34 @@ onMounted(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="任务名称" name="jobName">
<a-form-item :label="t('views.monitor.job.jobName')" name="jobName">
<a-input
v-model:value="queryParams.jobName"
allow-clear
placeholder="请输入任务名称"
:placeholder="t('views.monitor.job.jobNamePlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="任务组名" name="jobGroup">
<a-form-item
:label="t('views.monitor.job.jobGroup')"
name="jobGroup"
>
<a-select
v-model:value="queryParams.jobGroup"
allow-clear
placeholder="请选择菜单状态"
:placeholder="t('common.selectPlease')"
:options="dict.sysJobGroup"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="任务状态" name="status">
<a-form-item :label="t('views.monitor.job.status')" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择任务状态"
:placeholder="t('common.selectPlease')"
:options="dict.sysJobStatus"
>
</a-select>
@@ -618,12 +625,12 @@ onMounted(() => {
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<template #icon><SearchOutlined /></template>
搜索</a-button
>
{{ t('common.search') }}
</a-button>
<a-button type="default" @click.prevent="fnQueryReset">
<template #icon><ClearOutlined /></template>
重置</a-button
>
{{ t('common.reset') }}
</a-button>
</a-space>
</a-form-item>
</a-col>
@@ -641,7 +648,7 @@ onMounted(() => {
v-perms:has="['monitor:job:add']"
>
<template #icon><PlusOutlined /></template>
新建
{{ t('common.addText') }}
</a-button>
<a-button
type="default"
@@ -651,7 +658,7 @@ onMounted(() => {
v-perms:has="['monitor:job:remove']"
>
<template #icon><DeleteOutlined /></template>
删除
{{ t('common.deleteText') }}
</a-button>
<a-button
type="dashed"
@@ -659,7 +666,7 @@ onMounted(() => {
v-perms:has="['monitor:job:export']"
>
<template #icon><ExportOutlined /></template>
导出
{{ t('common.export') }}
</a-button>
<a-button
type="default"
@@ -667,7 +674,7 @@ onMounted(() => {
v-perms:has="['monitor:job:query']"
>
<template #icon><ContainerOutlined /></template>
日志
{{ t('views.monitor.job.jobLog') }}
</a-button>
<a-button
type="dashed"
@@ -676,7 +683,7 @@ onMounted(() => {
v-perms:has="['monitor:job:remove']"
>
<template #icon><SyncOutlined /></template>
重置队列
{{ t('views.monitor.job.resetQueue') }}
</a-button>
</a-space>
</template>
@@ -685,31 +692,31 @@ onMounted(() => {
<template #extra>
<a-space :size="8" align="center">
<a-tooltip>
<template #title>搜索栏</template>
<template #title>{{ t('common.searchBarText') }}</template>
<a-switch
v-model:checked="tableState.seached"
checked-children=""
un-checked-children=""
:checked-children="t('common.switch.show')"
:un-checked-children="t('common.switch.hide')"
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>表格斑马纹</template>
<template #title>{{ t('common.tableStripedText') }}</template>
<a-switch
v-model:checked="tableState.striped"
checked-children=""
un-checked-children=""
:checked-children="t('common.switch.open')"
:un-checked-children="t('common.switch.shut')"
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>刷新</template>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList()">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<template #title>{{ t('common.sizeText') }}</template>
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
@@ -719,9 +726,15 @@ onMounted(() => {
:selected-keys="[tableState.size as string]"
@click="fnTableSize"
>
<a-menu-item key="default">默认</a-menu-item>
<a-menu-item key="middle">中等</a-menu-item>
<a-menu-item key="small">紧凑</a-menu-item>
<a-menu-item key="default">
{{ t('common.size.default') }}
</a-menu-item>
<a-menu-item key="middle">
{{ t('common.size.middle') }}
</a-menu-item>
<a-menu-item key="small">
{{ t('common.size.small') }}
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
@@ -755,9 +768,9 @@ onMounted(() => {
v-if="hasPermissions(['monitor:job:changeStatus'])"
v-model:checked="record.status"
checked-value="1"
checked-children="正常"
:checked-children="t('views.monitor.job.status01')"
un-checked-value="0"
un-checked-children="暂停"
:un-checked-children="t('views.monitor.job.status00')"
size="small"
@change="fnRecordStatus(record)"
/>
@@ -773,7 +786,7 @@ onMounted(() => {
<template v-if="column.key === 'jobId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>查看详情</template>
<template #title>{{ t('common.viewText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.jobId)"
@@ -783,7 +796,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>编辑</template>
<template #title>{{ t('common.editText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.jobId)"
@@ -793,7 +806,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>删除</template>
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.jobId)"
@@ -803,7 +816,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>执行一次</template>
<template #title>{{ t('views.monitor.job.runOne') }}</template>
<a-button
type="link"
@click.prevent="fnRecordRunOne(record)"
@@ -813,7 +826,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>任务日志</template>
<template #title>{{ t('views.monitor.job.jobLog') }}</template>
<a-button
type="link"
@click.prevent="fnJobLogView(record.jobId)"
@@ -838,34 +851,53 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="任务名称" name="jobName">
<a-form-item :label="t('views.monitor.job.jobName')" name="jobName">
{{ modalState.from.jobName }}
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="出错策略" name="misfirePolicy">
<a-form-item
:label="t('views.monitor.job.misfirePolicy')"
name="misfirePolicy"
>
{{
['立即执行', '执行一次', '放弃执行'][
+modalState.from.misfirePolicy - 1
]
[
t('views.monitor.job.misfirePolicy1'),
t('views.monitor.job.misfirePolicy2'),
t('views.monitor.job.misfirePolicy3'),
][+modalState.from.misfirePolicy - 1]
}}
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="是否并发" name="concurrent">
{{ ['禁止', '允许'][+modalState.from.concurrent] }}
<a-form-item
:label="t('views.monitor.job.concurrent')"
name="concurrent"
>
{{
[
t('views.monitor.job.concurrent0'),
t('views.monitor.job.concurrent1'),
][+modalState.from.concurrent]
}}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="调用目标" name="invokeTarget">
<a-form-item
:label="t('views.monitor.job.invokeTarget')"
name="invokeTarget"
>
{{ modalState.from.invokeTarget }}
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="任务组名" name="jobGroup">
<a-form-item
:label="t('views.monitor.job.jobGroup')"
name="jobGroup"
>
<DictTag
:options="dict.sysJobGroup"
:value="modalState.from.jobGroup"
@@ -873,22 +905,30 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="任务状态" name="status">
{{ ['暂停', '正常'][+modalState.from.status] }}
<a-form-item :label="t('views.monitor.job.status')" name="status">
{{
[
t('views.monitor.job.status00'),
t('views.monitor.job.status01'),
][+modalState.from.status]
}}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="cron表达式" name="cronExpression">
<a-form-item
:label="t('views.monitor.job.cronExpression')"
name="cronExpression"
>
<a-tag color="default">
{{ modalState.from.cronExpression }}
</a-tag>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="记录日志" name="status">
<a-form-item :label="t('views.monitor.job.saveLog')" name="saveLog">
<DictTag
:options="dict.sysJobSaveLog"
:value="modalState.from.saveLog"
@@ -897,22 +937,30 @@ onMounted(() => {
</a-col>
</a-row>
<a-form-item label="创建时间" name="createTime">
<a-form-item
:label="t('views.monitor.job.createTime')"
name="createTime"
>
<span v-if="+modalState.from.createTime > 0">
{{ parseDateToStr(+modalState.from.createTime) }}
</span>
</a-form-item>
<a-form-item label="传入参数" name="targetParams">
<a-form-item
:label="t('views.monitor.job.targetParams')"
name="targetParams"
>
{{ modalState.from.targetParams }}
</a-form-item>
<a-form-item label="备注说明" name="remark">
<a-form-item :label="t('views.monitor.job.remark')" name="remark">
{{ modalState.from.remark }}
</a-form-item>
</a-form>
<template #footer>
<a-button key="cancel" @click="fnModalCancel">关闭</a-button>
<a-button key="cancel" @click="fnModalCancel">
{{ t('common.close') }}
</a-button>
</template>
</a-modal>
@@ -931,41 +979,57 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="任务名称"
:label="t('views.monitor.job.jobName')"
name="jobName"
v-bind="modalStateFrom.validateInfos.jobName"
>
<a-input
v-model:value="modalState.from.jobName"
allow-clear
placeholder="请输入任务名称"
:placeholder="t('views.monitor.job.jobNamePlease')"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="执行策略" name="misfirePolicy">
<a-form-item
:label="t('views.monitor.job.misfirePolicy')"
name="misfirePolicy"
>
<a-select
:disabled="true"
v-model:value="modalState.from.misfirePolicy"
default-value="3"
placeholder="出错策略"
:placeholder="t('common.selectPlease')"
>
<a-select-option key="1" value="1">立即执行</a-select-option>
<a-select-option key="2" value="2">执行一次</a-select-option>
<a-select-option key="3" value="3">放弃执行</a-select-option>
<a-select-option key="1" value="1">
{{ t('views.monitor.job.misfirePolicy1') }}
</a-select-option>
<a-select-option key="2" value="2">
{{ t('views.monitor.job.misfirePolicy2') }}
</a-select-option>
<a-select-option key="3" value="3">
{{ t('views.monitor.job.misfirePolicy3') }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="是否并发" name="concurrent">
<a-form-item
:label="t('views.monitor.job.concurrent')"
name="concurrent"
>
<a-select
:disabled="true"
v-model:value="modalState.from.concurrent"
default-value="0"
placeholder="是否并发"
:placeholder="t('common.selectPlease')"
>
<a-select-option key="1" value="1">允许</a-select-option>
<a-select-option key="0" value="0">禁止</a-select-option>
<a-select-option key="1" value="1">
{{ t('views.monitor.job.concurrent1') }}
</a-select-option>
<a-select-option key="0" value="0">
{{ t('views.monitor.job.concurrent0') }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
@@ -974,23 +1038,19 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="调用目标"
:label="t('views.monitor.job.invokeTarget')"
name="invokeTarget"
v-bind="modalStateFrom.validateInfos.invokeTarget"
>
<a-input
v-model:value="modalState.from.invokeTarget"
allow-clear
placeholder="请输入调用目标"
:placeholder="t('views.monitor.job.invokeTargetPlease')"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
<div>
Processor调用示例simple <br />
定义任务处理器示例src\modules\monitor\processor <br />
参数说明支持预设传入参数在处理器中进行序列化处理参数
</div>
<div>{{ t('views.monitor.job.invokeTargetTip') }}</div>
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
@@ -999,22 +1059,25 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="任务组名" name="jobGroup">
<a-form-item
:label="t('views.monitor.job.jobGroup')"
name="jobGroup"
>
<a-select
v-model:value="modalState.from.jobGroup"
default-value="DEFAULT"
placeholder="任务组名"
:placeholder="t('common.selectPlease')"
:options="dict.sysJobGroup"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="任务状态" name="status">
<a-form-item :label="t('views.monitor.job.status')" name="status">
<a-select
v-model:value="modalState.from.status"
default-value="0"
placeholder="任务状态"
:placeholder="t('common.selectPlease')"
:options="dict.sysJobStatus"
>
</a-select>
@@ -1025,7 +1088,7 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="18" :md="18" :xs="24">
<a-form-item
label="cron表达式"
:label="t('views.monitor.job.cronExpression')"
name="cronExpression"
:label-col="{ span: 4 }"
v-bind="modalStateFrom.validateInfos.cronExpression"
@@ -1033,14 +1096,14 @@ onMounted(() => {
<a-input
v-model:value="modalState.from.cronExpression"
allow-clear
placeholder="请输入或生成cron执行表达式"
:placeholder="t('views.monitor.job.cronExpressionPlease')"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
<div>
表达式示例0/20 * * * * ? <br />
示例说明每20秒执行任务
{{ t('views.monitor.job.cronExpressionTip') }}<br />
{{ t('views.monitor.job.cronExpressionTip1') }}
</div>
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
@@ -1053,18 +1116,18 @@ onMounted(() => {
@click.prevent="fnModalCron(true)"
>
<template #icon><FieldTimeOutlined /></template>
生成表达式
{{ t('views.monitor.job.cronExpressionNew') }}
</a-button>
</template>
</a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="记录日志" name="saveLog">
<a-form-item :label="t('views.monitor.job.saveLog')" name="saveLog">
<a-select
v-model:value="modalState.from.saveLog"
default-value="0"
placeholder="记录日志"
:placeholder="t('common.selectPlease')"
:options="dict.sysJobSaveLog"
>
</a-select>
@@ -1073,7 +1136,7 @@ onMounted(() => {
</a-row>
<a-form-item
label="传入参数"
:label="t('views.monitor.job.targetParams')"
name="targetParams"
:label-col="{ span: 4 }"
>
@@ -1081,17 +1144,20 @@ onMounted(() => {
v-model:value="modalState.from.targetParams"
:auto-size="{ minRows: 2, maxRows: 6 }"
:maxlength="400"
placeholder="调用目标传入参数仅支持json字符串"
:placeholder="t('views.monitor.job.targetParamsPlease')"
/>
</a-form-item>
<a-form-item label="备注说明" name="remark" :label-col="{ span: 4 }">
<a-form-item
:label="t('views.monitor.job.remark')"
name="remark"
:label-col="{ span: 4 }"
>
<a-textarea
v-model:value="modalState.from.remark"
:auto-size="{ minRows: 2, maxRows: 6 }"
:maxlength="400"
:show-count="true"
placeholder="可输入任务说明"
/>
</a-form-item>
</a-form>

View File

@@ -313,7 +313,7 @@ function fnModalOk() {
});
modalState.visibleByEdit = false;
modalStateFrom.resetFields();
fnGetList();
fnGetList(1);
} else {
message.error({
content: `${res.msg}`,
@@ -432,10 +432,13 @@ function fnRefreshCache() {
});
}
/**查询参数配置列表 */
function fnGetList() {
/**查询参数配置列表, pageNum初始页数 */
function fnGetList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if (pageNum) {
queryParams.pageNum = pageNum;
}
if (!queryRangePicker.value) {
queryRangePicker.value = ['', ''];
}
@@ -531,7 +534,7 @@ onMounted(() => {
<a-col :lg="6" :md="12" :xs="24">
<a-form-item>
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList">
<a-button type="primary" @click.prevent="fnGetList(1)">
<template #icon><SearchOutlined /></template>
{{ t('common.search') }}
</a-button>
@@ -611,7 +614,7 @@ onMounted(() => {
</a-tooltip>
<a-tooltip>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList">
<a-button type="text" @click.prevent="fnGetList()">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>