|
@@ -7,7 +7,10 @@
|
|
|
<div class="input">
|
|
|
<a-input v-model:value="searchValue" placeholder="请输入想要搜索的内容">
|
|
|
<template #suffix>
|
|
|
- <SearchOutlined :style="{ fontSize: '30px', color: '#ffffff' }" />
|
|
|
+ <SearchOutlined
|
|
|
+ @click="toChange(activeKey)"
|
|
|
+ :style="{ fontSize: '30px', color: '#ffffff' }"
|
|
|
+ />
|
|
|
</template>
|
|
|
</a-input>
|
|
|
</div>
|
|
@@ -15,7 +18,8 @@
|
|
|
<el-col :span="24" class="one">
|
|
|
<a-tabs v-model:activeKey="activeKey" centered @change="toChange">
|
|
|
<a-tab-pane v-for="item in actList" :key="item.value" :tab="item.label">
|
|
|
- <List></List>
|
|
|
+ <News v-if="item.value == 'news'"></News>
|
|
|
+ <List v-else></List>
|
|
|
</a-tab-pane>
|
|
|
</a-tabs>
|
|
|
</el-col>
|
|
@@ -29,14 +33,11 @@
|
|
|
import { get } from 'lodash-es'
|
|
|
const $checkRes = inject('$checkRes')
|
|
|
import List from './parts/list.vue'
|
|
|
+import News from './parts/news.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()
|
|
|
// 图片引入
|
|
@@ -57,9 +58,10 @@ const actList = ref([
|
|
|
{ label: '企业', value: 'company' },
|
|
|
{ label: '专家', value: 'expert' }
|
|
|
])
|
|
|
-const searchForm = ref({})
|
|
|
+const searchValue = ref('')
|
|
|
// 字典表
|
|
|
const fieldList = ref([])
|
|
|
+const statusList = ref([])
|
|
|
const typeList = ref([
|
|
|
{ value: '0', label: '供给' },
|
|
|
{ value: '1', label: '需求' }
|
|
@@ -74,10 +76,11 @@ const currentPage = ref(1)
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
|
loading.value = true
|
|
|
+ searchValue.value = route.query.searchValue || ''
|
|
|
await searchField()
|
|
|
await searchOther()
|
|
|
if (route.query && route.query.type == 'collection') await searchActive()
|
|
|
- else await search({ skip, limit })
|
|
|
+ else await searchTotal()
|
|
|
loading.value = false
|
|
|
})
|
|
|
const searchField = async () => {
|
|
@@ -114,7 +117,7 @@ const searchField = async () => {
|
|
|
{ label: '企业名称', model: 'name', type: 'name' },
|
|
|
{ label: '法定代表人:', model: 'representative' },
|
|
|
{ label: '企业地区:', model: 'area', type: 'area' },
|
|
|
- { label: '成立时间:', model: 'time' }
|
|
|
+ { label: '成立时间:', model: 'create_time' }
|
|
|
]
|
|
|
} else if (activeKey.value == 'expert') {
|
|
|
fields.value = [
|
|
@@ -123,19 +126,41 @@ const searchField = async () => {
|
|
|
{ label: '所在地区:', model: 'area', type: 'area' },
|
|
|
{ label: '研究方向:', model: 'direction' }
|
|
|
]
|
|
|
+ } else if (activeKey.value == 'news') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '资讯标题', model: 'title', type: 'name' },
|
|
|
+ { label: '发布人:', model: 'person' },
|
|
|
+ { label: '发布时间:', model: 'time' },
|
|
|
+ { label: '浏览量:', model: 'number' }
|
|
|
+ ]
|
|
|
+ } else if (activeKey.value == 'unit') {
|
|
|
+ fields.value = [
|
|
|
+ { label: '单位名称', model: 'name', type: 'name' },
|
|
|
+ { label: '技术领域:', model: 'field', type: 'dict' },
|
|
|
+ { label: '所在地区:', model: 'area', type: 'area' },
|
|
|
+ { label: '研究方向:', model: 'direction' }
|
|
|
+ ]
|
|
|
}
|
|
|
}
|
|
|
+const searchTotal = async () => {
|
|
|
+ const menu = await toolStore.total({
|
|
|
+ ...{ searchValue: searchValue.value },
|
|
|
+ is_use: '0',
|
|
|
+ status: '1'
|
|
|
+ })
|
|
|
+ if (menu.errcode == '0') actList.value = menu.data
|
|
|
+ await search({ skip, limit })
|
|
|
+}
|
|
|
const search = async (query = { skip: 0, limit }) => {
|
|
|
const info = {
|
|
|
skip: query.skip,
|
|
|
limit: query.limit,
|
|
|
- ...searchForm.value,
|
|
|
+ type: activeKey.value,
|
|
|
+ ...{ searchValue: searchValue.value },
|
|
|
is_use: '0',
|
|
|
status: '1'
|
|
|
}
|
|
|
- let res
|
|
|
- if (activeKey.value == 'achievement') res = await achieveStore.query(info)
|
|
|
- else if (activeKey.value == 'demand') res = await demandStore.query(info)
|
|
|
+ const res = await toolStore.query(info)
|
|
|
if (res.errcode == '0') {
|
|
|
list.value = res.data
|
|
|
total.value = res.total
|
|
@@ -163,12 +188,16 @@ const searchOther = async () => {
|
|
|
// 技术领域
|
|
|
result = await dictDataStore.query({ code: 'field', is_use: '0' })
|
|
|
if ($checkRes(result)) fieldList.value = result.data
|
|
|
+ // 赛事状态
|
|
|
+ result = await dictDataStore.query({ code: 'matchStatus', is_use: '0' })
|
|
|
+ if ($checkRes(result)) statusList.value = result.data
|
|
|
}
|
|
|
// 字典数据转换
|
|
|
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)
|
|
|
+ if (model == 'match_status') res = statusList.value.find((f) => f.value == data)
|
|
|
return get(res, 'label')
|
|
|
}
|
|
|
// 地区显示
|
|
@@ -176,6 +205,10 @@ const getArea = (data) => {
|
|
|
if (data) return data.join(',')
|
|
|
else return '暂无地区'
|
|
|
}
|
|
|
+// 时间
|
|
|
+const getTime = (data) => {
|
|
|
+ if (data) return `${data[0]} 至 ${data[1]}`
|
|
|
+}
|
|
|
// 查看
|
|
|
const toView = (item) => {
|
|
|
let path
|
|
@@ -191,7 +224,7 @@ const toView = (item) => {
|
|
|
const toChange = (key) => {
|
|
|
activeKey.value = key
|
|
|
if (route.query && route.query.type == 'collection') searchCollection({ skip, limit })
|
|
|
- else search({ skip, limit })
|
|
|
+ else searchTotal()
|
|
|
searchField()
|
|
|
}
|
|
|
// 分页
|
|
@@ -206,12 +239,19 @@ const sizeChange = (limits) => {
|
|
|
if (route.query && route.query.type == 'collection') searchCollection({ skip, limit })
|
|
|
else search({ skip, limit })
|
|
|
}
|
|
|
+watch(route, (newVal) => {
|
|
|
+ if (newVal && newVal.query && newVal.query.type) {
|
|
|
+ if (newVal.query && newVal.query.type == 'collection') searchActive()
|
|
|
+ else searchTotal()
|
|
|
+ }
|
|
|
+})
|
|
|
// provide
|
|
|
provide('fields', fields)
|
|
|
provide('list', list)
|
|
|
provide('toView', toView)
|
|
|
provide('getArea', getArea)
|
|
|
provide('getDict', getDict)
|
|
|
+provide('getTime', getTime)
|
|
|
provide('limit', limit)
|
|
|
provide('total', total)
|
|
|
provide('currentPage', currentPage)
|