Эх сурвалжийг харах

Merge branch 'master' of http://8.136.199.33:3000/eta_front/eta_mobile_front

jwyu 1 жил өмнө
parent
commit
5e76204daa

+ 12 - 0
src/api/common.js

@@ -65,4 +65,16 @@ export function apiGetAuthBtnList(){
  */
 export function apiGetPublicSetting(){
     return get('/system/config',{})
+}
+
+/**
+ * 校验研报分类是否有审批流
+ * @param {Object} params 
+ * @param {Number} params.ReportType 报告类型:1-中文研报;2-英文研报;3-智能研报
+ * @param {Number} params.ClassifyFirstId 倒数第二级分类的id
+ * @param {Number} params.ClassifySecondId 倒数第一级分类的id
+ * @returns 
+ */
+export function apiCheckClassify(params){
+    return post('/report_approve/classify/check_open',params)
 }

+ 20 - 1
src/api/report.js

@@ -211,5 +211,24 @@ export default {
      */
     reportPublishTimeSet(params){
         return post('/report/pre_publish',params)
-    }
+    },
+
+    /**
+     * 中文研报提交审批
+     * @param {Object} params 
+     * @param {Number} params.ReportId
+     * @returns 
+     */
+    reportCnSubmit(params){
+        return post("/report/approve/submit",params)
+    },
+    /**
+     * 中文研报撤销审批
+     * @param {Object} params 
+     * @param {Number} params.ReportId
+     * @returns 
+     */
+    reportCnCancel(params){
+        return post("/report/approve/cancel",params)
+    },
 }

+ 18 - 0
src/api/reportEn.js

@@ -161,4 +161,22 @@ export default {
     getCustomListEn: params => {
         return get('/english_report/company/list',params)
     },
+    /**
+     * 英文研报提交审批
+     * @param {Object} params 
+     * @param {Number} params.ReportId
+     * @returns 
+     */
+    reportEnSubmit(params){
+        return post("/english_report/approve/submit",params)
+    },
+    /**
+     * 英文研报撤销审批
+     * @param {Object} params 
+     * @param {Number} params.ReportId
+     * @returns 
+     */
+    reportEnCancel(params){
+        return post("/english_report/approve/cancel",params)
+    },
 }

+ 37 - 0
src/hooks/useReportApprove.js

@@ -0,0 +1,37 @@
+import { useConfigSettingStore } from '@/store/modules/etaConfig'
+import {apiCheckClassify} from '@/api/common'
+import { storeToRefs } from 'pinia'
+import {ref} from 'vue'
+export function useReportApprove(){
+    let isApprove = ref(false)
+    let isOtherApprove = ref(false)
+    let hasApproveFlow = ref(false)
+    const configSettingStore = useConfigSettingStore()
+    const { etaConfigInfo } = storeToRefs(configSettingStore)
+    //获取基本配置,判断是否走审批流
+    const getEtaConfig = async()=>{
+        await configSettingStore.getBaseConfigSetting()
+        const {IsReportApprove='',ReportApproveType=''} = etaConfigInfo.value
+        isApprove.value = IsReportApprove==='true'?true:false
+        isOtherApprove.value = isApprove.value&&ReportApproveType==='other' 
+    }
+    //检查分类是否存在审批流
+    const checkClassifyNameArr = (type=1,classify=[])=>{
+        let params = {
+            ReportType:type,
+            ClassifyFirstId:classify[classify.length-2]||0,
+            ClassifySecondId:classify[classify.length-1]||0,
+        }
+        apiCheckClassify(params).then(res=>{
+            if(res.Ret!==200) return 
+            hasApproveFlow.value = res.Data||false
+        })
+    }
+    return {
+        isApprove,
+        isOtherApprove,
+        hasApproveFlow,
+        getEtaConfig,
+        checkClassifyNameArr
+    }
+}

+ 52 - 10
src/views/report/AddReport.vue

@@ -12,8 +12,10 @@ import { useRouter } from 'vue-router'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
+import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
 
 const router=useRouter()
 const {checkAuthBtn} = useAuthBtn()
@@ -64,7 +66,8 @@ async function handleReportBaseInfoChange(e){
             }
         }
     }
-    
+    const classify = e.classifyName.map(i=>i.id)
+    checkClassifyNameArr(1,classify)
     showReportBaseInfo.value=false
 }
 
@@ -119,6 +122,7 @@ function reInitSheetIframe(e){
 }
 
 onMounted(()=>{
+    getEtaConfig()
     window.addEventListener('message',reInitSheetIframe)
 })
 onUnmounted(()=>{
@@ -219,6 +223,10 @@ async function handleReportOpt(type){
             showPublishPop.value=true
         }
     }
+    if(type==='submit'){
+        //提交
+        handleReportSubmit(params)
+    }
     if(type==='dsfb'){
         //定时发布
         const res=await apiReport.reportAdd(params)
@@ -324,6 +332,31 @@ function onConfirmDSFBTime(time){
         })
     })
 }
+//提交
+async function handleReportSubmit(params){
+    const res=await apiReport.reportAdd(params)
+    if(res.Ret!==200) return 
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnSubmit({
+            ReportId:Number(res.Data.ReportId)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            router.back()
+        }).catch(()=>{ //如果选择取消就和存草稿一样,转到编辑页
+            router.replace({
+                path:'/report/edit',
+                query:{
+                    id:res.Data.ReportId
+                }
+            })
+        })
+    })
+}
 
 </script>
 
@@ -348,14 +381,23 @@ function onConfirmDSFBTime(time){
                     <img src="@/assets/imgs/report/icon_save2.png" alt="">
                     <span>保存</span>
                 </div>
-                <div class="item" @click="handleReportOpt('dsfb')" v-permission="reportManageBtn.reportManage_publish">
-                    <img src="@/assets/imgs/report/icon_time.png" alt="">
-                    <span>定时发布</span>
-                </div>
-                <div class="item" @click="handleReportOpt('fb')" v-permission="reportManageBtn.reportManage_publish">
-                    <img src="@/assets/imgs/report/icon_publish3.png" alt="">
-                    <span>发布</span>
-                </div>
+                <template v-if="!isApprove||!hasApproveFlow">
+                    <div class="item" @click="handleReportOpt('dsfb')" v-permission="reportManageBtn.reportManage_publish">
+                        <img src="@/assets/imgs/report/icon_time.png" alt="">
+                        <span>定时发布</span>
+                    </div>
+                    <div class="item" @click="handleReportOpt('fb')" v-permission="reportManageBtn.reportManage_publish">
+                        <img src="@/assets/imgs/report/icon_publish3.png" alt="">
+                        <span>发布</span>
+                    </div>
+                </template>
+                <template v-if="isApprove&&hasApproveFlow">
+                    <div class="item" @click="handleReportOpt('submit')" v-permission="reportManageBtn.reportManage_publish">
+                        <img src="@/assets/imgs/report/icon_publish3.png" alt="">
+                        <span>提交</span>
+                    </div>
+                </template>
+                
             </div>
             <div class="right-btn" @click="showReportInsertPop=true">
                 <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -393,7 +435,7 @@ function onConfirmDSFBTime(time){
             <div class="btns">
                 <div class="btn blue" @click="handleConfirmPublish(2)">发布&推送</div>
                 <div class="btn" @click="handleConfirmPublish(1)">仅发布</div>
-                <div class="btn" @click="showPublishPop=false">取消发布</div>
+                <div class="btn" @click="showPublishPop=false">取消</div>
             </div>
         </div>
     </van-popup>

+ 1 - 1
src/views/report/Detail.vue

@@ -29,7 +29,7 @@ const showPublishPop=ref(false)
 function handleReportPublishCancle(){
     showDialog({
         title: '提示',
-        message: `是否确认取消发布?`,
+        message: `是否确认撤销发布?`,
         showCancelButton:true
     }).then(()=>{
         apiReport.reportPublishCancle({ReportIds:Number(route.query.id)}).then(res=>{

+ 35 - 11
src/views/report/EditReport.vue

@@ -12,14 +12,14 @@ import { useRoute, useRouter } from 'vue-router'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
 import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
+import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
-
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
 const router=useRouter()
 const route=useRoute()
 const {checkAuthBtn} = useAuthBtn()
 
-const isApprove = ref(false)
 
 
 const {lastFocusPosition,initFroalaEditor,imgUploadFlag,frolaEditorContentChange}=useInitFroalaEditor()
@@ -30,6 +30,7 @@ let autoSaveTimer=null
 onMounted(() => {
     const el=document.getElementById('editor')
     reportContentEditorIns=initFroalaEditor('#editor',{height:el.offsetHeight-150})
+    getEtaConfig()
     getReportDetail()
     autoSaveTimer=setInterval(() => {
         autoSaveReportContent()
@@ -80,7 +81,9 @@ async function getReportDetail(){
         reportBaseInfoData.abstract=res.Data.Abstract
 
         reportContentEditorIns.html.set(res.Data.Content);
-
+        
+        const classify = reportBaseInfoData.classifyName.map(i=>i.id)
+        checkClassifyNameArr(1,classify)
         // 查找选中的分类是否有电话会
         const classifyRes=await apiReport.getClassifyList({
             CurrentIndex:1,
@@ -101,11 +104,9 @@ async function getReportDetail(){
                 })
             })
         }
+        
 
     }
-    //获取审批流
-    await publicSettingStore.getPublicSetting()
-    isApprove.value = ['1','3'].includes(publicSettingStore.publicSetting.ApprovalFlow)
 }
 
 
@@ -142,7 +143,8 @@ async function handleReportBaseInfoChange(e){
             }
         }
     }
-    
+    const classify = e.classifyName.map(i=>i.id)
+    checkClassifyNameArr(1,classify)
     showReportBaseInfo.value=false
 }
 
@@ -307,6 +309,9 @@ async function handleReportOpt(type){
     if(type==='dsfb'){
         showDSFBTime.value=true
     }
+    if(type==='submit'){
+        handleReportSubmit(params)
+    }
 }
 
 // 点击发布提示弹窗中的操作按钮
@@ -421,6 +426,25 @@ function onConfirmDSFBTime(time){
     })
 }
 
+//提交报告
+async function handleReportSubmit(params){
+    const res = await apiReport.reportEdit(params)
+    if(res.Ret!==200) return
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnSubmit({
+            ReportId:Number(route.query.id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            router.back()
+        })
+    }).catch(()=>{})
+}
+
 
 </script>
 
@@ -445,7 +469,7 @@ function onConfirmDSFBTime(time){
                     <img src="@/assets/imgs/report/icon_save2.png" alt="">
                     <span>保存</span>
                 </div>
-                <template v-if="!isApprove">
+                <template v-if="!isApprove||!hasApproveFlow">
                     <div class="item" @click="handleReportOpt('dsfb')" v-permission="reportManageBtn.reportManage_publish">
                         <img src="@/assets/imgs/report/icon_time.png" alt="">
                         <span>定时发布</span>
@@ -455,8 +479,8 @@ function onConfirmDSFBTime(time){
                         <span>发布</span>
                     </div>
                 </template>
-                <template v-if="isApprove">
-                    <div class="item" @click="handleReportOpt('fb')" v-permission="reportManageBtn.reportManage_publish">
+                <template v-if="isApprove&&hasApproveFlow">
+                    <div class="item" @click="handleReportOpt('submit')" v-permission="reportManageBtn.reportManage_publish">
                         <img src="@/assets/imgs/report/icon_publish3.png" alt="">
                         <span>提交</span>
                     </div>
@@ -498,7 +522,7 @@ function onConfirmDSFBTime(time){
             <div class="btns">
                 <div :class="['btn blue',reportData.MsgIsSend===1?'disabled':'']" @click="handleConfirmPublish(2)">发布&推送</div>
                 <div class="btn" @click="handleConfirmPublish(1)">仅发布</div>
-                <div class="btn" @click="showPublishPop=false">取消发布</div>
+                <div class="btn" @click="showPublishPop=false">取消</div>
             </div>
         </div>
     </van-popup>

+ 96 - 42
src/views/report/List.vue

@@ -8,13 +8,11 @@ import { showToast,showDialog,Dialog } from 'vant';
 import { useRouter } from 'vue-router';
 import { useWindowSize } from '@vueuse/core'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
-import {usePublicSettingStore} from '@/store/modules/publicSetting'
 import {reportFrequencyOpts} from './utils/config'
 import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
+import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
-const publicSettingStore = usePublicSettingStore()
-
-const isApprove = ref(false)
+const {isApprove,isOtherApprove,getEtaConfig} = useReportApprove()
 
 const {checkAuthBtn} = useAuthBtn()
 
@@ -80,6 +78,7 @@ const listState = reactive({
     loading:false
 })
 async function getList(){
+    const timeType = ['','publish_time','modify_time','approve_time']
     const res=await apiReport.getList({
         CurrentIndex:listState.page,
         PageSize:listState.pageSize,
@@ -89,7 +88,7 @@ async function getList(){
         ClassifyNameSecond:listState.ClassifyNameSecond,
         Frequency:listState.Frequency,
         MsgIsSend:listState.MsgIsSend,
-        TimeType:dateType.value===1?'publish_time':'modify_time',
+        TimeType:timeType[dateType.value]||'publish_time',
         State:listState.publishStatus
     })
     if(res.Ret===200){
@@ -185,6 +184,39 @@ function publishReportApprove(){
     })
 }
 
+//提交报告
+function handleReportSubmit(item){
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnSubmit({
+            ReportId:Number(item.Id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            refreshList()
+        })
+    }).catch(()=>{})
+}
+//撤销报告
+function handleReportCancel(item){
+    showDialog({
+        title: '提示',
+        message: '确定要撤销审批吗?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnCancel({
+            ReportId:Number(item.Id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('撤销成功')
+            refreshList()
+        })
+    }).catch(()=>{})
+}
+
 
 // 发布弹窗关闭
 function handlePublishPopClose(refresh){
@@ -199,7 +231,7 @@ function handlePublishPopClose(refresh){
 function handleReportPublishCancle(item){
     showDialog({
         title: '提示',
-        message: `是否确认取消${isApprove.value?'提交':'发布'}?`,
+        message: `是否确认撤销发布?`,
         showCancelButton:true
     }).then(()=>{
         apiReport.reportPublishCancle({ReportIds:Number(item.Id)}).then(res=>{
@@ -228,7 +260,7 @@ function handldReportMsgSend(item){
 const calendarMinDate=new Date(2010,0,1)
 const showCalendar=ref(false)
 const calendarIns=ref(null)
-const dateType=ref(1)//1发布时间 2更新时间
+const dateType=ref(1)//1发布时间 2更新时间 3审批时间
 function handleCalendarChange(e){
     listState.StartDate=moment(e[0]).format('YYYY-MM-DD')
     listState.EndDate=moment(e[1]).format('YYYY-MM-DD')
@@ -276,16 +308,16 @@ async function onLongPressItem(e){
     }
     //检验权限,如果该状态下无可操作项,则长按不弹出
     let checkState = false
-    if(e.State===1){ //编辑、发布、删除
+    if([1,3].includes(e.State)){ //编辑、发布、删除
         checkState = checkAuthBtn(reportManageBtn.reportManage_reportEdit)
             ||checkAuthBtn(reportManageBtn.reportManage_publish)
             ||checkAuthBtn(reportManageBtn.reportManage_reportDel)
     }
-    if((e.State===2&&!isApprove)||e.State===4){ //推送消息、取消发布
+    if([2,6].includes(e.State)){ //推送消息、取消发布
         checkState = checkAuthBtn(reportManageBtn.reportManage_sendMsg)
             ||checkAuthBtn(reportManageBtn.reportManage_cancelPublish)
     }
-    if((e.State===2&&isApprove)||e.State===3){ //撤销
+    if([4,5].includes(e.State)){ //撤销
         checkState = checkAuthBtn(reportManageBtn.reportManage_cancelPublish)
     }
     
@@ -313,34 +345,41 @@ const reportStatusOpt=[
     }
 ]
 const publishStatusOpt=[
+    {
+        label:'未发布',
+        value:1
+    },
     {
         label:'已发布',
         value:2
     },
-    {
-        label:'未发布',
-        value:1
-    }
-]
-const approveStatusOpt=[
     {
         label:'待提交',
-        value:1
+        value:3
     },
     {
         label:'待审批',
-        value:2
-    },
-    {
-        label:'已审批',
         value:4
     },
     {
         label:'已驳回',
-        value:3
-    }
+        value:5
+    },
+    {
+        label:'已通过',
+        value:6
+    },
 ]
-let statusOpt = publishStatusOpt
+const statusOpt = computed(()=>{
+    let tempArr = publishStatusOpt
+    if(!isApprove.value){
+        tempArr = tempArr.filter(i=>![3,4].includes(i.value))
+    }
+    if(isOtherApprove.value){
+        tempArr = tempArr.filter(i=>i.value!==1)
+    }
+    return tempArr
+})
 function handleSelectReportStatus(item){
     if(temMsgIsSendVal.value==item.value){
         temMsgIsSendVal.value=''
@@ -456,10 +495,7 @@ async function handleReportEdit(e){
 }
 
 onMounted(async ()=>{
-    await publicSettingStore.getPublicSetting()
-    isApprove.value = ['1','3'].includes(publicSettingStore.publicSetting.ApprovalFlow)
-    console.log('isApprove',isApprove.value)
-    statusOpt = isApprove.value?approveStatusOpt:publishStatusOpt
+    getEtaConfig()
 })
 
 </script>
@@ -544,7 +580,7 @@ onMounted(async ()=>{
                         </div>
                     </div>
                 </van-dropdown-item>
-                <van-dropdown-item :title="isApprove?'状态':'发布状态'" ref="publishStatusDropMenuIns">
+                <van-dropdown-item title="报告状态" ref="publishStatusDropMenuIns">
                     <div class="report-status-box">
                         <ul>
                             <li 
@@ -599,10 +635,12 @@ onMounted(async ()=>{
                             <span v-permission="reportManageBtn.reportManage_reportList_uv">UV:{{item.Uv}}</span>
                         </div>
                         <div class="status">
-                            <span v-if="item.State===1">{{isApprove?'待提交':'未发布'}}</span>
-                            <span v-if="item.State===2" class="active-status">{{isApprove?'待审批':'已发布'}}</span>
-                            <span v-if="item.State===3">已驳回</span>
-                            <span v-if="item.State===4">已审批</span>
+                            <span v-if="item.State===1">未发布</span>
+                            <span v-if="item.State===2" class="active-status">已发布</span>
+                            <span v-if="item.State===3">待提交</span>
+                            <span v-if="item.State===4">待审批</span>
+                            <span v-if="item.State===5">已驳回</span>
+                            <span v-if="item.State===6" class="active-status">已通过</span>
                         </div>
                     </div>
                 </li>
@@ -637,19 +675,34 @@ onMounted(async ()=>{
     >
         <div class="report-item-action-box" v-if="activeItem">
             <!-- <div class="title">{{activeItem.Title}}</div> -->
-            <template v-if="activeItem.State==1">
+            <!-- 操作:未发布——发布、编辑、删除
+                    已发布——取消发布、推送消息/已推送消息
+                    待提交——提交、编辑、删除
+                    待审批——撤销
+                    已通过——撤销、推送消息/已推送消息
+                    已驳回——撤销 
+            -->
+            <!-- 未发布,待提交 -->
+            <template v-if="[1,3].includes(activeItem.State)">
                 <div class="item" @click="handleReportEdit(activeItem)" v-permission="reportManageBtn.reportManage_reportEdit">编辑</div>
-                <div class="item" @click="handleReportPublish(activeItem)" v-permission="reportManageBtn.reportManage_publish">{{isApprove?'提交':'发布'}}</div>
+                <div class="item" v-if="checkAuthBtn(reportManageBtn.reportManage_publish)&&activeItem.State===1"
+                    @click="handleReportPublish(activeItem)">发布</div>
+                <div class="item" v-if="checkAuthBtn(reportManageBtn.reportManage_publish)&&activeItem.State===3"
+                    @click="handleReportSubmit(activeItem)">提交</div>
                 <div class="item" @click="handleReportDel(activeItem)" v-permission="reportManageBtn.reportManage_reportDel">删除</div>
             </template>
-            <template v-if="[2,4].includes(activeItem.State)">
-                <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="reportManageBtn.reportManage_cancelPublish">{{isApprove?'撤销':'取消发布'}}</div>
-            </template>
-            <template v-if="activeItem.State==4||(activeItem.State==2&&!isApprove)">
+            <!-- 已发布,已通过 -->
+            <template v-if="[2,6].includes(activeItem.State)">
+                <div class="item" v-if="checkAuthBtn(reportManageBtn.reportManage_cancelPublish)&&activeItem.State===2"
+                    @click="handleReportPublishCancle(activeItem)">撤销</div> <!-- 实际上是取消发布 -->
+                <div class="item" v-if="checkAuthBtn(reportManageBtn.reportManage_cancelPublish)&&activeItem.State===6"
+                    @click="handleReportCancel(activeItem)">撤销</div>
                 <div class="item" @click="handldReportMsgSend(activeItem)" v-if="activeItem.MsgIsSend==0&&checkAuthBtn(reportManageBtn.reportManage_sendMsg)">推送消息</div>
             </template>
-            <template v-if="activeItem.State==3">
-                <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="reportManageBtn.reportManage_cancelPublish">撤销</div>
+            <!-- 待审批,已驳回 -->
+            <template v-if="[4,5].includes(activeItem.State)">
+                <div class="item" v-if="checkAuthBtn(reportManageBtn.reportManage_cancelPublish)"
+                    @click="handleReportCancel(activeItem)">撤销</div>
             </template>
         </div>
     </van-action-sheet>
@@ -696,8 +749,9 @@ onMounted(async ()=>{
                     <span>日期选择</span>
                 </div>
                 <div class="time-type-box">
-                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">{{isApprove?'审批时间':'发布时间'}}</span>
+                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">发布时间</span>
                     <span @click="dateType=2" :class="['item',dateType===2?'active':'']">更新时间</span>
+                    <span @click="dateType=3" :class="['item',dateType===3?'active':'']">审批时间</span>
                 </div>
             </template>
         </van-calendar>

+ 1 - 1
src/views/report/components/ReportPublishPop.vue

@@ -63,7 +63,7 @@ function handleReportMessageSend(publish){
         <div class="btns">
             <div :class="['btn blue',reportData.MsgIsSend===1?'disabled':'']" @click="handleConfirmPublish(2)">发布&推送</div>
             <div class="btn" @click="handleConfirmPublish(1)">仅发布</div>
-            <div class="btn" @click="emits('close')">取消发布</div>
+            <div class="btn" @click="emits('close')">取消</div>
         </div>
     </div>
 </template>

+ 44 - 10
src/views/reportEn/AddReport.vue

@@ -12,11 +12,13 @@ import {useInitFroalaEditor} from '@/hooks/useFroalaEditor'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {enReportManageBtn} from '@/hooks/useAuthBtn'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
+import {useReportApprove} from '@/hooks/useReportApprove'
 
 const cachedViewsStore=useCachedViewsStore()
 const router=useRouter()
 const route=useRoute()
 const publicSettingStore = usePublicSettingStore()
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
 
 const {lastFocusPosition,frolaEditorContentChange,imgUploadFlag,initFroalaEditor}=useInitFroalaEditor()
 
@@ -85,6 +87,8 @@ async function getReportDetail(){
         reportContentIns.html.set(res.Data.Content);
         temOverviewData.value=res.Data.Overview
 
+        const classify = reportBaseInfoData.classifyName.map(i=>i.id)
+        checkClassifyNameArr(2,classify)
     }
 }
 
@@ -122,7 +126,8 @@ async function handleReportBaseInfoChange(e){
             }
         }
     }
-    
+    const classify = e.classifyName.map(i=>i.id)
+    checkClassifyNameArr(2,classify)
     showReportBaseInfo.value=false
 }
 
@@ -198,6 +203,7 @@ function reInitSheetIframe(e){
 }
 
 onMounted(()=>{
+    getEtaConfig()
     window.addEventListener('message',reInitSheetIframe)
 })
 onUnmounted(()=>{
@@ -319,7 +325,9 @@ async function handleReportOpt(e){
     if(e==='dsfb'){
         showDSFBTime.value=true
     }
-    
+    if(e==='submit'){
+        handleReportSubmit(reportId)
+    }
 }
 
 // 发布报告
@@ -351,6 +359,23 @@ function onConfirmDSFBTime(time){
         }
     })
 }
+function handleReportSubmit(reportId){
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReportEn.reportEnSubmit({
+            ReportId:Number(reportId)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            setTimeout(() => {
+                router.back()
+            }, 1500);
+        })
+    }).catch(()=>{})
+}
 </script>
 
 <template>
@@ -375,14 +400,23 @@ function onConfirmDSFBTime(time){
                     <img src="@/assets/imgs/report/icon_save2.png" alt="">
                     <span>保存</span>
                 </div>
-                <div class="item" @click="handleReportOpt('dsfb')" v-permission="enReportManageBtn.enReport_publish">
-                    <img src="@/assets/imgs/report/icon_time.png" alt="">
-                    <span>定时发布</span>
-                </div>
-                <div class="item" @click="handleReportOpt('fb')" v-permission="enReportManageBtn.enReport_publish">
-                    <img src="@/assets/imgs/report/icon_publish3.png" alt="">
-                    <span>发布</span>
-                </div>
+                <template v-if="!isApprove||!hasApproveFlow">
+                    <div class="item" @click="handleReportOpt('dsfb')" v-permission="enReportManageBtn.enReport_publish">
+                        <img src="@/assets/imgs/report/icon_time.png" alt="">
+                        <span>定时发布</span>
+                    </div>
+                    <div class="item" @click="handleReportOpt('fb')" v-permission="enReportManageBtn.enReport_publish">
+                        <img src="@/assets/imgs/report/icon_publish3.png" alt="">
+                        <span>发布</span>
+                    </div>
+                </template>
+                <template v-if="isApprove&&hasApproveFlow">
+                    <div class="item" @click="handleReportOpt('submit')" v-permission="enReportManageBtn.enReport_publish">
+                        <img src="@/assets/imgs/report/icon_publish3.png" alt="">
+                        <span>提交</span>
+                    </div>
+                </template>
+                
             </div>
             <div class="right-btn" @click="showReportInsertPop=true">
                 <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">

+ 114 - 12
src/views/reportEn/List.vue

@@ -1,5 +1,5 @@
 <script setup name="ReportEnList">
-import {nextTick, reactive,ref,computed} from 'vue'
+import {nextTick, reactive,ref,computed,onMounted} from 'vue'
 import apiReportEn from '@/api/reportEn'
 import moment from 'moment'
 import ListClassify from './components/ListClassify.vue'
@@ -10,8 +10,10 @@ import { useRouter } from 'vue-router';
 import { useWindowSize } from '@vueuse/core'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {enReportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
+import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
 const {checkAuthBtn} = useAuthBtn()
+const {isApprove,isOtherApprove,getEtaConfig} = useReportApprove()
 
 const { width, height } = useWindowSize()
 
@@ -66,6 +68,7 @@ const listState = reactive({
     loading:false
 })
 async function getList(){
+    const timeType = ['','publish_time','modify_time','approve_time']
     const res=await apiReportEn.getList({
         CurrentIndex:listState.page,
         PageSize:listState.pageSize,
@@ -76,7 +79,7 @@ async function getList(){
         ClassifySecond:listState.ClassifyNameSecond.id,
         Frequency:listState.Frequency,
         EmailState:listState.MsgIsSend,
-        TimeType:dateType.value===1?'publish_time':'modify_time',
+        TimeType:timeType[dateType.value]||'publish_time',
         State:listState.publishStatus
     })
     if(res.Ret===200){
@@ -147,7 +150,7 @@ async function handleReportPublish(item){
 function handleReportPublishCancle(item){
     showDialog({
         title: '提示',
-        message: `是否确认取消发布?`,
+        message: `是否确认撤销发布?`,
         showCancelButton:true
     }).then(()=>{
         apiReportEn.reportPublishCancle({ReportIds:Number(item.Id)}).then(res=>{
@@ -159,11 +162,44 @@ function handleReportPublishCancle(item){
     })
 }
 
+//提交报告
+function handleReportSubmit(item){
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReportEn.reportEnSubmit({
+            ReportId:Number(item.Id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            refreshList()
+        })
+    }).catch(()=>{})
+}
+//撤销报告
+function handleReportCancle(item){
+    showDialog({
+        title: '提示',
+        message: '确定要撤销审批吗?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReportEn.reportEnCancel({
+            ReportId:Number(item.Id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('撤销成功')
+            refreshList()
+        })
+    }).catch(()=>{})
+}
+
 // 日期筛选
 const calendarMinDate=new Date(2010,0,1)
 const showCalendar=ref(false)
 const calendarIns=ref(null)
-const dateType=ref(1)//1发布时间 2更新时间
+const dateType=ref(1)//1发布时间 2更新时间 3 审批时间
 function handleCalendarChange(e){
     listState.StartDate=moment(e[0]).format('YYYY-MM-DD')
     listState.EndDate=moment(e[1]).format('YYYY-MM-DD')
@@ -210,15 +246,18 @@ function onLongPressItem(e){
     }
     //检验权限,如果该状态下无可操作项,则长按不弹出
     let checkState = false
-    if(e.State===1){ //编辑、发布、删除
+    if([1,3].includes(e.State)){ //编辑、发布、删除
         checkState = checkAuthBtn(enReportManageBtn.enReport_reportEdit)
             ||checkAuthBtn(enReportManageBtn.enReport_publish)
             ||checkAuthBtn(enReportManageBtn.enReport_reportDel)
     }
-    if(e.State===2){ //群发邮件/群发日志、取消发布
+    if([2,6].includes(e.State)){ //群发邮件/群发日志、取消发布
         checkState = checkAuthBtn(enReportManageBtn.enReport_sendEmail)
             ||checkAuthBtn(enReportManageBtn.enReport_cancelPublish)
     }
+    if([4,5].includes(e.State)){
+        checkState = checkAuthBtn(enReportManageBtn.enReport_cancelPublish)
+    }
     if(!checkState) return
     activeItem.value=e
     showReportItemOpt.value=true
@@ -277,15 +316,41 @@ const reportStatusOpt=[
     }
 ]
 const publishStatusOpt=[
+{
+        label:'未发布',
+        value:1
+    },
     {
         label:'已发布',
         value:2
     },
     {
-        label:'未发布',
-        value:1
+        label:'待提交',
+        value:3
+    },
+    {
+        label:'待审批',
+        value:4
+    },
+    {
+        label:'已驳回',
+        value:5
+    },
+    {
+        label:'已通过',
+        value:6
     }
 ]
+const statusOpt = computed(()=>{
+    let tempArr = publishStatusOpt
+    if(!isApprove.value){
+        tempArr = tempArr.filter(i=>![3,4].includes(i.value))
+    }
+    if(isOtherApprove.value){
+        tempArr = tempArr.filter(i=>i.value!==1)
+    }
+    return tempArr
+})
 function handleSelectReportStatus(item){
     if(temMsgIsSendVal.value==item.value){
         temMsgIsSendVal.value=''
@@ -405,6 +470,9 @@ function handleGoEmailLog(e){
         }
     })
 }
+onMounted(()=>{
+    getEtaConfig()
+})
 </script>
 
 <template>
@@ -487,12 +555,12 @@ function handleGoEmailLog(e){
                         </div>
                     </div>
                 </van-dropdown-item>
-                <van-dropdown-item title="发布状态" ref="publishStatusDropMenuIns">
+                <van-dropdown-item title="报告状态" ref="publishStatusDropMenuIns">
                     <div class="report-status-box">
                         <ul>
                             <li 
                                 :class="['status-item',temPublishStatusVal===item.value?'active':'']" 
-                                v-for="item in publishStatusOpt" 
+                                v-for="item in statusOpt" 
                                 :key="item.value"
                                 @click="handleSelectReportPublishStatus(item)"
                             >{{item.label}}</li>
@@ -542,6 +610,10 @@ function handleGoEmailLog(e){
                         <div>
                             <span v-if="item.State===1">未发布</span>
                             <span v-if="item.State===2" class="active-status">已发布</span>
+                            <span v-if="item.State===3">待提交</span>
+                            <span v-if="item.State===4">待审批</span>
+                            <span v-if="item.State===5">已驳回</span>
+                            <span v-if="item.State===6" class="active-status">已通过</span>
                         </div>
                     </div>
                 </li>
@@ -565,7 +637,36 @@ function handleGoEmailLog(e){
     >
         <div class="report-item-action-box" v-if="activeItem">
             <!-- <div class="title">{{activeItem.Title}}</div> -->
-            <template v-if="activeItem.State==1">
+            <!-- 操作:未发布——发布、编辑、删除
+            已发布——取消发布、群发邮件/群发日志
+            待提交——提交、编辑、删除
+            待审批——撤销
+            已通过——撤销、群发邮件/群发日志
+            已驳回——撤销 -->
+            <!-- 未发布,待提交 -->
+            <template v-if="[1,3].includes(activeItem.State)">
+                <div class="item" @click="handleReportEdit(activeItem)" v-if="activeItem.CanEdit&&checkAuthBtn(enReportManageBtn.enReport_reportEdit)">编辑</div>
+                <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_publish)&&activeItem.State===1"
+                    @click="handleReportPublish(activeItem)">发布</div>
+                <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_publish)&&activeItem.State===3"
+                    @click="handleReportSubmit(activeItem)">提交</div>
+                <div class="item" @click="handleReportDel(activeItem)" v-permission="enReportManageBtn.enReport_reportDel">删除</div>
+            </template>
+            <!-- 已发布,已通过 -->
+            <template v-if="[2,6].includes(activeItem.State)">
+                <div class="item" @click="showSendEmail=true;showReportItemOpt=false" v-if="activeItem.EmailState===0&&activeItem.EmailAuth&&checkAuthBtn(enReportManageBtn.enReport_sendEmail)">群发邮件</div>
+                <div class="item" @click="handleGoEmailLog(activeItem)" v-if="activeItem.EmailState===1&&activeItem.EmailAuth&&checkAuthBtn(enReportManageBtn.enReport_sendEmail)">群发日志</div>
+                <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_cancelPublish)&&activeItem.State===2"
+                    @click="handleReportPublishCancle(activeItem)">撤销</div> <!-- 实际上是取消发布 -->
+                <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_cancelPublish)&&activeItem.State===6"
+                    @click="handleReportCancle(activeItem)">撤销</div>
+            </template>
+            <!-- 待审批,已驳回 -->
+            <template v-if="[4,5].includes(activeItem.State)">
+                <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_cancelPublish)"
+                    @click="handleReportCancle(activeItem)">撤销</div>
+            </template>
+            <!-- <template v-if="activeItem.State==1">
                 <div class="item" @click="handleReportEdit(activeItem)" v-if="activeItem.CanEdit&&checkAuthBtn(enReportManageBtn.enReport_reportEdit)">编辑</div>
                 <div class="item" @click="handleReportPublish(activeItem)" v-permission="enReportManageBtn.enReport_publish">发布</div>
                 <div class="item" @click="handleReportDel(activeItem)" v-permission="enReportManageBtn.enReport_reportDel">删除</div>
@@ -574,7 +675,7 @@ function handleGoEmailLog(e){
                 <div class="item" @click="showSendEmail=true;showReportItemOpt=false" v-if="activeItem.EmailState===0&&activeItem.EmailAuth&&checkAuthBtn(enReportManageBtn.enReport_sendEmail)">群发邮件</div>
                 <div class="item" @click="handleGoEmailLog(activeItem)" v-if="activeItem.EmailState===1&&activeItem.EmailAuth&&checkAuthBtn(enReportManageBtn.enReport_sendEmail)">群发日志</div>
                 <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="enReportManageBtn.enReport_cancelPublish">取消发布</div>
-            </template>
+            </template> -->
         </div>
     </van-action-sheet>
 
@@ -613,6 +714,7 @@ function handleGoEmailLog(e){
                 <div class="time-type-box">
                     <span @click="dateType=1" :class="['item',dateType===1?'active':'']">发布时间</span>
                     <span @click="dateType=2" :class="['item',dateType===2?'active':'']">更新时间</span>
+                    <span @click="dateType=3" :class="['item',dateType===3?'active':'']">审批时间</span>
                 </div>
             </template>
         </van-calendar>