Merge pull request #3969 from jumpserver/pr@v4@action

perf: table center
This commit is contained in:
feng626
2024-05-22 19:19:30 +08:00
committed by GitHub
5 changed files with 10 additions and 47 deletions

View File

@@ -245,6 +245,7 @@ $color-drop-menu-border: #e4e7ed;
// 主要是 Table 中的操作列 // 主要是 Table 中的操作列
.layout.table-actions { .layout.table-actions {
display: flex; display: flex;
justify-content: center;
align-items: flex-end; align-items: flex-end;
.el-button { .el-button {

View File

@@ -53,11 +53,11 @@ export default {
} }
}, },
{ {
path: 'batch-Transfer', path: 'file-transfer',
name: 'BatchTransfer', name: 'FileTransfer',
component: () => import('@/views/ops/File/index'), component: () => import('@/views/ops/File/index'),
meta: { meta: {
title: i18n.t('BatchTransfer'), title: i18n.t('FileTransfer'),
permissions: ['rbac.view_filemanager'] permissions: ['rbac.view_filemanager']
} }
}, },
@@ -86,8 +86,8 @@ export default {
}, },
children: [ children: [
{ {
path: 'quick-job', path: 'adhoc',
name: 'QuickJob', name: 'Adhoc',
component: () => import('@/views/ops/Job/QuickJob'), component: () => import('@/views/ops/Job/QuickJob'),
meta: { meta: {
title: i18n.t('QuickJob'), title: i18n.t('QuickJob'),

View File

@@ -1,12 +1,11 @@
<template> <template>
<div> <div>
<ExecutionDetailDialog v-if="showExecutionDetailDialog" :item="item" :visible.sync="showExecutionDetailDialog" /> <ExecutionDetailDialog v-if="showExecutionDetailDialog" :item="item" :visible.sync="showExecutionDetailDialog" />
<GenericListPage :header-actions="headerActions" :table-config="tableConfig" /> <GenericListPage ref="GenericListPage" :header-actions="headerActions" :table-config="tableConfig" />
</div> </div>
</template> </template>
<script> <script>
import { ActionsFormatter } from '@/components/Table/TableFormatters'
import { GenericListPage } from '@/layout/components' import { GenericListPage } from '@/layout/components'
import { openTaskPage } from '@/utils/jms' import { openTaskPage } from '@/utils/jms'
import ExecutionDetailDialog from '@/views/ops/Execution/ExecutionDetail' import ExecutionDetailDialog from '@/views/ops/Execution/ExecutionDetail'
@@ -23,62 +22,33 @@ export default {
showExecutionDetailDialog: false, showExecutionDetailDialog: false,
tableConfig: { tableConfig: {
url: '/api/v1/ops/job-executions/', url: '/api/v1/ops/job-executions/',
columns: [
'id', 'job', 'material', 'job_type', 'is_finished', 'is_success',
'time_cost', 'date_created', 'actions'
],
columnsShow: { columnsShow: {
min: ['material', 'actions'], min: ['material', 'actions'],
default: [ default: [
'id', 'job', 'material', 'job_type', 'is_success', 'id', 'job', 'material', 'job_type', 'is_finished', 'is_success',
'time_cost', 'date_created', 'actions' 'time_cost', 'date_created', 'actions'
] ]
}, },
columnsMeta: { columnsMeta: {
job_type: {
width: '100px'
},
id: { id: {
width: '100px',
formatter(row) { formatter(row) {
return row.id.slice(0, 8) return row.id.slice(0, 8)
} }
}, },
count: {
width: '96px',
formatter: (row) => {
if (row.count) {
return <div>
<el-tooltip open-delay='1000' content='success'><span Class='text-success'>{row.count.ok}&nbsp;</span></el-tooltip>
<el-tooltip open-delay='1000' content='failed'><span Class='text-danger'>&nbsp;{row.count.failed}&nbsp;</span>
</el-tooltip>
<el-tooltip open-delay='1000' content='exclude'><span Class='text-warning'>&nbsp;{row.count.excludes}&nbsp;</span>
</el-tooltip>
<el-tooltip open-delay='1000' content='total'><span Class='text-primary'>&nbsp;{row.count.total}</span></el-tooltip>
</div>
}
return '-'
}
},
job: { job: {
formatter: (row) => { formatter: (row) => {
return <span>{row.job?.name || '-'}</span> return <span>{row.job?.name || '-'}</span>
} }
}, },
is_finished: { is_finished: {
width: '96px',
formatter: (row) => { formatter: (row) => {
if (row.is_finished) { if (row.is_finished) {
return <i Class='fa fa-check text-primary'/> return <i Class='fa fa-check text-primary'/>
} }
return <i Class='fa fa-times text-danger'/> return <i Class='fa fa-times text-danger'/>
},
formatterArgs: {
width: '14px'
} }
}, },
is_success: { is_success: {
width: '96px',
formatter: (row) => { formatter: (row) => {
if (!row.is_finished) { if (!row.is_finished) {
return <i Class='fa fa fa-spinner fa-spin'/> return <i Class='fa fa fa-spinner fa-spin'/>
@@ -87,13 +57,9 @@ export default {
return <i Class='fa fa-check text-primary'/> return <i Class='fa fa-check text-primary'/>
} }
return <i Class='fa fa-times text-danger'/> return <i Class='fa fa-times text-danger'/>
},
formatterArgs: {
width: '14px'
} }
}, },
time_cost: { time_cost: {
width: '100px',
formatter: function(row) { formatter: function(row) {
if (row.time_cost) { if (row.time_cost) {
return row.time_cost.toFixed(2) + 's' return row.time_cost.toFixed(2) + 's'
@@ -102,7 +68,7 @@ export default {
} }
}, },
actions: { actions: {
formatter: ActionsFormatter, width: '120px',
formatterArgs: { formatterArgs: {
hasUpdate: false, hasUpdate: false,
hasDelete: false, hasDelete: false,

View File

@@ -137,7 +137,7 @@ import { formatFileSize } from '@/utils/common'
import store from '@/store' import store from '@/store'
export default { export default {
name: 'BatchTransfer', name: 'FileTransfer',
components: { components: {
AssetTreeTable, AssetTreeTable,
Page, Page,

View File

@@ -147,11 +147,7 @@ export default {
} }
}, },
actions: { actions: {
el: {
fixed: 'right'
},
formatterArgs: { formatterArgs: {
fixed: 'right',
hasDelete: hasDelete, hasDelete: hasDelete,
canUpdate: ({ row }) => { canUpdate: ({ row }) => {
return this.$hasPerm('users.change_user') && return this.$hasPerm('users.change_user') &&