demand.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <div id="demand">
  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="12" v-for="(item, index) in list" :key="index" @click="toView(item)">
  10. <el-col :span="24" class="company">{{ item.title }}</el-col>
  11. <el-col :span="24" class="other">
  12. <el-col :span="8" class="other_1 textOver">
  13. <span>依托单位名称:</span>
  14. <span>{{ item.company_name }}</span>
  15. </el-col>
  16. <el-col :span="8" class="other_1 textOver">
  17. <span>需求截止时间:</span>
  18. <span>{{ item.stop_date }}</span>
  19. </el-col>
  20. <el-col :span="8" class="other_1 textOver">
  21. <span>专业领域:</span>
  22. <span>{{ getDict(item.fields) }}</span>
  23. </el-col>
  24. </el-col>
  25. </el-col>
  26. </el-col>
  27. <el-col :span="24" class="thr">
  28. <component :is="CPage" :total="total" :limit="limit" @query="search"></component>
  29. </el-col>
  30. </el-col>
  31. </el-row>
  32. </div>
  33. </template>
  34. <script lang="ts" setup>
  35. import CPage from '@/components/common/web/c-page.vue';
  36. import partsSearch from '@/components/c-search.vue';
  37. import type { Ref } from 'vue';
  38. import { ref, onMounted } from 'vue';
  39. import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
  40. import { TecholdemandStore } from '@common/src/stores/studio/supplydemand/techoldemand'; //
  41. import type { IQueryResult } from '@/util/types.util';
  42. const sysdictdata = DictDataStore();
  43. const techoldemand = TecholdemandStore();
  44. let fields: Ref<any[]> = ref([
  45. { label: '标题', model: 'title', isSearch: true },
  46. { label: '依托单位名称', model: 'scientist_name', isSearch: true },
  47. { label: '科学家名称', model: 'scientist_name', isSearch: true },
  48. ]);
  49. // 查询数据
  50. let searchForm: Ref<{}> = ref({});
  51. let list: Ref<any[]> = ref([]);
  52. // 总数
  53. let total: Ref<number> = ref(0);
  54. let limit: 10;
  55. let skip = 0;
  56. let fieldList: Ref<any[]> = ref([]);
  57. onMounted(async () => {
  58. await searchOther();
  59. await search({ skip, limit });
  60. });
  61. // 查询
  62. const search = async (e: { skip: number; limit: number }) => {
  63. const { skip, limit } = e;
  64. let info = { limit: limit, skip: skip, ...searchForm.value, is_use: '0', status: '1' };
  65. if (info.limit == undefined) info.limit = 8;
  66. const res: IQueryResult = await techoldemand.query(info);
  67. list.value = res.data as any[];
  68. total.value = res.total;
  69. };
  70. // 查询
  71. const partSearch = (form: { [x: string]: any }) => {
  72. searchForm.value = form;
  73. search({ skip, limit });
  74. };
  75. const emit = defineEmits(['toView']);
  76. //获取领域信息
  77. const getDict = (e: any) => {
  78. let fields = [];
  79. for (const val of e) {
  80. let data = fieldList.value.find((i) => i.dict_value == val);
  81. if (data) fields.push(data.dict_label);
  82. }
  83. let data = fields.join(',');
  84. return data;
  85. };
  86. const toView = (e: object) => {
  87. emit('toView', { data: e, component: 'demands' });
  88. };
  89. // 查询其他信息
  90. const searchOther = async () => {
  91. // 字典表---单位性质
  92. const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_field' });
  93. fieldList.value = p1.data as [];
  94. };
  95. </script>
  96. <style lang="scss" scoped>
  97. .main {
  98. .one {
  99. box-shadow: 0 0 2px #858585;
  100. padding: 10px;
  101. margin: 0 0 10px 0;
  102. }
  103. .two {
  104. display: flex;
  105. flex-direction: row;
  106. flex-wrap: wrap;
  107. box-shadow: 0 0 5px #858585;
  108. padding: 10px;
  109. border-radius: 5px;
  110. margin: 0 0 10px 0;
  111. .list {
  112. max-width: 49%;
  113. border: 3px solid #a2e1f7;
  114. padding: 10px;
  115. border-radius: 5px;
  116. margin: 0 20px 20px 0;
  117. .company {
  118. font-size: 20px;
  119. font-family: cursive;
  120. margin: 0 0 10px 0;
  121. font-weight: bold;
  122. }
  123. .other {
  124. display: flex;
  125. flex-direction: row;
  126. flex-wrap: wrap;
  127. .other_1 {
  128. margin: 0 0 10px 0;
  129. span {
  130. font-size: 14px;
  131. color: #858585;
  132. }
  133. span:nth-child(2) {
  134. color: #000000;
  135. }
  136. }
  137. }
  138. }
  139. .list:hover {
  140. cursor: pointer;
  141. border: 3px solid #65cd94;
  142. .company {
  143. color: #ffffff;
  144. }
  145. }
  146. .list:nth-child(2n) {
  147. margin: 0 0 20px 0;
  148. }
  149. }
  150. }
  151. </style>