<template>
|
<j-modal :title="title" :width="1200" :visible="visible" :confirmLoading="confirmLoading" @ok="handleOk"
|
@cancel="handleCancel" cancelText="关闭" centered>
|
<a-spin :spinning="spinning">
|
<a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-row>
|
<a-col :span="customSpan">
|
<a-form-model-item label="维修开始时间" prop="actualStartTime" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-date-picker show-time v-model="model.actualStartTime" :allowClear="false"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
style="width:100%"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="customSpan">
|
<a-form-model-item label="维修结束时间" prop="actualEndTime" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-date-picker show-time v-model="model.actualEndTime" :allowClear="false"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
style="width:100%"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="customSpan">
|
<a-form-model-item label="故障原因">
|
<a-textarea placeholder="请输入故障原因" v-model="model.faultReason"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="customSpan">
|
<a-form-model-item label="故障分析">
|
<a-textarea placeholder="请输入故障分析" v-model="model.faultAnalysis"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="customSpan">
|
<a-form-model-item label="排故过程">
|
<a-textarea placeholder="请输入排故过程" v-model="model.faultProcess"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="customSpan">
|
<a-form-model-item label="预防措施">
|
<a-textarea placeholder="请输入预防措施" v-model="model.faultPrevent"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<j-vxe-table ref="editableDetailTable" rowNumber rowSelection bordered alwaysEdit toolbar
|
:toolbarConfig="detail.toolbarConfig" keep-source :height="300"
|
:dataSource="detail.dataSource" :columns="detail.columns">
|
|
</j-vxe-table>
|
</a-form-model>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
import { postAction, getAction } from '@/api/manage'
|
import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue'
|
import { JVXETypes } from '@comp/jeecg/JVxeTable'
|
|
export default {
|
name: 'EamRepairOrderModal',
|
components: { LxSearchEquipmentSelect },
|
data() {
|
return {
|
title: '操作',
|
visible: false,
|
model: {},
|
customSpan: 12,
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
},
|
confirmLoading: false,
|
spinning: false,
|
validatorRules: {
|
actualStartTime: [{ required: true, message: '请选择维修开始时间', trigger: 'change' }],
|
actualEndTime: [{ required: true, message: '请选择维修结束时间', trigger: 'change' }]
|
},
|
detail: {
|
dataSource: [],
|
columns: [
|
{
|
title: 'ID',
|
key: 'id',
|
type: JVXETypes.hidden
|
},
|
{
|
title: '维修人',
|
key: 'repairUser',
|
align: 'center',
|
placeholder: '请输入${title}',
|
type: JVXETypes.input,
|
validateRules: [{ required: true, message: '请输入${title}' }]
|
},
|
{
|
title: '是否是主维修人',
|
key: 'repairPrimary',
|
align: 'center',
|
type: JVXETypes.select,
|
placeholder: '请选择${title}',
|
dictCode: 'yn',
|
validateRules: [{ required: true, message: '请选择${title}' }]
|
},
|
{
|
title: '维修时长',
|
key: 'repairDuration',
|
align: 'center',
|
placeholder: '请输入${title}',
|
type: JVXETypes.inputNumber,
|
validateRules: [{ required: true, message: '请输入${title}' }]
|
},
|
{
|
title: '备注',
|
key: 'remark',
|
align: 'center',
|
type: JVXETypes.textarea,
|
placeholder: '请输入${title}'
|
}
|
],
|
toolbarConfig: {
|
// prefix 前缀;suffix 后缀
|
slot: ['prefix', 'suffix'],
|
// add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
|
btn: ['add', 'remove', 'clearSelection']
|
}
|
},
|
url: {
|
report: '/eam/eamRepairOrder/report',
|
detail: '/eam/eamRepairPerson/list'
|
}
|
}
|
},
|
methods: {
|
handleFillIn(record) {
|
this.visible = true
|
this.model = Object.assign({}, record)
|
this.getRepairDetailByApi(record.id)
|
},
|
|
getRepairDetailByApi(repairId) {
|
this.spinning = true
|
this.detail.dataSource = []
|
getAction(this.url.detail, { repairId })
|
.then(res => {
|
if (res.success) this.detail.dataSource = res.result
|
})
|
.finally(() => {
|
this.spinning = false
|
})
|
},
|
|
async handleOk() {
|
const errMap = await this.$refs.editableDetailTable.validateTable()
|
if (errMap) return
|
|
const that = this
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = that.spinning = true
|
|
that.model.eamRepairPersonList = that.$refs.editableDetailTable.getTableData()
|
|
postAction(that.url.report, that.model)
|
.then((res) => {
|
if (res.success) {
|
that.$notification.success({
|
message: '消息',
|
description: res.message
|
})
|
that.$emit('ok')
|
that.close()
|
} else {
|
that.$notification.warning({
|
message: '消息',
|
description: res.message
|
})
|
}
|
})
|
.finally(() => {
|
that.confirmLoading = that.spinning = false
|
})
|
} else {
|
return false
|
}
|
})
|
},
|
|
close() {
|
this.$emit('close')
|
this.visible = false
|
if (this.$refs.form) this.$refs.form.clearValidate()
|
},
|
|
handleCancel() {
|
this.close()
|
}
|
}
|
}
|
</script>
|