mirror of
https://github.com/jumpserver/lina.git
synced 2025-07-07 20:19:01 +00:00
commit
f85d3567a7
@ -57,7 +57,7 @@ export default {
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
getRoute({ row }) {
|
||||
switch (row['app_category']) {
|
||||
switch (row['category']) {
|
||||
case 'remote_app':
|
||||
return {
|
||||
name: 'RemoteAppDetail',
|
||||
|
@ -60,8 +60,8 @@ export default {
|
||||
},
|
||||
performExport: {
|
||||
type: Function,
|
||||
default(selectedRows, exportOptions, query) {
|
||||
return this.defaultPerformExport(selectedRows, exportOptions, query)
|
||||
default(selectedRows, exportOptions, query, exportType) {
|
||||
return this.defaultPerformExport(selectedRows, exportOptions, query, exportType)
|
||||
}
|
||||
},
|
||||
canExportAll: {
|
||||
@ -143,7 +143,7 @@ export default {
|
||||
mounted() {
|
||||
this.$eventBus.$on('showExportDialog', ({ selectedRows, url, name }) => {
|
||||
// Todo: 没有时间了,只能先这么处理了
|
||||
if (url === this.url || url.indexOf('account') > -1) {
|
||||
if (url === this.url || url.indexOf(this.url) > -1 || url.indexOf('account') > -1) {
|
||||
this.showExportDialog()
|
||||
}
|
||||
})
|
||||
@ -167,7 +167,7 @@ export default {
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
},
|
||||
async defaultPerformExport(selectRows, exportOption, q) {
|
||||
async defaultPerformExport(selectRows, exportOption, q, exportTypeOption) {
|
||||
const url = (process.env.VUE_APP_ENV === 'production') ? (`${this.url}`) : (`${process.env.VUE_APP_BASE_API}${this.url}`)
|
||||
const query = Object.assign({}, q)
|
||||
if (exportOption === 'selected') {
|
||||
@ -179,7 +179,7 @@ export default {
|
||||
const spm = await createSourceIdCache(resources)
|
||||
query['spm'] = spm.spm
|
||||
}
|
||||
query['format'] = this.exportTypeOption
|
||||
query['format'] = exportTypeOption
|
||||
const queryStr =
|
||||
(url.indexOf('?') > -1 ? '&' : '?') +
|
||||
queryUtil.stringify(query, '=', '&')
|
||||
@ -187,11 +187,11 @@ export default {
|
||||
},
|
||||
async handleExport() {
|
||||
const listTableRef = this.$parent.$parent.$parent.$parent
|
||||
const query = listTableRef.dataTable.getQuery()
|
||||
const query = listTableRef['dataTable'].getQuery()
|
||||
delete query['limit']
|
||||
delete query['offset']
|
||||
await this.beforeExport()
|
||||
return this.performExport(this.selectedRows, this.exportOption, query)
|
||||
return this.performExport(this.selectedRows, this.exportOption, query, this.exportTypeOption)
|
||||
},
|
||||
async handleExportConfirm() {
|
||||
await this.handleExport()
|
||||
|
@ -1,8 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
<TableAction :table-url="iTableConfig.url" :search-table="search" :date-pick="handleDateChange" v-bind="headerActions" :selected-rows="selectedRows" :reload-table="reloadTable" />
|
||||
<TableAction
|
||||
:table-url="tableUrl"
|
||||
:search-table="search"
|
||||
:date-pick="handleDateChange"
|
||||
:selected-rows="selectedRows"
|
||||
:reload-table="reloadTable"
|
||||
v-bind="headerActions"
|
||||
/>
|
||||
<IBox class="table-content">
|
||||
<AutoDataTable ref="dataTable" :filter-table="filter" :config="iTableConfig" @selection-change="handleSelectionChange" v-on="$listeners" />
|
||||
<AutoDataTable
|
||||
ref="dataTable"
|
||||
:filter-table="filter"
|
||||
:config="iTableConfig"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-on="$listeners"
|
||||
/>
|
||||
</IBox>
|
||||
</div>
|
||||
</template>
|
||||
@ -50,6 +63,9 @@ export default {
|
||||
this.$log.debug('Header actions', this.headerActions)
|
||||
this.$log.debug('ListTable: iTableConfig change', config)
|
||||
return config
|
||||
},
|
||||
tableUrl() {
|
||||
return this.iTableConfig.url
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -77,9 +77,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleUrlChange(_url) {
|
||||
this.$set(this.iTableConfig, 'url', _url)
|
||||
this.$emit('urlChange', _url)
|
||||
handleUrlChange(url) {
|
||||
this.$set(this.iTableConfig, 'url', url)
|
||||
this.$emit('urlChange', url)
|
||||
this.forceRerender()
|
||||
},
|
||||
forceRerender() {
|
||||
|
@ -175,8 +175,12 @@ export default {
|
||||
},
|
||||
defaultUpdate() {
|
||||
const id = this.$route.params.id
|
||||
const routeName = this.validActions.updateRoute
|
||||
this.$router.push({ name: routeName, params: { id: id }})
|
||||
let route = this.validActions.updateRoute
|
||||
if (typeof route === 'string') {
|
||||
route = { name: route, params: {}}
|
||||
}
|
||||
route.params.id = id
|
||||
this.$router.push(route)
|
||||
},
|
||||
getObject() {
|
||||
const url = this.validActions.detailApiUrl
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<GenericDetailPage :object.sync="RemoteAppPermission" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners" @tab-click="TabClick">
|
||||
<GenericDetailPage :object.sync="app" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners" @tab-click="TabClick">
|
||||
<keep-alive>
|
||||
<component :is="config.activeMenu" :object="RemoteAppPermission" />
|
||||
<component :is="config.activeMenu" :object="app" />
|
||||
</keep-alive>
|
||||
</GenericDetailPage>
|
||||
</template>
|
||||
@ -22,7 +22,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
RemoteAppPermission: {},
|
||||
app: { type: '', category: '', id: '' },
|
||||
config: {
|
||||
activeMenu: 'ApplicationPermissionDetail',
|
||||
submenu: [
|
||||
@ -41,7 +41,20 @@ export default {
|
||||
],
|
||||
actions: {
|
||||
detailApiUrl: `/api/v1/perms/application-permissions/${this.$route.params.id}/`,
|
||||
deleteApiUrl: `/api/v1/perms/application-permissions/${this.$route.params.id}/`
|
||||
deleteApiUrl: `/api/v1/perms/application-permissions/${this.$route.params.id}/`,
|
||||
updateCallback: () => {
|
||||
const route = {
|
||||
name: 'ApplicationPermissionUpdate',
|
||||
query: {
|
||||
type: this.app.type,
|
||||
category: this.app.category
|
||||
},
|
||||
params: {
|
||||
id: this.app.id
|
||||
}
|
||||
}
|
||||
this.$router.push(route)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import { DetailFormatter } from '@/components/TableFormatters'
|
||||
import isFalsey from '@/components/DataTable/compenents/el-data-table/utils/is-falsey'
|
||||
import deepmerge from 'deepmerge'
|
||||
import * as queryUtil from '@/components/DataTable/compenents/el-data-table/utils/query'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -66,7 +67,7 @@ export default {
|
||||
label: this.$t('sessions.riskLevel'),
|
||||
width: '105px',
|
||||
formatter: (row, col, cellValue) => {
|
||||
const display = row.risk_level_display
|
||||
const display = row['risk_level_display']
|
||||
if (cellValue === 0) {
|
||||
return display
|
||||
} else {
|
||||
@ -117,6 +118,33 @@ export default {
|
||||
hasImport: false,
|
||||
hasDatePicker: true,
|
||||
canExportSelected: true,
|
||||
exportOptions: {
|
||||
// Todo: 优化这里,和抽象组件重复了
|
||||
performExport: async(selectRows, exportOption, q, exportTypeOption) => {
|
||||
let url = this.tableConfig.url
|
||||
url = (process.env.VUE_APP_ENV === 'production') ? (`${url}`) : (`${process.env.VUE_APP_BASE_API}${url}`)
|
||||
const query = Object.assign({}, q)
|
||||
if (exportOption === 'selected') {
|
||||
const resources = []
|
||||
const data = selectRows
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
resources.push(data[index].id)
|
||||
}
|
||||
const spm = await createSourceIdCache(resources)
|
||||
query['spm'] = spm.spm
|
||||
}
|
||||
query['format'] = exportTypeOption
|
||||
const queryStr =
|
||||
(url.indexOf('?') > -1 ? '&' : '?') +
|
||||
queryUtil.stringify(query, '=', '&')
|
||||
url = url + queryStr
|
||||
this.$log.debug('Export url: ', this.url, '=>', url)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url + queryStr)
|
||||
}
|
||||
},
|
||||
datePicker: {
|
||||
dateStart: dateFrom,
|
||||
dateEnd: dateTo
|
||||
@ -138,7 +166,7 @@ export default {
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onSelected: function(event, treeNode) {
|
||||
onSelected: (event, treeNode) => {
|
||||
// 禁止点击根节点
|
||||
if (treeNode.id === 'root') {
|
||||
return
|
||||
@ -147,8 +175,8 @@ export default {
|
||||
this.$message.error(this.$t('sessions.EsDisabled'))
|
||||
return
|
||||
}
|
||||
this.tableConfig.url = `/api/v1/terminal/commands/?command_storage_id=${treeNode.id}`
|
||||
}.bind(this)
|
||||
this.tableConfig.url = `/api/v1/terminal/commands/?command_storage_id=${treeNode.id}&order=-timestamp`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user