67f263a81865819a7e295b8aca0a7d5e22504c8d.svn-base 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. this.$emit("refresh")
  79. },
  80. show(){
  81. this.visible = true
  82. this.loadData();
  83. },
  84. loadData(){
  85. this.loading = true
  86. getAction("/sys/dict/deleteList").then(res=>{
  87. this.loading = false
  88. if(res.success){
  89. this.dataSource = res.result
  90. }else{
  91. this.$message.warning(res.message)
  92. }
  93. })
  94. },
  95. handleBack(id){
  96. putAction("/sys/dict/back/"+id).then(res=>{
  97. if(res.success){
  98. this.$message.success(res.message)
  99. this.loadData();
  100. }else{
  101. this.$message.warning(res.message)
  102. }
  103. })
  104. },
  105. handleDelete(id){
  106. this.$confirm({
  107. title: '彻底删除字典',
  108. content: (<div>
  109. <p>您确定要彻底删除这个字典项吗?</p>
  110. <p style="color:red;">注意:彻底删除后将无法恢复,请谨慎操作!</p>
  111. </div>),
  112. centered: false,
  113. onOk: () => {
  114. var that = this;
  115. deleteAction("/sys/dict/deletePhysic/"+id).then((res) => {
  116. if (res.success) {
  117. this.$message.success(res.message)
  118. this.loadData();
  119. } else {
  120. that.$message.warning(res.message);
  121. }
  122. });
  123. },
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. </style>