Commit 5ef0a2b9 authored by 纪泽龙's avatar 纪泽龙

合并jzl

parent 54bfdc33
......@@ -3,36 +3,74 @@
:title="title"
:visible.sync="dialogVisible"
width="80%"
:before-close="handleClose">
:before-close="handleClose"
>
<el-row>
<el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-col :span="22">
<el-form-item label="所属管道" prop="pipeCode">
<el-select v-model="form.pipeCode" placeholder="请选择所属管道">
<el-option
v-for="item in pipeList"
:key="item.pipeCode"
:label="item.pipeName"
:value="item.pipeCode">
:value="item.pipeCode"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="所在地址" prop="deviceAddr">
<el-input v-model="form.deviceAddr" placeholder="请输入所在地址" />
</el-form-item>
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
</el-col>
<el-col :span="11">
<el-form-item label="物联网编号" prop="iotNo">
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item>
<el-form-item label="经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入经度" />
</el-col>
<el-col :span="22">
<el-form-item label="经纬度坐标" prop="">
<el-card class="box-card">
<div v-text="`[[${form.longitude},${form.latitude}]]`"></div>
</el-card>
</el-form-item>
</el-col>
<!-- <el-col>
<el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item>
<el-form-item label="物联网编号" prop="iotNo">
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-col> -->
<el-col :span="11">
<el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="设备图片上传" prop="iconUrl">
<MyFileUpload
listType="picture-card"
......@@ -40,25 +78,36 @@
@remove="listRemove"
:fileArr="fileArr"
/>
<el-input v-show="false" disabled v-model="form.iconUrl"></el-input>
</el-form-item>
<el-form-item label="联系人" prop="linkman">
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="安装时间" prop="installationTime">
<el-date-picker clearable size="small"
<el-date-picker
clearable
size="small"
v-model="form.installationTime"
type="datetime"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择安装时间">
placeholder="选择安装时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="22">
<el-form-item label="备注" prop="remarks">
<el-input v-model="form.remarks" placeholder="请输入备注" />
<el-input
type="textarea"
v-model="form.remarks"
placeholder="请输入备注"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
......@@ -67,67 +116,103 @@
</template>
<script>
import {
getAllDeviceInfo,
addDeviceInfo,
updateDeviceInfo,
} from "@/api/device/deviceInfo";
import { pipeAllInfoList } from "@/api/device/pipe";
import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js";
import { getAllDeviceInfo ,addDeviceInfo, updateDeviceInfo } from "@/api/device/deviceInfo";
import { pipeAllInfoList } from "@/api/device/pipe";
import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js";
export default {
export default {
props: {
title: { type: String }
title: { type: String },
},
data () {
data() {
return {
form : {
deviceType : "3"
form: {
deviceType: "3",
},
dialogVisible : false,
dialogVisible: false,
fileList: [],
// 表单校验
rules: {},
map: null,
obj: null,
gaoMap: null,
fileArr: [],
pipeList: [],
rules: {
pipeCode: [
{ required: true, message: "请选择所属管道", trigger: "blur" },
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
],
deviceName: [
{ required: true, message: "请输入设备名称", trigger: "blur" },
],
deviceModel: [
{ required: true, message: "请输入设备型号", trigger: "blur" },
],
deviceAddr: [
{ required: true, message: "请输入所在地址", trigger: "blur" },
],
iotNo: [
{ required: true, message: "请输入物联网编号", trigger: "blur" },
],
linkman: [
{ required: true, message: "请输入联系人", trigger: "blur" },
],
phone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
],
iconUrl: [{ required: true, message: "请上传图片", trigger: "change" }],
installationTime: [
{
// type: "date",
required: true,
message: "请选择日期",
trigger: "change",
},
map : null,
obj : null,
gaoMap : null,
fileArr: [],
pipeList: []
}
],
},
};
},
components: {
MyFileUpload,
},
methods: {
show () {
show() {
this.dialogVisible = true;
},
hide () {
this.remove()
hide() {
this.remove();
},
getFileInfo(res){
getFileInfo(res) {
this.form.iconUrl = res.url;
},
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => {
updateDeviceInfo(this.form).then((response) => {
this.dialogVisible = false;
this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.addMarker(this.gaoMap.deviceType, this.form);
this.msgSuccess("修改成功");
});
} else {
addDeviceInfo(this.form).then(response => {
if(response.code == 200){
addDeviceInfo(this.form).then((response) => {
if (response.code == 200) {
this.remove();
this.map.remove(this.obj);
this.form.deviceId = response.data;
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form);
this.gaoMap.addMarker(this.gaoMap.deviceType, this.form);
this.gaoMap.placeSearch.clear();
this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功");
}else{
} else {
this.msgSuccess("新增失败");
}
});
......@@ -141,14 +226,14 @@
listRemove(e) {
this.form.url = "";
this.fileArr = [];
}
},
mounted(){
pipeAllInfoList({}).then(response => {
},
mounted() {
pipeAllInfoList({}).then((response) => {
this.pipeList = response.data;
});
}
}
},
};
</script>
......@@ -685,13 +685,21 @@ class gaodeMap {
that.markerOverlays.push(e.obj);
}
if (e.obj && e.obj.getExtData().type == "newLine") {
console.log("挂上事件");
that.newLineAddEvent(e.obj);
// 记录这条线
// console.log(e.obj.getPath().length)
// 如果只有一个点,并没有连成线的时候就不close 大于一个点的时候才执行clse
console.log(that.lineType)
if (e.obj.getPath().length > 1) {
that.newLineObj = e.obj;
// 关闭
that.mouseTool.close();
} else {
// that.newLineObj = null;
}
// 关闭
// 创建一条新线,然后在点地图的时候删除原来的旧线
// that.createNewLine();
......
......@@ -270,6 +270,7 @@ export default {
this.gaoMap.lineType = 1;
} else {
this.gaoMap.lineType = 0;
this.gaoMap.mouseTool.close();
}
// 关闭当前线条的infowindow
this.gaoMap.closeLineInfoWindow();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment