维基管理后台
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.
 
 
 

105 lines
2.7 KiB

<!--
* @Author: wally
* @email: 18603454788@163.com
* @Date: 2021-04-20 12:33:22
* @LastEditors: wally
* @LastEditTime: 2021-04-20 12:45:39
-->
<template>
<div class="pa-3 white fill-height d-flex flex-column">
<development-search :type-lists="typeLists" @selResSearch="selResSearch" />
<development-date :lists="lists" :pagination="pagination" :type-lists="typeLists" @selResSearch="selResSearch" />
</div>
</template>
<script>
import DevelopmentSearch from 'components/Development/DevelopmentSearch.vue';
import DevelopmentDate from 'components/Development/DevelopmentDate.vue';
import { selResSearch } from 'config/api';
import { mapActions } from 'vuex';
export default {
name: 'InnovativeAchievements',
components: {
DevelopmentSearch,
DevelopmentDate,
},
data() {
return {
lists: [],
pagination: { current: 1, pageSize: 10 },
typeLists: [],
};
},
async created() {
await this.selModelSearch();
await this.selResSearch();
},
methods: {
...mapActions(['getSelModelSearch']),
/**
* 获取分类管理列表
* @param { Number } model 类型 0成果 1仪器 2实验室
* @param { String } name 分类名称
*/
async selModelSearch(condition) {
const params = {
param: {
pageNum: (condition && condition.current) || 1,
pageSize: (condition && condition.pageSize) || 10,
model: 0,
},
};
if (condition) {
if (condition.name) {
params.param.name = condition.name;
}
}
const data = await this.getSelModelSearch(params);
this.typeLists = data;
},
/**
* 获取成果
* @param { Array } modelIds 类型 0成果 1仪器 2实验室
* @param { String } name 分类名称
*/
async selResSearch(condition) {
try {
const params = {
param: {
pageNum: (condition && condition.current) || 1,
pageSize: (condition && condition.pageSize) || 10,
},
};
if (condition) {
if (condition.content) {
params.param.content = condition.content;
}
if (condition.modelIds) {
params.param.modelIds = condition.modelIds;
}
}
const res = await selResSearch(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>