Kaynağa Gözat

研报切换分类时,检查该分类是否有审批流

cxmo 1 yıl önce
ebeveyn
işleme
f27282f7f4

+ 11 - 0
src/api/modules/approve.js

@@ -151,6 +151,17 @@ export const approveInterence = {
     rejectApprove(params){
         return http.post("/report_approve/refuse",params)
     },
+    /**
+     * 校验研报分类是否有审批流
+     * @param {Object} params 
+     * @param {Number} params.ReportType 报告类型:1-中文研报;2-英文研报;3-智能研报
+     * @param {Number} params.ClassifyFirstId 倒数第二级分类的id
+     * @param {Number} params.ClassifySecondId 倒数第一级分类的id
+     * @returns 
+     */
+    checkClassifyApprove(params){
+        return http.post("/report_approve/classify/check_open",params)
+    },
 
 
 

+ 17 - 0
src/mixins/reportApproveConfig.js

@@ -8,12 +8,15 @@
     审批详情
  */
 import {etaBaseConfigInterence} from '@/api/modules/etaBaseConfigApi.js';
+import {approveInterence} from '@/api/modules/approve.js';
 export default{
     data(){
         return{
             ReportApproveType:'',
             IsReportApprove:false,
             pageLoading:false,
+            hasApproveFlow:false,
+            checkLoading:false,
         }
     },
     computed:{
@@ -37,6 +40,20 @@ export default{
             this.IsReportApprove = IsReportApprove==='true'?true:false,
             this.ReportApproveType = ReportApproveType
         },
+        //检查是否有审批流
+        checkClassifyNameArr(type=1,classify=[]){
+            this.checkLoading=true
+            let params = {
+                ReportType:type,
+                ClassifyFirstId:classify[classify.length-2]||0,
+                ClassifySecondId:classify[classify.length-1]||0,
+            }
+            approveInterence.checkClassifyApprove(params).then(res=>{
+                this.checkLoading=false
+                if(res.Ret!==200) return 
+                this.hasApproveFlow = res.Data||false
+            })
+        },
     },
     mounted(){
         this.getBaseConfig()

+ 15 - 2
src/views/report_manage/addreportNew.vue

@@ -51,23 +51,26 @@
 					>存草稿</el-button
 				>
 				<!--不走审批流-->
-				<template v-if="!isApprove">
+				<template v-if="!isApprove||!hasApproveFlow">
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('dsfb')"
 						>定时发布</el-button
 					>
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('fb')"
 						:loading="isPublishloading"
 						>发布</el-button
 					>
 				</template>
-				<template v-if="isApprove">
+				<template v-if="isApprove&&hasApproveFlow">
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
+						:disabled="checkLoading"
 						type="primary" size="medium" @click="clickreportadd('submit')">提交</el-button>
 				</template>
 			</div>
@@ -509,6 +512,10 @@ export default {
 						frequency: res.Data.Frequency,
 						content: res.Data.Content,
 					};
+					let classify = this.aeForm.classifynameArr.map(i=>{
+						return JSON.parse(i).v||0
+					})
+					this.checkClassifyNameArr(1,classify)
 				}
 			});
 		},
@@ -520,6 +527,12 @@ export default {
 			});
 		},
 		userclassidreportdetail() {
+			//检查classifynameArr是否有审批流
+			let classify = this.aeForm.classifynameArr.map(i=>{
+				return JSON.parse(i).v||0
+			})
+			this.checkClassifyNameArr(1,classify)
+
 			if (this.aeForm.add_type == 1) {
 				if (this.aeForm.classifynameArr.length == 2) {
 					this.aeForm.title = JSON.parse(this.aeForm.classifynameArr[1]).l;

+ 13 - 2
src/views/report_manage/editreportNew.vue

@@ -51,23 +51,26 @@
 					>存草稿</el-button
 				>
 				<!--不走审批流-->
-				<template v-if="!isApprove">
+				<template v-if="!isApprove||!hasApproveFlow">
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('dsfb')"
 						>定时发布</el-button
 					>
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('fb')"
 						:loading="isPublishloading"
 						>发布</el-button
 					>
 				</template>
-				<template v-if="isApprove">
+				<template v-if="isApprove&&hasApproveFlow">
 					<el-button v-permission="permissionBtn.reportManageBtn.reportManage_publish"
+						:disabled="checkLoading"
 						type="primary" size="medium" @click="clickreportadd('submit')">提交</el-button>
 				</template>
 			</div>
@@ -488,6 +491,12 @@ export default {
 			// }
 		},
 		userclassidreportdetail() {
+			//检查classifynameArr是否有审批流
+			let classify = this.aeForm.classifynameArr.map(i=>{
+				return JSON.parse(i).v||0
+			})
+			this.checkClassifyNameArr(1,classify)
+
 			if (this.aeForm.add_type == 1) {
 				if (this.aeForm.classifynameArr.length == 2) {
 					this.aeForm.title = JSON.parse(this.aeForm.classifynameArr[1]).l;
@@ -589,6 +598,8 @@ export default {
 					if(data.PrePublishTime){
 						this.taskTime=data.PrePublishTime
 					}
+					let classify = [data.ClassifyIdFirst,data.ClassifyIdSecond]
+					this.checkClassifyNameArr(1,classify)
 				}
 			});
 		},

+ 6 - 21
src/views/report_manage/mixins/messagePush.js

@@ -127,28 +127,13 @@ export default {
     //展示提交审批弹窗
     handleSubmitReport(id){
         this.submitId = id
-        const canPost = this.permissionBtn.checkPermissionBtn(this.permissionBtn.reportManageBtn.reportManage_sendMsg)
-        if(canPost){
-            this.$confirm("报告通过审批后,是否推送消息?","提示",{
-                confirmButtonText: '推送',
-                cancelButtonText: '不推送',
-                type: 'warning',
-                distinguishCancelAndClose:true,
-                beforeClose:(action, instance,done)=>{
-                    if(action=='close') {
-                        //右上角
-                        this.isPublishloading = false;
-                    } else if(action=='cancel') {
-                        this.submitReport("submit")
-                    }else {
-                        this.submitReport("both")
-                    }
-                    done()
-                }
-            })
-        }else{
+        this.$confirm("是否确认提交该报告进入审批流程?","提示",{
+            confirmButtonText:'确定',
+            cancelButtonText:'取消',
+            type:'warning',
+        }).then(()=>{
             this.submitReport("submit")
-        }
+        })
         
     },
     //提交审批

+ 12 - 2
src/views/report_manage/reportEn/reportEditor.vue

@@ -63,23 +63,26 @@
 					@click.native="clickreportadd('cg')"
 					>存草稿</el-button
 				>
-				<template v-if="!isApprove">
+				<template v-if="!isApprove||!hasApproveFlow">
 					<el-button v-permission="permissionBtn.enReportManageBtn.enReport_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('dsfb')"
 						>定时发布</el-button
 					>
 					<el-button v-permission="permissionBtn.enReportManageBtn.enReport_publish"
 						type="primary"
 						size="medium"
+						:disabled="checkLoading"
 						@click.native="clickreportadd('fb')"
 						:loading="isPublishloading"
 						>发布</el-button
 					>
 				</template>
-				<template v-if="isApprove">
+				<template v-if="isApprove&&hasApproveFlow">
 					<el-button v-permission="permissionBtn.enReportManageBtn.enReport_publish"
+						:disabled="checkLoading"
 						type="primary" size="medium" @click="clickreportadd('submit')">提交</el-button>
 				</template>
 			</div>
@@ -581,6 +584,11 @@ export default {
 		},
 
 		userclassidreportdetail() {
+			//检查classifynameArr是否有审批流
+			let classify = this.aeForm.classifynameArr.map(i=>{
+				return JSON.parse(i).v||0
+			})
+			this.checkClassifyNameArr(2,classify)
 			// console.log(this.aeForm.classifynameArr,'this.aeForm.classifynameArr');
 			if (this.aeForm.add_type == 1) {
 				if (this.aeForm.classifynameArr.length == 3) {
@@ -679,6 +687,8 @@ export default {
 					if(data.PrePublishTime){
 						this.taskTime=data.PrePublishTime
 					}
+					let classify = [data.ClassifyIdRoot,data.ClassifyIdFirst,data.ClassifyIdSecond]
+					this.checkClassifyNameArr(2,classify)
 				}
 			});
 		},

+ 8 - 26
src/views/report_manage/reportlist.vue

@@ -1021,32 +1021,14 @@ export default {
     //提交报告
     handleSubmitReport(item){
         this.submitId = item.Id
-        const canPost = this.permissionBtn.checkPermissionBtn(this.permissionBtn.reportManageBtn.reportManage_sendMsg)&&item.MsgIsSend===0
-        if(canPost){
-            this.$confirm("报告通过审批后,是否推送消息?","提示",{
-                confirmButtonText: '推送',
-                cancelButtonText: '不推送',
-                type: 'warning',
-                distinguishCancelAndClose:true,
-                beforeClose:(action, instance,done)=>{
-                    if(action=='close') {
-                    } else if(action=='cancel') {
-                        this.submitReport("submit")
-                    }else {
-                        this.submitReport("both")
-                    }
-                    done()
-                }
-            })
-        }else{
-            this.$confirm("是否确认提交该报告进入审批流程?","提示",{
-                confirmButtonText:'确定',
-                cancelButtonText:'取消',
-                type:'warning',
-            }).then(()=>{
-                this.submitReport("submit")
-            })
-        }
+        this.$confirm("是否确认提交该报告进入审批流程?","提示",{
+            confirmButtonText:'确定',
+            cancelButtonText:'取消',
+            type:'warning',
+        }).then(()=>{
+            this.submitReport("submit")
+        })
+        
     },
     submitReport(type){
         //both:提交&推送

+ 20 - 6
src/views/smartReport/editReport.vue

@@ -20,18 +20,21 @@
                     <img src="~@/assets/img/smartReport/icon01.png" alt="">
                     <span>存草稿</span>
                 </li>
-                <template v-if="!isApprove">
-                    <li class="action-item" @click="handlePublishOpt('dsfb')">
+                <template v-if="!isApprove||!hasApproveFlow">
+                    <li class="action-item" :class="{'disabled':checkLoading}"
+                        @click="handlePublishOpt('dsfb')">
                         <img src="~@/assets/img/smartReport/icon01.png" alt="">
                         <span>定时发布</span>
                     </li>
-                    <li class="action-item" @click="handlePublishOpt('fb')">
+                    <li class="action-item" :class="{'disabled':checkLoading}"
+                        @click="handlePublishOpt('fb')">
                         <img src="~@/assets/img/smartReport/icon01.png" alt="">
                         <span>发布</span>
                     </li>
                 </template>
-                <template v-if="isApprove">
-                    <li class="action-item" @click="handlePublishOpt('submit')">
+                <template v-if="isApprove&&hasApproveFlow">
+                    <li class="action-item" :class="{'disabled':checkLoading}"
+                        @click="handlePublishOpt('submit')">
                         <img src="~@/assets/img/smartReport/icon01.png" alt="">
                         <span>提交</span>
                     </li>
@@ -763,6 +766,10 @@ export default {
                 ContentStruct:JSON.stringify(this.conList)
             }
             console.log(params);
+            //检查classifynameArr是否有审批流
+            let classify = [e.ClassifyIdFirst,e.ClassifyIdSecond]
+            this.checkClassifyNameArr(3,classify)
+
             apiSmartReport.reportEdit({...params}).then(res=>{
                 if(res.Ret===200){
                     this.$message.success('保存成功')
@@ -793,6 +800,8 @@ export default {
                     this.$nextTick(()=>{
                         this.contentChange=false
                     })
+                    let classify = [res.Data.ClassifyIdFirst,res.Data.ClassifyIdSecond]
+                    this.checkClassifyNameArr(3,classify)
                 }
             })
         },
@@ -876,7 +885,7 @@ export default {
                 return
             }
             // 发布
-            if(this.isApprove){
+            if(type==='submit'){
                 this.submitReport()
                 return
             }
@@ -1105,6 +1114,11 @@ div{
                 &:last-child{
                     border-right: none;
                 }
+                &.disabled{
+                    pointer-events: none;
+                    cursor: not-allowed;
+                    color:#999;
+                }
             }
         }
     }