clear-data.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <el-button type="primary" @click="onSubmit" :loading="submitButtonStat">清空数据</el-button>
  5. <el-button type="primary" @click="onClearCache" :loading="clearCacheButtonStat">清空缓存</el-button>
  6. <el-button type="primary" @click="onClearTableCache" :loading="clearTableCacheButtonStat">清空数据表结构缓存</el-button>
  7. </div>
  8. </div>
  9. </template>
  10. <script>
  11. import Vue from 'vue'
  12. import network from './../../utils/network'
  13. import tool from './../../utils/tool'
  14. export default {
  15. name: 'config_clear-data',
  16. created () {
  17. },
  18. mounted () {
  19. },
  20. data () {
  21. return {
  22. loading: false,
  23. submitButtonStat: false,
  24. clearCacheButtonStat: false,
  25. clearTableCacheButtonStat: false,
  26. }
  27. },
  28. methods: {
  29. onSubmit () {
  30. this.submitButtonStat = true
  31. network.getData('config/clear-data').then(response => {
  32. this.$message({
  33. message: response,
  34. type: 'success'
  35. })
  36. this.submitButtonStat = false
  37. }).catch(response => {
  38. this.submitButtonStat = false
  39. })
  40. },
  41. onClearCache () {
  42. this.clearCacheButtonStat = true
  43. network.getData('config/clear-cache').then(response => {
  44. this.$message({
  45. message: response,
  46. type: 'success'
  47. })
  48. this.clearCacheButtonStat = false
  49. }).catch(response => {
  50. this.clearCacheButtonStat = false
  51. })
  52. },
  53. onClearTableCache () {
  54. this.clearTableCacheButtonStat = true
  55. network.getData('config/clear-table-cache').then(response => {
  56. this.$message({
  57. message: response,
  58. type: 'success'
  59. })
  60. this.clearTableCacheButtonStat = false
  61. }).catch(response => {
  62. this.clearTableCacheButtonStat = false
  63. })
  64. },
  65. }
  66. }
  67. </script>
  68. <style scoped>
  69. </style>