<template>
|
<j-modal
|
:title='title'
|
:width='width'
|
:visible='visible'
|
:confirmLoading='confirmLoading'
|
switchFullscreen
|
@ok='handleOk'
|
@cancel='handleCancel'
|
cancelText='关闭'
|
>
|
<a-spin :spinning='confirmLoading'>
|
<a-form-model
|
ref='form'
|
:model='model'
|
:rules='validatorRules1'
|
>
|
<a-row>
|
<a-col :span='12'>
|
<a-form-model-item
|
label='单据号'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='num'
|
>
|
<a-input
|
v-model='model.num'
|
disabled='true'
|
placeholder='请输入单据号'
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='12'>
|
<a-form-model-item
|
label='设备编码/名称/型号'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='equipmentId'
|
>
|
<a-input
|
v-model='model.equipmentId'
|
disabled='true'
|
placeholder='请输入编码/名称/型号'
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col
|
:span='12'
|
v-if='isSelfCreate'
|
>
|
<a-form-model-item
|
label='故障类型'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='faultTypeId'
|
>
|
<j-dict-select-tag
|
allow-clear
|
placeholder='请选择故障类型'
|
:triggerChange='true'
|
dictCode="mom_eam_fault_type,name,id,del_flag!='1'"
|
v-model='model.faultTypeId'
|
/>
|
|
</a-form-model-item>
|
</a-col>
|
<a-col
|
:span='12'
|
v-if='isSelfCreate'
|
>
|
<a-form-model-item
|
label='故障原因'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='faultCauseId'
|
>
|
<j-dict-select-tag
|
allow-clear
|
placeholder='请选择故障原因'
|
:triggerChange='true'
|
dictCode="mom_eam_fault_cause,name,id,del_flag!='1'"
|
v-model='model.faultCauseId'
|
/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span='12'>
|
<a-form-model-item
|
label='故障分析'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='faultCause'
|
>
|
<a-textarea
|
v-model='model.faultCause'
|
placeholder='请输入故障分析'
|
></a-textarea>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span='12'>
|
<a-form-model-item
|
label='维修措施'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='maintenanceMeasures'
|
>
|
<a-textarea
|
v-model='model.maintenanceMeasures'
|
placeholder='请输入维修措施'
|
></a-textarea>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span='12'>
|
<a-form-model-item
|
label='维保意见'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
prop='suggestion'
|
>
|
<a-textarea
|
v-model='model.suggestion'
|
placeholder='请输入维保意见'
|
></a-textarea>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
|
import { httpAction } from '@/api/manage'
|
import { getAction } from '../../../../api/manage'
|
import { duplicateCheck } from '@/api/api'
|
import pick from 'lodash.pick'
|
|
|
export default {
|
name: 'RepairOrderFaultAnalysisReportModel',
|
components: {},
|
props: {
|
isSelfCreate: {
|
type: Boolean,
|
required: false,
|
default: true
|
}
|
},
|
data() {
|
return {
|
title: '操作',
|
width: 1400,
|
visible: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
},
|
confirmLoading: false,
|
validatorRules1: {
|
faultTypeId: [
|
{ required: true, message: '请选择故障类型!' }
|
],
|
faultCauseId: [
|
{ required: true, message: '请输入故障原因!' }
|
],
|
faultCause: [
|
{ required: true, message: '请输入故障分析!' }
|
],
|
maintenanceMeasures: [
|
|
{ required: true, message: '请输入维修措施' }
|
],
|
remark: [{ min: 0, max: 100, message: '超过做大输入限制,请缩减长度' }]
|
|
},
|
|
url: {
|
add: '/eam/repairOrderFaultAnalysis/add',
|
edit: '/eam/repairOrderFaultAnalysis/edit',
|
},
|
equipmentList: [],
|
hoursList: [],
|
actualMaterialList: [],
|
faultAnalysisList: [],
|
|
reportRepairStatus: false,
|
data: null
|
|
}
|
},
|
created() {
|
//备份model原始值
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model))
|
},
|
methods: {
|
add(data) {
|
|
this.edit(this.modelDefault)
|
this.model.id = this.getUuiD(16)
|
this.model.num = data[0].num
|
this.model.equipmentId = data[0].equipmentNum + '/' + data[0].equipmentName + '/' + data[0].equipmentModel
|
this.model.reportAfterRepairId=data[0].id
|
},
|
edit(record) {
|
this.model = Object.assign({}, record)
|
console.log(this.isSelfCreate)
|
this.visible = true;
|
this.$nextTick(() => {
|
this.form.setFieldsValue(pick(this.model, 'equipmentId', 'num'));
|
});
|
},
|
|
|
|
close() {
|
this.$emit('close')
|
this.visible = false
|
this.$refs.form.clearValidate()
|
},
|
handleOk() {
|
const that = this
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true
|
let httpurl = ''
|
let method = ''
|
if (this.title == '新增') {
|
httpurl += this.url.add
|
method = 'post'
|
} else {
|
httpurl += this.url.edit
|
method = 'put'
|
}
|
/* this.model.repairOrderId=data.id*/
|
//子表验证(维修内容)
|
//表单提交
|
httpAction(httpurl, this.model, method).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message)
|
that.$emit('ok')
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
that.close()
|
})
|
} else {
|
return false
|
}
|
})
|
},
|
handleCancel() {
|
this.close()
|
},
|
|
getUuiD(randomLength) {
|
return Number(
|
Math.random()
|
.toString()
|
.substr(2, randomLength) + Date.now()
|
).toString(36)
|
},
|
popupCallback(value, row) {
|
this.model = Object.assign(this.model, row)
|
console.log(this.model)
|
}
|
}
|
}
|
</script>
|