index.vue 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="body">
  3. <el-card class="box-card">
  4. <div slot="header" class="clearfix">
  5. <el-button type="primary" style="float: right" icon="el-icon-plus" @click="handleAdd">新建配置</el-button>
  6. </div>
  7. <div class="text item">
  8. <el-table stripe :data="tableData" border style="width: 100%">
  9. <el-table-column prop="appName" label="配置名称" />
  10. <el-table-column prop="picture" label="二维码" align="center">
  11. <template slot-scope="scope">
  12. <!-- :src="scope.row.qrCode" -->
  13. <el-popover placement="right" trigger="hover" style="cursor: pointer;">
  14. <el-image
  15. slot="reference"
  16. src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png"
  17. alt="scope.row.image_url"
  18. style="max-height: 110px;max-width: 110px"
  19. />
  20. <el-image src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png" />
  21. </el-popover>
  22. <!-- <img
  23. src="https://cdn4.buysellads.net/uu/1/41334/1550855401-cc_light.png"
  24. min-width="70"
  25. height="80"
  26. />-->
  27. </template>
  28. </el-table-column>
  29. <el-table-column prop="createDate" label="状态" align="center" width="200">
  30. <template slot-scope="scope">
  31. <el-tag
  32. :type="scope.row.status==1?'success':'danger'"
  33. size="small "
  34. effect="dark"
  35. >{{ scope.row.status==1?'发布':'未发布' }}</el-tag>
  36. </template>
  37. </el-table-column>
  38. <el-table-column align="center" label="操作" min-width="100" width="280">
  39. <template slot-scope="scope">
  40. <el-link :underline="false" style="margin-right:1em" type="primary">
  41. <router-link
  42. :to="{path:'WeChatConfig/Edit',query: { configId: scope.row.configId }}"
  43. >编辑</router-link>
  44. </el-link>
  45. <el-popconfirm
  46. icon="el-icon-info"
  47. icon-color="red"
  48. title="确定要删除该配置吗?"
  49. @onConfirm="handleDelete(scope.row)"
  50. >
  51. <el-link slot="reference" :underline="false" type="danger">删除</el-link>
  52. </el-popconfirm>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <el-pagination
  57. v-show="WxTotal!==0"
  58. style="float:right; margin:20px 0"
  59. :total="WxTotal"
  60. :current-page="currentPage"
  61. :page-size="pageSize"
  62. :page-sizes="[pageSize, 20, 35,40,50,80,100]"
  63. layout="total, prev, pager, next, sizes"
  64. @size-change="handleSizeChange"
  65. @current-change="handleCurrentChange"
  66. />
  67. </div>
  68. </el-card>
  69. </div>
  70. </template>
  71. <script>
  72. import { getConfigList, DeleteConfig } from '@/api/WeChatApi'
  73. export default {
  74. data() {
  75. return {
  76. appName: undefined,
  77. daterange: '',
  78. tableData: [],
  79. endDate: undefined,
  80. startDate: undefined,
  81. //
  82. pageSize: 10,
  83. currentPage: 1,
  84. WxTotal: 0 // 条目总数
  85. }
  86. },
  87. mounted() {
  88. this.onSearch()
  89. },
  90. methods: {
  91. // 改变每页显示条数
  92. handleSizeChange(val) {
  93. this.pageSize = val
  94. this.changePagination()
  95. },
  96. // 改变页码
  97. handleCurrentChange(val) {
  98. this.currentPage = val
  99. this.changePagination()
  100. },
  101. // 改变分页组件重新查询数据
  102. changePagination() {
  103. getConfigList({
  104. // title: this.title,
  105. // startDate: this.startDate,
  106. // endDate: this.endDate,
  107. pageNum: this.currentPage,
  108. pageSize: this.pageSize
  109. }).then((res) => {
  110. this.tableData = res.data.records
  111. })
  112. },
  113. handleAdd() {
  114. this.$router.push({ path: 'WeChatConfig/Edit' })
  115. },
  116. handleDelete(row) {
  117. DeleteConfig(row.configId).then(() => {
  118. this.onSearch()
  119. })
  120. },
  121. onSearch() {
  122. getConfigList({
  123. pageNum: this.currentPage,
  124. pageSize: this.pageSize
  125. }).then((res) => {
  126. this.tableData = res.data.records
  127. this.WxTotal = res.data.total
  128. })
  129. },
  130. onReset() {
  131. this.appName = ''
  132. this.onSearch()
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .box-card {
  139. box-shadow: none;
  140. }
  141. </style>