123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <template>
- <div class="app-container">
- <div class="title h1" style="margin-top: 10px;">服务企业</div>
- <div class="filter-container">
- <el-input placeholder="公司名字" v-model="listQueryParam.keyword" style="width: 15%; margin-left: 20px; margin-bottom: 20px;"></el-input>
- <el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="search">
- 搜索
- </el-button>
- </div>
- <div>
- <el-table
- :data="companys"
- border
- fit
- style="width: 100%"
- v-loading="listLoading"
- >
- <el-table-column label="名字" align="center" min-width="25%">
- <template slot-scope="{row}">
- <span>{{ row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="地址" align="center" :show-overflow-tooltip="true" min-width="35%">
- <template slot-scope="{row}">
- <span>{{ row.address }}</span>
- </template>
- </el-table-column>
- <el-table-column label="注册时间" align="center" min-width="20%">
- <template slot-scope="{row}">
- <span>{{ row.applyTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="发包数(个)" align="center" min-width="20%">
- <template slot-scope="{row}">
- <span>{{ row.projectCount }}</span>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0" :total="total" :page.sync="listQueryParam.pageNo" :limit.sync="listQueryParam.pageSize" @pagination="getList" />
- </div>
- </div>
- </template>
- <script>
- import Http from '@/js/http'
- import Api from '@/js/api'
- import {notify} from '@/constants'
- import Pagination from '@/components/Pagination'
- export default {
- name: 'Companys',
- components: { Pagination },
- data: function () {
- return {
- companys: [],
- listLoading: false,
- listQueryParam: {
- pageNo: 1,
- pageSize: 20,
- keyword: ''
- },
- total: 0
- }
- },
- mounted () {
- this.getList()
- },
- methods: {
- search () {
- this.listQueryParam.pageNo = 1
- this.getList()
- },
- getList () {
- this.listLoading = true
- let url = Api.COMPANY.PAGE.replace('{pageNo}', this.listQueryParam.pageNo - 1)
- .replace('{pageSize}', this.listQueryParam.pageSize)
- url = url + '?keyword=' + this.listQueryParam.keyword
- Http.get(url).then((res) => {
- const companyPage = res.data
- this.total = companyPage.totalCount
- this.listQueryParam.pageNo = companyPage.pageNo + 1
- this.listQueryParam.pageSize = companyPage.pageSize
- this.companys.splice(0, this.companys.length)
- companyPage.datas.forEach(company => {
- this.companys.push(company)
- })
- }).catch((error) => {
- console.error(error)
- notify('error', '获取公司数据异常:' + error)
- })
- this.listLoading = false
- }
- }
- }
- </script>
- <style scoped>
- </style>
|