绿谷官网后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

82 lines
2.3 KiB

<template>
<div class="pa-3 white fill-height d-flex flex-column">
<partner-search @getBackendSearch="getBackendSearch" />
<partner-date :lists="lists" :pagination="pagination" @getBackendSearch="getBackendSearch" />
</div>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
import PartnerSearch from 'components/Partner/PartnerSearch.vue';
import PartnerDate from 'components/Partner/PartnerDate.vue';
import { backendSearch } from 'config/api';
export default {
name: 'CooperativePartner',
components: {
PartnerSearch,
PartnerDate,
},
data() {
return {
lists: [],
pagination: { current: 1, pageSize: 10 },
};
},
computed: mapState(['partnerOptions']),
async created() {
const options = { type: 1, typeOfPlatform: 2 };
this.setPartnerOptions(options);
await this.getBackendSearch();
},
methods: {
...mapMutations(['setPartnerOptions']),
/**
* 后台查询合作伙伴和衍生企业
* @param { String } name 公司名
* @param { Number } type 1-合作伙伴 2-衍生企业
* @param { Number } typeOfPlatform 1-创新平台 2-关于我们 3-孵化平台
* @param { Number } typeOfTech 0-高校 1-院所 2-企业
*/
async getBackendSearch(condition) {
try {
const params = {
param: {
type: this.partnerOptions.type,
typeOfPlatform: this.partnerOptions.typeOfPlatform,
pageNum: (condition && condition.current) || 1,
pageSize: (condition && condition.pageSize) || 10,
},
};
if (condition) {
if (condition.name) {
params.param.name = condition.name;
}
if (condition.typeOfTech !== '') {
params.param.typeOfTech = condition.typeOfTech;
}
}
const res = await backendSearch(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.lists = data.list;
const paper = { ...this.pagination };
paper.current = data.pageNum;
paper.total = +data.total;
paper.pageSize = data.pageSize;
this.pagination = paper;
} else {
throw msg || '获取失败';
}
} catch (error) {
this.$message.error(error);
}
},
},
};
</script>