Browse Source

英文研报配置审批流

cxmo 1 năm trước cách đây
mục cha
commit
415c131b73

+ 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)
+    },
 }

+ 7 - 0
src/views/report/AddReport.vue

@@ -344,6 +344,13 @@ async function handleReportSubmit(params){
             if(res.Ret!==200) return 
             showToast('提交成功')
             router.back()
+        }).catch(()=>{
+            router.replace({
+                path:'/report/edit',
+                query:{
+                    id:res.Data.ReportId
+                }
+            })
         })
     })
 }

+ 5 - 3
src/views/report/EditReport.vue

@@ -306,7 +306,7 @@ async function handleReportOpt(type){
         showDSFBTime.value=true
     }
     if(type==='submit'){
-        handleReportSubmit()
+        handleReportSubmit(params)
     }
 }
 
@@ -423,7 +423,9 @@ function onConfirmDSFBTime(time){
 }
 
 //提交报告
-function handleReportSubmit(){
+async function handleReportSubmit(params){
+    const res = await apiReport.reportEdit(params)
+    if(res.Ret!==200) return
     showDialog({
         title: '提示',
         message: '是否确认提交该报告进入审批流程?',
@@ -436,7 +438,7 @@ function handleReportSubmit(){
             showToast('提交成功')
             router.back()
         })
-    })
+    }).catch(()=>{})
 }
 
 

+ 1 - 12
src/views/report/List.vue

@@ -344,16 +344,6 @@ const reportStatusOpt=[
     }
 ]
 const publishStatusOpt=[
-    {
-        label:'已发布',
-        value:2
-    },
-    {
-        label:'未发布',
-        value:1
-    }
-]
-const approveStatusOpt=[
     {
         label:'未发布',
         value:1
@@ -379,7 +369,6 @@ const approveStatusOpt=[
         value:6
     },
 ]
-let statusOpt = approveStatusOpt
 function handleSelectReportStatus(item){
     if(temMsgIsSendVal.value==item.value){
         temMsgIsSendVal.value=''
@@ -585,7 +574,7 @@ onMounted(async ()=>{
                         <ul>
                             <li 
                                 :class="['status-item',temPublishStatusVal===item.value?'active':'']" 
-                                v-for="item in statusOpt" 
+                                v-for="item in publishStatusOpt" 
                                 :key="item.value"
                                 @click="handleSelectReportPublishStatus(item)"
                             >{{item.label}}</li>

+ 40 - 9
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,getEtaConfig} = useReportApprove()
 
 const {lastFocusPosition,frolaEditorContentChange,imgUploadFlag,initFroalaEditor}=useInitFroalaEditor()
 
@@ -198,6 +200,7 @@ function reInitSheetIframe(e){
 }
 
 onMounted(()=>{
+    getEtaConfig()
     window.addEventListener('message',reInitSheetIframe)
 })
 onUnmounted(()=>{
@@ -319,7 +322,9 @@ async function handleReportOpt(e){
     if(e==='dsfb'){
         showDSFBTime.value=true
     }
-    
+    if(e==='subumit'){
+        handleReportSubmit()
+    }
 }
 
 // 发布报告
@@ -351,6 +356,23 @@ function onConfirmDSFBTime(time){
         }
     })
 }
+function handleReportSubmit(){
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReportEn.reportEnSubmit({
+            ReportId:Number(route.query.id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            setTimeout(() => {
+                router.back()
+            }, 1500);
+        })
+    }).catch(()=>{})
+}
 </script>
 
 <template>
@@ -375,14 +397,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">
+                    <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">
+                    <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">

+ 99 - 9
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,getEtaConfig} = useReportApprove()
 
 const { width, height } = useWindowSize()
 
@@ -159,6 +161,39 @@ 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)
@@ -210,15 +245,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,13 +315,29 @@ 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
     }
 ]
 function handleSelectReportStatus(item){
@@ -405,6 +459,9 @@ function handleGoEmailLog(e){
         }
     })
 }
+onMounted(()=>{
+    getEtaConfig()
+})
 </script>
 
 <template>
@@ -487,7 +544,7 @@ 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 
@@ -542,6 +599,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 +626,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 +664,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>
 
@@ -611,7 +701,7 @@ function handleGoEmailLog(e){
                     <span>日期选择</span>
                 </div>
                 <div class="time-type-box">
-                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">发布时间</span>
+                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">{{isApprove?'审批时间':'发布时间'}}</span>
                     <span @click="dateType=2" :class="['item',dateType===2?'active':'']">更新时间</span>
                 </div>
             </template>