region2.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div class="context">
  3. <div class="panel">
  4. <h5>区域管理</h5>
  5. <el-button id="queryBtn" type="success" @click="query()" :disabled="serachBtnStatus">刷新</el-button>
  6. <div class="pages">
  7. <div class="shops" v-for="s in 2">
  8. <h5> 小飞龙蒙正店</h5>
  9. <div class="change">
  10. <el-button type="primary" @click="">新增区域</el-button>
  11. <el-button @click="" >编辑区域</el-button>
  12. <el-button @click="" type="danger">删除区域</el-button>
  13. </div>
  14. <el-table
  15. :data="tableData"
  16. style="width: 100%">
  17. <el-table-column
  18. type="index"
  19. label="序号"
  20. align="center"
  21. width="50">
  22. </el-table-column>
  23. <el-table-column
  24. prop="name"
  25. label="序列号"
  26. >
  27. </el-table-column>
  28. <el-table-column
  29. prop="name"
  30. label="类型"
  31. >
  32. </el-table-column>
  33. <el-table-column
  34. prop="date"
  35. label="创建日期"
  36. width="180">
  37. </el-table-column>
  38. <el-table-column
  39. prop="name"
  40. label="状态"
  41. >
  42. </el-table-column>
  43. <el-table-column
  44. prop="address"
  45. label="操作">
  46. <template slot-scope="scope">
  47. <el-button type="success" @click="run(scope.row.id)" v-if="state != 4">开启</el-button>
  48. <el-button type="danger" @click="pause(scope.row.id)">暂停</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <br>
  53. <br>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import Global from '../Global.js'
  61. import {
  62. testTable,
  63. testSelect
  64. } from "../api/getApiRes";
  65. let qs = require('qs');
  66. export default {
  67. data() {
  68. return {
  69. tableData:[],
  70. serachBtnStatus:true
  71. }
  72. },
  73. mounted() {
  74. this.getTableQuery();
  75. },
  76. methods: {
  77. // 查询按钮
  78. query() {
  79. let that = this;
  80. this.getTableQuery();
  81. that.serachBtnStatus = true;
  82. let totalTime = 2
  83. let clock = window.setInterval(() => {
  84. totalTime--
  85. if (totalTime < 0) {
  86. totalTime = 2;
  87. that.serachBtnStatus = false;
  88. }
  89. }, 1000)
  90. this.$message.success('查询完毕');
  91. },
  92. // 页面数据查询
  93. getTableQuery() {
  94. let that = this;
  95. that.loading = true;
  96. let param = {
  97. token: localStorage.token,
  98. };
  99. let postdata = qs.stringify(param);
  100. testTable(postdata).then(res => {
  101. let json = res;
  102. if (json.Code == 0) {
  103. that.loading = false;
  104. if (json.Rs) {
  105. that.tableData = json.Rs;
  106. } else {
  107. that.tableData = [];
  108. }
  109. } else {
  110. that.$message.error(json.Memo + '错误码:' + json.Code);
  111. }
  112. })
  113. },
  114. }
  115. }
  116. </script>
  117. <style scoped>
  118. @import "../assets/css/panel.css";
  119. ul {
  120. margin: 0;
  121. padding: 0;
  122. list-style: none;
  123. }
  124. .context {
  125. height: 770px;
  126. overflow-y: scroll;
  127. display: block;
  128. margin: 0 auto;
  129. background-color: #fff !important;
  130. padding: 30px;
  131. }
  132. .panel-body {
  133. padding: 20px;
  134. background: #F0F2F5;
  135. }
  136. .pages {
  137. width: 100%;
  138. min-height: 600px;
  139. overflow: hidden;
  140. display: block;
  141. margin: 0 auto;
  142. padding-bottom: 80px;
  143. }
  144. .change {
  145. float: right;
  146. }
  147. #queryBtn {
  148. float: right;
  149. }
  150. </style>