AgencyList.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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="../../assets/img/logo-blue.png"/>
  10. <span class="logo-title">群智众测平台</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. export default {
  99. name: "AgencyList",
  100. components: {TopSearch},
  101. data() {
  102. return {
  103. user: {},
  104. isLogin: false,
  105. loading: false,
  106. defaultValue: defaultValue,
  107. searchVal: '',
  108. searchType: '1',
  109. searchTypeArr: [
  110. {
  111. "name": "全部",
  112. "value": "all"
  113. },
  114. {
  115. "name": "项目",
  116. "value": "0"
  117. },
  118. {
  119. "name": "机构",
  120. "value": "1"
  121. },
  122. {
  123. "name": "工具",
  124. "value": "2"
  125. },
  126. {
  127. "name": "专家",
  128. "value": "3"
  129. }],
  130. curAgencyList: [],
  131. activePage: 1,
  132. totalElements: 0
  133. }
  134. },
  135. methods: {
  136. loadData() {
  137. this.showLoading();
  138. if (storageGet('user') != null) {
  139. this.isLogin = true;
  140. }
  141. this.searchVal = this.$route.params.searchVal;
  142. this.handleSearchData();
  143. this.hideLoading();
  144. },
  145. showLoading() {
  146. this.loading = true
  147. },
  148. hideLoading() {
  149. this.loading = false
  150. },
  151. checkLogin() {
  152. this.checkCreateProjectAuth();
  153. },
  154. checkCreateProjectAuth() {
  155. if (!this.isLogin) {
  156. console.log("请登录后访问");
  157. notify('warning', '请登录后访问');
  158. } else if (this.isLogin) {
  159. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  160. this.$router.push('/project/create');
  161. }).catch((error) => {
  162. notify('error', error.data)
  163. })
  164. }
  165. },
  166. handleSearchData() {
  167. if (this.searchType == 0) {
  168. // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
  169. } else if (this.searchType == 1) {
  170. let url = '/api/agency/list/more';
  171. let params = {
  172. "keyword": this.searchVal,
  173. "activePage": this.activePage,
  174. "columnFilters": [
  175. {
  176. "field": "type",
  177. "type": "enums",
  178. "enums": this.searchTypeArr,
  179. "value": this.searchType
  180. }
  181. ]
  182. }
  183. Http.post(url, params).then((res) => {
  184. this.curAgencyList = res.data.content;
  185. this.totalElements = res.data.totalElements;
  186. })
  187. } else if (this.searchType == 2) {
  188. this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
  189. } else if (this.searchType == 3) {
  190. this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
  191. }
  192. },
  193. goToDetail(userId) {
  194. this.$router.push({
  195. name: 'AgencyDetail',
  196. params: {id: userId, type: 0}
  197. })
  198. },
  199. nextPage() {
  200. let url = '/api/agency/list/more';
  201. let params = {
  202. "keyword": this.searchVal,
  203. "activePage": this.activePage,
  204. "columnFilters": [
  205. {
  206. "field": "type",
  207. "type": "enums",
  208. "enums": this.searchTypeArr,
  209. "value": this.searchType
  210. }
  211. ]
  212. }
  213. Http.post(url, params).then((res) => {
  214. this.curAgencyList = res.data.content;
  215. this.totalElements = res.data.totalElements;
  216. })
  217. },
  218. gotoHome() {
  219. this.$router.push('/home');
  220. },
  221. handleTypeClick(tab) {
  222. this.searchType = tab.name
  223. },
  224. handlePageChange(index) {
  225. this.activePage = index;
  226. this.nextPage();
  227. },
  228. setUserInfo() {
  229. this.user = storageGet('user') && storageGet('user').userVO;
  230. }
  231. },
  232. mounted() {
  233. this.setUserInfo();
  234. this.loadData();
  235. }
  236. }
  237. </script>
  238. <style scoped lang="less">
  239. @import "../../style/search-nav";
  240. .item-template {
  241. height: 80px;
  242. }
  243. </style>