|
@@ -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,isOtherApprove,getEtaConfig} = useReportApprove()
|
|
|
|
|
|
const {checkAuthBtn} = useAuthBtn()
|
|
|
|
|
@@ -80,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,
|
|
@@ -89,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){
|
|
@@ -185,6 +184,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()
|
|
|
+ })
|
|
|
+ }).catch(()=>{})
|
|
|
+}
|
|
|
+//撤销报告
|
|
|
+function handleReportCancel(item){
|
|
|
+ showDialog({
|
|
|
+ title: '提示',
|
|
|
+ message: '确定要撤销审批吗?',
|
|
|
+ showCancelButton:true
|
|
|
+ }).then(()=>{
|
|
|
+ apiReport.reportCnCancel({
|
|
|
+ ReportId:Number(item.Id)
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ showToast('撤销成功')
|
|
|
+ refreshList()
|
|
|
+ })
|
|
|
+ }).catch(()=>{})
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
// 发布弹窗关闭
|
|
|
function handlePublishPopClose(refresh){
|
|
@@ -199,7 +231,7 @@ function handlePublishPopClose(refresh){
|
|
|
function handleReportPublishCancle(item){
|
|
|
showDialog({
|
|
|
title: '提示',
|
|
|
- message: `是否确认取消${isApprove.value?'提交':'发布'}?`,
|
|
|
+ message: `是否确认撤销发布?`,
|
|
|
showCancelButton:true
|
|
|
}).then(()=>{
|
|
|
apiReport.reportPublishCancle({ReportIds:Number(item.Id)}).then(res=>{
|
|
@@ -228,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')
|
|
@@ -276,16 +308,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)
|
|
|
}
|
|
|
|
|
@@ -313,34 +345,41 @@ const reportStatusOpt=[
|
|
|
}
|
|
|
]
|
|
|
const publishStatusOpt=[
|
|
|
+ {
|
|
|
+ label:'未发布',
|
|
|
+ value:1
|
|
|
+ },
|
|
|
{
|
|
|
label:'已发布',
|
|
|
value:2
|
|
|
},
|
|
|
- {
|
|
|
- label:'未发布',
|
|
|
- value:1
|
|
|
- }
|
|
|
-]
|
|
|
-const approveStatusOpt=[
|
|
|
{
|
|
|
label:'待提交',
|
|
|
- value:1
|
|
|
+ value:3
|
|
|
},
|
|
|
{
|
|
|
label:'待审批',
|
|
|
- value:2
|
|
|
- },
|
|
|
- {
|
|
|
- label:'已审批',
|
|
|
value:4
|
|
|
},
|
|
|
{
|
|
|
label:'已驳回',
|
|
|
- value:3
|
|
|
- }
|
|
|
+ value:5
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label:'已通过',
|
|
|
+ value:6
|
|
|
+ },
|
|
|
]
|
|
|
-let statusOpt = publishStatusOpt
|
|
|
+const statusOpt = computed(()=>{
|
|
|
+ let tempArr = publishStatusOpt
|
|
|
+ if(!isApprove.value){
|
|
|
+ tempArr = tempArr.filter(i=>![3,4].includes(i.value))
|
|
|
+ }
|
|
|
+ if(isOtherApprove.value){
|
|
|
+ tempArr = tempArr.filter(i=>i.value!==1)
|
|
|
+ }
|
|
|
+ return tempArr
|
|
|
+})
|
|
|
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>
|
|
@@ -696,8 +749,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>
|