You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <div>
  3. <TopHeader :menu="'tech_view'"></TopHeader>
  4. <div class="ui container">
  5. <SearchBar :type="0" :condition="condition" @changeCondition="changeCondition"></SearchBar>
  6. <div class="conent-c">
  7. <div class="filter-c">
  8. <Filters :type="0" :condition="condition" @changeCondition="changeCondition"></Filters>
  9. </div>
  10. <div class="result-c">
  11. <SciAndTechPrjList ref="resultListRef" :condition="condition" @changeCondition="changeCondition">
  12. </SciAndTechPrjList>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import TopHeader from '../components/TopHeader.vue';
  20. import SearchBar from '../components/SearchBar.vue';
  21. import Filters from '../components/Filters.vue';
  22. import SciAndTechPrjList from '../components/SciAndTechPrjList.vue';
  23. import { getUrlSearchParams } from '~/utils';
  24. export default {
  25. data() {
  26. return {
  27. condition: {
  28. q: '', // 搜索框
  29. type_name: '', // 项目类型
  30. institution_name: '', // 项目参与单位
  31. execute_year: '', // 执行周期包含年份
  32. apply_year: '',
  33. page: '',
  34. pageSize: '',
  35. sort: '',
  36. },
  37. pageSizes: [15, 30, 50],
  38. };
  39. },
  40. components: {
  41. TopHeader,
  42. SearchBar,
  43. Filters,
  44. SciAndTechPrjList
  45. },
  46. methods: {
  47. changeCondition(params) {
  48. this.condition = {
  49. ...this.condition,
  50. ...params,
  51. };
  52. if (!params.changePage) {
  53. this.condition.page = 1;
  54. }
  55. window.location.href = `/tech/tech_view?` + `q=${encodeURIComponent(this.condition.q.trim())}` +
  56. `&type_name=${encodeURIComponent(this.condition.type_name)}` +
  57. `&institution_name=${encodeURIComponent(this.condition.institution_name)}` +
  58. `&execute_year=${encodeURIComponent(this.condition.execute_year)}` +
  59. `&apply_year=${encodeURIComponent(this.condition.apply_year)}` +
  60. `&page=${encodeURIComponent(this.condition.page)}` +
  61. `&pageSize=${encodeURIComponent(this.condition.pageSize)}` +
  62. `&sort=${encodeURIComponent(this.condition.sort)}`;
  63. },
  64. },
  65. beforeMount() {
  66. const urlParams = getUrlSearchParams();
  67. this.condition.q = urlParams.q || '';
  68. this.condition.type_name = urlParams.type_name || '';
  69. this.condition.institution_name = urlParams.institution_name || '';
  70. this.condition.execute_year = urlParams.execute_year || '';
  71. this.condition.apply_year = urlParams.apply_year || '';
  72. this.condition.sort = urlParams.sort || '';
  73. this.condition.page = Number(urlParams.page) || 1;
  74. this.condition.pageSize = this.pageSizes.indexOf(Number(urlParams.pageSize)) >= 0 ? Number(urlParams.pageSize) : 15;
  75. this.$nextTick(() => {
  76. this.$refs.resultListRef.search();
  77. });
  78. },
  79. mounted() { },
  80. beforeDestroy() { },
  81. };
  82. </script>
  83. <style scoped lang="less">
  84. .conent-c {
  85. display: flex;
  86. }
  87. .filter-c {
  88. flex: 1;
  89. padding-left: 12px;
  90. }
  91. .result-c {
  92. margin-left: 10px;
  93. flex: 3;
  94. }
  95. </style>