Преглед изворни кода

研报审批流同步移动端

cxmo пре 1 година
родитељ
комит
6493c06b68
3 измењених фајлова са 95 додато и 11 уклоњено
  1. 7 0
      src/api/common.js
  2. 27 0
      src/store/modules/publicSetting.js
  3. 61 11
      src/views/report/List.vue

+ 7 - 0
src/api/common.js

@@ -57,4 +57,11 @@ export function apiGetLanguageConfig(params){
  */
 export function apiGetAuthBtnList(){
     return get('/system/role/menu/buttons',{})
+}
+
+/**
+ * 获取系统动态配置配置
+ */
+export function apiGetPublicSetting(){
+    return get('/system/config',{})
 }

+ 27 - 0
src/store/modules/publicSetting.js

@@ -0,0 +1,27 @@
+/* 系统动态配置配置 */
+import { defineStore } from "pinia";
+import { apiGetPublicSetting } from '@/api/common'
+
+export const usePublicSettingStore = defineStore('publicSetting',{
+  state: () => {
+    return {
+      publicSetting: {}
+    }
+  },
+
+  actions: {
+    async getPublicSetting() {
+      const res = await apiGetPublicSetting();
+      if(res.Ret !== 200) return
+      let filterObj = {}
+      let data = res.Data||[]
+      data.forEach(item => {
+        if(!filterObj[item.ConfKey]) {
+          filterObj[item.ConfKey] = item.ConfVal;
+        }
+      })
+      this.publicSetting = filterObj
+      console.log('a')
+    }
+  }
+})

+ 61 - 11
src/views/report/List.vue

@@ -1,5 +1,5 @@
 <script setup name="ReportList">
-import {computed, nextTick, reactive,ref} from 'vue'
+import {computed, nextTick, onMounted, reactive,ref} from 'vue'
 import apiReport from '@/api/report'
 import moment from 'moment'
 import ListClassify from './components/ListClassify.vue'
@@ -8,9 +8,13 @@ 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'
 const cachedViewsStore=useCachedViewsStore()
+const publicSettingStore = usePublicSettingStore()
+
+const isApprove = ref(false)
 
 const {checkAuthBtn} = useAuthBtn()
 
@@ -155,10 +159,25 @@ async function handleReportPublish(item){
         }
         return
     }
-
+    //如果走审批流 直接发布
+    if(isApprove.value){
+        publishReportApprove()
+        showReportItemOpt.value=false
+        return
+    }
     showPublishPop.value=true
     showReportItemOpt.value=false
 }
+function publishReportApprove(){
+    apiReport.reportPublish({
+        ReportIds:activeReportData.value.Id.toString()
+    }).then(res=>{
+        if(res.Ret!==200) return 
+        showToast('发布成功')
+        handlePublishPopClose('refresh')
+    })
+}
+
 
 // 发布弹窗关闭
 function handlePublishPopClose(refresh){
@@ -173,7 +192,7 @@ function handlePublishPopClose(refresh){
 function handleReportPublishCancle(item){
     showDialog({
         title: '提示',
-        message: `是否确认取消发布?`,
+        message: `是否确认取消${isApprove.value?'提交':'发布'}?`,
         showCancelButton:true
     }).then(()=>{
         apiReport.reportPublishCancle({ReportIds:Number(item.Id)}).then(res=>{
@@ -292,6 +311,25 @@ const publishStatusOpt=[
         value:1
     }
 ]
+const approveStatusOpt=[
+    {
+        label:'未提交',
+        value:1
+    },
+    {
+        label:'待审批',
+        value:2
+    },
+    {
+        label:'已审批',
+        value:4
+    },
+    {
+        label:'已驳回',
+        value:3
+    }
+]
+let statusOpt = publishStatusOpt
 function handleSelectReportStatus(item){
     if(temMsgIsSendVal.value==item.value){
         temMsgIsSendVal.value=''
@@ -406,6 +444,13 @@ 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
+})
+
 </script>
 
 <template>
@@ -488,12 +533,12 @@ async function handleReportEdit(e){
                         </div>
                     </div>
                 </van-dropdown-item>
-                <van-dropdown-item title="发布状态" ref="publishStatusDropMenuIns">
+                <van-dropdown-item :title="isApprove?'状态':'发布状态'" ref="publishStatusDropMenuIns">
                     <div class="report-status-box">
                         <ul>
                             <li 
                                 :class="['status-item',temPublishStatusVal===item.value?'active':'']" 
-                                v-for="item in publishStatusOpt" 
+                                v-for="item in statusOpt" 
                                 :key="item.value"
                                 @click="handleSelectReportPublishStatus(item)"
                             >{{item.label}}</li>
@@ -543,8 +588,10 @@ async function handleReportEdit(e){
                             <span v-permission="reportManageBtn.reportManage_reportList_uv">UV:{{item.Uv}}</span>
                         </div>
                         <div class="status">
-                            <span v-if="item.State===1">未发布</span>
-                            <span v-if="item.State===2" class="active-status">已发布</span>
+                            <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>
                         </div>
                     </div>
                 </li>
@@ -581,12 +628,15 @@ async function handleReportEdit(e){
             <!-- <div class="title">{{activeItem.Title}}</div> -->
             <template v-if="activeItem.State==1">
                 <div class="item" @click="handleReportEdit(activeItem)" v-permission="reportManageBtn.reportManage_reportEdit">编辑</div>
-                <div class="item" @click="handleReportPublish(activeItem)" v-permission="reportManageBtn.reportManage_publish">发布</div>
+                <div class="item" @click="handleReportPublish(activeItem)" v-permission="reportManageBtn.reportManage_publish">{{isApprove?'提交':'发布'}}</div>
                 <div class="item" @click="handleReportDel(activeItem)" v-permission="reportManageBtn.reportManage_reportDel">删除</div>
             </template>
-            <template v-if="activeItem.State==2">
+            <template v-if="[2,4].includes(activeItem.State)">
                 <div class="item" @click="handldReportMsgSend(activeItem)" v-if="activeItem.MsgIsSend==0&&checkAuthBtn(reportManageBtn.reportManage_sendMsg)">推送消息</div>
-                <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="reportManageBtn.reportManage_cancelPublish">取消发布</div>
+                <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="reportManageBtn.reportManage_cancelPublish">{{isApprove?'撤销':'取消发布'}}</div>
+            </template>
+            <template v-if="activeItem.State==3">
+                <div class="item" @click="handleReportPublishCancle(activeItem)" v-permission="reportManageBtn.reportManage_cancelPublish">撤销</div>
             </template>
         </div>
     </van-action-sheet>
@@ -633,7 +683,7 @@ async function handleReportEdit(e){
                     <span>日期选择</span>
                 </div>
                 <div class="time-type-box">
-                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">发布时间</span>
+                    <span @click="dateType=1" :class="['item',dateType===1?'active':'']">{{isApprove?'审批时间':'发布时间'}}</span>
                     <span @click="dateType=2" :class="['item',dateType===2?'active':'']">更新时间</span>
                 </div>
             </template>