Explorar el Código

瑞恒日报修改按钮

yanghao hace 2 días
padre
commit
8107ffd760

+ 9 - 3
src/views/pms/constructionDailyReport/index.vue

@@ -1,6 +1,7 @@
 <script setup lang="ts">
 import { FiveIotProjectDailyReportApi } from '@/api/pms/fiveconstructiondailyreport'
 import { useUserStore } from '@/store/modules/user'
+import { resolveDailyReportDeptId } from '@/utils/dailyReportDept'
 import { rangeShortcuts } from '@/utils/formatTime'
 import { useDebounceFn } from '@vueuse/core'
 import dayjs from 'dayjs'
@@ -14,8 +15,10 @@ import type {
 defineOptions({ name: 'ConstructionDailyReport' })
 
 const userStore = useUserStore()
-const deptId = userStore.getUser.deptId
+const TOP_DEPT_ID = 388
+const deptId = resolveDailyReportDeptId(userStore.getUser.deptId, TOP_DEPT_ID)
 const route = useRoute()
+const pageRouteName = route.name
 
 const parseQueryNumber = (value: unknown) => {
   if (Array.isArray(value)) {
@@ -66,6 +69,8 @@ const visible = ref(false)
 const formRef = ref<InstanceType<typeof ConstructionDailyReportDrawer>>()
 
 function syncQueryFromRoute() {
+  if (route.name !== pageRouteName) return
+
   const nextQuery = createDefaultQuery()
   query.value = {
     ...query.value,
@@ -145,8 +150,9 @@ onMounted(() => {
     class="grid grid-cols-[auto_1fr] grid-rows-[62px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]">
     <DeptTreeSelect
       v-model="query.deptId"
-      :top-id="388"
-      :deptId="deptId"
+      :top-id="TOP_DEPT_ID"
+      :dept-id="deptId"
+      :init-select="false"
       :show-title="false"
       class="row-span-2" />
     <el-form

+ 10 - 3
src/views/pms/fiveDailyReportSummary/index.vue

@@ -5,12 +5,16 @@ import { FiveIotProjectDailyReportApi } from '@/api/pms/fiveconstructiondailyrep
 import { rangeShortcuts } from '@/utils/formatTime'
 import { useDebounceFn } from '@vueuse/core'
 import { useTableComponents } from '@/components/ZmTable/useTableComponents'
+import { useUserStore } from '@/store/modules/user'
+import { resolveDailyReportDeptId } from '@/utils/dailyReportDept'
 
 defineOptions({ name: 'FiveDailyReportSummary' })
 
 const route = useRoute()
+const pageRouteName = route.name
 const router = useRouter()
-const defaultDeptId = 388
+const TOP_DEPT_ID = 388
+const defaultDeptId = resolveDailyReportDeptId(useUserStore().getUser.deptId, TOP_DEPT_ID)
 const { ZmTable, ZmTableColumn } = useTableComponents()
 
 const summaryCards = [
@@ -87,6 +91,8 @@ const cardStatistics = ref({
 const deptColumnLabel = computed(() => (selectedDeptType.value === '1' ? '项目部' : '队伍'))
 
 const syncQueryFromRoute = () => {
+  if (route.name !== pageRouteName) return
+
   const createTime = route.query.createTime
 
   if (Array.isArray(createTime)) {
@@ -255,8 +261,9 @@ watch(
     class="grid grid-cols-[auto_1fr] grid-rows-[48px_44px_1fr] gap-3 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]">
     <DeptTreeSelect
       v-model="query.deptId"
-      :top-id="388"
-      :deptId="defaultDeptId"
+      :top-id="TOP_DEPT_ID"
+      :dept-id="defaultDeptId"
+      :init-select="false"
       :show-title="false"
       class="row-span-3"
       @node-click="handleDeptNodeClick" />