zck 1 月之前
父节点
当前提交
17bd3ed862

+ 47 - 8
src/api/jixiaoguanli/caiwubaobiao.js

@@ -81,16 +81,16 @@ export const shuidianqifentanList = (params) => {
     })
 }
 
-//v23财务--各月工单人工明细
-export const ChromaticityAdd = (params) => {
+//v23财务--各月工单成本计算
+export const calculate = (params) => {
     return service({
-      url:'/mes_server/Cost_Accounting/ChromaticityAdd',
+      url:'/mes_server/Cost_Calculation/calculate',
       method: 'get',
       params
     })
 }
 
-//v23财务--各月工单色度数
+//v23财务--各月工单色度数添加
 export const ChromaticityDetailAdd = (params) => {
     return service({
       url:'/mes_server/Cost_Accounting/ChromaticityDetailAdd',
@@ -201,11 +201,50 @@ export const shuidianqiDetailAdd = (params) => {
   })
 }
 
-//v23财务--计算成本
-export const CostCalculation = (params) => {
+//v23财务--计算完工成本
+export const CalculateCompletedCost = (params) => {
   return service({
-    url:'/mes_server/Cost_Calculation/CostCalculation',
+    url:'/mes_server/Cost_Accounting/CalculateCompletedCost',
     method: 'get',
     params
   })
-}
+}
+
+//v23财务--获取月份工序成本左侧菜单
+export const getProcessTab = (params) => {
+  return service({
+    url:'/mes_server/Cost_Accounting/getProcessTab',
+    method: 'get',
+    params
+  })
+}
+
+
+//v23财务--获取月份工序成本列表
+export const ProcessCostAccountingList = (params) => {
+  return service({
+    url:'/mes_server/Cost_Accounting/ProcessCostAccountingList',
+    method: 'get',
+    params
+  })
+}
+
+
+//v23财务--完工工单成本左侧菜单
+export const GetCompletionWorkOrderCostTab = (params) => {
+  return service({
+    url:'/mes_server/Cost_Accounting/GetCompletionWorkOrderCostTab',
+    method: 'get',
+    params
+  })
+}
+
+
+//v23财务--完工工单成本列表
+export const CompletionWorkOrderCostList = (params) => {
+  return service({
+    url:'/mes_server/Cost_Accounting/CompletionWorkOrderCostList',
+    method: 'get',
+    params
+  })
+}

+ 313 - 123
src/view/equipment/maintenance.vue

@@ -78,17 +78,18 @@
             <el-table-column type="selection" width="30" />
             <el-table-column fixed align="left" label="设备编号" prop="设备编号"  width="90"/>
             <el-table-column fixed align="left" label="设备名称" prop="设备名称"  width="220"/>
-            <el-table-column align="left" label="报障时间" prop="报障时间"  width="120"/>
-            <el-table-column align="left" label="维修受理时间" prop="维修受理时间"  width="120"/>
-            <el-table-column align="left" label="修复时间"  prop="修复时间"  width="120"/>
+            <el-table-column align="left" label="报障报告时间" prop="报障时间"  width="120"/>
+            <el-table-column align="left" label="维修开始时间" prop="维修受理时间"  width="120"/>
+            <el-table-column align="left" label="维修完成时间"  prop="修复时间"  width="120"/>
+            <el-table-column align="left" label="故障现象" prop="故障现象"  width="110"/>
+            <el-table-column align="left" label="原因分析及措施" prop="处理方法"  width="160"/>
             <el-table-column align="left" label="故障维修工时" prop="故障维修工时"  width="110"/>
             <el-table-column align="left" label="非故障维修工时" prop="非故障维修工时"  width="125"/>
             <el-table-column align="left" label="计划维修工时" prop="计划维修工时"  width="110"/>
             <el-table-column align="left" label="专项维修工时" prop="专项维修工时"  width="110"/>
-            <el-table-column align="left" label="验收情况" prop="验收情况"  width="110"/>
             <el-table-column align="left" label="维修姓名1" prop="维修姓名1"  width="110"/>
-            <el-table-column align="left" label="故障现象" prop="故障现象"  width="110"/>
-            <el-table-column align="left" label="处理方法" prop="处理方法"  width="110"/>
+            <el-table-column align="left" label="验收情况" prop="验收情况"  width="110"/>
+            <el-table-column align="left" label="验收人" prop="验收人" width="100" />
             <el-table-column align="left" label="使用部门" prop="使用部门"  width="110"/>
             <el-table-column align="left" label="创建用户" prop="创建用户"  width="110"/>
             <el-table-column align="left" label="创建时间" prop="创建时间"  width="120"/>
@@ -188,6 +189,8 @@
           <el-date-picker
             v-model="repairForm.故障报告时间"
             type="datetime"
+            :format="'YYYY-MM-DD HH:mm'"
+            :value-format="'YYYY-MM-DD HH:mm:ss'"
             placeholder="选择故障报告时间"
             style="width: 100%"
           />
@@ -231,12 +234,15 @@
     <!-- 第五行:时间信息 -->
     <el-row :gutter="20">
       <el-col :span="12">
-        <el-form-item label="维修受理时间">
+        <el-form-item label="维修开始时间">
           <el-date-picker
             v-model="repairForm.维修受理时间"
             type="datetime"
-            placeholder="选择维修受理时间"
+            :format="'YYYY-MM-DD HH:mm'"
+            :value-format="'YYYY-MM-DD HH:mm:ss'"
+            placeholder="维修开始时间"
             style="width: 100%"
+            @change="calculateWorkingHours"
           />
         </el-form-item>
       </el-col>
@@ -246,12 +252,15 @@
         </el-form-item>
       </el-col>
       <el-col :span="12">
-        <el-form-item label="修复时间">
+        <el-form-item label="维修完成时间">
           <el-date-picker
             v-model="repairForm.修复时间"
             type="datetime"
-            placeholder="选择修复时间"
+            :format="'YYYY-MM-DD HH:mm'"
+            :value-format="'YYYY-MM-DD HH:mm:ss'"
+            placeholder="维修完成时间"
             style="width: 100%"
+            @change="calculateWorkingHours"
           />
         </el-form-item>
       </el-col>
@@ -292,12 +301,22 @@
     <el-row :gutter="20">
       <el-col :span="6">
         <el-form-item label="实际维修工时">
-          <el-input v-model="repairForm.实际维修工时" placeholder="请输入实际维修工时" />
+          <el-input 
+            v-model="repairForm.实际维修工时" 
+            :readonly="true"
+            placeholder=""
+            :title="repairForm.实际维修工时 ? '自动计算工时' : '请先选择维修开始和完成时间'"
+          >
+          </el-input>
         </el-form-item>
       </el-col>
       <el-col :span="6">
         <el-form-item label="设备故障总工时">
-          <el-input v-model="repairForm.设备故障总工时" placeholder="请输入设备故障总工时" />
+          <el-input 
+            v-model="repairForm.设备故障总工时" 
+            placeholder="请输入设备故障总工时"
+            @blur="validateTotalHours"
+          />
         </el-form-item>
       </el-col>
     </el-row>
@@ -306,12 +325,18 @@
     <el-row :gutter="20">
       <el-col :span="6">
         <el-form-item label="验收人">
-          <el-input v-model="repairForm.验收人" placeholder="请输入验收人" />
+          <el-input v-model="repairForm.验收人" placeholder="请输入验收人"
+          @keyup.enter.native="() => openEmployeeForAcceptance()"
+           />
+          
         </el-form-item>
       </el-col>
       <el-col :span="6">
         <el-form-item label="验收情况">
-          <el-input v-model="repairForm.验收情况" placeholder="请输入验收情况" />
+          <el-select v-model="repairForm.验收情况" placeholder="请选择验收情况" >
+            <el-option label="正常" value="正常" />
+            <el-option label="待修" value="待修" />
+          </el-select>
         </el-form-item>
       </el-col>
     </el-row>
@@ -379,17 +404,25 @@
           <el-date-picker
             v-model="maintenanceForm.保养时间段"
             type="datetimerange"
+            :format="'YYYY-MM-DD HH:mm'"
+            :value-format="'YYYY-MM-DD HH:mm:ss'"
             range-separator="至"
             start-placeholder="开始时间"
             end-placeholder="结束时间"
             style="width: 100%"
+            @change="calculateMaintenanceHours"
           />
         </el-form-item>
       </el-col>
       <el-col :span="6">
         <el-form-item label="保养工时">
-          <el-input v-model="maintenanceForm.保养工时" placeholder="请输入保养工时" />
-        </el-form-item>
+  <el-input 
+    v-model="maintenanceForm.保养工时" 
+    :readonly="true" 
+    placeholder="自动计算"
+    :title="maintenanceForm.保养工时 ? '自动计算工时' : '请先选择保养时间段'"
+  />
+</el-form-item>
       </el-col>
     </el-row>
 
@@ -574,7 +607,7 @@
   // 全量引入格式化工具 请按需保留
   import dayjs, { Dayjs } from 'dayjs';
   import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
-  import {ref, reactive} from 'vue'
+  import {ref, reactive,watch} from 'vue'
   import { exportExcelFile } from '@/utils/excel'
   import { ElMessage, ElMessageBox } from 'element-plus'
   import {getMaintenanceTab,YearMaintenanceList,YearAccessoriesList,YearMaintainList,MonthAccessoriesList,
@@ -791,8 +824,8 @@ const initMaintenanceForm = () => ({
 })
 
 
-const repairForm = reactive(initRepairForm())
-const maintenanceForm = reactive(initMaintenanceForm())
+const repairForm = ref(initRepairForm())
+const maintenanceForm = ref(initMaintenanceForm())
 
 const dialogwxFormVisible = ref(false)
 const dialogbyFormVisible = ref(false)
@@ -811,11 +844,11 @@ const onADD = () => {
   if(yearcode.value === 0){
     ElMessage.error('请先选择左侧菜单')
   }else if (yearcode.value === 1 ){
-    Object.assign(repairForm, initRepairForm()) // 重置表单
+    repairForm.value = initRepairForm();
     type.value = 'create'
     dialogwxFormVisible.value = true
   }else if (yearcode.value === 2 ){
-    Object.assign(maintenanceForm, initMaintenanceForm()) // 重置表单
+    maintenanceForm.value = initMaintenanceForm();
     console.log('保养弹窗')
     type.value = 'create'
     dialogbyFormVisible.value = true
@@ -838,35 +871,35 @@ const wxmonthdoubleClick = async (row) => {
   const res = await MachineMaintenanceDetail({ UniqId: row.UniqId })
   
   // 清空原有数据
-  Object.assign(repairForm, initRepairForm())
+  repairForm.value = initRepairForm();
   
   // 逐个赋值
-  repairForm.部门 = res.data.使用部门 || ''
-  repairForm.设备编号 = res.data.设备编号 || ''
-  repairForm.设备名称 = res.data.设备名称 || ''
-  repairForm.故障报告时间 = res.data.报障时间 || ''
-  repairForm.维修性质 = res.data.维修性质 || ''
-  repairForm.故障现象 = res.data.故障现象 || ''
-  repairForm.维修受理时间 = res.data.维修受理时间 || ''
-  repairForm.等配件时间 = res.data.等配件时间 || ''
-  repairForm.修复时间 = res.data.修复时间 || ''
-  repairForm.原因分析及措施 = res.data.原因分析及措施 || ''
-  repairForm.实际维修工时 = res.data.实际维修工时 || ''
-  repairForm.设备故障总工时 = res.data.故障工时 || ''
-  repairForm.验收人 = res.data.验收人 || ''
-  repairForm.验收情况 = res.data.验收情况 || ''
+  repairForm.value.部门 = res.data.使用部门 || ''
+  repairForm.value.设备编号 = res.data.设备编号 || ''
+  repairForm.value.设备名称 = res.data.设备名称 || ''
+  repairForm.value.故障报告时间 = res.data.报障时间 || ''
+  repairForm.value.维修性质 = res.data.维修性质 || ''
+  repairForm.value.故障现象 = res.data.故障现象 || ''
+  repairForm.value.维修受理时间 = res.data.维修受理时间 || ''
+  repairForm.value.等配件时间 = res.data.等配件时间 || ''
+  repairForm.value.修复时间 = res.data.修复时间 || ''
+  repairForm.value.原因分析及措施 = res.data.原因分析及措施 || ''
+  repairForm.value.实际维修工时 = res.data.实际维修工时 || ''
+  repairForm.value.设备故障总工时 = res.data.故障工时 || ''
+  repairForm.value.验收人 = res.data.验收人 || ''
+  repairForm.value.验收情况 = res.data.验收情况 || ''
   
-  repairForm.code5 = res.data.机长 || ''
-  repairForm.name5 = res.data.机长姓名 || ''
-  repairForm.code1 = res.data.维修人员1 || ''
-  repairForm.name1 = res.data.维修人员姓名1 || ''
-  repairForm.code2 = res.data.维修人员2 || ''
-  repairForm.name2 = res.data.维修人员姓名2 || ''
-  repairForm.code3 = res.data.维修人员3 || ''
-  repairForm.name3 = res.data.维修人员姓名3 || ''
-  repairForm.code4 = res.data.维修人员4 || ''
-  repairForm.name4 = res.data.维修人员姓名4 || ''
-  repairForm.UniqId = res.data.UniqId || ''
+  repairForm.value.code5 = res.data.机长 || ''
+  repairForm.value.name5 = res.data.机长姓名 || ''
+  repairForm.value.code1 = res.data.维修人员1 || ''
+  repairForm.value.name1 = res.data.维修人员姓名1 || ''
+  repairForm.value.code2 = res.data.维修人员2 || ''
+  repairForm.value.name2 = res.data.维修人员姓名2 || ''
+  repairForm.value.code3 = res.data.维修人员3 || ''
+  repairForm.value.name3 = res.data.维修人员姓名3 || ''
+  repairForm.value.code4 = res.data.维修人员4 || ''
+  repairForm.value.name4 = res.data.维修人员姓名4 || ''
+  repairForm.value.UniqId = res.data.UniqId || ''
   dialogwxFormVisible.value = true
 }
 
@@ -875,26 +908,26 @@ const bymonthdoubleClick = async (row) => {
   const res = await MachineMaintainDetail({ UniqId: row.UniqId })
   
   // 清空原有数据
-  Object.assign(maintenanceForm, initMaintenanceForm())
+  maintenanceForm.value = initMaintenanceForm();
   console.log('维修详情',res)
   // 逐个赋值
-  maintenanceForm.部门 = res.data.使用部门 || ''
-  maintenanceForm.设备编号 = res.data.设备编号 || ''
-  maintenanceForm.设备名称 = res.data.设备名称 || ''
-  maintenanceForm.保养类型 = res.data.保养类型 || ''
-  maintenanceForm.保养时间段[0] = res.data.保养开始时间 || ''
-  maintenanceForm.保养时间段[1] = res.data.保养结束时间 || ''
-  maintenanceForm.保养工时 = res.data.保养工时 || ''
-  maintenanceForm.code1 = res.data.执行机修 || ''
-  maintenanceForm.name1 = res.data.执行机修姓名 || ''
-  maintenanceForm.code2 = res.data.执行机长 || ''
-  maintenanceForm.name2 = res.data.执行机长姓名 || ''
-  maintenanceForm.保养备注 = res.data.保养备注 || ''
-  maintenanceForm.code3 = res.data.验收人员 || ''
-  maintenanceForm.name3 = res.data.验收人员姓名 || ''
-  maintenanceForm.验收备注 = res.data.验收备注 || ''
-  maintenanceForm.保养评价 = res.data.验收情况 || ''
-  maintenanceForm.UniqId = res.data.UniqId || ''
+  maintenanceForm.value.部门 = res.data.使用部门 || ''
+  maintenanceForm.value.设备编号 = res.data.设备编号 || ''
+  maintenanceForm.value.设备名称 = res.data.设备名称 || ''
+  maintenanceForm.value.保养类型 = res.data.保养类型 || ''
+  maintenanceForm.value.保养时间段[0] = res.data.保养开始时间 || ''
+  maintenanceForm.value.保养时间段[1] = res.data.保养结束时间 || ''
+  maintenanceForm.value.保养工时 = res.data.保养工时 || ''
+  maintenanceForm.value.code1 = res.data.执行机修 || ''
+  maintenanceForm.value.name1 = res.data.执行机修姓名 || ''
+  maintenanceForm.value.code2 = res.data.执行机长 || ''
+  maintenanceForm.value.name2 = res.data.执行机长姓名 || ''
+  maintenanceForm.value.保养备注 = res.data.保养备注 || ''
+  maintenanceForm.value.code3 = res.data.验收人员 || ''
+  maintenanceForm.value.name3 = res.data.验收人员姓名 || ''
+  maintenanceForm.value.验收备注 = res.data.验收备注 || ''
+  maintenanceForm.value.保养评价 = res.data.验收情况 || ''
+  maintenanceForm.value.UniqId = res.data.UniqId || ''
   dialogbyFormVisible.value = true
 }
   
@@ -920,23 +953,23 @@ const getbm = async () => {
 // 部门选择处理
 const handleDeptSelect = (data) => {
   if(yearcode.value === 1){
-    repairForm.部门 = data.label
+    repairForm.value.部门 = data.label
   deptDialogVisible.value = false 
   }else if(yearcode.value === 2){
-    maintenanceForm.部门 = data.label
+    maintenanceForm.value.部门 = data.label
     deptDialogVisible.value = false 
   }
 }
 
 // 获取设备数据
 const getsb = async () => {
-  if (!repairForm.部门&&!maintenanceForm.部门) {
+  if (!repairForm.value.部门&&!maintenanceForm.value.部门) {
     ElMessage.warning('请先选择部门')
     return
   }
   
   try {
-    const res = await gdzl_MachineList({ address: yearcode.value === 1 ? repairForm.部门 : maintenanceForm.部门 })
+    const res = await gdzl_MachineList({ address: yearcode.value === 1 ? repairForm.value.部门 : maintenanceForm.value.部门 })
     if (res.code === 0) {
       if (!res.data) {
         ElMessage.warning('该部门下暂无设备')
@@ -958,12 +991,12 @@ const getsb = async () => {
 // 设备选择处理
 const handleDeviceSelect = (row) => {
   if(yearcode.value === 1){
-    repairForm.设备编号 = row.id
-  repairForm.设备名称 = row.name
+    repairForm.value.设备编号 = row.id
+  repairForm.value.设备名称 = row.name
   deviceDialogVisible.value = false
   }else if(yearcode.value === 2){
-    maintenanceForm.设备编号 = row.id
-    maintenanceForm.设备名称 = row.name
+    maintenanceForm.value.设备编号 = row.id
+    maintenanceForm.value.设备名称 = row.name
     deviceDialogVisible.value = false 
   }
 
@@ -975,9 +1008,36 @@ const showEmployeeDialog = ref(false)
 const employeeList = ref([])
 const currentSelectField = ref('') // 记录当前正在编辑的字段
 const currentFormType = ref('repair') // 记录当前操作的表单类型
+const isAcceptanceField = ref(false) // 标记是否为验收人字段
+
+// 打开员工选择弹窗 - 验收人专用
+const openEmployeeForAcceptance = async () => {
+  try {
+    const searchValue = repairForm.value.验收人 || ''
+    const response = await getYg({ sczl_bh: searchValue })
+    
+    if (response.code === 0) {
+      if (response.data.length === 1) {
+        // 只有一条数据直接填充姓名
+        repairForm.value.验收人 = response.data[0].ygxm
+      } else if (response.data.length > 1) {
+        // 多条数据展示弹窗,专门为验收人
+        isAcceptanceField.value = true
+        employeeList.value = response.data
+        showEmployeeDialog.value = true
+      }
+    }
+  } catch (error) {
+    console.error('获取员工失败:', error)
+    ElMessage.error('获取员工信息失败')
+  }
+}
 
 // 打开员工选择弹窗
+// 修改现有的openEmployeeDialog方法
 const openEmployeeDialog = (fieldPrefix) => {
+  isAcceptanceField.value = false
+  
   // 判断当前操作的表单类型
   if (dialogwxFormVisible.value) {
     currentFormType.value = 'repair'
@@ -986,11 +1046,30 @@ const openEmployeeDialog = (fieldPrefix) => {
   }
   
   currentSelectField.value = fieldPrefix.replace('code', '') // 存储基础数字部分
-  const form = currentFormType.value === 'repair' ? repairForm : maintenanceForm
+  const form = currentFormType.value === 'repair' ? repairForm.value : maintenanceForm.value
   const codeValue = form[fieldPrefix] || ''
   getEmployee(codeValue)
 }
 
+// 修改选择员工方法,添加对验收人的处理
+const selectEmployee = (row) => {
+  if (isAcceptanceField.value) {
+    // 验收人字段处理
+    repairForm.value.验收人 = row.ygxm
+  } else if (currentSelectField.value) {
+    // 原有的code1/code2/code3处理
+    const index = currentSelectField.value
+    if (currentFormType.value === 'repair') {
+      repairForm.value[`code${index}`] = row.员工编号
+      repairForm.value[`name${index}`] = row.ygxm
+    } else {
+      maintenanceForm.value[`code${index}`] = row.员工编号
+      maintenanceForm.value[`name${index}`] = row.ygxm
+    }
+  }
+  showEmployeeDialog.value = false
+  isAcceptanceField.value = false
+}
 // 获取员工数据
 const getEmployee = async (searchValue = '') => {
   try {
@@ -1011,44 +1090,153 @@ const getEmployee = async (searchValue = '') => {
   }
 }
 
-// 选择员工
-const selectEmployee = (row) => {
-  if (currentSelectField.value) {
-    const index = currentSelectField.value
-    if (currentFormType.value === 'repair') {
-      repairForm[`code${index}`] = row.员工编号
-      repairForm[`name${index}`] = row.ygxm
-    } else {
-      maintenanceForm[`code${index}`] = row.员工编号
-      maintenanceForm[`name${index}`] = row.ygxm
+
+// // 选择员工
+// const selectEmployee = (row) => {
+//   if (currentSelectField.value) {
+//     const index = currentSelectField.value
+//     if (currentFormType.value === 'repair') {
+//       repairForm.value[`code${index}`] = row.员工编号
+//       repairForm.value[`name${index}`] = row.ygxm
+//     } else {
+//       maintenanceForm.value[`code${index}`] = row.员工编号
+//       maintenanceForm.value[`name${index}`] = row.ygxm
+//     }
+//   }
+//   showEmployeeDialog.value = false
+// }
+
+const calculateWorkingHours = () => {
+  // 如果是 ref,需要通过 .value 访问
+  const { 维修受理时间, 修复时间 } = repairForm.value;
+  
+  if (!维修受理时间 || !修复时间) {
+    return;
+  }
+  
+  try {
+    const startTime = new Date(维修受理时间);
+    const endTime = new Date(修复时间);
+    
+    if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
+      console.error('日期格式无效');
+      return;
+    }
+    
+    if (endTime <= startTime) {
+      ElMessage.warning('维修完成时间必须晚于维修开始时间');
+      repairForm.value.修复时间 = '';
+      repairForm.value.实际维修工时 = '';
+      return;
     }
+    
+    const diffMs = endTime - startTime;
+    const diffHours = (diffMs / (1000 * 60 * 60)).toFixed(2);
+    repairForm.value.实际维修工时 = diffHours;
+    
+  } catch (error) {
+    console.error('计算工时错误:', error);
   }
-  showEmployeeDialog.value = false
-}
+};
+
+const validateTotalHours = () => {
+  const actualHours = parseFloat(repairForm.value.实际维修工时) || 0;
+  const totalHours = parseFloat(repairForm.value.设备故障总工时) || 0;
+  
+  if (totalHours < actualHours) {
+    ElMessage.warning('设备故障总工时不能小于实际维修工时');
+    repairForm.value.设备故障总工时 = actualHours.toString();
+  }
+};
+
+// 监听等配件时间
+watch(() => repairForm.value.等配件时间, (newVal) => {
+  if (newVal && repairForm.value.实际维修工时) {
+    const actualHours = parseFloat(repairForm.value.实际维修工时) || 0;
+    const waitingHours = parseFloat(newVal) || 0;
+    repairForm.value.设备故障总工时 = (actualHours + waitingHours).toFixed(2);
+  }
+});
+
+
+// 保养计算工时函数
+const calculateMaintenanceHours = () => {
+  // 使用 .value 访问 maintenanceForm
+  const { 保养时间段 } = maintenanceForm.value;
+  
+  // 检查保养时间段是否有值且是数组
+  if (!保养时间段 || !Array.isArray(保养时间段) || 保养时间段.length !== 2) {
+    maintenanceForm.value.保养工时 = '';
+    return;
+  }
+  
+  const [startTimeStr, endTimeStr] = 保养时间段;
+  
+  if (!startTimeStr || !endTimeStr) {
+    maintenanceForm.value.保养工时 = '';
+    return;
+  }
+  
+  try {
+    const startTime = new Date(startTimeStr);
+    const endTime = new Date(endTimeStr);
+    
+    if (isNaN(startTime.getTime()) || isNaN(endTime.getTime())) {
+      console.error('日期格式无效');
+      maintenanceForm.value.保养工时 = '';
+      return;
+    }
+    
+    if (endTime <= startTime) {
+      ElMessage.warning('保养结束时间必须晚于保养开始时间');
+      maintenanceForm.value.保养时间段 = [];
+      maintenanceForm.value.保养工时 = '';
+      return;
+    }
+    
+    // 计算时间差(毫秒)
+    const diffMs = endTime - startTime;
+    
+    // 转换为小时,保留2位小数
+    const diffHours = (diffMs / (1000 * 60 * 60)).toFixed(2);
+    
+    // 更新保养工时
+    maintenanceForm.value.保养工时 = diffHours;
+    
+  } catch (error) {
+    console.error('计算保养工时错误:', error);
+    maintenanceForm.value.保养工时 = '';
+  }
+};
+
+// 如果需要实时监听变化(可选),添加 watch
+watch(() => maintenanceForm.value.保养时间段, () => {
+  calculateMaintenanceHours();
+}, { deep: true });
 
 
 const wxenterDialog = async () => {
-  console.log('repairForm:', repairForm)
+  console.log('repairForm:', repairForm.value)
   const params = {
-    使用部门: repairForm.部门,
-    设备编号: repairForm.设备编号,
-    设备名称: repairForm.设备名称,
-    报障时间: dayjs(repairForm.故障报告时间).format('YYYY-MM-DD HH:mm:ss'),
-    报障人: repairForm.code5,
-    故障现象: repairForm.故障现象,
-    维修性质: repairForm.维修性质,
-    维修受理时间: dayjs(repairForm.维修受理时间).format('YYYY-MM-DD HH:mm:ss'),
-    等配件时间: repairForm.等配件时间,
-    修复时间: dayjs(repairForm.修复时间).format('YYYY-MM-DD HH:mm:ss'),
-    维修人员1: repairForm.code1,
-    维修人员2: repairForm.code2,
-    维修人员3: repairForm.code3,
-    维修人员4: repairForm.code4,
-    处理方法: repairForm.原因分析及措施,
-    实际维修工时: repairForm.实际维修工时,
-    故障工时: repairForm.设备故障总工时,
-    验收人: repairForm.验收人,
-    验收情况: repairForm.验收情况,
+    使用部门: repairForm.value.部门,
+    设备编号: repairForm.value.设备编号,
+    设备名称: repairForm.value.设备名称,
+    报障时间: dayjs(repairForm.value.故障报告时间).format('YYYY-MM-DD HH:mm:ss'),
+    报障人: repairForm.value.code5,
+    故障现象: repairForm.value.故障现象,
+    维修性质: repairForm.value.维修性质,
+    维修受理时间: dayjs(repairForm.value.维修受理时间).format('YYYY-MM-DD HH:mm:ss'),
+    等配件时间: repairForm.value.等配件时间,
+    修复时间: dayjs(repairForm.value.修复时间).format('YYYY-MM-DD HH:mm:ss'),
+    维修人员1: repairForm.value.code1,
+    维修人员2: repairForm.value.code2,
+    维修人员3: repairForm.value.code3,
+    维修人员4: repairForm.value.code4,
+    处理方法: repairForm.value.原因分析及措施,
+    实际维修工时: repairForm.value.实际维修工时,
+    故障工时: repairForm.value.设备故障总工时,
+    验收人: repairForm.value.验收人,
+    验收情况: repairForm.value.验收情况,
     sys_id: sys_id,
   }
 console.log(params)
@@ -1070,7 +1258,7 @@ console.log(type.value)
   }else if (type.value === 'update') {
     // 新增
     console.log('修改')
-    params.UniqId = repairForm.UniqId
+    params.UniqId = repairForm.value.UniqId
     try {
       const response = await MachineMaintenanceUpdate(params)
       if (response.code === 0) {
@@ -1086,22 +1274,22 @@ console.log(type.value)
 }
 
 const byenterDialog = async () => {
-  console.log('maintenanceForm:', maintenanceForm)
+  console.log('maintenanceForm:', maintenanceForm.value)
   const params = {
-    使用部门: maintenanceForm.部门,
-    设备编号: maintenanceForm.设备编号,
-    设备名称: maintenanceForm.设备名称,
-    保养类型: maintenanceForm.保养类型,
-    维修性质: maintenanceForm.维修性质,
-    保养开始时间: dayjs(maintenanceForm.保养时间段[0]).format('YYYY-MM-DD HH:mm:ss'),
-    保养结束时间: dayjs(maintenanceForm.保养时间段[1]).format('YYYY-MM-DD HH:mm:ss'),
-    保养工时: maintenanceForm.保养工时,
-    执行机修: maintenanceForm.code1,
-    执行机长:maintenanceForm.code2,
-    保养备注: maintenanceForm.保养备注,
-    验收人员: maintenanceForm.code3,
-    验收备注: maintenanceForm.验收备注,
-    验收情况: maintenanceForm.验收评价,
+    使用部门: maintenanceForm.value.部门,
+    设备编号: maintenanceForm.value.设备编号,
+    设备名称: maintenanceForm.value.设备名称,
+    保养类型: maintenanceForm.value.保养类型,
+    维修性质: maintenanceForm.value.维修性质,
+    保养开始时间: dayjs(maintenanceForm.value.保养时间段[0]).format('YYYY-MM-DD HH:mm:ss'),
+    保养结束时间: dayjs(maintenanceForm.value.保养时间段[1]).format('YYYY-MM-DD HH:mm:ss'),
+    保养工时: maintenanceForm.value.保养工时,
+    执行机修: maintenanceForm.value.code1,
+    执行机长:maintenanceForm.value.code2,
+    保养备注: maintenanceForm.value.保养备注,
+    验收人员: maintenanceForm.value.code3,
+    验收备注: maintenanceForm.value.验收备注,
+    验收情况: maintenanceForm.value.验收评价,
     sys_id: sys_id,
   }
 console.log(params)
@@ -1123,7 +1311,7 @@ console.log(type.value)
   }else if (type.value === 'update') {
     // 新增
     console.log('修改')
-    params.UniqId = maintenanceForm.UniqId
+    params.UniqId = maintenanceForm.value.UniqId
     try {
       const response = await MachineMaintainUpdate(params)
       if (response.code === 0) {
@@ -1138,6 +1326,8 @@ console.log(type.value)
   }
 }
 
+
+
 // 导出
 const wxtjDialog = ref(false)
 const wxtjrq = ref('')

+ 101 - 1
src/view/equipment/powerconsumption.vue

@@ -38,6 +38,7 @@
                         :data="hztableData"  border row-key="ID"
                         size="small" id="hztable"
                         :cell-class-name="gxbgCellClass"
+                        show-summary :summary-method="getSummaries"
                         highlight-current-row="true" @row-dblclick="updateCompanyFunc"
                         @row-click="hztableRowClick" :show-overflow-tooltip="true"
                         @selection-change="handleSelectionChange">
@@ -49,6 +50,13 @@
                <el-table-column   align="center" label="上月末辅电表读数" prop="lastAuxiliary"  width="130" />
                <el-table-column   align="center" label="本月末辅电表读数" prop="newAuxiliary"  width="130" />
                <el-table-column   align="center" label="辅电表耗电量" prop="auxiliaryNumber"  width="110" />
+               <el-table-column 
+        align="center" 
+        label="行合计" 
+        prop="rowTotal" 
+        width="160"
+        :formatter="rowTotalFormatter">
+    </el-table-column>
               </el-table>
   
               <!-- 分页 -->
@@ -145,7 +153,7 @@ const handleNodeClick = async (nodeData) => {
     
     // 检查响应有效性
     if (response?.code === 0 && Array.isArray(response.data)) {
-      hztableData.value = response.data;
+      hztableData.value = calculateRowTotals(response.data);
       console.log('表格数据更新成功:', response.data);
     } else {
       console.warn('返回数据格式异常:', response);
@@ -178,6 +186,98 @@ const hztableRowClick = async (row) => {
 }
 
 
+// 在获取数据后计算行合计
+const calculateRowTotals = (data) => {
+    return data.map(item => {
+        // 计算每一行的合计(主电表耗电量 + 辅电表耗电量)
+        const mainNum = Number(item.mainNumber) || 0;
+        const auxiliaryNum = Number(item.auxiliaryNumber) || 0;
+        item.rowTotal = mainNum + auxiliaryNum;
+        return item;
+    });
+};
+
+const getSummaries = (param) => {  
+    const { columns, data } = param;  
+    const sums = {};  
+    
+    // 列合计的列
+    const summableLabels = ["主电表耗电量", "辅电表耗电量", "行合计"];
+    
+    columns.forEach((column, index) => {  
+        if (index === 1) {  
+            sums[index] = '合计行';  
+            return;  
+        }  
+        
+        if (summableLabels.includes(column.label)) {  
+            const values = data.map(item => {
+                if (column.property === 'rowTotal') {
+                    // 行合计的计算
+                    const mainNum = Number(item.mainNumber) || 0;
+                    const auxiliaryNum = Number(item.auxiliaryNumber) || 0;
+                    return mainNum + auxiliaryNum;
+                }
+                return Number(item[column.property]);
+            });  
+            
+            if (!values.every(value => isNaN(value))) {  
+                sums[index] = values.reduce((prev, curr) => {  
+                    const value = Number(curr);  
+                    if (!isNaN(value)) {  
+                        return prev + value; 
+                    }  
+                    return prev;  
+                }, 0);  
+                
+                // 格式化为两位小数
+                if (typeof sums[index] === 'number') {
+                    sums[index] = sums[index].toFixed(2);
+                }
+            } else {  
+                sums[index] = 'N/A';  
+            }  
+        }  
+    });  
+    
+    return sums;  
+};
+
+
+	//合计
+	// const getSummaries = (param) => {  
+	//   const { columns, data } = param;  
+	//   const sums = {};  
+	//   //选择你希望合计的列
+	//   const summableLabels = [ "主电表耗电量","辅电表耗电量"];
+	//   columns.forEach((column, index) => {  
+	// 	  if (index === 1) {  
+	// 		  sums[index] = '合计';  
+	// 		  return;  
+	// 	  }  
+	
+	// 	  if (summableLabels.includes(column.label)) {  
+	// 		  const values = data.map(item => Number(item[column.property]));  
+	
+	// 		  // 检查数组中是否所有值都是 NaN  
+	// 		  if (!values.every(value => isNaN(value))) {  
+	// 			  sums[index] = values.reduce((prev, curr) => {  
+	// 				  const value = Number(curr);  
+	// 				  if (!isNaN(value)) {  
+	// 					  return prev + value; 
+	// 				  }  
+	// 				  return prev;  
+	// 			  }, 0);  
+	// 			  // 如果需要,可以在这里添加单位  
+	// 			  // sums[index] += ' 件';  
+	// 		  } else {  
+	// 			   sums[index] = 'N/A';  
+	// 		  }  
+	// 	  }  
+	//   });  
+	
+	//   return sums;  
+  // };  
   
 
   //导出按钮(汇总)

+ 27 - 48
src/view/performance/chejianbaogong.vue

@@ -533,16 +533,16 @@
 				  <el-table-column prop="检验项目" label="检验项目" width="320" />
 				  <el-table-column prop="点检方法" label="点检方法" width="180" />
 				  <el-table-column v-slot="scope"  label="正常"  width="70" >
-				  <el-checkbox v-model="scope.row.zc" @click="zcClick(scope.row)"></el-checkbox>
+				  <el-checkbox v-model="scope.row.zc" @change="zcClick(scope.row)"></el-checkbox>
 				  </el-table-column>
 				  <el-table-column v-slot="scope" label="异常" width="70"  >
-					 <el-checkbox v-model="scope.row.yc" @click="ycClick(scope.row)"></el-checkbox>
+					 <el-checkbox v-model="scope.row.yc" @change="ycClick(scope.row)"></el-checkbox>
 				  </el-table-column>
 				  <el-table-column v-slot="scope" label="备注说明" width="180" >
 				 <el-input v-model="scope.row.remark"/>
 				  </el-table-column>
 				  <el-table-column v-slot="scope" label="不检测" >
-					 <el-checkbox v-model="scope.row.notjc" @click="notjcClick(scope.row)"></el-checkbox>
+					 <el-checkbox v-model="scope.row.notjc" @change="notjcClick(scope.row)"></el-checkbox>
 				  </el-table-column>
 				</el-table>
 				<el-row :gutter="24">
@@ -4676,10 +4676,10 @@ const yinbaninvertSelection = () => {
   const dianjianDialog = async () => {
 	  dianjianselectData.splice(0, dianjianselectData.length, ...dianjianselectData.map(item=>{
 		  if(item.zc==true){
-			  item.status='正常'
+			  item.status='合格'
 		  }
 		  if(item.yc==true){
-			  item.status='异常'
+			  item.status='不合格'
 		  }
 		  if(item.notjc==true){
 			  item.status='不检测'
@@ -4695,10 +4695,12 @@ const yinbaninvertSelection = () => {
 		  delete item.判定标准
 		  return item
 	  }))
+	  console.log(dianjianselectData)
+	//   return;
 	  const response = await InspectionItemAdd(dianjianselectData);
 	  if (response.code === 0) {
 			successres('点检记录添加成功')
-			dianjianVisible.value=false
+			closedianjianDialog();
 	  }
   }
   //制程检验记录提交按钮
@@ -4788,6 +4790,8 @@ const yinbaninvertSelection = () => {
 	  }
   }
   const closedianjianDialog = async () => {
+	  dianjianselectData.splice(0, dianjianselectData.length);
+	  pandingfangfa.value=''
 	  dianjianVisible.value=false
   }
   const closezhichengDialog = async () => {
@@ -5007,48 +5011,23 @@ const yinbaninvertSelection = () => {
 	}
   };
   const notjcClick =  (val) => {
-	try {
-	  if(val.notjc==false){
-		  val.zc=false
-		  val.yc==false
-	  }else{
-		  val.zc=true
-		  val.yc==false
-	  }
-	} catch (error) {
-	  console.error('An error occurred:', error);
-	}
-  };
-  const zcClick =  (val) => {
-	try {
-		if(val.notjc==false){
-		   if(val.zc==false){
-			   val.yc=false
-		   }else{
-			   val.yc==true
-		   }
-		}{
-		  val.zc=true
-		}
-	} catch (error) {
-	  console.error('An error occurred:', error);
-	}
-  };
-  const ycClick =  (val) => {
-	try {
-		if(val.notjc==false){
-		  if(val.yc==false){
-			  val.zc=false
-		  }else{
-			  val.zc=true
-		  }
-		}else{
-		  val.yc=true
-		}
-	} catch (error) {
-	  console.error('An error occurred:', error);
-	}
-  };
+	console.log("不检测")
+	val.notjc=true
+	val.zc=false
+	val.yc=false
+};
+const zcClick =  (val) => {
+	console.log("合格")
+	val.notjc=false
+	val.zc=true
+	val.yc=false
+};
+const ycClick =  (val) => {
+	console.log("不合格")
+	val.notjc=false
+	val.zc=false
+	val.yc=true
+};
   
   let pandingfangfa=ref()
   //检验项目单击

+ 442 - 305
src/view/v23financial/v23CostOrder.vue

@@ -1,183 +1,221 @@
 <template>
-    <div>
+  <div>
+    <layout>
+      <layout-header>
+        <div class="">
+          <!--          按钮部分-->
+          <el-form ref="elSearchFormRef"   class="demo-form-inline" :rules="searchRule" >
+            <el-form-item>
+              <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input> -->
+              <!-- <el-button type="primary" class="bt" icon="edit"  @click="oncreate">成本计算</el-button> -->
+              <el-input v-model="searchInfo" placeholder="搜索工单编号" @keyup.enter="onSubmit" clearable style="width: 200px;margin: 5px"></el-input>
+              <el-button type="primary" icon="search" @click="onSubmit" title="搜索"  ></el-button>
+              <el-button type="primary" class="bt" icon="download" @click="ToExcel" >导出到Excel</el-button>
+            </el-form-item>
+          </el-form>
+
+      
+
+        </div>
+      </layout-header>
+
       <layout>
-        <layout-header>
-          <div class="">
-            <!--          按钮部分-->
-            <el-form ref="elSearchFormRef"   class="demo-form-inline" :rules="searchRule" >
-              <el-form-item>
-                <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input> -->
-                <el-button type="primary" class="bt" icon="edit"  @click="oncreate">成本计算</el-button>
-                <el-button type="primary" class="bt" icon="download" @click="ToExcel" >导出到Excel</el-button>
-              </el-form-item>
-            </el-form>
-  
-        
-  
+        <!--    左侧树侧形结构-->
+        <layout-sider :resize-directions="['right']" :width="190"  style="margin-right: 10px;height: 78vh">
+          <div class="JKWTree-tree" style="height: 200px">
+            <h3>V23工单成本独立核算</h3>
+            <el-tree :data="treeData"  :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
+            </el-tree>
           </div>
-        </layout-header>
-  
-        <layout>
-          <!--    左侧树侧形结构-->
-          <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
-            <div class="JKWTree-tree" style="height: 200px">
-              <h3>V23工单成本独立核算</h3>
-              <el-tree :data="treeData"  :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
-              </el-tree>
+        </layout-sider>
+
+        <!-- 右侧区域 -->
+        <layout-content >
+        <el-main>
+          <div class="gva-table-box">
+            <!-- 表格数据 -->
+            <el-table ref="multipleTable" style="width: 100%;height: 50vh" tooltip-effect="dark"
+                      :row-style="{ height: '25px' }"  :header-cell-style="{ padding: '0px' }"
+                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                      :data="hztableData"  border row-key="ID"
+                      size="small" id="tab2"
+
+                      :cell-class-name="gxbgCellClass"
+                      highlight-current-row="true" @row-dblclick="updateCompanyFunc"
+                      @row-click="tableRowClick" :show-overflow-tooltip="true"
+                      @selection-change="handleSelectionChange">
+                      <el-table-column sortable align="center" label="工单编号" prop="工单编号" width="120" />
+                     
+                      <el-table-column align="center" label="成品代号" prop="成品代号" width="120" />
+                      <el-table-column align="center" label="成品名称" prop="成品名称" width="300" />
+                      <el-table-column align="center" label="直接材料" prop="直接材料" width="120" />
+                      <el-table-column align="center" label="分摊材料" prop="分摊材料" width="120" />
+                      <el-table-column align="center" label="考核直接材料" prop="考核直接材料" width="120" />
+                      <el-table-column sortable align="center" label="车间名称" prop="车间名称" width="120" />
+                      <el-table-column sortable align="center" label="车间人工" prop="车间人工" width="120" />
+                      <el-table-column align="center" label="部门人工附加" prop="部门人工附加" width="120" />
+                      <el-table-column align="center" label="直接折旧" prop="直接折旧" width="120" />
+                      <el-table-column align="center" label="分摊折旧" prop="分摊折旧" width="120" />
+                      <el-table-column align="center" label="直接水电" prop="直接水电" width="120" />
+                      <el-table-column align="center" label="分摊水电" prop="分摊水电" width="120" />
+                      <el-table-column align="center" label="场地租金" prop="场地租金" width="120" />
+                      <el-table-column align="center" label="废气处理" prop="废气处理" width="120" />
+                      <el-table-column align="center" label="锅炉" prop="锅炉" width="120" />
+                      <el-table-column align="center" label="空压机" prop="空压机" width="120" />
+                      <el-table-column align="center" label="真空鼓风机" prop="真空鼓风机" width="120" />
+                      <el-table-column align="center" label="中央空调" prop="中央空调" width="120" />
+                      <el-table-column align="center" label="分摊其他" prop="分摊其他" width="120" />
+                      <el-table-column align="center" label="成本合计" prop="成本合计" width="120" />
+                      <el-table-column align="center" label="录入人" prop="Sys_id" width="120" />
+                      <el-table-column align="center" label="录入时间" prop="Sys_rq" width="160" />
+            </el-table>
+
+            <!-- 分页 -->
+            <div class="gva-pagination">
+                <el-pagination
+                  @size-change="handleSizeChange"
+                  @current-change="handleCurrentChange"
+                  :current-page="page"
+                  :page-size="limit"
+                  layout="total, sizes, prev, pager, next, jumper"
+                  :total="total">
+                </el-pagination>
+              </div>
+
+              <div class="formula-description">
+          <div class="formula-title">计算公式说明:</div>
+          <div class="formula-grid">
+            <div class="formula-item">
+              <span class="formula-label">水电分摊因子:</span>
+              <span class="formula-content">工单机台生产工时</span>
             </div>
-          </layout-sider>
-  
-          <!-- 右侧区域 -->
-          <layout-content >
-          <el-main>
-            <div class="gva-table-box">
-              <!-- 表格数据 -->
-              <el-table ref="multipleTable" style="width: 100%;height: 63vh" tooltip-effect="dark"
-                        :row-style="{ height: '25px' }"  :header-cell-style="{ padding: '0px' }"
-                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
-                        :data="hztableData"  border row-key="ID"
-                        size="small" id="tab2"
-
-                        :cell-class-name="gxbgCellClass"
-                        highlight-current-row="true" @row-dblclick="updateCompanyFunc"
-                        @row-click="tableRowClick" :show-overflow-tooltip="true"
-                        @selection-change="handleSelectionChange">
-               <el-table-column  sortable align="center" label="车间名称" prop="车间名称"  width="120" />
-               <el-table-column  sortable align="center" label="工单编号" prop="sczl_gdbh"  width="120" />
-               <el-table-column   align="center" label="年月" prop="sys_ny"  width="100" />
-               <el-table-column   align="center" label="印件号" prop="sczl_yjno"  width="90" />
-               <el-table-column   align="center" label="印件名称" prop="印件名称"  width="300" />
-               <el-table-column   align="center" label="工序号" prop="sczl_gxh"  width="90" />
-               <el-table-column   align="center" label="工序名称" prop="工序名称"  width="110" />
-               <el-table-column   align="center" label="设备编号" prop="sczl_jtbh"  width="110" />
-               <el-table-column   align="center" label="卷张换算系数" prop="卷张换算系数"  width="110" />
-               <el-table-column   align="center" label="占用机时" prop="占用机时"  width="110" />
-               <el-table-column   align="center" label="班组车头产量" prop="班组车头产量"  width="120" />
-               <el-table-column   align="center" label="墨数" prop="sczl_ms"  width="110" />
-               <el-table-column   align="center" label="工序难度系数" prop="工序难度系数"  width="200" />
-               <el-table-column   align="center" label="班组换算产量" prop="班组换算产量"  width="200" />
-               <el-table-column   align="center" label="千件工价" prop="千件工价"  width="110" />
-               <el-table-column   align="center" label="计件产量" prop="计件产量"  width="200" />
-               <el-table-column   align="center" label="水电分摊因子" prop="水电分摊因子"  width="200" />
-               <el-table-column   align="center" label="材料分摊因子" prop="材料分摊因子"  width="200" />
-               <el-table-column   align="center" label="人工分摊因子" prop="人工分摊因子"  width="200" />
-               <el-table-column   align="center" label="小时折旧额" prop="A_小时折旧额"  width="200" />
-               <el-table-column   align="center" label="车间人工" prop="车间人工"  width="110" />
-               <el-table-column   align="center" label="部门人工附加" prop="部门人工附加"  width="110" />
-               <el-table-column   align="center" label="直接材料" prop="直接材料"  width="200" />
-               <el-table-column   align="center" label="考核直接材料" prop="考核直接材料"  width="200" />
-               <el-table-column   align="center" label="分摊材料" prop="分摊材料"  width="110" />
-               <el-table-column   align="center" label="直接折旧" prop="直接折旧"  width="110" />
-               <el-table-column   align="center" label="分摊折旧" prop="分摊折旧"  width="200" />
-               <el-table-column   align="center" label="直接水电" prop="直接水电"  width="200" />
-               <el-table-column   align="center" label="分摊水电" prop="分摊水电"  width="110" />
-               <el-table-column   align="center" label="场地租金" prop="场地租金"  width="110" />
-               <el-table-column   align="center" label="废气处理" prop="废气处理"  width="200" />
-               <el-table-column   align="center" label="锅炉" prop="锅炉"  width="140" />
-               <el-table-column   align="center" label="热水锅炉" prop="热水锅炉"  width="110" />
-               <el-table-column   align="center" label="空压机A" prop="空压机A"  width="110" />
-               <el-table-column   align="center" label="空压机B" prop="空压机B"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机A" prop="真空鼓风机A"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机B" prop="真空鼓风机B"  width="110" />
-               <el-table-column   align="center" label="中央空调A" prop="中央空调A"  width="110" />
-               <el-table-column   align="center" label="中央空调B" prop="中央空调B"  width="110" />
-               <el-table-column   align="center" label="分摊其他" prop="分摊其他"  width="200" />
-               <el-table-column   align="center" label="成本合计" prop="客户编号"  width="200" />
-              </el-table>
-  
-              <!-- 分页 -->
-              <div class="gva-pagination">
-                  <el-pagination
-                    @size-change="handleSizeChange"
-                    @current-change="handleCurrentChange"
-                    :current-page="page"
-                    :page-size="limit"
-                    layout="total, sizes, prev, pager, next, jumper"
-                    :total="total">
-                  </el-pagination>
-                </div>
+            <div class="formula-item">
+              <span class="formula-label">材料分摊因子:</span>
+              <span class="formula-content">色度数</span>
             </div>
-
-            <el-dialog
-      v-model="costlist"
-      title="成本计算"
-      width="500px"
-      :close-on-click-modal="false"
-    >
-      <!-- 月份选择器 -->
-      <div class="date-picker-container">
-        <div class="date-picker-item">
-          <span class="label">计算月份:</span>
-          <el-date-picker
-            v-model="costMonth"
-            type="month"
-            placeholder="选择创建月份"
-            format="YYYY年MM月"
-            value-format="YYYYMM"
-          />
+            <div class="formula-item">
+              <span class="formula-label">人工分摊因子:</span>
+              <span class="formula-content">直接人工成本</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">小时折旧额:</span>
+              <span class="formula-content">机台小时折旧 × 水电分摊因子</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">车间人工:</span>
+              <span class="formula-content">车间人工成本 × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">部门人工附加:</span>
+              <span class="formula-content">部门人工 × (车间直接人工成本 ÷ 总直接人工成本) × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">直接材料:</span>
+              <span class="formula-content">ERP直接材料数量 × 单价</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">分摊材料:</span>
+              <span class="formula-content">ERP分摊材料数量 × 单价 × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">直接水电:</span>
+              <span class="formula-content">上报运行时长 × 电量单价</span>
+            </div>
+            <div class="formula-item full-width">
+              <span class="formula-label">废气处理、锅炉、热水锅炉、空压机、空调、鼓风机:</span>
+              <span class="formula-content">上报数量 × 单价 × (水电分摊因子 ÷ 总分摊因子)(锅炉和热水锅炉只算卷凹机组)</span>
+            </div>
+          </div>
         </div>
+
+          </div>
+
+          <el-dialog
+    v-model="costlist"
+    title="成本计算"
+    width="500px"
+    :close-on-click-modal="false"
+  >
+    <!-- 月份选择器 -->
+    <div class="date-picker-container">
+      <div class="date-picker-item">
+        <span class="label">计算月份:</span>
+        <el-date-picker
+          v-model="costMonth"
+          type="month"
+          placeholder="选择创建月份"
+          format="YYYY年MM月"
+          value-format="YYYYMM"
+        />
       </div>
+    </div>
 
-      <!-- 底部按钮 -->
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="costlist = false">取消</el-button>
-          <el-button type="primary" @click="costhandleConfirm">确定</el-button>
-        </span>
-      </template>
-    </el-dialog>
-          </el-main>
-        </layout-content>
-        </layout>
+    <!-- 底部按钮 -->
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="costlist = false">取消</el-button>
+        <el-button type="primary" @click="costhandleConfirm">确定</el-button>
+      </span>
+    </template>
+  </el-dialog>
+        </el-main>
+      </layout-content>
       </layout>
-    </div>
-  </template>
-  <script setup>
-  // 全量引入格式化工具 请按需保留
-  import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
-  import {ref, reactive} from 'vue'
-  import { useUserStore } from '@/pinia/modules/user'
-  import { exportExcelFile } from '@/utils/excel'
-  import {ElMessage} from "element-plus";
-  import * as XLSX from 'xlsx'
+    </layout>
+  </div>
+</template>
+<script setup>
+// 全量引入格式化工具 请按需保留
+import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
+import {ref, reactive} from 'vue'
+import { useUserStore } from '@/pinia/modules/user'
+import { exportExcelFile } from '@/utils/excel'
+import {ElMessage} from "element-plus";
+import * as XLSX from 'xlsx'
 import FileSaver from 'file-saver'
 import LuckyExcel from 'luckyexcel';
-  import {getSummaryTab,SummaryCostAccountingList,CostCalculation} from '@/api/jixiaoguanli/caiwubaobiao'
+import {getSummaryTab,SummaryCostAccountingList,GetCompletionWorkOrderCostTab,CompletionWorkOrderCostList} from '@/api/jixiaoguanli/caiwubaobiao'
 
-  defineOptions({name: 'Company'})
+defineOptions({name: 'Company'})
 
-  const userStore = useUserStore()
-  const _username = ref('')
-  _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
+const userStore = useUserStore()
+const _username = ref('')
+_username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
 
-  // =========== 获取左侧树侧形结构 ===========
+// =========== 获取左侧树侧形结构 ===========
 const treeData = ref([]);
 const defaultProps = {
   children: 'children',
   label: 'label'
 };
+
 const getTreeData = async () => {
   try {
-    const res = await getSummaryTab(); // 调用您的API接口
+    const res = await GetCompletionWorkOrderCostTab(); // 调用API接口
     
     if (res.code === 0 && res.data) {
-      // 转换数据结构
-      treeData.value = Object.entries(res.data).map(([yearMonth, workshops]) => {
-        // 提取年份和月份(假设格式为YYYYMM)
-        const year = yearMonth.substring(0, 4);
-        const month = yearMonth.substring(4);
-        
+      // 直接将数据转换为树节点,保留完整格式
+      treeData.value = res.data.map(item => {
+        const [value, label] = item.split('-->');
         return {
-          label: `${year}${month}`,
-          value: yearMonth,
-          children: workshops.map(workshop => ({
-            label: workshop.trim(), // 去除车间名称前后空格
-            value: `${yearMonth}-${workshop.trim()}`,
-            // 可以添加其他属性
-            type: 'workshop'
-          }))
+          label: item, // 直接使用原始字符串 "1010-->广东中烟"
+          value: value.trim(), // 编码部分作为value
+          originalCode: value.trim(), // 保留编码
+          originalName: label.trim(), // 保留名称
+          // 可以添加其他属性
+          type: 'company'
+        };
+      }).sort((a, b) => {
+        // 按编码排序逻辑:数字开头 > J开头 > Y开头
+        const getSortKey = (code) => {
+          const firstChar = code.charAt(0);
+          if (/[0-9]/.test(firstChar)) return '1' + code;
+          if (firstChar === 'J') return '2' + code;
+          if (firstChar === 'Y') return '3' + code;
+          return '4' + code;
         };
-      }).sort((a, b) => b.value.localeCompare(a.value)); // 按年月倒序排序
+        return getSortKey(a.value).localeCompare(getSortKey(b.value));
+      });
       
       console.log('生成的树形数据:', treeData.value);
     } else {
@@ -189,178 +227,277 @@ const getTreeData = async () => {
 };
 getTreeData();
 
+//备份按字母分组
+// const getTreeData = async () => {
+//   try {
+//     const res = await GetCompletionWorkOrderCostTab();
+    
+//     if (res.code === 0 && res.data) {
+//       // 定义分组
+//       const groups = {
+//         '数字编码': { label: '数字编码', children: [] },
+//         'J编码': { label: 'J编码', children: [] },
+//         'Y编码': { label: 'Y编码', children: [] }
+//       };
+      
+//       // 处理每个条目
+//       res.data.forEach(item => {
+//         const [value, label] = item.split('-->');
+//         const code = value.trim();
+//         const name = label.trim();
+        
+//         const node = {
+//           label: item, // 直接使用原始字符串 "1010-->广东中烟"
+//           value: `${code}`, // 使用编码作为value
+//           originalCode: code,
+//           originalName: name,
+//           type: 'company'
+//         };
+        
+//         // 根据编码前缀分组
+//         const prefix = code.charAt(0);
+//         if (/[0-9]/.test(prefix)) {
+//           groups['数字编码'].children.push(node);
+//         } else if (prefix === 'J') {
+//           groups['J编码'].children.push(node);
+//         } else if (prefix === 'Y') {
+//           groups['Y编码'].children.push(node);
+//         } else {
+//           groups['数字编码'].children.push(node);
+//         }
+//       });
+      
+//       // 转换为树形结构,并排序
+//       treeData.value = Object.values(groups)
+//         .filter(group => group.children.length > 0) // 只保留有数据的组
+//         .map(group => {
+//           // 对每个组内的节点排序
+//           group.children.sort((a, b) => {
+//             // 按编码排序
+//             const getSortKey = (code) => {
+//               // 如果是纯数字编码,按数字大小排序
+//               if (/^\d+$/.test(code)) {
+//                 return code.padStart(10, '0'); // 补零确保数字正确排序
+//               }
+//               return code;
+//             };
+//             return getSortKey(a.originalCode).localeCompare(getSortKey(b.originalCode));
+//           });
+          
+//           return {
+//             label: group.label,
+//             value: group.label,
+//             children: group.children
+//           };
+//         });
+      
+//       console.log('按分组生成的树形数据:', treeData.value);
+//     }
+//   } catch (error) {
+//     console.error('请求出错:', error);
+//   }
+// };
+
+const total = ref(0)
+const page = ref(1)
+const limit = ref(50)
+const nodeclick = ref('')
 const hztableData = ref([])
 const handleNodeClick = async (nodeData) => {
-  console.log('点击节点:', nodeData);
-  
-  // 根据节点类型处理不同逻辑
-  if (nodeData.value.split('-').length === 1) {
-    // 点击了年月节点
-    console.log('选择了年月:', nodeData.label);
-  } else {
-    // 点击了车间节点
-    const [yearMonth, workshop] = nodeData.value.split('-');
-    console.log(`选择了 ${yearMonth} 的 ${workshop}`);
-    const res = await SummaryCostAccountingList({month:yearMonth,sist:workshop})
+console.log('点击节点:', nodeData);
+nodeclick.value = nodeData
+// 根据节点类型处理不同逻辑
+if (nodeData.value.split('-').length === 1) {
+  // 点击了年月节点
+  console.log('选择了:', nodeData.label);
+  const res = await CompletionWorkOrderCostList({code:nodeData.label.split('-->')[0],page:page.value,limit:limit.value})
+  console.log(res)
+  if(res.code === 0){
+      hztableData.value = res.data.list
+      total.value = res.data.total
+  }
+}
+};
+
+const handleSizeChange = (val) => {
+limit.value = val;
+handleNodeClick(nodeclick.value);
+}
+
+const handleCurrentChange = (val) => {
+page.value = val;
+handleNodeClick(nodeclick.value);
+}
+
+
+const searchInfo = ref('')
+// 搜索按钮点击事件
+const onSubmit = async () => {
+  if (!searchInfo.value) {
+    ElMessage.error('请输入工单编号');
+    return;
+  }
+  try {
+    const res = await CompletionWorkOrderCostList({search:searchInfo.value,page:page.value,limit:limit.value})
     console.log(res)
     if(res.code === 0){
-        hztableData.value = res.data
-
+        hztableData.value = res.data.list
+        total.value = res.data.total
     }
+  } catch (error) {
+    console.error(error);
   }
 };
 
-  
 //导出按钮
 const ToExcel = async () => { 
-  try {
-    const el = document.getElementById('tab2');
-    //  使用table_to_sheet获取工作表对象
-    const worksheet = XLSX.utils.table_to_sheet(el, { raw: true });
-    //设置从C列开始为数字格式
-    const range = XLSX.utils.decode_range(worksheet['!ref']);
-    for (let col = 3; col <= range.e.c; col++) { // 从C列(索引2)开始
-      for (let row = range.s.r + 1; row <= range.e.r; row++) { // 跳过表头行
-        const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
-        if (worksheet[cellAddress]) {
-          // 尝试转换为数字
-          const cellValue = worksheet[cellAddress].v;
-          const numValue = Number(cellValue);
-          
-          if (!isNaN(numValue)) {
-            worksheet[cellAddress].t = 'n'; // 数字类型
-            worksheet[cellAddress].v = numValue; // 更新值
-            // worksheet[cellAddress].z = '0.000'; // 数字格式
-          }
+try {
+  const el = document.getElementById('tab2');
+  //  使用table_to_sheet获取工作表对象
+  const worksheet = XLSX.utils.table_to_sheet(el, { raw: true });
+  //设置从C列开始为数字格式
+  const range = XLSX.utils.decode_range(worksheet['!ref']);
+  for (let col = 3; col <= range.e.c; col++) { // 从C列(索引2)开始
+    for (let row = range.s.r + 1; row <= range.e.r; row++) { // 跳过表头行
+      const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
+      if (worksheet[cellAddress]) {
+        // 尝试转换为数字
+        const cellValue = worksheet[cellAddress].v;
+        const numValue = Number(cellValue);
+        
+        if (!isNaN(numValue)) {
+          worksheet[cellAddress].t = 'n'; // 数字类型
+          worksheet[cellAddress].v = numValue; // 更新值
+          // worksheet[cellAddress].z = '0.000'; // 数字格式
         }
       }
     }
-    
-    // 创建并导出工作簿
-    const workbook = XLSX.utils.book_new();
-    XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
-    XLSX.writeFile(workbook, '成本汇总.xlsx');
-    
-  } catch (error) {
-    console.error('导出失败:', error);
-    ElMessage.error('导出数据失败,请重试');
   }
-};
   
+  // 创建并导出工作簿
+  const workbook = XLSX.utils.book_new();
+  XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+  XLSX.writeFile(workbook, '成本汇总.xlsx');
+  
+} catch (error) {
+  console.error('导出失败:', error);
+  ElMessage.error('导出数据失败,请重试');
+}
+};
+
 const costlist = ref(false)
 const costMonth = ref('')
-  
+
 const oncreate = () => {
-  costlist.value = true;
+costlist.value = true;
 }
 
-const costhandleConfirm = async () => {
-  if (!costMonth.value) {
-    ElMessage.error('请选择计算月份');
-    return;
-  }
-  try {
-    const qtdtAdds = await CostCalculation({
-      month: costMonth.value,
-      sys_id: userStore.userInfo.nickName
-    });
-    if (qtdtAdds.code === 0) {
-      costlist.value = false;
-      ElMessage({type: 'success',message: '计算成功'})
-    } else {
-      ElMessage({type: 'error',message: '计算失败'})
-    }
-  } catch (error) {
-    console.error(error);
-  }
+// const costhandleConfirm = async () => {
+//   if (!costMonth.value) {
+//     ElMessage.error('请选择计算月份');
+//     return;
+//   }
+//   try {
+//     const qtdtAdds = await ({
+//       month: costMonth.value,
+//       sys_id: userStore.userInfo.nickName
+//     });
+//     if (qtdtAdds.code === 0) {
+//       costlist.value = false;
+//       ElMessage({type: 'success',message: '计算成功'})
+//     } else {
+//       ElMessage({type: 'error',message: '计算失败'})
+//     }
+//   } catch (error) {
+//     console.error(error);
+//   }
+// }
+
+
+</script>
+
+<style scoped>
+.form-container {
+  display: flex;
+  flex-wrap: wrap;
 }
-  
-  
-  </script>
-  
-  <style scoped>
-  .form-container {
-    display: flex;
-    flex-wrap: wrap;
-  }
-  
+
+.form-column {
+  /*flex: 1;*/
+  margin-right: 15px; /* 调整列之间的间距 */
+}
+
+/* 左侧输入框宽度调整 */
+.form-column .el-form-item .el-input {
+  width: 150px; /* 调整左侧输入框的宽度 */
+}
+
+:deep(.hui-plan-usage-lows  div) {
+  color: #8c939d !important;
+}
+:deep(.lan-plan-usage-lows  div) {
+  color: blue !important;
+  font-weight: bold;
+}
+
+
+/* 媒体查询,根据需要调整断点 */
+@media screen and (max-width: 768px) {
   .form-column {
-    /*flex: 1;*/
-    margin-right: 15px; /* 调整列之间的间距 */
-  }
-  
-  /* 左侧输入框宽度调整 */
-  .form-column .el-form-item .el-input {
-    width: 150px; /* 调整左侧输入框的宽度 */
+    flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
+    margin-right: 0;
   }
-  
-  :deep(.hui-plan-usage-lows  div) {
-    color: #8c939d !important;
-  }
-  :deep(.lan-plan-usage-lows  div) {
-    color: blue !important;
-    font-weight: bold;
-  }
-  
+}
+/*:deep(.el-table td .cell) {*/
+/*  line-height: 30px !important;*/
+/*}*/
+.JKWTree-container {
+  display: flex;
+}
+.JKWTree-tree {
+  /*width: 300px;*/
+  background-color: #fff;
+  padding: 10px;
+  margin-right: 20px;
+}
+.JKWTree-tree h3 {
+  font-size: 15px;
+  font-weight: 700;
+  margin: 10px 0;
+}
+.JKWTree-content {
+  flex: 1;
+}
 
-  /* 媒体查询,根据需要调整断点 */
-  @media screen and (max-width: 768px) {
-    .form-column {
-      flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
-      margin-right: 0;
-    }
-  }
-  /*:deep(.el-table td .cell) {*/
-  /*  line-height: 30px !important;*/
-  /*}*/
-  .JKWTree-container {
-    display: flex;
-  }
-  .JKWTree-tree {
-    /*width: 300px;*/
-    background-color: #fff;
-    padding: 10px;
-    margin-right: 20px;
-  }
-  .JKWTree-tree h3 {
-    font-size: 15px;
-    font-weight: 700;
-    margin: 10px 0;
-  }
-  .JKWTree-content {
-    flex: 1;
-  }
 
-  
-  /* 选中某行时的背景色 */
-  :deep(.el-table__body tr.current-row) > td {
-    background: #ff80ff !important;
-  }
-  </style>
-  <style scoped>
-  :deep(.el-table td .cell) {
-    line-height: 20px !important;
-  }
-  :deep(.el-tabs__header){
-    margin-bottom: 0;
-  }
-  .search{
-    margin-left: 0px !important;
-    margin-right: 10px !important;
-  }
-  .bt{
-    margin-left: 2px !important;
-    padding: 3px !important;
-    font-size: 12px;
-  }
-  .el-tabs__header{
-    margin: 0px !important;
-  }
-  .gva-table-box{
-    padding: 0px !important;
-  }
-  .mab{
-    margin-bottom: 5px;
-  }
-  </style>
-  
+/* 选中某行时的背景色 */
+:deep(.el-table__body tr.current-row) > td {
+  background: #ff80ff !important;
+}
+</style>
+<style scoped>
+:deep(.el-table td .cell) {
+  line-height: 20px !important;
+}
+:deep(.el-tabs__header){
+  margin-bottom: 0;
+}
+.search{
+  margin-left: 0px !important;
+  margin-right: 10px !important;
+}
+.bt{
+  margin-left: 2px !important;
+  padding: 3px !important;
+  font-size: 12px;
+}
+.el-tabs__header{
+  margin: 0px !important;
+}
+.gva-table-box{
+  padding: 0px !important;
+}
+.mab{
+  margin-bottom: 5px;
+}
+</style>

+ 357 - 299
src/view/v23financial/v23CostProcess.vue

@@ -1,181 +1,226 @@
 <template>
-    <div>
+  <div>
+    <layout>
+      <layout-header>
+        <div class="">
+          <!--          按钮部分-->
+          <el-form ref="elSearchFormRef"   class="demo-form-inline" :rules="searchRule" >
+            <el-form-item>
+              <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input> -->
+              <!-- <el-button type="primary" class="bt" icon="edit"  @click="oncreate">成本计算</el-button> -->
+              <el-button type="primary" class="bt" icon="download" @click="ToExcel" >导出到Excel</el-button>
+            </el-form-item>
+          </el-form>
+
+      
+
+        </div>
+      </layout-header>
+
       <layout>
-        <layout-header>
-          <div class="">
-            <!--          按钮部分-->
-            <el-form ref="elSearchFormRef"   class="demo-form-inline" :rules="searchRule" >
-              <el-form-item>
-                <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input> -->
-                <el-button type="primary" class="bt" icon="edit"  @click="oncreate">成本计算</el-button>
-                <el-button type="primary" class="bt" icon="download" @click="ToExcel" >导出到Excel</el-button>
-              </el-form-item>
-            </el-form>
-  
-        
-  
+        <!--    左侧树侧形结构-->
+        <layout-sider :resize-directions="['right']" :width="190"  style="margin-right: 10px;height: 78vh">
+          <div class="JKWTree-tree" style="height: 200px">
+            <h3>V23工序成本独立核算</h3>
+            <el-tree :data="treeData"  :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
+            </el-tree>
           </div>
-        </layout-header>
-  
-        <layout>
-          <!--    左侧树侧形结构-->
-          <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
-            <div class="JKWTree-tree" style="height: 200px">
-              <h3>V23工序成本独立核算</h3>
-              <el-tree :data="treeData"  :props="defaultProps" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
-              </el-tree>
-            </div>
-          </layout-sider>
-  
-          <!-- 右侧区域 -->
-          <layout-content >
-          <el-main>
-            <div class="gva-table-box">
-              <!-- 表格数据 -->
-              <el-table ref="multipleTable" style="width: 100%;height: 76vh" tooltip-effect="dark"
-                        :row-style="{ height: '25px' }"  :header-cell-style="{ padding: '0px' }"
-                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
-                        :data="hztableData"  border row-key="ID"
-                        size="small" id="tab2"
+        </layout-sider>
 
-                        :cell-class-name="gxbgCellClass"
-                        highlight-current-row="true" @row-dblclick="updateCompanyFunc"
-                        @row-click="tableRowClick" :show-overflow-tooltip="true"
-                        @selection-change="handleSelectionChange">
-               <el-table-column  sortable align="center" label="车间名称" prop="车间名称"  width="120" />
-               <el-table-column  sortable align="center" label="工单编号" prop="sczl_gdbh"  width="120" />
-               <el-table-column   align="center" label="年月" prop="sys_ny"  width="100" />
-               <el-table-column   align="center" label="印件号" prop="sczl_yjno"  width="90" />
-               <el-table-column   align="center" label="印件名称" prop="印件名称"  width="300" />
-               <el-table-column   align="center" label="工序号" prop="sczl_gxh"  width="90" />
-               <el-table-column   align="center" label="工序名称" prop="工序名称"  width="110" />
-               <el-table-column   align="center" label="设备编号" prop="sczl_jtbh"  width="110" />
-               <el-table-column   align="center" label="卷张换算系数" prop="卷张换算系数"  width="110" />
-               <el-table-column   align="center" label="占用机时" prop="占用机时"  width="110" />
-               <el-table-column   align="center" label="班组车头产量" prop="班组车头产量"  width="120" />
-               <el-table-column   align="center" label="墨数" prop="sczl_ms"  width="110" />
-               <el-table-column   align="center" label="工序难度系数" prop="工序难度系数"  width="200" />
-               <el-table-column   align="center" label="班组换算产量" prop="班组换算产量"  width="200" />
-               <el-table-column   align="center" label="千件工价" prop="千件工价"  width="110" />
-               <el-table-column   align="center" label="计件产量" prop="计件产量"  width="200" />
-               <el-table-column   align="center" label="水电分摊因子" prop="水电分摊因子"  width="200" />
-               <el-table-column   align="center" label="材料分摊因子" prop="材料分摊因子"  width="200" />
-               <el-table-column   align="center" label="人工分摊因子" prop="人工分摊因子"  width="200" />
-               <el-table-column   align="center" label="小时折旧额" prop="A_小时折旧额"  width="200" />
-               <el-table-column   align="center" label="车间人工" prop="车间人工"  width="110" />
-               <el-table-column   align="center" label="部门人工附加" prop="部门人工附加"  width="110" />
-               <el-table-column   align="center" label="直接材料" prop="直接材料"  width="200" />
-               <el-table-column   align="center" label="考核直接材料" prop="考核直接材料"  width="200" />
-               <el-table-column   align="center" label="分摊材料" prop="分摊材料"  width="110" />
-               <el-table-column   align="center" label="直接折旧" prop="直接折旧"  width="110" />
-               <el-table-column   align="center" label="分摊折旧" prop="分摊折旧"  width="200" />
-               <el-table-column   align="center" label="直接水电" prop="直接水电"  width="200" />
-               <el-table-column   align="center" label="分摊水电" prop="分摊水电"  width="110" />
-               <el-table-column   align="center" label="场地租金" prop="场地租金"  width="110" />
-               <el-table-column   align="center" label="废气处理" prop="废气处理"  width="200" />
-               <el-table-column   align="center" label="锅炉" prop="锅炉"  width="140" />
-               <el-table-column   align="center" label="热水锅炉" prop="热水锅炉"  width="110" />
-               <el-table-column   align="center" label="空压机A" prop="空压机A"  width="110" />
-               <el-table-column   align="center" label="空压机B" prop="空压机B"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机A" prop="真空鼓风机A"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机B" prop="真空鼓风机B"  width="110" />
-               <el-table-column   align="center" label="中央空调A" prop="中央空调A"  width="110" />
-               <el-table-column   align="center" label="中央空调B" prop="中央空调B"  width="110" />
-               <el-table-column   align="center" label="分摊其他" prop="分摊其他"  width="200" />
-               <el-table-column   align="center" label="成本合计" prop="客户编号"  width="200" />
-              </el-table>
-  
-              <!-- 分页 -->
-              <div class="gva-pagination">
-                <el-pagination layout="total" :current-page="page" :page-size="pageSize"
-                 :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
+        <!-- 右侧区域 -->
+        <layout-content >
+        <el-main>
+          <div class="gva-table-box">
+            <!-- 表格数据 -->
+            <el-table ref="multipleTable" style="width: 100%;height: 50vh" tooltip-effect="dark"
+                      :row-style="{ height: '25px' }"  :header-cell-style="{ padding: '0px' }"
+                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
+                      :data="hztableData"  border row-key="ID"
+                      size="small" id="tab2"
+
+                      :cell-class-name="gxbgCellClass"
+                      highlight-current-row="true" @row-dblclick="updateCompanyFunc"
+                      @row-click="tableRowClick" :show-overflow-tooltip="true"
+                      @selection-change="handleSelectionChange">
+             <el-table-column  sortable align="center" label="车间名称" prop="车间名称"  width="120" />
+             <el-table-column  sortable align="center" label="工单编号" prop="sczl_gdbh"  width="120" />
+             <el-table-column   align="center" label="年月" prop="sys_ny"  width="100" />
+             <el-table-column   align="center" label="印件号" prop="sczl_yjno"  width="90" />
+             <el-table-column   align="center" label="印件名称" prop="印件名称"  width="300" />
+             <el-table-column   align="center" label="工序号" prop="sczl_gxh"  width="90" />
+             <el-table-column   align="center" label="工序名称" prop="工序名称"  width="110" />
+             <el-table-column   align="center" label="设备编号" prop="sczl_jtbh"  width="110" />
+             <el-table-column   align="center" label="卷张换算系数" prop="卷张换算系数"  width="110" />
+             <el-table-column   align="center" label="占用机时" prop="占用机时"  width="110" />
+             <el-table-column   align="center" label="班组车头产量" prop="班组车头产量"  width="120" />
+             <el-table-column   align="center" label="墨数" prop="sczl_ms"  width="110" />
+             <el-table-column   align="center" label="工序难度系数" prop="工序难度系数"  width="200" />
+             <el-table-column   align="center" label="班组换算产量" prop="班组换算产量"  width="200" />
+             <el-table-column   align="center" label="千件工价" prop="千件工价"  width="110" />
+             <el-table-column   align="center" label="计件产量" prop="计件产量"  width="200" />
+             <el-table-column   align="center" label="水电分摊因子" prop="水电分摊因子"  width="200" />
+             <el-table-column   align="center" label="材料分摊因子" prop="材料分摊因子"  width="200" />
+             <el-table-column   align="center" label="人工分摊因子" prop="人工分摊因子"  width="200" />
+             <el-table-column   align="center" label="小时折旧额" prop="A_小时折旧额"  width="200" />
+             <el-table-column   align="center" label="车间人工" prop="车间人工"  width="110" />
+             <el-table-column   align="center" label="部门人工附加" prop="部门人工附加"  width="110" />
+             <el-table-column   align="center" label="直接材料" prop="直接材料"  width="200" />
+             <el-table-column   align="center" label="考核直接材料" prop="考核直接材料"  width="200" />
+             <el-table-column   align="center" label="分摊材料" prop="分摊材料"  width="110" />
+             <el-table-column   align="center" label="直接折旧" prop="直接折旧"  width="110" />
+             <el-table-column   align="center" label="分摊折旧" prop="分摊折旧"  width="200" />
+             <el-table-column   align="center" label="直接水电" prop="直接水电"  width="200" />
+             <el-table-column   align="center" label="分摊水电" prop="分摊水电"  width="110" />
+             <el-table-column   align="center" label="场地租金" prop="场地租金"  width="110" />
+             <el-table-column   align="center" label="废气处理" prop="废气处理"  width="200" />
+             <el-table-column   align="center" label="锅炉" prop="锅炉"  width="140" />
+             <el-table-column   align="center" label="热水锅炉" prop="热水锅炉"  width="110" />
+             <el-table-column   align="center" label="空压机" prop="空压机"  width="110" />
+             <el-table-column   align="center" label="真空鼓风机" prop="真空鼓风机"  width="110" />
+             <el-table-column   align="center" label="中央空调" prop="中央空调"  width="110" />
+             <el-table-column   align="center" label="分摊其他" prop="分摊其他"  width="200" />
+             <el-table-column   align="center" label="成本合计" prop="客户编号"  width="200" />
+            </el-table>
+
+            <!-- 分页 -->
+            <div class="gva-pagination">
+                <el-pagination
+                  @size-change="handleSizeChange"
+                  @current-change="handleCurrentChange"
+                  :current-page="page"
+                  :page-size="limit"
+                  layout="total, sizes, prev, pager, next, jumper"
+                  :total="total">
+                </el-pagination>
               </div>
-            </div>
 
-            <el-dialog
-      v-model="costlist"
-      title="成本计算"
-      width="500px"
-      :close-on-click-modal="false"
-    >
-      <!-- 月份选择器 -->
-      <div class="date-picker-container">
-        <div class="date-picker-item">
-          <span class="label">计算月份:</span>
-          <el-date-picker
-            v-model="costMonth"
-            type="month"
-            placeholder="选择创建月份"
-            format="YYYY年MM月"
-            value-format="YYYYMM"
-          />
+              <div class="formula-description">
+          <div class="formula-title">计算公式说明:</div>
+          <div class="formula-grid">
+            <div class="formula-item">
+              <span class="formula-label">水电分摊因子:</span>
+              <span class="formula-content">工单机台生产工时</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">材料分摊因子:</span>
+              <span class="formula-content">色度数</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">人工分摊因子:</span>
+              <span class="formula-content">直接人工成本</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">小时折旧额:</span>
+              <span class="formula-content">机台小时折旧 × 水电分摊因子</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">车间人工:</span>
+              <span class="formula-content">车间人工成本 × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">部门人工附加:</span>
+              <span class="formula-content">部门人工 × (车间直接人工成本 ÷ 总直接人工成本) × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">直接材料:</span>
+              <span class="formula-content">ERP直接材料数量 × 单价</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">分摊材料:</span>
+              <span class="formula-content">ERP分摊材料数量 × 单价 × (工单工序色度数 ÷ 车间总色度数)</span>
+            </div>
+            <div class="formula-item">
+              <span class="formula-label">直接水电:</span>
+              <span class="formula-content">上报运行时长 × 电量单价</span>
+            </div>
+            <div class="formula-item full-width">
+              <span class="formula-label">废气处理、锅炉、热水锅炉、空压机、空调、鼓风机:</span>
+              <span class="formula-content">上报数量 × 单价 × (水电分摊因子 ÷ 总分摊因子)(锅炉和热水锅炉只算卷凹机组)</span>
+            </div>
+          </div>
         </div>
+
+          </div>
+
+          <el-dialog
+    v-model="costlist"
+    title="成本计算"
+    width="500px"
+    :close-on-click-modal="false"
+  >
+    <!-- 月份选择器 -->
+    <div class="date-picker-container">
+      <div class="date-picker-item">
+        <span class="label">计算月份:</span>
+        <el-date-picker
+          v-model="costMonth"
+          type="month"
+          placeholder="选择创建月份"
+          format="YYYY年MM月"
+          value-format="YYYYMM"
+        />
       </div>
+    </div>
 
-      <!-- 底部按钮 -->
-      <template #footer>
-        <span class="dialog-footer">
-          <el-button @click="costlist = false">取消</el-button>
-          <el-button type="primary" @click="costhandleConfirm">确定</el-button>
-        </span>
-      </template>
-    </el-dialog>
-          </el-main>
-        </layout-content>
-        </layout>
+    <!-- 底部按钮 -->
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="costlist = false">取消</el-button>
+        <el-button type="primary" @click="costhandleConfirm">确定</el-button>
+      </span>
+    </template>
+  </el-dialog>
+        </el-main>
+      </layout-content>
       </layout>
-    </div>
-  </template>
-  <script setup>
-  // 全量引入格式化工具 请按需保留
-  import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
-  import {ref, reactive} from 'vue'
-  import { useUserStore } from '@/pinia/modules/user'
-  import { exportExcelFile } from '@/utils/excel'
-  import {ElMessage} from "element-plus";
-  import * as XLSX from 'xlsx'
+    </layout>
+  </div>
+</template>
+<script setup>
+// 全量引入格式化工具 请按需保留
+import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
+import {ref, reactive} from 'vue'
+import { useUserStore } from '@/pinia/modules/user'
+import { exportExcelFile } from '@/utils/excel'
+import {ElMessage} from "element-plus";
+import * as XLSX from 'xlsx'
 import FileSaver from 'file-saver'
 import LuckyExcel from 'luckyexcel';
-  import {getSummaryTab,SummaryCostAccountingList,CostCalculation} from '@/api/jixiaoguanli/caiwubaobiao'
+import {getSummaryTab,SummaryCostAccountingList,getProcessTab,ProcessCostAccountingList} from '@/api/jixiaoguanli/caiwubaobiao'
 
-  defineOptions({name: 'Company'})
+defineOptions({name: 'Company'})
 
-  const userStore = useUserStore()
-  const _username = ref('')
-  _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
+const userStore = useUserStore()
+const _username = ref('')
+_username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
 
-  // =========== 获取左侧树侧形结构 ===========
+// =========== 获取左侧树侧形结构 ===========
 const treeData = ref([]);
 const defaultProps = {
-  children: 'children',
-  label: 'label'
+children: 'children',
+label: 'label'
 };
 const getTreeData = async () => {
   try {
-    const res = await getSummaryTab(); // 调用您的API接口
+    const res = await getProcessTab();
     
     if (res.code === 0 && res.data) {
-      // 转换数据结构
       treeData.value = Object.entries(res.data).map(([yearMonth, workshops]) => {
-        // 提取年份和月份(假设格式为YYYYMM)
         const year = yearMonth.substring(0, 4);
-        const month = yearMonth.substring(4);
+        const month = parseInt(yearMonth.substring(4), 10);
         
         return {
-          label: `${year}${month}`,
+          label: `${year}${month}`,
           value: yearMonth,
           children: workshops.map(workshop => ({
-            label: workshop.trim(), // 去除车间名称前后空格
-            value: `${yearMonth}-${workshop.trim()}`,
-            // 可以添加其他属性
+            label: workshop,
+            value: `${yearMonth}-${workshop}`,
             type: 'workshop'
           }))
         };
-      }).sort((a, b) => b.value.localeCompare(a.value)); // 按年月倒序排序
+      }).sort((a, b) => b.value.localeCompare(a.value)); // 按年月倒序
       
-      console.log('生成的树形数据:', treeData.value);
-    } else {
-      console.error('获取数据失败:', res.msg);
+      console.log('树形数据:', treeData.value);
     }
   } catch (error) {
     console.error('请求出错:', error);
@@ -183,178 +228,191 @@ const getTreeData = async () => {
 };
 getTreeData();
 
+const total = ref(0)
+const page = ref(1)
+const limit = ref(50)
+const nodeclick = ref('')
 const hztableData = ref([])
 const handleNodeClick = async (nodeData) => {
-  console.log('点击节点:', nodeData);
-  
-  // 根据节点类型处理不同逻辑
-  if (nodeData.value.split('-').length === 1) {
-    // 点击了年月节点
-    console.log('选择了年月:', nodeData.label);
-  } else {
-    // 点击了车间节点
-    const [yearMonth, workshop] = nodeData.value.split('-');
-    console.log(`选择了 ${yearMonth} 的 ${workshop}`);
-    const res = await SummaryCostAccountingList({month:yearMonth,sist:workshop})
-    console.log(res)
-    if(res.code === 0){
-        hztableData.value = res.data
-
-    }
+console.log('点击节点:', nodeData);
+nodeclick.value = nodeData
+// 根据节点类型处理不同逻辑
+if (nodeData.value.split('-').length === 1) {
+  // 点击了年月节点
+  console.log('选择了年月:', nodeData.label);
+} else {
+  // 点击了车间节点
+  const [yearMonth, workshop] = nodeData.value.split('-');
+  console.log(`选择了 ${yearMonth} 的 ${workshop}`);
+  const res = await ProcessCostAccountingList({month:yearMonth,sist:workshop,page:page.value,limit:limit.value})
+  console.log(res)
+  if(res.code === 0){
+      hztableData.value = res.data.list
+      total.value = res.data.total
   }
+}
 };
 
-  
+const handleSizeChange = (val) => {
+limit.value = val;
+handleNodeClick(nodeclick.value);
+}
+
+const handleCurrentChange = (val) => {
+page.value = val;
+handleNodeClick(nodeclick.value);
+}
+
+
 //导出按钮
 const ToExcel = async () => { 
-  try {
-    const el = document.getElementById('tab2');
-    //  使用table_to_sheet获取工作表对象
-    const worksheet = XLSX.utils.table_to_sheet(el, { raw: true });
-    //设置从C列开始为数字格式
-    const range = XLSX.utils.decode_range(worksheet['!ref']);
-    for (let col = 3; col <= range.e.c; col++) { // 从C列(索引2)开始
-      for (let row = range.s.r + 1; row <= range.e.r; row++) { // 跳过表头行
-        const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
-        if (worksheet[cellAddress]) {
-          // 尝试转换为数字
-          const cellValue = worksheet[cellAddress].v;
-          const numValue = Number(cellValue);
-          
-          if (!isNaN(numValue)) {
-            worksheet[cellAddress].t = 'n'; // 数字类型
-            worksheet[cellAddress].v = numValue; // 更新值
-            // worksheet[cellAddress].z = '0.000'; // 数字格式
-          }
+try {
+  const el = document.getElementById('tab2');
+  //  使用table_to_sheet获取工作表对象
+  const worksheet = XLSX.utils.table_to_sheet(el, { raw: true });
+  //设置从C列开始为数字格式
+  const range = XLSX.utils.decode_range(worksheet['!ref']);
+  for (let col = 3; col <= range.e.c; col++) { // 从C列(索引2)开始
+    for (let row = range.s.r + 1; row <= range.e.r; row++) { // 跳过表头行
+      const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
+      if (worksheet[cellAddress]) {
+        // 尝试转换为数字
+        const cellValue = worksheet[cellAddress].v;
+        const numValue = Number(cellValue);
+        
+        if (!isNaN(numValue)) {
+          worksheet[cellAddress].t = 'n'; // 数字类型
+          worksheet[cellAddress].v = numValue; // 更新值
+          // worksheet[cellAddress].z = '0.000'; // 数字格式
         }
       }
     }
-    
-    // 创建并导出工作簿
-    const workbook = XLSX.utils.book_new();
-    XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
-    XLSX.writeFile(workbook, '成本汇总.xlsx');
-    
-  } catch (error) {
-    console.error('导出失败:', error);
-    ElMessage.error('导出数据失败,请重试');
   }
-};
   
+  // 创建并导出工作簿
+  const workbook = XLSX.utils.book_new();
+  XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
+  XLSX.writeFile(workbook, '成本汇总.xlsx');
+  
+} catch (error) {
+  console.error('导出失败:', error);
+  ElMessage.error('导出数据失败,请重试');
+}
+};
+
 const costlist = ref(false)
 const costMonth = ref('')
-  
+
 const oncreate = () => {
-  costlist.value = true;
+costlist.value = true;
 }
 
-const costhandleConfirm = async () => {
-  if (!costMonth.value) {
-    ElMessage.error('请选择计算月份');
-    return;
-  }
-  try {
-    const qtdtAdds = await CostCalculation({
-      month: costMonth.value,
-      sys_id: userStore.userInfo.nickName
-    });
-    if (qtdtAdds.code === 0) {
-      costlist.value = false;
-      ElMessage({type: 'success',message: '计算成功'})
-    } else {
-      ElMessage({type: 'error',message: '计算失败'})
-    }
-  } catch (error) {
-    console.error(error);
-  }
+// const costhandleConfirm = async () => {
+//   if (!costMonth.value) {
+//     ElMessage.error('请选择计算月份');
+//     return;
+//   }
+//   try {
+//     const qtdtAdds = await ({
+//       month: costMonth.value,
+//       sys_id: userStore.userInfo.nickName
+//     });
+//     if (qtdtAdds.code === 0) {
+//       costlist.value = false;
+//       ElMessage({type: 'success',message: '计算成功'})
+//     } else {
+//       ElMessage({type: 'error',message: '计算失败'})
+//     }
+//   } catch (error) {
+//     console.error(error);
+//   }
+// }
+
+
+</script>
+
+<style scoped>
+.form-container {
+  display: flex;
+  flex-wrap: wrap;
 }
-  
-  
-  </script>
-  
-  <style scoped>
-  .form-container {
-    display: flex;
-    flex-wrap: wrap;
-  }
-  
+
+.form-column {
+  /*flex: 1;*/
+  margin-right: 15px; /* 调整列之间的间距 */
+}
+
+/* 左侧输入框宽度调整 */
+.form-column .el-form-item .el-input {
+  width: 150px; /* 调整左侧输入框的宽度 */
+}
+
+:deep(.hui-plan-usage-lows  div) {
+  color: #8c939d !important;
+}
+:deep(.lan-plan-usage-lows  div) {
+  color: blue !important;
+  font-weight: bold;
+}
+
+
+/* 媒体查询,根据需要调整断点 */
+@media screen and (max-width: 768px) {
   .form-column {
-    /*flex: 1;*/
-    margin-right: 15px; /* 调整列之间的间距 */
+    flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
+    margin-right: 0;
   }
-  
-  /* 左侧输入框宽度调整 */
-  .form-column .el-form-item .el-input {
-    width: 150px; /* 调整左侧输入框的宽度 */
-  }
-  
-  :deep(.hui-plan-usage-lows  div) {
-    color: #8c939d !important;
-  }
-  :deep(.lan-plan-usage-lows  div) {
-    color: blue !important;
-    font-weight: bold;
-  }
-  
+}
+/*:deep(.el-table td .cell) {*/
+/*  line-height: 30px !important;*/
+/*}*/
+.JKWTree-container {
+  display: flex;
+}
+.JKWTree-tree {
+  /*width: 300px;*/
+  background-color: #fff;
+  padding: 10px;
+  margin-right: 20px;
+}
+.JKWTree-tree h3 {
+  font-size: 15px;
+  font-weight: 700;
+  margin: 10px 0;
+}
+.JKWTree-content {
+  flex: 1;
+}
 
-  /* 媒体查询,根据需要调整断点 */
-  @media screen and (max-width: 768px) {
-    .form-column {
-      flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
-      margin-right: 0;
-    }
-  }
-  /*:deep(.el-table td .cell) {*/
-  /*  line-height: 30px !important;*/
-  /*}*/
-  .JKWTree-container {
-    display: flex;
-  }
-  .JKWTree-tree {
-    /*width: 300px;*/
-    background-color: #fff;
-    padding: 10px;
-    margin-right: 20px;
-  }
-  .JKWTree-tree h3 {
-    font-size: 15px;
-    font-weight: 700;
-    margin: 10px 0;
-  }
-  .JKWTree-content {
-    flex: 1;
-  }
 
-  
-  /* 选中某行时的背景色 */
-  :deep(.el-table__body tr.current-row) > td {
-    background: #ff80ff !important;
-  }
-  </style>
-  <style scoped>
-  :deep(.el-table td .cell) {
-    line-height: 20px !important;
-  }
-  :deep(.el-tabs__header){
-    margin-bottom: 0;
-  }
-  .search{
-    margin-left: 0px !important;
-    margin-right: 10px !important;
-  }
-  .bt{
-    margin-left: 2px !important;
-    padding: 3px !important;
-    font-size: 12px;
-  }
-  .el-tabs__header{
-    margin: 0px !important;
-  }
-  .gva-table-box{
-    padding: 0px !important;
-  }
-  .mab{
-    margin-bottom: 5px;
-  }
-  </style>
-  
+/* 选中某行时的背景色 */
+:deep(.el-table__body tr.current-row) > td {
+  background: #ff80ff !important;
+}
+</style>
+<style scoped>
+:deep(.el-table td .cell) {
+  line-height: 20px !important;
+}
+:deep(.el-tabs__header){
+  margin-bottom: 0;
+}
+.search{
+  margin-left: 0px !important;
+  margin-right: 10px !important;
+}
+.bt{
+  margin-left: 2px !important;
+  padding: 3px !important;
+  font-size: 12px;
+}
+.el-tabs__header{
+  margin: 0px !important;
+}
+.gva-table-box{
+  padding: 0px !important;
+}
+.mab{
+  margin-bottom: 5px;
+}
+</style>

+ 25 - 28
src/view/v23financial/v23CostSummary.vue

@@ -75,14 +75,11 @@
                <el-table-column   align="center" label="废气处理" prop="废气处理"  width="200" />
                <el-table-column   align="center" label="锅炉" prop="锅炉"  width="140" />
                <el-table-column   align="center" label="热水锅炉" prop="热水锅炉"  width="110" />
-               <el-table-column   align="center" label="空压机A" prop="空压机A"  width="110" />
-               <el-table-column   align="center" label="空压机B" prop="空压机B"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机A" prop="真空鼓风机A"  width="110" />
-               <el-table-column   align="center" label="真空鼓风机B" prop="真空鼓风机B"  width="110" />
-               <el-table-column   align="center" label="中央空调A" prop="中央空调A"  width="110" />
-               <el-table-column   align="center" label="中央空调B" prop="中央空调B"  width="110" />
+               <el-table-column   align="center" label="空压机" prop="空压机"  width="110" />
+               <el-table-column   align="center" label="真空鼓风机" prop="真空鼓风机"  width="110" />
+               <el-table-column   align="center" label="中央空调" prop="中央空调"  width="110" />
                <el-table-column   align="center" label="分摊其他" prop="分摊其他"  width="200" />
-               <el-table-column   align="center" label="成本合计" prop="客户编号"  width="200" />
+               <el-table-column   align="center" label="成本合计" prop="成本合计"  width="200" />
               </el-table>
   
               <!-- 分页 -->
@@ -189,7 +186,7 @@
   import * as XLSX from 'xlsx'
 import FileSaver from 'file-saver'
 import LuckyExcel from 'luckyexcel';
-  import {getSummaryTab,SummaryCostAccountingList,CostCalculation} from '@/api/jixiaoguanli/caiwubaobiao'
+  import {getSummaryTab,SummaryCostAccountingList} from '@/api/jixiaoguanli/caiwubaobiao'
 
   defineOptions({name: 'Company'})
 
@@ -315,26 +312,26 @@ const oncreate = () => {
   costlist.value = true;
 }
 
-const costhandleConfirm = async () => {
-  if (!costMonth.value) {
-    ElMessage.error('请选择计算月份');
-    return;
-  }
-  try {
-    const qtdtAdds = await CostCalculation({
-      month: costMonth.value,
-      sys_id: userStore.userInfo.nickName
-    });
-    if (qtdtAdds.code === 0) {
-      costlist.value = false;
-      ElMessage({type: 'success',message: '计算成功'})
-    } else {
-      ElMessage({type: 'error',message: '计算失败'})
-    }
-  } catch (error) {
-    console.error(error);
-  }
-}
+// const costhandleConfirm = async () => {
+//   if (!costMonth.value) {
+//     ElMessage.error('请选择计算月份');
+//     return;
+//   }
+//   try {
+//     const qtdtAdds = await ({
+//       month: costMonth.value,
+//       sys_id: userStore.userInfo.nickName
+//     });
+//     if (qtdtAdds.code === 0) {
+//       costlist.value = false;
+//       ElMessage({type: 'success',message: '计算成功'})
+//     } else {
+//       ElMessage({type: 'error',message: '计算失败'})
+//     }
+//   } catch (error) {
+//     console.error(error);
+//   }
+// }
   
   
   </script>

+ 72 - 26
src/view/v23financial/v23Costmaintenance.vue

@@ -9,7 +9,8 @@
                 <!-- <el-input v-model="searchInfo" placeholder="搜索工单编号" clearable style="width: 200px;margin: 5px"></el-input>
                 <el-button type="primary" class="bt" icon="edit" @click="onout">月度费用结构建立</el-button>
                 <el-button type="primary" class="bt" icon="edit" @click="onout">月度费用处理</el-button>-->
-                <el-button type="primary" class="bt" icon="edit" @click="oncbcreate">成本数据创建</el-button> 
+                <el-button type="primary" class="bt" icon="edit" @click="onmonthcbcreate">月度工单成本计算</el-button> 
+                <el-button type="primary" class="bt" icon="edit" @click="onordercbcreate">完工工单成本计算</el-button> 
                 <!-- <el-button type="primary" class="bt" icon="edit" @click="onsdqcreate">创建</el-button>  -->
                 <el-button type="primary" class="bt" icon="edit" :disabled="tableStates.showrgdownTable === false" @click="onartificial">月度人工维护</el-button>
                 <el-button type="primary" class="bt" icon="edit" :disabled="tableStates.showsdqzjupTable === false" @click="onsdqzj">水电气直接费用增加</el-button>
@@ -252,12 +253,12 @@
                <el-table-column  sortable align="center" label="创建时间" prop="Sys_Rq"  width="110" /> 
               </el-table>
 
-            <!-- 创建成本数据 -->
+            <!-- 月度工单成本计算 -->
 
-            <el-dialog v-model="cbcreate"  title="成本数据创建" destroy-on-close style="height: 20%;width: 20%;">
-              <el-form-item label="创建年月份" label-width="100px">
+            <el-dialog v-model="monthcbcreate"  title="月度工单成本计算" destroy-on-close style="height: 20%;width: 20%;">
+              <el-form-item label="计算年月份" label-width="100px">
                 <el-date-picker
-                v-model="cbMonth"
+                v-model="monthcbMonth"
                 type="month"
                 placeholder="选择年月"
                 :default-value="new Date()"
@@ -268,8 +269,29 @@
 
               <template #footer>
                 <div class="dialog-footer" style="text-align: right;">
-                  <el-button @click="cbcreatecloseDialog">取消</el-button>
-                  <el-button type="primary" @click="cbcreateonDialog">确定</el-button>
+                  <el-button @click="monthcbcreatecloseDialog">取消</el-button>
+                  <el-button type="primary" @click="monthcbcreateonDialog">确定</el-button>
+                </div>
+              </template>
+            </el-dialog>
+
+              <!-- 完工工单成本计算 -->
+            <el-dialog v-model="ordercbcreate"  title="完工工单成本计算" destroy-on-close style="height: 20%;width: 20%;">
+              <el-form-item label="计算年月份" label-width="100px">
+                <el-date-picker
+                v-model="ordercbMonth"
+                type="month"
+                placeholder="选择年月"
+                :default-value="new Date()"
+                style="width: 200px;" 
+                />
+                </el-form-item>
+
+
+              <template #footer>
+                <div class="dialog-footer" style="text-align: right;">
+                  <el-button @click="ordercbcreatecloseDialog">取消</el-button>
+                  <el-button type="primary" @click="ordercbcreateonDialog">确定</el-button>
                 </div>
               </template>
             </el-dialog>
@@ -334,7 +356,7 @@
             </el-table>
           </el-dialog>
 
-          <el-dialog v-model="sdqftlist" title="水电气分批量维护"  style="width: 100%;height: 100%;margin: 0px;padding: 0px">
+          <el-dialog v-model="sdqftlist" title="水电气分批量维护"  style="width: 100%;height: 100%;margin: 0px;padding: 0px">
                 <el-button type="primary" @click="sdqftConfirm":class="{ 'confirm-btn': true, 'is-new': isNewData }">{{ isNewData ? '新增' : '更新' }}</el-button>
             <el-button type="" @click="sdqftCancel">退出</el-button>
             <el-button type="primary" icon="plus" @click="add_sdqftenterDialog">新增一行</el-button>
@@ -607,8 +629,8 @@
   import * as XLSX from 'xlsx'
   import dayjs, { Dayjs } from 'dayjs';
   import {GetZzTab,ArtificialAdd,ArtificialAddList,ArtificialEdit,ArtificialList,ArtificialDetailList,shuidianqiList,shuidianqiDetailList,
-    shuidianqifentanList,ChromaticityAdd,ChromaticityDetailAdd,ChromaticityDetailList,MonochromaticDetailList,UtilitiesList,UtilitiesAdd,shuidianqiMachineDetailList,
-    PrepaidExpensesListEdit,PrepaidExpensesList,PrepaidExpensesDetailCopy,shuidianqiDetailAdd,CostCalculation
+    shuidianqifentanList,calculate,ChromaticityDetailAdd,ChromaticityDetailList,MonochromaticDetailList,UtilitiesList,UtilitiesAdd,shuidianqiMachineDetailList,
+    PrepaidExpensesListEdit,PrepaidExpensesList,PrepaidExpensesDetailCopy,shuidianqiDetailAdd,CalculateCompletedCost
   } from '@/api/jixiaoguanli/caiwubaobiao'
   import {ElMessage,ElMessageBox} from "element-plus";
   defineOptions({name: 'Company'})
@@ -830,32 +852,56 @@ const sdsuptableRowClick = async (row) => {
   }
 }
 
-const cbcreate = ref(false)
-const cbMonth = ref('')
+const monthcbcreate = ref(false)
+const monthcbMonth = ref('')
+const ordercbcreate = ref(false)
+const ordercbMonth = ref('')
 
-const oncbcreate = () => {
-  cbcreate.value = true
+// 月度工单成本计算
+const onmonthcbcreate = () => {
+  monthcbcreate.value = true
 }
 
- const cbcreateonDialog =  async () => {
-  cbMonth.value = dayjs(cbMonth.value).format('YYYYMM');
-  console.log(cbMonth.value)
-  const res = await ChromaticityAdd({month:cbMonth.value,sys_id:userStore.userInfo.nickName});
+ const monthcbcreateonDialog =  async () => {
+  monthcbMonth.value = dayjs(monthcbMonth.value).format('YYYYMM');
+  console.log(monthcbMonth.value)
+  const res = await calculate({month:monthcbMonth.value,sys_id:userStore.userInfo.nickName});
   if(res.code === 0){
     ElMessage({type: 'success',message: '创建成功'});
   }else{
     ElMessage({type: 'error',message: '创建失败'});
   }
 
-  cbcreatecloseDialog()
+  monthcbcreatecloseDialog()
+}
+
+const monthcbcreatecloseDialog = () => {
+  monthcbcreate.value = false
+  monthcbMonth.value = ''
 }
 
-const cbcreatecloseDialog = () => {
-  cbcreate.value = false
-  cbMonth.value = ''
+//完工工单成本计算
+const onordercbcreate = () => {
+  ordercbcreate.value = true
 }
 
+const ordercbcreateonDialog =  async () => {
+  ordercbMonth.value = dayjs(ordercbMonth.value).format('YYYYMM');
+  console.log(ordercbMonth.value)
+  const res = await CalculateCompletedCost({month:ordercbMonth.value,sys_id:userStore.userInfo.nickName});
+  if(res.code === 0){
+    ElMessage({type: 'success',message: '创建成功'});
+  }else{
+    ElMessage({type: 'error',message: '创建失败'});
+  }
+
+  ordercbcreatecloseDialog()
+}
 
+const ordercbcreatecloseDialog = () => {
+  ordercbcreate.value = false
+  ordercbMonth.value = ''
+}
 
 const isNewData = ref(false);//新增or修改
 const rgsjlist = ref(false)
@@ -973,16 +1019,16 @@ const sdqfttableData = ref([]);
 const sdqft_tableColumns = ref(
     [
       { label: '年月', prop: '年月', width: '100' },
-      { label: '部门名称', prop: '部门名称', width: '140' },
-      { label: '科目名称', prop: '科目名称', width: '130' },
+      { label: '部门名称', prop: '部门名称', width: '160' },
+      { label: '科目名称', prop: '科目名称', width: '150' },
       { label: '耗电量', prop: '耗电量', width: '160' },
       { label: '单位电价', prop: '单位电价', width: '160' },
       { label: '耗气量', prop: '耗气量', width: '160' },
       { label: '单位气价', prop: '单位气价', width: '160' },
     ]
 )
-const SDQFT_WORKSHOPS = ['胶印车间', '凹丝印车间', '印后车间', '检验车间','制造中心','制造中心','制造中心','制造中心','制造中心','制造中心','制造中心','制造中心','制造中心'];
-const SDQFT_kmmc = ['待分摊总额','待分摊总额','待分摊总额','待分摊总额','废气处理(RTO)','锅炉','空压机A','空压机B','热水锅炉','真空鼓风机A','真空鼓风机B','中央空调A(6号楼)','中央空调B(5号楼)'];
+const SDQFT_WORKSHOPS = ['6#楼1楼待分摊', '6#楼2楼待分摊', '公用设备设施分摊', '公用设备设施分摊','公用设备设施分摊','公用设备设施分摊','公用设备设施分摊','公用设备设施分摊'];
+const SDQFT_kmmc = ['待分摊总额','待分摊总额','废气处理(RTO)','锅炉','热水锅炉','6#楼空压机','6#楼真空鼓风','6#中央空调',];
 
 
 const onsdqcreate = () => {

+ 32 - 25
src/view/yunyin/shengchanguanli/shebeiyunxing.vue

@@ -566,8 +566,9 @@
                 <el-table-column v-slot="scope" label="异常" width="80">
                    <el-checkbox v-model="scope.row.yc" @change="ycClick(scope.row)"></el-checkbox>
                 </el-table-column>
-                <el-table-column label="备注说明" width="180">
-				</el-table-column>
+				<el-table-column v-slot="scope" label="备注说明" width="180" >
+				 <el-input v-model="scope.row.remark"/>
+				  </el-table-column>
                 <el-table-column
 				  v-slot="scope"
                   label="不检测"
@@ -5675,14 +5676,12 @@ const dianjianenterDialog = async () => {
     };
   });
 
-  console.log("转换后的数据:", formattedData);
-
   // 调用接口提交数据
   try {
     const res = await InspectionItemAdd(formattedData); // 替换成你的 API 方法
     if (res.code === 0) {
       ElMessage.success("提交成功!");
-      dianjianVisible.value = false;
+      dianjiancloseDialog();
     } else {
       ElMessage.error(res.msg || "提交失败!");
     }
@@ -5692,7 +5691,9 @@ const dianjianenterDialog = async () => {
 };
 
 const dianjiancloseDialog = () => {
-  dianjianVisible.value = false;	
+  dianjianVisible.value = false;
+  pandingfangfa.value=''
+  dianjianselectData.splice(0, dianjianselectData.length);
 }
 
 
@@ -6385,25 +6386,31 @@ const dropdownOptions = ref([]);
 const selectedOption = ref('');
 // 获取接口数据并转换为下拉框需要的格式
 const fetchData = async () => {
-  try {
-    const response = await facilityMachineList();
-    if (response.code === 0) {
-      const options = response.data.map((item) => ({
-        label: item,
-        value: item
-      }));
-	  const selectionValue = options.find(item => {
-		  return item.value.indexOf(JTMC) !== -1
-	  })
-	  
-      selectedOption.value = selectionValue.value ?? options[0].value
-	  dropdownOptions.value = options
-    }
-  } catch (error) {
-    console.error('Error fetching data:', error);
-    // Handle the error appropriately
-  }
-};
+	try {
+	  // Simulate API call
+	  const response = await facilityMachineList();
+	  if (response.code === 0) {
+		// Transform data format
+		const options = response.data.map((item) => ({
+		  label: item,
+		  value: item
+		}));
+		dropdownOptions.value = options;
+  
+		// Default to selecting the first option
+		 const defaultOption = options.find(option => option.value.split('|')[0] === JTMC);
+		  if (defaultOption) {
+			selectedOption.value = defaultOption.value;
+		  } else if (options.length > 0) {
+			// 如果 myDefaultValue 不在选项中,选择第一个选项
+			selectedOption.value = options[0].value;
+		  }
+	  }
+	} catch (error) {
+	  console.error('Error fetching data:', error);
+	  // Handle the error appropriately
+	}
+  };
 // formData
 let BZMC=ref()
 let lastCellValue=ref()