فهرست منبع

pms 瑞鹰日报 列表表头分组

(cherry picked from commit f34c15de8c6003976b75b144fa00fbb0104b9c03)
zhangcl 1 هفته پیش
والد
کامیت
1e005de3a9
1فایلهای تغییر یافته به همراه104 افزوده شده و 5 حذف شده
  1. 104 5
      src/views/pms/iotrydailyreport/index.vue

+ 104 - 5
src/views/pms/iotrydailyreport/index.vue

@@ -44,7 +44,7 @@
           type="primary"
           plain
           @click="openForm('create')"
-          v-hasPermi="['pms:iot-rh-daily-report:create']"
+          v-hasPermi="['pms:iot-ry-daily-report:create']"
         >
           <Icon icon="ep:plus" class="mr-5px" /> 新增
         </el-button>
@@ -53,7 +53,7 @@
           plain
           @click="handleExport"
           :loading="exportLoading"
-          v-hasPermi="['pms:iot-rh-daily-report:export']"
+          v-hasPermi="['pms:iot-ry-daily-report:export']"
         >
           <Icon icon="ep:download" class="mr-5px" /> 导出
         </el-button>
@@ -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,13 +149,25 @@
             </el-tooltip>
           </template>
         </el-table-column>
+        <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="非生产时间" align="center">
+          <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
               link
               type="primary"
               @click="openForm('update', scope.row.id, scope.row)"
-              v-hasPermi="['pms:iot-rh-daily-report:update']"
+              v-hasPermi="['pms:iot-ry-daily-report:update']"
             >
               编辑
             </el-button>
@@ -154,7 +175,7 @@
               link
               type="danger"
               @click="handleDelete(scope.row.id)"
-              v-hasPermi="['pms:iot-rh-daily-report:delete']"
+              v-hasPermi="['pms:iot-ry-daily-report:delete']"
             >
               删除
             </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>