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

合并jzl

parent 54bfdc33
...@@ -3,36 +3,74 @@ ...@@ -3,36 +3,74 @@
:title="title" :title="title"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="80%" width="80%"
:before-close="handleClose"> :before-close="handleClose"
>
<el-row>
<el-form ref="form" :model="form" :rules="rules" label-width="135px"> <el-form ref="form" :model="form" :rules="rules" label-width="135px">
<el-col :span="22">
<el-form-item label="所属管道" prop="pipeCode"> <el-form-item label="所属管道" prop="pipeCode">
<el-select v-model="form.pipeCode" placeholder="请选择所属管道"> <el-select v-model="form.pipeCode" placeholder="请选择所属管道">
<el-option <el-option
v-for="item in pipeList" v-for="item in pipeList"
:key="item.pipeCode" :key="item.pipeCode"
:label="item.pipeName" :label="item.pipeName"
:value="item.pipeCode"> :value="item.pipeCode"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" /> <el-input v-model="form.deviceName" placeholder="请输入设备名称" />
</el-form-item> </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-form-item label="所在地址" prop="deviceAddr">
<el-input v-model="form.deviceAddr" placeholder="请输入所在地址" /> <el-input v-model="form.deviceAddr" placeholder="请输入所在地址" />
</el-form-item> </el-form-item>
<el-form-item label="设备型号" prop="deviceModel"> </el-col>
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
<el-col :span="11">
<el-form-item label="物联网编号" prop="iotNo">
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
</el-form-item> </el-form-item>
<el-form-item label="经度" prop="longitude"> </el-col>
<el-input v-model="form.longitude" placeholder="请输入经度" />
<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-form-item>
</el-col>
<!-- <el-col>
<el-form-item label="纬度" prop="latitude"> <el-form-item label="纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入纬度" /> <el-input v-model="form.latitude" placeholder="请输入纬度" />
</el-form-item> </el-form-item>
<el-form-item label="物联网编号" prop="iotNo"> </el-col> -->
<el-input v-model="form.iotNo" placeholder="请输入物联网编号" />
<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-form-item>
</el-col>
<el-col>
<el-form-item label="设备图片上传" prop="iconUrl"> <el-form-item label="设备图片上传" prop="iconUrl">
<MyFileUpload <MyFileUpload
listType="picture-card" listType="picture-card"
...@@ -40,25 +78,36 @@ ...@@ -40,25 +78,36 @@
@remove="listRemove" @remove="listRemove"
:fileArr="fileArr" :fileArr="fileArr"
/> />
<el-input v-show="false" disabled v-model="form.iconUrl"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="linkman"> </el-col>
<el-input v-model="form.linkman" placeholder="请输入联系人" />
</el-form-item> <el-col>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item>
<el-form-item label="安装时间" prop="installationTime"> <el-form-item label="安装时间" prop="installationTime">
<el-date-picker clearable size="small" <el-date-picker
clearable
size="small"
v-model="form.installationTime" v-model="form.installationTime"
type="datetime" type="date"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择安装时间"> placeholder="选择安装时间"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="22">
<el-form-item label="备注" prop="remarks"> <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-form-item>
</el-col>
</el-form> </el-form>
</el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button> <el-button type="primary" @click="submitForm">确 定</el-button>
...@@ -67,67 +116,103 @@ ...@@ -67,67 +116,103 @@
</template> </template>
<script> <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"; export default {
import { pipeAllInfoList } from "@/api/device/pipe";
import MyFileUpload from "@/components/MyFileUpload";
import { DEVICE_TYPE } from "utils/gaodeMap.js";
export default {
props: { props: {
title: { type: String } title: { type: String },
}, },
data () { data() {
return { return {
form : { form: {
deviceType : "3" deviceType: "3",
}, },
dialogVisible : false, dialogVisible: false,
fileList: [], fileList: [],
// 表单校验 // 表单校验
rules: {},
map: null,
obj: null,
gaoMap: null,
fileArr: [],
pipeList: [],
rules: { 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: { components: {
MyFileUpload, MyFileUpload,
}, },
methods: { methods: {
show () { show() {
this.dialogVisible = true; this.dialogVisible = true;
}, },
hide () { hide() {
this.remove() this.remove();
}, },
getFileInfo(res){ getFileInfo(res) {
this.form.iconUrl = res.url; this.form.iconUrl = res.url;
}, },
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.deviceId != null) { if (this.form.deviceId != null) {
updateDeviceInfo(this.form).then(response => { updateDeviceInfo(this.form).then((response) => {
this.dialogVisible = false; this.dialogVisible = false;
this.map.remove(this.obj); this.map.remove(this.obj);
this.gaoMap.addMarker(this.gaoMap.deviceType,this.form); this.gaoMap.addMarker(this.gaoMap.deviceType, this.form);
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
}); });
} else { } else {
addDeviceInfo(this.form).then(response => { addDeviceInfo(this.form).then((response) => {
if(response.code == 200){ if (response.code == 200) {
this.remove(); this.remove();
this.map.remove(this.obj); this.map.remove(this.obj);
this.form.deviceId = response.data; 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.placeSearch.clear();
this.gaoMap.closeAddMarker(); this.gaoMap.closeAddMarker();
this.msgSuccess("新增成功"); this.msgSuccess("新增成功");
}else{ } else {
this.msgSuccess("新增失败"); this.msgSuccess("新增失败");
} }
}); });
...@@ -141,14 +226,14 @@ ...@@ -141,14 +226,14 @@
listRemove(e) { listRemove(e) {
this.form.url = ""; this.form.url = "";
this.fileArr = []; this.fileArr = [];
}
}, },
mounted(){ },
pipeAllInfoList({}).then(response => { mounted() {
pipeAllInfoList({}).then((response) => {
this.pipeList = response.data; this.pipeList = response.data;
}); });
} },
} };
</script> </script>
...@@ -685,13 +685,21 @@ class gaodeMap { ...@@ -685,13 +685,21 @@ class gaodeMap {
that.markerOverlays.push(e.obj); that.markerOverlays.push(e.obj);
} }
if (e.obj && e.obj.getExtData().type == "newLine") { if (e.obj && e.obj.getExtData().type == "newLine") {
console.log("挂上事件"); console.log("挂上事件");
that.newLineAddEvent(e.obj); 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.newLineObj = e.obj;
// 关闭
that.mouseTool.close(); that.mouseTool.close();
} else {
// that.newLineObj = null;
}
// 关闭
// 创建一条新线,然后在点地图的时候删除原来的旧线 // 创建一条新线,然后在点地图的时候删除原来的旧线
// that.createNewLine(); // that.createNewLine();
......
...@@ -270,6 +270,7 @@ export default { ...@@ -270,6 +270,7 @@ export default {
this.gaoMap.lineType = 1; this.gaoMap.lineType = 1;
} else { } else {
this.gaoMap.lineType = 0; this.gaoMap.lineType = 0;
this.gaoMap.mouseTool.close();
} }
// 关闭当前线条的infowindow // 关闭当前线条的infowindow
this.gaoMap.closeLineInfoWindow(); 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