yanghao 2 giorni fa
parent
commit
e6f14bdd12

+ 209 - 0
src/views/pms/qhse/reportSummary/data.json

@@ -0,0 +1,209 @@
+{
+  "code": 0,
+  "data": {
+    "list": [
+      {
+        "id": 5,
+        "title": "5#项目公司2026-05QHSE月报",
+        "yearMonths": "2026-05",
+        "deptId": 388,
+        "employee": "5",
+        "subcontractors": "3",
+        "drivingMileage": "5",
+        "totalManHours": "4",
+        "withoutAccident": "4",
+        "fatality": "4",
+        "injury": "3",
+        "restrictedCase": "4",
+        "medicalCase": "4",
+        "firstAidCase": "4",
+        "vehicleAccident": "3",
+        "nearMiss": "3",
+        "spill": "4",
+        "lifeSavingRules": "3",
+        "toolboxTalk": "4",
+        "committeeMeeting": "5",
+        "monthlyMeeting": "5",
+        "companyHazard": "4",
+        "qhseInspection": "5",
+        "socCards": "0",
+        "ptwAudit": "0",
+        "jsa": "0",
+        "drills": "3",
+        "training": "3",
+        "participantsTraining": "4",
+        "trainingsHours": "4",
+        "waterConsumption": "4",
+        "dieselConsumption": "4",
+        "electricityConsumption": "3",
+        "naturalGasConsumption": "2",
+        "remark": "hhhhhhhhhhh",
+        "dutyPerson": 1,
+        "createTime": 1782377575000,
+        "personName": "超级管理员"
+      },
+      {
+        "id": 4,
+        "title": "四川瑞都2026-05QHSE月报",
+        "yearMonths": "2026-05",
+        "deptId": 163,
+        "employee": "4",
+        "subcontractors": "4",
+        "drivingMileage": "4",
+        "totalManHours": "1",
+        "withoutAccident": "2",
+        "fatality": "3",
+        "injury": "4",
+        "restrictedCase": "4",
+        "medicalCase": "2",
+        "firstAidCase": "3",
+        "vehicleAccident": "4",
+        "nearMiss": "4",
+        "spill": "2",
+        "lifeSavingRules": "4",
+        "toolboxTalk": "4",
+        "committeeMeeting": "5",
+        "monthlyMeeting": "5",
+        "companyHazard": "4",
+        "qhseInspection": "4",
+        "socCards": "51",
+        "ptwAudit": "4",
+        "jsa": "27",
+        "drills": "2",
+        "training": "5",
+        "participantsTraining": "8",
+        "trainingsHours": "3",
+        "waterConsumption": "7",
+        "dieselConsumption": "3",
+        "electricityConsumption": "4",
+        "naturalGasConsumption": "4",
+        "remark": "她她她她她她她她她她她她",
+        "dutyPerson": 1,
+        "createTime": 1782377575000,
+        "personName": "超级管理员"
+      },
+      {
+        "id": 3,
+        "title": "瑞恒兴域2026-05QHSE月报",
+        "yearMonths": "2026-05",
+        "deptId": 157,
+        "employee": "3",
+        "subcontractors": "4",
+        "drivingMileage": "3",
+        "totalManHours": "3",
+        "withoutAccident": "4",
+        "fatality": "4",
+        "injury": "4",
+        "restrictedCase": "4",
+        "medicalCase": "4",
+        "firstAidCase": "3",
+        "vehicleAccident": "3",
+        "nearMiss": "4",
+        "spill": "4",
+        "lifeSavingRules": "3",
+        "toolboxTalk": "4",
+        "committeeMeeting": "3",
+        "monthlyMeeting": "2",
+        "companyHazard": "3",
+        "qhseInspection": "2",
+        "socCards": "0",
+        "ptwAudit": "0",
+        "jsa": "0",
+        "drills": "3",
+        "training": "4",
+        "participantsTraining": "4",
+        "trainingsHours": "4",
+        "waterConsumption": "2",
+        "dieselConsumption": "2",
+        "electricityConsumption": "1",
+        "naturalGasConsumption": "1",
+        "remark": null,
+        "dutyPerson": 1,
+        "createTime": 1782377575000,
+        "personName": "超级管理员"
+      },
+      {
+        "id": 2,
+        "title": "瑞鹰国际2026-05QHSE月报",
+        "yearMonths": "2026-05",
+        "deptId": 158,
+        "employee": "4",
+        "subcontractors": "3",
+        "drivingMileage": "3",
+        "totalManHours": "3",
+        "withoutAccident": "3",
+        "fatality": "3",
+        "injury": "2",
+        "restrictedCase": "1",
+        "medicalCase": "2",
+        "firstAidCase": "4",
+        "vehicleAccident": "2",
+        "nearMiss": "1",
+        "spill": "3",
+        "lifeSavingRules": "3",
+        "toolboxTalk": "2",
+        "committeeMeeting": "2",
+        "monthlyMeeting": "3",
+        "companyHazard": "2",
+        "qhseInspection": "3",
+        "socCards": "127",
+        "ptwAudit": "34",
+        "jsa": "46",
+        "drills": "3",
+        "training": "4",
+        "participantsTraining": "3",
+        "trainingsHours": "2",
+        "waterConsumption": "1",
+        "dieselConsumption": "1",
+        "electricityConsumption": "1",
+        "naturalGasConsumption": "1",
+        "remark": null,
+        "dutyPerson": 1,
+        "createTime": 1782377575000,
+        "personName": "超级管理员"
+      },
+      {
+        "id": 1,
+        "title": "科瑞石油技术",
+        "yearMonths": "2026-05",
+        "deptId": 156,
+        "employee": "4",
+        "subcontractors": "7",
+        "drivingMileage": "8",
+        "totalManHours": "3",
+        "withoutAccident": "5",
+        "fatality": "5",
+        "injury": "2",
+        "restrictedCase": "3",
+        "medicalCase": "4",
+        "firstAidCase": "3",
+        "vehicleAccident": "5",
+        "nearMiss": "3",
+        "spill": "4",
+        "lifeSavingRules": "3",
+        "toolboxTalk": "4",
+        "committeeMeeting": "4",
+        "monthlyMeeting": "1",
+        "companyHazard": "1",
+        "qhseInspection": "1",
+        "socCards": "178",
+        "ptwAudit": "38",
+        "jsa": "73",
+        "drills": "1",
+        "training": "1",
+        "participantsTraining": "1",
+        "trainingsHours": "1",
+        "waterConsumption": "3",
+        "dieselConsumption": "3",
+        "electricityConsumption": "3",
+        "naturalGasConsumption": "2",
+        "remark": null,
+        "dutyPerson": 1,
+        "createTime": 1782199003000,
+        "personName": "超级管理员"
+      }
+    ],
+    "total": 5
+  },
+  "msg": ""
+}

+ 3 - 12
src/views/pms/qhse/reportSummary/index.vue

@@ -9,7 +9,6 @@ const loading = ref(false)
 const list = ref<QhseMonthReportListItem[]>([])
 const total = ref(0)
 const visible = ref(false)
-const currentId = ref<number>()
 
 const queryFormRef = ref()
 const queryParams = reactive({
@@ -48,11 +47,9 @@ function resetQuery() {
   getList()
 }
 
+let yearMonths = ref<string | undefined>('')
 async function handleView(row: QhseMonthReportItem) {
-  const res = await QhseMonthReportSummaryApi.getQhseMonthReportSummary({
-    yearMonths: row.yearMonths
-  })
-  currentId.value = row.id
+  yearMonths.value = row.yearMonths
   visible.value = true
 }
 
@@ -67,12 +64,6 @@ function handleCurrentChange(pageNo: number) {
   getList()
 }
 
-function formatDate(value?: string | number | Date) {
-  if (!value) return '-'
-  const date = dayjs(value)
-  return date.isValid() ? date.format('YYYY-MM-DD') : '-'
-}
-
 onMounted(() => {
   getList()
 })
@@ -177,7 +168,7 @@ onMounted(() => {
 
   <QhseMonthReportPreviewDrawer
     v-model:visible="visible"
-    :id="currentId"
+    :yearMonths="yearMonths"
     @update:visible="visible = $event" />
 </template>
 

+ 12 - 8
src/views/pms/qhse/reportSummary/preview-drawer.vue

@@ -1,5 +1,5 @@
 <script lang="ts" setup>
-import { QhseMonthReportApi } from '@/api/pms/qhse'
+import { QhseMonthReportSummaryApi } from '@/api/pms/qhse'
 import type {
   QhseMonthReportItem,
   ReportCompanyColumn,
@@ -11,7 +11,7 @@ import { computed, ref, watch } from 'vue'
 
 interface Props {
   visible: boolean
-  id?: number
+  yearMonths: string | undefined
 }
 
 interface TableRow {
@@ -197,10 +197,13 @@ const tableRows = computed<TableRow[]>(() => {
   })
 })
 
-async function loadDetail(id: number) {
+async function loadDetail() {
   loading.value = true
   try {
-    const res = await QhseMonthReportApi.getQhseMonthReport(id)
+    const res = await QhseMonthReportSummaryApi.getQhseMonthReportSummary({
+      yearMonths: props.yearMonths
+    })
+
     report.value = ((res as any)?.data ?? res ?? {}) as QhseMonthReportItem
   } finally {
     loading.value = false
@@ -260,10 +263,11 @@ function tableSpanMethod({
 }
 
 watch(
-  () => [props.visible, props.id] as const,
-  ([visible, id]) => {
-    if (!visible || !id) return
-    loadDetail(id)
+  () => [props.visible, props.yearMonths] as const,
+  async ([visible, yearMonths], [previousVisible, previousYearMonths]) => {
+    if (!visible || !yearMonths) return
+    if (visible === previousVisible && yearMonths === previousYearMonths) return
+    await loadDetail()
   },
   { immediate: true }
 )