Files
laws-sinotruk-client/src/views/system/DictDeleteList.vue
T
2023-10-08 16:48:57 +08:00

139 lines
3.3 KiB
Vue

<template>
<j-modal
:width="modalWidth"
:style="modalStyle"
:visible="visible"
switchFullscreen
:maskClosable="false"
@cancel="handleCancel">
<template slot="footer">
<a-button @click="handleCancel">{{ $t('close') }}</a-button>
</template>
<a-table
ref="table"
rowKey="id"
size="middle"
:columns="columns"
:loading="loading"
:dataSource="dataSource"
:pagination="false">
<span slot="action" slot-scope="text, record">
<a @click="handleBack(record.id)"><a-icon type="redo"/>{{ $t('dict.dictFetch') }}</a>
<a-divider type="vertical"/>
<a @click="handleDelete(record.id)"><a-icon type="scissor"/>{{ $t('userRecycle.completelyDelete') }}</a>
</span>
</a-table>
</j-modal>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
export default {
name: 'DictDeleteList',
data () {
return {
modalWidth: '90%',
modalStyle: { top: '20px' },
title: this.$t('operation'),
visible: false,
loading: false,
dataSource: [],
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 120,
align: 'center',
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('dict.dictionaryName'),
align: 'left',
dataIndex: 'dictName'
},
{
title: this.$t('dict.dictionaryNumber'),
align: 'left',
dataIndex: 'dictCode'
},
{
title: this.$t('description'),
align: 'left',
dataIndex: 'description'
},
{
title: this.$t('operation'),
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
]
}
},
methods: {
handleCancel () {
this.visible = false
// 回收站字典列表刷新
this.$emit('refresh')
},
show () {
this.visible = true
this.loadData()
},
loadData () {
this.loading = true
getAction('/sys/dict/deleteList').then(res => {
this.loading = false
if (res.success) {
this.dataSource = res.result
} else {
this.$message.warning(res.message)
}
})
},
handleBack (id) {
postAction('/sys/dict/back/' + id).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
})
},
handleDelete (id) {
this.$confirm({
title: this.$t('dict.completeDeleteDict'),
content: (<div>
<p>{ this.$t('dict.sureCompleteDeleteDict') }</p>
<p style="color:red;">{ this.$t('dict.deleteDictCannotRestore') }</p>
</div>),
centered: false,
onOk: () => {
const that = this
postAction('/sys/dict/deletePhysic/' + id).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
}
}
}
</script>
<style scoped>
</style>