<template>
|
<div class="warningEdit height overflow">
|
<div class="centent-form overflowy-auto">
|
<el-form
|
class="margin-auto width90"
|
ref="registerForm"
|
:model="registerForm"
|
size="mini"
|
label-position="left"
|
label-width="120px"
|
>
|
<el-form-item label="故障编号:" prop="alertCode">
|
<el-input disabled v-model="registerForm.alertCode" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="故障设备:" prop="placeType">
|
<!-- <el-input v-model="registerForm.deviceName" clearable></el-input> -->
|
<el-select size="mini" clearable v-model="registerForm.deviceName" placeholder="请选择">
|
<el-option
|
v-for="(item, index) in deviceNameList"
|
:key="'deviceName' + index"
|
:label="item.deviceName"
|
:value="item.deviceName"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="故障名称:" prop="isFull">
|
<el-input v-model="registerForm.alertName" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="故障描述:" prop="isFull">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 2, maxRows: 6 }"
|
v-model="registerForm.alertDes"
|
clearable
|
></el-input>
|
</el-form-item>
|
<!-- <el-form-item label="锁定:" prop="isLock">
|
<el-input v-model="registerForm.isLock" clearable></el-input>
|
</el-form-item> -->
|
</el-form>
|
</div>
|
<div class="palteEdit-button text-right margin-right15 margin-top2">
|
<el-button type="primary" size="mini" class="form-buttom" @click="submitForm('registerForm')">提交</el-button>
|
<el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { CarAddOrUpdate, AlertGetCode } from '@/api/warning';
|
import { DeviceSearch } from '@/api/stacker';
|
export default {
|
data() {
|
return {
|
registerForm: {
|
alertCode: ''
|
},
|
deviceNameList: []
|
};
|
},
|
props: {
|
rowitem: {
|
type: Object,
|
default: {}
|
}
|
},
|
mounted() {
|
if (JSON.stringify(this.rowitem) != '{}') {
|
this.registerForm = this.rowitem;
|
} else {
|
this.AlertGetCode();
|
}
|
this.DeviceSearch();
|
},
|
methods: {
|
//获取编号
|
AlertGetCode() {
|
AlertGetCode().then(res => {
|
this.registerForm.alertCode = res;
|
});
|
},
|
//获取设备
|
DeviceSearch() {
|
DeviceSearch('1&onePageNum=999').then(res => {
|
if (res.code == 0) {
|
this.deviceNameList = res.data || [];
|
}
|
});
|
},
|
submitForm(registerForm) {
|
this.$refs[registerForm].validate(valid => {
|
if (valid) {
|
CarAddOrUpdate(this.registerForm).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
});
|
this.$emit('addsubmit');
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '提交失败'
|
});
|
}
|
});
|
} else {
|
}
|
});
|
}
|
},
|
watch: {}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.warningEdit {
|
width: 98%;
|
padding: 1%;
|
.show-pwd {
|
position: absolute;
|
right: 10px;
|
top: 3px;
|
font-size: 16px;
|
color: #889aa4;
|
cursor: pointer;
|
user-select: none;
|
}
|
.centent-form {
|
height: 92%;
|
width: 100%;
|
margin: auto;
|
}
|
.warningEdit-button {
|
}
|
::v-deep .el-form-item__content {
|
width: 60%;
|
}
|
::v-deep .el-select {
|
width: 100%;
|
}
|
}
|
</style>
|