|
@@ -13,15 +13,31 @@
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="24" class="one">
|
|
<el-col :span="24" class="one">
|
|
- <a-tabs v-model:activeKey="activeKey" centered>
|
|
|
|
- <a-tab-pane key="1" tab="成果(0)">成果</a-tab-pane>
|
|
|
|
- <a-tab-pane key="2" tab="需求(0)">需求</a-tab-pane>
|
|
|
|
- <a-tab-pane key="3" tab="项目(0)">项目</a-tab-pane>
|
|
|
|
- <a-tab-pane key="4" tab="赛事(0)">赛事</a-tab-pane>
|
|
|
|
- <a-tab-pane key="5" tab="资讯(0)">资讯</a-tab-pane>
|
|
|
|
- <a-tab-pane key="6" tab="单位(0)">单位</a-tab-pane>
|
|
|
|
- <a-tab-pane key="7" tab="企业(0)">企业</a-tab-pane>
|
|
|
|
- <a-tab-pane key="8" tab="专家(0)">专家</a-tab-pane>
|
|
|
|
|
|
+ <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})`">
|
|
|
|
+ <List></List>
|
|
|
|
+ </a-tab-pane>
|
|
</a-tabs>
|
|
</a-tabs>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -33,34 +49,119 @@
|
|
// 基础
|
|
// 基础
|
|
import { get } from 'lodash-es'
|
|
import { get } from 'lodash-es'
|
|
const $checkRes = inject('$checkRes')
|
|
const $checkRes = inject('$checkRes')
|
|
|
|
+import List from './parts/list.vue'
|
|
import { SearchOutlined } from '@ant-design/icons-vue'
|
|
import { SearchOutlined } from '@ant-design/icons-vue'
|
|
// 接口
|
|
// 接口
|
|
|
|
+import { AchievementStore } from '@/store/api/platform/achievement'
|
|
import { DemandStore } from '@/store/api/platform/demand'
|
|
import { DemandStore } from '@/store/api/platform/demand'
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
import { DictDataStore } from '@/store/api/system/dictData'
|
|
-const store = DemandStore()
|
|
|
|
|
|
+const achieveStore = AchievementStore()
|
|
|
|
+const demandStore = DemandStore()
|
|
const dictDataStore = DictDataStore()
|
|
const dictDataStore = DictDataStore()
|
|
// 图片引入
|
|
// 图片引入
|
|
import searchOne from '@/assets/search.jpeg'
|
|
import searchOne from '@/assets/search.jpeg'
|
|
// 路由
|
|
// 路由
|
|
-const route = useRoute()
|
|
|
|
|
|
+const router = useRouter()
|
|
// 加载中
|
|
// 加载中
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
const activeKey = ref('1')
|
|
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 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 list = ref([])
|
|
|
|
+let skip = 0
|
|
|
|
+let limit = inject('limit')
|
|
|
|
+const total = ref(0)
|
|
|
|
+const currentPage = ref(1)
|
|
// 请求
|
|
// 请求
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
loading.value = true
|
|
loading.value = true
|
|
await searchOther()
|
|
await searchOther()
|
|
- await search()
|
|
|
|
|
|
+ await search({ skip, limit })
|
|
loading.value = false
|
|
loading.value = false
|
|
})
|
|
})
|
|
-const search = async () => {
|
|
|
|
- let id = route.query.id
|
|
|
|
- if (id) {
|
|
|
|
- // let res = await store.fetch(id)
|
|
|
|
- // if (res.errcode == '0') info.value = res.data
|
|
|
|
|
|
+const search = async (query = { skip: 0, limit }) => {
|
|
|
|
+ const info = {
|
|
|
|
+ skip: query.skip,
|
|
|
|
+ limit: query.limit,
|
|
|
|
+ ...searchForm.value,
|
|
|
|
+ is_use: '0',
|
|
|
|
+ status: '1'
|
|
}
|
|
}
|
|
|
|
+ let res
|
|
|
|
+ if (activeKey.value == '1') res = await achieveStore.query(info)
|
|
|
|
+ else if (activeKey.value == '2') res = await demandStore.query(info)
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ list.value = res.data
|
|
|
|
+ total.value = res.total
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+const searchOther = async () => {
|
|
|
|
+ let result
|
|
|
|
+ // 技术领域
|
|
|
|
+ result = await dictDataStore.query({ code: 'field', is_use: '0' })
|
|
|
|
+ if ($checkRes(result)) fieldList.value = result.data
|
|
|
|
+}
|
|
|
|
+// 字典数据转换
|
|
|
|
+const getDict = (data, model) => {
|
|
|
|
+ let res
|
|
|
|
+ if (model == 'field') res = fieldList.value.find((f) => f.value == data)
|
|
|
|
+ return get(res, 'label')
|
|
|
|
+}
|
|
|
|
+// 地区显示
|
|
|
|
+const getArea = (data) => {
|
|
|
|
+ if (data) return data.join(',')
|
|
|
|
+}
|
|
|
|
+// 查看
|
|
|
|
+const toView = (item) => {
|
|
|
|
+ let path
|
|
|
|
+ if (activeKey.value == '1') path = '/achievement/detail'
|
|
|
|
+ else if (activeKey.value == '2') path = '/demand/detail'
|
|
|
|
+ router.push({ path, query: { id: item.id || item._id } })
|
|
|
|
+}
|
|
|
|
+// 切换标签页
|
|
|
|
+const toChange = (key) => {
|
|
|
|
+ activeKey.value = key
|
|
|
|
+ search({ skip, limit })
|
|
|
|
+}
|
|
|
|
+// 分页
|
|
|
|
+const changePage = (page = currentPage.value) => {
|
|
|
|
+ search({ skip: (page - 1) * limit, limit: limit })
|
|
|
|
+}
|
|
|
|
+const sizeChange = (limits) => {
|
|
|
|
+ limit = limits
|
|
|
|
+ currentPage.value = 1
|
|
|
|
+ search({ skip: 0, limit: limit })
|
|
}
|
|
}
|
|
-const searchOther = async () => {}
|
|
|
|
|
|
+// provide
|
|
|
|
+provide('fields', fields)
|
|
|
|
+provide('list', list)
|
|
|
|
+provide('toView', toView)
|
|
|
|
+provide('getArea', getArea)
|
|
|
|
+provide('getDict', getDict)
|
|
|
|
+provide('limit', limit)
|
|
|
|
+provide('total', total)
|
|
|
|
+provide('currentPage', currentPage)
|
|
|
|
+provide('sizeChange', sizeChange)
|
|
|
|
+provide('changePage', changePage)
|
|
</script>
|
|
</script>
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
.main {
|
|
.main {
|