fix: 调度任务状态多语言

This commit is contained in:
TsMask
2023-11-21 19:48:49 +08:00
parent a104fbf7eb
commit 3a6059263f
3 changed files with 16 additions and 19 deletions

View File

@@ -865,10 +865,6 @@ export default {
cronExpressionTip1: "Illustrative example: Execute tasks every 20 seconds", cronExpressionTip1: "Illustrative example: Execute tasks every 20 seconds",
cronExpressionNew: "Generating Expressions", cronExpressionNew: "Generating Expressions",
status: "Status", status: "Status",
status0: "Disable",
status1: "Opens",
status00: "Pause",
status01: "Active",
statusChange: "Are you sure you want the {text} {num} job?", statusChange: "Are you sure you want the {text} {num} job?",
saveLog: "Recording log", saveLog: "Recording log",
tipRowErr: "Errors in the recording of jobs", tipRowErr: "Errors in the recording of jobs",

View File

@@ -865,10 +865,6 @@ export default {
cronExpressionTip1: "示例说明每20秒执行任务", cronExpressionTip1: "示例说明每20秒执行任务",
cronExpressionNew: "生成表达式", cronExpressionNew: "生成表达式",
status: "状态", status: "状态",
status0: "关闭",
status1: "开启",
status00: "暂停",
status01: "正常",
statusChange: "确定要{text} {num} 任务吗?", statusChange: "确定要{text} {num} 任务吗?",
saveLog: "记录日志", saveLog: "记录日志",
tipRowErr: "任务记录存在错误", tipRowErr: "任务记录存在错误",

View File

@@ -377,8 +377,8 @@ function fnModalCron(opt: boolean, cronStr?: string) {
function fnRecordStatus(row: Record<string, string>) { function fnRecordStatus(row: Record<string, string>) {
const text = const text =
row.status === '1' row.status === '1'
? t('views.monitor.job.status1') ? dict.sysJobStatus.find(s => s.value === '1')?.label
: t('views.monitor.job.status0'); : dict.sysJobStatus.find(s => s.value === '0')?.label;
Modal.confirm({ Modal.confirm({
title: t('common.tipTitle'), title: t('common.tipTitle'),
content: t('views.monitor.job.statusChange', { text, num: row.jobName }), content: t('views.monitor.job.statusChange', { text, num: row.jobName }),
@@ -403,7 +403,11 @@ function fnRecordStatus(row: Record<string, string>) {
}); });
}, },
onCancel() { onCancel() {
row.status = row.status === '1' ? '0' : '1'; const value =
row.status === '1'
? dict.sysJobStatus.find(s => s.value === '0')?.value
: dict.sysJobStatus.find(s => s.value === '1')?.value;
row.status = value || '0';
}, },
}); });
} }
@@ -768,9 +772,13 @@ onMounted(() => {
v-if="hasPermissions(['monitor:job:changeStatus'])" v-if="hasPermissions(['monitor:job:changeStatus'])"
v-model:checked="record.status" v-model:checked="record.status"
checked-value="1" checked-value="1"
:checked-children="t('views.monitor.job.status01')" :checked-children="
dict.sysJobStatus.find(s => s.value === '1')?.label
"
un-checked-value="0" un-checked-value="0"
:un-checked-children="t('views.monitor.job.status00')" :un-checked-children="
dict.sysJobStatus.find(s => s.value === '0')?.label
"
size="small" size="small"
@change="fnRecordStatus(record)" @change="fnRecordStatus(record)"
/> />
@@ -858,10 +866,7 @@ onMounted(() => {
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item :label="t('views.monitor.job.status')" name="status"> <a-form-item :label="t('views.monitor.job.status')" name="status">
{{ {{
[ dict.sysJobStatus.find(s => s.value === modalState.from.status)?.label
t('views.monitor.job.status00'),
t('views.monitor.job.status01'),
][+modalState.from.status]
}} }}
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -1086,7 +1091,7 @@ onMounted(() => {
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="18" :md="18" :xs="24"> <a-col :lg="16" :md="16" :xs="24">
<a-form-item <a-form-item
:label="t('views.monitor.job.cronExpression')" :label="t('views.monitor.job.cronExpression')"
name="cronExpression" name="cronExpression"
@@ -1122,7 +1127,7 @@ onMounted(() => {
</a-input> </a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="6" :xs="24"> <a-col :lg="8" :md="8" :xs="24">
<a-form-item :label="t('views.monitor.job.saveLog')" name="saveLog"> <a-form-item :label="t('views.monitor.job.saveLog')" name="saveLog">
<a-select <a-select
v-model:value="modalState.from.saveLog" v-model:value="modalState.from.saveLog"