index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div id="index">
  3. <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
  4. <template v-slot:info>
  5. <van-tabs v-model="active" @change="change" color="#409eff">
  6. <van-tab :title="`已授权【${oneTotal}】`" name="有效">
  7. <list-1 :list="list" @detail="detail"></list-1>
  8. </van-tab>
  9. <van-tab :title="`已受理【${twoTotal}】`" name="审中">
  10. <list-1 :list="list" @detail="detail"></list-1>
  11. </van-tab>
  12. <van-tab :title="`已失效专利【${thrTotal}】`" name="失效">
  13. <list-1 :list="list" @detail="detail"></list-1>
  14. </van-tab>
  15. </van-tabs>
  16. </template>
  17. </admin-frame>
  18. </div>
  19. </template>
  20. <script>
  21. import list1 from '../../../../../company/parts/list_2.vue';
  22. import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
  23. import { mapState, createNamespacedHelpers } from 'vuex';
  24. const { mapActions: patentinfo } = createNamespacedHelpers('patentinfo');
  25. const moment = require('moment');
  26. export default {
  27. name: 'index',
  28. props: {},
  29. components: {
  30. adminFrame,
  31. list1,
  32. },
  33. data: function () {
  34. return {
  35. active: '有效',
  36. list: [],
  37. limit: 10,
  38. total: 0,
  39. oneTotal: 0,
  40. twoTotal: 0,
  41. thrTotal: 0,
  42. };
  43. },
  44. async created() {
  45. await this.search({ term: '有效' });
  46. await this.searchTotal();
  47. },
  48. methods: {
  49. ...patentinfo(['query']),
  50. async search({ skip = 0, limit = this.limit, ...info } = {}) {
  51. if (this.active == '有效') {
  52. info.term = this.active;
  53. info.user_id = this.user._id;
  54. let res = await this.query({ skip, limit, ...info });
  55. if (this.$checkRes(res)) {
  56. this.$set(this, `list`, res.data);
  57. this.$set(this, `total`, res.total);
  58. }
  59. } else if (this.active == '审中') {
  60. info.term = this.active;
  61. info.user_id = this.user._id;
  62. let res = await this.query({ skip, limit, ...info });
  63. if (this.$checkRes(res)) {
  64. this.$set(this, `list`, res.data);
  65. this.$set(this, `total`, res.total);
  66. }
  67. } else if (this.active == '失效') {
  68. info.term = this.active;
  69. info.user_id = this.user._id;
  70. let res = await this.query({ skip, limit, ...info });
  71. if (this.$checkRes(res)) {
  72. let onDate = moment(new Date()).format('YYYY-MM-DD');
  73. let data = res.data.filter((i) => i.lose_data <= onDate);
  74. console.log(data);
  75. // this.$set(this, `list`, res.data);
  76. // this.$set(this, `total`, res.total);
  77. }
  78. }
  79. },
  80. // 查询总数
  81. async searchTotal({ skip = 0, limit = this.limit, ...info } = {}) {
  82. let res = await this.query({ skip, limit, term: '有效', user_id: this.user._id, ...info });
  83. if (this.$checkRes(res)) this.$set(this, `oneTotal`, res.total);
  84. res = await this.query({ skip, limit, term: '审中', user_id: this.user._id, ...info });
  85. if (this.$checkRes(res)) this.$set(this, `twoTotal`, res.total);
  86. res = await this.query({ skip, limit, term: '失效', user_id: this.user._id, ...info });
  87. if (this.$checkRes(res)) this.$set(this, `thrTotal`, res.total);
  88. },
  89. // 详情
  90. detail(data) {
  91. this.$router.push({ path: '/service/patent/user/patent/information/detail', query: { id: data.id } });
  92. },
  93. // 选择类型
  94. change(name) {
  95. this.$set(this, `active`, name);
  96. this.search({ term: name });
  97. },
  98. // 返回
  99. back() {
  100. this.$router.push({ path: '/service/patent/index' });
  101. },
  102. },
  103. computed: {
  104. ...mapState(['user']),
  105. },
  106. metaInfo() {
  107. return { title: this.$route.meta.title };
  108. },
  109. watch: {
  110. test: {
  111. deep: true,
  112. immediate: true,
  113. handler(val) {},
  114. },
  115. },
  116. };
  117. </script>
  118. <style lang="less" scoped></style>