AgencyList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="home-wrapper">
  3. <!-- <TopSearch :searchVal="searchVal" :searchType="searchType" :searchTypeArr="searchTypeArr"/>-->
  4. <div class="nav" stype="height:500px">
  5. <!--搜索框-->
  6. <el-row class="search-nav" style="padding: 30px 0 20px 0">
  7. <el-col :span="6">
  8. <div class="pull-left" @click="gotoHome" style="cursor: pointer">
  9. <img class="logo-img" :src="logo_transparent"/>
  10. <span class="logo-title">{{logoTitle}}</span>
  11. </div>
  12. </el-col>
  13. <el-col :span="12">
  14. <div class="search-nav">
  15. <div id="search-block ">
  16. <el-tabs v-model="searchType" type="card" @tab-click="handleTypeClick">
  17. <el-tab-pane v-for="item in searchTypeArr" v-if="item.value!=='all'" :label="item.name"
  18. :name="item.value"
  19. :key="item.value"></el-tab-pane>
  20. </el-tabs>
  21. <div class="search-input">
  22. <el-input placeholder="请输入内容" v-model="searchVal" class="input-with-select">
  23. <el-button class="search-button" slot="append" type="primary" @click="handleSearchData">搜索</el-button>
  24. </el-input>
  25. </div>
  26. </div>
  27. </div>
  28. </el-col>
  29. <el-col :span="6">
  30. <el-button type="primary pull-right" class="releaseBtn" @click="checkLogin()">免费发布众测需求</el-button>
  31. </el-col>
  32. </el-row>
  33. </div>
  34. <div class="container" style="margin: 20px auto;">
  35. <div class="create-body">
  36. <div class="title h2">测评机构</div>
  37. <el-collapse accordion style="margin: 0 30px">
  38. <template style="color: black">
  39. <el-table
  40. ref="multipleTable"
  41. :data="curAgencyList"
  42. tooltip-effect="dark"
  43. style="width: 100%; font-size: 20px; color: black" v-loading="loading">
  44. <el-table-column
  45. label="头像"
  46. width="100">
  47. <template slot-scope="scope"><img
  48. :src="scope.row.agencyPhoto==null?defaultValue.image:scope.row.agencyPhoto"
  49. style="width: 50px; height: 50px;"/>
  50. </template>
  51. </el-table-column>
  52. <el-table-column
  53. prop="evaluationAgencyName"
  54. label="名称"
  55. align="left"
  56. width="300">
  57. </el-table-column>
  58. <el-table-column
  59. prop="address"
  60. align="left"
  61. label="地址">
  62. </el-table-column>
  63. <el-table-column
  64. prop="taskCount"
  65. align="center"
  66. label="接包数量">
  67. </el-table-column>
  68. <el-table-column
  69. align="center"
  70. label="操作">
  71. <template slot-scope="scope">
  72. <div class="btn btn-small btn-info" @click="goToDetail(scope.row.userId)">查看详情</div>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. </template>
  77. <el-pagination
  78. v-if="curAgencyList&&curAgencyList.length"
  79. :page-size="9"
  80. layout="prev, pager, next"
  81. :total="totalElements"
  82. :current-page="activePage"
  83. @current-change="handlePageChange"
  84. class="pull-right"
  85. >
  86. </el-pagination>
  87. </el-collapse>
  88. </div>
  89. </div>
  90. </div>
  91. </template>
  92. <script>
  93. import Http from '@/js/http.js';
  94. import TopSearch from "../../components/commons/TopSearch";
  95. import {defaultValue, storageGet} from '@/js/index.js'
  96. import {notify} from "../../constants";
  97. import Apis from '@/js/api'
  98. import {CONFIG} from "../../config";
  99. export default {
  100. name: "AgencyList",
  101. components: {TopSearch},
  102. data() {
  103. return {
  104. logoTitle:CONFIG.logoTitle,
  105. logo_transparent:CONFIG.logo_transparent,
  106. user: {},
  107. isLogin: false,
  108. loading: false,
  109. defaultValue: defaultValue,
  110. searchVal: '',
  111. searchType: '1',
  112. searchTypeArr: [
  113. {
  114. "name": "全部",
  115. "value": "all"
  116. },
  117. {
  118. "name": "项目",
  119. "value": "0"
  120. },
  121. {
  122. "name": "机构",
  123. "value": "1"
  124. },
  125. {
  126. "name": "资源",
  127. "value": "2"
  128. },
  129. {
  130. "name": "专家",
  131. "value": "3"
  132. }],
  133. curAgencyList: [],
  134. activePage: 1,
  135. totalElements: 0
  136. }
  137. },
  138. methods: {
  139. loadData() {
  140. this.showLoading();
  141. if (storageGet('user') != null) {
  142. this.isLogin = true;
  143. }
  144. this.searchVal = this.$route.params.searchVal;
  145. this.handleSearchData();
  146. this.hideLoading();
  147. },
  148. showLoading() {
  149. this.loading = true
  150. },
  151. hideLoading() {
  152. this.loading = false
  153. },
  154. checkLogin() {
  155. this.checkCreateProjectAuth();
  156. },
  157. checkCreateProjectAuth() {
  158. if (!this.isLogin) {
  159. console.log("请登录后访问");
  160. notify('warning', '请登录后访问');
  161. } else if (this.isLogin) {
  162. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  163. this.$router.push('/project/create');
  164. }).catch((error) => {
  165. notify('error', error.data)
  166. })
  167. }
  168. },
  169. handleSearchData() {
  170. if (this.searchType == 0) {
  171. // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
  172. } else if (this.searchType == 1) {
  173. let url = '/api/agency/list/more';
  174. let params = {
  175. "keyword": this.searchVal,
  176. "activePage": this.activePage,
  177. "columnFilters": [
  178. {
  179. "field": "type",
  180. "type": "enums",
  181. "enums": this.searchTypeArr,
  182. "value": this.searchType
  183. }
  184. ]
  185. }
  186. Http.post(url, params).then((res) => {
  187. this.curAgencyList = res.data.content;
  188. this.totalElements = res.data.totalElements;
  189. })
  190. } else if (this.searchType == 2) {
  191. this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
  192. } else if (this.searchType == 3) {
  193. this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
  194. }
  195. },
  196. goToDetail(userId) {
  197. this.$router.push({
  198. name: 'NewAgencyDetail',
  199. path:'/agency/detail',
  200. query: {id: userId, type: 0}
  201. })
  202. },
  203. nextPage() {
  204. let url = '/api/agency/list/more';
  205. let params = {
  206. "keyword": this.searchVal,
  207. "activePage": this.activePage,
  208. "columnFilters": [
  209. {
  210. "field": "type",
  211. "type": "enums",
  212. "enums": this.searchTypeArr,
  213. "value": this.searchType
  214. }
  215. ]
  216. }
  217. Http.post(url, params).then((res) => {
  218. this.curAgencyList = res.data.content;
  219. this.totalElements = res.data.totalElements;
  220. })
  221. },
  222. gotoHome() {
  223. this.$router.push('/home');
  224. },
  225. handleTypeClick(tab) {
  226. this.searchType = tab.name
  227. },
  228. handlePageChange(index) {
  229. this.activePage = index;
  230. this.nextPage();
  231. },
  232. setUserInfo() {
  233. this.user = storageGet('user') && storageGet('user').userVO;
  234. }
  235. },
  236. mounted() {
  237. this.setUserInfo();
  238. this.loadData();
  239. }
  240. }
  241. </script>
  242. <style scoped lang="scss">
  243. @import "../../style/search-nav.scss";
  244. .item-template {
  245. height: 80px;
  246. }
  247. </style>