liuhairui 2 هفته پیش
والد
کامیت
a011a33352

+ 107 - 14
src/view/SalaryManage/ProcessProduction.vue

@@ -79,10 +79,15 @@
           border
           stripe
           row-key="rowKey"
-          style="width: 100%"
+          style="width: 100%;height: 65vh;"
           :row-style="{ height: '32px' }"
           :header-row-style="{ height: '36px' }"
           :span-method="tableSpanMethod"
+          :row-class-name="processTableRowClassName"
+          :cell-style="processTableCellStyle"
+          @row-click="onProcessTableRowClick"
+          @row-mouseenter="onProcessTableRowMouseEnter"
+          @row-mouseleave="onProcessTableRowMouseLeave"
           :summary-method="tableSummaryMethod"
           show-summary
           show-overflow-tooltip
@@ -112,9 +117,9 @@
               </div>
             </template>
           </el-table-column>
-          <el-table-column label="工序编号" prop="工序号" width="100" align="center"  />
+          <el-table-column label="工序编号" prop="工序号" width="90" align="center"  />
           <el-table-column label="工序名称" prop="工序名称" min-width="280" align="left"  show-overflow-tooltip />
-          <el-table-column label="员工姓名" prop="员工姓名" width="120" align="left">
+          <el-table-column label="员工姓名" prop="员工姓名" width="110" align="left">
             <template #header>
               <div class="process-production-col-header">
                 <span>员工姓名</span>
@@ -139,9 +144,9 @@
               </div>
             </template>
           </el-table-column>
-          <el-table-column label="完工数量" prop="数量" width="90" align="center" />
-          <el-table-column v-if="!hideAmountColumns" label="分" prop="工分" width="100" align="center" />
-          <el-table-column v-if="!hideAmountColumns" label="工时" prop="工时" width="100" align="center" />
+          <el-table-column label="数量" prop="数量" width="90" align="center" />
+          <el-table-column v-if="!hideAmountColumns" label="定额分" prop="工分" width="100" align="center" />
+          <el-table-column v-if="!hideAmountColumns" label="标准总工时(秒)" prop="工时" width="150" align="center" />
           <el-table-column v-if="!hideAmountColumns" label="工资" prop="工资" width="100" align="center" />
           <el-table-column label="开工日期" prop="开工日期" width="110" align="center">
             <template #header>
@@ -307,10 +312,17 @@ const pickGroupFromStaff = (staff) =>
     staff?.小组 ?? staff?.group ?? staff?.['设备编组'] ?? staff?.['设备编号'] ?? staff?.team_name ?? ''
   ).trim()
 
+const pickStaffListFromProcess = (proc) => {
+  if (Array.isArray(proc?.staffs)) return proc.staffs
+  if (Array.isArray(proc?.员工列表)) return proc.员工列表
+  if (Array.isArray(proc?.staff_list)) return proc.staff_list
+  return []
+}
+
 const flattenProcessList = (processList = []) => {
   const rows = []
   for (const proc of processList) {
-    const staffs = Array.isArray(proc.staffs) ? proc.staffs : []
+    const staffs = pickStaffListFromProcess(proc)
     if (!staffs.length) {
       rows.push({
         rowKey: `${proc.工序号}-empty`,
@@ -325,6 +337,7 @@ const flattenProcessList = (processList = []) => {
         工时: '',
         工资: '',
         _processRowSpan: 1,
+        _groupRowSpan: 1,
       })
       continue
     }
@@ -338,10 +351,11 @@ const flattenProcessList = (processList = []) => {
         数量: staff.数量 ?? '',
         开工日期: staff.开工日期 ?? '',
         完工日期: staff.完工日期 ?? '',
-        工分: staff.工分 ?? '',
+        工分: staff.工分 ?? staff.金额 ?? '',
         工时: staff.工时 ?? '',
         工资: staff.工资 ?? '',
         _processRowSpan: index === 0 ? staffs.length : 0,
+        _groupRowSpan: 1,
       })
     })
   }
@@ -366,8 +380,9 @@ const syncCheckboxFilterAfterDataChange = (options, selectedRef) => {
 }
 
 const applyCheckboxColumnFilter = (rows, options, selected, getValue) => {
+  if (!options.length) return rows
   if (!selected.length) return []
-  if (!options.length || selected.length >= options.length) return rows
+  if (selected.length >= options.length) return rows
   const set = new Set(selected)
   return rows.filter((row) => {
     const val = getValue(row)
@@ -460,8 +475,14 @@ const recomputeProcessRowSpan = (rows) => {
       j++
     }
     const group = rows.slice(i, j)
+    const groupName = String(group[0].小组 || '').trim()
+    const mergeGroup = groupName && group.every((r) => String(r.小组 || '').trim() === groupName)
     group.forEach((row, idx) => {
-      result.push({ ...row, _processRowSpan: idx === 0 ? group.length : 0 })
+      result.push({
+        ...row,
+        _processRowSpan: idx === 0 ? group.length : 0,
+        _groupRowSpan: mergeGroup ? (idx === 0 ? group.length : 0) : 1,
+      })
     })
     i = j
   }
@@ -477,14 +498,71 @@ const displayTableData = computed(() => {
   return recomputeProcessRowSpan(filtered)
 })
 
+const resetAllColumnFilters = () => {
+  selectAllGroupFilter()
+  selectAllStaffNameFilter()
+  selectAllStartDateFilter()
+  selectAllFinishDateFilter()
+}
+
+const getProcessKey = (row) => `${row?.工序号 ?? ''}||${row?.工序名称 ?? ''}`
+
+const activeProcessKey = ref('')
+const hoveredProcessKey = ref('')
+
 watch(flatTableRows, () => {
-  syncGroupFilterAfterDataChange()
-  syncStaffNameFilterAfterDataChange()
-  syncStartDateFilterAfterDataChange()
-  syncFinishDateFilterAfterDataChange()
+  resetAllColumnFilters()
+  activeProcessKey.value = ''
+  hoveredProcessKey.value = ''
+})
+
+const onProcessTableRowClick = (row) => {
+  activeProcessKey.value = getProcessKey(row)
+}
+
+const onProcessTableRowMouseEnter = (row) => {
+  hoveredProcessKey.value = getProcessKey(row)
+}
+
+const onProcessTableRowMouseLeave = () => {
+  hoveredProcessKey.value = ''
+}
+
+const isProcessRowHighlighted = (row, activeKey, hoverKey) => {
+  const key = getProcessKey(row)
+  return (activeKey && key === activeKey) || (hoverKey && key === hoverKey)
+}
+
+const processTableRowClassName = computed(() => {
+  const activeKey = activeProcessKey.value
+  const hoverKey = hoveredProcessKey.value
+  return ({ row }) => {
+    if (isProcessRowHighlighted(row, activeKey, hoverKey)) {
+      return activeKey && getProcessKey(row) === activeKey
+        ? 'process-production-row-active'
+        : 'process-production-row-hover'
+    }
+    return ''
+  }
+})
+
+const processTableCellStyle = computed(() => {
+  const activeKey = activeProcessKey.value
+  const hoverKey = hoveredProcessKey.value
+  return ({ row }) => {
+    if (isProcessRowHighlighted(row, activeKey, hoverKey)) {
+      return { backgroundColor: '#ff80ff' }
+    }
+    return {}
+  }
 })
 
 const tableSpanMethod = ({ row, column }) => {
+  if (column.property === '小组') {
+    const rowspan = row._groupRowSpan ?? 1
+    if (rowspan > 0) return { rowspan, colspan: 1 }
+    return { rowspan: 0, colspan: 0 }
+  }
   if (column.property !== '工序号' && column.property !== '工序名称') {
     return { rowspan: 1, colspan: 1 }
   }
@@ -648,7 +726,11 @@ const executeProductionSearch = async (orderNo) => {
     }
 
     const data = res.data || {}
+    applyOrderSummaryFromWorkOrder(data, workorder)
     processListRaw.value = data.工序列表 || []
+    resetAllColumnFilters()
+    activeProcessKey.value = ''
+    hoveredProcessKey.value = ''
     if (!processListRaw.value.length) {
       pageHint.value = '未找到报工数据'
     }
@@ -830,6 +912,17 @@ defineExpose({ loadByWorkorder })
   background: #fafafa;
 }
 
+/* 合并单元格时按工序组整组高亮,同工序多员工行同步着色 */
+.process-production-table-wrap :deep(.el-table__body tr.process-production-row-active > td.el-table__cell),
+.process-production-table-wrap :deep(.el-table__body tr.process-production-row-active.el-table__row--striped > td.el-table__cell) {
+  background-color: #ff80ff !important;
+}
+
+.process-production-table-wrap :deep(.el-table__body tr.process-production-row-hover > td.el-table__cell),
+.process-production-table-wrap :deep(.el-table__body tr.process-production-row-hover.el-table__row--striped > td.el-table__cell) {
+  background-color: #ff80ff !important;
+}
+
 .process-production-col-header {
   display: inline-flex;
   align-items: center;

+ 8 - 8
src/view/SalaryManage/SalaryList.vue

@@ -245,7 +245,7 @@
             />
           </template>
         </el-table-column>
-        <el-table-column label="生产款号" prop="生产款号" width="110" align="center">
+        <el-table-column label="生产款号" prop="生产款号" width="200" align="center">
           <template #header>
             <TableColumnFilterHeader
               label="生产款号"
@@ -284,7 +284,7 @@
         </el-table-column>
         <el-table-column label="工序编号" prop="工序编号" width="90" align="center" />
         <el-table-column label="工序名称" prop="工序名称" min-width="280"/>
-        <el-table-column label="小组" prop="设备编号" width="110" align="center">
+        <el-table-column label="小组" prop="设备编号" width="105" align="center">
           <template #header>
             <TableColumnFilterHeader
               label="小组"
@@ -296,16 +296,16 @@
             />
           </template>
         </el-table-column>
-        <el-table-column label="上报数量" prop="数量" width="80" align="center" />
-        <el-table-column label="分" prop="标准分数" width="90" align="center" />
+        <el-table-column label="数量" prop="数量" width="80" align="center" />
+        <el-table-column label="定额分" prop="标准分数" width="90" align="center" />
         <el-table-column label="工资" prop="工资" width="90" align="center" />
-        <el-table-column label="秒" prop="标准工时" width="90" align="center" />
-        <el-table-column label="生产工时(秒)" prop="生产工时" width="120" align="center" />
+        <el-table-column label="标准工时(秒)" prop="标准工时" width="120" align="center" />
+        <el-table-column label="标准总工时(秒)" prop="生产工时" width="150" align="center" />
         <!-- <el-table-column label="生产总工分" prop="生产分数" width="100" align="center" /> -->
-        <el-table-column label="上报日期" prop="日期" width="110" align="center">
+        <el-table-column label="日期" prop="日期" width="110" align="center">
           <template #header>
             <TableColumnFilterHeader
-              label="上报日期"
+              label="日期"
               v-model="detailReportDateFilter"
               :options="detailReportDateFilterOptions"
               :active="isDetailReportDateFilterActive"

+ 2 - 3
src/view/performance/WorkScoreReporting/gongfenbaogong.vue

@@ -64,8 +64,8 @@
                           show-overflow-tooltip
                           @row-click="tableRowClick"
                         >
+                        <el-table-column align="center" label="小组" prop="sys_id" :width="90" show-overflow-tooltip />
                         <el-table-column align="center" label="订单编号" prop="work_order" :width="100" />
-                        <el-table-column align="center" label="生产款号" prop="生产款号" :width="120" />
                         <el-table-column align="center" label="工序编号" prop="process_code" :width="90" />
                                   <el-table-column align="left" label="工序名称" prop="process_name" min-width="200" show-overflow-tooltip />
                                   <el-table-column align="center" label="员工姓名" prop="staff_name" :width="120">
@@ -93,8 +93,7 @@
                                       </div>
                                     </template>
                                   </el-table-column>
-                                  <el-table-column align="center" label="完工数量" prop="number" :width="90" />
-                                  <el-table-column align="center" label="组别" prop="sys_id" :width="90" show-overflow-tooltip />
+                                  <el-table-column align="center" label="数量" prop="number" :width="90" />
                                   <el-table-column align="center" label="报工时间" prop="sys_rq" :width="180" show-overflow-tooltip />
                                   <el-table-column align="center" label="操作" :width="100" fixed="right">
                                     <template #default="scope">