You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
204 lines
6.7 KiB
Vue
204 lines
6.7 KiB
Vue
2 years ago
|
<template>
|
||
|
<el-dialog
|
||
|
class="addPhotoDialog"
|
||
|
:title="photoDialogTitle"
|
||
|
:visible.sync="photoDialog"
|
||
|
width="654px"
|
||
|
>
|
||
|
<el-form
|
||
|
label-position="left"
|
||
|
label-width="92px"
|
||
|
ref="formPhotoInfo"
|
||
|
:rules="rules"
|
||
|
:model="formInfo"
|
||
|
>
|
||
|
<el-form-item label="出厂编号" prop="bsIdentifier" required>
|
||
|
<el-input v-model="formInfo.bsIdentifier"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="生产厂家" prop="bsManufacturer" required>
|
||
|
<el-input v-model="formInfo.bsManufacturer"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="生产日期" prop="bsProductionDate" required>
|
||
|
<el-input v-model="formInfo.bsProductionDate"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label=" 图像监测装置 ID" prop="cmdid" required>
|
||
|
<el-input v-model="formInfo.cmdid"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="显示名" prop="displayName" required>
|
||
|
<el-input v-model="formInfo.displayName"></el-input>
|
||
|
</el-form-item>
|
||
|
|
||
|
<el-form-item label="装置名称" prop="equipName" required>
|
||
|
<el-input v-model="formInfo.equipName"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item
|
||
|
label="装置基本信息版本号"
|
||
|
prop="essentialInfoVersion"
|
||
|
required
|
||
|
>
|
||
|
<el-input v-model="formInfo.essentialInfoVersion"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="是否带云台" prop="hasPan" required>
|
||
|
<el-input v-model="formInfo.hasPan"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="纬度" prop="latitude" required>
|
||
|
<el-input v-model.number="formInfo.latitude"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="线路编号" prop="lineid" required>
|
||
|
<el-input v-model="formInfo.lineid"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="经度" prop="longitude" required>
|
||
|
<el-input v-model.number="formInfo.longitude"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="装置型号" prop="model" required>
|
||
|
<el-input v-model="formInfo.model"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="原始 ID" prop="orgId" required>
|
||
|
<el-input v-model="formInfo.orgId"></el-input>
|
||
|
</el-form-item>
|
||
|
<el-form-item label="杆塔编号" prop="towerid" required>
|
||
|
<el-input v-model="formInfo.towerid"></el-input>
|
||
|
</el-form-item>
|
||
|
</el-form>
|
||
|
<div slot="footer" class="dialog-footer">
|
||
|
<el-button @click="closeDialog(0)">取 消</el-button>
|
||
|
<el-button type="primary" @click="submitForm()">确 定</el-button>
|
||
|
</div>
|
||
|
</el-dialog>
|
||
|
</template>
|
||
|
<script>
|
||
|
import { addTerminalJoggle, updateTerminalJoggle } from "@/utils/api/index";
|
||
|
export default {
|
||
|
props: {
|
||
|
photoDialog: {
|
||
|
type: Boolean,
|
||
|
},
|
||
|
photoDialogTitle: {
|
||
|
type: String,
|
||
|
default: "新增",
|
||
|
},
|
||
|
formItem: {
|
||
|
type: Object,
|
||
|
default: function () {
|
||
|
return {};
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
|
||
|
data() {
|
||
|
return {
|
||
|
formInfo: {},
|
||
|
rules: {},
|
||
|
//表单数组,对象
|
||
|
formArr: [],
|
||
|
};
|
||
|
},
|
||
|
methods: {
|
||
|
// 保存确定操作
|
||
|
submitForm() {
|
||
|
this.$refs.formPhotoInfo.validate((valid) => {
|
||
|
if (valid) {
|
||
|
let formObj = {
|
||
|
bsIdentifier: this.formInfo.bsIdentifier,
|
||
|
bsManufacturer: this.formInfo.bsManufacturer,
|
||
|
bsProductionDate: this.formInfo.bsProductionDate,
|
||
|
cmdid: this.formInfo.cmdid,
|
||
|
displayName: this.formInfo.displayName,
|
||
|
equipName: this.formInfo.equipName,
|
||
|
essentialInfoVersion: this.formInfo.essentialInfoVersion,
|
||
|
hasPan: this.formInfo.hasPan,
|
||
|
latitude: this.formInfo.latitude,
|
||
|
lineid: this.formInfo.lineid,
|
||
|
longitude: this.formInfo.longitude,
|
||
|
model: this.formInfo.model,
|
||
|
orgId: this.formInfo.orgId,
|
||
|
towerid: this.formInfo.towerid,
|
||
|
};
|
||
|
this.formArr.push(formObj);
|
||
|
console.log(this.formArr);
|
||
|
|
||
|
// 走保存请求
|
||
|
if (this.photoDialogTitle == "新增") {
|
||
|
addTerminalJoggle({ list: this.formArr })
|
||
|
.then((res) => {
|
||
|
console.log(res);
|
||
|
this.$emit("photoDialogClose", 1); //关闭弹窗
|
||
|
this.$message.success("添加成功");
|
||
|
this.$refs.formPhotoInfo.resetFields();
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
console.log(err); //代码错误、请求失败捕获
|
||
|
this.$message.error("添加失败");
|
||
|
});
|
||
|
} else if (this.photoDialogTitle == "修改") {
|
||
|
let changeformObj = {
|
||
|
bsIdentifier: this.formInfo.bsIdentifier,
|
||
|
bsManufacturer: this.formInfo.bsManufacturer,
|
||
|
bsProductionDate: this.formInfo.bsProductionDate,
|
||
|
cmdid: this.formInfo.cmdid,
|
||
|
displayName: this.formInfo.displayName,
|
||
|
equipName: this.formInfo.equipName,
|
||
|
essentialInfoVersion: this.formInfo.essentialInfoVersion,
|
||
|
hasPan: this.formInfo.hasPan,
|
||
|
latitude: this.formInfo.latitude,
|
||
|
lineid: this.formInfo.lineid,
|
||
|
longitude: this.formInfo.longitude,
|
||
|
model: this.formInfo.model,
|
||
|
orgId: this.formInfo.orgId,
|
||
|
towerid: this.formInfo.towerid,
|
||
|
id: this.formInfo.id,
|
||
|
};
|
||
|
updateTerminalJoggle(changeformObj)
|
||
|
.then((res) => {
|
||
|
console.log(res);
|
||
|
this.$emit("photoDialogClose", 1); //关闭弹窗
|
||
|
this.$message.success("修改成功");
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
console.log(err); //代码错误、请求失败捕获
|
||
|
this.$message.error("修改失败");
|
||
|
});
|
||
|
}
|
||
|
} else {
|
||
|
console.log("error submit!!");
|
||
|
return false;
|
||
|
}
|
||
|
});
|
||
|
},
|
||
|
//取消关闭弹窗
|
||
|
closeDialog(flag) {
|
||
|
this.$refs.formPhotoInfo.resetFields();
|
||
|
this.$emit("photoDialogClose", flag);
|
||
|
},
|
||
|
},
|
||
|
mounted() {
|
||
|
console.log("打印传过来的对象", this.formItem);
|
||
|
console.log("打印传过来的对象", this.formItem.bsIdentifier);
|
||
|
this.formInfo = JSON.parse(JSON.stringify(this.formItem));
|
||
|
},
|
||
|
watch: {
|
||
|
formItem: {
|
||
|
handler(newVal, oldVal) {
|
||
|
// 调用函数
|
||
|
this.$nextTick(() => {
|
||
|
this.formInfo = JSON.parse(JSON.stringify(this.formItem));
|
||
|
});
|
||
|
},
|
||
|
immediate: true,
|
||
|
deep: true,
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
<style lang="less">
|
||
|
.addPhotoDialog {
|
||
|
.el-dialog {
|
||
|
.el-form {
|
||
|
display: flex;
|
||
|
flex-wrap: wrap;
|
||
|
justify-content: space-between;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|