|
@@ -14,28 +14,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="one">
|
|
|
<a-tabs v-model:activeKey="activeKey" centered @change="toChange">
|
|
|
- <a-tab-pane key="1" :tab="`成果(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="2" :tab="`需求(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="3" :tab="`项目(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="4" :tab="`赛事(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="5" :tab="`资讯(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="6" :tab="`单位(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="7" :tab="`企业(${total})`">
|
|
|
- <List></List>
|
|
|
- </a-tab-pane>
|
|
|
- <a-tab-pane key="8" :tab="`专家(${total})`">
|
|
|
+ <a-tab-pane v-for="item in actList" :key="item.value" :tab="item.label">
|
|
|
<List></List>
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
@@ -53,38 +32,39 @@ import List from './parts/list.vue'
|
|
|
import { SearchOutlined } from '@ant-design/icons-vue'
|
|
|
// 接口
|
|
|
import { AchievementStore } from '@/store/api/platform/achievement'
|
|
|
+import { ToolStore } from '@/store/api/platform/tool'
|
|
|
import { DemandStore } from '@/store/api/platform/demand'
|
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
const achieveStore = AchievementStore()
|
|
|
const demandStore = DemandStore()
|
|
|
+const toolStore = ToolStore()
|
|
|
const dictDataStore = DictDataStore()
|
|
|
// 图片引入
|
|
|
import searchOne from '@/assets/search.jpeg'
|
|
|
// 路由
|
|
|
const router = useRouter()
|
|
|
+const route = useRoute()
|
|
|
// 加载中
|
|
|
const loading = ref(false)
|
|
|
-const activeKey = ref('1')
|
|
|
-// const actList = ref([
|
|
|
-// { label: '成果', value: 'achievement' },
|
|
|
-// { label: '需求', value: 'demand' },
|
|
|
-// { label: '项目', value: 'project' },
|
|
|
-// { label: '赛事', value: 'match' },
|
|
|
-// { label: '资讯', value: 'news' },
|
|
|
-// { label: '单位', value: 'unit' },
|
|
|
-// { label: '企业', value: 'company' },
|
|
|
-// { label: '专家', value: 'expert' }
|
|
|
-// ])
|
|
|
+const activeKey = ref('achievement')
|
|
|
+const actList = ref([
|
|
|
+ { label: '成果', value: 'achievement' },
|
|
|
+ { label: '需求', value: 'demand' },
|
|
|
+ { label: '项目', value: 'project' },
|
|
|
+ { label: '赛事', value: 'match' },
|
|
|
+ { label: '资讯', value: 'news' },
|
|
|
+ { label: '单位', value: 'unit' },
|
|
|
+ { label: '企业', value: 'company' },
|
|
|
+ { label: '专家', value: 'expert' }
|
|
|
+])
|
|
|
const searchForm = ref({})
|
|
|
// 字典表
|
|
|
const fieldList = ref([])
|
|
|
-//
|
|
|
-const fields = ref([
|
|
|
- { label: '名称', model: 'name', type: 'name' },
|
|
|
- { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
- { label: '成果地区:', model: 'area', type: 'area' },
|
|
|
- { label: '单位:', model: 'user' }
|
|
|
+const typeList = ref([
|
|
|
+ { value: '0', label: '供给' },
|
|
|
+ { value: '1', label: '需求' }
|
|
|
])
|
|
|
+const fields = ref([])
|
|
|
// 列表
|
|
|
const list = ref([])
|
|
|
let skip = 0
|
|
@@ -94,10 +74,57 @@ const currentPage = ref(1)
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
|
loading.value = true
|
|
|
+ await searchField()
|
|
|
await searchOther()
|
|
|
- await search({ skip, limit })
|
|
|
+ if (route.query && route.query.type == 'collection') await searchActive()
|
|
|
+ else await search({ skip, limit })
|
|
|
loading.value = false
|
|
|
})
|
|
|
+const searchField = async () => {
|
|
|
+ if (activeKey.value == 'achievement') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '成果名称', model: 'name', type: 'name' },
|
|
|
+ { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
+ { label: '成果地区:', model: 'area', type: 'area' },
|
|
|
+ { label: '参考价格:', model: 'money' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'demand') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '需求名称', model: 'name', type: 'name' },
|
|
|
+ { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
+ { label: '类型:', model: 'type', type: 'dict' },
|
|
|
+ { label: '需求地区:', model: 'area', type: 'area' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'project') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '项目名称', model: 'name', type: 'name' },
|
|
|
+ { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
+ { label: '项目地区:', model: 'area', type: 'area' },
|
|
|
+ { label: '发布时间:', model: 'time' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'match') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '比赛名称', model: 'name', type: 'name' },
|
|
|
+ { label: '比赛金额:', model: 'money' },
|
|
|
+ { label: '比赛日期:', model: 'time', type: 'time' },
|
|
|
+ { label: '赛事状态:', model: 'match_status', type: 'dict' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'company') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '企业名称', model: 'name', type: 'name' },
|
|
|
+ { label: '法定代表人:', model: 'representative' },
|
|
|
+ { label: '企业地区:', model: 'area', type: 'area' },
|
|
|
+ { label: '成立时间:', model: 'time' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'expert') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '专家姓名', model: 'name', type: 'name' },
|
|
|
+ { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
+ { label: '所在地区:', model: 'area', type: 'area' },
|
|
|
+ { label: '研究方向:', model: 'direction' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+}
|
|
|
const search = async (query = { skip: 0, limit }) => {
|
|
|
const info = {
|
|
|
skip: query.skip,
|
|
@@ -107,8 +134,25 @@ const search = async (query = { skip: 0, limit }) => {
|
|
|
status: '1'
|
|
|
}
|
|
|
let res
|
|
|
- if (activeKey.value == '1') res = await achieveStore.query(info)
|
|
|
- else if (activeKey.value == '2') res = await demandStore.query(info)
|
|
|
+ if (activeKey.value == 'achievement') res = await achieveStore.query(info)
|
|
|
+ else if (activeKey.value == 'demand') res = await demandStore.query(info)
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ list.value = res.data
|
|
|
+ total.value = res.total
|
|
|
+ }
|
|
|
+}
|
|
|
+const searchActive = async () => {
|
|
|
+ const menu = await toolStore.getTotal()
|
|
|
+ if (menu.errcode == '0') actList.value = menu.data
|
|
|
+ await searchCollection({ skip, limit })
|
|
|
+}
|
|
|
+const searchCollection = async (query = { skip: 0, limit }) => {
|
|
|
+ const info = {
|
|
|
+ skip: query.skip,
|
|
|
+ limit: query.limit,
|
|
|
+ type: activeKey.value
|
|
|
+ }
|
|
|
+ const res = await toolStore.getCollection(info)
|
|
|
if (res.errcode == '0') {
|
|
|
list.value = res.data
|
|
|
total.value = res.total
|
|
@@ -124,6 +168,7 @@ const searchOther = async () => {
|
|
|
const getDict = (data, model) => {
|
|
|
let res
|
|
|
if (model == 'field') res = fieldList.value.find((f) => f.value == data)
|
|
|
+ if (model == 'type') res = typeList.value.find((f) => f.value == data)
|
|
|
return get(res, 'label')
|
|
|
}
|
|
|
// 地区显示
|
|
@@ -134,23 +179,32 @@ const getArea = (data) => {
|
|
|
// 查看
|
|
|
const toView = (item) => {
|
|
|
let path
|
|
|
- if (activeKey.value == '1') path = '/achievement/detail'
|
|
|
- else if (activeKey.value == '2') path = '/demand/detail'
|
|
|
+ if (activeKey.value == 'achievement') path = '/achievement/detail'
|
|
|
+ else if (activeKey.value == 'demand') path = '/demand/detail'
|
|
|
+ else if (activeKey.value == 'project') path = '/project/detail'
|
|
|
+ else if (activeKey.value == 'match') path = '/innovation/detail'
|
|
|
+ else if (activeKey.value == 'company') path = '/company/detail'
|
|
|
+ else if (activeKey.value == 'expert') path = '/expert/detail'
|
|
|
router.push({ path, query: { id: item.id || item._id } })
|
|
|
}
|
|
|
// 切换标签页
|
|
|
const toChange = (key) => {
|
|
|
activeKey.value = key
|
|
|
- search({ skip, limit })
|
|
|
+ if (route.query && route.query.type == 'collection') searchCollection({ skip, limit })
|
|
|
+ else search({ skip, limit })
|
|
|
+ searchField()
|
|
|
}
|
|
|
// 分页
|
|
|
const changePage = (page = currentPage.value) => {
|
|
|
- search({ skip: (page - 1) * limit, limit: limit })
|
|
|
+ if (route.query && route.query.type == 'collection')
|
|
|
+ searchCollection({ skip: (page - 1) * limit, limit: limit })
|
|
|
+ else search({ skip: (page - 1) * limit, limit: limit })
|
|
|
}
|
|
|
const sizeChange = (limits) => {
|
|
|
limit = limits
|
|
|
currentPage.value = 1
|
|
|
- search({ skip: 0, limit: limit })
|
|
|
+ if (route.query && route.query.type == 'collection') searchCollection({ skip, limit })
|
|
|
+ else search({ skip, limit })
|
|
|
}
|
|
|
// provide
|
|
|
provide('fields', fields)
|