|
@@ -78,17 +78,18 @@
|
|
|
<el-table-column type="selection" width="30" />
|
|
<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="90"/>
|
|
|
<el-table-column fixed align="left" label="设备名称" prop="设备名称" width="220"/>
|
|
<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="110"/>
|
|
|
<el-table-column align="left" label="非故障维修工时" prop="非故障维修工时" width="125"/>
|
|
<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="专项维修工时" 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="维修姓名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="110"/>
|
|
<el-table-column align="left" label="创建用户" prop="创建用户" width="110"/>
|
|
|
<el-table-column align="left" label="创建时间" prop="创建时间" width="120"/>
|
|
<el-table-column align="left" label="创建时间" prop="创建时间" width="120"/>
|
|
@@ -188,6 +189,8 @@
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="repairForm.故障报告时间"
|
|
v-model="repairForm.故障报告时间"
|
|
|
type="datetime"
|
|
type="datetime"
|
|
|
|
|
+ :format="'YYYY-MM-DD HH:mm'"
|
|
|
|
|
+ :value-format="'YYYY-MM-DD HH:mm:ss'"
|
|
|
placeholder="选择故障报告时间"
|
|
placeholder="选择故障报告时间"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
/>
|
|
/>
|
|
@@ -231,12 +234,15 @@
|
|
|
<!-- 第五行:时间信息 -->
|
|
<!-- 第五行:时间信息 -->
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="维修受理时间">
|
|
|
|
|
|
|
+ <el-form-item label="维修开始时间">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="repairForm.维修受理时间"
|
|
v-model="repairForm.维修受理时间"
|
|
|
type="datetime"
|
|
type="datetime"
|
|
|
- placeholder="选择维修受理时间"
|
|
|
|
|
|
|
+ :format="'YYYY-MM-DD HH:mm'"
|
|
|
|
|
+ :value-format="'YYYY-MM-DD HH:mm:ss'"
|
|
|
|
|
+ placeholder="维修开始时间"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
|
+ @change="calculateWorkingHours"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -246,12 +252,15 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="修复时间">
|
|
|
|
|
|
|
+ <el-form-item label="维修完成时间">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="repairForm.修复时间"
|
|
v-model="repairForm.修复时间"
|
|
|
type="datetime"
|
|
type="datetime"
|
|
|
- placeholder="选择修复时间"
|
|
|
|
|
|
|
+ :format="'YYYY-MM-DD HH:mm'"
|
|
|
|
|
+ :value-format="'YYYY-MM-DD HH:mm:ss'"
|
|
|
|
|
+ placeholder="维修完成时间"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
|
+ @change="calculateWorkingHours"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -292,12 +301,22 @@
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="实际维修工时">
|
|
<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-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="设备故障总工时">
|
|
<el-form-item label="设备故障总工时">
|
|
|
- <el-input v-model="repairForm.设备故障总工时" placeholder="请输入设备故障总工时" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="repairForm.设备故障总工时"
|
|
|
|
|
+ placeholder="请输入设备故障总工时"
|
|
|
|
|
+ @blur="validateTotalHours"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -306,12 +325,18 @@
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="验收人">
|
|
<el-form-item label="验收人">
|
|
|
- <el-input v-model="repairForm.验收人" placeholder="请输入验收人" />
|
|
|
|
|
|
|
+ <el-input v-model="repairForm.验收人" placeholder="请输入验收人"
|
|
|
|
|
+ @keyup.enter.native="() => openEmployeeForAcceptance()"
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="验收情况">
|
|
<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-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
@@ -379,17 +404,25 @@
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="maintenanceForm.保养时间段"
|
|
v-model="maintenanceForm.保养时间段"
|
|
|
type="datetimerange"
|
|
type="datetimerange"
|
|
|
|
|
+ :format="'YYYY-MM-DD HH:mm'"
|
|
|
|
|
+ :value-format="'YYYY-MM-DD HH:mm:ss'"
|
|
|
range-separator="至"
|
|
range-separator="至"
|
|
|
start-placeholder="开始时间"
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
end-placeholder="结束时间"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
|
|
+ @change="calculateMaintenanceHours"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="保养工时">
|
|
<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-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
@@ -574,7 +607,7 @@
|
|
|
// 全量引入格式化工具 请按需保留
|
|
// 全量引入格式化工具 请按需保留
|
|
|
import dayjs, { Dayjs } from 'dayjs';
|
|
import dayjs, { Dayjs } from 'dayjs';
|
|
|
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
|
|
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 { exportExcelFile } from '@/utils/excel'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import {getMaintenanceTab,YearMaintenanceList,YearAccessoriesList,YearMaintainList,MonthAccessoriesList,
|
|
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 dialogwxFormVisible = ref(false)
|
|
|
const dialogbyFormVisible = ref(false)
|
|
const dialogbyFormVisible = ref(false)
|
|
@@ -811,11 +844,11 @@ const onADD = () => {
|
|
|
if(yearcode.value === 0){
|
|
if(yearcode.value === 0){
|
|
|
ElMessage.error('请先选择左侧菜单')
|
|
ElMessage.error('请先选择左侧菜单')
|
|
|
}else if (yearcode.value === 1 ){
|
|
}else if (yearcode.value === 1 ){
|
|
|
- Object.assign(repairForm, initRepairForm()) // 重置表单
|
|
|
|
|
|
|
+ repairForm.value = initRepairForm();
|
|
|
type.value = 'create'
|
|
type.value = 'create'
|
|
|
dialogwxFormVisible.value = true
|
|
dialogwxFormVisible.value = true
|
|
|
}else if (yearcode.value === 2 ){
|
|
}else if (yearcode.value === 2 ){
|
|
|
- Object.assign(maintenanceForm, initMaintenanceForm()) // 重置表单
|
|
|
|
|
|
|
+ maintenanceForm.value = initMaintenanceForm();
|
|
|
console.log('保养弹窗')
|
|
console.log('保养弹窗')
|
|
|
type.value = 'create'
|
|
type.value = 'create'
|
|
|
dialogbyFormVisible.value = true
|
|
dialogbyFormVisible.value = true
|
|
@@ -838,35 +871,35 @@ const wxmonthdoubleClick = async (row) => {
|
|
|
const res = await MachineMaintenanceDetail({ UniqId: row.UniqId })
|
|
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
|
|
dialogwxFormVisible.value = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -875,26 +908,26 @@ const bymonthdoubleClick = async (row) => {
|
|
|
const res = await MachineMaintainDetail({ UniqId: row.UniqId })
|
|
const res = await MachineMaintainDetail({ UniqId: row.UniqId })
|
|
|
|
|
|
|
|
// 清空原有数据
|
|
// 清空原有数据
|
|
|
- Object.assign(maintenanceForm, initMaintenanceForm())
|
|
|
|
|
|
|
+ maintenanceForm.value = initMaintenanceForm();
|
|
|
console.log('维修详情',res)
|
|
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
|
|
dialogbyFormVisible.value = true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -920,23 +953,23 @@ const getbm = async () => {
|
|
|
// 部门选择处理
|
|
// 部门选择处理
|
|
|
const handleDeptSelect = (data) => {
|
|
const handleDeptSelect = (data) => {
|
|
|
if(yearcode.value === 1){
|
|
if(yearcode.value === 1){
|
|
|
- repairForm.部门 = data.label
|
|
|
|
|
|
|
+ repairForm.value.部门 = data.label
|
|
|
deptDialogVisible.value = false
|
|
deptDialogVisible.value = false
|
|
|
}else if(yearcode.value === 2){
|
|
}else if(yearcode.value === 2){
|
|
|
- maintenanceForm.部门 = data.label
|
|
|
|
|
|
|
+ maintenanceForm.value.部门 = data.label
|
|
|
deptDialogVisible.value = false
|
|
deptDialogVisible.value = false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 获取设备数据
|
|
// 获取设备数据
|
|
|
const getsb = async () => {
|
|
const getsb = async () => {
|
|
|
- if (!repairForm.部门&&!maintenanceForm.部门) {
|
|
|
|
|
|
|
+ if (!repairForm.value.部门&&!maintenanceForm.value.部门) {
|
|
|
ElMessage.warning('请先选择部门')
|
|
ElMessage.warning('请先选择部门')
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
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.code === 0) {
|
|
|
if (!res.data) {
|
|
if (!res.data) {
|
|
|
ElMessage.warning('该部门下暂无设备')
|
|
ElMessage.warning('该部门下暂无设备')
|
|
@@ -958,12 +991,12 @@ const getsb = async () => {
|
|
|
// 设备选择处理
|
|
// 设备选择处理
|
|
|
const handleDeviceSelect = (row) => {
|
|
const handleDeviceSelect = (row) => {
|
|
|
if(yearcode.value === 1){
|
|
if(yearcode.value === 1){
|
|
|
- repairForm.设备编号 = row.id
|
|
|
|
|
- repairForm.设备名称 = row.name
|
|
|
|
|
|
|
+ repairForm.value.设备编号 = row.id
|
|
|
|
|
+ repairForm.value.设备名称 = row.name
|
|
|
deviceDialogVisible.value = false
|
|
deviceDialogVisible.value = false
|
|
|
}else if(yearcode.value === 2){
|
|
}else if(yearcode.value === 2){
|
|
|
- maintenanceForm.设备编号 = row.id
|
|
|
|
|
- maintenanceForm.设备名称 = row.name
|
|
|
|
|
|
|
+ maintenanceForm.value.设备编号 = row.id
|
|
|
|
|
+ maintenanceForm.value.设备名称 = row.name
|
|
|
deviceDialogVisible.value = false
|
|
deviceDialogVisible.value = false
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -975,9 +1008,36 @@ const showEmployeeDialog = ref(false)
|
|
|
const employeeList = ref([])
|
|
const employeeList = ref([])
|
|
|
const currentSelectField = ref('') // 记录当前正在编辑的字段
|
|
const currentSelectField = ref('') // 记录当前正在编辑的字段
|
|
|
const currentFormType = ref('repair') // 记录当前操作的表单类型
|
|
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) => {
|
|
const openEmployeeDialog = (fieldPrefix) => {
|
|
|
|
|
+ isAcceptanceField.value = false
|
|
|
|
|
+
|
|
|
// 判断当前操作的表单类型
|
|
// 判断当前操作的表单类型
|
|
|
if (dialogwxFormVisible.value) {
|
|
if (dialogwxFormVisible.value) {
|
|
|
currentFormType.value = 'repair'
|
|
currentFormType.value = 'repair'
|
|
@@ -986,11 +1046,30 @@ const openEmployeeDialog = (fieldPrefix) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
currentSelectField.value = fieldPrefix.replace('code', '') // 存储基础数字部分
|
|
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] || ''
|
|
const codeValue = form[fieldPrefix] || ''
|
|
|
getEmployee(codeValue)
|
|
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 = '') => {
|
|
const getEmployee = async (searchValue = '') => {
|
|
|
try {
|
|
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 () => {
|
|
const wxenterDialog = async () => {
|
|
|
- console.log('repairForm:', repairForm)
|
|
|
|
|
|
|
+ console.log('repairForm:', repairForm.value)
|
|
|
const params = {
|
|
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,
|
|
sys_id: sys_id,
|
|
|
}
|
|
}
|
|
|
console.log(params)
|
|
console.log(params)
|
|
@@ -1070,7 +1258,7 @@ console.log(type.value)
|
|
|
}else if (type.value === 'update') {
|
|
}else if (type.value === 'update') {
|
|
|
// 新增
|
|
// 新增
|
|
|
console.log('修改')
|
|
console.log('修改')
|
|
|
- params.UniqId = repairForm.UniqId
|
|
|
|
|
|
|
+ params.UniqId = repairForm.value.UniqId
|
|
|
try {
|
|
try {
|
|
|
const response = await MachineMaintenanceUpdate(params)
|
|
const response = await MachineMaintenanceUpdate(params)
|
|
|
if (response.code === 0) {
|
|
if (response.code === 0) {
|
|
@@ -1086,22 +1274,22 @@ console.log(type.value)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const byenterDialog = async () => {
|
|
const byenterDialog = async () => {
|
|
|
- console.log('maintenanceForm:', maintenanceForm)
|
|
|
|
|
|
|
+ console.log('maintenanceForm:', maintenanceForm.value)
|
|
|
const params = {
|
|
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,
|
|
sys_id: sys_id,
|
|
|
}
|
|
}
|
|
|
console.log(params)
|
|
console.log(params)
|
|
@@ -1123,7 +1311,7 @@ console.log(type.value)
|
|
|
}else if (type.value === 'update') {
|
|
}else if (type.value === 'update') {
|
|
|
// 新增
|
|
// 新增
|
|
|
console.log('修改')
|
|
console.log('修改')
|
|
|
- params.UniqId = maintenanceForm.UniqId
|
|
|
|
|
|
|
+ params.UniqId = maintenanceForm.value.UniqId
|
|
|
try {
|
|
try {
|
|
|
const response = await MachineMaintainUpdate(params)
|
|
const response = await MachineMaintainUpdate(params)
|
|
|
if (response.code === 0) {
|
|
if (response.code === 0) {
|
|
@@ -1138,6 +1326,8 @@ console.log(type.value)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// 导出
|
|
// 导出
|
|
|
const wxtjDialog = ref(false)
|
|
const wxtjDialog = ref(false)
|
|
|
const wxtjrq = ref('')
|
|
const wxtjrq = ref('')
|