|
|
@ -37,7 +37,7 @@ |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="维护单位" name="maintenanceUnit"> |
|
|
|
<a-input v-model:value="form.maintenanceUnit" placeholder="请输入" disabled/> |
|
|
|
<a-input v-model:value="form.maintenanceUnit" placeholder="请输入" disabled /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
@ -49,15 +49,22 @@ |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="链路维护单位" name="linkUnit"> |
|
|
|
<a-input v-model:value="form.linkUnit" placeholder="请输入" /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<!-- <a-row :gutter="[16, 16]"> |
|
|
|
<a-col :span="24"> |
|
|
|
<a-form-item label="地点" name="address"> |
|
|
|
<a-input v-model:value="form.address" placeholder="请输入" /> |
|
|
|
</a-form-item> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
</a-row> --> |
|
|
|
<a-row :gutter="[16, 16]" v-show="false"> |
|
|
|
<a-col :span="24"> |
|
|
|
<div id="container" style="width: 100%; height: 500px" v-show="form.address" ></div> |
|
|
|
<div id="container" style="width: 100%; height: 500px" v-show="form.address"></div> |
|
|
|
</a-col> |
|
|
|
</a-row> |
|
|
|
<a-row :gutter="[16, 16]"> |
|
|
@ -72,12 +79,19 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { reactive, ref ,toRefs} from 'vue'; |
|
|
|
import { reactive, ref, toRefs } from 'vue'; |
|
|
|
import { message } from 'ant-design-vue'; |
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader'; |
|
|
|
import { getInfo, add, update, getProjectInfo, getOrganizationType,getContractPartyBNameByProjectName } from './api'; |
|
|
|
import { |
|
|
|
getInfo, |
|
|
|
add, |
|
|
|
update, |
|
|
|
getProjectInfo, |
|
|
|
getOrganizationType, |
|
|
|
getContractPartyBNameByProjectName, |
|
|
|
} from './api'; |
|
|
|
export default { |
|
|
|
setup(props,{emit}) { |
|
|
|
setup(props, { emit }) { |
|
|
|
const title = ref('新增'); |
|
|
|
const visible = ref(false); |
|
|
|
const form = reactive({ |
|
|
@ -85,7 +99,8 @@ |
|
|
|
organizationName: null, |
|
|
|
remark: '', |
|
|
|
maintenanceUnit: '', |
|
|
|
address: '', |
|
|
|
// address: '', |
|
|
|
linkUnit:'', |
|
|
|
longitude: '', |
|
|
|
latitude: '', |
|
|
|
pointName: '', |
|
|
@ -102,17 +117,18 @@ |
|
|
|
const res = await getOrganizationType(); |
|
|
|
organizationNameOptions.value = res.rows; |
|
|
|
}; |
|
|
|
const showModal = async (type, id, projectId,selectInfo) => { |
|
|
|
const showModal = async (type, id, projectId, selectInfo) => { |
|
|
|
console.log(selectInfo); |
|
|
|
visible.value = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
title.value = '新增'; |
|
|
|
form.projectName = selectInfo.node.ownerName |
|
|
|
form.organizationName = selectInfo.node.projectName |
|
|
|
const res = await getContractPartyBNameByProjectName({projectName:selectInfo.node.ownerName}) |
|
|
|
form.maintenanceUnit = res |
|
|
|
form.projectName = selectInfo.node.ownerName; |
|
|
|
form.organizationName = selectInfo.node.projectName; |
|
|
|
const res = await getContractPartyBNameByProjectName({ |
|
|
|
projectName: selectInfo.node.ownerName, |
|
|
|
}); |
|
|
|
form.maintenanceUnit = res; |
|
|
|
initMap(); |
|
|
|
} else if (type == 2) { |
|
|
|
title.value = '编辑'; |
|
|
@ -138,8 +154,8 @@ |
|
|
|
delete params.id; |
|
|
|
add(params).then((_) => { |
|
|
|
message.success('新增成功'); |
|
|
|
emit('success') |
|
|
|
closeModal() |
|
|
|
emit('success'); |
|
|
|
closeModal(); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
let params = {}; |
|
|
@ -148,8 +164,8 @@ |
|
|
|
} |
|
|
|
update(params).then((_) => { |
|
|
|
message.success('编辑成功'); |
|
|
|
emit('success') |
|
|
|
closeModal() |
|
|
|
emit('success'); |
|
|
|
closeModal(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -165,7 +181,8 @@ |
|
|
|
organizationName: [{ required: true, message: '请选择' }], |
|
|
|
remark: [{ required: true, message: '请输入' }], |
|
|
|
maintenanceUnit: [{ required: true, message: '请输入' }], |
|
|
|
address: [{ required: true, message: '请输入' }], |
|
|
|
// address: [{ required: true, message: '请输入' }], |
|
|
|
linkUnit : [{ required: true, message: '请输入' }], |
|
|
|
pointName: [{ required: true, message: '请输入' }], |
|
|
|
}; |
|
|
|
//地图 |
|
|
@ -183,7 +200,9 @@ |
|
|
|
// 初始化地图 |
|
|
|
map.value = new AMap.Map('container', { |
|
|
|
zoom: 17, |
|
|
|
center: form.longitude?[form.longitude, form.latitude]:['121.5645431', '29.8596452'], |
|
|
|
center: form.longitude |
|
|
|
? [form.longitude, form.latitude] |
|
|
|
: ['121.5645431', '29.8596452'], |
|
|
|
}); |
|
|
|
|
|
|
|
// 添加标记(可选) |
|
|
@ -198,19 +217,19 @@ |
|
|
|
if (currentMarker.value) { |
|
|
|
map.value.remove(currentMarker.value); |
|
|
|
currentMarker.value = null; |
|
|
|
form.longitude = '' |
|
|
|
form.latitude = '' |
|
|
|
form.longitude = ''; |
|
|
|
form.latitude = ''; |
|
|
|
} else { |
|
|
|
currentMarker.value = new AMap.Marker({ |
|
|
|
position: [e.lnglat.getLng(), e.lnglat.getLat()], // 经纬度转换 |
|
|
|
title: form.address , |
|
|
|
title: form.address, |
|
|
|
}); |
|
|
|
form.longitude = e.lnglat.getLng() |
|
|
|
form.latitude = e.lnglat.getLat() |
|
|
|
form.longitude = e.lnglat.getLng(); |
|
|
|
form.latitude = e.lnglat.getLat(); |
|
|
|
// 添加到地图 |
|
|
|
map.value.add(currentMarker.value); |
|
|
|
} |
|
|
|
console.log(form) |
|
|
|
console.log(form); |
|
|
|
}); |
|
|
|
} catch (error) { |
|
|
|
console.error('加载高德地图失败:', error); |
|
|
|