Commit ddd166b4 authored by 杨柠瑞's avatar 杨柠瑞

coding

parent 3ee4ec5b
...@@ -681,29 +681,9 @@ ...@@ -681,29 +681,9 @@
// 删除一条数据 // 删除一条数据
deleteData(data) { deleteData(data) {
const self = this const self = this
self.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { const params = { ids: [data.id] }
confirmButtonText: '确定', params.ids = JSON.stringify(params.ids)
cancelButtonText: '取消', self.deleteDataRequest(params)
type: 'warning'
}).then(() => {
request(self.schema.modelUnderscorePlural + '/' + data.id + '/delete', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
}).then(data => {
if (data.data.message === 'delete success') {
self.$message({
message: data.data.message,
type: 'success'
})
self.getList()
}
})
}).catch(() => {
self.$message({
message: '已取消删除',
type: 'success'
})
})
}, },
refreshList() { refreshList() {
this.listQuery = { this.listQuery = {
...@@ -720,15 +700,17 @@ ...@@ -720,15 +700,17 @@
// 批量删除 // 批量删除
BatchRemove() { BatchRemove() {
const self = this const self = this
const datas = { const datas = { ids: [] }
ids: []
}
if (!self.multipleSelection) return false if (!self.multipleSelection) return false
_.each(self.multipleSelection, function(item, index) { _.each(self.multipleSelection, function(item, index) {
datas.ids.push(item.id) datas.ids.push(item.id)
}) })
datas.ids = JSON.stringify(datas.ids) datas.ids = JSON.stringify(datas.ids)
self.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { self.deleteDataRequest(datas)
},
deleteDataRequest(data) {
const self = this
self.$confirm('此操作将永久删除数据, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
...@@ -736,12 +718,12 @@ ...@@ -736,12 +718,12 @@
request(self.schema.modelUnderscorePlural + '/delete/batch', { request(self.schema.modelUnderscorePlural + '/delete/batch', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
data: datas, data: data,
transformRequest: param transformRequest: param
}).then(data => { }).then(resp => {
if (data.data.message === 'delete success') { if (resp.data.message === 'delete success') {
self.$message({ self.$message({
message: data.data.message, message: resp.data.message,
type: 'success' type: 'success'
}) })
self.getList() self.getList()
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
showExport: true, showExport: true,
showDeleteButton: true, showDeleteButton: true,
buttonGroup: false, buttonGroup: false,
showSelection: false, showSelection: true,
showOverflowTooltip: true, showOverflowTooltip: true,
tableCurrentChange(value) {} tableCurrentChange(value) {}
// dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据 // dataProcessing(value, params, definedOperate) {}, // 处理返回后的数据,必须return 处理后的数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment