修改完成
This commit is contained in:
parent
546485505b
commit
7f13e4d269
|
|
@ -174,6 +174,34 @@
|
||||||
append-to-body
|
append-to-body
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
|
<!-- 内层对话框 选择地图 -->
|
||||||
|
<el-dialog
|
||||||
|
width="70%"
|
||||||
|
title="选择地图"
|
||||||
|
:visible.sync="innerVisible"
|
||||||
|
v-if="innerVisible"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<el-row class="search-container">
|
||||||
|
<el-input
|
||||||
|
clearable
|
||||||
|
placeholder="请输入地址"
|
||||||
|
v-model="searchAddress"
|
||||||
|
@keyup.enter.native="onSearchAddress"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
style="width: 120px"
|
||||||
|
@click="onSearchAddress"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
</el-row>
|
||||||
|
<div
|
||||||
|
id="map-container"
|
||||||
|
style="height: 550px; background-color: #bfc"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<el-form
|
<el-form
|
||||||
ref="form"
|
ref="form"
|
||||||
:model="form"
|
:model="form"
|
||||||
|
|
@ -252,6 +280,62 @@
|
||||||
onkeyup="this.value = this.value.replace(/[^\d]/g,'');"
|
onkeyup="this.value = this.value.replace(/[^\d]/g,'');"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="开工日期" prop="startDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.startDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width: 100%"
|
||||||
|
@change="startDateChange"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="竣工日期" prop="completionDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.completionDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width: 100%"
|
||||||
|
:picker-options="{
|
||||||
|
// 设置当前时间为 开工日期
|
||||||
|
disabledDate: (time) => {
|
||||||
|
const currentDate = new Date(
|
||||||
|
form.startDate || new Date(),
|
||||||
|
)
|
||||||
|
currentDate.setDate(currentDate.getDate())
|
||||||
|
return time.getTime() < currentDate.getTime()
|
||||||
|
},
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="handleProjectAddress"
|
||||||
|
>选择工程地址</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="经度" prop="longitude">
|
||||||
|
<el-input disabled v-model="form.longitude" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="纬度" prop="latitude">
|
||||||
|
<el-input disabled v-model="form.latitude" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
label="工程地址"
|
||||||
|
prop="detailsAddress"
|
||||||
|
class="address-ipt"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.province"
|
||||||
|
disabled
|
||||||
|
style="width: 40%"
|
||||||
|
/>
|
||||||
|
<el-input
|
||||||
|
v-model="form.detailsAddress"
|
||||||
|
style="width: 60%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -319,8 +403,17 @@ export default {
|
||||||
dictType: undefined,
|
dictType: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
},
|
},
|
||||||
|
innerVisible: false,
|
||||||
|
map: null,
|
||||||
|
searchAddress: '',
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {
|
||||||
|
longitude: '',
|
||||||
|
latitude: '',
|
||||||
|
address: '',
|
||||||
|
province: '',
|
||||||
|
detailsAddress: '',
|
||||||
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
lotName: [
|
lotName: [
|
||||||
|
|
@ -361,6 +454,41 @@ export default {
|
||||||
// ownPro: [
|
// ownPro: [
|
||||||
// { required: true, message: "所属工程项目", trigger: "blur" }
|
// { required: true, message: "所属工程项目", trigger: "blur" }
|
||||||
// ]
|
// ]
|
||||||
|
startDate: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择开工日期',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// completionDate: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// message: '请选择竣工日期',
|
||||||
|
// trigger: 'change',
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
longitude: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: 'change',
|
||||||
|
message: '经度不能为空',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
latitude: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: 'change',
|
||||||
|
message: '纬度不能为空',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
detailsAddress: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入详细地址',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -433,6 +561,11 @@ export default {
|
||||||
status: '0',
|
status: '0',
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
costIndicators: '',
|
costIndicators: '',
|
||||||
|
longitude: '',
|
||||||
|
latitude: '',
|
||||||
|
address: '',
|
||||||
|
detailsAddress: '',
|
||||||
|
province: '',
|
||||||
}
|
}
|
||||||
this.resetForm('form')
|
this.resetForm('form')
|
||||||
},
|
},
|
||||||
|
|
@ -473,6 +606,8 @@ export default {
|
||||||
this.$refs['form'].validate((valid) => {
|
this.$refs['form'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
|
this.form.address =
|
||||||
|
this.form.province + this.form.detailsAddress
|
||||||
if (this.form.lotId != undefined) {
|
if (this.form.lotId != undefined) {
|
||||||
updateProjectLot(this.form)
|
updateProjectLot(this.form)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
@ -535,6 +670,100 @@ export default {
|
||||||
// 将数字转为字符串,并使用正则表达式添加逗号
|
// 将数字转为字符串,并使用正则表达式添加逗号
|
||||||
return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
return amount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
|
||||||
},
|
},
|
||||||
|
// 开工日期变化
|
||||||
|
startDateChange(val) {
|
||||||
|
if (this.form.completionDate) {
|
||||||
|
const startDate = val.split('-').join('') - 0
|
||||||
|
const endDate = this.form.completionDate.split('-').join('') - 0
|
||||||
|
|
||||||
|
if (startDate >= endDate) {
|
||||||
|
this.form.completionDate = ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 选择工程地址 */
|
||||||
|
handleProjectAddress() {
|
||||||
|
const this_ = this
|
||||||
|
this.searchAddress = '';
|
||||||
|
this.innerVisible = 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.detailsAddress = `${addComp.city}${addComp.district}${addComp.street}${addComp.streetNumber}`
|
||||||
|
this_.form.province = `${addComp.province}`
|
||||||
|
this_.form.longitude = e.latlng.lng
|
||||||
|
this_.form.latitude = e.latlng.lat
|
||||||
|
})
|
||||||
|
this_.map.clearOverlays()
|
||||||
|
point = new BMapGL.Point(e.latlng.lng, e.latlng.lat)
|
||||||
|
let marker = new BMapGL.Marker(point) // 创建标点
|
||||||
|
this_.map.addOverlay(marker)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/* 搜索 */
|
||||||
|
onSearchAddress() {
|
||||||
|
// console.log(this.searchAddress, '-----------')
|
||||||
|
|
||||||
|
// 创建地址
|
||||||
|
const myGeo = new BMapGL.Geocoder()
|
||||||
|
const _this = this
|
||||||
|
myGeo.getPoint(
|
||||||
|
this.searchAddress,
|
||||||
|
function (point) {
|
||||||
|
if (point) {
|
||||||
|
_this.map.clearOverlays()
|
||||||
|
const { lng, lat } = point
|
||||||
|
|
||||||
|
_this.map.centerAndZoom(point, 16)
|
||||||
|
_this.map.addOverlay(
|
||||||
|
new BMapGL.Marker(point, {
|
||||||
|
title: _this.searchAddress,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
// 根据坐标得到地址描述
|
||||||
|
myGeo.getLocation(
|
||||||
|
new BMapGL.Point(lng, lat),
|
||||||
|
function (result) {
|
||||||
|
if (result) {
|
||||||
|
// console.log('result-----', result)
|
||||||
|
let addComp = result.addressComponents
|
||||||
|
// let addressDetails = result.content
|
||||||
|
_this.form.detailsAddress = `${addComp.city}${addComp.district}${addComp.street}${addComp.streetNumber}`
|
||||||
|
// _this.form.detailsAddress = `${addressDetails.address.replace(
|
||||||
|
// addComp.province,
|
||||||
|
// '',
|
||||||
|
// )}${addressDetails.business}${
|
||||||
|
// addressDetails.poi_desc
|
||||||
|
// }`
|
||||||
|
_this.form.province = `${addComp.province}`
|
||||||
|
_this.form.longitude = lng
|
||||||
|
_this.form.latitude = lat
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
this.$message.error('您输入的地址有误,请重新输入')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'中国',
|
||||||
|
)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ module.exports = {
|
||||||
// target: `http://10.40.92.81:8080`, //韩/
|
// target: `http://10.40.92.81:8080`, //韩/
|
||||||
// target: `http://192.168.2.74:49080`, //旭/
|
// target: `http://192.168.2.74:49080`, //旭/
|
||||||
// target: `http://192.168.2.17:39080`, //帅
|
// target: `http://192.168.2.17:39080`, //帅
|
||||||
target: `http://localhost:39080`, //福
|
target: `http://192.168.2.209:49080`, //福
|
||||||
// target: `http://192.168.0.37:49080`, //跃
|
// target: `http://192.168.0.37:49080`, //跃
|
||||||
|
|
||||||
//******** 注意事项 ********* */
|
//******** 注意事项 ********* */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue