[参数项列表] 删除

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