|
@@ -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>
|