unit.vue 5.2 KB

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