studio.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div id="studio">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <component :is="partsSearch" :is_title="false" :is_search="true" :fields="fields" @search="partSearch"> </component>
  7. </el-col>
  8. <el-col :span="24" class="two">
  9. <el-col class="list" :span="6" v-for="(item, index) in list" :key="index" @click="toView(item)">
  10. <el-col :span="24" class="name">{{ item.name }}</el-col>
  11. <el-col :span="24" class="other">
  12. <el-col :span="24" class="other_1">
  13. <span>依托单位:</span>
  14. <span>{{ item.company_name }}</span>
  15. </el-col>
  16. <el-col :span="24" class="other_1">
  17. <span>入驻科学家:</span>
  18. <span>{{ item.scientist_name }}</span>
  19. </el-col>
  20. </el-col>
  21. </el-col>
  22. </el-col>
  23. <el-col :span="24" class="thr">
  24. <component :is="CPage" :total="total" :limit="limit" @query="search"></component>
  25. </el-col>
  26. </el-col>
  27. </el-row>
  28. </div>
  29. </template>
  30. <script lang="ts" setup>
  31. import CPage from '@/components/common/web/c-page.vue';
  32. import partsSearch from '@/components/c-search.vue';
  33. import type { Ref } from 'vue';
  34. import { ref, onMounted } from 'vue';
  35. import { StudioStore } from '@common/src/stores/studio/studios/studio'; //
  36. import type { IQueryResult } from '@/util/types.util';
  37. const studio = StudioStore();
  38. let fields: Ref<any[]> = ref([
  39. { label: '工作室名称', model: 'name', isSearch: true },
  40. { label: '依托单位', model: 'company_name', isSearch: true },
  41. { label: '入驻科学家', model: 'scientist_name', isSearch: true },
  42. ]);
  43. // 查询数据
  44. let searchForm: Ref<{}> = ref({});
  45. let list: Ref<any[]> = ref([]);
  46. // 总数
  47. let total: Ref<number> = ref(0);
  48. let limit: 8;
  49. let skip = 0;
  50. onMounted(async () => {
  51. await search({ skip, limit });
  52. });
  53. // 查询
  54. const search = async (e: { skip: number; limit: number }) => {
  55. const { skip, limit } = e;
  56. let info = { limit: limit, skip: skip, ...searchForm.value, status: '1' };
  57. if (info.limit == undefined) info.limit = 8;
  58. const res: IQueryResult = await studio.query(info);
  59. list.value = res.data as any[];
  60. total.value = res.total;
  61. };
  62. // 查询
  63. const partSearch = (form: { [x: string]: any }) => {
  64. searchForm.value = form;
  65. search({ skip, limit });
  66. };
  67. const emit = defineEmits(['toView']);
  68. const toView = (e: object) => {
  69. emit('toView', { data: e, component: 'studios' });
  70. };
  71. </script>
  72. <style lang="scss" scoped>
  73. .main {
  74. .one {
  75. box-shadow: 0 0 2px #858585;
  76. padding: 10px;
  77. margin: 0 0 10px 0;
  78. }
  79. .two {
  80. display: flex;
  81. flex-direction: row;
  82. flex-wrap: wrap;
  83. box-shadow: 0 0 5px #858585;
  84. padding: 10px;
  85. border-radius: 5px;
  86. margin: 0 0 10px 0;
  87. .list {
  88. max-width: 22%;
  89. min-height: 270px;
  90. overflow: hidden;
  91. border: 3px solid #a2e1f7;
  92. padding: 10px;
  93. border-radius: 5px;
  94. margin: 0 40px 10px 0;
  95. .name {
  96. text-align: center;
  97. font-size: 25px;
  98. font-family: cursive;
  99. margin: 0 0 5px 0;
  100. padding: 10px 0;
  101. font-weight: bold;
  102. }
  103. .other {
  104. display: flex;
  105. flex-direction: row;
  106. flex-wrap: wrap;
  107. .other_1 {
  108. margin: 0 0 5px 0;
  109. span {
  110. font-size: 14px;
  111. color: #858585;
  112. }
  113. span:nth-child(2) {
  114. color: #000000;
  115. }
  116. }
  117. }
  118. }
  119. .list:hover {
  120. cursor: pointer;
  121. border: 3px solid #65cd94;
  122. .name {
  123. color: #ffffff;
  124. }
  125. }
  126. .list:nth-child(4n) {
  127. margin: 0 0 10px 0;
  128. }
  129. }
  130. }
  131. </style>