[参数项列表] 删除

This commit is contained in:
zhaomeijing
2022-04-28 15:06:45 +08:00
parent 733ec70223
commit 13db5019c8
@@ -92,7 +92,9 @@
<script>
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import addModel from './components/addModel'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import Vue from 'vue'
export default {
name: 'index',
components: {
@@ -100,6 +102,8 @@ export default {
},
data() {
return {
selectedRowKeysArray: '',
token:Vue.ls.get(ACCESS_TOKEN),
loading: false,
toggleSearchStatus: false,
selectedRowKeys: [],
@@ -167,6 +171,7 @@ export default {
},
onSelectChange(value) {
this.selectedRowKeys = value
this.selectedRowKeysArray = this.selectedRowKeys.join(',')
},
//添加
handleAdd() {
@@ -178,21 +183,42 @@ export default {
},
//批量删除
handleDel() {
let param={
ids: this.selectedRowKeysArray
}
if (this.selectedRowKeys.length > 0) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
postAction(_this.url.deleteAll, { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
} else {
_this.$message.warning(_this.$t('operationFailed'))
axios({
url: '/jero-boot/params/paramsInfo/deleteBatch',
method: 'post',
data: param,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
}
})
.then( (res) =>{
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
}else{
_this.$message.warning(_this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
});
}
})
} else {