[Update] 修改删除

This commit is contained in:
ibuler
2020-04-07 20:55:13 +08:00
parent 730d2288a2
commit 07fb293cbe
4 changed files with 12 additions and 7 deletions

View File

@@ -104,6 +104,7 @@
:key="row.id"
:table-data="data"
:row="row"
:url="url"
:reload="getList"
:col="col"
:cell-value="row[col.prop]"

View File

@@ -6,9 +6,9 @@
import ActionsGroup from '@/components/ActionsGroup/index'
import BaseFormatter from './base'
const defaultPerformDelete = function({row, col}) {
const defaultPerformDelete = function({ row, col }) {
const id = row.id
const url = `/api/v1/users/groups/${id}/`
const url = `${this.url}${id}/`
return this.$axios.delete(url)
}
const defaultUpdateCallback = function({row, col}) {
@@ -56,16 +56,16 @@ export default {
name: 'update',
title: this.$tc('Update'),
type: 'primary',
has: colActions.hasUpdate || true,
can: colActions.canUpdate || true,
has: colActions.hasUpdate !== false,
can: colActions.canUpdate !== false,
callback: colActions.onUpdate || defaultUpdateCallback.bind(this)
},
{
name: 'delete',
title: this.$tc('Delete'),
type: 'danger',
has: colActions.hasDelete || true,
can: colActions.canDelete || true,
has: colActions.hasDelete !== false,
can: colActions.canDelete !== false,
callback: colActions.onDelete || defaultDeleteCallback.bind(this)
}
]

View File

@@ -24,6 +24,10 @@ export default {
tableData: {
type: Array,
default: () => ({})
},
url: {
type: String,
default: ''
}
}
}

View File

@@ -26,7 +26,7 @@ export default {
},
fields: [
'name', 'username', 'email', 'groups', 'password_strategy', 'password', 'mfa_level',
'source', 'role', 'date_expired', 'phone', 'wechat', 'comment'
'source', 'role', 'date_expired', 'phone', 'wechat', 'comment',
],
url: '/api/v1/users/users/',
fieldsMeta: {