[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" :key="row.id"
:table-data="data" :table-data="data"
:row="row" :row="row"
:url="url"
:reload="getList" :reload="getList"
:col="col" :col="col"
:cell-value="row[col.prop]" :cell-value="row[col.prop]"

View File

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

View File

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

View File

@@ -26,7 +26,7 @@ export default {
}, },
fields: [ fields: [
'name', 'username', 'email', 'groups', 'password_strategy', 'password', 'mfa_level', '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/', url: '/api/v1/users/users/',
fieldsMeta: { fieldsMeta: {