Parcourir la source

pms 瑞恒日报 统计未填报数据

zhangcl il y a 6 jours
Parent
commit
3c71064db1

+ 5 - 0
src/api/pms/iotrhdailyreport/index.ts

@@ -47,6 +47,11 @@ export const IotRhDailyReportApi = {
     return await request.get({ url: `/pms/iot-rh-daily-report/rhDailyReportStatistics`, params })
   },
 
+  // 按照日期查询瑞恒日报统计数据 未填报队伍明细
+  rhUnReportDetails: async (params: any) => {
+    return await request.get({ url: `/pms/iot-rh-daily-report/rhUnReportDetails`, params })
+  },
+
   // 查询项目任务实际进度列表
   taskActualProgress: async (params: any) => {
     return await request.get({ url: `/pms/iot-rh-daily-report/taskActualProgress`, params })

+ 268 - 0
src/views/pms/iotrhdailyreport/UnfilledReportDialog.vue

@@ -0,0 +1,268 @@
+<template>
+  <el-dialog
+    v-model="dialogVisible"
+    title="未填报详情"
+    width="80%"
+    top="5vh"
+    :close-on-click-modal="false"
+    @closed="handleClosed"
+  >
+    <!-- 搜索条件区域 -->
+    <ContentWrap class="mb-15px">
+      <el-form
+        :model="searchParams"
+        ref="searchFormRef"
+        :inline="true"
+        label-width="100px"
+      >
+        <el-form-item label="创建时间" prop="createTime">
+          <el-date-picker
+            v-model="searchParams.createTime"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            type="daterange"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+            class="!w-320px"
+            @change="handleSearch"
+          />
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="handleSearch">
+            <Icon icon="ep:search" class="mr-5px" /> 搜索
+          </el-button>
+          <el-button @click="resetSearch">
+            <Icon icon="ep:refresh" class="mr-5px" /> 重置
+          </el-button>
+        </el-form-item>
+      </el-form>
+    </ContentWrap>
+
+    <!-- 列表区域 -->
+    <ContentWrap>
+      <div class="table-container">
+        <el-table
+          v-loading="loading"
+          :data="list"
+          :stripe="true"
+          style="width: 100%"
+          :cell-style="cellStyle"
+          empty-text="暂无未填报数据"
+          table-layout="fixed"
+        >
+          <el-table-column
+            label="日期"
+            align="center"
+            prop="reportDate"
+            width="120"
+          >
+            <template #default="scope">
+              <span class="date-content">{{ scope.row.reportDate }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="部门名称"
+            prop="deptNames"
+            min-width="300"
+          >
+            <template #default="scope">
+              <div class="dept-names-content">
+                {{ scope.row.deptNames || '-' }}
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+
+      <!-- 分页
+      <Pagination
+        :total="total"
+        v-model:page="searchParams.pageNo"
+        v-model:limit="searchParams.pageSize"
+        @pagination="getList"
+      /> -->
+    </ContentWrap>
+  </el-dialog>
+</template>
+
+<script setup lang="ts">
+import { ref, reactive, watch, nextTick } from 'vue'
+import {IotRhDailyReportApi} from "@/api/pms/iotrhdailyreport";
+
+const { t } = useI18n()
+const message = useMessage()
+
+// 弹窗显示控制
+const dialogVisible = ref(false)
+
+// 搜索参数
+const searchParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  createTime: []
+})
+
+// 列表数据
+const list = ref<any[]>([])
+const total = ref(0)
+const loading = ref(false)
+
+// 接收父组件传递的查询参数
+const props = defineProps<{
+  queryParams: any
+}>()
+
+// 搜索表单引用
+const searchFormRef = ref()
+
+// 打开弹窗
+const open = () => {
+  // 复制父组件的查询参数
+  if (props.queryParams.createTime && props.queryParams.createTime.length > 0) {
+    searchParams.createTime = [...props.queryParams.createTime]
+  }
+
+  dialogVisible.value = true
+  // 获取数据
+  nextTick(() => {
+    getList()
+  })
+}
+
+// 获取列表数据
+const getList = async () => {
+  // 检查时间范围
+  if (!searchParams.createTime || searchParams.createTime.length === 0) {
+    list.value = []
+    total.value = 0
+    return
+  }
+
+  loading.value = true
+  try {
+    const res = await IotRhDailyReportApi.rhUnReportDetails({
+      createTime: searchParams.createTime
+    })
+
+    // 处理返回数据
+    if (res && Array.isArray(res)) {
+      list.value = res
+      total.value = res.length
+    } else {
+      list.value = []
+      total.value = 0
+    }
+  } catch (error) {
+    console.error('获取未填报数据失败', error)
+    message.error('获取未填报数据失败')
+    list.value = []
+    total.value = 0
+  } finally {
+    loading.value = false
+  }
+}
+
+// 搜索
+const handleSearch = () => {
+  searchParams.pageNo = 1
+  getList()
+}
+
+// 重置搜索
+const resetSearch = () => {
+  searchFormRef.value?.resetFields()
+  handleSearch()
+}
+
+// 单元格样式
+const cellStyle = ({ row, column, rowIndex, columnIndex }: any) => {
+  // 为所有列设置基本样式
+  const baseStyle = {
+    padding: '8px 4px'
+  }
+
+  if (column.property === 'deptNames') {
+    return {
+      ...baseStyle,
+      whiteSpace: 'normal',
+      wordBreak: 'break-all',
+      lineHeight: '1.5'
+    }
+  }
+
+  return baseStyle
+}
+
+// 弹窗关闭处理
+const handleClosed = () => {
+  list.value = []
+  total.value = 0
+  searchParams.pageNo = 1
+}
+
+// 暴露方法给父组件
+defineExpose({
+  open
+})
+
+// 监听父组件查询参数变化
+watch(() => props.queryParams.createTime, (newVal) => {
+  if (newVal && newVal.length > 0) {
+    searchParams.createTime = [...newVal]
+  }
+}, { deep: true })
+</script>
+
+<style scoped>
+/* 表格容器确保正确布局 */
+.table-container {
+  width: 100%;
+  overflow-x: auto;
+}
+
+.date-content {
+  white-space: nowrap;
+}
+
+.dept-names-content {
+  white-space: normal;
+  word-break: break-all;
+  line-height: 1.5;
+  padding: 8px 4px;
+}
+
+/* 深度样式修改确保表格正确显示 */
+:deep(.el-table) {
+  table-layout: fixed;
+}
+
+:deep(.el-table .el-table__cell) {
+  box-sizing: border-box;
+}
+
+:deep(.el-table .cell) {
+  white-space: normal;
+  word-break: break-all;
+  line-height: 1.5;
+  padding: 8px 4px;
+}
+
+:deep(.el-table td.el-table__cell) {
+  padding: 8px 4px;
+  border-bottom: 1px solid var(--el-table-border-color);
+}
+
+:deep(.el-table th.el-table__cell) {
+  padding: 8px 4px;
+  background-color: var(--el-table-header-bg-color);
+}
+
+/* 确保列宽正确分配 */
+:deep(.el-table__body colgroup col:nth-child(1)) {
+  width: 120px;
+}
+
+:deep(.el-table__body colgroup col:nth-child(2)) {
+  width: auto;
+}
+</style>

+ 50 - 1
src/views/pms/iotrhdailyreport/index.vue

@@ -81,7 +81,13 @@
           </div>
           <div class="stat-item" :style="{ color: unFilledColor }">
             <span>未填报:</span>
-            <span>{{ statistics.unFilled || '-' }}</span>
+            <span
+              class="unfilled-link"
+              @click="openUnfilledDialog"
+              :class="{ 'disabled': !queryParams.createTime || queryParams.createTime.length === 0 }"
+            >
+              {{ statistics.unFilled || '-' }}
+            </span>
           </div>
         </div>
       </ContentWrap>
@@ -206,6 +212,12 @@
 
       <!-- 表单弹窗:添加/修改 -->
       <IotRhDailyReportForm ref="formRef" @success="getList" :row-data="selectedRowData"/>
+
+      <UnfilledReportDialog
+        ref="unfilledDialogRef"
+        :query-params="queryParams"
+        @close="handleUnfilledDialogClose"
+      />
     </el-col>
   </el-row>
 
@@ -269,6 +281,8 @@ const queryParams = reactive({
 })
 const queryFormRef = ref() // 搜索的表单
 const exportLoading = ref(false) // 导出的加载中
+// 添加弹窗引用
+const unfilledDialogRef = ref()
 
 const rootDeptId = ref(157)
 
@@ -345,6 +359,24 @@ const percentageFormatter = (row: any, column: any, cellValue: any, index: numbe
   return `${(parseFloat(cellValue) * 100).toFixed(2)}%`;
 };
 
+// 添加打开未填报弹窗的方法
+const openUnfilledDialog = () => {
+  // 检查是否选择了创建时间
+  if (!queryParams.createTime || queryParams.createTime.length === 0) {
+    message.warning('请先选择创建时间范围')
+    return
+  }
+
+  // 打开弹窗
+  unfilledDialogRef.value.open()
+}
+
+// 弹窗关闭回调
+const handleUnfilledDialogClose = () => {
+  // 可以在这里处理弹窗关闭后的逻辑
+  console.log('未填报弹窗已关闭')
+}
+
 // 新增获取统计数据的方法
 const getStatistics = async () => {
   // 重置统计数据
@@ -764,6 +796,23 @@ watch(list, () => {
 .color-indicator.orange {
   background-color: orange;
 }
+
+/* 统计区域未填报链接样式 */
+.unfilled-link {
+  cursor: pointer;
+  text-decoration: underline;
+  color: #FF5500;
+}
+
+.unfilled-link:hover {
+  color: #ff7733;
+}
+
+.unfilled-link.disabled {
+  cursor: not-allowed;
+  text-decoration: none;
+  color: #cccccc;
+}
 </style>
 
 <style>