data_clear.blade.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @extends('layouts.base')
  2. @section('content')
  3. <style>
  4. .panel {
  5. margin-bottom: 10px !important;
  6. padding-left: 20px;
  7. border-radius: 10px;
  8. }
  9. .panel .active a {
  10. background-color: #29ba9c !important;
  11. border-radius: 18px !important;
  12. color: #fff;
  13. }
  14. .panel a {
  15. border: none !important;
  16. background-color: #fff !important;
  17. }
  18. .content {
  19. background: #eff3f6;
  20. padding: 10px !important;
  21. }
  22. .con {
  23. padding-bottom: 20px;
  24. position: relative;
  25. border-radius: 8px;
  26. min-height: 100vh;
  27. background-color: #fff;
  28. }
  29. .con .setting .block {
  30. padding: 10px;
  31. background-color: #fff;
  32. border-radius: 8px;
  33. }
  34. .con .setting .block .title {
  35. font-size: 18px;
  36. margin-bottom: 15px;
  37. display: flex;
  38. align-items: center;
  39. }
  40. .confirm-btn {
  41. width: calc(100% - 266px);
  42. position: fixed;
  43. bottom: 0;
  44. right: 0;
  45. margin-right: 10px;
  46. line-height: 63px;
  47. background-color: #ffffff;
  48. box-shadow: 0px 8px 23px 1px rgba(51, 51, 51, 0.3);
  49. background-color: #fff;
  50. text-align: center;
  51. }
  52. b {
  53. font-size: 14px;
  54. }
  55. </style>
  56. <div id='re_content'>
  57. @include('layouts.newTabs')
  58. <div class="con">
  59. <div class="setting">
  60. <el-form ref="form" label-width="15%">
  61. <div class="block">
  62. <div class="title">
  63. <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span>
  64. <b>数据清理</b>
  65. </div>
  66. <el-form-item :label="item.name" v-for="item in plugin_data">
  67. <el-button style="margin-left: 60%" size="mini" type="primary" @click="setTimeBox(item.name,item.plugin)">清理</el-button>
  68. </el-form-item>
  69. </div>
  70. </el-form>
  71. <el-dialog :visible.sync="setTime" width="50%" center :title="name">
  72. <div>
  73. <el-form ref="form1" label-width="15%">
  74. <el-form-item label="需要清理的时间">
  75. <el-date-picker
  76. v-model="times"
  77. type="datetimerange"
  78. value-format="timestamp"
  79. range-separator="至"
  80. start-placeholder="开始日期"
  81. end-placeholder="结束日期"
  82. style="margin-left:5px;"
  83. align="right">
  84. </el-date-picker>
  85. </el-form-item>
  86. <div style="text-align: center">
  87. <el-button type="primary" @click="submit()">提交</el-button>
  88. <el-button type="danger" @click="cancel()">取消</el-button>
  89. </div>
  90. </el-form>
  91. </div>
  92. </el-dialog>
  93. </div>
  94. </div>
  95. </div>
  96. <script>
  97. new Vue({
  98. el: "#re_content",
  99. delimiters: ['[[', ']]'],
  100. data() {
  101. let config = JSON.parse(`{!! json_encode($data) !!}`);
  102. return {
  103. times:[],
  104. setTime:false,
  105. name:'',
  106. plugin:'',
  107. plugin_data:config,
  108. }
  109. },
  110. methods: {
  111. submit() {
  112. let loading = this.$loading({
  113. target: document.querySelector(".content"),
  114. background: 'rgba(0, 0, 0, 0)'
  115. });
  116. let search = {
  117. plugin:this.plugin,
  118. start:'',
  119. end:''
  120. };
  121. if(this.times && this.times.length>0) {
  122. search.start = this.times[0]/1000;
  123. search.end = this.times[1]/1000;
  124. }
  125. this.$http.post("{!! yzWebFullUrl('setting.shop.clear-handle') !!}", search).then(function(response) {
  126. if (response.data.result) {
  127. this.$message({
  128. message: response.data.msg,
  129. type: 'success'
  130. });
  131. } else {
  132. this.$message({
  133. message: response.data.msg,
  134. type: 'error'
  135. });
  136. }
  137. loading.close();
  138. }, function(response) {
  139. this.$message({
  140. message: response.data.msg,
  141. type: 'error'
  142. });
  143. })
  144. },
  145. setTimeBox(name,plugin){
  146. this.name = name;
  147. this.plugin = plugin;
  148. this.setTime = true;
  149. },
  150. cancel(){
  151. this.name = '';
  152. this.plugin = '';
  153. this.setTime = false;
  154. }
  155. },
  156. });
  157. </script>
  158. @endsection