@ -1,12 +1,30 @@
< template >
< div class = "app-container" >
< el -dialog title = "流程记录" :visible.sync ="dialogVisible" width = "60%" v -dialogDrag append -to -body >
< el -form :model ="formData" ref = "formRef" :rules ="formRules" :loading ="formLoading" :inline ="true" label -width = " 15rem " >
< el -row :gutter ="1" >
< el -col :span ="24" >
< span class = "notice" > { {
projectList . length === 0
? ( this . formData . recordType === 'kssg'
? "没有项目可以施工"
: ( this . formData . recordType === 'sgz' )
? "没有项目在施工中"
: ( this . formData . recordType === 'sgwczj'
? "没有项目可以完成"
: ''
)
)
: ''
} } < / span >
< / e l - c o l >
< / e l - r o w >
< el -form :model ="formData" ref = "formRef" :rules ="formRules" :loading ="formLoading" :inline ="true"
label - width = "15rem" >
< el -row :gutter ="1" >
< el -col :span ="24" >
< el -form -item v-if ="formData.recordType !== 'zj'" label="维修项目" prop="item.id" >
< el -select style = "width: 20rem" v -model = " formData.item.id " >
< el -option v -for = " item in projectList " :key ="item.id" :label ="item.itemName" :value ="item.id" / >
< el -select style = "width: 20rem" v-model ="formData.item.id" >
< el -option v -for = " item in projectList " :key ="item.id" :label ="item.itemName" :value ="item.id" / >
< / e l - s e l e c t >
< / e l - f o r m - i t e m >
< / e l - c o l >
@ -14,30 +32,41 @@
< el -row :gutter ="1" >
< el -col :span ="24" >
< el -form -item label = "描述" prop = "remark" >
< el -input style = "width: 30rem" type = "textarea" v -model = " formData.remark " : autosize = "{ minRows: 4, maxRows: 8}" / >
< el -input style = "width: 30rem" type = "textarea" v -model = " formData.remark "
: autosize = "{ minRows: 4, maxRows: 8}" / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< el -row :gutter ="1" >
< el -col :span ="24" >
< el -form -item label = "附件" prop = "image" >
<!-- < FileUpload v -model = " formData.image " / > -- >
< ImageUpload v -model = " formData.image " / >
<!-- < FileUpload v -model = " formData.image " / > -- >
< ImageUpload v -model = " formData.image " / >
< / e l - f o r m - i t e m >
< / e l - c o l >
< / e l - r o w >
< / e l - f o r m >
< div slot = "footer" class = "dialog-footer" >
< el -button v-if ="formData.recordType !== 'sgwczj'" type="primary" @click="doUpdate" > 确 定 < / el -button >
< el -button v-if ="formData.recordType === 'sgwczj'" type="primary" @click="doUpdate" > 部分完成 < / el -button >
< el -button v-if ="formData.recordType === 'sgwczj'" type="success" @click="doFinish" >
{ { isNext ? "整体完成并指派下一项目" : ( isEndCheck ? "整体完成并移交总检" : "整体完成" ) } }
< el -button v-if ="formData.recordType !== 'sgwczj' && projectList.length > 0" type="primary" @click="doUpdate(null)" > 确
定
< / e l - b u t t o n >
< el -button @ click = "dialogVisible = false" > 取 消 < / e l - b u t t o n >
< el -button v-if ="formData.recordType === 'sgwczj' && projectList.length !== 0" type="primary" @click="doUpdate(null)" >
部分完成
< / e l - b u t t o n >
< el -button v-if ="formData.recordType === 'sgwczj' && projectList.length !== 0" type="primary" @click="doFinish" >
完成并移交下一班组
< / e l - b u t t o n >
< el -button v -if = " formData.recordType = = = ' sgwczj ' & & ! isNext & & projectList.length ! = = 0 " type = "primary"
@ click = "doFinish" >
{ { isEndCheck ? "完成并移交总检" : "完成工单" } }
< / e l - b u t t o n >
<!-- < el -button v-if ="formData.recordType === 'sgwczj'" type="success" @click="doFinish" > - - >
<!-- { { isNext ? "整体完成并指派下一项目" : ( isEndCheck ? "整体完成并移交总检" : "整体完成" ) } } -- >
<!-- < / e l - b u t t o n > - - >
< / div >
< / e l - d i a l o g >
< UpdateRepair ref = "updateRepair" @success ="doUpdate" / >
< UpdateRepair ref = "updateRepair" @success ="doUpdate" / >
< / div >
< / template >
@ -49,16 +78,16 @@ import UpdateRepair from "@/views/repair/tickets/form/UpdateRepair.vue";
export default {
name : "UpdateRecord" ,
components : { UpdateRepair } ,
data ( ) {
data ( ) {
return {
dialogVisible : false ,
formData : {
formData : {
/ / 主 表 信 息
id : null ,
ticketsWorkStatus : null ,
remark : null ,
/ / 子 表 信 息
item : {
item : {
id : null ,
itemStatus : null ,
} ,
@ -66,8 +95,8 @@ export default {
image : null ,
recordType : null ,
} ,
formRules : {
'item.id' : [ { required : true , message : "维修项目不能为空" , trigger : 'blur' } ]
formRules : {
'item.id' : [ { required : true , message : "维修项目不能为空" , trigger : 'blur' } ]
} ,
formLoading : false ,
projectList : [ ] ,
@ -78,104 +107,127 @@ export default {
clickRow : null
}
} ,
methods : {
init ( ) {
methods : {
init ( ) {
this . formData = {
/ / 主 表 信 息
id : null ,
ticketsWorkStatus : null ,
remark : null ,
/ / 子 表 信 息
item : {
ticketsWorkStatus : null ,
remark : null ,
/ / 子 表 信 息
item : {
id : null ,
itemStatus : null ,
itemStatus : null ,
} ,
/ / 记 录 信 息
image : null ,
recordType : null ,
recordType : null ,
}
this . projectList = [ ]
this . clickRow = null
} ,
async open ( row ) {
async open ( row ) {
this . init ( )
this . clickRow = row
/ / 是 否 需 要 总 检
this . isEndCheck = row . endCheck === '1'
this . formData . id = row . id
this . formData . recordType = row . clickType
await this . listProject ( row . id )
this . dialogVisible = true
} ,
async listProject ( ticketId ) {
async listProject ( ticketId ) {
try {
this . formLoading = true
const res = await getProjectList ( ticketId )
this . projectList = res . data
this . formData . ticketsWorkStatus = "02"
this . formData . item . itemStatus = "02"
if ( this . formData . recordType === 'kssg' ) {
this . projectList = this . projectList . filter ( item => item . itemStatus === '01' )
} else if ( this . formData . recordType === 'sgz' ) {
this . projectList = this . projectList . filter ( item => item . itemStatus === '02' )
} else {
/ / 因 为 自 己 手 里 有 一 个 项 目 , 所 以 是 > 1
this . isNext = this . projectList . filter ( item => item . itemStatus !== '03' ) . length > 1
/ / 下 面 0 1 : 未 派 工 、 0 2 : 施 工 中 、 0 3 : 已 完 成
/ / 开 始 施 工 展 示 所 有 的 项 目 , 方 便 返 工
/ / 施 工 中 的 项 目 只 展 示 施 工 中 的 项 目 , 一 是 没 施 工 就 有 施 工 记 录 不 合 理 , 二 是 防 止 项 目 太 多 员 工 选 错 , 三 已 完 成 的 项 目 需 要 重 新 就 重 新 开 始 施 工
/ / 施 工 完 成 同 施 工 中
if ( this . formData . recordType !== 'kssg' ) {
this . projectList = this . projectList . filter ( item => item . itemStatus === '02' )
/ / 施 工 完 成 需 要 特 殊 计 算 一 些 东 西
/ / 项 目 全 完 成 需 要 总 检 、 项 目 全 完 成 不 需 要 总 检 、 项 目 没 有 全 完 成
if ( this . formData . recordType !== 'sgz' ) {
/ / 因 为 自 己 手 里 有 一 个 项 目 , 所 以 是 > 1
this . isNext = this . projectList . filter ( item => item . itemStatus !== '03' ) . length > 1
}
}
} finally {
} finally {
this . formLoading = false
}
} ,
async doUpdate ( ) {
async doUpdate ( nextName = null ) {
try {
if ( this . formData . recordType === 'zj' ) {
if ( nextName ) {
this . formData [ 'nextName' ] = nextName
}
if ( this . formData . recordType === 'zj' ) {
this . formData . ticketsWorkStatus = '03'
this . formData [ 'isFinish' ] = '1'
}
if ( this . formData . recordType !== 'zj' ) {
if ( this . formData . recordType !== 'zj' ) {
await this . $refs . formRef . validate ( )
this . formLoading = true
await updateStatus ( this . formData )
this . $modal . msgSuccess ( "操作成功" )
if ( ! nextName ) {
this . $modal . msgSuccess ( "操作成功" )
}
this . dialogVisible = false
this . $emit ( "success" )
} else {
} else {
this . formLoading = true
await updateStatus ( this . formData )
this . $modal . msgSuccess ( "操作成功" )
if ( nextName ) {
this . $modal . msgSuccess ( "操作成功" )
}
this . dialogVisible = false
this . $emit ( "success" )
}
} catch {
} catch {
}
} ,
async doFinish ( ) {
try {
async doFinish ( ) {
try {
await this . $refs . formRef . validate ( )
this . formLoading = true
/ / 不 论 是 什 么 按 钮 , 这 个 工 单 子 项 是 完 了 的
this . formData . item . itemStatus = "03"
/ / 整 体 完 成 并 指 派 下 一 个 人
if ( this . isNext ) {
if ( this . isNext ) {
this . formData [ 'finishType' ] = "01"
await this . $refs . updateRepair . open ( this . clickRow )
return
}
/ / 整 体 完 成 并 移 交 总 检
if ( this . isEndCheck ) {
if ( this . isEndCheck ) {
this . formData [ 'finishType' ] = "02"
this . formData . ticketsWorkStatus = "05"
await this . doUpdate ( ) ;
return
}
/ / 整 体 完 成 , 只 有 没 有 项 目 , 不 需 要 总 检 , 这 个 工 单 才 是 完 了
this . formData . ticketsWorkStatus = "03"
this . formData [ 'finishType' ] = "03"
this . formData [ 'isFinish' ] = '1'
await this . doUpdate ( )
} catch { }
} catch {
}
}
}
}
< / script >
< style scoped lang = "scss" >
. notice {
display : inline - block ;
width : 100 % ;
text - align : center ;
margin : 1 rem 0 ;
font - size : 18 px ;
color : red ;
}
< / style >