数据资源左侧列表

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

View File

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

View File

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