Explorar o código

中文研报添加编辑切换分类时,判断分类是否有审批流

cxmo hai 1 ano
pai
achega
7c9923ca51

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

+ 18 - 1
src/hooks/useReportApprove.js

@@ -1,17 +1,34 @@
 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 hasApproveFlow = 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
     }
+    //检查分类是否存在审批流
+    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,
-        getEtaConfig
+        hasApproveFlow,
+        getEtaConfig,
+        checkClassifyNameArr
     }
 }

+ 5 - 4
src/views/report/AddReport.vue

@@ -15,7 +15,7 @@ import {usePublicSettingStore} from '@/store/modules/publicSetting'
 import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
-const {isApprove,getEtaConfig} = useReportApprove()
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
 
 const router=useRouter()
 const {checkAuthBtn} = useAuthBtn()
@@ -66,7 +66,8 @@ async function handleReportBaseInfoChange(e){
             }
         }
     }
-    
+    const classify = e.classifyName.map(i=>i.id)
+    checkClassifyNameArr(1,classify)
     showReportBaseInfo.value=false
 }
 
@@ -378,7 +379,7 @@ async function handleReportSubmit(params){
                     <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>
@@ -388,7 +389,7 @@ async function handleReportSubmit(params){
                         <span>发布</span>
                     </div>
                 </template>
-                <template v-if="isApprove">
+                <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>

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

@@ -15,7 +15,7 @@ import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
 import {useReportApprove} from '@/hooks/useReportApprove'
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
-const {isApprove,getEtaConfig} = useReportApprove()
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
 const router=useRouter()
 const route=useRoute()
 const {checkAuthBtn} = useAuthBtn()
@@ -140,7 +140,8 @@ async function handleReportBaseInfoChange(e){
             }
         }
     }
-    
+    const classify = e.classifyName.map(i=>i.id)
+    checkClassifyNameArr(1,classify)
     showReportBaseInfo.value=false
 }
 
@@ -465,7 +466,7 @@ async function handleReportSubmit(params){
                     <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>
@@ -475,7 +476,7 @@ async function handleReportSubmit(params){
                         <span>发布</span>
                     </div>
                 </template>
-                <template v-if="isApprove">
+                <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>

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

@@ -78,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,
@@ -87,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){
@@ -259,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')
@@ -738,8 +739,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>

+ 5 - 3
src/views/reportEn/List.vue

@@ -68,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,
@@ -78,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){
@@ -198,7 +199,7 @@ function handleReportCancle(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')
@@ -701,8 +702,9 @@ onMounted(()=>{
                     <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>