index.vue 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <div class="flex-item flex-h">
  6. <el-button size="mini" type="success" @click="redirection('addCase')">新增案场</el-button>
  7. </div>
  8. <tableSearch value="请输入案场名称" @exportSearchKey="searchList"></tableSearch>
  9. </div>
  10. <div class="moreFilter"></div>
  11. </div>
  12. <div class="system-table-box">
  13. <el-table
  14. :data="currentList"
  15. stripe
  16. style="width: 100%">
  17. <el-table-column
  18. prop="CaseId"
  19. label="ID">
  20. </el-table-column>
  21. <el-table-column
  22. prop="CaseName"
  23. label="案场名称">
  24. </el-table-column>
  25. <el-table-column
  26. prop="CaseAddress"
  27. label="地址">
  28. </el-table-column>
  29. <el-table-column label="操作" width="200">
  30. <template slot-scope="scope">
  31. <el-button
  32. size="mini"
  33. type="warning"
  34. @click="editItem(scope.$index, scope.row)">编辑</el-button>
  35. <!-- <el-button
  36. size="mini"
  37. type="success"
  38. @click="keyManager(scope.$index, scope.row)">钥匙管理</el-button> -->
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. </div>
  43. <el-pagination
  44. @current-change="handleCurrentChange"
  45. :current-page.sync="postData.page"
  46. :page-size="postData.pagesize"
  47. layout="prev, pager, next, jumper"
  48. :total="total">
  49. </el-pagination>
  50. </div>
  51. </template>
  52. <script>
  53. import tableSearch from '@/components/tableSearch/index'
  54. export default {
  55. name: '',
  56. data () {
  57. return {
  58. total: 0,
  59. postData: { // 表格搜索条件
  60. name: '', // 案场名称
  61. page: 0, // 当前页码
  62. pagesize: 10, // 请求数据量
  63. },
  64. currentList: []
  65. }
  66. },
  67. components: {
  68. tableSearch,
  69. },
  70. mounted () {
  71. this.$nextTick(function () { })
  72. },
  73. created () {
  74. this.getList()
  75. },
  76. methods: {
  77. getList () { // 获取列表
  78. this.$ajax(this.$api.caseManager.getCaseList.url, {
  79. method: this.$api.caseManager.getCaseList.method,
  80. queryData: this.postData
  81. }).then(res => {
  82. this.currentList = res.list
  83. this.postData.page = res.page
  84. this.total = res.pagenum
  85. })
  86. },
  87. redirection (pathName) { // 重定向
  88. this.$router.push({ name: pathName })
  89. },
  90. handleCurrentChange (val) { // 跳转到分页
  91. this.getList()
  92. },
  93. editItem (index, row) { // 修改
  94. // console.log(index, row)
  95. this.$router.push({ name: 'editCase', query: { id: row.CaseId } })
  96. },
  97. keyManager (index, row) { // 钥匙管理
  98. console.log(index, row)
  99. },
  100. searchList (key) { // 搜索列表
  101. this.postData.name = key
  102. this.currentList = []
  103. this.postData.page = 0
  104. this.getList()
  105. }
  106. }
  107. }
  108. </script>
  109. <!-- Add "scoped" attribute to limit CSS to this component only -->
  110. <style lang="scss" scoped>
  111. @import "page.scss";
  112. </style>