|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<el-card style="margin: 5px;margin-top: -20px">
|
|
|
|
<el-form label-width="100px" :model="inputQuery" style="width: 80%; margin: auto;" ref="formRef" :rules="formRules">
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="20">
|
|
|
|
<el-form-item class="query-form-item" label="项目内容:" prop="content">
|
|
|
|
<el-input v-model="inputQuery.content" placeholder="请输入项目内容" style="width: 100%"
|
|
|
|
clearable></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="20">
|
|
|
|
<el-form-item class="query-form-item" label="备注:" prop="remark">
|
|
|
|
<el-input type="textarea" :rows="10" placeholder="请输入备注" v-model="inputQuery.remark"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
<div style="text-align: center;margin-top: 12px">
|
|
|
|
<el-button type="primary" size="small" icon="search" @click="onModifySubmit">提交</el-button>
|
|
|
|
<el-button type="primary" size="small" icon="search" @click="closeDialog">取消</el-button>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
import {addDeviceInspectPlanDelect,uploadDeviceInspectPlanDelect} from "@/api/dev/deviceInspectPlanDelect";
|
|
|
|
import {isBlank} from "@/utils/strUtil";
|
|
|
|
import {saveDeviceInspectPlan} from "@/api/dev/deviceInspectPlan";
|
|
|
|
import {addDeviceRepairOrderDetail, updateDeviceRepairOrderDetail} from "@/api/dev/deviceRepairOrderDetail";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
inputQuery: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
closeDialog: {
|
|
|
|
type: Function,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
name: "DeviceInspectPlanProjectSet",
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
formRules: {
|
|
|
|
content: [
|
|
|
|
{required: true, message: "项目内容不能为空", trigger: "blur"}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onModifySubmit() {
|
|
|
|
//报修接口
|
|
|
|
if(this.type == "repair"){
|
|
|
|
this.$refs["formRef"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
if (isBlank(this.inputQuery.id)) {
|
|
|
|
addDeviceRepairOrderDetail(this.inputQuery).then((res) => {
|
|
|
|
if (res.code == 20000) {
|
|
|
|
this.closeDialog();
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.message);
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
this.$message.error(error.message);
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
updateDeviceRepairOrderDetail(this.inputQuery).then((res) => {
|
|
|
|
if (res.code == 20000) {
|
|
|
|
this.closeDialog();
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.message);
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
this.$message.error(error.message);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
//巡检计划
|
|
|
|
this.$refs["formRef"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
if (isBlank(this.inputQuery.id)) {
|
|
|
|
addDeviceInspectPlanDelect(this.inputQuery).then((res) => {
|
|
|
|
if (res.code == 20000) {
|
|
|
|
this.closeDialog();
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.message);
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
this.$message.error(error.message);
|
|
|
|
})
|
|
|
|
}else{
|
|
|
|
uploadDeviceInspectPlanDelect(this.inputQuery).then((res) => {
|
|
|
|
if (res.code == 20000) {
|
|
|
|
this.closeDialog();
|
|
|
|
} else {
|
|
|
|
this.$message.error(res.message);
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
this.$message.error(error.message);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|