<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="validatorRules"
|
>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item
|
label="部位"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="location"
|
>
|
<a-input
|
v-model="model.location"
|
placeholder="请输入部位"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="示意图"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="sketchMap"
|
>
|
<j-image-upload
|
:isMultiple="false"
|
v-model="model.sketchMap"
|
></j-image-upload>
|
</a-form-model-item>
|
</a-col>
|
<!-- <a-col :span="24">
|
<a-form-model-item
|
label="维修项目"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="maintenanceItem"
|
>
|
<a-input
|
v-model="model.maintenanceItem"
|
placeholder="请输入维修项目"
|
></a-input>
|
</a-form-model-item>
|
</a-col> -->
|
<a-col :span="24">
|
<a-form-model-item
|
label="维修要求"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="maintenanceRequire"
|
>
|
<a-input
|
v-model="model.maintenanceRequire"
|
placeholder="请输入维修要求"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="方法"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="maintenanceWay"
|
>
|
<a-input
|
v-model="model.maintenanceWay"
|
placeholder="请输入维修方法"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="工具"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="maintenanceTooling"
|
>
|
<a-input
|
v-model="model.maintenanceTooling"
|
placeholder="请输入维修工具"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="安全要求"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="safetyRequirement"
|
>
|
<a-input
|
v-model="model.safetyRequirement"
|
placeholder="请输入安全要求"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<!-- <a-col :span="24">
|
<a-form-model-item
|
label="维修周期"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="repairCycle"
|
>
|
<a-input-number
|
style="width: 100%"
|
v-model="model.repairCycle"
|
placeholder="请输入维修周期"
|
:min="0"
|
:max="99999"
|
></a-input-number>
|
</a-form-model-item>
|
</a-col> -->
|
<a-col :span="24">
|
<a-form-model-item
|
label="工时定额"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="timeQuota"
|
>
|
<a-input-number
|
style="width: 100%"
|
v-model="model.timeQuota"
|
placeholder="请输入工时定额"
|
:min="0"
|
:max="99999"
|
></a-input-number>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="维保专业"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="mamaintenanceSpecialtyId"
|
>
|
<j-dict-select-tag
|
placeholder="请选择维保专业"
|
:triggerChange="true"
|
dictCode="mom_eam_maintenance_specialty,name,id,del_flag!='1'"
|
v-model="model.mamaintenanceSpecialtyId"
|
/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
|
import { httpAction } from '@/api/manage'
|
import { validateDuplicateValue } from '@/utils/util'
|
|
export default {
|
name: "RepairOrderDetailModal",
|
components: {
|
},
|
props: {
|
mainId: {
|
type: String,
|
required: false,
|
default: ''
|
}
|
},
|
data() {
|
return {
|
title: "操作",
|
width: 800,
|
visible: false,
|
model: {
|
},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 },
|
},
|
|
confirmLoading: false,
|
validatorRules: {
|
location: [
|
{ required: true, message: '请输入部位!' },
|
{ max: 32, message: '超过最大输入限制,请缩减长度' }
|
],
|
sketchMap: [
|
{ required: true, message: '请上传!' },
|
],
|
// maintenanceItem: [{ required: true, message: '请输入维修项目!' },
|
// { max: 32, message: '超过最大输入限制,请缩减长度' }
|
// ],
|
maintenanceRequire: [{ required: true, message: '请输入维修要求!' },
|
{ max: 32, message: '超过最大输入限制,请缩减长度' }
|
],
|
maintenanceTooling: [{ required: true, message: '请输入维修工具!' },
|
{ max: 32, message: '超过最大输入限制,请缩减长度' }
|
],
|
safetyRequirement: [{ required: true, message: '请输入安全要求!' },
|
{ max: 32, message: '超过最大输入限制,请缩减长度' }
|
],
|
timeQuota: [{ required: true, message: '请输入工时定额!' },
|
|
],
|
// repairCycle: [{ required: true, message: '请输入维修周期!' }],
|
// mamaintenanceSpecialtyId: [{ required: true, message: '请选择维保专业!' },
|
// ],
|
maintenanceWay: [{ required: true, message: '请输入方法!' },
|
{ max: 32, message: '超过最大输入限制,请缩减长度' }
|
],
|
},
|
url: {
|
add: "/eam/repairOrder/addRepairOrderDetail",
|
edit: "/eam/repairOrder/editRepairOrderDetail",
|
}
|
|
}
|
},
|
created() {
|
//备份model原始值
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
},
|
methods: {
|
add() {
|
this.edit(this.modelDefault);
|
},
|
edit(record) {
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
},
|
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.model.id) {
|
httpurl += this.url.add;
|
method = 'post';
|
} else {
|
httpurl += this.url.edit;
|
method = 'put';
|
}
|
this.model['repairOrderId'] = this.mainId
|
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()
|
},
|
|
|
}
|
}
|
</script>
|