fix: 修复克隆路由问题;批量更新显示问题

This commit is contained in:
“huailei000”
2022-09-06 16:37:28 +08:00
committed by huailei
parent 03ca2d614f
commit 2cffb5c952
2 changed files with 23 additions and 17 deletions

View File

@@ -16,11 +16,6 @@
v-bind="tableConfig"
/>
</TreeTable>
<AssetBulkUpdateDialog
:visible.sync="updateSelectedDialogSetting.visible"
v-bind="updateSelectedDialogSetting"
/>
</div>
</template>
@@ -28,7 +23,6 @@
import { TreeTable } from '@/components'
import $ from '@/utils/jquery-vendor'
import { mapGetters } from 'vuex'
import AssetBulkUpdateDialog from './components/AssetBulkUpdateDialog'
import TreeMenu from './components/TreeMenu'
import BaseList from './components/BaseList'
import { setUrlParam } from '@/utils/common'
@@ -36,7 +30,6 @@ import { setUrlParam } from '@/utils/common'
export default {
components: {
TreeTable,
AssetBulkUpdateDialog,
TreeMenu,
BaseList
},
@@ -66,11 +59,7 @@ export default {
tableConfig: {
url: '/api/v1/assets/assets/'
},
helpMessage: this.$t('assets.AssetListHelpMessage'),
updateSelectedDialogSetting: {
visible: false,
selectedRows: []
}
helpMessage: this.$t('assets.AssetListHelpMessage')
}
},
computed: {

View File

@@ -2,6 +2,10 @@
<div>
<ListTable :table-config="iTableConfig" :header-actions="iHeaderActions" />
<PlatformDialog :visible.sync="showPlatform" :category="category" />
<AssetBulkUpdateDialog
:visible.sync="updateSelectedDialogSetting.visible"
v-bind="updateSelectedDialogSetting"
/>
</div>
</template>
@@ -13,13 +17,15 @@ import {
TagsFormatter,
ChoicesDisplayFormatter
} from '@/components/TableFormatters'
import AssetBulkUpdateDialog from './AssetBulkUpdateDialog'
import { connectivityMeta } from '@/components/AccountListTable/const'
import PlatformDialog from '../components/PlatformDialog'
export default {
components: {
ListTable,
PlatformDialog
PlatformDialog,
AssetBulkUpdateDialog
},
props: {
url: {
@@ -53,6 +59,14 @@ export default {
},
data() {
const vm = this
const onAction = (row, action) => {
const routeName = _.capitalize(row.category.value) + action
vm.$router.push({
name: routeName,
params: { id: row.id },
...(action === 'Create' && { query: { clone_from: row.id }})
})
}
return {
showPlatform: false,
defaultConfig: {
@@ -114,10 +128,8 @@ export default {
actions: {
formatter: ActionsFormatter,
formatterArgs: {
onUpdate: ({ row }) => {
const routeName = _.capitalize(row.category.value) + 'Update'
vm.$router.push({ name: routeName, params: { id: row.id }})
},
onUpdate: ({ row }) => onAction(row, 'Update'),
onClone: ({ row }) => onAction(row, 'Create'),
performDelete: ({ row }) => {
const id = row.id
const url = `/api/v1/assets/assets/${id}/`
@@ -180,11 +192,16 @@ export default {
vm.$hasPerm('assets.change_asset')
},
callback: ({ selectedRows }) => {
console.log('selectedRows: ----------------------ss', selectedRows)
vm.updateSelectedDialogSetting.selectedRows = selectedRows
vm.updateSelectedDialogSetting.visible = true
}
}
]
},
updateSelectedDialogSetting: {
visible: false,
selectedRows: []
}
}
},