index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="debt">
  5. <el-col :span="24" class="top">
  6. <topInfo :topTitle="topTitle" :display="display"></topInfo>
  7. </el-col>
  8. <el-col :span="24" class="search">
  9. <searchInfo></searchInfo>
  10. </el-col>
  11. <el-col :span="24" class="main">
  12. <newsInfo :debtTable="debtTable" :total="total" @handleClick="handleClick"></newsInfo>
  13. </el-col>
  14. </el-col>
  15. </el-row>
  16. </div>
  17. </template>
  18. <script>
  19. import topInfo from '@/layout/common/topInfo.vue';
  20. import searchInfo from '@/layout/common/searchInfo.vue';
  21. import newsInfo from '@/layout/institution/newsInfo.vue';
  22. import { createNamespacedHelpers } from 'vuex';
  23. const { mapActions } = createNamespacedHelpers('institution');
  24. export default {
  25. name: 'index',
  26. props: {},
  27. components: {
  28. topInfo, //头部导航
  29. searchInfo, //搜素
  30. newsInfo, //
  31. },
  32. data: () => ({
  33. display: 'none',
  34. topTitle: '金融机构',
  35. debtTable: [],
  36. total: 1,
  37. }),
  38. created() {
  39. // this.search();
  40. // this.searchstatus1();
  41. // this.searchelse();
  42. },
  43. computed: {
  44. status() {
  45. return this.$route.params.status;
  46. },
  47. },
  48. watch: {
  49. // status(news) {
  50. // if (news == 1) {
  51. // this.search();
  52. // }
  53. // },
  54. status: {
  55. handler(oval) {
  56. console.log(oval);
  57. this.debtTable = [];
  58. console.log(this.debtTable);
  59. if (oval == 0) {
  60. console.log('if');
  61. this.search();
  62. } else if (oval == 1) {
  63. console.log('elseif');
  64. this.searchstatus1();
  65. } else {
  66. console.log('else');
  67. this.searchelse();
  68. }
  69. },
  70. //立刻
  71. immediate: true,
  72. deep: true,
  73. },
  74. },
  75. methods: {
  76. // 修改
  77. ...mapActions(['query', 'delete']),
  78. async search({ skip = 0, limit = 10, ...info } = {}) {
  79. console.log(status);
  80. const res = await this.query({ skip, limit, ...info });
  81. console.log(res.data);
  82. var weishenhe = res.data.filter(item => item.type === '0');
  83. this.$set(this, `debtTable`, weishenhe);
  84. },
  85. async searchstatus1({ skip = 0, limit = 10, ...info } = {}) {
  86. console.log(status);
  87. const res = await this.query({ skip, limit, ...info });
  88. console.log(res.data);
  89. var weishenhe = res.data.filter(item => item.type === '1');
  90. this.$set(this, `debtTable`, weishenhe);
  91. },
  92. async searchelse({ skip = 0, limit = 10, ...info } = {}) {
  93. console.log(status);
  94. const res = await this.query({ skip, limit, ...info });
  95. console.log(res.data);
  96. var weishenhe = res.data.filter(item => item.type === '2');
  97. console.log(weishenhe);
  98. this.$set(this, `debtTable`, weishenhe);
  99. },
  100. handleClick(newid) {
  101. this.$router.push({ path: '/institution/detail', query: { id: newid } });
  102. },
  103. },
  104. };
  105. </script>
  106. <style lang="less" scoped>
  107. .debt {
  108. padding: 20px;
  109. }
  110. .top {
  111. border-bottom: 1px solid #ccc;
  112. }
  113. </style>