style: 调度任务日志多语言

This commit is contained in:
TsMask
2023-11-11 10:54:48 +08:00
parent 447a8a5e0d
commit 9c28e19413
4 changed files with 161 additions and 76 deletions

View File

@@ -235,7 +235,7 @@ const modalStateFrom = Form.useForm(
{
required: true,
min: 2,
max: 20,
max: 50,
message: t('views.monitor.job.jobNamePlease'),
},
],
@@ -243,7 +243,7 @@ const modalStateFrom = Form.useForm(
{
required: true,
min: 2,
max: 20,
max: 50,
message: t('views.monitor.job.invokeTargetPlease'),
},
],

View File

@@ -116,34 +116,34 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '日志编号',
title: t('common.rowId'),
dataIndex: 'jobLogId',
align: 'center',
},
{
title: '任务名称',
title: t('views.monitor.jobLog.jobName'),
dataIndex: 'jobName',
align: 'center',
},
{
title: '任务组名',
title: t('views.monitor.jobLog.jobGroup'),
dataIndex: 'jobGroup',
key: 'jobGroup',
align: 'center',
},
{
title: '调用目标',
title: t('views.monitor.jobLog.invokeTarget'),
dataIndex: 'invokeTarget',
align: 'center',
},
{
title: '执行状态',
title: t('views.monitor.jobLog.status'),
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '记录时间',
title: t('views.monitor.jobLog.createTime'),
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
@@ -152,7 +152,7 @@ let tableColumns: ColumnsType = [
},
},
{
title: '消耗时间',
title: t('views.monitor.jobLog.costTime'),
dataIndex: 'costTime',
key: 'costTime',
align: 'center',
@@ -161,7 +161,7 @@ let tableColumns: ColumnsType = [
},
},
{
title: '操作',
title: t('common.operate'),
key: 'jobLogId',
align: 'center',
},
@@ -185,7 +185,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;
@@ -242,7 +243,7 @@ let modalState: ModalStateType = reactive({
*/
function fnModalVisibleByVive(row: Record<string, string>) {
modalState.from = Object.assign(modalState.from, row);
modalState.title = '调度日志信息';
modalState.title = t('views.monitor.jobLog.viewLog');
modalState.visibleByView = true;
}
@@ -260,14 +261,14 @@ function fnRecordDelete() {
const ids = tableState.selectedRowKeys.join(',');
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除调度日志编号为 【${ids}】 的数据项吗?`,
content: t('views.monitor.jobLog.delTip', { num: ids }),
onOk() {
const key = 'delJobLog';
message.loading({ content: t('common.loading'), key });
delJobLog(ids).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('views.monitor.jobLog.delOk'),
key,
duration: 2,
});
@@ -288,14 +289,14 @@ function fnRecordDelete() {
function fnCleanList() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认清空所有调度日志数据项吗?`,
content: t('views.monitor.jobLog.clearTip'),
onOk() {
const key = 'cleanJobLog';
message.loading({ content: t('common.loading'), key });
cleanJobLog().then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `清空成功`,
content: t('views.monitor.jobLog.clearOk'),
key,
duration: 2,
});
@@ -316,14 +317,14 @@ function fnCleanList() {
function fnExportList() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认根据搜索条件导出xlsx表格文件吗?`,
content: t('views.monitor.jobLog.exportTip'),
onOk() {
const key = 'exportJobLog';
message.loading({ content: t('common.loading'), key });
exportJobLog(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
content: t('views.monitor.jobLog.exportOk'),
key,
duration: 2,
});
@@ -415,45 +416,56 @@ 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.jobLog.jobName')"
name="jobName"
>
<a-input
v-model:value="queryParams.jobName"
:allow-clear="jobId === '0'"
:disabled="jobId !== '0'"
placeholder="请输入任务名称"
:placeholder="t('common.ipnutPlease')"
></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.jobLog.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.jobLog.status')"
name="status"
>
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择执行状态"
:placeholder="t('common.selectPlease')"
:options="dict.sysCommonStatus"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="记录时间" name="queryRangePicker">
<a-form-item
:label="t('views.monitor.jobLog.createTime')"
name="queryRangePicker"
>
<a-range-picker
v-model:value="queryRangePicker"
allow-clear
bordered
value-format="YYYY-MM-DD"
:placeholder="['记录开始', '记录结束']"
style="width: 100%"
></a-range-picker>
</a-form-item>
@@ -463,11 +475,11 @@ onMounted(() => {
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<template #icon><SearchOutlined /></template>
搜索
{{ t('common.search') }}
</a-button>
<a-button type="default" @click.prevent="fnQueryReset">
<template #icon><ClearOutlined /></template>
重置
{{ t('common.reset') }}
</a-button>
</a-space>
</a-form-item>
@@ -482,7 +494,7 @@ onMounted(() => {
<a-space :size="8" align="center">
<a-button type="default" @click.prevent="fnClose()">
<template #icon><CloseOutlined /></template>
关闭
{{ t('common.close') }}
</a-button>
<a-button
type="default"
@@ -492,7 +504,7 @@ onMounted(() => {
v-perms:has="['monitor:job:remove']"
>
<template #icon><DeleteOutlined /></template>
删除
{{ t('common.deleteText') }}
</a-button>
<a-button
type="dashed"
@@ -501,7 +513,7 @@ onMounted(() => {
v-perms:has="['monitor:job:remove']"
>
<template #icon><DeleteOutlined /></template>
清空
{{ t('views.monitor.jobLog.clearText') }}
</a-button>
<a-button
type="dashed"
@@ -509,7 +521,7 @@ onMounted(() => {
v-perms:has="['monitor:job:export']"
>
<template #icon><ExportOutlined /></template>
导出
{{ t('common.export') }}
</a-button>
</a-space>
</template>
@@ -518,31 +530,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>
@@ -552,9 +564,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>
@@ -585,20 +603,24 @@ onMounted(() => {
</template>
<template v-if="column.key === 'status'">
<a-tag :color="+record.status ? 'success' : 'error'">
{{ ['失败', '正常'][+record.status] }}
{{
[
t('views.monitor.jobLog.status0'),
t('views.monitor.jobLog.status1'),
][+record.status]
}}
</a-tag>
</template>
<template v-if="column.key === 'jobLogId'">
<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)"
v-perms:has="['monitor:job:query']"
>
<template #icon><ProfileOutlined /></template>
详情
</a-button>
</a-tooltip>
</a-space>
@@ -617,26 +639,40 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="日志编号" name="jobLogId">
<a-form-item :label="t('common.rowId')" name="jobLogId">
{{ modalState.from.jobLogId }}
</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.jobLog.status')"
name="status"
>
<a-tag :color="+modalState.from.status ? 'success' : 'error'">
{{ ['失败', '正常'][+modalState.from.status] }}
{{
[
t('views.monitor.jobLog.status0'),
t('views.monitor.jobLog.status1'),
][+modalState.from.status]
}}
</a-tag>
</a-form-item>
</a-col>
</a-row>
<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.jobLog.jobName')"
name="jobName"
>
{{ modalState.from.jobName }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="任务组名" name="jobGroup">
<a-form-item
:label="t('views.monitor.jobLog.jobGroup')"
name="jobGroup"
>
<DictTag
:options="dict.sysJobGroup"
:value="modalState.from.jobGroup"
@@ -646,37 +682,46 @@ onMounted(() => {
</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.jobLog.invokeTarget')"
name="invokeTarget"
>
{{ modalState.from.invokeTarget }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="记录时间" name="createTime">
<a-form-item
:label="t('views.monitor.jobLog.createTime')"
name="createTime"
>
<span v-if="+modalState.from.createTime > 0">
{{ parseDateToStr(+modalState.from.createTime) }}
</span>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="传入参数" name="targetParams">
<a-form-item
:label="t('views.monitor.jobLog.targetParams')"
name="targetParams"
>
<a-textarea
v-model:value="modalState.from.targetParams"
:auto-size="{ minRows: 2, maxRows: 6 }"
placeholder="传入参数"
:disabled="true"
/>
</a-form-item>
<a-form-item label="日志信息" name="jobMsg">
<a-form-item :label="t('views.monitor.jobLog.jobMsg')" name="jobMsg">
<a-textarea
v-model:value="modalState.from.jobMsg"
:auto-size="{ minRows: 2, maxRows: 6 }"
placeholder="日志信息"
:disabled="true"
/>
</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>
</PageContainer>