|
@@ -3,31 +3,31 @@
|
|
|
<div class="draw-edit" v-if="cusTransfer.draw.center">
|
|
|
<div class="draw-edit-content">
|
|
|
周边范围:
|
|
|
- <div class="radius-min __hover" @click="cusTransfer.draw.radius > 1 ? (cusTransfer.draw.radius--, setCircle()) : undefined">-</div>
|
|
|
+ <div class="radius-min __hover" @click="cusTransfer.draw.radius > 1 ? (cusTransfer.draw.radius--, handleRangeInput(cusTransfer.draw.radius)) : undefined">-</div>
|
|
|
<CusFormColumn
|
|
|
link="number"
|
|
|
label=""
|
|
|
- :min="1"
|
|
|
:clearable="false"
|
|
|
v-model:param="cusTransfer.draw.radius"
|
|
|
- @blur="handleRangeBlur"/>
|
|
|
- <div class="radius-max __hover" @click="cusTransfer.draw.radius++, setCircle()">+</div>
|
|
|
+ @input="handleRangeInput"/>
|
|
|
+ <div class="radius-max __hover" @click="cusTransfer.draw.radius < 60 ? (cusTransfer.draw.radius++, handleRangeInput(cusTransfer.draw.radius)) : undefined">+</div>
|
|
|
+ <div class="tips" v-if="cusTransfer.draw.radiusTips">请输入1~60的正整数!</div>
|
|
|
km
|
|
|
</div>
|
|
|
<div class="__cus-buttons-3">
|
|
|
- <div class="__cus-button-submit __hover" @click="initData">确定</div>
|
|
|
+ <div class="__cus-button-submit __hover" :style="`cursor: ${cusTransfer.draw.radiusTips ? 'not-allowed' : ''};`" @click="initData">确定</div>
|
|
|
<div class="__cus-button-cancel __hover" @click="onCancel">取消</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="content __box-shadow" v-if="cusTransfer.result.isInit" v-loading="$store.state.gis.analysis.loading">
|
|
|
<div class="head-tab">
|
|
|
<div class="head-tab-item __hover" :class="{active: cusTransfer.switchType === 'power'}" @click="cusTransfer.switchType = 'power'">
|
|
|
- <SvgIcon name="search"/>处置力量({{ $store.state.gis.analysis.power.length }}人)
|
|
|
+ <SvgIcon name="analysis-power"/>处置力量({{ $store.state.gis.analysis.power.length }}人)
|
|
|
</div>
|
|
|
<div class="head-tab-item __hover" :class="{active: cusTransfer.switchType === 'device'}" @click="cusTransfer.switchType = 'device'">
|
|
|
- <SvgIcon name="search"/>设备({{ $store.state.gis.analysis.device.length }}台)
|
|
|
+ <SvgIcon name="analysis-device"/>设备({{ $store.state.gis.analysis.device.length }}台)
|
|
|
</div>
|
|
|
- <div class="head-tab-close __hover" @click="$emit('cancel')">
|
|
|
+ <div class="head-tab-close __hover" @click="onCancel">
|
|
|
<SvgIcon name="close_2" color="#0069FF" size="14"/>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -39,6 +39,7 @@
|
|
|
:span="24"
|
|
|
label="搜索:"
|
|
|
v-model:param="cusTransfer.result.power.tempForm.text"
|
|
|
+ @keyup.enter="onSearchPower"
|
|
|
/>
|
|
|
<div class="__cus-buttons-2">
|
|
|
<div class="__cus-button-submit __hover" @click="onSearchPower">搜索</div>
|
|
@@ -64,6 +65,7 @@
|
|
|
:span="24"
|
|
|
label="搜索:"
|
|
|
v-model:param="cusTransfer.result.device.tempForm.text"
|
|
|
+ @keyup.enter="onSearchDevice"
|
|
|
/>
|
|
|
<div class="__cus-buttons-2">
|
|
|
<div class="__cus-button-submit __hover" @click="onSearchDevice">搜索</div>
|
|
@@ -72,12 +74,15 @@
|
|
|
</div>
|
|
|
<div class="table">
|
|
|
<CusTable
|
|
|
+ class="device-table"
|
|
|
:tableData="deviceTableDataCpt"
|
|
|
:tableHead="cusTransfer.result.device.head"
|
|
|
:total="deviceTableFilterCpt.length"
|
|
|
:page="cusTransfer.result.device.pageNum"
|
|
|
:pageSize="cusTransfer.result.device.pageSize"
|
|
|
@handlePage="handlePageDevice"
|
|
|
+ :row-class-name="deviceTableRowClassName"
|
|
|
+ @row-click="deviceHandleRowClick"
|
|
|
>
|
|
|
</CusTable>
|
|
|
</div>
|
|
@@ -98,7 +103,7 @@ import {
|
|
|
getCurrentInstance,
|
|
|
ComponentInternalInstance,
|
|
|
toRefs,
|
|
|
- nextTick, onUnmounted
|
|
|
+ nextTick, onUnmounted, onBeforeUnmount
|
|
|
} from 'vue'
|
|
|
import {useStore} from 'vuex'
|
|
|
import {useRouter, useRoute} from 'vue-router'
|
|
@@ -109,8 +114,7 @@ import * as style from "ol/style";
|
|
|
import * as ol from "ol";
|
|
|
import SelectChartCom from "@/views/gis/layout/tools/select-chart.vue";
|
|
|
import * as turf from "@turf/turf";
|
|
|
-import axios from "axios";
|
|
|
-import {formatPosition} from "@/utils/easyMap";
|
|
|
+import store from "@/store";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: '',
|
|
@@ -136,7 +140,8 @@ export default defineComponent({
|
|
|
draw: {
|
|
|
center: null,
|
|
|
radius: 5,
|
|
|
- wkt: ''
|
|
|
+ wkt: '',
|
|
|
+ radiusTips: false
|
|
|
},
|
|
|
analysisDraw: <any>null,
|
|
|
switchType: 'power',
|
|
@@ -159,8 +164,8 @@ export default defineComponent({
|
|
|
},
|
|
|
device: {
|
|
|
head: [
|
|
|
- {value: "name", label: "名称", show: true,},
|
|
|
- {value: "status", label: "状态", show: true, width: 60},
|
|
|
+ {value: "name", label: "名称", show: true},
|
|
|
+ // {value: "status", label: "状态", show: true, width: 60},
|
|
|
{value: "type", label: "类型", show: true, width: 90},
|
|
|
{value: "distance", label: "距离", show: true, width: 90},
|
|
|
],
|
|
@@ -176,11 +181,17 @@ export default defineComponent({
|
|
|
analysisDrawHelpTooltipElement: null,
|
|
|
},
|
|
|
})
|
|
|
- const handleRangeBlur = () => {
|
|
|
- if (!state.cusTransfer.draw.radius) {
|
|
|
- state.cusTransfer.draw.radius = 5
|
|
|
+ const handleRangeInput = (v) => {
|
|
|
+ const nV = Number(v)
|
|
|
+ if (!isNaN(Number(nV))) {
|
|
|
+ if (nV < 1 || nV > 60) {
|
|
|
+ state.cusTransfer.draw.radiusTips = true
|
|
|
+ } else {
|
|
|
+ state.cusTransfer.draw.radiusTips = false
|
|
|
+ state.cusTransfer.draw.radius = nV
|
|
|
+ setCircle()
|
|
|
+ }
|
|
|
}
|
|
|
- setCircle()
|
|
|
}
|
|
|
const initLayer = () => {
|
|
|
store.state.gis.analysis.layer.setVisible(true)
|
|
@@ -195,7 +206,7 @@ export default defineComponent({
|
|
|
const id = 'analysisDrawHelpTooltipElementId'
|
|
|
if (state.cusTransfer.analysisDrawHelpTooltipElement) {
|
|
|
props.map.removeOverlay(props.map.getOverlayById(id))
|
|
|
- state.cusTransfer.analysisDrawHelpTooltipElement.parentNode.removeChild(state.cusTransfer.analysisDrawHelpTooltipElement);
|
|
|
+ state.cusTransfer.analysisDrawHelpTooltipElement.parentNode?.removeChild(state.cusTransfer.analysisDrawHelpTooltipElement);
|
|
|
}
|
|
|
state.cusTransfer.analysisDrawHelpTooltipElement = document.createElement('div');
|
|
|
state.cusTransfer.analysisDrawHelpTooltipElement.className = 'tooltip hidden';
|
|
@@ -209,7 +220,23 @@ export default defineComponent({
|
|
|
}
|
|
|
createHelpTooltip(); //创建帮助提示框
|
|
|
// 标绘
|
|
|
+ let drawCircleDBClickTimer: any = null
|
|
|
state.cusTransfer.analysisDraw = new interaction.Draw({
|
|
|
+ stopClick: true,
|
|
|
+ finishCondition: (e) => {
|
|
|
+ let flag = true
|
|
|
+ // 圆形进行双击延时监听判断
|
|
|
+ if (!drawCircleDBClickTimer) {
|
|
|
+ flag = false
|
|
|
+ }
|
|
|
+ if (drawCircleDBClickTimer) {
|
|
|
+ clearTimeout(drawCircleDBClickTimer)
|
|
|
+ }
|
|
|
+ drawCircleDBClickTimer = setTimeout(() => {
|
|
|
+ drawCircleDBClickTimer = null
|
|
|
+ }, 1000)
|
|
|
+ return flag
|
|
|
+ },
|
|
|
source: store.state.gis.analysis.source,//测量绘制层数据源
|
|
|
type: 'Circle', //几何图形类型
|
|
|
style: new style.Style({
|
|
@@ -226,6 +253,7 @@ export default defineComponent({
|
|
|
// @ts-ignore
|
|
|
props.map.addInteraction(state.cusTransfer.analysisDraw);
|
|
|
const drawstartHandle = (evt) => {
|
|
|
+ store.commit('gis/SET_IS_DRAWING', true)
|
|
|
sketch = evt.feature; //绘制的要素
|
|
|
}
|
|
|
state.cusTransfer.analysisDraw.on('drawstart', drawstartHandle);
|
|
@@ -241,12 +269,22 @@ export default defineComponent({
|
|
|
props.map.un('pointermove', pointerMoveHandler)
|
|
|
state.cusTransfer.analysisDraw = null
|
|
|
store.state.gis.analysis.feature = evt.feature
|
|
|
+ store.state.gis.analysis.feature.set('featureType', 'analysisCircle')
|
|
|
getCircleParams(evt.feature.getGeometry())
|
|
|
+ setTimeout(() => {
|
|
|
+ store.commit('gis/SET_IS_DRAWING', false)
|
|
|
+ }, 600)
|
|
|
}
|
|
|
state.cusTransfer.analysisDraw.on('drawend', drawendHandle);
|
|
|
const getCircleParams = (circle) => {
|
|
|
const sourceProj = props.map.getView().getProjection();
|
|
|
- const radius = Math.round(circle.getRadius() * sourceProj.getMetersPerUnit() / 1000)
|
|
|
+ let radius = Math.round(circle.getRadius() * sourceProj.getMetersPerUnit() / 1000)
|
|
|
+ if (radius > 60) {
|
|
|
+ radius = 60
|
|
|
+ }
|
|
|
+ if (radius < 1) {
|
|
|
+ radius = 1
|
|
|
+ }
|
|
|
state.cusTransfer.draw.center = circle.getCenter()
|
|
|
state.cusTransfer.draw.radius = radius
|
|
|
setCircle()
|
|
@@ -260,9 +298,11 @@ export default defineComponent({
|
|
|
if (sketch) {
|
|
|
helpMsg = '双击结束标绘';
|
|
|
}
|
|
|
- state.cusTransfer.analysisDrawHelpTooltipElement.innerHTML = helpMsg; //将提示信息设置到对话框中显示
|
|
|
- helpTooltip.setPosition(evt.coordinate);//设置帮助提示框的位置
|
|
|
- state.cusTransfer.analysisDrawHelpTooltipElement.classList.remove('hidden');//移除帮助提示框的隐藏样式进行显示
|
|
|
+ if (state.cusTransfer.analysisDrawHelpTooltipElement) {
|
|
|
+ state.cusTransfer.analysisDrawHelpTooltipElement.innerHTML = helpMsg; //将提示信息设置到对话框中显示
|
|
|
+ helpTooltip.setPosition(evt.coordinate);//设置帮助提示框的位置
|
|
|
+ state.cusTransfer.analysisDrawHelpTooltipElement.classList.remove('hidden');//移除帮助提示框的隐藏样式进行显示
|
|
|
+ }
|
|
|
};
|
|
|
props.map.on('pointermove', pointerMoveHandler); //地图容器绑定鼠标移动事件,动态显示帮助提示框内容
|
|
|
}
|
|
@@ -273,13 +313,16 @@ export default defineComponent({
|
|
|
state.cusTransfer.draw.wkt = that.$easyMap.formatPosition.cpnTwpn(store.state.gis.analysis.feature.getGeometry().getCoordinates())
|
|
|
}
|
|
|
const initData = () => {
|
|
|
- state.cusTransfer.result.isInit = true
|
|
|
- state.cusTransfer.result.power.pageNum = 1
|
|
|
- state.cusTransfer.result.device.pageNum = 1
|
|
|
- store.dispatch('gis/LOAD_GIS_ANALYSIS', {
|
|
|
- center: state.cusTransfer.draw.center,
|
|
|
- wkt: state.cusTransfer.draw.wkt
|
|
|
- })
|
|
|
+ if (!state.cusTransfer.draw.radiusTips) {
|
|
|
+ state.cusTransfer.result.isInit = true
|
|
|
+ state.cusTransfer.result.power.pageNum = 1
|
|
|
+ state.cusTransfer.result.device.pageNum = 1
|
|
|
+ store.dispatch('gis/LOAD_GIS_ANALYSIS', {
|
|
|
+ center: state.cusTransfer.draw.center,
|
|
|
+ wkt: state.cusTransfer.draw.wkt
|
|
|
+ })
|
|
|
+ that.$easyMap.getShapeView(props.map, that.$easyMap.formatPosition.wpnTcpn(state.cusTransfer.draw.wkt)[0])
|
|
|
+ }
|
|
|
}
|
|
|
const powerTableFilterCpt = computed(() => {
|
|
|
return store.state.gis.analysis.power.filter(v => v.name.includes(state.cusTransfer.result.power.form.text))
|
|
@@ -322,8 +365,26 @@ export default defineComponent({
|
|
|
onSearchDevice()
|
|
|
}
|
|
|
const onCancel = () => {
|
|
|
+ emit('update:transfer', null)
|
|
|
emit('cancel')
|
|
|
}
|
|
|
+ const deviceTableRowClassName = ({row}) => {
|
|
|
+ if (row.id === store.state.gis.gisParams.default.feature?.getId()) {
|
|
|
+ return 'row-active'
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ const deviceHandleRowClick = (row) => {
|
|
|
+ if (row.id === store.state.gis.gisParams.default.feature?.getId()) {
|
|
|
+ store.dispatch('gis/LOAD_GIS_PARAMS_DEFAULT_RESET')
|
|
|
+ } else {
|
|
|
+ store.dispatch('gis/LOAD_GIS_PARAMS_DEFAULT_SB', {
|
|
|
+ wkt: row.wkt,
|
|
|
+ id: row.id,
|
|
|
+ info: row.info
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
watch(() => state.cusTransfer, () => {
|
|
|
emit('update:transfer', state.cusTransfer)
|
|
|
}, { deep: true })
|
|
@@ -342,17 +403,22 @@ export default defineComponent({
|
|
|
initLayer()
|
|
|
}
|
|
|
})
|
|
|
+ onBeforeUnmount(() => {
|
|
|
+ state.cusTransfer.draw.radiusTips = false
|
|
|
+ emit('update:transfer', state.cusTransfer)
|
|
|
+ })
|
|
|
onUnmounted(() => {
|
|
|
state.cusTransfer.result.isInit = false
|
|
|
store.state.gis.analysis.layer.setVisible(false)
|
|
|
if (state.cusTransfer.analysisDraw) {
|
|
|
props.map.removeInteraction(state.cusTransfer.analysisDraw);
|
|
|
}
|
|
|
+ state.cusTransfer.analysisDrawHelpTooltipElement?.parentNode.removeChild(state.cusTransfer.analysisDrawHelpTooltipElement);
|
|
|
store.dispatch('gis/LOAD_GIS_ANALYSIS_RESET')
|
|
|
})
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
- handleRangeBlur,
|
|
|
+ handleRangeInput,
|
|
|
initData,
|
|
|
setCircle,
|
|
|
powerTableFilterCpt,
|
|
@@ -365,7 +431,9 @@ export default defineComponent({
|
|
|
handlePageDevice,
|
|
|
onSearchDevice,
|
|
|
onResetDevice,
|
|
|
- onCancel
|
|
|
+ onCancel,
|
|
|
+ deviceTableRowClassName,
|
|
|
+ deviceHandleRowClick,
|
|
|
}
|
|
|
},
|
|
|
})
|
|
@@ -426,6 +494,31 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .tips {
|
|
|
+ $footH: 6px;
|
|
|
+ $bgColor: rgba(255, 255, 255, 0.8);
|
|
|
+ position: absolute;
|
|
|
+ top: -28px;
|
|
|
+ right: -10px;
|
|
|
+ font-size: 12px;
|
|
|
+ font-family: Microsoft YaHei;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #E60012;
|
|
|
+ background: $bgColor;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 6px 8px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ &:after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ bottom: -$footH;
|
|
|
+ border-top: $footH solid $bgColor;
|
|
|
+ border-left: $footH solid transparent;
|
|
|
+ border-right: $footH solid transparent;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.content {
|
|
@@ -496,6 +589,27 @@ export default defineComponent({
|
|
|
}
|
|
|
.table {
|
|
|
flex: 1;
|
|
|
+ :deep(.row-active) {
|
|
|
+ >td {
|
|
|
+ background: rgba(16,140,243,0.1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ :deep(.device-table) {
|
|
|
+ .el-table__row {
|
|
|
+ .el-table__cell:nth-child(2) {
|
|
|
+ .cell {
|
|
|
+ width: 80px;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis !important;
|
|
|
+ word-break: break-all !important;
|
|
|
+ white-space: normal !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|