Forráskód Böngészése

✨ feat(日报): 日报汇总

Zimo 1 hete
szülő
commit
e5de2e1a66

+ 7 - 3
src/api/pms/iotrhdailyreport/index.ts

@@ -2,7 +2,7 @@ import request from '@/config/axios'
 
 // 瑞恒日报 VO
 export interface IotRhDailyReportVO {
-  createTime:number,
+  createTime: number
   id: number // 主键id
   deptId: number // 施工队伍id
   projectId: number // 项目id
@@ -24,7 +24,7 @@ export interface IotRhDailyReportVO {
   nextPlan: string // 下步工作计划
   constructionStatus: number // 施工状态(动迁 准备 施工 完工)
   personnel: string // 人员情况
-  capacity: number  // 产能
+  capacity: number // 产能
   totalGasInjection: number // 累计注气量(万方)
   totalWaterInjection: number // 累计注水量(方)
   cumulativeCompletion: number // 累计完工井次
@@ -43,6 +43,10 @@ export const IotRhDailyReportApi = {
     return await request.get({ url: `/pms/iot-rh-daily-report/page`, params })
   },
 
+  getIotRhDailyReportSummary: async (params: any) => {
+    return await request.get({ url: `/pms/iot-rh-daily-report/statistics`, params })
+  },
+
   // 累计工作量统计
   totalWorkload: async (params: any) => {
     return await request.get({ url: `/pms/iot-rh-daily-report/totalWorkload`, params })
@@ -86,5 +90,5 @@ export const IotRhDailyReportApi = {
   // 导出瑞恒日报 Excel
   exportIotRhDailyReport: async (params) => {
     return await request.download({ url: `/pms/iot-rh-daily-report/export-excel`, params })
-  },
+  }
 }

+ 22 - 8
src/api/pms/iotrydailyreport/index.ts

@@ -2,10 +2,10 @@ import request from '@/config/axios'
 
 // 瑞鹰日报 VO
 export interface IotRyDailyReportVO {
-  createTime:number,
-  transitTime:any,
-  totalStaffNum:any,
-  offDutyStaffNum:any,
+  createTime: number
+  transitTime: any
+  totalStaffNum: any
+  offDutyStaffNum: any
   id: number // 主键id
   deptId: number // 施工队伍id
   projectId: number // 项目id
@@ -30,9 +30,9 @@ export interface IotRyDailyReportVO {
   selfStopTime: number
   complexityTime: number
   relocationTime: number
-  rectificationTime:  number
-  waitingStopTime:  number
-  winterBreakTime:  number
+  rectificationTime: number
+  waitingStopTime: number
+  winterBreakTime: number
   constructionStartDate: Date // 施工开始日期
   constructionEndDate: Date // 施工结束日期
   productionStatus: string // 当日生产情况生产动态
@@ -59,6 +59,20 @@ export const IotRyDailyReportApi = {
     return await request.get({ url: `/pms/iot-ry-daily-report/page`, params })
   },
 
+  getIotRyDailyReportSummary: async (params: any) => {
+    return await request.get({ url: `/pms/iot-ry-daily-report/statistics`, params })
+  },
+
+  // 累计工作量统计
+  totalWorkload: async (params: any) => {
+    return await request.get({ url: `/pms/iot-ry-daily-report/totalWorkload`, params })
+  },
+
+  // 按照日期查询瑞恒日报统计数据 已填报 未填报 数量
+  ryDailyReportStatistics: async (params: any) => {
+    return await request.get({ url: `/pms/iot-ry-daily-report/ryDailyReportStatistics`, params })
+  },
+
   // 查询瑞鹰日报详情
   getIotRyDailyReport: async (id: number) => {
     return await request.get({ url: `/pms/iot-ry-daily-report/get?id=` + id })
@@ -82,5 +96,5 @@ export const IotRyDailyReportApi = {
   // 导出瑞鹰日报 Excel
   exportIotRyDailyReport: async (params) => {
     return await request.download({ url: `/pms/iot-ry-daily-report/export-excel`, params })
-  },
+  }
 }

+ 94 - 0
src/components/count-to1.vue

@@ -0,0 +1,94 @@
+<script setup lang="ts">
+import { TransitionPresets, useTransition } from '@vueuse/core'
+
+defineOptions({
+  name: 'FaCountTo'
+})
+
+const props = withDefaults(
+  defineProps<{
+    startVal: number
+    endVal: number
+    autoplay?: boolean
+    duration?: number
+    transition?: keyof typeof TransitionPresets
+    delay?: number
+    decimals?: number
+    separator?: string
+    prefix?: string
+    suffix?: string
+  }>(),
+  {
+    autoplay: true,
+    duration: 2000,
+    transition: 'linear',
+    delay: 0,
+    decimals: 0,
+    separator: ','
+  }
+)
+
+const emits = defineEmits<{
+  onStarted: []
+  onFinished: []
+}>()
+
+const disabled = ref(false)
+
+const source = ref(props.startVal)
+const outputValue = useTransition(source, {
+  duration: props.duration,
+  transition: TransitionPresets[props.transition],
+  delay: props.delay,
+  disabled,
+  onStarted: () => emits('onStarted'),
+  onFinished: () => emits('onFinished')
+})
+const value = computed(() => {
+  let val: number | string = unref(outputValue.value)
+  val = Number(val).toFixed(props.decimals)
+  if (props.separator) {
+    const [integer, decimal] = val.toString().split('.')
+    val = integer.replace(/\B(?=(\d{3})+(?!\d))/g, props.separator) + (decimal ? `.${decimal}` : '')
+  }
+  if (props.prefix) {
+    val = props.prefix + val
+  }
+  if (props.suffix) {
+    val = val + props.suffix
+  }
+  return val
+})
+
+function start() {
+  source.value = props.endVal
+}
+
+function reset() {
+  disabled.value = true
+  source.value = props.startVal
+  nextTick(() => {
+    disabled.value = false
+  })
+}
+
+watch([() => props.startVal, () => props.endVal], () => {
+  start()
+})
+
+onMounted(() => {
+  props.autoplay && start()
+})
+
+defineExpose({
+  start,
+  reset
+})
+</script>
+
+<template>
+  <span>
+    <span v-if="endVal">{{ value }}</span>
+    <slot v-else></slot>
+  </span>
+</template>

+ 42 - 34
src/views/pms/iotrhdailyreport/DeptTree2.vue

@@ -1,6 +1,12 @@
 <template>
-  <div class="head-container" style="display: flex;flex-direction: row;">
-    <el-input v-model="deptName" class="mb-18px" clearable placeholder="请输入部门名称">
+  <div class="head-container" style="display: flex; flex-direction: row">
+    <el-input
+      size="default"
+      v-model="deptName"
+      class="mb-18px"
+      clearable
+      placeholder="请输入部门名称"
+    >
       <template #prefix>
         <Icon icon="ep:search" />
       </template>
@@ -21,11 +27,7 @@
       style="height: 52em"
     />
   </div>
-  <div
-    v-show="menuVisible"
-    class="custom-menu"
-    :style="{ left: menuX + 'px', top: menuY + 'px' }"
-  >
+  <div v-show="menuVisible" class="custom-menu" :style="{ left: menuX + 'px', top: menuY + 'px' }">
     <ul>
       <li @click="handleMenuClick('add')">新增子节点</li>
       <li @click="handleMenuClick('edit')">重命名</li>
@@ -39,18 +41,17 @@ import { ElTree } from 'element-plus'
 import * as DeptApi from '@/api/system/dept'
 import { defaultProps, handleTree } from '@/utils/tree'
 import { useTreeStore } from '@/store/modules/usersTreeStore'
-import {specifiedSimpleDepts} from "@/api/system/dept";
 defineOptions({ name: 'DeptTree2' })
 
 const deptName = ref('')
 const deptList = ref<Tree[]>([]) // 树形结构
 const treeRef = ref<InstanceType<typeof ElTree>>()
-const menuVisible = ref(false);
-const menuX = ref(0);
-const menuY = ref(0);
+const menuVisible = ref(false)
+const menuX = ref(0)
+const menuY = ref(0)
 const firstLevelKeys = ref([])
-let selectedNode = null;
-const treeStore = useTreeStore();
+let selectedNode = null
+const treeStore = useTreeStore()
 
 // props 定义,接收 deptId 参数
 interface Props {
@@ -62,12 +63,12 @@ const props = withDefaults(defineProps<Props>(), {
 })
 
 const handleRightClick = (event, { node, data }) => {
-  event.preventDefault();
-  menuX.value = event.clientX;
-  menuY.value = event.clientY;
-  selectedNode = data; // 存储当前操作的节点数据 ‌:ml-citation{ref="7" data="citationList"}
+  event.preventDefault()
+  menuX.value = event.clientX
+  menuY.value = event.clientY
+  selectedNode = data // 存储当前操作的节点数据 ‌:ml-citation{ref="7" data="citationList"}
   //menuVisible.value = true;
-};
+}
 const treeContainer = ref(null)
 const setHeight = () => {
   if (!treeContainer.value) return
@@ -76,25 +77,25 @@ const setHeight = () => {
   treeContainer.value.style.height = `${windowHeight * 0.78}px` // 60px 底部预留
 }
 const handleMenuClick = (action) => {
-  switch(action) {
+  switch (action) {
     case 'add':
       // 调用新增节点逻辑 ‌:ml-citation{ref="4" data="citationList"}
-      break;
+      break
     case 'edit':
       // 调用编辑节点逻辑 ‌:ml-citation{ref="7" data="citationList"}
-      break;
+      break
     case 'delete':
       // 调用删除节点逻辑 ‌:ml-citation{ref="4" data="citationList"}
-      break;
+      break
   }
-  menuVisible.value = false;
-};
+  menuVisible.value = false
+}
 /** 获得部门树 */
 const getTree = async () => {
   const res = await DeptApi.specifiedSimpleDepts(props.deptId)
   deptList.value = []
   deptList.value.push(...handleTree(res))
-  firstLevelKeys.value = deptList.value.map(node => node.id);
+  firstLevelKeys.value = deptList.value.map((node) => node.id)
 }
 
 /** 基于名字过滤 */
@@ -106,7 +107,7 @@ const filterNode = (name: string, data: Tree) => {
 /** 处理部门被点击 */
 const handleNodeClick = async (row: { [key: string]: any }) => {
   emits('node-click', row)
-  treeStore.setSelectedId(row.id);
+  treeStore.setSelectedId(row.id)
 }
 const emits = defineEmits(['node-click'])
 
@@ -116,11 +117,14 @@ watch(deptName, (val) => {
 })
 
 // 监听 deptId 变化,当父组件改变 deptId 时重新加载树
-watch(() => props.deptId, (newVal, oldVal) => {
-  if (newVal !== oldVal) {
-    getTree()
+watch(
+  () => props.deptId,
+  (newVal, oldVal) => {
+    if (newVal !== oldVal) {
+      getTree()
+    }
   }
-})
+)
 
 /** 初始化 */
 onMounted(async () => {
@@ -135,26 +139,30 @@ onUnmounted(() => {
 <style lang="scss" scoped>
 .custom-menu {
   position: fixed;
+  z-index: 1000;
   background: white;
   border: 1px solid #ccc;
-  box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
-  z-index: 1000;
+  box-shadow: 2px 2px 5px rgb(0 0 0 / 10%);
 }
+
 .custom-menu ul {
-  list-style: none;
   padding: 0;
   margin: 0;
+  list-style: none;
 }
+
 .custom-menu li {
   padding: 8px 20px;
   cursor: pointer;
 }
+
 .custom-menu li:hover {
   background: #f5f5f5;
 }
+
 .tree-container {
-  overflow-y: auto;
   min-width: 100%;
+  overflow-y: auto;
   border: 1px solid #e4e7ed;
   border-radius: 4px;
 }

+ 416 - 0
src/views/pms/iotrhdailyreport/summary.vue

@@ -0,0 +1,416 @@
+<script setup lang="ts">
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+import dayjs from 'dayjs'
+import { IotRhDailyReportApi } from '@/api/pms/iotrhdailyreport'
+import { useDebounceFn } from '@vueuse/core'
+import CountTo from '@/components/count-to1.vue'
+
+dayjs.extend(quarterOfYear)
+
+const rangeShortcuts = [
+  {
+    text: '今天',
+    value: () => {
+      const today = dayjs()
+      return [today.startOf('day').toDate(), today.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '昨天',
+    value: () => {
+      const yesterday = dayjs().subtract(1, 'day')
+      return [yesterday.startOf('day').toDate(), yesterday.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '本周',
+    value: () => {
+      return [dayjs().startOf('week').toDate(), dayjs().endOf('week').toDate()]
+    }
+  },
+  {
+    text: '上周',
+    value: () => {
+      const lastWeek = dayjs().subtract(1, 'week')
+      return [lastWeek.startOf('week').toDate(), lastWeek.endOf('week').toDate()]
+    }
+  },
+  {
+    text: '本月',
+    value: () => {
+      return [dayjs().startOf('month').toDate(), dayjs().endOf('month').toDate()]
+    }
+  },
+  {
+    text: '上月',
+    value: () => {
+      const lastMonth = dayjs().subtract(1, 'month')
+      return [lastMonth.startOf('month').toDate(), lastMonth.endOf('month').toDate()]
+    }
+  },
+  {
+    text: '本季度',
+    value: () => {
+      return [dayjs().startOf('quarter').toDate(), dayjs().endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '上季度',
+    value: () => {
+      const lastQuarter = dayjs().subtract(1, 'quarter')
+      return [lastQuarter.startOf('quarter').toDate(), lastQuarter.endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '今年',
+    value: () => {
+      return [dayjs().startOf('year').toDate(), dayjs().endOf('year').toDate()]
+    }
+  },
+  {
+    text: '去年',
+    value: () => {
+      const lastYear = dayjs().subtract(1, 'year')
+      return [lastYear.startOf('year').toDate(), lastYear.endOf('year').toDate()]
+    }
+  },
+  {
+    text: '最近7天',
+    value: () => {
+      return [dayjs().subtract(6, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近30天',
+    value: () => {
+      return [dayjs().subtract(29, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近90天',
+    value: () => {
+      return [dayjs().subtract(89, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近一年',
+    value: () => {
+      return [dayjs().subtract(1, 'year').toDate(), dayjs().toDate()]
+    }
+  }
+]
+
+interface Query {
+  pageNo: number
+  pageSize: number
+  deptId: number
+  contractName?: string
+  taskName?: string
+  createTime: string[]
+}
+
+const id = 157
+
+const query = ref<Query>({
+  pageNo: 1,
+  pageSize: 10,
+  deptId: 157,
+  createTime: []
+})
+
+const totalWorkKeys = [
+  ['totalCount', '个', '总数', 'i-tabler:report-analytics text-sky'],
+  [
+    'alreadyReported',
+    '个',
+    '已填报',
+    'i-material-symbols:check-circle-outline-rounded text-emerald'
+  ],
+  ['notReported', '个', '未填报', 'i-material-symbols:cancel-outline-rounded text-rose'],
+  [
+    'totalFuelConsumption',
+    '吨',
+    '累计油耗',
+    'i-material-symbols:directions-car-outline-rounded text-sky'
+  ],
+  [
+    'totalPowerConsumption',
+    'KWH',
+    '累计用电量',
+    'i-material-symbols:electric-bolt-outline-rounded text-sky'
+  ],
+  [
+    'totalWaterInjection',
+    '方',
+    '累计注水量',
+    'i-material-symbols:water-drop-outline-rounded text-sky'
+  ],
+  ['totalGasInjection', '万方', '累计注气量', 'i-material-symbols:cloud-outline text-sky']
+]
+
+const totalWork = ref({
+  totalCount: 0,
+  alreadyReported: 0,
+  notReported: 0,
+  totalFuelConsumption: 0,
+  totalPowerConsumption: 0,
+  totalWaterInjection: 0,
+  totalGasInjection: 0
+})
+
+const totalLoading = ref(false)
+
+const getTotal = useDebounceFn(async () => {
+  totalLoading.value = true
+
+  const { pageNo, pageSize, ...other } = query.value
+
+  try {
+    let res1: any[]
+    if (query.value.createTime.length !== 0) {
+      res1 = await IotRhDailyReportApi.rhDailyReportStatistics({
+        createTime: query.value.createTime
+      })
+
+      totalWork.value.totalCount = res1[0].count
+      totalWork.value.alreadyReported = res1[1].count
+      totalWork.value.notReported = res1[2].count
+    }
+
+    const res2 = await IotRhDailyReportApi.totalWorkload(other)
+
+    totalWork.value = {
+      ...totalWork.value,
+      ...res2,
+      totalGasInjection: (res2.totalGasInjection || 0) / 10000
+    }
+  } finally {
+    totalLoading.value = false
+  }
+}, 1000)
+
+interface List {
+  id: number | null
+  name: string | null
+  type: '1' | '2' | '3'
+  cumulativeGasInjection: number | null
+  cumulativeWaterInjection: number | null
+  cumulativePowerConsumption: number | null
+  cumulativeFuelConsumption: number | null
+  transitTime: number | null
+}
+
+const total = ref<number>(1000)
+
+const list = ref<List[]>([])
+
+const type = ref('2')
+
+const columns = (type: string) => {
+  return [
+    {
+      label: type === '2' ? '项目部' : '队伍',
+      prop: 'name'
+    },
+    {
+      label: '累计注气量(万方)',
+      prop: 'cumulativeGasInjection'
+    },
+    {
+      label: '累计注水量(方)',
+      prop: 'cumulativeWaterInjection'
+    },
+    {
+      label: '累计用电量(KWH)',
+      prop: 'cumulativePowerConsumption'
+    },
+    {
+      label: '累计油耗(吨)',
+      prop: 'cumulativeFuelConsumption'
+    }
+  ]
+}
+
+const listLoading = ref(false)
+
+const formatter = (row: List, column: any) => {
+  return row[column.property] ?? 0
+}
+
+const getList = useDebounceFn(async () => {
+  listLoading.value = true
+  try {
+    const res = (await IotRhDailyReportApi.getIotRhDailyReportSummary(query.value)) as {
+      total: number
+      list: any[]
+    }
+
+    const { total: resTotal, list: resList } = res
+
+    total.value = resTotal
+
+    type.value = resList[0]?.type || '2'
+
+    list.value = resList.map(
+      ({ id, projectDeptIa, projectDeptName, teamId, teamName, sort, taskId, type, ...other }) => ({
+        id: type === '2' ? projectDeptIa : teamId,
+        name: type === '2' ? projectDeptName : teamName,
+        ...other,
+        cumulativeGasInjection: (other.cumulativeGasInjection || 0) / 10000
+      })
+    )
+  } finally {
+    listLoading.value = false
+  }
+}, 1000)
+
+const handleDeptNodeClick = (node: any) => {
+  query.value.deptId = node.id
+  handleQuery()
+}
+
+const handleQuery = (setPage = true) => {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  getTotal()
+  getList()
+}
+
+const resetQuery = () => {
+  query.value = {
+    pageNo: 1,
+    pageSize: 10,
+    deptId: 157,
+    contractName: '',
+    taskName: '',
+    createTime: []
+  }
+  handleQuery()
+}
+
+watch(
+  () => query.value.createTime,
+  () => handleQuery(false)
+)
+
+onMounted(() => {
+  handleQuery()
+})
+</script>
+
+<template>
+  <div class="grid grid-cols-[16%_1fr] gap-5">
+    <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4">
+      <DeptTree2 :deptId="id" @node-click="handleDeptNodeClick" />
+    </div>
+    <div class="grid grid-rows-[62px_164px_1fr] h-full gap-5">
+      <el-form
+        size="default"
+        class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
+      >
+        <div class="flex items-center gap-8">
+          <el-form-item label="项目">
+            <el-input
+              v-model="query.contractName"
+              placeholder="请输入项目"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="任务">
+            <el-input
+              v-model="query.taskName"
+              placeholder="请输入任务"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="创建时间">
+            <el-date-picker
+              v-model="query.createTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :shortcuts="rangeShortcuts"
+              class="!w-220px"
+            />
+          </el-form-item>
+        </div>
+        <el-form-item>
+          <el-button type="primary" @click="handleQuery()">
+            <Icon icon="ep:search" class="mr-5px" /> 搜索
+          </el-button>
+          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        </el-form-item>
+      </el-form>
+      <div class="grid grid-cols-7 gap-8">
+        <div
+          v-for="info in totalWorkKeys"
+          :key="info[0]"
+          class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4 flex flex-col items-center justify-center gap-2"
+        >
+          <div class="size-7.5" :class="info[3]"></div>
+          <count-to class="text-2xl font-medium" :start-val="0" :end-val="totalWork[info[0]]">
+            <span>—</span>
+          </count-to>
+          <div class="text-xs font-medium text-[var(--el-text-color-regular)]">{{ info[1] }}</div>
+          <div class="text-sm font-medium text-[var(--el-text-color-regular)]">{{ info[2] }}</div>
+        </div>
+      </div>
+      <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow pt-4 px-8">
+        <el-table
+          v-loading="listLoading"
+          :data="list"
+          :stripe="true"
+          :style="{ width: '100%' }"
+          max-height="600"
+          class="min-h-143"
+          show-overflow-tooltip
+        >
+          <el-table-column
+            v-for="item in columns(type)"
+            :key="item.prop"
+            :label="item.label"
+            :prop="item.prop"
+            align="center"
+            :formatter="formatter"
+          />
+        </el-table>
+
+        <Pagination
+          class="mt-8"
+          :total="total"
+          v-model:page="query.pageNo"
+          v-model:limit="query.pageSize"
+          @pagination="getList"
+        />
+      </div>
+    </div>
+  </div>
+</template>
+
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
+}
+
+:deep(.el-table) {
+  border-top-right-radius: 8px;
+  border-top-left-radius: 8px;
+
+  .el-table__cell {
+    height: 52px;
+  }
+
+  .el-table__header-wrapper {
+    .el-table__cell {
+      background: var(--el-fill-color-light);
+    }
+  }
+}
+</style>

+ 406 - 0
src/views/pms/iotrydailyreport/summary.vue

@@ -0,0 +1,406 @@
+<script setup lang="ts">
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+import dayjs from 'dayjs'
+import { IotRyDailyReportApi } from '@/api/pms/iotrydailyreport'
+import { useDebounceFn } from '@vueuse/core'
+import CountTo from '@/components/count-to1.vue'
+
+dayjs.extend(quarterOfYear)
+
+const rangeShortcuts = [
+  {
+    text: '今天',
+    value: () => {
+      const today = dayjs()
+      return [today.startOf('day').toDate(), today.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '昨天',
+    value: () => {
+      const yesterday = dayjs().subtract(1, 'day')
+      return [yesterday.startOf('day').toDate(), yesterday.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '本周',
+    value: () => {
+      return [dayjs().startOf('week').toDate(), dayjs().endOf('week').toDate()]
+    }
+  },
+  {
+    text: '上周',
+    value: () => {
+      const lastWeek = dayjs().subtract(1, 'week')
+      return [lastWeek.startOf('week').toDate(), lastWeek.endOf('week').toDate()]
+    }
+  },
+  {
+    text: '本月',
+    value: () => {
+      return [dayjs().startOf('month').toDate(), dayjs().endOf('month').toDate()]
+    }
+  },
+  {
+    text: '上月',
+    value: () => {
+      const lastMonth = dayjs().subtract(1, 'month')
+      return [lastMonth.startOf('month').toDate(), lastMonth.endOf('month').toDate()]
+    }
+  },
+  {
+    text: '本季度',
+    value: () => {
+      return [dayjs().startOf('quarter').toDate(), dayjs().endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '上季度',
+    value: () => {
+      const lastQuarter = dayjs().subtract(1, 'quarter')
+      return [lastQuarter.startOf('quarter').toDate(), lastQuarter.endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '今年',
+    value: () => {
+      return [dayjs().startOf('year').toDate(), dayjs().endOf('year').toDate()]
+    }
+  },
+  {
+    text: '去年',
+    value: () => {
+      const lastYear = dayjs().subtract(1, 'year')
+      return [lastYear.startOf('year').toDate(), lastYear.endOf('year').toDate()]
+    }
+  },
+  {
+    text: '最近7天',
+    value: () => {
+      return [dayjs().subtract(6, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近30天',
+    value: () => {
+      return [dayjs().subtract(29, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近90天',
+    value: () => {
+      return [dayjs().subtract(89, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近一年',
+    value: () => {
+      return [dayjs().subtract(1, 'year').toDate(), dayjs().toDate()]
+    }
+  }
+]
+
+interface Query {
+  pageNo: number
+  pageSize: number
+  deptId: number
+  contractName?: string
+  taskName?: string
+  createTime: string[]
+  projectClassification: 1 | 2
+}
+
+const id = 158
+
+const query = ref<Query>({
+  pageNo: 1,
+  pageSize: 10,
+  deptId: 158,
+  createTime: [],
+  projectClassification: 1
+})
+
+const totalWorkKeys = [
+  ['totalCount', '个', '总数', 'i-tabler:report-analytics text-sky'],
+  [
+    'alreadyReported',
+    '个',
+    '已填报',
+    'i-material-symbols:check-circle-outline-rounded text-emerald'
+  ],
+  ['notReported', '个', '未填报', 'i-material-symbols:cancel-outline-rounded text-rose'],
+  [
+    'totalFuelConsumption',
+    '吨',
+    '累计油耗',
+    'i-material-symbols:directions-car-outline-rounded text-sky'
+  ],
+  [
+    'totalPowerConsumption',
+    'KWH',
+    '累计用电量',
+    'i-material-symbols:electric-bolt-outline-rounded text-sky'
+  ],
+  ['totalFootage', 'M', '累计进尺', 'i-solar:ruler-bold text-sky']
+]
+
+const totalWork = ref({
+  totalCount: 0,
+  alreadyReported: 0,
+  notReported: 0,
+  totalFuelConsumption: 0,
+  totalPowerConsumption: 0,
+  totalFootage: 0
+})
+
+const totalLoading = ref(false)
+
+const getTotal = useDebounceFn(async () => {
+  totalLoading.value = true
+
+  const { pageNo, pageSize, ...other } = query.value
+
+  try {
+    let res1: any[]
+    if (query.value.createTime.length !== 0) {
+      res1 = await IotRyDailyReportApi.ryDailyReportStatistics({
+        createTime: query.value.createTime,
+        projectClassification: query.value.projectClassification
+      })
+
+      totalWork.value.totalCount = res1[0].count
+      totalWork.value.alreadyReported = res1[1].count
+      totalWork.value.notReported = res1[2].count
+    }
+
+    const res2 = await IotRyDailyReportApi.totalWorkload(other)
+
+    totalWork.value = {
+      ...totalWork.value,
+      ...res2,
+      totalGasInjection: (res2.totalGasInjection || 0) / 10000
+    }
+  } finally {
+    totalLoading.value = false
+  }
+}, 1000)
+
+interface List {
+  id: number | null
+  name: string | null
+  type: '1' | '2' | '3'
+  cumulativeGasInjection: number | null
+  cumulativeWaterInjection: number | null
+  cumulativePowerConsumption: number | null
+  cumulativeFuelConsumption: number | null
+  transitTime: number | null
+}
+
+const total = ref<number>(1000)
+
+const list = ref<List[]>([])
+
+const type = ref('2')
+
+const columns = (type: string) => {
+  return [
+    {
+      label: type === '2' ? '项目部' : '队伍',
+      prop: 'name'
+    },
+    {
+      label: '累计进尺(M)',
+      prop: 'cumulativeFootage'
+    },
+    {
+      label: '累计用电量(KWH)',
+      prop: 'cumulativePowerConsumption'
+    },
+    {
+      label: '累计油耗(吨)',
+      prop: 'cumulativeFuelConsumption'
+    }
+  ]
+}
+
+const listLoading = ref(false)
+
+const formatter = (row: List, column: any) => {
+  return row[column.property] ?? 0
+}
+
+const getList = useDebounceFn(async () => {
+  listLoading.value = true
+  try {
+    const res = (await IotRyDailyReportApi.getIotRyDailyReportSummary(query.value)) as {
+      total: number
+      list: any[]
+    }
+
+    const { total: resTotal, list: resList } = res
+
+    total.value = resTotal
+
+    type.value = resList[0]?.type || '2'
+
+    list.value = resList.map(
+      ({ id, projectDeptIa, projectDeptName, teamId, teamName, sort, taskId, type, ...other }) => ({
+        id: type === '2' ? projectDeptIa : teamId,
+        name: type === '2' ? projectDeptName : teamName,
+        ...other
+      })
+    )
+  } finally {
+    listLoading.value = false
+  }
+}, 1000)
+
+const handleDeptNodeClick = (node: any) => {
+  query.value.deptId = node.id
+  handleQuery()
+}
+
+const handleQuery = (setPage = true) => {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  getTotal()
+  getList()
+}
+
+const resetQuery = () => {
+  query.value = {
+    pageNo: 1,
+    pageSize: 10,
+    deptId: 157,
+    createTime: [],
+    projectClassification: 1
+  }
+  handleQuery()
+}
+
+watch(
+  () => query.value.createTime,
+  () => handleQuery(false)
+)
+
+onMounted(() => {
+  handleQuery()
+})
+</script>
+
+<template>
+  <div class="grid grid-cols-[16%_1fr] gap-5">
+    <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4">
+      <DeptTree2 :deptId="id" @node-click="handleDeptNodeClick" />
+    </div>
+    <div class="grid grid-rows-[62px_164px_1fr] h-full gap-5">
+      <el-form
+        size="default"
+        class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
+      >
+        <div class="flex items-center gap-8">
+          <el-form-item label="项目">
+            <el-input
+              v-model="query.contractName"
+              placeholder="请输入项目"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="任务">
+            <el-input
+              v-model="query.taskName"
+              placeholder="请输入任务"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="创建时间">
+            <el-date-picker
+              v-model="query.createTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :shortcuts="rangeShortcuts"
+              class="!w-220px"
+            />
+          </el-form-item>
+        </div>
+        <el-form-item>
+          <el-button type="primary" @click="handleQuery()">
+            <Icon icon="ep:search" class="mr-5px" /> 搜索
+          </el-button>
+          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        </el-form-item>
+      </el-form>
+      <div class="grid grid-cols-6 gap-8">
+        <div
+          v-for="info in totalWorkKeys"
+          :key="info[0]"
+          class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4 flex flex-col items-center justify-center gap-2"
+        >
+          <div class="size-7.5" :class="info[3]"></div>
+          <count-to class="text-2xl font-medium" :start-val="0" :end-val="totalWork[info[0]]">
+            <span>—</span>
+          </count-to>
+          <div class="text-xs font-medium text-[var(--el-text-color-regular)]">{{ info[1] }}</div>
+          <div class="text-sm font-medium text-[var(--el-text-color-regular)]">{{ info[2] }}</div>
+        </div>
+      </div>
+      <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow pt-4 px-8">
+        <el-table
+          v-loading="listLoading"
+          :data="list"
+          :stripe="true"
+          :style="{ width: '100%' }"
+          max-height="600"
+          class="min-h-143"
+          show-overflow-tooltip
+        >
+          <el-table-column
+            v-for="item in columns(type)"
+            :key="item.prop"
+            :label="item.label"
+            :prop="item.prop"
+            align="center"
+            :formatter="formatter"
+          />
+        </el-table>
+
+        <Pagination
+          class="mt-8"
+          :total="total"
+          v-model:page="query.pageNo"
+          v-model:limit="query.pageSize"
+          @pagination="getList"
+        />
+      </div>
+    </div>
+  </div>
+</template>
+
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
+}
+
+:deep(.el-table) {
+  border-top-right-radius: 8px;
+  border-top-left-radius: 8px;
+
+  .el-table__cell {
+    height: 52px;
+  }
+
+  .el-table__header-wrapper {
+    .el-table__cell {
+      background: var(--el-fill-color-light);
+    }
+  }
+}
+</style>

+ 411 - 0
src/views/pms/iotrydailyreport/xsummary.vue

@@ -0,0 +1,411 @@
+<script setup lang="ts">
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+import dayjs from 'dayjs'
+import { IotRyDailyReportApi } from '@/api/pms/iotrydailyreport'
+import { useDebounceFn } from '@vueuse/core'
+import CountTo from '@/components/count-to1.vue'
+
+dayjs.extend(quarterOfYear)
+
+const rangeShortcuts = [
+  {
+    text: '今天',
+    value: () => {
+      const today = dayjs()
+      return [today.startOf('day').toDate(), today.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '昨天',
+    value: () => {
+      const yesterday = dayjs().subtract(1, 'day')
+      return [yesterday.startOf('day').toDate(), yesterday.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '本周',
+    value: () => {
+      return [dayjs().startOf('week').toDate(), dayjs().endOf('week').toDate()]
+    }
+  },
+  {
+    text: '上周',
+    value: () => {
+      const lastWeek = dayjs().subtract(1, 'week')
+      return [lastWeek.startOf('week').toDate(), lastWeek.endOf('week').toDate()]
+    }
+  },
+  {
+    text: '本月',
+    value: () => {
+      return [dayjs().startOf('month').toDate(), dayjs().endOf('month').toDate()]
+    }
+  },
+  {
+    text: '上月',
+    value: () => {
+      const lastMonth = dayjs().subtract(1, 'month')
+      return [lastMonth.startOf('month').toDate(), lastMonth.endOf('month').toDate()]
+    }
+  },
+  {
+    text: '本季度',
+    value: () => {
+      return [dayjs().startOf('quarter').toDate(), dayjs().endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '上季度',
+    value: () => {
+      const lastQuarter = dayjs().subtract(1, 'quarter')
+      return [lastQuarter.startOf('quarter').toDate(), lastQuarter.endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '今年',
+    value: () => {
+      return [dayjs().startOf('year').toDate(), dayjs().endOf('year').toDate()]
+    }
+  },
+  {
+    text: '去年',
+    value: () => {
+      const lastYear = dayjs().subtract(1, 'year')
+      return [lastYear.startOf('year').toDate(), lastYear.endOf('year').toDate()]
+    }
+  },
+  {
+    text: '最近7天',
+    value: () => {
+      return [dayjs().subtract(6, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近30天',
+    value: () => {
+      return [dayjs().subtract(29, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近90天',
+    value: () => {
+      return [dayjs().subtract(89, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近一年',
+    value: () => {
+      return [dayjs().subtract(1, 'year').toDate(), dayjs().toDate()]
+    }
+  }
+]
+
+interface Query {
+  pageNo: number
+  pageSize: number
+  deptId: number
+  contractName?: string
+  taskName?: string
+  createTime: string[]
+  projectClassification: 1 | 2
+}
+
+const id = 158
+
+const query = ref<Query>({
+  pageNo: 1,
+  pageSize: 10,
+  deptId: 158,
+  createTime: [],
+  projectClassification: 2
+})
+
+const totalWorkKeys = [
+  ['totalCount', '个', '总数', 'i-tabler:report-analytics text-sky'],
+  [
+    'alreadyReported',
+    '个',
+    '已填报',
+    'i-material-symbols:check-circle-outline-rounded text-emerald'
+  ],
+  ['notReported', '个', '未填报', 'i-material-symbols:cancel-outline-rounded text-rose'],
+  [
+    'totalFuelConsumption',
+    '吨',
+    '累计油耗',
+    'i-material-symbols:directions-car-outline-rounded text-sky'
+  ],
+  [
+    'totalPowerConsumption',
+    'KWH',
+    '累计用电量',
+    'i-material-symbols:electric-bolt-outline-rounded text-sky'
+  ],
+  ['constructionWells', '个', '累计施工井数', 'i-mdi:progress-wrench text-sky'],
+  ['completedWells', '个', '累计完工井数', 'i-mdi:wrench-check-outline text-emerald']
+]
+
+const totalWork = ref({
+  totalCount: 0,
+  alreadyReported: 0,
+  notReported: 0,
+  totalFuelConsumption: 0,
+  totalPowerConsumption: 0,
+  constructionWells: 0,
+  completedWells: 0
+})
+
+const totalLoading = ref(false)
+
+const getTotal = useDebounceFn(async () => {
+  totalLoading.value = true
+
+  const { pageNo, pageSize, ...other } = query.value
+
+  try {
+    let res1: any[]
+    if (query.value.createTime.length !== 0) {
+      res1 = await IotRyDailyReportApi.ryDailyReportStatistics({
+        createTime: query.value.createTime,
+        projectClassification: query.value.projectClassification
+      })
+
+      totalWork.value.totalCount = res1[0].count
+      totalWork.value.alreadyReported = res1[1].count
+      totalWork.value.notReported = res1[2].count
+    }
+
+    const res2 = await IotRyDailyReportApi.totalWorkload(other)
+
+    totalWork.value = {
+      ...totalWork.value,
+      ...res2
+    }
+  } finally {
+    totalLoading.value = false
+  }
+}, 1000)
+
+interface List {
+  id: number | null
+  name: string | null
+  type: '1' | '2' | '3'
+  cumulativeGasInjection: number | null
+  cumulativeWaterInjection: number | null
+  cumulativePowerConsumption: number | null
+  cumulativeFuelConsumption: number | null
+  transitTime: number | null
+}
+
+const total = ref<number>(1000)
+
+const list = ref<List[]>([])
+
+const type = ref('2')
+
+const columns = (type: string) => {
+  return [
+    {
+      label: type === '2' ? '项目部' : '队伍',
+      prop: 'name'
+    },
+    {
+      label: '累计施工井数',
+      prop: 'constructionWells'
+    },
+    {
+      label: '累计完工井数',
+      prop: 'completedWells'
+    },
+    {
+      label: '累计用电量(KWH)',
+      prop: 'cumulativePowerConsumption'
+    },
+    {
+      label: '累计油耗(吨)',
+      prop: 'cumulativeFuelConsumption'
+    }
+  ]
+}
+
+const listLoading = ref(false)
+
+const formatter = (row: List, column: any) => {
+  return row[column.property] ?? 0
+}
+
+const getList = useDebounceFn(async () => {
+  listLoading.value = true
+  try {
+    const res = (await IotRyDailyReportApi.getIotRyDailyReportSummary(query.value)) as {
+      total: number
+      list: any[]
+    }
+
+    const { total: resTotal, list: resList } = res
+
+    total.value = resTotal
+
+    type.value = resList[0]?.type || '2'
+
+    list.value = resList.map(
+      ({ id, projectDeptIa, projectDeptName, teamId, teamName, sort, taskId, type, ...other }) => ({
+        id: type === '2' ? projectDeptIa : teamId,
+        name: type === '2' ? projectDeptName : teamName,
+        ...other
+      })
+    )
+  } finally {
+    listLoading.value = false
+  }
+}, 1000)
+
+const handleDeptNodeClick = (node: any) => {
+  query.value.deptId = node.id
+  handleQuery()
+}
+
+const handleQuery = (setPage = true) => {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  getTotal()
+  getList()
+}
+
+const resetQuery = () => {
+  query.value = {
+    pageNo: 1,
+    pageSize: 10,
+    deptId: 157,
+    createTime: [],
+    projectClassification: 1
+  }
+  handleQuery()
+}
+
+watch(
+  () => query.value.createTime,
+  () => handleQuery(false)
+)
+
+onMounted(() => {
+  handleQuery()
+})
+</script>
+
+<template>
+  <div class="grid grid-cols-[16%_1fr] gap-5">
+    <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4">
+      <DeptTree2 :deptId="id" @node-click="handleDeptNodeClick" />
+    </div>
+    <div class="grid grid-rows-[62px_164px_1fr] h-full gap-5">
+      <el-form
+        size="default"
+        class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
+      >
+        <div class="flex items-center gap-8">
+          <el-form-item label="项目">
+            <el-input
+              v-model="query.contractName"
+              placeholder="请输入项目"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="任务">
+            <el-input
+              v-model="query.taskName"
+              placeholder="请输入任务"
+              clearable
+              @keyup.enter="handleQuery()"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="创建时间">
+            <el-date-picker
+              v-model="query.createTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :shortcuts="rangeShortcuts"
+              class="!w-220px"
+            />
+          </el-form-item>
+        </div>
+        <el-form-item>
+          <el-button type="primary" @click="handleQuery()">
+            <Icon icon="ep:search" class="mr-5px" /> 搜索
+          </el-button>
+          <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
+        </el-form-item>
+      </el-form>
+      <div class="grid grid-cols-7 gap-8">
+        <div
+          v-for="info in totalWorkKeys"
+          :key="info[0]"
+          class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow p-4 flex flex-col items-center justify-center gap-2"
+        >
+          <div class="size-7.5" :class="info[3]"></div>
+          <count-to class="text-2xl font-medium" :start-val="0" :end-val="totalWork[info[0]]">
+            <span>—</span>
+          </count-to>
+          <div class="text-xs font-medium text-[var(--el-text-color-regular)]">{{ info[1] }}</div>
+          <div class="text-sm font-medium text-[var(--el-text-color-regular)]">{{ info[2] }}</div>
+        </div>
+      </div>
+      <div class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow pt-4 px-8">
+        <el-table
+          v-loading="listLoading"
+          :data="list"
+          :stripe="true"
+          :style="{ width: '100%' }"
+          max-height="600"
+          class="min-h-143"
+          show-overflow-tooltip
+        >
+          <el-table-column
+            v-for="item in columns(type)"
+            :key="item.prop"
+            :label="item.label"
+            :prop="item.prop"
+            align="center"
+            :formatter="formatter"
+          />
+        </el-table>
+
+        <Pagination
+          class="mt-8"
+          :total="total"
+          v-model:page="query.pageNo"
+          v-model:limit="query.pageSize"
+          @pagination="getList"
+        />
+      </div>
+    </div>
+  </div>
+</template>
+
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
+}
+
+:deep(.el-table) {
+  border-top-right-radius: 8px;
+  border-top-left-radius: 8px;
+
+  .el-table__cell {
+    height: 52px;
+  }
+
+  .el-table__header-wrapper {
+    .el-table__cell {
+      background: var(--el-fill-color-light);
+    }
+  }
+}
+</style>

+ 7 - 2
uno.config.ts

@@ -1,7 +1,12 @@
-import { defineConfig, toEscapedSelector as e, presetUno } from 'unocss'
+import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss'
 // import transformerVariantGroup from '@unocss/transformer-variant-group'
 
 export default defineConfig({
+  content: {
+    pipeline: {
+      include: [/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/, 'src/**/*.{js,ts}']
+    }
+  },
   // ...UnoCSS options
   rules: [
     [
@@ -100,7 +105,7 @@ ${selector}:after {
       }
     ]
   ],
-  presets: [presetUno({ dark: 'class', attributify: false })],
+  presets: [presetUno({ dark: 'class', attributify: false }), presetIcons()],
   // transformers: [transformerVariantGroup()],
   shortcuts: {
     'wh-full': 'w-full h-full'