mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
Merge branch 'v3' of github.com:jumpserver/lina into v3
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
ref="TreeList"
|
ref="TreeList"
|
||||||
:table-config="tableConfig"
|
:table-config="tableConfig"
|
||||||
:help-message="helpMessage"
|
:help-message="helpMessage"
|
||||||
:header-actions="headerActions"
|
|
||||||
:tree-setting="treeSetting"
|
:tree-setting="treeSetting"
|
||||||
>
|
>
|
||||||
<TreeMenu
|
<TreeMenu
|
||||||
@@ -14,7 +13,7 @@
|
|||||||
/>
|
/>
|
||||||
<BaseList
|
<BaseList
|
||||||
slot="table"
|
slot="table"
|
||||||
v-bind="tableConfig"
|
:table-config="tableConfig"
|
||||||
/>
|
/>
|
||||||
</TreeTable>
|
</TreeTable>
|
||||||
|
|
||||||
@@ -22,7 +21,6 @@
|
|||||||
:visible.sync="updateSelectedDialogSetting.visible"
|
:visible.sync="updateSelectedDialogSetting.visible"
|
||||||
v-bind="updateSelectedDialogSetting"
|
v-bind="updateSelectedDialogSetting"
|
||||||
/>
|
/>
|
||||||
<PlatformDialog #platform-dialog :visible.sync="showPlatform" :category="category" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -32,15 +30,14 @@ import $ from '@/utils/jquery-vendor'
|
|||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import AssetBulkUpdateDialog from './components/AssetBulkUpdateDialog'
|
import AssetBulkUpdateDialog from './components/AssetBulkUpdateDialog'
|
||||||
import TreeMenu from './components/TreeMenu'
|
import TreeMenu from './components/TreeMenu'
|
||||||
import PlatformDialog from './components/PlatformDialog'
|
|
||||||
import BaseList from './components/BaseList'
|
import BaseList from './components/BaseList'
|
||||||
|
import { setUrlParam } from '@/utils/common'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
TreeTable,
|
TreeTable,
|
||||||
AssetBulkUpdateDialog,
|
AssetBulkUpdateDialog,
|
||||||
TreeMenu,
|
TreeMenu,
|
||||||
PlatformDialog,
|
|
||||||
BaseList
|
BaseList
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -61,16 +58,14 @@ export default {
|
|||||||
url: '/api/v1/assets/assets/',
|
url: '/api/v1/assets/assets/',
|
||||||
nodeUrl: '/api/v1/assets/nodes/',
|
nodeUrl: '/api/v1/assets/nodes/',
|
||||||
// ?assets=0不显示资产. =1显示资产
|
// ?assets=0不显示资产. =1显示资产
|
||||||
treeUrl: '/api/v1/assets/nodes/children/tree/?assets=0'
|
treeUrl: '/api/v1/assets/nodes/children/tree/?assets=0',
|
||||||
|
callback: {
|
||||||
|
onSelected: (event, treeNode) => this.getAssetsUrl(treeNode)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/assets/assets/'
|
url: '/api/v1/assets/assets/'
|
||||||
},
|
},
|
||||||
headerActions: {
|
|
||||||
onCreate: () => {
|
|
||||||
this.showPlatform = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
helpMessage: this.$t('assets.AssetListHelpMessage'),
|
helpMessage: this.$t('assets.AssetListHelpMessage'),
|
||||||
updateSelectedDialogSetting: {
|
updateSelectedDialogSetting: {
|
||||||
visible: false,
|
visible: false,
|
||||||
@@ -105,6 +100,19 @@ export default {
|
|||||||
this.decorateRMenu()
|
this.decorateRMenu()
|
||||||
const url = `${this.treeSetting.url}?node_id=${node.meta.data.id}&show_current_asset=${showCurrentAsset}`
|
const url = `${this.treeSetting.url}?node_id=${node.meta.data.id}&show_current_asset=${showCurrentAsset}`
|
||||||
this.$refs.TreeList.$refs.TreeTable.handleUrlChange(url)
|
this.$refs.TreeList.$refs.TreeTable.handleUrlChange(url)
|
||||||
|
},
|
||||||
|
getAssetsUrl(treeNode) {
|
||||||
|
let url = '/api/v1/assets/assets/'
|
||||||
|
if (treeNode.meta.type === 'node') {
|
||||||
|
const nodeId = treeNode.meta.data.id
|
||||||
|
url = setUrlParam(url, 'asset', '')
|
||||||
|
url = setUrlParam(url, 'node', nodeId)
|
||||||
|
} else if (treeNode.meta.type === 'asset') {
|
||||||
|
const assetId = treeNode.meta.data.id
|
||||||
|
url = setUrlParam(url, 'node', '')
|
||||||
|
url = setUrlParam(url, 'asset', assetId)
|
||||||
|
}
|
||||||
|
this.$set(this.tableConfig, 'url', url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -187,15 +187,18 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
iTableConfig() {
|
iTableConfig() {
|
||||||
const config = _.merge({}, this.defaultConfig, this.tableConfig)
|
const config = _.merge(this.defaultConfig, this.tableConfig, {
|
||||||
if (this.addColumns) {
|
url: this.url,
|
||||||
|
category: this.category
|
||||||
|
})
|
||||||
|
if (this.addColumns.length > 0) {
|
||||||
config.columns = [
|
config.columns = [
|
||||||
...config.columns.slice(0, 2),
|
...config.columns.slice(0, 2),
|
||||||
...this.addColumns,
|
...this.addColumns,
|
||||||
...config.columns.slice(2)
|
...config.columns.slice(2)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
if (this.addColumnsMeta) {
|
if (Object.keys(this.addColumnsMeta).length > 0) {
|
||||||
config.columnsMeta = _.merge(config.columnsMeta, this.addColumnsMeta)
|
config.columnsMeta = _.merge(config.columnsMeta, this.addColumnsMeta)
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
|
Reference in New Issue
Block a user