index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div id="list" class="main">
  3. <el-row v-if="view==='list'">
  4. <el-col :span="24">
  5. <data-table
  6. :fields="fields"
  7. :opera="opera"
  8. :total="total"
  9. :data="list"
  10. @query="search"
  11. @toView="toView"
  12. />
  13. </el-col>
  14. </el-row>
  15. <el-row v-else>
  16. <el-col :span="24">
  17. <el-row>
  18. <el-col :span="24">
  19. <el-button type="primary" plain icon="el-icon-back" size="mini" @click="toBack">返回</el-button>
  20. </el-col>
  21. <el-col :span="24">
  22. <achieve-view :info="viewData" />
  23. </el-col>
  24. </el-row>
  25. </el-col>
  26. </el-row>
  27. </div>
  28. </template>
  29. <script>
  30. import achieveView from '@/components/free/achieve-view.vue'
  31. import dataTable from '@/components/free/filter-page-table.vue'
  32. const _ = require('lodash')
  33. import { createNamespacedHelpers } from 'vuex'
  34. const { mapActions } = createNamespacedHelpers('duplicate')
  35. export default {
  36. name: 'List',
  37. components: { dataTable, achieveView },
  38. props: {},
  39. data: function() {
  40. return {
  41. view: 'list',
  42. list: [],
  43. total: 0,
  44. fields: [
  45. { label: '用户名称', prop: 'user_name', filter: true },
  46. {
  47. label: "申报状态",
  48. prop: "status",
  49. format: (i) =>
  50. i == "0"
  51. ? "草稿"
  52. : i == "1"
  53. ? "待审中"
  54. : i == "2"
  55. ? "审核通过"
  56. : i == "3"
  57. ? "审核拒绝"
  58. : "",
  59. },
  60. ],
  61. opera: [
  62. { label: '查看', method: 'toView' }
  63. ],
  64. viewData: {}
  65. }
  66. },
  67. created() {
  68. this.search()
  69. },
  70. methods: {
  71. ...mapActions(['query']),
  72. async search({ skip = 0, limit = 10, ...info } = {}) {
  73. const res = await this.query({ skip, limit, ...info })
  74. if (this.$checkRes(res)) {
  75. this.$set(this, `list`, res.data)
  76. this.$set(this, `total`, res.total)
  77. }
  78. },
  79. async toView({ data }) {
  80. this.$set(this, `viewData`, _.cloneDeep(data))
  81. this.view = 'detail'
  82. },
  83. async toBack() {
  84. this.view = 'list'
  85. this.viewData = {}
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .main {
  92. padding: 25px 30px 30px;
  93. }
  94. </style>