Commit 24bb4d62 authored by xinzhedeai's avatar xinzhedeai

地图组件副本 修改公司

parent c311c010
<template>
<div class="app-amap-search-point">
<el-autocomplete v-show="isSearch" v-model="mapInput" style="width: 100%;" :fetch-suggestions="querySearch" placeholder="请输入地址搜素" prefix-icon="el-icon-search" @select="handleSelect">
<template slot-scope="{ item }">
<div style="text-overflow: ellipsis; overflow: hidden;">{{ item.name }}</div>
<span style="font-size: 12px; color: #b4b4b4;">{{ item.district }}</span>
</template>
</el-autocomplete>
<div id="amap_search_point_container_add" :style="{padding: 0,margin: 0,width: '100%',height: mapHeight}" />
</div>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
export default {
name: 'AMapSearchPoint',
props: {
mapHeight: {
type: String,
default: () => { return '400px' }
},
isSearch: {
type: Boolean,
default: () => { return true }
},
point: {
type: Array,
default: () => { return null }
}
},
data() {
return {
mapInput: '',
lnglat: null,
mapMarker: null
}
},
computed: {},
watch: {
mapMarker(newValue, oldValue) {
if (oldValue) {
this.map.remove(oldValue)
}
if (newValue) {
this.map.add(newValue)
}
},
point() {
if (this.map) {
this.markPoint(this.point)
this.point && this.map.panTo(this.point)
}
}
},
created() {
this.initMap()
},
methods: {
// 输入选择
querySearch(queryString, callback) {
this.autoComplete.search(queryString, (status, result) => {
// result.tips[0].{name,district,location{lng,lat}}
if (result && result.tips) {
callback(result.tips.filter(tip => tip.location))
} else {
callback(null)
}
})
},
// 点选搜索结果
handleSelect(amapTip) {
if (amapTip.location.lng && amapTip.location.lat) {
this.$emit('choosePoint', [amapTip.location.lng, amapTip.location.lat])
} else {
this.$message({
message: '您所选的地点无法精确定位',
type: 'warning'
})
}
},
// 选中点
markPoint(lnglatArray) {
if (lnglatArray && lnglatArray.length === 2) {
this.mapMarker = new this.AMap.Marker({
position: new this.AMap.LngLat(lnglatArray[0], lnglatArray[1])
})
this.lnglat = lnglatArray
} else {
this.mapMarker = null
}
},
initMap() {
AMapLoader.load({
key: 'a0efee399e638b35211705625d786e83',
version: '2.0',
plugins: []
}).then((AMap) => {
this.AMap = AMap
// 加载地图
let center = [119.969873, 36.753901] // 平度市
if (this.defaultPoint && this.defaultPoint.length === 2) {
center = this.defaultPoint
}
this.map = new this.AMap.Map('amap_search_point_container_add', {
resizeEnable: true,
center: center,
zoom: 12
})
if (this.defaultPoint && this.defaultPoint.length === 2) {
this.markPoint(center)
}
// 点击选取
this.map.on('click', res => {
if (this.isSearch) {
if (res && res.lnglat && res.lnglat.lng && res.lnglat.lat) {
this.$emit('choosePoint', [res.lnglat.lng, res.lnglat.lat])
}
}
})
// 输入框选择位置
this.AMap.plugin(['AMap.AutoComplete'], () => {
this.autoComplete = new this.AMap.AutoComplete({
city: '全国'
})
})
// 初始化位置
if (this.point) {
this.markPoint(this.point)
this.point && this.map.panTo(this.point)
}
}).catch(e => {
console.error(e)
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
......@@ -536,7 +536,9 @@
</el-table-column>
<el-table-column label="操作" width="200px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-show="scope.row.auditState!=1" size="mini" round @click="showEnterpriseInfo(scope.row.id)">查看详情</el-button>
<el-button size="mini" round @click="showEnterpriseInfo(scope.row.id)">查看详情</el-button>
<!-- <el-button size="mini" round @click="editEnterpriseInfo(scope.row)">修改</el-button> -->
<!-- <el-button v-show="scope.row.auditState==1" size="mini" round @click="auditBtn(scope.row, 2)">通过</el-button>
<el-button v-show="scope.row.auditState==1" size="mini" round @click="auditBtn(scope.row, 3)">不通过</el-button> -->
</template>
......@@ -866,6 +868,19 @@ export default {
dialog2Submit() {
this.doAudit(this.dialog2Data)
},
editEnterpriseInfo(row){
this.addCompanyShow = true
this.mainDataEditing = row
if (this.mainDataEditing.workLicenseFilePath) {
this.mainDataEditing._workLicenseFileList = JSON.parse(this.mainDataEditing.workLicenseFilePath)
this.mainDataEditing._workLicenseFileListShow = JSON.parse(this.mainDataEditing.workLicenseFilePath) // 数据存放与原始绑定分开,可以防止中途赋值产生的闪烁问题
}
if (this.mainDataEditing.safetyLicenseFilePath) {
this.mainDataEditing._safetyLicenseFileList = JSON.parse(this.mainDataEditing.safetyLicenseFilePath)
this.mainDataEditing._safetyLicenseFileListShow = JSON.parse(this.mainDataEditing.safetyLicenseFilePath) // 数据存放与原始绑定分开,可以防止中途赋值产生的闪烁问题
}
this.mainDataEditing._administrativeAreaCascade = row.deptId
},
showEnterpriseInfo(enterpriseId) {
enterpriseApi.getById(enterpriseId).then(response => {
this.dialog1Data = response
......
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