浏览代码

中文研报配置审批流

cxmo 1 年之前
父节点
当前提交
ecec169bba
共有 5 个文件被更改,包括 185 次插入46 次删除
  1. 20 1
      src/api/report.js
  2. 17 0
      src/hooks/useReportApprove.js
  3. 40 8
      src/views/report/AddReport.vue
  4. 24 6
      src/views/report/EditReport.vue
  5. 84 31
      src/views/report/List.vue

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

+ 17 - 0
src/hooks/useReportApprove.js

@@ -0,0 +1,17 @@
+import { useConfigSettingStore } from '@/store/modules/etaConfig'
+import { storeToRefs } from 'pinia'
+import {ref} from 'vue'
+export function useReportApprove(){
+    let isApprove = ref(false)
+    const configSettingStore = useConfigSettingStore()
+    const { etaConfigInfo } = storeToRefs(configSettingStore)
+    const getEtaConfig = async()=>{
+        await configSettingStore.getBaseConfigSetting()
+        const {IsReportApprove=''} = etaConfigInfo.value
+        isApprove.value = IsReportApprove==='true'?true:false
+    }
+    return {
+        isApprove,
+        getEtaConfig
+    }
+}

+ 40 - 8
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,getEtaConfig} = useReportApprove()
 
 const router=useRouter()
 const {checkAuthBtn} = useAuthBtn()
@@ -119,6 +121,7 @@ function reInitSheetIframe(e){
 }
 
 onMounted(()=>{
+    getEtaConfig()
     window.addEventListener('message',reInitSheetIframe)
 })
 onUnmounted(()=>{
@@ -219,6 +222,9 @@ async function handleReportOpt(type){
             showPublishPop.value=true
         }
     }
+    if(type==='submit'){
+        handleReportSubmit(params)
+    }
     if(type==='dsfb'){
         //定时发布
         const res=await apiReport.reportAdd(params)
@@ -324,6 +330,23 @@ 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()
+        })
+    })
+}
 
 </script>
 
@@ -348,14 +371,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">
+                    <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">
+                    <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">

+ 24 - 6
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,getEtaConfig} = 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()
@@ -103,9 +104,6 @@ async function getReportDetail(){
         }
 
     }
-    //获取审批流
-    await publicSettingStore.getPublicSetting()
-    isApprove.value = ['1','3'].includes(publicSettingStore.publicSetting.ApprovalFlow)
 }
 
 
@@ -307,6 +305,9 @@ async function handleReportOpt(type){
     if(type==='dsfb'){
         showDSFBTime.value=true
     }
+    if(type==='submit'){
+        handleReportSubmit()
+    }
 }
 
 // 点击发布提示弹窗中的操作按钮
@@ -421,6 +422,23 @@ function onConfirmDSFBTime(time){
     })
 }
 
+//提交报告
+function handleReportSubmit(){
+    showDialog({
+        title: '提示',
+        message: '是否确认提交该报告进入审批流程?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnSubmit({
+            ReportId:Number(route.query.id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('提交成功')
+            router.back()
+        })
+    })
+}
+
 
 </script>
 
@@ -456,7 +474,7 @@ function onConfirmDSFBTime(time){
                     </div>
                 </template>
                 <template v-if="isApprove">
-                    <div class="item" @click="handleReportOpt('fb')" v-permission="reportManageBtn.reportManage_publish">
+                    <div class="item" @click="handleReportOpt('submit')" v-permission="reportManageBtn.reportManage_publish">
                         <img src="@/assets/imgs/report/icon_publish3.png" alt="">
                         <span>提交</span>
                     </div>

+ 84 - 31
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,getEtaConfig} = useReportApprove()
 
 const {checkAuthBtn} = useAuthBtn()
 
@@ -185,6 +183,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()
+        })
+    })
+}
+//撤销报告
+function handleReportCancel(item){
+    showDialog({
+        title: '提示',
+        message: '你确定要撤销申请吗?',
+        showCancelButton:true
+    }).then(()=>{
+        apiReport.reportCnCancel({
+            ReportId:Number(item.Id)
+        }).then(res=>{
+            if(res.Ret!==200) return 
+            showToast('撤销成功')
+            refreshList()
+        })
+    })
+}
+
 
 // 发布弹窗关闭
 function handlePublishPopClose(refresh){
@@ -199,7 +230,7 @@ function handlePublishPopClose(refresh){
 function handleReportPublishCancle(item){
     showDialog({
         title: '提示',
-        message: `是否确认取消${isApprove.value?'提交':'发布'}?`,
+        message: `是否确认取消发布?`,
         showCancelButton:true
     }).then(()=>{
         apiReport.reportPublishCancle({ReportIds:Number(item.Id)}).then(res=>{
@@ -276,16 +307,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)
     }
     
@@ -324,23 +355,31 @@ const publishStatusOpt=[
 ]
 const approveStatusOpt=[
     {
-        label:'待提交',
+        label:'未发布',
         value:1
     },
     {
-        label:'待审批',
+        label:'已发布',
         value:2
     },
     {
-        label:'已审批',
+        label:'待提交',
+        value:3
+    },
+    {
+        label:'待审批',
         value:4
     },
     {
         label:'已驳回',
-        value:3
-    }
+        value:5
+    },
+    {
+        label:'已通过',
+        value:6
+    },
 ]
-let statusOpt = publishStatusOpt
+let statusOpt = approveStatusOpt
 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>