数据资源左侧列表

This commit is contained in:
a0049873 2022-12-06 17:48:58 +08:00
parent 7a096d5dc1
commit 1eb4e4f46e
3 changed files with 99 additions and 71 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.wuhongjian
* @Date: 2022-04-01 19:19:40
* @LastEditors: Light
* @LastEditTime: 2022-12-01 17:53:16
* @LastEditTime: 2022-12-06 11:43:03
* @Description: 告诉大家这是什么
*/
import request from '@/utils/request'
@ -302,7 +302,7 @@ export function workdynamicsDetails(params) {
params,
})
}
//
//
export function selectDeptList(data) {
return request({
url: '/resource/selectDeptList',
@ -310,7 +310,15 @@ export function selectDeptList(data) {
data,
})
}
//
//
export function getDataResourceDeptList(data) {
return request({
url: '/resource/getDataResourceDeptList',
method: 'post',
data,
})
}
export function updateRes(data) {
return request({
url: '/resource/update',

View File

@ -2,10 +2,17 @@
<!-- 青岛 -->
<div class="details-pageconetent" v-if="whoShow1 && whoShow1.itShowQingDao">
<home-header></home-header>
<div class="details-pageconetent-left" v-if="Cardsname != '基础设施'">
<div
class="details-pageconetent-left"
v-if="
Cardsname === '应用资源' ||
Cardsname === '组件服务' ||
Cardsname === '数据资源'
"
>
<detailsPageconetentTree />
</div>
<div class="details-pageconetent-left" v-else>
<div class="details-pageconetent-left" v-else-if="Cardsname === '基础设施'">
<detailsPageInfrastructureTree v-if="flag == '1'" />
</div>
<div class="top" v-if="Cardsname != '知识库' && Cardsname != '基础设施'">

View File

@ -113,7 +113,7 @@
<script>
import { defineComponent, ref, watch } from 'vue'
import { selectDeptList } from '@/api/home.js'
import { selectDeptList, getDataResourceDeptList } from '@/api/home.js'
import mybus from '@/myplugins/mybus'
import { useRouter } from 'vue-router'
import { UpOutlined, DownOutlined } from '@ant-design/icons-vue'
@ -128,65 +128,45 @@
title: 'name',
}
const store = useStore()
//
const user = ref({
deptName: store.getters['user/deptName'],
deptId: store.getters['user/deptId'],
})
//
const user = ref({
deptName: store.getters['user/deptName'],
deptId: store.getters['user/deptId'],
})
const showKey = ref(0)
const treeData = ref([])
const init = () => {
treeData.value = []
console.log(
'router.currentRoute.value.query.select',
router.currentRoute.value.query.select
)
let select = router.currentRoute.value.query.select
if (select === '123') {
select = ''
}
console.log(
'获取url中的select=====================>',
router.currentRoute.value.query.select
)
if (
select !== '基础设施' &&
select !== '数据资源' &&
select !== '知识库'
) {
selectDeptList({ type: select }).then((res) => {
// console.log('=========================>', res.data.data)
res.data.data.forEach((val) => {
if (val.type !== '全部能力目录') {
let obj = {
title: val.type,
total: val.total,
show: val.type === '市级' ? true : false,
select: false,
key: val.type,
children: [],
}
switch (val.type) {
case '市级':
case '企业':
case '其他':
generateChildren(val, obj)
break
case '区级':
generateChildren2(val, obj)
break
}
treeData.value.push(obj)
}
})
//
const sortArr = ['全部能力目录', '市级', '区级', '企业', '其他']
treeData.value.sort((a, b) => {
return sortArr.indexOf(a.key) - sortArr.indexOf(b.key)
})
//
// let deptId=user.value.deptId
//
const processingData = (res) => {
res.data.data.forEach((val) => {
if (val.type !== '全部能力目录') {
let obj = {
title: val.type,
total: val.total,
show: val.type === '市级' ? true : false,
select: false,
key: val.type,
children: [],
}
switch (val.type) {
case '市级':
case '企业':
case '其他':
generateChildren(val, obj)
break
case '区级':
generateChildren2(val, obj)
break
}
treeData.value.push(obj)
}
})
//
const sortArr = ['全部能力目录', '市级', '区级', '企业', '其他']
treeData.value.sort((a, b) => {
return sortArr.indexOf(a.key) - sortArr.indexOf(b.key)
})
//
// let deptId=user.value.deptId
// treeData.value.forEach((child) => {
// let childern=child.children
// childern.forEach((childs) => {//
@ -209,11 +189,46 @@
// })
// }
// })
// })
console.log('左侧树结构数据======================>', treeData.value)
showKey.value++
console.log('左侧树结构数据======================>', treeData.value)
showKey.value++
}
const init = () => {
treeData.value = []
console.log(
'router.currentRoute.value.query.select',
router.currentRoute.value.query.select
)
let select = router.currentRoute.value.query.select
if (select === '123') {
select = ''
}
console.log(
'获取url中的select=====================>',
router.currentRoute.value.query.select
)
if (
select !== '基础设施' &&
select !== '数据资源' &&
select !== '知识库'
) {
selectDeptList({ type: select }).then((res) => {
// console.log('=========================>', res.data.data)
if (res.data.msg !== 'success') {
return
}
processingData(res)
})
} else if (select === '数据资源') {
getDataResourceDeptList({ type: select }).then((res) => {
// console.log('=========================>', res.data.data)
if (res.data.msg !== 'success') {
return
}
processingData(res)
})
}
}
@ -222,7 +237,6 @@
})
// children
const generateChildren = (val, obj) => {
if (val.dataList.length > 0) {
val.dataList.forEach((child) => {
let children = {
@ -232,14 +246,13 @@
total: child.deptCount,
key: child.deptId,
}
obj.children.push(children)
})
}
}
//
const generateChildren2 = (val, obj) => {
if (val.dataList.length > 0) {
val.dataList.forEach((dis) => {
let children = {
@ -259,7 +272,7 @@
select: false,
key: child.deptId,
}
children.children.push(children2)
})
}