<template>
|
<a-modal
|
:title="title"
|
:width="650"
|
:visible="visible"
|
:maskClosable="false"
|
:confirmLoading="confirmLoading"
|
:okButtonProps="{ props: {disabled: disableSubmit} }"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭"
|
>
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-row :gutter="24">
|
<a-col
|
hidden
|
:span="24"
|
>
|
<a-form-item
|
label="保养工单编号"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入保养工单编号'"
|
v-decorator="['technologyStatusVerificationBill', validatorRules.technologyStatusVerificationBill ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item
|
label="统一编号"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入统一编号'"
|
v-decorator="['equipmentNum', validatorRules.equipmentNum ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item
|
label="设备名称"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入设备名称'"
|
v-decorator="['equipmentName', validatorRules.equipmentName ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item
|
label="型号"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入型号'"
|
v-decorator="['equipmentModel', validatorRules.equipmentModel ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item
|
label="规格"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入规格'"
|
v-decorator="['specification', validatorRules.specification ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="技术状态"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="technologyStatus"
|
>
|
<j-dict-select-tag
|
allow-clear
|
placeholder="请选择技术状态"
|
:triggerChange="true"
|
dictCode="technology_status"
|
v-decorator="['technologyStatus', validatorRules.technologyStatus ]"
|
/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-spin>
|
|
<template slot="footer">
|
<a-button
|
:style="{marginRight: '8px'}"
|
@click="handleCancel"
|
>
|
关闭
|
</a-button>
|
<a-button
|
:disabled="disableSubmit || confirmLoading"
|
:loading="confirmLoading"
|
@click="handleOk"
|
type="primary"
|
>保存</a-button>
|
<!-- icon="save" -->
|
</template>
|
|
</a-modal>
|
</template>
|
|
<script>
|
import pick from 'lodash.pick'
|
import { postAction, requestPut } from '@/api/manage'
|
import { duplicateCheck } from '@/api/api'
|
|
export default {
|
name: 'EquipmentTechnologyStatusModal',
|
data() {
|
return {
|
title: "操作",
|
visible: false,
|
codeDisable: true,
|
disableSubmit: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 19 },
|
},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
validatorRules: {
|
technologyStatus: {
|
rules: [
|
{ required: true, message: '请输入选择技术状态!' },
|
]
|
},
|
|
},
|
url: {
|
edit: "/eam/dailyMaintenanceOrder/editTechnologyStatus"
|
},
|
//新增、编辑、删除、批量删除操作改变数据后刷新关联的组件的监听属性
|
alterFlag: ""
|
}
|
},
|
created() {
|
},
|
methods: {
|
|
edit(record) {
|
this.form.resetFields();
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
this.disableSubmit = false;
|
this.$nextTick(() => {
|
this.form.setFieldsValue(pick(this.model, 'technologyStatusVerificationBill', 'equipmentNum', 'equipmentName', 'equipmentModel', 'specification', 'technologyStatus'))
|
});
|
if (record.id) {
|
this.codeDisable = true;
|
} else {
|
this.codeDisable = false;
|
}
|
},
|
|
close() {
|
this.$emit('close');
|
this.visible = false;
|
},
|
|
handleOk() {
|
const that = this;
|
// 触发表单验证
|
this.form.validateFields((err, values) => {
|
if (!err) {
|
that.confirmLoading = true;
|
let formData = Object.assign(this.model, values);
|
let obj;
|
if (!this.model.id) {
|
obj = postAction(this.url.add, formData);
|
} else {
|
obj = requestPut(this.url.edit, { id: this.model.equipmentId, technologyStatus: this.model.technologyStatus, maintenanceOrderId: this.model.id, technologyStatusVerificationBill: this.model.technologyStatusVerificationBill });
|
}
|
obj.then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.$emit('ok');
|
that.alterFlag = new Date();
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.close();
|
})
|
}
|
})
|
},
|
|
handleCancel() {
|
this.close()
|
},
|
},
|
}
|
</script>
|
|
<style scoped>
|
.ant-btn {
|
padding: 0 10px;
|
margin-left: 3px;
|
}
|
|
.ant-form-item-control {
|
line-height: 0px;
|
}
|
|
/** 主表单行间距 */
|
.ant-form .ant-form-item {
|
margin-bottom: 10px;
|
}
|
|
/** Tab页面行间距 */
|
.ant-tabs-content .ant-form-item {
|
margin-bottom: 0px;
|
}
|
</style>
|