|
@@ -1,51 +1,54 @@
|
|
|
<script setup>
|
|
|
//ETA图库页面
|
|
|
import {ref,reactive} from 'vue'
|
|
|
+import CatalogTree from './components/CatalogTree.vue';
|
|
|
import apiChart from '@/api/chart'
|
|
|
|
|
|
-
|
|
|
-const goMobileSearch = ()=>{
|
|
|
+import {useCatalogList} from './hooks/useCatalogList'
|
|
|
+const {
|
|
|
+ catalogNodes,//目录列表
|
|
|
+ getCatalogList,//获取图库目录
|
|
|
+} = useCatalogList()
|
|
|
+//跳转至搜索页
|
|
|
+const goSearch = ()=>{
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-const goDetail = ()=>{}
|
|
|
+//跳转至图表详情页
|
|
|
+const goChartDetail = ()=>{}
|
|
|
|
|
|
|
|
|
-//目录列表
|
|
|
-const catalogNodes = ref([])
|
|
|
//是否展示目录列表
|
|
|
const IsShowCatalog = ref(false)
|
|
|
-//展开的目录
|
|
|
-const activeCatalogs = ref([])
|
|
|
-//获取图库目录
|
|
|
-async function getCatalogList(){
|
|
|
- const res = await apiChart.ETAChartClassifyList()
|
|
|
- if(res.Ret!==200) return
|
|
|
- catalogNodes.value = res.Data?res.Data.AllNodes:[]||[]
|
|
|
-}
|
|
|
+
|
|
|
//展示目录列表
|
|
|
function showCatalog(){
|
|
|
IsShowCatalog.value = true
|
|
|
}
|
|
|
-//展示目录操作栏,pad模式是 phone模式是popup
|
|
|
-function handleShowFileOpt(){}
|
|
|
-//子目录被点击
|
|
|
-function handleCatalogItemClick(item){
|
|
|
+//激活的目录路径
|
|
|
+const catalogMenu = ref('')
|
|
|
+//目录被点击 type:['node'一级目录,'item'二级目录]
|
|
|
+function catalogItemClick({item,type='node',parent}){
|
|
|
+ catalogMenu.value = type==='node'?item.ChartClassifyName||'':parent.ChartClassifyName+'/'+item.ChartClassifyName
|
|
|
listState.cid = item.ChartClassifyId
|
|
|
listState.list=[]
|
|
|
listState.page=1
|
|
|
getChartList()
|
|
|
}
|
|
|
+//目录操作栏被点击
|
|
|
+function showFileOptClick(node){
|
|
|
+ console.log('a,node:',node)
|
|
|
+}
|
|
|
//图表列表
|
|
|
const listState = reactive({
|
|
|
- cid:152,
|
|
|
+ cid:0,
|
|
|
list:[],
|
|
|
page:1,
|
|
|
pageSize:15,
|
|
|
finished:false,
|
|
|
loading:false,
|
|
|
total:0,
|
|
|
+ IsShowMe:false
|
|
|
})
|
|
|
//获取图表列表
|
|
|
async function getChartList(){
|
|
@@ -60,12 +63,13 @@ async function getChartList(){
|
|
|
const arr = res.Data?res.Data.List:[]
|
|
|
listState.list = [...listState.list,...arr]
|
|
|
listState.total = res.Data?res.Data.Paging.Totals:0
|
|
|
- listState.finished = res.Data?res.Data.Paging.IsEnd:0
|
|
|
+ listState.finished = res.Data?res.Data.Paging.IsEnd:true
|
|
|
listState.loading=false
|
|
|
}
|
|
|
|
|
|
//下拉加载
|
|
|
function onLoad(){
|
|
|
+ if(IsShowCatalog.value) return
|
|
|
listState.page++
|
|
|
getChartList()
|
|
|
}
|
|
@@ -83,14 +87,16 @@ getChartList()
|
|
|
readonly
|
|
|
placeholder="请输入图表名称"
|
|
|
style="flex:1"
|
|
|
- @click-input="goMobileSearch"
|
|
|
+ @click-input="goSearch"
|
|
|
/>
|
|
|
<div class="lang-icon icon">en</div>
|
|
|
<div class="list-icon icon" @click="showCatalog">list</div>
|
|
|
</div>
|
|
|
<div class="select-box">
|
|
|
- <p>共{{listState.total}}张图表</p>
|
|
|
- <span>只看我的</span>
|
|
|
+ <p>
|
|
|
+ <span style="margin-right: 5px;font-weight: bold;">{{ catalogMenu }}</span>
|
|
|
+ 共{{listState.total}}张图表</p>
|
|
|
+ <span> <van-checkbox v-model="listState.IsShowMe" shape="square">只看我的</van-checkbox></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="chart-list-wrap">
|
|
@@ -107,7 +113,7 @@ getChartList()
|
|
|
class="chart-list-item"
|
|
|
v-for="item in listState.list"
|
|
|
:key="item.ChartInfoId"
|
|
|
- @click="goDetail(item)"
|
|
|
+ @click="goChartDetail(item)"
|
|
|
>
|
|
|
<div class="title">{{item.ChartName}}</div>
|
|
|
<img class="img" :src="item.ChartImage" alt="">
|
|
@@ -127,35 +133,11 @@ getChartList()
|
|
|
<span class="close-icon">X</span>
|
|
|
</div>
|
|
|
<div class="list-box">
|
|
|
- <van-collapse v-model="activeCatalogs" :border="false">
|
|
|
- <van-collapse-item
|
|
|
- v-for="node in catalogNodes"
|
|
|
- :key="node.UniqueCode"
|
|
|
- :name="node.UniqueCode"
|
|
|
- :is-link="false"
|
|
|
- >
|
|
|
- <template #title>
|
|
|
- <div class="list-title">
|
|
|
- <img src="@/assets/imgs/ppt/ppt_icon_file.png" alt="">
|
|
|
- <span class="van-ellipsis">{{node.ChartClassifyName}}</span>
|
|
|
- <div @click.stop="handleShowFileOpt(node)" class="menu-icon">
|
|
|
- <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <div
|
|
|
- class="list-item"
|
|
|
- v-for="item in node.Children"
|
|
|
- :key="item.UniqueCode"
|
|
|
- @click.stop="handleCatalogItemClick(item)"
|
|
|
- >
|
|
|
- <span class="van-ellipsis text">{{ item.ChartClassifyName }}</span>
|
|
|
- <div @click.stop="handleShowFileOpt(item)" class="menu-icon">
|
|
|
- <img class="icon" src="@/assets/imgs/ppt/ppt_icon_menu.png" alt="">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </van-collapse-item>
|
|
|
- </van-collapse>
|
|
|
+ <CatalogTree
|
|
|
+ :catalog-nodes="catalogNodes"
|
|
|
+ :showFileOptClick="showFileOptClick"
|
|
|
+ @handleCatalogItemClick="catalogItemClick"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="bottom">
|
|
|
<span>添加图表分类</span>
|
|
@@ -166,15 +148,12 @@ getChartList()
|
|
|
</template>
|
|
|
<style lang="scss">
|
|
|
.chart-eta-list-wrap{
|
|
|
- .van-cell__title{
|
|
|
- overflow: hidden;
|
|
|
- }
|
|
|
.catalog-list-wrap{
|
|
|
width: 65%;
|
|
|
}
|
|
|
@media screen and (min-width:$media-width){
|
|
|
.catalog-list-wrap{
|
|
|
- width: auto;
|
|
|
+ width: 20%;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -244,34 +223,6 @@ getChartList()
|
|
|
padding: 0 15px;
|
|
|
align-items: center;
|
|
|
}
|
|
|
- .list-box{
|
|
|
- padding:15px;
|
|
|
- .list-title,.list-item{
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- span{
|
|
|
- flex: 1;
|
|
|
- text-align: center;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 0 15px;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- img{
|
|
|
- display: block;
|
|
|
- width: 48px;
|
|
|
- height: auto;
|
|
|
- }
|
|
|
- .menu-icon{
|
|
|
- width: 30px;
|
|
|
- text-align: center;
|
|
|
- .icon{
|
|
|
- width: 6px;
|
|
|
- margin-right: 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@media screen and (min-width:$media-width){
|
|
@@ -304,20 +255,6 @@ getChartList()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .catalog-list{
|
|
|
- .list-box{
|
|
|
- padding:15px;
|
|
|
- .list-title{
|
|
|
- display: flex;
|
|
|
- }
|
|
|
- img{
|
|
|
- width: 32px;
|
|
|
- &.icon{
|
|
|
- width:15px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</style>
|