You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
677 lines
23 KiB
677 lines
23 KiB
<template>
|
|
<el-dialog title="提示" :visible.sync="dialogVisible" width="1370px" :before-close="handleCancle">
|
|
<span slot="title">
|
|
<span v-if="pageType == 'add'">新增</span>
|
|
<span v-if="pageType == 'edit'">修改</span>
|
|
<span v-if="pageType == 'view'">查看</span>
|
|
<span v-if="pageType == 'patrol'">巡查记录</span>
|
|
</span>
|
|
<div>
|
|
<div class="dialog-h-content scroll-h">
|
|
<el-form :inline="true" :model="formData" ref="form" :rules="dataRule" :label-width="'90px'"
|
|
v-if="pageType != 'view' && pageType != 'patrol'">
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<!-- <el-form-item label="所属组织" prop="agencyId">
|
|
<el-input v-model.trim="formData.agencyId" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item> -->
|
|
|
|
<el-form-item label="所属组织" prop="agencyId">
|
|
<el-cascader class="u-item-width-normal" size="small" ref="myCascader"
|
|
v-model.trim="formData.agencyId" :options="orgOptions" :props="orgOptionProps"
|
|
:show-all-levels="false" @change="handleChangeAgency" clearable></el-cascader>
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="企业名称" prop="name">
|
|
<el-input v-model.trim="formData.name" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="九小场所" prop="nineSmallPlacesFlag">
|
|
<el-radio-group v-model="formData.nineSmallPlacesFlag" :disabled="disabled" size="small">
|
|
<el-radio label="是">是</el-radio>
|
|
<el-radio label="否">否</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="九小场分类" prop="nineSmallPlacesCategory" style="white-space: nowrap;overflow: hidden;">
|
|
<el-input v-model.trim="formData.nineSmallPlacesCategory" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="规模" prop="scale">
|
|
<el-input v-model.trim="formData.scale" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="负责人" prop="chargePerson">
|
|
<el-input v-model.trim="formData.chargePerson" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="联系电话" prop="mobile">
|
|
<el-input v-model.trim="formData.mobile" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-form-item label="企业地址" prop="address" style="display: block">
|
|
<el-select v-model.trim="formData.address" :disabled="disabled" filterable remote
|
|
:reserve-keyword="true" placeholder="请输入关键词" :remote-method="remoteMethod"
|
|
:loading="loading" @keyup.enter.native="remoteMethod(formData.location)">
|
|
<el-option v-for="(item, index) in searchOptions"
|
|
@click.native="handleClickKey(index)" :key="item.value" :label="item.label"
|
|
:value="item.value"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div id="app_event" class="div_map"></div>
|
|
</el-form>
|
|
<el-form :inline="false" :model="formData" ref="form" :label-width="'90px'" v-if="pageType == 'view'">
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-form-item label="所属组织" prop="equipmentName">{{ formData.equipmentName }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="企业名称" prop="equipmentNum">{{ formData.equipmentNum }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="九小场所" prop="principalName">{{ formData.principalName }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="规模" prop="contactNum">{{ formData.contactNum }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="负责人" prop="contactNum">{{ formData.contactNum }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="联系电话" prop="mobile">{{ formData.mobile }}</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="企业地址" prop="location" style="display: block">{{ formData.location
|
|
}}</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div id="app_event" class="div_map"></div>
|
|
</el-form>
|
|
<el-form :inline="false" :model="formData" ref="form" :label-width="'90px'" v-if="pageType == 'patrol'"
|
|
style="margin-left: 50px;">
|
|
<div class="div_btn">
|
|
<el-button size="small" type="primary " @click="patrolAddd()">新增</el-button>
|
|
</div>
|
|
<el-row v-for="(item, index) in tableData" :key="index" :gutter="20" style="margin-bottom: 20px;">
|
|
<el-row style="margin-top: 20px;">
|
|
<el-col :span="24">
|
|
<el-tag type="primary" effect="plain" class="custom-tag">●</el-tag>{{ item.datereviewTime}}
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row style="margin-top: 15px;">
|
|
<el-col :span="6" style="padding-left: 65px;"> <span style="color: #888; ">检查人员:</span> {{
|
|
item.checkPersons }}</el-col>
|
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">检查结论:</span> {{
|
|
item.checkResultFlag }}</el-col>
|
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">拟复查时间: </span> {{
|
|
item.reviewTime }}</el-col>
|
|
</el-row>
|
|
<el-row style="margin-top: 15px;">
|
|
<el-col :span="24" style="padding-left: 65px;"><span style="color: #888; ">隐患明细: </span> {{
|
|
item.hazardDetails }}</el-col>
|
|
</el-row>
|
|
<el-row style="margin-top: 15px;">
|
|
<el-col :span="24" style="padding-left: 65px;"> <span style="color: #888; ">整改要求: </span>{{
|
|
item.requirements }}</el-col>
|
|
</el-row>
|
|
<el-row style="margin-top: 15px;">
|
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">附件: </span>{{
|
|
item.attachmentUrl }}</el-col>
|
|
<el-col :span="6" style="padding-left: 65px;"><span style="color: #888; ">备注: </span>{{
|
|
item.remark }}</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<!-- 巡查记录新增 -->
|
|
<el-form :inline="true" :model="formData" ref="form" :rules="dataRule" :label-width="'90px'"
|
|
v-if="patrolAdd">
|
|
<el-row>
|
|
<el-col :span="16">
|
|
<el-form-item label="巡查时间" prop="equipmentName">
|
|
<el-input v-model.trim="formData.equipmentName" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="16">
|
|
<el-form-item label="检察人员" prop="equipmentNum">
|
|
<el-input v-model.trim="formData.equipmentNum" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="18">
|
|
<el-form-item label="检查结论" prop="principalName">
|
|
<el-input v-model.trim="formData.principalName" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-form-item label="拟复查时间" prop="principalName"
|
|
style="white-space: nowrap; overflow: hidden;">
|
|
<el-date-picker class="u-item-width-normal" size="small"
|
|
v-model.trim="formData.latestInspectTime" type="datetime"
|
|
format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期"></el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="8">
|
|
<el-form-item label="已整改隐患" prop="principalName"
|
|
style="white-space: nowrap;overflow: hidden;">
|
|
<el-radio-group v-model="formData.latestInspectTime" size="small">
|
|
<el-col v-for="option in radioOptions" :key="option.value">
|
|
<el-checkbox :label="option.value">{{ option.label }}</el-checkbox>
|
|
</el-col>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="18" v-for="(item, index) in inputList" :key="index">
|
|
<el-form-item label="" prop="textarea" class="input-container">
|
|
<el-input v-model="item.value" rows="3" placeholder="请输入隐患信息"></el-input>
|
|
</el-form-item>
|
|
<el-button @click="removeInput(index)" v-if="inputList.length > 1"
|
|
class="remove-button">
|
|
<el-icon name="minus"></el-icon>
|
|
</el-button>
|
|
<el-button @click="addInput" v-if="index === inputList.length - 1">
|
|
<el-icon name="plus"></el-icon>
|
|
</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<!-- <el-form-item label="附件">
|
|
<template>
|
|
<upload-image :defaultFileList="fileList" :limit="6"
|
|
@change="onChangeFileList"></upload-image>
|
|
</template>
|
|
</el-form-item> -->
|
|
<el-form-item label="附件">
|
|
<upload-image :defaultFileList="fileList" :limit="6" @change="onChangeFileList"
|
|
v-if="true"></upload-image>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-form-item label="备注" prop="textarea">
|
|
<el-input v-model.trim="formData.principalName" :disabled="disabled"
|
|
class="u-item-width-normal" size="small" clearable placeholder="请输入"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<!-- 巡查记录新增end -->
|
|
</el-form>
|
|
</div>
|
|
<div class="div_btn" v-if="patrolAdd">
|
|
<el-button size="small" @click="handleCancle">关闭</el-button>
|
|
<!-- <el-button size="small" @click="resetData" v-if="pageType != 'view'">重置</el-button> -->
|
|
<!-- <el-button size="small" type="primary" :disabled="btnDisable" @click="handleComfirm">确 定</el-button> -->
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="handleCancle" size="small">取消</el-button>
|
|
<el-button @click="handleCancle" size="small" type="primary">确定</el-button>
|
|
<!-- <el-button type="primary" @click="handleComfirm">确 定</el-button> -->
|
|
</span>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import { isMobile } from '@/utils/validate';
|
|
import { mapGetters } from 'vuex';
|
|
import { Loading } from 'element-ui'; // 引入Loading服务
|
|
import { requestPost, requestGet } from '@/js/dai/request';
|
|
import daiMap from '@/utils/dai-map';
|
|
import nextTick from 'dai-js/tools/nextTick';
|
|
// import UploadImage from '@/views/modules/plugins/rent/rentcontractinfo-add-or-update'
|
|
import UploadImage from '@/views/modules/plugins/rent/upload-image.vue'
|
|
let loading; // 加载动画
|
|
let map;
|
|
var search;
|
|
var markers;
|
|
var infoWindowList;
|
|
var geocoder; // 新建一个正逆地址解析类
|
|
|
|
export default {
|
|
props: {
|
|
dialogVisible: {
|
|
type: Boolean,
|
|
default: ''
|
|
},
|
|
defaultData: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
pageType: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
detailId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
detailData: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
disabled: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
|
|
data() {
|
|
let checkMObile = (rule, value, callback) => {
|
|
if (value === '') {
|
|
callback(new Error('请输入联系电话'));
|
|
} else {
|
|
if (!isMobile(value)) {
|
|
callback(new Error('联系电话格式不正确'));
|
|
}
|
|
callback();
|
|
}
|
|
};
|
|
let orgOptionProps = {
|
|
multiple: false,
|
|
value: 'agencyId',
|
|
label: 'agencyName',
|
|
children: 'subAgencyList',
|
|
checkStrictly: true
|
|
}
|
|
|
|
return {
|
|
orgOptions:[],
|
|
orgOptionProps,
|
|
inputList: [{ value: '' }],//隐患输入框
|
|
fileList:[],
|
|
patrolAdd: false,
|
|
radioOptions: [
|
|
{ label: 'Option 1', value: 'option1' },
|
|
{ label: 'Option 2', value: 'option2' },
|
|
{ label: '已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患', value: '已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患已整改隐患' },
|
|
],
|
|
tableData: [
|
|
{
|
|
datereviewTime: '2019-04-22 09:30',
|
|
checkPersons: '张三,李四',
|
|
checkResultFlag: '不合格',
|
|
reviewTime: '2019-04-22 09:30',
|
|
issues: ['1、生产配件机械设备到达年间', '2、配件工艺未达标需要年检机械设备、配件'],
|
|
requirements: ['1、第1条安全一定要过关', '2、第2条,设备需要保养'],
|
|
attachmentUrl: '123456789.jPg',
|
|
remark: '请相关负责人尽快处理'
|
|
},
|
|
{
|
|
datereviewTime: '2019-04-22 09:30',
|
|
checkPersons: '张三,李四',
|
|
checkResultFlag: '不合格',
|
|
reviewTime: '2019-04-22 09:30',
|
|
issues: ['1、生产配件机械设备到达年间', '2、配件工艺未达标需要年检机械设备、配件'],
|
|
requirements: ['1、第1条安全一定要过关', '2、第2条,设备需要保养'],
|
|
attachmentUrl: '123456789.jPg',
|
|
remark: '请相关负责人尽快处理'
|
|
},
|
|
],
|
|
detailIdcopy:this.detailId,
|
|
btnDisable: false,
|
|
user: '',
|
|
agencyId: '',
|
|
gridList: [], //所属网格list--场所区域
|
|
placeTypeList: [], //场所类型
|
|
resultArray: [{ value: '0', label: '合格' }, { value: '1', label: '不合格' }],
|
|
equipmentCategoryCodeArray: [],
|
|
list: {},
|
|
formData: {
|
|
agencyId:'',
|
|
name:'',
|
|
address:'',
|
|
scale:'',
|
|
chargePerson:'',
|
|
mobile:'',
|
|
nineSmallPlacesFlag:'',
|
|
nineSmallPlacesCategory:''
|
|
},
|
|
dataRule: {
|
|
agencyId: [{ required: true, message: '所属组织必选', trigger: 'blur' }],
|
|
name: [{ required: true, message: '企业名称不能为空', trigger: 'blur' }],
|
|
address: [{ required: true, message: '企业地址不能为空', trigger: 'blur' }],
|
|
scale: [{ required: true, message: '规模不能为空', trigger: 'blur' }],
|
|
chargePerson: [{ required: true, message: '负责人不能为空', trigger: 'blur' }],
|
|
mobile: [{ required: true, message: '联系电话不能为空', trigger: 'blur' }],
|
|
nineSmallPlacesCategory: [{ required: true, message: '九小场所类型不能为空', trigger: 'blur' }],
|
|
nineSmallPlacesFlag: [{ required: true, message: '九小场所类型不能为空', trigger: 'blur' }],
|
|
},
|
|
//地图
|
|
loading: false,
|
|
searchValue: '',
|
|
searchOptions: []
|
|
};
|
|
},
|
|
watch: {},
|
|
components: { UploadImage },
|
|
created() {},
|
|
async mounted() {
|
|
this.getOrgTreeList();
|
|
console.log('detailId', this.detailId);
|
|
this.user = this.$store.state.user;
|
|
this.agencyId = this.user.agencyId;
|
|
this.startLoading();
|
|
this.loadCategory();
|
|
// this.loadGrid();
|
|
// this.loadplaceType();
|
|
if (this.pageType != 'add') {
|
|
this.getDetail();
|
|
} else {
|
|
this.initMap();
|
|
}
|
|
await this.endLoading();
|
|
this.endLoading();
|
|
},
|
|
|
|
methods: {
|
|
handleChangeAgency(val) {
|
|
this.sarr = []
|
|
const map = new Map();
|
|
this.getLastItem(
|
|
this.orgOptions,
|
|
val,
|
|
"agencyId"
|
|
);
|
|
this.level = this.sarr[this.sarr.length - 1].level
|
|
},
|
|
getOrgTreeList() {
|
|
this.$http
|
|
.post('/gov/org/customeragency/agencygridtree', {})
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
return this.$message.error(res.msg)
|
|
} else {
|
|
console.log('获取组织树成功', res.data)
|
|
this.orgOptions = []
|
|
this.orgOptions.push(res.data)
|
|
}
|
|
})
|
|
.catch(() => {
|
|
return this.$message.error('网络错误')
|
|
})
|
|
},
|
|
addInput() {
|
|
this.inputList.push({ value: '' }); // 新增一个输入框,对应一个新的对象
|
|
},
|
|
removeInput(index) {
|
|
this.inputList.splice(index, 1); // 删除对应索引的输入框
|
|
},
|
|
onChangeFileList(e, rowIndex = 0) {
|
|
console.log('onChangeFileList', e)
|
|
if (e.length > 0) {
|
|
this.fileList = []
|
|
e.forEach(item => {
|
|
let ob = {
|
|
fileType: '0',
|
|
fileUrl: item.response.data.url
|
|
}
|
|
this.fileList.push(ob)
|
|
})
|
|
}
|
|
},
|
|
|
|
patrolAddd(){
|
|
this.patrolAdd=true
|
|
},
|
|
async loadCategory() {
|
|
const url = '/sys/dict/data/dictlist';
|
|
|
|
let params = {
|
|
dictType: 'safety_equipment_category'
|
|
};
|
|
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
if (code === 0) {
|
|
this.equipmentCategoryCodeArray = data;
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
async loadGrid() {
|
|
const url = '/gov/org/customergrid/gridoption';
|
|
let params = {
|
|
agencyId: this.agencyId,
|
|
purpose: 'query'
|
|
};
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
if (code === 0) {
|
|
this.gridList = data;
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
//场所类型
|
|
async loadplaceType() {
|
|
const url = '/gov/org/coverage/dict-select-list/enterprise_patrol';
|
|
let params = {
|
|
// agencyId: this.agencyId,
|
|
// purpose: 'query'
|
|
};
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
if (code === 0) {
|
|
this.placeTypeList = data;
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
async getDetail() {
|
|
const url = `/actual/base/monitoringEquipment/detail/${this.detailIdcopy}`;
|
|
const { data, code, msg } = await requestPost(url);
|
|
if (code === 0) {
|
|
console.log('详情数据', data);
|
|
this.formData = { ...data };
|
|
// this.remoteMethod("青岛");
|
|
// this.list = this.searchOptions.map(item => {
|
|
// return { value: item.value, label: item.label };
|
|
// });
|
|
// this.formData.location.push(this.list[0].value);
|
|
// this.remoteMethod(this.list[0].label);//调用远程搜索函数
|
|
|
|
|
|
// this.remoteMethod("对对对");
|
|
this.initMap();
|
|
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
|
|
handleComfirm() {
|
|
this.save();
|
|
},
|
|
async handleAdd() {
|
|
// this.btnDisable = true;
|
|
// setTimeout(() => {
|
|
// this.btnDisable = false;
|
|
// }, 10000);
|
|
// nextTick(1000);
|
|
// const form = new Promise((resolve, reject) => {
|
|
// this.$refs['form'].validate(valid => {
|
|
// if (valid) resolve();
|
|
// });
|
|
// });
|
|
// const form1 = new Promise((resolve, reject) => {
|
|
// this.$refs['form1'].validate(valid => {
|
|
// if (valid) resolve();
|
|
// });
|
|
// });
|
|
// Promise.all([form1, form])
|
|
// .then(() => {
|
|
// this.addFuwu();
|
|
// })
|
|
// .catch(() => {
|
|
// app.util.validateRule(messageObj);
|
|
// this.btnDisable = false;
|
|
// });
|
|
},
|
|
|
|
async save() {
|
|
console.log('this.formData', this.formData);
|
|
var url = '';
|
|
var params = {};
|
|
if (this.pageType == 'add') {
|
|
url = '/actual/base/monitoringEquipment/save';
|
|
} else {
|
|
url = '/actual/base/monitoringEquipment/update';
|
|
}
|
|
params = { ...this.formData };
|
|
const { data, code, msg } = await requestPost(url, params);
|
|
if (code === 0) {
|
|
this.$message.success('操作成功');
|
|
this.detailIdcopy=data
|
|
// this.handleCancle();
|
|
} else if (code >= 8000) {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
handleCancle() {
|
|
this.resetData();
|
|
this.$emit('handleClose');
|
|
},
|
|
resetData() {
|
|
this.$refs.form.resetFields();
|
|
},
|
|
// 开启加载动画
|
|
startLoading() {
|
|
loading = Loading.service({
|
|
lock: true, // 是否锁定
|
|
text: '正在加载……', // 加载中需要显示的文字
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色
|
|
});
|
|
},
|
|
// 结束加载动画
|
|
endLoading() {
|
|
// clearTimeout(timer);
|
|
if (loading) {
|
|
loading.close();
|
|
}
|
|
}, // 地图初始化函数,本例取名为init,开发者可根据实际情况定义
|
|
initMap() {
|
|
let { latitude, longitude } = this.$store.state.user;
|
|
|
|
if (this.formData.latitude && this.formData.longitude) {
|
|
latitude = this.formData.latitude;
|
|
longitude = this.formData.longitude;
|
|
}
|
|
if (!latitude || latitude == '' || latitude == '0') {
|
|
latitude = 39.9088810666821;
|
|
longitude = 116.39743841556731;
|
|
}
|
|
|
|
this.$nextTick(() => {
|
|
map = new daiMap(
|
|
document.getElementById('app_event'),
|
|
{ latitude, longitude },
|
|
{
|
|
zoom: 16.2, // 设置地图缩放级别
|
|
pitch: 43.5, // 设置俯仰角
|
|
rotation: 45 // 设置地图旋转角度
|
|
}
|
|
);
|
|
// 监听地图平移结束
|
|
map.on('dragend', e => {
|
|
if (!this.disabled) {
|
|
this.handleMoveCenter(e);
|
|
}
|
|
});
|
|
|
|
map.setCenter(latitude, longitude);
|
|
if (this.formData.latitude) {
|
|
map.setMarker(latitude, longitude);
|
|
}
|
|
});
|
|
},
|
|
async handleMoveCenter() {
|
|
//修改地图中心点
|
|
const { lat, lng } = map.getCenter();
|
|
this.formData.latitude = lat;
|
|
this.formData.longitude = lng;
|
|
map.setMarker(lat, lng);
|
|
|
|
let { msg, data } = await map.getAddress(lat, lng);
|
|
if (msg == 'success') {
|
|
this.formData.location = data.address;
|
|
this.searchValue = data.address;
|
|
this.searchOptions = [];
|
|
}
|
|
},
|
|
async remoteMethod(query) {
|
|
console.log("query",query)
|
|
if (query !== '') {
|
|
this.loading = true;
|
|
const { msg, data } = await map.searchNearby(query);
|
|
this.loading = false;
|
|
this.resultList = [];
|
|
|
|
if (msg == 'success' && data.resultList && data.resultList.length > 0) {
|
|
if (data.resultList && data.resultList.length > 0) {
|
|
this.resultList = data.resultList;
|
|
this.searchOptions = this.resultList.map(item => {
|
|
return { value: `${item.id}`, label: `${item.address + item.name}` };
|
|
});
|
|
console.log("this.searchOptions",this.searchOptions )
|
|
}
|
|
} else {
|
|
this.searchOptions = [
|
|
{
|
|
value: '0',
|
|
label: '未检索到结果'
|
|
}
|
|
];
|
|
}
|
|
} else {
|
|
this.searchOptions = [];
|
|
}
|
|
},
|
|
handleClickKey(index) {
|
|
let selPosition = this.resultList[index];
|
|
let lonlat = selPosition.lonlat.split(' ');
|
|
map.setCenter(lonlat[1], lonlat[0]);
|
|
map.setMarker(lonlat[1], lonlat[0]);
|
|
this.formData.latitude = lonlat[1];
|
|
this.formData.longitude = lonlat[0];
|
|
this.formData.location = selPosition.address + selPosition.name;
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@import '@/assets/scss/modules/management/form-main.scss';
|
|
@import '@/assets/scss/modules/management/form.scss';
|
|
@import '@/assets/scss/modules/visual/a_customize.scss';
|
|
.el-dialog__body {
|
|
padding: 30px 80px;
|
|
}
|
|
.div_btn {
|
|
display: flex;
|
|
}
|
|
.custom-tag {
|
|
font-size: 16px; /* 设置圆点大小 */
|
|
border: none; /* 去掉边框 */
|
|
}
|
|
</style>
|
|
|