@@ -0,0 +1,711 @@
< template >
< div class = "app-container" >
< el-radio-group v-model = "sharedQueryParams.responsiblePerson" @change="handleQuery" size="small" style="margin-bottom: 10px;" >
< el -radio -button v-for = "person in personList" :key="person" :label="person" > {{ person }} < / el -radio -button >
< / el-radio-group >
< DragResizePanel direction = "horizontal" :initialSize = "500" :minSize = "350"
style = "height: calc(100vh - 164px); margin-top: 10px;" >
< template # panelA >
< div style = "height: 100%; padding: 0 10px; display: flex; flex-direction: column;" >
< el-form :model = "partQueryParams" size = "small" :inline = "true" label -width = " 80px " >
< el-form-item label = "巡检部位" prop = "inspectPart" >
< el-input v-model = "partQueryParams.inspectPart" placeholder="请输入巡检部位" clearable
@keyup.enter.native ="handlePartQuery" / >
< / el-form-item >
< el-form-item label = "产线" prop = "productionLine" >
< el-input v-model = "sharedQueryParams.productionLine" placeholder="请输入产线" clearable
@keyup.enter.native ="handleQuery" / >
< / el-form-item >
< el-form-item label = "产线段" prop = "lineSection" >
< el-input v-model = "sharedQueryParams.lineSection" placeholder="请输入产线段" clearable
@keyup.enter.native ="handleQuery" / >
< / el-form-item >
< el-form-item >
< el-button type = "primary" icon = "el-icon-search" size = "mini" @click ="handlePartQuery" > 搜索 < / el -button >
< / el-form-item >
< / el-form >
< el-row :gutter = "10" class = "mb8" >
< el-button type = "primary" plain icon = "el-icon-plus" size = "mini" @click ="handlePartAdd" > 新增 < / el -button >
< el-button type = "success" plain icon = "el-icon-edit" size = "mini" :disabled = "partSingle"
@click ="handlePartUpdate" > 修改 < / el -button >
< el-button type = "danger" plain icon = "el-icon-delete" size = "mini" :disabled = "partMultiple"
@click ="handlePartDelete" > 删除 < / el -button >
< / el-row >
< div v-loading = "partLoading" style="flex: 1; overflow-y: auto; overflow-x: hidden;" >
< div v-for = "item in equipmentPartList" :key="item.partId" class="part-card"
: class = "{ 'part-card-selected': isCurrentPart(item) }" @click ="handlePartRowClick(item)" >
< el -checkbox :value = "!!partCheckedMap[item.partId]" @click.stop @change ="togglePartSelect(item)"
class = "part-checkbox" / >
< div class = "part-card-body" >
< div class = "part-card-name" >
< pre > { { item . inspectPart } } < / pre >
< / div >
< div class = "part-card-meta" >
< span > { { item . productionLine } } < / span >
< template v-if = "item.lineSection" > / {{ item.lineSection }} < / template >
< template v-if = "item.responsiblePerson"> | <span class="part-card-person" > 负责人 : {{ item.responsiblePerson }} < / span > < / template >
< template v-if = "item.remark" > | {{ item.remark }} < / template >
< / div >
< / div >
< div class = "part-card-actions" @click.stop >
< el -button size = "mini" type = "text" icon = "el-icon-document-copy" @click ="handlePartCopy(item)" / >
< el-button size = "mini" type = "text" icon = "el-icon-plus" @click ="handleAddChecklistForPart(item)" / >
< el-button size = "mini" type = "text" icon = "el-icon-full-screen" @click ="handleShowQRCode(item)" / >
< el-button size = "mini" type = "text" icon = "el-icon-edit" @click ="handlePartUpdate(item)" / >
< el-button size = "mini" type = "text" icon = "el-icon-delete" @click ="handlePartDelete(item)" / >
< / div >
< / div >
< / div >
< / div >
< / template >
< template # panelB >
< div style = "height: 100%; padding: 0 10px; display: flex; flex-direction: column; overflow: hidden;" >
< el-form :model = "checklistQueryParams" ref = "checklistQueryForm" size = "small" :inline = "true"
label -width = " 80px " >
< el-form-item label = "检验编号" prop = "checkNo" >
< el-input v-model = "checklistQueryParams.checkNo" placeholder="请输入检验编号" clearable
@keyup.enter.native ="handleChecklistQuery" / >
< / el-form-item >
< el-form-item label = "检验部位" prop = "partId" >
< el-select v-model = "checklistQueryParams.partId" placeholder="请选择检验部位" clearable size="mini"
@change ="handleChecklistQuery" style = "width: 150px;" >
< el-option v-for = "item in equipmentPartList" :key="item.partId" :label="item.inspectPart"
:value = "item.partId" / >
< / el-select >
< / el-form-item >
< el-form-item label = "设备状态" prop = "equipmentState" >
< el-select v-model = "checklistQueryParams.equipmentState" placeholder="请选择设备状态" clearable
@change ="handleChecklistQuery" style = "width: 150px;" >
< el-option label = "运行" value = "运行" / >
< el-option label = "停止" value = "停止" / >
< / el-select >
< / el-form-item >
< el-form-item label = "检验标准" prop = "checkStandard" >
< el-input v-model = "checklistQueryParams.checkStandard" placeholder="请输入检验标准" clearable
@keyup.enter.native ="handleChecklistQuery" / >
< / el-form-item >
< el-form-item >
< el-button type = "primary" icon = "el-icon-search" size = "mini" @click ="handleChecklistQuery" > 搜索 < / el -button >
< el-button type = "primary" plain icon = "el-icon-plus" size = "mini" @click ="handleChecklistAdd" > 新增 < / el -button >
< el-button type = "success" plain icon = "el-icon-edit" size = "mini" :disabled = "checklistSingle"
@click ="handleChecklistUpdate" > 修改 < / el -button >
< el-button type = "danger" plain icon = "el-icon-delete" size = "mini" :disabled = "checklistMultiple"
@click ="handleChecklistDelete" > 删除 < / el -button >
< / el-form-item >
< / el-form >
< div v-loading = "checklistLoading" style="flex: 1; overflow: hidden;" >
< el -table :data = "equipmentChecklistList" height = "calc(100% - 20px)"
@ selection -change = " handleChecklistSelectionChange " >
< el-table-column type = "selection" width = "55" align = "center" / >
< el-table-column label = "检验编号" align = "center" prop = "checkNo" / >
< el-table-column label = "设备部件名称" align = "center" prop = "partName" width = "120" / >
< el-table-column label = "检验内容" align = "center" prop = "checkContent" show -overflow -tooltip / >
< el-table-column label = "设备状态" align = "center" prop = "equipmentState" / >
< el-table-column label = "检验标准" align = "center" prop = "checkStandard" show -overflow -tooltip / >
< el-table-column label = "备注" align = "center" prop = "remark" show -overflow -tooltip / >
< el-table-column label = "操作" align = "center" class -name = " small -padding fixed -width " width = "180" >
< template slot -scope = " scope " >
< el-button size = "mini" type = "text" icon = "el-icon-document-copy"
@click.stop ="handleChecklistCopy(scope.row)" >
< / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-edit"
@click.stop ="handleChecklistUpdate(scope.row)" > < / el -button >
< el-button size = "mini" type = "text" icon = "el-icon-delete"
@click.stop ="handleChecklistDelete(scope.row)" > < / el -button >
< / template >
< / el-table-column >
< / el-table >
< / div >
< / div >
< / template >
< / DragResizePanel >
< el-dialog :title = "partTitle" :visible.sync = "partOpen" width = "500px" append -to -body >
< el-form ref = "partForm" :model = "partForm" :rules = "partRules" label -width = " 80px " >
< el-form-item label = "产线" prop = "productionLine" >
< el-select v-model = "partForm.lineId" placeholder="请选择产线" style="width: 100%;" >
< 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 = "产线段" prop = "lineSection" >
< el-input v-model = "partForm.lineSection" placeholder="请输入产线段" / >
< / el-form-item >
< el-form-item label = "巡检部位" prop = "inspectPart" >
< el-input v-model = "partForm.inspectPart" placeholder="请输入巡检部位" / >
< / el-form-item >
< el-form-item label = "负责人" prop = "responsiblePerson" >
< el-input v-model = "partForm.responsiblePerson" placeholder="请输入负责人" clearable / >
< / el-form-item >
< el-form-item label = "备注" prop = "remark" >
< el-input v-model = "partForm.remark" placeholder="请输入备注" / >
< / el-form-item >
< / el-form >
< div slot = "footer" class = "dialog-footer" >
< el-button :loading = "partButtonLoading" type = "primary" @click ="submitPartForm" > 确 定 < / el -button >
< el-button @click ="cancelPart" > 取 消 < / el -button >
< / div >
< / el-dialog >
< el-dialog :title = "qrCodeTitle" :visible.sync = "qrCodeOpen" width = "360px" append -to -body >
< div ref = "qrCodeWrapper" style = "display: flex; flex-direction: column; align-items: center; padding: 10px 0;" >
< QRCode ref = "qrCodeRef" :content = "qrCodeContent" :size = "200" :text = "qrCodeText" / >
< / div >
< div slot = "footer" class = "dialog-footer" >
< el-button :loading = "qrCodeLoading" type = "primary" @click ="saveQRCodeImage" > 保存图片 < / el -button >
< el-button :loading = "qrCodeLoading" type = "primary" @click ="printQRCode" > 打印 < / el -button >
< / div >
< / el-dialog >
< el-dialog :title = "checklistTitle" :visible.sync = "checklistOpen" width = "500px" append -to -body >
< el-form ref = "checklistForm" :model = "checklistForm" :rules = "checklistRules" label -width = " 80px " >
< el-form-item label = "检验编号" prop = "checkNo" >
< el-input v-model = "checklistForm.checkNo" placeholder="请输入检验编号" / >
< / el-form-item >
< el-form-item label = "检验部位" prop = "partId" >
< el-select v-model = "checklistForm.partId" placeholder="请选择检验部位" clearable style="width: 100%;" >
< el -option v-for = "item in equipmentPartList" :key="item.partId" :label="item.inspectPart"
:value = "item.partId" / >
< / el-select >
< / el-form-item >
< el-form-item label = "检验内容" >
< el-input v-model = "checklistForm.checkContent" type="textarea" placeholder="请输入内容" / >
< / el-form-item >
< el-form-item label = "设备状态" prop = "equipmentState" >
< el-select v-model = "checklistForm.equipmentState" placeholder="请选择设备状态" clearable style="width: 100%;" >
< el -option label = "运行" value = "运行" / >
< el-option label = "停止" value = "停止" / >
< / el-select >
< / el-form-item >
< el-form-item label = "检验标准" prop = "checkStandard" >
< el-input v-model = "checklistForm.checkStandard" type="textarea" placeholder="请输入检验标准" / >
< / el-form-item >
< el-form-item label = "备注" prop = "remark" >
< el-input v-model = "checklistForm.remark" placeholder="请输入备注" / >
< / el-form-item >
< / el-form >
< div slot = "footer" class = "dialog-footer" >
< el-button :loading = "checklistButtonLoading" type = "primary" @click ="submitChecklistForm" > 确 定 < / el -button >
< el-button @click ="cancelChecklist" > 取 消 < / el -button >
< / div >
< / el-dialog >
< / div >
< / template >
< script >
import DragResizePanel from "@/components/DragResizePanel" ;
import QRCode from "@/components/QRCode" ;
import domToImage from 'dom-to-image' ;
import html2canvas from 'html2canvas' ;
import { PDFDocument } from 'pdf-lib' ;
import { listEquipmentPart , getEquipmentPart , delEquipmentPart , addEquipmentPart , updateEquipmentPart } from "@/api/mes/eqp/equipmentPart" ;
import { listEquipmentChecklist , getEquipmentChecklist , delEquipmentChecklist , addEquipmentChecklist , updateEquipmentChecklist } from "@/api/mes/eqp/equipmentChecklist" ;
import { listProductionLine } from '@/api/wms/productionLine'
export default {
name : "EquipmentPartByPerson" ,
components : { DragResizePanel , QRCode } ,
data ( ) {
return {
showSearch : true ,
// Shared query params (responsiblePerson is primary, others optional)
sharedQueryParams : {
responsiblePerson : undefined ,
productionLine : undefined ,
lineSection : undefined
} ,
personList : [ ] ,
lineList : [ ] ,
// Part (left side)
partLoading : false ,
partButtonLoading : false ,
partIds : [ ] ,
partSingle : true ,
partMultiple : true ,
partTotal : 0 ,
equipmentPartList : [ ] ,
partTitle : "" ,
partOpen : false ,
partQueryParams : {
pageNum : 1 ,
pageSize : 1000 ,
inspectPart : undefined ,
} ,
partCheckedMap : { } ,
partForm : { } ,
partRules : {
inspectPart : [
{ required : true , message : "巡检部位不能为空" , trigger : "blur" }
] ,
productionLine : [
{ required : true , message : "产线不能为空" , trigger : "blur" }
] ,
lineSection : [
{ required : true , message : "产线段不能为空" , trigger : "blur" }
]
} ,
// Checklist (right side)
checklistLoading : false ,
checklistButtonLoading : false ,
checklistIds : [ ] ,
checklistSingle : true ,
checklistMultiple : true ,
checklistTotal : 0 ,
equipmentChecklistList : [ ] ,
checklistTitle : "" ,
checklistOpen : false ,
checklistQueryParams : {
pageNum : 1 ,
pageSize : 1000 ,
checkNo : undefined ,
partId : undefined ,
partName : undefined ,
equipmentState : undefined ,
checkStandard : undefined ,
responsiblePerson : undefined
} ,
checklistForm : { } ,
checklistRules : { } ,
currentPart : { } ,
// QR Code
qrCodeOpen : false ,
qrCodeTitle : '' ,
qrCodeContent : '' ,
qrCodeText : '' ,
qrCodeLoading : false ,
} ;
} ,
computed : {
currentPartId ( ) {
return this . currentPart ? . partId || "" ;
} ,
} ,
created ( ) {
this . loadInitData ( ) ;
} ,
methods : {
async loadInitData ( ) {
try {
const res = await listProductionLine ( { pageSize : 999 } ) ;
if ( res . rows ) this . lineList = res . rows ;
} catch ( e ) { console . error ( '加载产线列表失败' , e ) ; }
await this . loadPersonList ( ) ;
} ,
async loadPersonList ( ) {
try {
const res = await listEquipmentPart ( { pageSize : 9999 } ) ;
if ( res . rows ) {
const persons = [ ... new Set ( res . rows . map ( item => item . responsiblePerson ) . filter ( Boolean ) ) ] ;
this . personList = persons . sort ( ) ;
if ( this . personList . length > 0 && ! this . sharedQueryParams . responsiblePerson ) {
this . sharedQueryParams . responsiblePerson = this . personList [ 0 ] ;
}
}
if ( this . sharedQueryParams . responsiblePerson ) {
this . getPartList ( ) ;
this . getChecklistList ( ) ;
}
} catch ( e ) { console . error ( '加载负责人列表失败' , e ) ; }
} ,
applySharedParams ( ) {
this . partQueryParams . responsiblePerson = this . sharedQueryParams . responsiblePerson ;
this . partQueryParams . productionLine = this . sharedQueryParams . productionLine ;
this . partQueryParams . lineSection = this . sharedQueryParams . lineSection ;
this . checklistQueryParams . responsiblePerson = this . sharedQueryParams . responsiblePerson ;
this . checklistQueryParams . productionLine = this . sharedQueryParams . productionLine ;
this . checklistQueryParams . lineSection = this . sharedQueryParams . lineSection ;
} ,
handleQuery ( ) {
this . partQueryParams . pageNum = 1 ;
this . checklistQueryParams . pageNum = 1 ;
this . applySharedParams ( ) ;
this . getPartList ( true ) ;
} ,
// ========== Part (Left) ==========
getPartList ( splitChild = false ) {
this . partLoading = true ;
this . applySharedParams ( ) ;
const params = {
... this . partQueryParams ,
productionLine : this . sharedQueryParams . productionLine ,
lineSection : this . sharedQueryParams . lineSection ,
} ;
listEquipmentPart ( params ) . then ( response => {
this . equipmentPartList = response . rows ;
if ( splitChild ) {
this . checklistLoading = true ;
this . equipmentChecklistList = this . equipmentPartList . flatMap ( item => item . checklistList || [ ] ) ;
this . checklistLoading = false ;
}
this . partTotal = response . total ;
this . partLoading = false ;
} ) ;
} ,
handlePartQuery ( ) {
this . partQueryParams . pageNum = 1 ;
this . getPartList ( ) ;
} ,
isCurrentPart ( item ) {
return this . currentPart && this . currentPart . partId === item . partId ;
} ,
togglePartSelect ( item ) {
const checked = ! this . partCheckedMap [ item . partId ] ;
this . $set ( this . partCheckedMap , item . partId , checked ) ;
this . updatePartSelection ( ) ;
} ,
updatePartSelection ( ) {
const selected = this . equipmentPartList . filter ( item => this . partCheckedMap [ item . partId ] ) ;
this . partIds = selected . map ( item => item . partId ) ;
this . partSingle = selected . length !== 1 ;
this . partMultiple = ! selected . length ;
} ,
handlePartRowClick ( row ) {
this . checklistQueryParams . partId = row . partId ;
this . checklistQueryParams . pageNum = 1 ;
this . currentPart = row ;
this . getChecklistList ( ) ;
} ,
resetPartForm ( ) {
this . partForm = {
partId : undefined ,
inspectPart : undefined ,
remark : undefined ,
lineId : undefined ,
productionLine : undefined ,
lineSection : undefined ,
responsiblePerson : undefined
} ;
this . resetForm ( "partForm" ) ;
} ,
cancelPart ( ) {
this . partOpen = false ;
this . resetPartForm ( ) ;
} ,
handlePartAdd ( ) {
this . resetPartForm ( ) ;
if ( this . sharedQueryParams . responsiblePerson ) {
this . partForm . responsiblePerson = this . sharedQueryParams . responsiblePerson ;
}
this . partOpen = true ;
this . partTitle = "添加检验部位" ;
} ,
handlePartUpdate ( row ) {
this . partLoading = true ;
this . resetPartForm ( ) ;
const partId = row . partId || this . partIds ;
getEquipmentPart ( partId ) . then ( response => {
this . partLoading = false ;
this . partForm = response . data ;
if ( this . partForm . productionLine && this . lineList . length ) {
const line = this . lineList . find ( l => l . lineName === this . partForm . productionLine ) ;
if ( line ) this . $set ( this . partForm , 'lineId' , line . lineId ) ;
}
this . partOpen = true ;
this . partTitle = "修改检验部位" ;
} ) ;
} ,
submitPartForm ( ) {
this . $refs [ "partForm" ] . validate ( valid => {
if ( valid ) {
this . partButtonLoading = true ;
if ( this . partForm . lineId ) {
const line = this . lineList . find ( l => l . lineId === this . partForm . lineId ) ;
if ( line ) this . partForm . productionLine = line . lineName ;
}
if ( this . partForm . partId != null ) {
updateEquipmentPart ( this . partForm ) . then ( response => {
this . $modal . msgSuccess ( "修改成功" ) ;
this . partOpen = false ;
this . getPartList ( ) ;
this . loadPersonList ( ) ;
} ) . finally ( ( ) => {
this . partButtonLoading = false ;
} ) ;
} else {
addEquipmentPart ( this . partForm ) . then ( response => {
this . $modal . msgSuccess ( "新增成功" ) ;
this . partOpen = false ;
this . getPartList ( ) ;
this . loadPersonList ( ) ;
} ) . finally ( ( ) => {
this . partButtonLoading = false ;
} ) ;
}
}
} ) ;
} ,
handlePartDelete ( row ) {
const partIds = row . partId || this . partIds ;
this . $modal . confirm ( '是否确认删除检验部位编号为"' + partIds + '"的数据项?' ) . then ( ( ) => {
this . partLoading = true ;
return delEquipmentPart ( partIds ) ;
} ) . then ( ( ) => {
this . partLoading = false ;
this . getPartList ( ) ;
this . loadPersonList ( ) ;
this . $modal . msgSuccess ( "删除成功" ) ;
} ) . catch ( ( ) => { } ) . finally ( ( ) => {
this . partLoading = false ;
} ) ;
} ,
handlePartCopy ( row ) {
this . partLoading = true ;
this . resetPartForm ( ) ;
getEquipmentPart ( row . partId ) . then ( response => {
this . partLoading = false ;
this . partForm = response . data ;
this . partForm . partId = undefined ;
this . partOpen = true ;
this . partTitle = "复制新增检验部位" ;
} ) ;
} ,
handleAddChecklistForPart ( row ) {
this . resetChecklistForm ( ) ;
this . checklistForm . partId = row . partId ;
this . checklistOpen = true ;
this . checklistTitle = "添加设备检验清单" ;
} ,
handleShowQRCode ( row ) {
this . qrCodeContent = ` eqpPart:: ${ row . partId } ` ;
this . qrCodeText = row . inspectPart ;
this . qrCodeTitle = ` 二维码 - ${ row . inspectPart } ` ;
this . qrCodeOpen = true ;
} ,
async saveQRCodeImage ( ) {
const el = this . $refs . qrCodeWrapper ;
if ( ! el ) return ;
this . qrCodeLoading = true ;
try {
const dataUrl = await domToImage . toPng ( el ) ;
const link = document . createElement ( 'a' ) ;
link . href = dataUrl ;
link . download = ` 二维码_ ${ this . qrCodeText } _ ${ new Date ( ) . getTime ( ) } .png ` ;
document . body . appendChild ( link ) ;
link . click ( ) ;
document . body . removeChild ( link ) ;
this . $modal . msgSuccess ( '图片保存成功' ) ;
} catch ( error ) {
console . error ( '保存二维码图片失败:' , error ) ;
this . $modal . msgError ( '保存图片失败' ) ;
} finally {
this . qrCodeLoading = false ;
}
} ,
async printQRCode ( ) {
const el = this . $refs . qrCodeWrapper ;
if ( ! el ) return ;
this . qrCodeLoading = true ;
try {
const canvas = await html2canvas ( el , {
backgroundColor : '#ffffff' ,
scale : 3 ,
useCORS : true ,
} ) ;
const mmToPt = 72 / 25.4 ;
const sizeMm = 100 ;
const sizePt = sizeMm * mmToPt ;
const pdfDoc = await PDFDocument . create ( ) ;
const imgPng = await pdfDoc . embedPng ( canvas . toDataURL ( 'image/png' ) ) ;
const page = pdfDoc . addPage ( [ sizePt , sizePt ] ) ;
const imgDims = imgPng . scale ( 1 ) ;
const scale = Math . min ( sizePt / imgDims . width , sizePt / imgDims . height ) ;
const dw = imgDims . width * scale ;
const dh = imgDims . height * scale ;
page . drawImage ( imgPng , {
x : ( sizePt - dw ) / 2 ,
y : ( sizePt - dh ) / 2 ,
width : dw ,
height : dh ,
} ) ;
const pdfBytes = await pdfDoc . save ( ) ;
const blob = new Blob ( [ pdfBytes ] , { type : 'application/pdf' } ) ;
const url = URL . createObjectURL ( blob ) ;
window . open ( url , '_blank' ) ;
} catch ( error ) {
console . error ( '打印二维码失败:' , error ) ;
this . $modal . msgError ( '打印失败' ) ;
} finally {
this . qrCodeLoading = false ;
}
} ,
// ========== Checklist (Right) ==========
getChecklistList ( ) {
this . checklistLoading = true ;
this . applySharedParams ( ) ;
listEquipmentChecklist ( this . checklistQueryParams ) . then ( response => {
this . equipmentChecklistList = response . rows ;
this . checklistTotal = response . total ;
this . checklistLoading = false ;
} ) ;
} ,
handleChecklistQuery ( ) {
this . checklistQueryParams . pageNum = 1 ;
this . getChecklistList ( ) ;
} ,
handleChecklistSelectionChange ( selection ) {
this . checklistIds = selection . map ( item => item . checkId ) ;
this . checklistSingle = selection . length !== 1 ;
this . checklistMultiple = ! selection . length ;
} ,
resetChecklistForm ( ) {
this . checklistForm = {
checkId : undefined ,
checkNo : undefined ,
partId : undefined ,
partName : undefined ,
checkContent : undefined ,
equipmentState : undefined ,
checkStandard : undefined ,
responsiblePerson : undefined ,
remark : undefined
} ;
this . resetForm ( "checklistForm" ) ;
} ,
cancelChecklist ( ) {
this . checklistOpen = false ;
this . resetChecklistForm ( ) ;
} ,
handleChecklistAdd ( ) {
this . resetChecklistForm ( ) ;
if ( this . currentPart ? . partId ) {
this . checklistForm . partId = this . currentPart . partId ;
}
this . checklistOpen = true ;
this . checklistTitle = "添加设备检验清单" ;
} ,
handleChecklistCopy ( row ) {
this . checklistLoading = true ;
this . resetChecklistForm ( ) ;
getEquipmentChecklist ( row . checkId ) . then ( response => {
this . checklistLoading = false ;
this . checklistForm = response . data ;
this . checklistForm . checkId = undefined ;
this . checklistOpen = true ;
this . checklistTitle = "复制新增设备检验清单" ;
} ) ;
} ,
handleChecklistUpdate ( row ) {
this . checklistLoading = true ;
this . resetChecklistForm ( ) ;
const checkId = row . checkId || this . checklistIds ;
getEquipmentChecklist ( checkId ) . then ( response => {
this . checklistLoading = false ;
this . checklistForm = response . data ;
this . checklistOpen = true ;
this . checklistTitle = "修改设备检验清单" ;
} ) ;
} ,
submitChecklistForm ( ) {
this . $refs [ "checklistForm" ] . validate ( valid => {
if ( valid ) {
this . checklistButtonLoading = true ;
if ( this . checklistForm . checkId != null ) {
updateEquipmentChecklist ( this . checklistForm ) . then ( response => {
this . $modal . msgSuccess ( "修改成功" ) ;
this . checklistOpen = false ;
this . getChecklistList ( ) ;
} ) . finally ( ( ) => {
this . checklistButtonLoading = false ;
} ) ;
} else {
addEquipmentChecklist ( this . checklistForm ) . then ( response => {
this . $modal . msgSuccess ( "新增成功" ) ;
this . checklistOpen = false ;
this . getChecklistList ( ) ;
} ) . finally ( ( ) => {
this . checklistButtonLoading = false ;
} ) ;
}
}
} ) ;
} ,
handleChecklistDelete ( row ) {
const checkIds = row . checkId || this . checklistIds ;
this . $modal . confirm ( '是否确认删除设备检验清单编号为"' + checkIds + '"的数据项?' ) . then ( ( ) => {
this . checklistLoading = true ;
return delEquipmentChecklist ( checkIds ) ;
} ) . then ( ( ) => {
this . checklistLoading = false ;
this . getChecklistList ( ) ;
this . $modal . msgSuccess ( "删除成功" ) ;
} ) . catch ( ( ) => { } ) . finally ( ( ) => {
this . checklistLoading = false ;
} ) ;
} ,
}
} ;
< / script >
< style scoped >
. part - card {
display : flex ;
align - items : center ;
padding : 6 px 8 px ;
margin - bottom : 2 px ;
border - radius : 4 px ;
cursor : pointer ;
transition : background - color 0.2 s ;
border - left : 3 px solid transparent ;
}
. part - card : hover {
background - color : # f5f7fa ;
}
. part - card - selected {
background - color : # ecf5ff ;
border - left - color : # 409 eff ;
}
. part - checkbox {
margin - right : 8 px ;
flex - shrink : 0 ;
}
. part - card - body {
flex : 1 ;
min - width : 0 ;
overflow : hidden ;
}
. part - card - name {
font - size : 13 px ;
font - weight : 500 ;
color : # 303133 ;
line - height : 1.4 ;
}
. part - card - meta {
font - size : 11 px ;
color : # 909399 ;
line - height : 1.3 ;
white - space : nowrap ;
overflow : hidden ;
text - overflow : ellipsis ;
}
. part - card - person {
color : # 409 eff ;
font - weight : 600 ;
}
. part - card - actions {
flex - shrink : 0 ;
margin - left : 4 px ;
white - space : nowrap ;
}
. part - card - actions . el - button {
padding : 2 px 3 px ;
font - size : 13 px ;
}
< / style >