Karsa 5 mesi fa
parent
commit
fa8c7a5ae2
2 ha cambiato i file con 46 aggiunte e 16 eliminazioni
  1. 16 7
      src/views/externalReport/List.vue
  2. 30 9
      src/views/externalReport/Preview.vue

+ 16 - 7
src/views/externalReport/List.vue

@@ -48,6 +48,9 @@ async function getClassify() {
 
     classifyOptions.value = res.Data||[];
     filterEmpty(classifyOptions.value)
+
+    listState.classifys = collectClassifyOpts.value.length ? collectClassifyOpts.value.map(_ => _.Id) : []
+    getList()
 }
 getClassify()
 function filterEmpty(arr) {
@@ -72,6 +75,7 @@ getPermissionList()
 const collectClassifyOpts = computed(() => {
     return isReportWarResearch.value ? findCollectItem(classifyOptions.value) : []
 })
+
 function findCollectItem(arr) {
     let collectArr = []
     function traverse(node) {
@@ -89,14 +93,13 @@ function findCollectItem(arr) {
 }
 
 
-
 const listState = reactive({
     reportType: 1,
-    classifys: collectClassifyOpts.value.map(_ => _.Id) || [],   
+    classifys: [],   
     permissions:[],
     keyWord:'',
     list:[],
-    page:0,
+    page:1,
     pageSize:20,
     finished:false,
     loading:false
@@ -146,7 +149,6 @@ function refreshList(){
 }
 function handleReportChange() {
     listState.keyWord = '';
-    listState.classifys = [];
     listState.permissions = [];
     showMoreFilter.value = false
     refreshList()
@@ -446,6 +448,7 @@ function goDetail(item){
             :offset="100"
             :finished-text="listState.list.length>0?'没有更多了':'暂无相关报告'"
             @load="onLoad"
+            :immediate-check="false"
         >   
             <img v-if="listState.list.length==0&&listState.finished" class="list-empty-img" src="https://hzstatic.hzinsights.com/static/ETA_mobile/empty_img.png" alt="">
             <ul class="list-wrap">
@@ -666,16 +669,22 @@ function goDetail(item){
 .classify-box {
     .classify-sub-list {
         .sub-item {
-            margin-left: 20px;
+            margin-left: 40px;
         }
     }
     .active {
         color: $theme-color;
         position: relative;
         &::after {
-            content: '√';
+            content: '';
+            display: block;
+            width: 36px;
+            height: 36px;
+            background-image: url('@/assets/imgs/icon_select2.png');
+            background-size: cover;
+            background-repeat: no-repeat;
             position: absolute;
-            left: -22px;
+            left: -40px;
             top: 0;
         }
     }

+ 30 - 9
src/views/externalReport/Preview.vue

@@ -36,12 +36,7 @@ async function getReportDetail(){
     if(res.Ret===200){
         reportInfo.value=res.Data
         document.title=res.Data.Title
-        attachmentsList.value = res.Data.AttachmentList 
-            ? res.Data.AttachmentList.map(item => ({
-                ...item,
-                FileSize: parseInt((item.FileSize||0)/1024)
-            }))
-            : []
+        attachmentsList.value = res.Data.AttachmentList || []
     }
 }
 getReportDetail()
@@ -83,6 +78,24 @@ function handleCopyLink() {
 }
 
 
+const configAnchors = [
+    140,
+    Math.round(0.7 * window.innerHeight),
+]
+const panelHeight = ref(configAnchors[0])
+
+
+function formatSize(size) {
+    if (size >= 1024 * 1024) { // 超过1MB
+        return (size / (1024 * 1024)).toFixed(2) + ' MB';
+    } else if (size >= 1024) { // 超过1KB
+        return (size / 1024).toFixed(2) + ' KB';
+    } else {
+        return size + ' B'; // 小于1KB
+    }
+}
+
+
 function getFileIcon(name) {
     let fileName=name.toLocaleLowerCase()
     if(fileName.endsWith('.pdf')){
@@ -109,11 +122,16 @@ function getFileIcon(name) {
         <div class="report-html-wrap" v-html="reportInfo.Abstract" v-if="reportInfo.Abstract"></div>
         <div class="report-html-wrap" v-html="reportInfo.Content" v-if="reportInfo.Content"></div>
         
-        <van-floating-panel :content-draggable="false" v-if="fileLen">
+        <van-floating-panel 
+            :content-draggable="false" 
+            v-if="fileLen" 
+            v-model:height="panelHeight" 
+            :anchors="configAnchors"
+        >
             <div class="attachments-wrapper">
                 <div>
                     <svg-icon name="link_ico" size="20px"></svg-icon>
-                    附件{{fileLen}}个({{totalSize}}KB)
+                    附件{{fileLen}}个({{formatSize(totalSize)}})
                 </div>
 
                 <ul class="list-cont">
@@ -121,7 +139,7 @@ function getFileIcon(name) {
                         <svg-icon class="file-ico" :name="getFileIcon(item.Title)"></svg-icon>
                         <div class="right-info">
                             <p class="van-ellipsis file-name">{{item.Title}}</p>
-                            <span style="color:#999">{{item.FileSize}}KB</span>
+                            <span style="color:#999">{{formatSize(item.FileSize)}}</span>
                         </div>
                     </li>
                 </ul>
@@ -135,6 +153,8 @@ function getFileIcon(name) {
         @click="handleCopyLink"
     />
 
+    <van-back-top bottom="100" right="10"/>
+
     <!-- 预览-->
     <van-popup
         v-model:show="isShowPreview"
@@ -144,6 +164,7 @@ function getFileIcon(name) {
     >
         <PreViewFile v-if="isShowPreview" :url="previewUrl"/>
     </van-popup>
+    
 </template>
 
 <style lang="scss" scoped>