diff --git a/public/index.html b/public/index.html index 925455c..7eec9d4 100644 --- a/public/index.html +++ b/public/index.html @@ -1,14 +1,21 @@ - - - - - - - <%= webpackConfig.name %> - - - - -
-
-
-
-
-
正在加载系统资源,请耐心等待
-
-
- + + + +
+
+
+
+
+
正在加载系统资源,请耐心等待
+
+
+ + diff --git a/src/assets/images/location.png b/src/assets/images/location.png new file mode 100644 index 0000000..0c50528 Binary files /dev/null and b/src/assets/images/location.png differ diff --git a/src/plugins/modal.js b/src/plugins/modal.js index 92bc1ef..506609d 100644 --- a/src/plugins/modal.js +++ b/src/plugins/modal.js @@ -3,81 +3,84 @@ import { Message, MessageBox, Notification, Loading } from 'element-ui' let loadingInstance export default { - // 消息提示 - msg(content) { - Message.info(content) - }, - // 错误消息 - msgError(content) { - Message.error(content) - }, - // 成功消息 - msgSuccess(content) { - Message.success(content) - }, - // 警告消息 - msgWarning(content) { - Message.warning(content) - }, - // 弹出提示 - alert(content) { - MessageBox.alert(content, "系统提示") - }, - // 错误提示 - alertError(content) { - MessageBox.alert(content, "系统提示", { type: 'error' }) - }, - // 成功提示 - alertSuccess(content) { - MessageBox.alert(content, "系统提示", { type: 'success' }) - }, - // 警告提示 - alertWarning(content) { - MessageBox.alert(content, "系统提示", { type: 'warning' }) - }, - // 通知提示 - notify(content) { - Notification.info(content) - }, - // 错误通知 - notifyError(content) { - Notification.error(content) - }, - // 成功通知 - notifySuccess(content) { - Notification.success(content) - }, - // 警告通知 - notifyWarning(content) { - Notification.warning(content) - }, - // 确认窗体 - confirm(content) { - return MessageBox.confirm(content, "系统提示", { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: "warning", - }) - }, - // 提交内容 - prompt(content) { - return MessageBox.prompt(content, "系统提示", { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: "warning", - }) - }, - // 打开遮罩层 - loading(content) { - loadingInstance = Loading.service({ - lock: true, - text: content, - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }) - }, - // 关闭遮罩层 - closeLoading() { - loadingInstance.close() - } + // 消息提示 + msg(content) { + Message.info(content) + }, + // 错误消息 + msgError(content) { + Message.closeAll() + Message.error(content) + }, + // 成功消息 + msgSuccess(content) { + Message.closeAll() + Message.success(content) + }, + // 警告消息 + msgWarning(content) { + Message.closeAll() + Message.warning(content) + }, + // 弹出提示 + alert(content) { + MessageBox.alert(content, '系统提示') + }, + // 错误提示 + alertError(content) { + MessageBox.alert(content, '系统提示', { type: 'error' }) + }, + // 成功提示 + alertSuccess(content) { + MessageBox.alert(content, '系统提示', { type: 'success' }) + }, + // 警告提示 + alertWarning(content) { + MessageBox.alert(content, '系统提示', { type: 'warning' }) + }, + // 通知提示 + notify(content) { + Notification.info(content) + }, + // 错误通知 + notifyError(content) { + Notification.error(content) + }, + // 成功通知 + notifySuccess(content) { + Notification.success(content) + }, + // 警告通知 + notifyWarning(content) { + Notification.warning(content) + }, + // 确认窗体 + confirm(content) { + return MessageBox.confirm(content, '系统提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + }, + // 提交内容 + prompt(content) { + return MessageBox.prompt(content, '系统提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + }, + // 打开遮罩层 + loading(content) { + loadingInstance = Loading.service({ + lock: true, + text: content, + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)', + }) + }, + // 关闭遮罩层 + closeLoading() { + loadingInstance.close() + }, } diff --git a/src/views/basic/level-manage/index.vue b/src/views/basic/level-manage/index.vue index f180aa5..8305d0f 100644 --- a/src/views/basic/level-manage/index.vue +++ b/src/views/basic/level-manage/index.vue @@ -75,7 +75,7 @@ /> - + diff --git a/src/views/basic/model-manage/addOrEditForm.vue b/src/views/basic/model-manage/addOrEditForm.vue index 828ded9..482091d 100644 --- a/src/views/basic/model-manage/addOrEditForm.vue +++ b/src/views/basic/model-manage/addOrEditForm.vue @@ -3,10 +3,10 @@
- + - + @@ -30,25 +30,12 @@ export default { projectId: '', level: '', nodeCount: '', - proName: '', parentId: '', //父级节点id }, addOrEditFormRules: { deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' }], - proName: [{ required: true, message: '请输入设备编码', trigger: 'blur' }], - Keeper: [{ required: true, message: '请选择设备保管人', trigger: 'change' }], + proName: [{ required: true, message: '请输入分类名称', trigger: 'blur' }], }, - - KeeperList: [ - { - id: '张三', - name: '张三', - }, - { - id: '李四', - name: '李四', - }, - ], } }, methods: { @@ -78,12 +65,12 @@ export default { }, setFormData(data) { - const { deviceName, id, level, nodeCount, projectId } = data + const { deviceName, level, nodeCount, projectId, id } = data this.addOrEditForm = { deviceName, projectId, parentId: id, - level: parseInt(level) + 1, + level: level, nodeCount, } }, diff --git a/src/views/basic/model-manage/index.vue b/src/views/basic/model-manage/index.vue index 24768d5..fc43835 100644 --- a/src/views/basic/model-manage/index.vue +++ b/src/views/basic/model-manage/index.vue @@ -9,7 +9,12 @@ @keyup.enter.native="handleQuery" /> --> - + @@ -35,44 +40,36 @@ - + + - + - - + - - - - - + + + @@ -600,4 +856,8 @@ export default { color: #409eff; background-color: #f0f7ff; } + +#map-container { + min-height: 76vh; +} diff --git a/src/views/basic/model-manage/useOrReturnForm.vue b/src/views/basic/model-manage/useOrReturnForm.vue index 3490da5..21cfb77 100644 --- a/src/views/basic/model-manage/useOrReturnForm.vue +++ b/src/views/basic/model-manage/useOrReturnForm.vue @@ -1,218 +1,226 @@ \ No newline at end of file + diff --git a/src/views/basic/model-manage/useOrReturnFormNew.vue b/src/views/basic/model-manage/useOrReturnFormNew.vue new file mode 100644 index 0000000..f6fec02 --- /dev/null +++ b/src/views/basic/model-manage/useOrReturnFormNew.vue @@ -0,0 +1,662 @@ + + + + + diff --git a/src/views/basic/project/index.vue b/src/views/basic/project/index.vue index b49ef85..5414530 100644 --- a/src/views/basic/project/index.vue +++ b/src/views/basic/project/index.vue @@ -57,7 +57,7 @@ - + @@ -94,8 +94,8 @@ /> - - + + @@ -109,6 +109,35 @@ /> + + + + + + +
+ + 选择地址 +
+
+ + + + + + + + + + + + + + + @@ -126,9 +155,19 @@ :fullscreen="false" :visible.sync="mapVisible" :close-on-click-modal="false" - style="margin-top: 8.5vh" + @close="handleMapClose" + width="80%" > -
+
+ + 搜索 +
+
+ +
+ 确定 +
+
@@ -237,19 +276,28 @@ export default { }, // 表单参数 form: { - longitude: '', - latitude: '', - location: '', - remark: '', - level: '', + proName: '', // 项目名称 + level: '', // 层级配置 + chargePerson: '', // 负责人 + location: '', // 项目所在地 + longitude: '', // 经度 + latitude: '', // 纬度 + remark: '', // 备注 }, // 表单校验 - rules: { + addOrEditRules: { proName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }], level: [{ required: true, message: '请选择层级配置', trigger: 'change' }], + chargePerson: [{ required: true, message: '请输入负责人', trigger: 'blur' }], + location: [{ required: true, message: '请选择项目所在地', trigger: 'blur' }], + longitude: [{ required: true, message: '请选择项目所在地', trigger: 'blur' }], + latitude: [{ required: true, message: '请选择项目所在地', trigger: 'blur' }], }, levelList: [], + + searchAddress: '', + marker: null, } }, created() { @@ -281,14 +329,13 @@ export default { // 表单重置 reset() { this.form = { - proId: undefined, - proName: undefined, - proType: undefined, - unit: undefined, - chargePerson: undefined, - location: undefined, - remark: undefined, - level: undefined, + proName: '', // 项目名称 + level: '', // 层级配置 + chargePerson: '', // 负责人 + location: '', // 项目所在地 + longitude: '', // 经度 + latitude: '', // 纬度 + remark: '', // 备注 } this.resetForm('form') }, @@ -309,8 +356,54 @@ export default { this.title = '新增项目' }, /** 地图选点操作 */ - mapAdd() { - this.mapVisible = true + handleMapAdd() { + const this_ = this + this_.mapVisible = true + this.$nextTick(() => { + this_.map = new BMapGL.Map('map-container') // 创建地图实例 + let point = new BMapGL.Point(117.13805, 31.8734) // 创建点坐标 + // let point = new BMapGL.Point(116.404, 39.915) // 创建点坐标 + this_.map.centerAndZoom(point, 12) // 初始化地图,设置中心点坐标和地图级别 + this_.map.enableScrollWheelZoom(true) // 启用滚轮放大缩小 + this_.map.setHeading(64.5) //设置地图旋转角度 + this_.map.setTilt(73) //设置地图的倾斜角度 + + var geoc = new BMapGL.Geocoder() + + this_.map.addEventListener('click', function (e) { + var pt = e.latlng + geoc.getLocation(pt, function (res) { + var addComp = res.addressComponents + this_.form.location = `${addComp.province}${addComp.city}${addComp.district}${addComp.street}${addComp.streetNumber}` + this_.form.longitude = e.latlng.lng + this_.form.latitude = e.latlng.lat + }) + this_.map.clearOverlays() + const points = new BMapGL.Point(e.latlng.lng, e.latlng.lat) + // let marker = new BMapGL.Marker(point) // 创建标点 + // this_.map.addOverlay(marker) + + if (this_.marker) { + this_.map.removeOverlay(this_.marker) + } + + // 创建新标记 + this_.marker = new BMapGL.Marker(points) + this_.map.addOverlay(this_.marker) + + // 设置地图中心点 + this_.map.centerAndZoom(points, 16) + + // 可以添加信息窗口 + const infoWindow = new BMapGL.InfoWindow(this_.form.location) + this_.marker.addEventListener('click', () => { + this_.map.openInfoWindow(infoWindow, points) + }) + + // 自动打开信息窗口 + this_.map.openInfoWindow(infoWindow, points) + }) + }) }, /** 修改按钮操作 */ handleUpdate(row) { @@ -396,10 +489,10 @@ export default { //返回选中点的位置 findLocation() { this.mapVisible = false - this.$emit('findlocdata', this.form) - this.temp.location = this.keyword - this.temp.lng = this.form.longitude - this.temp.lat = this.form.latitude + // this.$emit('findlocdata', this.form) + // this.temp.location = this.keyword + // this.temp.lng = this.form.longitude + // this.temp.lat = this.form.latitude }, /** 删除按钮操作 */ handleDelete(row) { @@ -425,6 +518,61 @@ export default { `项目信息表.xlsx`, ) }, + + // 根据地址定位 并获取经纬度 + handleSearch() { + console.log(this.searchAddress, '搜索地址') + + const geoc = new BMapGL.Geocoder() + + geoc.getPoint( + this.searchAddress, + (point) => { + if (point) { + // 清除旧标记 + if (this.marker) { + this.map.removeOverlay(this.marker) + } + + // 创建新标记 + this.marker = new BMapGL.Marker(point) + this.map.addOverlay(this.marker) + + // 设置地图中心点 + this.map.centerAndZoom(point, 16) + + // 可以添加信息窗口 + const infoWindow = new BMapGL.InfoWindow(this.searchAddress) + this.marker.addEventListener('click', () => { + this.map.openInfoWindow(infoWindow, point) + }) + + // 自动打开信息窗口 + this.map.openInfoWindow(infoWindow, point) + + console.log('坐标点:', point) + } else { + this.$message.error('未找到该地址对应的位置') + } + }, + '全国', + ) // '全国'是可选的城市参数 + }, + + // 关闭地图选点 + handleMapClose() { + this.mapVisible = false + if (this.marker) { + this.map.removeOverlay(this.marker) + } + // 清除地图 + if (this.map) { + this.map.removeAllOverlays() + this.map.removeAllListeners() + this.map.clear() + this.map = null + } + }, }, } diff --git a/src/views/basic/survey/index.vue b/src/views/basic/survey/index.vue index b8bec96..3c0d839 100644 --- a/src/views/basic/survey/index.vue +++ b/src/views/basic/survey/index.vue @@ -1,284 +1,438 @@ diff --git a/src/views/index.vue b/src/views/index.vue index 1ab56f7..507fe15 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,84 +1,111 @@