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

pms 瑞鹰日报 非生产时间预警

zhangcl 1 hete
szülő
commit
02bd4532e6

+ 82 - 72
src/api/pms/iotrydailyreport/index.ts

@@ -1,72 +1,82 @@
-import request from '@/config/axios'
-
-// 瑞鹰日报 VO
-export interface IotRyDailyReportVO {
-  id: number // 主键id
-  deptId: number // 施工队伍id
-  projectId: number // 项目id
-  taskId: number // 任务id
-  projectClassification: string // 项目类别(钻井 修井 注氮 酸化压裂... )
-  relocationDays: number // 搬迁安装天数(D)
-  lastestWellDoneTime: Date // 上井次完井时间
-  currentDepth: number // 当前井深(m)
-  dailyFootage: number // 日进尺(m)
-  monthlyFootage: number // 月进尺(m)
-  annualFootage: number // 年累计进尺(m)
-  dailyPowerUsage: number // 当日用电量(kWh)
-  monthlyPowerUsage: number // 当月用电量(kWh)
-  dailyFuel: number // 当日油耗(吨)
-  monthlyFuel: number // 当月油耗(吨)
-  nonProductionTime: number // 非生产时间(H)
-  nptReason: string // 非生产时间原因
-  constructionStartDate: Date // 施工开始日期
-  constructionEndDate: Date // 施工结束日期
-  productionStatus: string // 当日生产情况生产动态
-  nextPlan: string // 下步工作计划
-  rigStatus: number // 施工状态(动迁 准备 施工 完工)
-  personnel: string // 人员情况
-  mudDensity: number // 泥浆性能-密度(g/cm³)
-  mudViscosity: number // 泥浆性能-粘度(S)
-  lateralLength: number // 水平段长度(m) 适用于水平井
-  wellInclination: number // 井斜(°)
-  azimuth: number // 方位(°)
-  extProperty: string // 不同专业公司的扩展属性值
-  sort: number // 排序值
-  remark: string // 备注
-  status: number // 状态(0启用 1禁用)
-  processInstanceId: string // 流程实例id
-  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
-}
-
-// 瑞鹰日报 API
-export const IotRyDailyReportApi = {
-  // 查询瑞鹰日报分页
-  getIotRyDailyReportPage: async (params: any) => {
-    return await request.get({ url: `/pms/iot-ry-daily-report/page`, params })
-  },
-
-  // 查询瑞鹰日报详情
-  getIotRyDailyReport: async (id: number) => {
-    return await request.get({ url: `/pms/iot-ry-daily-report/get?id=` + id })
-  },
-
-  // 新增瑞鹰日报
-  createIotRyDailyReport: async (data: IotRyDailyReportVO) => {
-    return await request.post({ url: `/pms/iot-ry-daily-report/create`, data })
-  },
-
-  // 修改瑞鹰日报
-  updateIotRyDailyReport: async (data: IotRyDailyReportVO) => {
-    return await request.put({ url: `/pms/iot-ry-daily-report/update`, data })
-  },
-
-  // 删除瑞鹰日报
-  deleteIotRyDailyReport: async (id: number) => {
-    return await request.delete({ url: `/pms/iot-ry-daily-report/delete?id=` + id })
-  },
-
-  // 导出瑞鹰日报 Excel
-  exportIotRyDailyReport: async (params) => {
-    return await request.download({ url: `/pms/iot-ry-daily-report/export-excel`, params })
-  },
-}
+import request from '@/config/axios'
+
+// 瑞鹰日报 VO
+export interface IotRyDailyReportVO {
+  id: number // 主键id
+  deptId: number // 施工队伍id
+  projectId: number // 项目id
+  taskId: number // 任务id
+  projectClassification: string // 项目类别(钻井 修井 注氮 酸化压裂... )
+  relocationDays: number // 搬迁安装天数(D)
+  latestWellDoneTime: Date // 上井次完井时间
+  currentDepth: number // 当前井深(m)
+  dailyFootage: number // 日进尺(m)
+  monthlyFootage: number // 月进尺(m)
+  annualFootage: number // 年累计进尺(m)
+  dailyPowerUsage: number // 当日用电量(kWh)
+  monthlyPowerUsage: number // 当月用电量(kWh)
+  dailyFuel: number // 当日油耗(吨)
+  monthlyFuel: number // 当月油耗(吨)
+  nonProductionTime: number // 非生产时间(H)
+  nptReason: string // 非生产时间原因
+  drillingWorkingTime: number
+  otherProductionTime: number
+  accidentTime: number
+  repairTime: number
+  selfStopTime: number
+  complexityTime: number
+  relocationTime: number
+  rectificationTime:  number
+  waitingStopTime:  number
+  winterBreakTime:  number
+  constructionStartDate: Date // 施工开始日期
+  constructionEndDate: Date // 施工结束日期
+  productionStatus: string // 当日生产情况生产动态
+  nextPlan: string // 下步工作计划
+  rigStatus: number // 施工状态(动迁 准备 施工 完工)
+  personnel: string // 人员情况
+  mudDensity: number // 泥浆性能-密度(g/cm³)
+  mudViscosity: number // 泥浆性能-粘度(S)
+  lateralLength: number // 水平段长度(m) 适用于水平井
+  wellInclination: number // 井斜(°)
+  azimuth: number // 方位(°)
+  extProperty: string // 不同专业公司的扩展属性值
+  sort: number // 排序值
+  remark: string // 备注
+  status: number // 状态(0启用 1禁用)
+  processInstanceId: string // 流程实例id
+  auditStatus: number // 审批状态 未提交、审批中、审批通过、审批不通过、已取消
+}
+
+// 瑞鹰日报 API
+export const IotRyDailyReportApi = {
+  // 查询瑞鹰日报分页
+  getIotRyDailyReportPage: async (params: any) => {
+    return await request.get({ url: `/pms/iot-ry-daily-report/page`, params })
+  },
+
+  // 查询瑞鹰日报详情
+  getIotRyDailyReport: async (id: number) => {
+    return await request.get({ url: `/pms/iot-ry-daily-report/get?id=` + id })
+  },
+
+  // 新增瑞鹰日报
+  createIotRyDailyReport: async (data: IotRyDailyReportVO) => {
+    return await request.post({ url: `/pms/iot-ry-daily-report/create`, data })
+  },
+
+  // 修改瑞鹰日报
+  updateIotRyDailyReport: async (data: IotRyDailyReportVO) => {
+    return await request.put({ url: `/pms/iot-ry-daily-report/update`, data })
+  },
+
+  // 删除瑞鹰日报
+  deleteIotRyDailyReport: async (id: number) => {
+    return await request.delete({ url: `/pms/iot-ry-daily-report/delete?id=` + id })
+  },
+
+  // 导出瑞鹰日报 Excel
+  exportIotRyDailyReport: async (params) => {
+    return await request.download({ url: `/pms/iot-ry-daily-report/export-excel`, params })
+  },
+}

+ 100 - 1
src/views/pms/iotrydailyreport/index.vue

@@ -61,6 +61,15 @@
     </el-form>
   </ContentWrap>
 
+  <ContentWrap class="mb-15px">
+    <div class="color-legend">
+      <div class="legend-item">
+        <span class="color-indicator orange"></span>
+        <span>进尺工作时间+其它生产时间+非生产时间=24H&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;否则橙色预警</span>
+      </div>
+    </div>
+  </ContentWrap>
+
   <!-- 列表 -->
   <ContentWrap ref="tableContainerRef">
     <div class="table-container">
@@ -140,6 +149,18 @@
             </el-tooltip>
           </template>
         </el-table-column>
+        <el-table-column label="非生产时间" align="center">
+          <el-table-column label="进尺工作时间(H)" align="center" prop="drillingWorkingTime" :width="columnWidths.drillingWorkingTime"/>
+          <el-table-column label="其它生产时间(H)" align="center" prop="otherProductionTime" :width="columnWidths.otherProductionTime"/>
+          <el-table-column label="事故(H)" align="center" prop="accidentTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="修理(H)" align="center" prop="repairTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="自停(H)" align="center" prop="selfStopTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="复杂(H)" align="center" prop="complexityTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="搬迁(H)" align="center" prop="relocationTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="整改(H)" align="center" prop="rectificationTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="等停(H)" align="center" prop="waitingStopTime" :width="columnWidths.nonProductionTime"/>
+          <el-table-column label="冬休(H)" align="center" prop="winterBreakTime" :width="columnWidths.nonProductionTime"/>
+        </el-table-column>
         <el-table-column label="操作" align="center" :width="columnWidths.operation" fixed="right">
           <template #default="scope">
             <el-button
@@ -267,6 +288,8 @@ const columnWidths = ref({
   productionStatus: '200px',
   azimuth: '150px',
   designWellStruct: '200px',
+  drillingWorkingTime: '150px',
+  otherProductionTime: '150px',
   createTime: '180px',
   operation: '120px'
 })
@@ -278,6 +301,47 @@ const formatDesignWellStruct = (text: string | null | undefined) => {
   return text.length > 30 ? text.substring(0, 30) + '...' : text;
 };
 
+// 检查10个时间字段之和是否为24H
+const checkTimeSumEquals24 = (row: any) => {
+  // 获取三个字段的值,转换为数字,如果为空则视为0
+  const drillingWorkingTime = parseFloat(row.drillingWorkingTime) || 0;
+  const otherProductionTime = parseFloat(row.otherProductionTime) || 0;
+  const accidentTime = parseFloat(row.accidentTime) || 0;
+  const repairTime = parseFloat(row.repairTime) || 0;
+  const selfStopTime = parseFloat(row.selfStopTime) || 0;
+  const complexityTime = parseFloat(row.complexityTime) || 0;
+  const relocationTime = parseFloat(row.relocationTime) || 0;
+  const rectificationTime = parseFloat(row.rectificationTime) || 0;
+  const waitingStopTime = parseFloat(row.waitingStopTime) || 0;
+  const winterBreakTime = parseFloat(row.winterBreakTime) || 0;
+
+  // 计算总和
+  const sum = drillingWorkingTime + otherProductionTime + accidentTime + repairTime
+    + selfStopTime + complexityTime + relocationTime + rectificationTime + waitingStopTime + winterBreakTime;
+
+  // 返回是否等于24(允许一定的浮点数误差)
+  return Math.abs(sum - 24) < 0.01; // 使用0.01作为误差范围
+};
+
+// 单元格样式函数
+const cellStyle = ({ row, column, rowIndex, columnIndex }: { row: any; column: any; rowIndex: number; columnIndex: number }) => {
+  // 处理三个时间字段:当日注气时间、当日注水时间、非生产时间
+  const timeFields = ['drillingWorkingTime', 'otherProductionTime', 'accidentTime',
+    'repairTime', 'selfStopTime', 'complexityTime',
+    'relocationTime', 'rectificationTime', 'waitingStopTime', 'winterBreakTime'];
+  if (timeFields.includes(column.property)) {
+    // 检查10个时间字段之和是否不等于24
+    if (!checkTimeSumEquals24(row)) {
+      return {
+        color: 'orange',
+        fontWeight: 'bold'
+      };
+    }
+  }
+  // 默认返回空对象,不应用特殊样式
+  return {};
+};
+
 // 计算文本宽度
 const getTextWidth = (text: string, fontSize = 14) => {
   const span = document.createElement('span');
@@ -300,7 +364,7 @@ const FLEXIBLE_COLUMNS = ['deptName', 'contractName', 'taskName', 'equipmentType
   'currentDepth', 'dailyFootage', 'monthlyFootage', 'annualFootage', 'totalConstructionWells',
   'completedWells', 'mudDensity', 'mudViscosity', 'constructionStartDate',
   'constructionEndDate', 'lateralLength', 'wellInclination',
-  'azimuth', 'createTime'];
+  'azimuth', 'drillingWorkingTime', 'otherProductionTime', 'createTime'];
 
 /** 查询列表 */
 const getList = async () => {
@@ -389,6 +453,8 @@ const calculateColumnWidths = () => {
   calculateColumnMinWidth('azimuth', '方位(°)', (row: any) => row.azimuth);
   calculateColumnMinWidth('designWellStruct', '设计井身结构', (row: any) => row.designWellStruct);
   calculateColumnMinWidth('productionStatus', '生产动态', (row: any) => row.productionStatus);
+  calculateColumnMinWidth('drillingWorkingTime', '进尺工作时间', (row: any) => row.drillingWorkingTime);
+  calculateColumnMinWidth('otherProductionTime', '其它生产时间', (row: any) => row.otherProductionTime);
   calculateColumnMinWidth('createTime', '创建时间', (row: any) => dateFormatter(null, null, row.createTime));
 
   // 设计井身结构 生产动态 列使用固定宽度,不参与自动计算
@@ -583,6 +649,39 @@ watch(list, () => {
   flex-grow: 0;
 }
 
+/* 颜色说明区域样式 */
+.color-legend {
+  display: flex;
+  flex-direction: column;
+  gap: 8px;
+  padding: 12px 16px;
+  background-color: #f8f9fa;
+  border-radius: 4px;
+  border-left: 4px solid #e6f7ff;
+}
+
+.legend-item {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  font-size: 14px;
+}
+
+.color-indicator {
+  display: inline-block;
+  width: 12px;
+  height: 12px;
+  border-radius: 50%;
+}
+
+.color-indicator.red {
+  background-color: red;
+}
+
+.color-indicator.orange {
+  background-color: orange;
+}
+
 </style>
 
 <style>