@@ -73,7 +73,7 @@
< span class = "section-title" > 检修记录 < span class = "en-sub" > · Inspection Records < / span > < / span >
< span class = "section-count" v-if = "inspectionRecords.length" > 共 {{ inspectionTotal }} 条 < / span >
< / div >
< el -table :data = "inspectionRecords" border size = "small" v-loading = "inspectionLoading" max- height="3 00"
< el -table :data = "inspectionRecords" border size = "small" v-loading = "inspectionLoading" height="1 00% "
@ selection -change = " handleInspectionSelectionChange " ref = "inspectionTable" >
< el-table-column type = "selection" width = "40" / >
< el-table-column label = "设备部件" align = "center" prop = "partName" min -width = " 120 " show -overflow -tooltip / >
@@ -113,25 +113,141 @@
< / el -button >
< / div >
< / div >
< el-table :data = "detailList" border size = "small" v-loading = "detailLoading" max- height="3 00" >
< el -table -column label = "设备部件 " align = "center" prop = "componentName" min - width =" 120 " show -overflow -tooltip / >
< el-table-column label = "产线" align = "center" prop = "productionLine" width = "110" / >
< el-table-column label = "类型" align = "center" width = "70" >
< el-table :data = "detailList" border size = "small" v-loading = "detailLoading" height="1 00% " >
< el -table -column label = "编号 " align = "center" width ="60" >
< template slot -scope = " scope " > { { scope . $index + 1 } } < / template >
< / el-table-column >
< el-table-column label = "时间" align = "center" width = "130" >
< template slot -scope = " scope " >
< el-tag v-if = "scope.row.maintenanceCategory === 0" size="mini" > 保养 < / el -tag >
< el-tag v-else-if = "scope.row.maintenanceCategory === 1" size="mini" type="warning" > 维修 < / el -tag >
< el-date-picker
v-if = "scope.row._editing"
v-model = "scope.row.itemPlanDate"
type = "date"
value -format = " yyyy -MM -dd "
placeholder = "选择日期"
style = "width: 118px;" / >
< span v-else > {{ parseTime ( scope.row.itemPlanDate , ' { y } / { m } / { d } ' ) | | ' - ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "维修 内容" align = "center" prop = "repairContent" min -width = " 15 0" show -overflow -tooltip / >
< el-table-column label = "负责人" align = "center" prop = "repairUser" width = "90" / >
< el-table-column label = "计划日期" align = "center" width = "100" >
< template slot -scope = " scope " > { { parseTime ( scope . row . itemPlanDate , '{y}-{m}-{d}' ) } } < / template >
< / el-table-column >
< el-table-column label = "目标厂家" align = "center" prop = "targetManufacturer" width = "110" / >
< el-table-column label = "操作" align = "center" width = "100" fixed = "right" >
< el-table-column label = "具体工作 内容" align = "center" min -width = " 22 0" >
< template slot -scope = " scope " >
< el-button size = "mini" type = "text" icon = "el-icon-edit" @click ="handleEditDetail(scope.row)" > < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handleDeleteDetail(scope.row)" > < / el -button >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.repairContent"
storageKey = "maintenanceRepairContent"
matchRule = "contain"
triggerMode = "focus"
placeholder = "请输入具体工作内容" / >
< div v-else class = "cell-pre-wrap" > { { scope . row . repairContent || '-' } } < / div >
< / template >
< / el-table-column >
< el-table-column label = "产线执行人员" align = "center" min -width = " 150 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.lineExecutor"
storageKey = "maintenanceLineExecutor"
matchRule = "contain"
triggerMode = "focus"
placeholder = "请输入产线执行人员" / >
< div v-else class = "cell-pre-wrap" > { { scope . row . lineExecutor || '-' } } < / div >
< / template >
< / el-table-column >
< el-table-column label = "设备执行人员" align = "center" min -width = " 150 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.equipmentExecutor"
storageKey = "maintenanceEquipmentExecutor"
matchRule = "contain"
triggerMode = "focus"
placeholder = "请输入设备执行人员" / >
< div v-else class = "cell-pre-wrap" > { { scope . row . equipmentExecutor || '-' } } < / div >
< / template >
< / el-table-column >
< el-table-column label = "预计完成时间" align = "center" min -width = " 140 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.plannedCompleteTime"
storageKey = "maintenancePlannedCompleteTime"
matchRule = "contain"
triggerMode = "focus"
placeholder = "如 7:00-18:30" / >
< span v-else > {{ scope.row.plannedCompleteTime | | ' - ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "实际完成时间" align = "center" min -width = " 140 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.actualCompleteTime"
storageKey = "maintenanceActualCompleteTime"
matchRule = "contain"
triggerMode = "focus"
placeholder = "如 7:00-18:30" / >
< span v-else > {{ scope.row.actualCompleteTime | | ' - ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "总耗时( h) " align = "center" min -width = " 110 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.totalHours"
storageKey = "maintenanceTotalHours"
matchRule = "contain"
triggerMode = "focus"
placeholder = "如 9.5小时" / >
< span v-else > {{ scope.row.totalHours | | ' - ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "验收人" align = "center" min -width = " 110 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.acceptanceUser"
storageKey = "maintenanceAcceptanceUser"
matchRule = "contain"
triggerMode = "focus"
placeholder = "请输入验收人" / >
< span v-else > {{ scope.row.acceptanceUser | | ' - ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "是否完成" align = "center" width = "100" >
< template slot -scope = " scope " >
< el-select
v-if = "scope.row._editing"
v-model = "scope.row.detailStatus"
placeholder = "请选择"
style = "width: 80px;" >
< el-option label = "否" :value = "0" / >
< el-option label = "是" :value = "2" / >
< / el-select >
< span v-else > {{ scope.row.detailStatus = = = 2 ? ' 是 ' : ' 否 ' }} < / span >
< / template >
< / el -table -column >
< el-table-column label = "备注" align = "center" min -width = " 180 " >
< template slot -scope = " scope " >
< MemoInput
v-if = "scope.row._editing"
v-model = "scope.row.remark"
storageKey = "maintenanceRemark"
matchRule = "contain"
triggerMode = "focus"
placeholder = "请输入备注" / >
< div v-else class = "cell-pre-wrap" > { { scope . row . remark || '-' } } < / div >
< / template >
< / el-table-column >
< el-table-column label = "操作" align = "center" width = "140" fixed = "right" >
< template slot -scope = " scope " >
< template v-if = "scope.row._editing" >
< el -button size = "mini" type = "text" icon = "el-icon-check" @click ="saveDetailRow(scope.row)" > 保存 < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-close" @click ="cancelEditDetail(scope.row)" > 取消 < / el -button >
< / template >
< template v-else >
< el -button size = "mini" type = "text" icon = "el-icon-edit" @click ="handleEditDetail(scope.row)" > 编辑 < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handleDeleteDetail(scope.row)" > 删除 < / el -button >
< / template >
< / template >
< / el-table-column >
< / el-table >
@@ -196,41 +312,6 @@
< / div >
< / el-dialog >
<!-- 明细编辑弹窗 -- >
< el-dialog :title = "detailDialogTitle" :visible.sync = "detailDialogVisible" width = "550px" append -to -body >
< el-form ref = "detailForm" :model = "detailForm" label -width = " 110px " >
< el-form-item label = "设备部件" prop = "componentName" >
< el-input v-model = "detailForm.componentName" placeholder="请输入设备部件名称" / >
< / el-form-item >
< el-form-item label = "产线" prop = "productionLine" >
< el-select v-model = "detailForm.productionLine" placeholder="请选择" clearable style="width:100%" >
< el -option v-for = "item in lineList" :key="item.lineId" :label="item.lineName" :value="item.lineName" / >
< / el-select >
< / el-form-item >
< el-form-item label = "明细类型" prop = "maintenanceCategory" >
< el-select v-model = "detailForm.maintenanceCategory" placeholder="请选择" style="width:100%" >
< el -option label = "保养" :value = "0" / >
< el-option label = "维修" :value = "1" / >
< / el-select >
< / el-form-item >
< el-form-item label = "维修内容" prop = "repairContent" >
< el-input v-model = "detailForm.repairContent" type="textarea" :rows="2" placeholder="请输入维修内容" / >
< / el-form-item >
< el-form-item label = "负责人" prop = "repairUser" >
< el-input v-model = "detailForm.repairUser" placeholder="请输入维修负责人" / >
< / el-form-item >
< el-form-item label = "计划日期" prop = "itemPlanDate" >
< el-date-picker clearable v-model = "detailForm.itemPlanDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择" style="width:100%" / >
< / el-form-item >
< el-form-item label = "目标厂家" prop = "targetManufacturer" >
< el-input v-model = "detailForm.targetManufacturer" placeholder="请输入目标厂家" / >
< / el-form-item >
< / el-form >
< div slot = "footer" class = "dialog-footer" >
< el-button @click ="detailDialogVisible = false" > 取 消 < / el -button >
< el-button type = "primary" :loading = "detailButtonLoading" @click ="submitDetailForm" > 确 定 < / el -button >
< / div >
< / el-dialog >
< / div >
< / template >
@@ -240,18 +321,18 @@ import { listMaintenancePlanDetail, addMaintenancePlanDetail, updateMaintenanceP
import { listEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord" ;
import { listProductionLine } from "@/api/wms/productionLine" ;
import DragResizePanel from "@/components/DragResizePanel/index.vue" ;
import MemoInput from "@/components/MemoInput/index.vue" ;
import { parseTime } from '@/utils/klp'
export default {
name : "EqpMaintenance" ,
components : { DragResizePanel } ,
components : { DragResizePanel , MemoInput } ,
data ( ) {
return {
loading : false ,
detailLoading : false ,
buttonLoading : false ,
inspectionLoading : false ,
detailButtonLoading : false ,
total : 0 ,
dataList : [ ] ,
currentRow : null ,
@@ -273,11 +354,7 @@ export default {
inspectionQueried : false ,
selectedInspectionRows : [ ] ,
// 维修明细
detailList : [ ] ,
detailDialogVisible : false ,
detailDialogTitle : "" ,
detailForm : { } ,
editingDetailId : null
detailList : [ ]
} ;
} ,
created ( ) {
@@ -324,7 +401,9 @@ export default {
loadDetailList ( planId ) {
var self = this ;
listMaintenancePlanDetail ( { planId : planId , pageNum : 1 , pageSize : 999 } ) . then ( function ( r ) {
self . detailList = r . rows || [ ] ;
self . detailList = ( r . rows || [ ] ) . map ( function ( item ) {
return self . decorateDetailRow ( item ) ;
} ) ;
} ) ;
} ,
// ---- 检修记录查询 ----
@@ -373,9 +452,17 @@ export default {
componentName : rec . partName || '' ,
productionLine : self . currentRow . productionLine || rec . productionLine || '' ,
maintenanceCategory : 1 ,
itemPlanDate : rec . inspectTime ? parseTime ( rec . inspectTime , '{y}-{m}-{d}' ) : parseTime ( new Date ( ) , '{y}-{m}-{d}' ) ,
repairContent : rec . abnormalDesc || '' ,
lineExecutor : rec . inspector || '' ,
equipmentExecutor : '' ,
plannedCompleteTime : '' ,
actualCompleteTime : '' ,
totalHours : '' ,
acceptanceUser : '' ,
repairUser : rec . inspector || '' ,
detailStatus : 0
detailStatus : 0 ,
remark : rec . remark || ''
} ) ;
} ) ;
Promise . all ( promises ) . then ( function ( ) {
@@ -464,56 +551,139 @@ export default {
} ,
// ---- 明细管理 ----
handleAddDetail ( ) {
this . detailForm = {
planId : this . currentRow . planId ,
componentName : '' ,
productionLine : this . currentRow . productionLine || '' ,
maintenanceCategory : 1 ,
repairContent : '' ,
repairUser : '' ,
itemPlanDate : undefined ,
targetManufacturer : '' ,
detailStatus : 0
} ;
this . editingDetailId = null ;
this . detailDialogTitle = "添加维修明细" ;
this . detailDialogVisible = true ;
} ,
handleEditDetail ( row ) {
this . detailForm = Object . assign ( { } , row ) ;
this . editingDetailId = row . detailId ;
this . detailDialogTitle = "编辑维修明细" ;
this . detailDialogVisible = true ;
} ,
submitDetailForm ( ) {
if ( ! this . detailForm . componentName ) {
this . $modal . msgWarning ( "请输入设备部件名称" ) ;
if ( ! this . currentRow || ! this . currentRow . planId ) return ;
if ( this . getEditingDetailRow ( ) ) {
this . $modal . msgWarning ( "请先保存或取消当前编辑行" ) ;
return ;
}
var self = this ;
this . detailButtonLoading = true ;
if ( this . editingDetailId ) {
updateMaintenancePlanDetail ( this . detailForm ) . then ( function ( ) {
self . $modal . msgSuccess ( "修改成功" ) ;
self . detailDialogVisible = false ;
self . load DetailList ( self . currentRow . planId ) ;
} ) . finally ( function ( ) { self . detailButtonLoading = false ; } ) ;
} else {
addMaintenancePlanDetail ( this . detailForm ) . then ( function ( ) {
self . $modal . msgSuccess ( "添加成功 " ) ;
self . detailDialogVisible = false ;
self . loadDetailList ( self . currentRow . planId ) ;
} ) . finally ( function ( ) { self . detailButtonLoading = false ; } ) ;
var row = this . decorateDetailRow ( this . getDefaultDetailRow ( ) ) ;
row . _isNew = true ;
row . _ editing = true ;
row . _origin = null ;
this . detailList . unshift ( row ) ;
} ,
handleEdit Detail( row ) {
if ( ! row ) return ;
var editing = this . getEditingDetailRow ( ) ;
if ( editing && editing !== row ) {
this . $modal . msgWarning ( "请先保存或取消当前编辑行 " ) ;
return ;
}
this . beginDetailEdit ( row ) ;
} ,
beginDetailEdit ( row ) {
if ( ! row ) return ;
row . _origin = JSON . parse ( JSON . stringify ( {
itemPlanDate : row . itemPlanDate ,
repairContent : row . repairContent ,
lineExecutor : row . lineExecutor ,
equipmentExecutor : row . equipmentExecutor ,
plannedCompleteTime : row . plannedCompleteTime ,
actualCompleteTime : row . actualCompleteTime ,
totalHours : row . totalHours ,
acceptanceUser : row . acceptanceUser ,
detailStatus : row . detailStatus ,
remark : row . remark
} ) ) ;
row . _editing = true ;
} ,
cancelEditDetail ( row ) {
if ( ! row ) return ;
if ( row . _isNew ) {
this . detailList = this . detailList . filter ( function ( r ) { return r !== row ; } ) ;
return ;
}
if ( row . _origin ) {
row . itemPlanDate = row . _origin . itemPlanDate ;
row . repairContent = row . _origin . repairContent ;
row . lineExecutor = row . _origin . lineExecutor ;
row . equipmentExecutor = row . _origin . equipmentExecutor ;
row . plannedCompleteTime = row . _origin . plannedCompleteTime ;
row . actualCompleteTime = row . _origin . actualCompleteTime ;
row . totalHours = row . _origin . totalHours ;
row . acceptanceUser = row . _origin . acceptanceUser ;
row . detailStatus = row . _origin . detailStatus ;
row . remark = row . _origin . remark ;
}
row . _editing = false ;
row . _origin = null ;
} ,
handleDeleteDetail ( row ) {
var self = this ;
if ( ! row ) return ;
if ( row . _isNew ) {
this . detailList = this . detailList . filter ( function ( r ) { return r !== row ; } ) ;
return ;
}
this . $modal . confirm ( '确认删除该维修明细?' ) . then ( function ( ) {
return delMaintenancePlanDetail ( row . detailId ) ;
} ) . then ( function ( ) {
self . $modal . msgSuccess ( "删除成功" ) ;
self . loadDetailList ( self . currentRow . planId ) ;
} ) . catch ( function ( ) { } ) ;
} ,
getEditingDetailRow ( ) {
return this . detailList . find ( function ( r ) { return r && r . _editing ; } ) || null ;
} ,
decorateDetailRow ( row ) {
var r = row || { } ;
if ( ! r . _rowKey ) r . _rowKey = r . detailId ? ( "detail_" + r . detailId ) : ( "tmp_" + Date . now ( ) + "_" + Math . random ( ) . toString ( 16 ) . slice ( 2 ) ) ;
if ( typeof r . _editing !== 'boolean' ) r . _editing = false ;
if ( typeof r . _isNew !== 'boolean' ) r . _isNew = false ;
if ( ! r . _origin ) r . _origin = null ;
if ( r . detailStatus === undefined || r . detailStatus === null ) r . detailStatus = 0 ;
return r ;
} ,
getDefaultDetailRow ( ) {
return {
planId : this . currentRow . planId ,
componentName : '' ,
productionLine : this . currentRow . productionLine || '' ,
maintenanceCategory : 1 ,
itemPlanDate : parseTime ( new Date ( ) , '{y}-{m}-{d}' ) ,
repairContent : '' ,
lineExecutor : '' ,
equipmentExecutor : '' ,
plannedCompleteTime : '' ,
actualCompleteTime : '' ,
totalHours : '' ,
acceptanceUser : '' ,
detailStatus : 0 ,
remark : ''
} ;
} ,
buildDetailPayload ( row ) {
return {
detailId : row . detailId ,
planId : this . currentRow . planId ,
componentName : row . componentName ,
productionLine : this . currentRow . productionLine || row . productionLine || '' ,
maintenanceCategory : row . maintenanceCategory === undefined ? 1 : row . maintenanceCategory ,
itemPlanDate : row . itemPlanDate ,
repairContent : row . repairContent ,
lineExecutor : row . lineExecutor ,
equipmentExecutor : row . equipmentExecutor ,
plannedCompleteTime : row . plannedCompleteTime ,
actualCompleteTime : row . actualCompleteTime ,
totalHours : row . totalHours ,
acceptanceUser : row . acceptanceUser ,
detailStatus : row . detailStatus ,
remark : row . remark
} ;
} ,
saveDetailRow ( row ) {
if ( ! row ) return ;
if ( ! row . repairContent ) {
this . $modal . msgWarning ( "请输入具体工作内容" ) ;
return ;
}
var self = this ;
var payload = this . buildDetailPayload ( row ) ;
var api = row . _isNew || ! row . detailId ? addMaintenancePlanDetail : updateMaintenancePlanDetail ;
api ( payload ) . then ( function ( ) {
self . $modal . msgSuccess ( row . _isNew || ! row . detailId ? "添加成功" : "修改成功" ) ;
self . loadDetailList ( self . currentRow . planId ) ;
} ) ;
}
}
} ;
@@ -530,6 +700,11 @@ export default {
. search - row { display : flex ; align - items : center ; gap : 6 px ; padding : 0 14 px 10 px ; background : # f5f7fa ; }
. search - row . el - input { flex : 1 ; }
. list - body { flex : 1 ; overflow - y : auto ; padding : 0 6 px ; }
. list - body { scrollbar - width : thin ; scrollbar - color : rgba ( 144 , 147 , 153 , 0.45 ) transparent ; }
. list - body : : - webkit - scrollbar { width : 8 px ; height : 8 px ; }
. list - body : : - webkit - scrollbar - track { background : transparent ; }
. list - body : : - webkit - scrollbar - thumb { background : rgba ( 144 , 147 , 153 , 0.35 ) ; border - radius : 6 px ; }
. list - body : : - webkit - scrollbar - thumb : hover { background : rgba ( 144 , 147 , 153 , 0.55 ) ; }
. list - item { display : flex ; align - items : center ; padding : 10 px 12 px ; margin - bottom : 2 px ; cursor : pointer ; border - radius : 6 px ; transition : all 0.15 s ; }
. list - item : hover { background : # ebeef5 ; }
. list - item . active { background : # d9ecff ; }
@@ -546,7 +721,7 @@ export default {
/* ========== 右侧面板 ========== */
. right - panel { height : 100 % ; overflow : hidden ; display : flex ; flex - direction : column ; background : # faf8f5 ; }
. empty - tip { display : flex ; align - items : center ; justify - content : center ; height : 100 % ; color : # 909399 ; font - size : 14 px ; gap : 8 px ; }
. right - content { flex : 1 ; display : flex ; flex - direction : column ; overflow : hidden ; padding : 12 px 16 px ; }
. right - content { flex : 1 ; min - height : 0 ; display : flex ; flex - direction : column ; overflow : hidden ; padding : 12 px 16 px ; }
/* 基本信息栏 */
. info - bar { display : flex ; align - items : center ; justify - content : space - between ; padding : 8 px 16 px ; background : # fff ; border : 1 px solid # e4e7ed ; border - radius : 4 px ; margin - bottom : 10 px ; flex - shrink : 0 ; }
@@ -563,10 +738,25 @@ export default {
. section - count { font - size : 12 px ; color : # 909399 ; }
. section - actions { display : flex ; align - items : center ; gap : 6 px ; }
. inspection - section . el - table { flex : 1 ; overflow - y : auto ; }
. inspection - section . el - table { scrollbar - width : thin ; scrollbar - color : rgba ( 144 , 147 , 153 , 0.45 ) transparent ; }
. detail - section . el - table { scrollbar - width : thin ; scrollbar - color : rgba ( 144 , 147 , 153 , 0.45 ) transparent ; }
. inspection - section : : v - deep . el - table ,
. detail - section : : v - deep . el - table { display : flex ; flex - direction : column ; height : 100 % ; }
. inspection - section : : v - deep . el - table _ _body - wrapper ,
. detail - section : : v - deep . el - table _ _body - wrapper { flex : 1 ; min - height : 0 ; }
. inspection - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar ,
. detail - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar { width : 8 px ; height : 8 px ; }
. inspection - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - track ,
. detail - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - track { background : transparent ; }
. inspection - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - thumb ,
. detail - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - thumb { background : rgba ( 144 , 147 , 153 , 0.35 ) ; border - radius : 6 px ; }
. inspection - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - thumb : hover ,
. detail - section : : v - deep . el - table _ _body - wrapper : : - webkit - scrollbar - thumb : hover { background : rgba ( 144 , 147 , 153 , 0.55 ) ; }
/* 下半部分:维修明细 */
. detail - section { flex : 1 ; min - height : 0 ; display : flex ; flex - direction : column ; overflow : hidden ; background : # fff ; border : 1 px solid # e4e7ed ; border - radius : 4 px ; }
. detail - section . el - table { flex : 1 ; overflow - y : auto ; }
. cell - pre - wrap { white - space : pre - wrap ; word - break : break - all ; line - height : 18 px ; }
. empty - data { padding : 24 px 0 ; text - align : center ; color : # c0c4cc ; font - size : 13 px ; }