jwyu před 1 rokem
rodič
revize
3d3b3c16f6

+ 57 - 0
src/api/report.js

@@ -10,8 +10,65 @@ export default {
      * @param ClassifyNameSecond
      * @param KeyWord
      * @param MsgIsSend
+     * @param State
+     * @param StartDate
+     * @param EndDate
      */
     getList:params=>{
         return get('/report/list',params)
+    },
+    /**
+     * 获取报告分类
+     * @param CurrentIndex
+     * @param PageSize
+     * @param KeyWord
+     */
+    getClassifyList:params=>{
+        return get('/classify/list',params)
+    },
+    /**
+     * 删除报告
+     * @param ReportIds
+     */
+    reportDel:params=>{
+        return post('/report/delete',params)
+    },
+    /**
+     * 周报校验音频
+     * @param ReportId
+     */
+    weekReportValidAudio:params=>{
+        return get('/report/CheckDayWeekReportChapterVideo',params)
+    },
+    /**
+     * 发布报告
+     * @param ReportIds 用,隔开
+     */
+    reportPublish:params=>{
+        return post('/report/publish',params)
+    },
+    /**
+     * 报告取消发布
+     * @param ReportIds
+     * @returns 
+     */
+    reportPublishCancle:params=>{
+        return post('/report/publish/cancle',params)
+    },
+    /**
+     * 同时推送客群和模板消息
+     * @param ReportId
+     * @returns 
+     */
+    reportMessageSend:params=>{
+        return post('/report/sendMsg',params)
+    },
+    /**
+     * 报告详情
+     * @param ReportId
+     */
+    getReportDetail:params=>{
+        return get('/report/detail',params)
     }
+
 }

+ 30 - 0
src/router/report.js

@@ -15,5 +15,35 @@
             hasBackHome:true,
             keepAlive:false
         },
+    },
+    {
+        path:"/report/detail",
+        name:"ReportDetail",
+        component: () => import("@/views/report/Detail.vue"),
+        meta: { 
+            title: "中文研报",
+            hasBackHome:true,
+            keepAlive:false
+        },
+    },
+    {
+        path:"/report/chapter/list",
+        name:"ReportChapterList",
+        component: () => import("@/views/report/chapter/List.vue"),
+        meta: { 
+            title: "中文研报",
+            hasBackHome:true,
+            keepAlive:false
+        },
+    },
+    {
+        path:"/report/chapter/detail",
+        name:"ReportChapterDetail",
+        component: () => import("@/views/report/chapter/Detail.vue"),
+        meta: { 
+            title: "中文研报",
+            hasBackHome:true,
+            keepAlive:false
+        },
     }
 ]

+ 33 - 0
src/views/report/Detail.vue

@@ -0,0 +1,33 @@
+<script setup name="reportDetail">
+import {ref} from 'vue'
+import { useRoute } from "vue-router";
+import apiReport from '@/api/report'
+
+const route=useRoute()
+
+// 获取报告详情
+let reportInfo=ref(null)
+async function getReportDetail(){
+    const res=await apiReport.getReportDetail({ReportId:Number(route.query.id)})
+    if(res.Ret===200){
+        reportInfo.value=res.Data
+        document.title=res.Data.Title
+    }
+}
+getReportDetail()
+
+</script>
+
+<template>
+    <div class="report-detail-page" v-if="reportInfo">
+        <span>第{{reportInfo.Stage}}期/{{reportInfo.Frequency}}</span>
+        <div>{{reportInfo.Title}}</div>
+        <div><span>{{reportInfo.Author}}</span><span>{{reportInfo.PublishTime}}</span></div>
+        <div>{{reportInfo.Abstract}}</div>
+        <div v-html="reportInfo.Content"></div>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+
+</style>

+ 278 - 13
src/views/report/List.vue

@@ -1,9 +1,56 @@
 <script setup name="ReportList">
-import {reactive} from 'vue'
+import {reactive,ref} from 'vue'
 import apiReport from '@/api/report'
+import moment from 'moment'
+import ListClassify from './components/ListClassify.vue'
+import { showToast,showDialog,Dialog } from 'vant';
+import { useRouter } from 'vue-router';
+
+const router=useRouter()
+
+// 分类弹窗
+const showClassify=ref(false)
+// 更多操作
+const showMoreFilter=ref(false)
+const frequencyOpt=[
+    {
+        label:'年度',
+        value:'年度'
+    },
+    {
+        label:'半年度',
+        value:'半年度'
+    },
+    {
+        label:'季度',
+        value:'季度'
+    },
+    {
+        label:'月度',
+        value:'月度'
+    },
+    {
+        label:'双周度',
+        value:'双周度'
+    },
+    {
+        label:'周度',
+        value:'周度'
+    },
+    {
+        label:'日度',
+        value:'日度'
+    },
+    {
+        label:'不定时',
+        value:'不定时'
+    },
+]//频度筛选项
 
 
 const listState = reactive({
+    StartDate:'',
+    EndDate:'',
     list:[],
     page:0,
     pageSize:20,
@@ -14,6 +61,8 @@ async function getList(){
     const res=await apiReport.getList({
         CurrentIndex:listState.page,
         PageSize:listState.pageSize,
+        StartDate:listState.StartDate,
+        EndDate:listState.EndDate
     })
     if(res.Ret===200){
         listState.loading=false
@@ -29,40 +78,252 @@ async function getList(){
 }
 function onLoad(){
     listState.page++
-    // getList()
+    getList()
+}
+
+function refreshList(){
+    listState.page=1
+    listState.list=[]
+    listState.finished=false
+    getList()
+}
+
+
+// 删除报告
+function handleReportDel(item){
+    showDialog({
+        title: '提示',
+        message: '确认删除吗?',
+        showCancelButton:true
+    }).then(() => {
+        // on close
+        apiReport.reportDel({ReportIds:item.Id}).then(res=>{
+            if(res.Ret===200){
+                showToast('删除成功')
+                refreshList()
+            }
+        })
+    }).catch(()=>{})
+}
+
+// 发布报告
+let activeReportId=ref('')
+let showPublishPop=ref(false)
+async function handleReportPublish(item){
+    activeReportId.value=item.Id.toString()
+
+    // 周报校验是否上传了音频
+    if(item.ClassifyNameFirst=='周报'){
+        const validRes=await apiReport.weekReportValidAudio({ReportId:Number(item.Id)})
+        if(validRes.Ret===200){
+			if(validRes.Data){
+                showDialog({
+                    title: '发布提示',
+                    message: `报告未上传录音:${validRes.Data.join('、')},确定发布吗?`,
+                    showCancelButton:true
+                }).then(()=>{
+                    showPublishPop.value=true
+                })
+            }else{
+                showPublishPop.value=true
+            }
+        }
+        return
+    }
+
+    showPublishPop.value=true
+}
+// 确认发布报告
+// type 1 仅发布 2发布且推送
+function handleConfirmPublish(type){
+    apiReport.reportPublish({
+        ReportIds:activeReportId.value
+    }).then(res=>{
+        if(res.Ret==200){
+            if(type===2){
+                handleReportMessageSend(true)
+            }else{
+                if(res.Data){
+                    showDialog({
+                        title: '发布提示',
+                        message: res.Data,
+                    }).then(()=>{
+
+                    })
+                }else{
+                    showToast('发布成功')
+                }
+                activeReportId.value=0
+                refreshList()
+                showPublishPop.value=false
+            }
+        }
+    })
+}
+
+// 推送消息
+function handleReportMessageSend(publish){
+    apiReport.reportMessageSend({
+        ReportId:Number(activeReportId.value)
+    }).then(res=>{
+        if(res.Ret===200){
+            if(publish){
+                showToast('发布且推送成功')
+            }else{
+                showToast('推送成功')
+            }
+            activeReportId.value=0
+            refreshList()
+            showPublishPop.value=false
+        }
+    })
+}
+
+// 日期筛选
+const calendarMinDate=new Date(2010,0,1)
+const showCalendar=ref(false)
+function handleCalendarChange(e){
+    listState.StartDate=moment(e[0]).format('YYYY-MM-DD')
+    listState.EndDate=moment(e[1]).format('YYYY-MM-DD')
+    refreshList()
+    showCalendar.value=false
+}
+
+// 跳转详情
+function goDetail(item){
+    let routerEl
+
+    if(['day','week'].includes(item.ChapterType)){
+        routerEl=router.resolve({
+            path:"/report/chapter/list",
+            query:{
+                id:item.Id
+            }
+        })
+    }else{
+        routerEl=router.resolve({
+            path:"/report/detail",
+            query:{
+                id:item.Id
+            }
+        })
+    }
+
+    
+    window.open(routerEl.href,'_blank')
 }
+
 </script>
 
 <template>
     <div class="report-list-page">
         <div class="sticky-box">
             <div class="top-box">
-                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="">
+                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="" @click="showClassify=true">
                 <van-search
                     style="flex:1"
                     shape="round" 
                     readonly 
-                    placeholder="请输入图表名称"
+                    placeholder="请输入报告标题或作者"
                 />
-                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="">
-                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="">
+                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="" @click="showCalendar=true">
+                <img class="menu-icon" src="@/assets/imgs/myETA/icon_menu.png" alt="" @click="showMoreFilter=true">
             </div>
-            
-
         </div>
         <van-list
             v-model:loading="listState.loading"
             :finished="listState.finished"
-            :finished-text="listState.list.length>0?'没有更多了':'暂无图表'"
+            :finished-text="listState.list.length>0?'没有更多了':'暂无相关报告'"
             @load="onLoad"
-        >
+        >   
+            <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">
-                <li class="item" v-for="item in listState.list" :key="item.Id">
-                
+                <van-swipe-cell v-for="item in listState.list" :key="item.Id">
+                <li class="item" @click="goDetail(item)">
+                    <h2 class="van-ellipsis title">{{item.Title}}</h2>
+                    <p class="van-multi-ellipsis--l2 des">{{item.Abstract}}</p>
+                    <div class="bot-info">
+                        <div>
+                            <span>{{moment(item.ModifyTime).format('YYYY-MM-DD HH:mm')}}</span>
+                            <span>{{item.AdminRealName}}</span>
+                        </div>
+                        <div>
+                            <span v-if="item.State===1">未发布</span>
+                            <span v-if="item.State===2">已发布</span>
+                        </div>
+                    </div>
                 </li>
+                <template #right>
+                    <template v-if="item.State==1">
+                        <van-button square type="danger" text="删除" @click.stop="handleReportDel(item)" />
+                        <van-button square type="primary" text="发布" @click.stop="handleReportPublish(item)" />
+                    </template>
+                    <template v-if="item.State==2">
+                        <van-button square type="primary" text="取消发布" />
+                    </template>
+                </template>
+                </van-swipe-cell>
             </ul>
         </van-list>
     </div>
+    <!-- 回到顶部 -->
+    <van-back-top />
+    <!-- 分类弹窗 -->
+    <van-popup 
+        v-model:show="showClassify"
+        position="left"
+        closeable
+        style="height:100%"
+    >
+        <ListClassify/>
+    </van-popup>
+    <!-- 报告发布弹窗 -->
+    <van-popup 
+        v-model:show="showPublishPop"
+        position="center"
+        round
+    >
+        <div class="publish-report-pop-box">
+            <div>发布提示</div>
+            <p>是否发布报告,且推送模板消息和客户群?</p>
+            <div>
+                <van-button square type="primary" text="取消发布" @click="showPublishPop=false;activeReportId=0"/>
+                <van-button square type="primary" text="仅发布" @click="handleConfirmPublish(1)"/>
+                <van-button square type="primary" text="发布&推送" @click="handleConfirmPublish(2)"/>
+            </div>
+        </div>
+    </van-popup>
+
+    <!-- 日期筛选 -->
+    <van-calendar 
+        v-model:show="showCalendar" 
+        type="range"
+        allow-same-day
+        :min-date="calendarMinDate"
+        @confirm="handleCalendarChange" 
+    />
+
+    <!-- 更多操作 -->
+    <van-popup 
+        v-model:show="showMoreFilter"
+        position="bottom"
+        round
+        closeable
+    >
+        <div class="more-filter-wrap">
+            <div class="lable-text">更多设置</div>
+            <div>
+                <div>选择频度</div>
+                <ul>
+                    <li v-for="item in frequencyOpt" :key="item.value">{{item.label}}</li>
+                </ul>
+            </div>
+            <div>
+                <div>报告状态</div>
+
+            </div>
+        </div>
+    </van-popup>
 </template>
 
 <style lang="scss" scoped>
@@ -83,7 +344,11 @@ function onLoad(){
 .list-wrap{
     .item{
         padding: 20px;
-
+        margin-bottom: 20px;
+        .bot-info{
+            display: flex;
+            justify-content: space-between;
+        }
     }
 }
 </style>

+ 13 - 0
src/views/report/chapter/List.vue

@@ -0,0 +1,13 @@
+<script setup name="reportChapterList">
+
+</script>
+
+<template>
+    <div class="report-chapterlist-page">
+        
+    </div>
+</template>
+
+<style lang="scss" scoped>
+
+</style>

+ 52 - 0
src/views/report/components/ListClassify.vue

@@ -0,0 +1,52 @@
+<script setup>
+import {ref} from 'vue'
+import apiReport from '@/api/report'
+
+const list=ref([])
+function getClassifyList(){
+    apiReport.getClassifyList({
+        CurrentIndex:1,
+        PageSize:1000,
+        KeyWord:''
+    }).then(res=>{
+        if(res.Ret===200){
+            list.value=res.Data.List||[]
+        }
+    })
+}
+getClassifyList()
+
+const activeNames=ref([])
+
+</script>
+
+<template>
+    <div class="report-list-classify-wrap">
+        <div>所有分类</div>
+        <div class="list-box">
+            <van-collapse v-model="activeNames">
+                <van-collapse-item 
+                    :title="item.ClassifyName" 
+                    :name="item.Id" 
+                    v-for="item in list" 
+                    :key="item.Id"
+                >
+                    <div 
+                        class="child-item" 
+                        v-for="child in item.Child" 
+                        :key="child.Id"
+                        @click="classifyChange(item.ClassifyName,child.ClassifyName)"
+                    >{{child.ClassifyName}}</div>
+                </van-collapse-item>
+            </van-collapse>
+        </div>
+    </div>
+</template>
+
+<style lang="scss" scoped>
+.report-list-classify-wrap{
+    width: 600px;
+    height: 100%;
+    padding-top: 40px;
+}
+</style>