@@ -6,13 +6,9 @@
< div class = "panel-header" >
< div class = "header-title" >
< i class = "el-icon-s-tools" > < / i >
< span > 维修计划 < / span >
< span > 检修单 < / span >
< el-button size = "mini" type = "text" icon = "el-icon-refresh" @click ="getList" style = "margin-left:4px;" title = "刷新列表" > < / el-button >
< / div >
< el-select v-model = "queryParams.approvalStatus" placeholder="审批状态" clearable size="mini" @change="handleQuery" class="header-filter" >
< el -option label = "草稿" :value = "0" / >
< el-option label = "已驳回" :value = "3" / >
< / el-select >
< / div >
< div class = "search-row" >
@@ -30,10 +26,6 @@
< span class = "item-title" > { { item . planNo } } < / span >
< span class = "item-sub" > { { item . planName } } < / span >
< / div >
< div class = "item-meta" >
< el-tag v-if = "item.approvalStatus === 0" type="info" size="mini" > 草稿 < / el -tag >
< el-tag v-else-if = "item.approvalStatus === 3" type="danger" size="mini" > 已驳回 < / el -tag >
< / div >
< div class = "item-actions" >
< el-button size = "mini" type = "text" icon = "el-icon-edit" @click.stop ="handleUpdate(item)" > < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click.stop ="handleDelete(item)" > < / el -button >
@@ -41,7 +33,7 @@
< / div >
< div v-if = "dataList.length === 0 && !loading" class="list-empty" >
< i class = "el-icon-folder-opened" > < / i >
< span > 暂无维修计划 数据 < / span >
< span > 暂无检修单 数据 < / span >
< / div >
< / div >
@@ -56,84 +48,73 @@
< div class = "right-panel" >
< div v-if = "!currentRow" class="empty-tip" >
< i class = "el-icon-info" > < / i >
< span > 请在左侧列表中选择一条维修计划 查看详情 < / span >
< span > 请在左侧列表中选择一条检修单 查看详情 < / span >
< / div >
< div v-else v-loading = "detailLoading" class="detail -content">
< div class = "doc-header" >
< div class = "doc-header-top " >
< div class = "doc-title-group " >
< div class = "doc-title" > { { currentRow . planNo } } < / div >
< div class = "doc-subtitle" > Maintenance Plan < / div >
< div v-else class = "right -content" >
<!-- 基本信息栏 -- >
< div class = "info-bar " >
< div class = "info-bar-left " >
< span class = "info-label" > 产线 : < / span >
< span class = "info-value" > { { currentRow . productionLine || '未设置' } } < / span >
< el-divider direction = "vertical" / >
< span class = "info-label" > 时间 : < / span >
< span class = "info-value" > { { parseTime ( currentRow . plannedStartTime , '{y}-{m}-{d}' ) } } ~ { { parseTime ( currentRow . plannedEndTime , '{y}-{m}-{d}' ) } } < / span >
< / div >
< div class = "doc-heade r-right" >
< el-button size = "mini" type = "text" icon = "el-icon-refres h" @click ="handleRefreshDetail" tit le = "刷新详情 " > 刷新 < / el-button >
< el-button size = "mini" type = "text" icon = "el-icon-edit" @click ="handleUpdate(currentRow)" v-if = "currentRow.approvalStatus !== 2" >编辑 < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handleDelete(currentRow)" v-if = "currentRow.approvalStatus !== 2" >删除 < / el -button >
< / div >
< / div >
< div class = "doc-status-row" >
< span class = "doc-status-label" > Approval / 状态 : < / span >
< el-tag v-if = "currentRow.approvalStatus === 0" type="info" size="small" > 草稿 < / el -tag >
< el-tag v-else-if = "currentRow.approvalStatus === 1" size="small" > 待审批 < / el -tag >
< el-tag v-else-if = "currentRow.approvalStatus === 2" type="success" size="small" > 已审批 < / el -tag >
< el-tag v-else-if = "currentRow.approvalStatus === 3" type="danger" size="small" > 已驳回 < / el -tag >
< div class = "info-ba r-right" >
< el-button size = "mini" icon = "el-icon-searc h" @click ="queryInspectionRecords" :disab led = "!currentRow.productionLine " > 查询检修记录 < / el-button >
< el-button size = "mini" type = "text" icon = "el-icon-edit" @click ="handleUpdate(currentRow)" > 编辑 < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handleDelete(currentRow)" > 删除 < / el -button >
< / div >
< / div >
< div class = "detail-meta" >
< span > < i class = "el-icon-document" > < / i > { { currentRow . planName } } < / span >
< span v-if = "currentRow.repairType === 1" > 定期保养 < / span >
< span v-else-if = "currentRow.repairType === 2" > 安全整改 < / span >
< span v-else-if = "currentRow.repairType === 3" > 专项检修 < / span >
< span v-else-if = "currentRow.repairType === 4" > 故障维修 < / span >
< span v-if = "currentRow.priorityLevel === 1"><el-tag size="mini" type="info" > 普通 < / el -tag > < / span >
< span v-if = "currentRow.priorityLevel === 2"><el-tag size="mini" type="danger" > 重要 < / el -tag > < / span >
< span v-if = "currentRow.plannedStartTime"><i class="el-icon-time" > < / i > 开始 : {{ parseTime ( currentRow.plannedStartTime , ' { y } - { m } - { d } ' ) }} < / span >
< span v-if = "currentRow.plannedEndTime"><i class="el-icon-time" > < / i > 结束 : {{ parseTime ( currentRow.plannedEndTime , ' { y } - { m } - { d } ' ) }} < / span >
< span v-if = "currentRow.dutyDept"><i class="el-icon-s-home" > < / i > {{ currentRow.dutyDept }} < / span >
< span v-if = "currentRow.planOwner"><i class="el-icon-user-solid" > < / i > {{ currentRow.planOwner }} < / span >
< span v-if = "currentRow.budgetAmount"><i class="el-icon-money" > < / i > 预算 : ¥ {{ currentRow.budgetAmount }} < / span >
<!-- 上半部分 : 检修记录 -- >
< div class = "section inspection-section" >
< div class = "section-header" >
< span class = "section-title" > 检修记录 < span class = "en-sub" > · Inspection Records < / span > < / span >
< span class = "section-count" v-if = "inspectionRecords.length" > 共 {{ inspectionTotal }} 条 < / span >
< / div >
< el -divider / >
< div c lass = "section-title" >
< span > 计划说明 < span class = "en-sub" > · Description < / span > < / span >
< / div >
< div class = "remark-content" > { { currentRow . planDescription || '无' } } < / div >
< el-divider / >
< div class = "section-title" >
< span > 关联异常记录 < span class = "en-sub" > · Related Abnormal Records < / span > < / span >
< el-button v-if = "currentRow.approvalStatus === 0 || currentRow.approvalStatus === 3" size="mini" type="primary" plain icon="el-icon-plus" style="margin-left:8px;" @click="handleSelectAbnormalRecords" > 选择记录 < / el -button >
< / div >
< el-table :data = "abnormalList" border size = "small" style = "width:100%" v-loading = "abnormalLoading" >
< el -table -column label = "设备部件" align = "center" prop = "partName" width = "140" / >
< el-table-column label = "产线" align = "center" prop = "productionLine" width = "120" / >
< el-table-column label = "班次" align = "center" width = "80" >
< el -table :data = "inspectionRecords" border size = "small" v-loading = "inspectionLoading" max-height="300"
@ 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 / >
< el-table-column label = "班次" align = "c enter" width = "70" >
< template slot -scope = " scope " > { { scope . row . shift == 1 ? '白班' : '夜班' } } < / template >
< / el-table-column >
< el-table-column label = "巡检时间" align = "center" width = "150" >
< template slot -scope = " scope " > { { parseTime ( scope . row . inspectTime , '{y}-{m}-{d} {h}:{i}' ) } } < / template >
< / el-table-column >
< el-table-column label = "异常描述 " align = "center" prop = "abnormalDesc" min - width =" 160 " show -overflow -tooltip / >
< el-table-column label = "操作" align = "center" width = "70" v-if = "currentRow.approvalStatus === 0 || currentRow.approvalStatus === 3" >
< el-table-column label = "运行状态 " align = "center" width ="80" >
< template slot -scope = " scope " >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handleRemoveAbnormal(scope.row) " > < / el -button >
< el-tag v-if = "scope.row.runStatus == 1" type="success" size="mini " > 正常 < / el -tag >
< el-tag v-else type = "danger" size = "mini" > 故障 < / el-tag >
< / template >
< / el-table-column >
< el-table-column label = "巡检人" align = "center" prop = "inspector" width = "90" / >
< el-table-column label = "异常描述" align = "center" prop = "abnormalDesc" min -width = " 150 " show -overflow -tooltip / >
< el-table-column label = "备注" align = "center" prop = "remark" min -width = " 120 " show -overflow -tooltip / >
< / el-table >
< div v-if = "abnormalList.length === 0 && !abnormalLoading" class="empty-data" style="margin-top:8px;" > 暂无关联异常记录 < / div >
< div class = "section-gap" / >
< div class = "section-title" >
< span > 维修明细 < span class = "en-sub" > · Maintenance Details < / span > < / span >
< el-button v-if = "currentRow.approvalStatus === 0 || currentRow.approvalStatus === 3" size="mini" type="primary" plain icon="el-icon-plus" style="margin-left:8px;" @click="handleAddDetail" > 添加 < / el -button >
< div v-if = "!inspectionLoading && inspectionQueried && inspectionRecords.length === 0" class="empty-data" >
该产线该时间段内暂无检修记录
< / div >
< el-table :data = "detailList" border size = "small" style = "width:100%" v-loading = "detailLoading ">
< el -table -column label = "设备部件" align = "center" prop = "componentName" width = "130" / >
< div v-if = "!inspectionQueried" class="empty-data ">
点击 " 查询检修记录 " 查看该产线时间段内的巡检数据
< / div >
< / div >
< ! - - 下半部分 : 维修明细 - - >
< div class = "section detail-section" >
< div class = "section-header" >
< span class = "section-title" > 维修明细 < span class = "en-sub" > · Maintenance Details < / span > < / span >
< div class = "section-actions" >
< el-button size = "mini" type = "primary" plain icon = "el-icon-plus" @click ="handleAddDetail" > 新增 < / el -button >
< el-button v-if = "selectedInspectionRows.length"
size = "mini" type = "success" plain icon = "el-icon-plus" @click ="addDetailFromSelection" >
从选中记录添加 ( {{ selectedInspectionRows.length }} )
< / el -button >
< / div >
< / div >
< el-table :data = "detailList" border size = "small" v-loading = "detailLoading" max-height="300" >
< 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" >
< template slot -scope = " scope " >
@@ -147,31 +128,38 @@
< 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" v-if = "currentRow.approvalStatus === 0 || currentRow.approvalStatus === 3" >
< el-table-column label = "操作" align = "center" width = "100" fixed = "right" >
< 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 >
< / template >
< / el-table-column >
< / el-table >
< div v-if = "detailList.length === 0 && !detailLoading" class="empty-data" style="margin-top:8px;" > 暂无维修明细 , 请关联异常记录后自动生成或 手动添加 < / div >
< div class = "section-gap" / >
< div v-if = "currentRow.approvalStatus === 0 || currentRow.approvalStatus === 3" class="form-actions" >
< el -button type = "primary" :loading = "submitLoading" icon = "el-icon-s-promotion" @click ="handleSubmitApproval" > 提交审批 < / el -button >
< div v-if = "detailList.length === 0 && !detailLoading" class="empty-data" > 暂无维修明细 , 请手动添加 < / div >
< / div >
< / div >
< / div >
< / template >
< / DragResizePanel >
< ! - - 新增 / 编辑计划弹窗 - - >
< el-dialog :title = "title" :visible.sync = "open" width = "6 50px" append -to -body >
< el-dialog :title = "title" :visible.sync = "open" width = "58 0px" append -to -body >
< el-form ref = "form" :model = "form" :rules = "rules" label -width = " 110px " >
< el-form-item label = "计划名称" prop = "planName" >
< el-input v-model = "form.planName" placeholder="请输入计划名称" / >
< / el-form-item >
< el-form-item label = "产线" prop = "productionLine" >
< el-select v-model = "form.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 = "plannedStartTime" >
< el-date-picker clearable v-model = "form.plannedStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" style="width:100%" / >
< / el-form-item >
< el-form-item label = "结束时间" prop = "plannedEndTime" >
< el-date-picker clearable v-model = "form.plannedEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" style="width:100%" / >
< / el-form-item >
< el-form-item label = "维修类型" prop = "repairType" >
< el-select v-model = "form.repairType" placeholder="请选择" style="width:100%" >
< el -option label = "定期保养" :value = "1" / >
@@ -186,24 +174,18 @@
< el-option label = "重要" :value = "2" / >
< / el-select >
< / el-form-item >
< el-form-item label = "计划开始时间 " prop = "plannedStartTime " >
< el-date-picker clearable v-model = "form.plannedStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" style="width:100% " / >
< / el-form-item >
< el-form-item label = "计划结束时间" prop = "plannedEndTime" >
< el-date-picker clearable v-model = "form.plannedEndTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择" style="width:100%" / >
< el-form-item label = "计划说明 " prop = "planDescription " >
< el-input v-model = "form.planDescription" type="textarea" :rows="3" placeholder="请输入计划说明 " / >
< / el-form-item >
< el-form-item label = "负责部门" prop = "dutyDept" >
< el-input v-model = "form.dutyDept" placeholder="请输入负责部门" / >
< / el-form-item >
< el-form-item label = "计划 负责人" prop = "planOwner" >
< el-form-item label = "负责人" prop = "planOwner" >
< el-input v-model = "form.planOwner" placeholder="请输入负责人" / >
< / el-form-item >
< el-form-item label = "预算金额(元)" prop = "budgetAmount" >
< el-input-number v-model = "form.budgetAmount" :min="0" :precision="2" style="width:100%" placeholder="请输入预算金额" / >
< / el-form-item >
< el-form-item label = "计划说明" prop = "planDescription" >
< el-input v-model = "form.planDescription" type="textarea" :rows="3" placeholder="请输入计划说明" / >
< / el-form-item >
< el-form-item label = "备注" prop = "remark" >
< el-input v-model = "form.remark" type="textarea" :rows="2" placeholder="请输入备注" / >
< / el-form-item >
@@ -214,39 +196,6 @@
< / div >
< / el-dialog >
<!-- 选择异常巡检记录弹窗 -- >
< el-dialog title = "选择异常巡检记录" :visible.sync = "abnormalSelectorVisible" width = "800px" append -to -body >
< el-form :model = "abnormalQuery" size = "small" :inline = "true" style = "margin-bottom:12px;" >
< el-form-item label = "产线" >
< el-select v-model = "abnormalQuery.productionLine" placeholder="请选择" clearable @change="loadAbnormalRecords" style="width:140px;" >
< el -option v-for = "item in lineList" :key="item.lineId" :label="item.lineName" :value="item.lineId" / >
< / el-select >
< / el-form-item >
< el-form-item label = "巡检人" >
< el-input v-model = "abnormalQuery.inspector" placeholder="搜索" clearable style="width:120px;" @keyup.enter.native="loadAbnormalRecords" / >
< / el-form-item >
< el-form-item >
< el-button type = "primary" size = "mini" @click ="loadAbnormalRecords" > 搜索 < / el -button >
< / el-form-item >
< / el-form >
< el-table ref = "abnormalTable" :data = "abnormalRecordList" border size = "small" @ selection -change = " handleAbnormalSelectionChange " max -height = " 400 " >
< el-table-column type = "selection" width = "45" / >
< el-table-column label = "设备部件" align = "center" prop = "partName" width = "130" / >
< el-table-column label = "产线" align = "center" prop = "productionLine" width = "110" / >
< el-table-column label = "班次" align = "center" width = "70" >
< template slot -scope = " scope " > { { scope . row . shift == 1 ? '白班' : '夜班' } } < / template >
< / el-table-column >
< el-table-column label = "巡检时间" align = "center" prop = "inspectTime" width = "150" >
< template slot -scope = " scope " > { { parseTime ( scope . row . inspectTime , '{y}-{m}-{d} {h}:{i}' ) } } < / template >
< / el-table-column >
< el-table-column label = "异常描述" align = "center" prop = "abnormalDesc" min -width = " 160 " show -overflow -tooltip / >
< / el-table >
< div slot = "footer" class = "dialog-footer" >
< el-button @click ="abnormalSelectorVisible = false" > 取 消 < / el -button >
< el-button type = "primary" @click ="confirmAbnormalSelection" > 确 定 ( 已选 {{ abnormalSelectedRecords.length }} 条 ) < / el -button >
< / div >
< / el-dialog >
<!-- 明细编辑弹窗 -- >
< el-dialog :title = "detailDialogTitle" :visible.sync = "detailDialogVisible" width = "550px" append -to -body >
< el-form ref = "detailForm" :model = "detailForm" label -width = " 110px " >
@@ -288,7 +237,6 @@
< script >
import { listMaintenancePlan , getMaintenancePlan , addMaintenancePlan , updateMaintenancePlan , delMaintenancePlan } from "@/api/flow/maintenancePlan" ;
import { listMaintenancePlanDetail , addMaintenancePlanDetail , updateMaintenancePlanDetail , delMaintenancePlanDetail } from "@/api/flow/maintenancePlanDetail" ;
import { listMaintenancePlanAbnormal , addMaintenancePlanAbnormal , delMaintenancePlanAbnormal } from "@/api/flow/maintenancePlanAbnormal" ;
import { listEquipmentInspectionRecord } from "@/api/mes/eqp/equipmentInspectionRecord" ;
import { listProductionLine } from "@/api/wms/productionLine" ;
import DragResizePanel from "@/components/DragResizePanel/index.vue" ;
@@ -302,8 +250,7 @@ export default {
loading : false ,
detailLoading : false ,
buttonLoading : false ,
submit Loading: false ,
abnormalLoading : false ,
inspection Loading: false ,
detailButtonLoading : false ,
total : 0 ,
dataList : [ ] ,
@@ -313,17 +260,19 @@ export default {
form : { } ,
rules : {
planName : [ { required : true , message : "请输入计划名称" , trigger : "blur" } ] ,
productionLine : [ { required : true , message : "请选择产线" , trigger : "change" } ] ,
plannedStartTime : [ { required : true , message : "请选择开始时间" , trigger : "change" } ] ,
plannedEndTime : [ { required : true , message : "请选择结束时间" , trigger : "change" } ] ,
repairType : [ { required : true , message : "请选择维修类型" , trigger : "change" } ]
} ,
queryParams : { pageNum : 1 , pageSize : 10 , planNo : undefined , approvalStatus : undefined } ,
// Abnormal records
abnormalList : [ ] ,
abnormalSelectorVisible : false ,
abnormalQuery : { productionLine : undefined , inspector : undefined } ,
abnormalRecordList : [ ] ,
abnormalSelectedRecords : [ ] ,
queryParams : { pageNum : 1 , pageSize : 10 , planNo : undefined } ,
lineList : [ ] ,
// Details
// 检修记录
inspectionRecords : [ ] ,
inspectionTotal : 0 ,
inspectionQueried : false ,
selectedInspectionRows : [ ] ,
// 维修明细
detailList : [ ] ,
detailDialogVisible : false ,
detailDialogTitle : "" ,
@@ -358,6 +307,9 @@ export default {
} ,
handleRowClick ( row ) {
this . currentRow = row ;
this . inspectionQueried = false ;
this . inspectionRecords = [ ] ;
this . selectedInspectionRows = [ ] ;
this . loadDetail ( row . planId ) ;
} ,
loadDetail ( planId ) {
@@ -365,19 +317,9 @@ export default {
var self = this ;
getMaintenancePlan ( planId ) . then ( function ( response ) {
self . currentRow = response . data ;
self . loadAbnormalList ( planId ) ;
self . loadDetailList ( planId ) ;
} ) . finally ( function ( ) { self . detailLoading = false ; } ) ;
} ,
loadAbnormalList ( planId ) {
this . abnormalLoading = true ;
var self = this ;
listMaintenancePlanAbnormal ( { planId : planId , pageNum : 1 , pageSize : 999 } ) . then ( function ( r ) {
var rows = r . rows || [ ] ;
// Enrich with inspection record info — query each record
self . abnormalList = rows ;
self . abnormalLoading = false ;
} ) . catch ( function ( ) { self . abnormalLoading = false ; } ) ;
self . detailLoading = false ;
} ) . catch ( function ( ) { self . detailLoading = false ; } ) ;
} ,
loadDetailList ( planId ) {
var self = this ;
@@ -385,16 +327,73 @@ export default {
self . detailList = r . rows || [ ] ;
} ) ;
} ,
handleRefreshDetail ( ) {
if ( this . currentRow && this . currentRow . planId ) {
this . loadDetail ( this . currentRow . planId ) ;
// ---- 检修记录查询 ----
queryInspectionRecords ( ) {
if ( ! this . currentRow || ! this . currentRow . productionLine ) {
this . $modal . msgWarning ( "请先在编辑中设置产线" ) ;
return ;
}
this . inspectionLoading = true ;
var self = this ;
var params = {
pageNum : 1 ,
pageSize : 9999 ,
productionLine : this . getProductionLineId ( this . currentRow . productionLine ) ,
startTime : this . currentRow . plannedStartTime ? parseTime ( this . currentRow . plannedStartTime , '{y}-{m}-{d}' ) : undefined ,
endTime : this . currentRow . plannedEndTime ? parseTime ( this . currentRow . plannedEndTime , '{y}-{m}-{d}' ) : undefined
} ;
listEquipmentInspectionRecord ( params ) . then ( function ( response ) {
self . inspectionRecords = response . rows || [ ] ;
self . inspectionTotal = response . total || 0 ;
self . inspectionQueried = true ;
self . $nextTick ( function ( ) {
if ( self . $refs . inspectionTable ) {
self . $refs . inspectionTable . clearSelection ( ) ;
}
} ) ;
} ) . finally ( function ( ) {
self . inspectionLoading = false ;
} ) ;
} ,
// ---- Plan CRUD ----
getProductionLineId ( name ) {
var line = this . lineList . find ( function ( l ) { return l . lineName === name ; } ) ;
return line ? line . lineId : null ;
} ,
handleInspectionSelectionChange ( selection ) {
this . selectedInspectionRows = selection ;
} ,
addDetailFromSelection ( ) {
if ( this . selectedInspectionRows . length === 0 ) return ;
var self = this ;
var planId = this . currentRow . planId ;
this . $modal . loading ( "正在添加维修明细..." ) ;
var promises = this . selectedInspectionRows . map ( function ( rec ) {
return addMaintenancePlanDetail ( {
planId : planId ,
componentName : rec . partName || '' ,
productionLine : self . currentRow . productionLine || rec . productionLine || '' ,
maintenanceCategory : 1 ,
repairContent : rec . abnormalDesc || '' ,
repairUser : rec . inspector || '' ,
detailStatus : 0
} ) ;
} ) ;
Promise . all ( promises ) . then ( function ( ) {
self . $modal . closeLoading ( ) ;
self . $modal . msgSuccess ( "已从检修记录添加 " + self . selectedInspectionRows . length + " 条明细" ) ;
self . loadDetailList ( planId ) ;
self . $refs . inspectionTable . clearSelection ( ) ;
self . selectedInspectionRows = [ ] ;
} ) . catch ( function ( ) {
self . $modal . closeLoading ( ) ;
self . $modal . msgError ( "操作失败" ) ;
} ) ;
} ,
// ---- 计划 CRUD ----
handleAdd ( ) {
this . reset ( ) ;
this . open = true ;
this . title = "新增维修计划 " ;
this . title = "新增检修单 " ;
} ,
handleUpdate ( row ) {
this . reset ( ) ;
@@ -402,17 +401,18 @@ export default {
getMaintenancePlan ( row . planId ) . then ( function ( response ) {
self . form = response . data ;
self . open = true ;
self . title = "修改维修计划 " ;
self . title = "修改检修单 " ;
} ) ;
} ,
reset ( ) {
this . form = {
planId : undefined , planNo : undefined , planName : undefined ,
productionLine : undefined ,
repairType : undefined , priorityLevel : 1 ,
plannedStartTime : undefined , plannedEndTime : undefined ,
dutyDept : undefined , planOwner : undefined ,
budgetAmount : undefined , planDescription : undefined ,
approvalStatus : 0 , remark: undefined
remark : undefined
} ;
this . resetForm ( "form" ) ;
} ,
@@ -447,7 +447,7 @@ export default {
} ,
handleDelete ( row ) {
var self = this ;
this . $modal . confirm ( '是否确认删除维修计划 "' + row . planNo + '"? ' ) . then ( function ( ) {
this . $modal . confirm ( '是否确认删除检修单 "' + row . planNo + '"? ' ) . then ( function ( ) {
self . loading = true ;
return delMaintenancePlan ( row . planId ) ;
} ) . then ( function ( ) {
@@ -455,103 +455,25 @@ export default {
self . getList ( ) ;
if ( self . currentRow && self . currentRow . planId === row . planId ) {
self . currentRow = null ;
self . abnormalList = [ ] ;
self . detailList = [ ] ;
self . inspectionRecords = [ ] ;
self . inspectionQueried = false ;
}
self . $modal . msgSuccess ( "删除成功" ) ;
} ) . catch ( function ( ) { } ) . finally ( function ( ) { self . loading = false ; } ) ;
} ,
// ---- Submit for approval ----
handleSubmitApproval ( ) {
var self = this ;
if ( this . detailList . length === 0 ) {
this . $modal . msgWarning ( "请至少添加一条维修明细" ) ;
return ;
}
this . $modal . confirm ( '确认提交维修计划"' + this . currentRow . planNo + '"进行审批?' ) . then ( function ( ) {
self . submitLoading = true ;
return updateMaintenancePlan ( { planId : self . currentRow . planId , approvalStatus : 1 } ) ;
} ) . then ( function ( ) {
self . $modal . msgSuccess ( "提交审批成功" ) ;
self . submitLoading = false ;
self . loadDetail ( self . currentRow . planId ) ;
self . getList ( ) ;
} ) . catch ( function ( ) { self . submitLoading = false ; } ) ;
} ,
// ---- Abnormal records selection ----
handleSelectAbnormalRecords ( ) {
this . abnormalSelectedRecords = [ ] ;
this . abnormalQuery = { productionLine : undefined , inspector : undefined } ;
this . loadAbnormalRecords ( ) ;
this . abnormalSelectorVisible = true ;
} ,
loadAbnormalRecords ( ) {
var self = this ;
var params = {
pageNum : 1 , pageSize : 999 ,
productionLine : this . abnormalQuery . productionLine ,
inspector : this . abnormalQuery . inspector ,
runStatus : 0 // 异常记录
} ;
listEquipmentInspectionRecord ( params ) . then ( function ( response ) {
self . abnormalRecordList = response . rows || [ ] ;
} ) ;
} ,
handleAbnormalSelectionChange ( selection ) {
this . abnormalSelectedRecords = selection ;
} ,
confirmAbnormalSelection ( ) {
if ( this . abnormalSelectedRecords . length === 0 ) {
this . $modal . msgWarning ( "请至少选择一条异常记录" ) ;
return ;
}
var self = this ;
var planId = this . currentRow . planId ;
var addPromises = this . abnormalSelectedRecords . map ( function ( rec ) {
return addMaintenancePlanAbnormal ( { planId : planId } ) ;
} ) ;
// Also auto-create detail rows from selected records
this . $modal . loading ( "正在关联异常记录并生成维修明细..." ) ;
Promise . all ( addPromises ) . then ( function ( ) {
// Create detail rows
var detailPromises = self . abnormalSelectedRecords . map ( function ( rec ) {
return addMaintenancePlanDetail ( {
planId : planId ,
componentName : rec . partName || '' ,
productionLine : rec . productionLine || '' ,
maintenanceCategory : 1 ,
detailStatus : 0
} ) ;
} ) ;
return Promise . all ( detailPromises ) ;
} ) . then ( function ( ) {
self . $modal . closeLoading ( ) ;
self . $modal . msgSuccess ( "关联成功,已生成维修明细" ) ;
self . abnormalSelectorVisible = false ;
self . loadAbnormalList ( planId ) ;
self . loadDetailList ( planId ) ;
} ) . catch ( function ( ) {
self . $modal . closeLoading ( ) ;
self . $modal . msgError ( "操作失败" ) ;
} ) ;
} ,
handleRemoveAbnormal ( row ) {
var self = this ;
this . $modal . confirm ( '确认移除该异常记录关联?' ) . then ( function ( ) {
return delMaintenancePlanAbnormal ( row . relId ) ;
} ) . then ( function ( ) {
self . $modal . msgSuccess ( "移除成功" ) ;
self . loadAbnormalList ( self . currentRow . planId ) ;
} ) . catch ( function ( ) { } ) ;
} ,
// ---- Detail management ----
// ---- 明细管理 ----
handleAddDetail ( ) {
this . detailForm = {
planId : this . currentRow . planId ,
componentName : '' , productionLine : '' ,
maintenanceCategory : 1 , repairContent : '' ,
repairUser : '' , itemPlanDate : undefined ,
targetManufacturer : '' , detailStatus : 0
componentName : '' ,
productionLine : this . currentRow . productionLine || '' ,
maintenanceCategory : 1 ,
repairContent : '' ,
repairUser : '' ,
itemPlanDate : undefined ,
targetManufacturer : '' ,
detailStatus : 0
} ;
this . editingDetailId = null ;
this . detailDialogTitle = "添加维修明细" ;
@@ -605,8 +527,8 @@ export default {
. panel - header { display : flex ; align - items : center ; justify - content : space - between ; padding : 12 px 14 px 8 px ; background : # f5f7fa ; }
. header - title { display : flex ; align - items : center ; gap : 6 px ; font - size : 14 px ; font - weight : 600 ; color : # 303133 ; }
. header - title i { color : # 409 eff ; font - size : 16 px ; }
. header - filter { width : 120 px ; }
. 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 - 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 ; }
@@ -615,51 +537,42 @@ export default {
. item - main { flex : 1 ; min - width : 0 ; display : flex ; flex - direction : column ; gap : 3 px ; }
. item - title { font - size : 13 px ; font - weight : 500 ; color : # 303133 ; white - space : nowrap ; overflow : hidden ; text - overflow : ellipsis ; }
. item - sub { font - size : 12 px ; color : # 909399 ; }
. item - meta { flex - shrink : 0 ; margin : 0 8 px ; }
. item - actions { flex - shrink : 0 ; opacity : 0 ; transition : opacity 0.15 s ; }
. list - item : hover . item - actions { opacity : 1 ; }
. list - empty { display : flex ; flex - direction : column ; align - items : center ; justify - content : center ; padding : 60 px 0 ; color : # c0c4cc ; font - size : 13 px ; gap : 8 px ; }
. list - empty i { font - size : 32 px ; }
. list - footer { border - top : 1 px solid # e4e7ed ; padding : 2 px 8 px 0 ; background : # f5f7fa ; }
/* ========== 右侧面板 — Word 文档风格 ========== */
. right - panel { height : 100 % ; overflow - y: auto ; padding : 12 px 16 px ; background : # faf8f5 ; }
. right - panel . detail - content { margin : 0 auto ; background : # ffffff ; padding : 28 px 32 px 36 px ; box - shadow : 0 1 px 4 px rgba ( 0 , 0 , 0 , 0.06 ) , 0 2 px 12 px rgba ( 0 , 0 , 0 , 0.04 ) ; min - height : 100 % ; }
/* ========== 右侧面板 ========== */
. right - panel { height : 100 % ; overflow : hidden ; displa y: 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 ; }
. doc - header { margin - bottom : 18 px ; padding - bottom : 14 px ; border - bottom : 2 px solid # 1 a3c6e ; }
. doc - header - top { display : flex ; align - items : flex - start ; justify - content : space - between ; gap : 16 px ; }
. doc - title - group { flex : 1 ; min - width : 0 ; }
. doc - title { font - family : 'Georgia' , 'Times New Roman' , 'Noto Serif SC' , 'SimSun' , serif ; font - size : 24 px ; font - weight : 700 ; color : # 1 a1a1a ; line - height : 1.3 ; letter - spacing : 0.5 px ; }
. doc - subtitle { font - family : 'Georgia' , 'Times New Roman' , serif ; font - size : 12 px ; font - weight : 400 ; color : # 8 c8c8c ; font - style : italic ; letter - spacing : 0.8 px ; margin - top : 2 px ; }
. doc - heade r- right { flex - shrink : 0 ; }
. doc - status - row { display : flex ; align - items : center ; gap : 8 px ; margin - top : 10 px ; }
. doc - status - label { font - family : 'Georgia' , 'Times New Roman' , serif ; font - size : 11 px ; color : # 8 c8c8c ; letter - spacing : 0.3 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 ; }
. info - bar - left { display : flex ; align - items : center ; gap : 6 px ; font - size : 13 px ; }
. info - label { color : # 909399 ; }
. info - value { color : # 303133 ; font - weight : 500 ; }
. info - ba r- right { display : flex ; align - items : center ; gap : 8 px ; flex - shrink : 0 ; }
. detail - meta { display : flex ; flex - wrap : wrap ; gap : 16 px ; font - size : 12 px ; color : # 909399 ; margin - bottom : 16 px ; padding - bottom : 12 px ; border - bottom : 1 px solid # e0dcd6 ; }
. detail - meta span { display : inline - flex ; align - items : center ; gap : 4 px ; }
. detail - meta i { font - size : 13 px ; }
/* 上半部分:检修记录 */
. inspection - section { flex : 1 ; min - height : 0 ; display : flex ; flex - direction : column ; overflow : hidden ; background : # fff ; border : 1 px solid # e4e7ed ; border - radius : 4 px ; margin - bottom : 10 px ; }
. section - header { display : flex ; align - items : center ; justify - content : space - between ; padding : 8 px 12 px ; border - bottom : 1 px solid # ebeef5 ; flex - shrink : 0 ; }
. section - title { font - size : 13 px ; font - weight : 600 ; color : # 303133 ; }
. section - title . en - sub { font - size : 11 px ; font - weight : 400 ; color : # c0c4cc ; font - style : italic ; }
. 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 ; }
. section - title { font - family : 'Georgia' , 'Times New Roman' , 'Noto Serif SC' , 'SimSun' , serif ; width : 100 % ; font - size : 15 px ; font - weight : 700 ; color : # 1 a1a1a ; margin : 22 px 0 12 px 0 ; padding : 0 0 10 px 0 ; border - bottom : 1 px solid # d4d0c8 ; display : flex ; align - items : center ; gap : 10 px ; letter - spacing : 0.3 px ; }
. section - title : first - child { margin - top : 0 ; }
. section - title . en - sub { font - size : 11 px ; font - weight : 400 ; color : # 8 c8c8c ; letter - spacing : 0.5 px ; font - family : 'Georgia' , 'Times New Roman' , serif ; font - style : italic ; }
. section - title i { font - size : 16 px ; color : # 1 a3c6e ; }
/* 下半部分:维修明细 */
. 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 ; }
. r emark - content { padding : 1 2px 16 px ; background : # faf8f5 ; border : 1 px solid # e8e4de ; border - radius : 2 px ; font - size : 13 px ; line - height : 1.8 ; color : # 1 a1a1a ; }
. section - gap { height : 16 px ; }
. empty - data { color : # 8 c8c8c ; font - size : 13 px ; font - style : italic ; }
. empty - data { padding : 24 px 0 ; text - align : center ; color : # c0c4cc ; font - size : 13 px ; }
. form - actions { display : flex ; justify - content : flex - end ; gap : 10 px ; padding : 16 px 0 ; border - top : 1 px solid # e0dcd6 ; margin - top : 8 px ; }
. right - panel . el - table { border : 1 px s olid # e8e4de ! important ; border - radius : 2 px ! important ; font - size : 12 px ! important ; }
. right - panel . el - table thead th { background - color : # 2 c3e50 ! important ; color : # ffffff ! important ; font - weight : 60 0 ! important ; font - size : 11 px ! important ; letter - spacing : 0.5 px ! important ; border - bottom : none ! important ; font - family : 'Georgia' , 'Times New Roman' , serif ; }
. right - panel . el - table thead th . cell { color : # ffffff ! important ; }
. right - panel . el - table _ _body tr : hover > td { background - color : # f7f5f0 ! important ; }
. right - panel . el - table -- border td { border - right : 1 px solid # f0ece6 ! important ; }
. right - panel . el - table -- border th { border - right : 1 px solid # 3 a5166 ! important ; }
. right - panel . el - table td { padding : 6 px 4 px ! important ; color : # 3 a3a3a ! important ; }
. right - panel . el - divider -- horizontal { margin : 8 px 0 4 px ; background - color : # e0dcd6 ; }
. right - panel . el - tag { border - radius : 2 px ; font - family : 'Georgia' , 'Times New Roman' , serif ; letter - spacing : 0.3 px ; }
. right - panel . el - tag -- mini { padding : 0 6 px ; line - height : 20 px ; height : 20 px ; }
. right - panel . el - tag -- small { padding : 0 8 px ; }
/* 表格样式 */
. right - panel . el - table { border : none ! important ; }
. right - panel . el - table th { background : # f5f7fa ! important ; c olor : # 606266 ! important ; font - size : 1 2px ! important ; padding : 6 px 0 ! important ; }
. right - panel . el - table td { padding : 6 px 0 ! important ; font - size : 12 px ! important ; color : # 303133 ! important ; }
. right - panel . el - divider -- vertical { margin : 0 6 px ; }
< / style >