DictDeleteList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <a-modal
  3. :width="modalWidth"
  4. :style="modalStyle"
  5. :visible="visible"
  6. :maskClosable="false"
  7. @cancel="handleCancel">
  8. <template slot="footer">
  9. <a-button @click="handleCancel">关闭</a-button>
  10. </template>
  11. <a-table
  12. ref="table"
  13. rowKey="id"
  14. size="middle"
  15. :columns="columns"
  16. :loading="loading"
  17. :dataSource="dataSource"
  18. :pagination="false">
  19. <span slot="action" slot-scope="text, record">
  20. <a @click="handleBack(record.id)"><a-icon type="redo"/>字典取回</a>
  21. <a-divider type="vertical"/>
  22. <a @click="handleDelete(record.id)"><a-icon type="scissor"/>彻底删除</a>
  23. </span>
  24. </a-table>
  25. </a-modal>
  26. </template>
  27. <script>
  28. import { getAction,deleteAction,putAction } from '@/api/manage'
  29. export default {
  30. name: "DictDeleteList",
  31. data () {
  32. return {
  33. modalWidth: '90%',
  34. modalStyle: { 'top': '20px'},
  35. title: '操作',
  36. visible: false,
  37. loading: false,
  38. dataSource:[],
  39. columns:[
  40. {
  41. title: '#',
  42. dataIndex: '',
  43. key: 'rowIndex',
  44. width: 120,
  45. align: "center",
  46. customRender: function (t, r, index) {
  47. return parseInt(index) + 1;
  48. }
  49. },
  50. {
  51. title: '字典名称',
  52. align: "left",
  53. dataIndex: 'dictName'
  54. },
  55. {
  56. title: '字典编号',
  57. align: "left",
  58. dataIndex: 'dictCode'
  59. },
  60. {
  61. title: '描述',
  62. align: "left",
  63. dataIndex: 'description'
  64. },
  65. {
  66. title: '操作',
  67. dataIndex: 'action',
  68. align: "center",
  69. scopedSlots: {customRender: 'action'}
  70. }
  71. ]
  72. }
  73. },
  74. methods: {
  75. handleCancel(){
  76. this.visible = false
  77. },
  78. show(){
  79. this.visible = true
  80. this.loadData();
  81. },
  82. loadData(){
  83. this.loading = true
  84. getAction("/sys/dict/deleteList").then(res=>{
  85. this.loading = false
  86. if(res.success){
  87. this.dataSource = res.result
  88. }else{
  89. this.$message.warning(res.message)
  90. }
  91. })
  92. },
  93. handleBack(id){
  94. putAction("/sys/dict/back/"+id).then(res=>{
  95. if(res.success){
  96. this.$message.success(res.message)
  97. this.loadData();
  98. }else{
  99. this.$message.warning(res.message)
  100. }
  101. })
  102. },
  103. handleDelete(id){
  104. deleteAction("/sys/dict/deletePhysic/"+id).then(res=>{
  105. if(res.success){
  106. this.$message.success(res.message)
  107. this.loadData();
  108. }else{
  109. this.$message.warning(res.message)
  110. }
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style scoped>
  117. </style>