AgencyList.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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 :src="scope.row.agencyPhoto" style="width: 50px; height: 50px;"/>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. prop="evaluationAgencyName"
  52. label="名称"
  53. align="left"
  54. width="300">
  55. </el-table-column>
  56. <el-table-column
  57. prop="address"
  58. align="left"
  59. label="地址">
  60. </el-table-column>
  61. <el-table-column
  62. prop="taskCount"
  63. align="center"
  64. label="接包数量">
  65. </el-table-column>
  66. <el-table-column
  67. align="center"
  68. label="操作">
  69. <template slot-scope="scope">
  70. <div class="btn btn-small btn-info" @click="goToDetail(scope.row.userId)">查看详情</div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </template>
  75. <el-pagination
  76. v-if="curAgencyList&&curAgencyList.length"
  77. :page-size="9"
  78. layout="prev, pager, next"
  79. :total="totalElements"
  80. :current-page="activePage"
  81. @current-change="handlePageChange"
  82. class="pull-right"
  83. >
  84. </el-pagination>
  85. </el-collapse>
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <script>
  91. import Http from '@/js/http.js';
  92. import TopSearch from "../../components/commons/TopSearch";
  93. import {storageGet} from '@/js/index.js'
  94. import {notify} from "../../constants";
  95. export default {
  96. name: "AgencyList",
  97. components: {TopSearch},
  98. data() {
  99. return {
  100. isLogin: false,
  101. loading: false,
  102. searchVal: '',
  103. searchType: '1',
  104. searchTypeArr: [
  105. {
  106. "name": "全部",
  107. "value": "all"
  108. },
  109. {
  110. "name": "项目",
  111. "value": "0"
  112. },
  113. {
  114. "name": "机构",
  115. "value": "1"
  116. },
  117. {
  118. "name": "工具",
  119. "value": "2"
  120. },
  121. {
  122. "name": "专家",
  123. "value": "3"
  124. }],
  125. curAgencyList: [],
  126. activePage: 1,
  127. totalElements: 0
  128. }
  129. },
  130. methods: {
  131. loadData() {
  132. this.showLoading();
  133. if (storageGet('user') != null) {
  134. this.isLogin = true;
  135. }
  136. this.searchVal = this.$route.params.searchVal;
  137. this.handleSearchData();
  138. this.hideLoading();
  139. },
  140. showLoading () {
  141. this.loading = true
  142. },
  143. hideLoading () {
  144. this.loading = false
  145. },
  146. checkLogin() {
  147. this.checkCreateProjectAuth();
  148. },
  149. checkCreateProjectAuth() {
  150. if (!this.isLogin) {
  151. console.log("请登录后访问");
  152. notify('warning', '请登录后访问');
  153. } else if (this.isLogin) {
  154. Http.get(Apis.USER.IS_PART.replace('{userId}', this.user.id)).then((res) => {
  155. this.$router.push('/project/create');
  156. }).catch((error) => {
  157. notify('error', error.data)
  158. })
  159. }
  160. },
  161. handleSearchData() {
  162. if (this.searchType == 0) {
  163. // this.$router.push({name: 'Square2.0', params: {searchVal: this.searchVal, searchType: "project"}});
  164. } else if (this.searchType == 1) {
  165. let url = '/api/agency/list/more';
  166. let params = {
  167. "keyword": this.searchVal,
  168. "activePage": this.activePage,
  169. "columnFilters": [
  170. {
  171. "field": "type",
  172. "type": "enums",
  173. "enums": this.searchTypeArr,
  174. "value": this.searchType
  175. }
  176. ]
  177. }
  178. Http.post(url, params).then((res) => {
  179. this.curAgencyList = res.data.content;
  180. this.totalElements = res.data.totalElements;
  181. })
  182. } else if (this.searchType == 2) {
  183. this.$router.push({name: 'ResourceList', params: {searchVal: this.searchVal}});
  184. } else if (this.searchType == 3) {
  185. this.$router.push({name: 'ExpertList', params: {searchVal: this.searchVal}});
  186. }
  187. },
  188. goToDetail(userId) {
  189. this.$router.push({
  190. name: 'AgencyDetail',
  191. params: {id: userId, type: 0}
  192. })
  193. },
  194. nextPage() {
  195. let url = '/api/agency/list/more';
  196. let params = {
  197. "keyword": this.searchVal,
  198. "activePage": this.activePage,
  199. "columnFilters": [
  200. {
  201. "field": "type",
  202. "type": "enums",
  203. "enums": this.searchTypeArr,
  204. "value": this.searchType
  205. }
  206. ]
  207. }
  208. Http.post(url, params).then((res) => {
  209. this.curAgencyList = res.data.content;
  210. this.totalElements = res.data.totalElements;
  211. })
  212. },
  213. gotoHome() {
  214. this.$router.push('/home');
  215. },
  216. handleTypeClick(tab) {
  217. this.searchType = tab.name
  218. },
  219. handlePageChange(index) {
  220. this.activePage = index;
  221. this.nextPage();
  222. }
  223. },
  224. mounted() {
  225. this.loadData();
  226. },
  227. }
  228. </script>
  229. <style scoped>
  230. .item-template {
  231. height: 80px;
  232. }
  233. </style>