li.shaoyi 2 år sedan
förälder
incheckning
e82827d061

+ 27 - 13
src/packages/pc/components/layouts/header/components/report/index.vue

@@ -1,6 +1,6 @@
 <!-- 交易商结算单 -->
 <template>
-    <app-drawer title="交易商结算单" :width="1000" v-model:show="show" :refresh="refresh" :show-close="false">
+    <app-drawer title="交易商结算单" :width="1000" v-model:show="show" :show-close="!!reportAgree[agreeIndex]?.isAgree">
         <div class="el-form--horizontal">
             <div class="el-form-item--col">
                 <el-select placeholder="请选择" v-model="reporttype" @change="onChange" style="width: 160px;">
@@ -42,17 +42,19 @@
             <app-table :data="tradedetails" v-model:columns="tradeDetailsTableColumns" />
         </fieldset>
         <template #footer>
-            <el-button type="info" @click="onDisAgree">不同意</el-button>
-            <el-button type="primary" @click="onAgree">同意</el-button>
+            <el-button type="info" @click="show = false" v-if="!!reportAgree[agreeIndex]?.isAgree">关闭</el-button>
+            <template v-else>
+                <el-button type="info" @click="onDisAgree">不同意</el-button>
+                <el-button type="primary" @click="onAgree">同意</el-button>
+            </template>
         </template>
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
 import { ref, shallowRef, computed } from 'vue'
-import { useRouter } from 'vue-router'
 import eventBus from '@/services/bus'
-import { useAccountStore, useUserStore } from '@/stores'
+import { useLoginStore, useAccountStore, useUserStore } from '@/stores'
 import { formatDate } from '@/filters'
 import { localData } from '@/stores/storage'
 import { onMounted } from 'vue'
@@ -62,8 +64,6 @@ import AppTable from '@pc/components/base/table/index.vue'
 import AppTableDetails from '@pc/components/base/table-details/index.vue'
 
 const show = ref(true)
-const refresh = ref(false)
-const router = useRouter()
 const loading = ref(false)
 /// 报表类型 日报表-1 月报表-2
 const reporttype = ref(1)
@@ -73,6 +73,7 @@ const cycletime = shallowRef(formatDate(new Date().toISOString(), 'YYYYMMDD'))
 const pickerType = computed(() => reporttype.value === 1 ? 'date' : 'month')
 const pickerFormat = computed(() => reporttype.value === 1 ? 'YYYYMMDD' : 'YYYYMM')
 
+const loginStore = useLoginStore()
 const currentAccount = useAccountStore().currentAccount
 const userInfo = useUserStore().userInfo
 
@@ -81,19 +82,32 @@ const logs = shallowRef<Model.ReportBankAccountOutInLogRsp[]>([])
 const dpostions = shallowRef<Model.ReportReckonDayPositionRsp[]>([])
 const tradedetails = shallowRef<Model.ReportTradeDetailRsp[]>([])
 
+const reportAgree = localData.getValue('reportAgree')
+const agreeIndex = reportAgree.findIndex((e) => e.loginId === loginStore.loginId)
+
 const onAgree = () => {
+    if (agreeIndex > -1) {
+        reportAgree[agreeIndex].isAgree = true
+        reportAgree[agreeIndex].agreedTime = new Date().toISOString()
+    } else {
+        reportAgree.push({
+            loginId: loginStore.loginId,
+            isAgree: true,
+            agreedTime: new Date().toISOString()
+        })
+    }
     /// 记录时间和是否同意
-    localData.setValue('isReportAgree', true)
-    localData.setValue('reportTime', new Date().toISOString())
+    localData.setValue('reportAgree', reportAgree)
     show.value = false
-    refresh.value = false
 }
 
 const onDisAgree = () => {
-    /// 记录时间和是否同意
-    localData.setValue('isReportAgree', false)
+    if (agreeIndex > -1) {
+        reportAgree.splice(agreeIndex, 1)
+        /// 记录时间和是否同意
+        localData.setValue('reportAgree', reportAgree)
+    }
     eventBus.$emit('LogoutNotify')
-    router.replace({ name: 'login' })
 }
 
 const reloadData = () => {

+ 5 - 2
src/packages/pc/components/layouts/header/index.vue

@@ -41,7 +41,7 @@ import { ref, onMounted, computed, defineAsyncComponent } from 'vue'
 import { SwitchButton, Unlock, Avatar } from '@element-plus/icons-vue'
 import { getFileUrl, diffDays } from '@/filters'
 import { useComponent } from '@/hooks/component'
-import { useUserStore, useGlobalStore, useNoticeStore } from '@/stores'
+import { useLoginStore, useUserStore, useGlobalStore, useNoticeStore } from '@/stores'
 import eventBus from '@/services/bus'
 import AppIcon from '@pc/components/base/icon/index.vue'
 import { localData } from '@/stores/storage'
@@ -56,6 +56,7 @@ const componentMap = new Map<string, unknown>([
 ])
 
 const { componentId, openComponent, closeComponent } = useComponent(undefined, false)
+const loginStore = useLoginStore()
 const globalStore = useGlobalStore()
 const userStore = useUserStore()
 const noticeStore = useNoticeStore()
@@ -78,8 +79,10 @@ const exitFullSreen = () => {
 }
 
 onMounted(() => {
+    const reportAgree = localData.getValue('reportAgree')
+    const userReportAgree = reportAgree.find((e) => e.loginId === loginStore.loginId)
     /// 如果未同意 或者跨天
-    if (!localData.getValue('isReportAgree') || diffDays(localData.getValue('reportTime')) > 0) {
+    if (!userReportAgree || diffDays(userReportAgree.agreedTime) > 0) {
         openComponent('report')
     }
     // 监听全屏变化

+ 1 - 2
src/stores/storage.ts

@@ -9,8 +9,7 @@ function createLocalData() {
         loginInfo: <Model.LoginRsp | undefined>undefined,
         autoLoginEncryptedData: '', // 自动登录加密数据
         settings: <Model.LocalSetting[]>([]),
-        reportTime: '', 
-        isReportAgree: false
+        reportAgree: <{ loginId: number; isAgree: boolean; agreedTime: string }[]>([]) // 结算单弹窗提示
     }
 }