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 中的操作列
.layout.table-actions {
display: flex;
justify-content: center;
align-items: flex-end;
.el-button {

View File

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

View File

@@ -1,12 +1,11 @@
<template>
<div>
<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>
</template>
<script>
import { ActionsFormatter } from '@/components/Table/TableFormatters'
import { GenericListPage } from '@/layout/components'
import { openTaskPage } from '@/utils/jms'
import ExecutionDetailDialog from '@/views/ops/Execution/ExecutionDetail'
@@ -23,62 +22,33 @@ export default {
showExecutionDetailDialog: false,
tableConfig: {
url: '/api/v1/ops/job-executions/',
columns: [
'id', 'job', 'material', 'job_type', 'is_finished', 'is_success',
'time_cost', 'date_created', 'actions'
],
columnsShow: {
min: ['material', 'actions'],
default: [
'id', 'job', 'material', 'job_type', 'is_success',
'id', 'job', 'material', 'job_type', 'is_finished', 'is_success',
'time_cost', 'date_created', 'actions'
]
},
columnsMeta: {
job_type: {
width: '100px'
},
id: {
width: '100px',
formatter(row) {
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: {
formatter: (row) => {
return <span>{row.job?.name || '-'}</span>
}
},
is_finished: {
width: '96px',
formatter: (row) => {
if (row.is_finished) {
return <i Class='fa fa-check text-primary'/>
}
return <i Class='fa fa-times text-danger'/>
},
formatterArgs: {
width: '14px'
}
},
is_success: {
width: '96px',
formatter: (row) => {
if (!row.is_finished) {
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-times text-danger'/>
},
formatterArgs: {
width: '14px'
}
},
time_cost: {
width: '100px',
formatter: function(row) {
if (row.time_cost) {
return row.time_cost.toFixed(2) + 's'
@@ -102,7 +68,7 @@ export default {
}
},
actions: {
formatter: ActionsFormatter,
width: '120px',
formatterArgs: {
hasUpdate: false,
hasDelete: false,

View File

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

View File

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