Browse Source

界面高度、地图不显示经纬度

shibei_master
dai 3 years ago
parent
commit
ed7ac80be6
  1. 1
      package.json
  2. 21
      src/views/modules/communityService/dqfwzx/cpts/edit.vue
  3. 10
      src/views/modules/communityService/sqzzz/cpts/edit.vue
  4. 47
      src/views/modules/cpts/base/cpts/edit.vue
  5. 30
      src/views/modules/cpts/base/index.vue
  6. 8
      src/views/modules/shequzhili/tuceng/anquan/weihua/index.vue
  7. 8
      src/views/modules/shequzhili/tuceng/anquan/xuncha/index.vue
  8. 8
      src/views/modules/shequzhili/tuceng/yingji/ziyuan/index.vue
  9. 4
      src/views/modules/shequzhili/tuceng/zhonghe/base.vue

1
package.json

@ -18,6 +18,7 @@
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "^0.4.0", "@riophae/vue-treeselect": "^0.4.0",
"@tinymce/tinymce-vue": "^3.2.8", "@tinymce/tinymce-vue": "^3.2.8",
"async-validator": "^4.2.5",
"axios": "^0.19.0", "axios": "^0.19.0",
"babel-eslint": "^8.0.1", "babel-eslint": "^8.0.1",
"babel-plugin-component": "^1.1.1", "babel-plugin-component": "^1.1.1",

21
src/views/modules/communityService/dqfwzx/cpts/edit.vue

@ -140,7 +140,7 @@
>查询</el-button >查询</el-button
> >
<div id="app" class="div_map"></div> <div id="app" class="div_map"></div>
<div style="margin-top: 10px"> <div style="margin-top: 10px" v-show="false">
<span>经度</span> <span>经度</span>
<el-input <el-input
class="item_width_3" class="item_width_3"
@ -292,6 +292,7 @@ var search;
var markers; var markers;
var infoWindowList; var infoWindowList;
let loading; // let loading; //
var geocoder; //
export default { export default {
data() { data() {
@ -461,11 +462,13 @@ export default {
}); });
infoWindowList = Array(10); infoWindowList = Array(10);
geocoder = new TMap.service.Geocoder(); //
// //
map.on("panend", () => { map.on("panend", (e) => {
this.handleMoveCenter(); this.handleMoveCenter(e);
}); });
this.handleMoveCenter(); // this.handleMoveCenter();
}, },
setMarker(lat, lng) { setMarker(lat, lng) {
@ -510,7 +513,7 @@ export default {
}); });
}, },
handleMoveCenter() { handleMoveCenter(e) {
// //
const center = map.getCenter(); const center = map.getCenter();
const lat = center.getLat(); const lat = center.getLat();
@ -518,6 +521,14 @@ export default {
this.dataForm.latitude = lat; this.dataForm.latitude = lat;
this.dataForm.longitude = lng; this.dataForm.longitude = lng;
this.setMarker(lat, lng); this.setMarker(lat, lng);
if (e && e.originalEvent) {
geocoder
.getAddress({ location: new TMap.LatLng(lat, lng) }) //
.then((result) => {
this.dataForm.locationAddress = result.result.address;
});
}
}, },
async initForm(type, row) { async initForm(type, row) {

10
src/views/modules/communityService/sqzzz/cpts/edit.vue

@ -186,13 +186,13 @@
</el-input> </el-input>
<el-button <el-button
style="margin-left: 10px" style="margin-left: 10px"
type="primary" type="default"
size="small" size="small"
@click="handleSearchMap" @click="handleSearchMap"
>查询</el-button >查询</el-button
> >
<div id="app" class="div_map"></div> <div id="app" class="div_map"></div>
<div style="margin-top: 10px"> <div style="margin-top: 10px" v-show="false">
<span>经度</span> <span>经度</span>
<el-input <el-input
class="item_width_3" class="item_width_3"
@ -315,7 +315,7 @@ export default {
{ required: true, message: "联系电话不能为空", trigger: "blur" }, { required: true, message: "联系电话不能为空", trigger: "blur" },
], ],
longitude: [ longitude: [
{ required: true, message: "位置坐标不能为空", trigger: "blur" }, { required: true, message: "请拖动地图选择坐标点", trigger: "blur" },
], ],
}; };
}, },
@ -420,7 +420,7 @@ export default {
map.on("panend", (e) => { map.on("panend", (e) => {
this.handleMoveCenter(e); this.handleMoveCenter(e);
}); });
this.handleMoveCenter(); // this.handleMoveCenter();
}, },
setMarker(lat, lng) { setMarker(lat, lng) {
@ -613,7 +613,7 @@ export default {
width: 200px; width: 200px;
} }
.item_width_4 { .item_width_4 {
width: 200px; width: 430px;
} }
.div_map { .div_map {

47
src/views/modules/cpts/base/cpts/edit.vue

@ -110,11 +110,12 @@
style="margin-left: 10px" style="margin-left: 10px"
type="default" type="default"
size="small" size="small"
ref="mapSearch"
@click="handleSearchMap(item)" @click="handleSearchMap(item)"
>查询</el-button >查询</el-button
> >
<div id="app" class="div_map"></div> <div id="app" class="div_map"></div>
<div style="margin-top: 10px"> <div style="margin-top: 10px" v-show="false">
<span>经度</span> <span>经度</span>
<el-input <el-input
class="address-item-input2" class="address-item-input2"
@ -241,7 +242,7 @@
>查询</el-button >查询</el-button
> >
<div id="app" class="div_map"></div> <div id="app" class="div_map"></div>
<div style="margin-top: 10px"> <div style="margin-top: 10px" v-show="false">
<span>经度</span> <span>经度</span>
<el-input <el-input
class="address-item-input2" class="address-item-input2"
@ -301,6 +302,7 @@
<script> <script>
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import nextTick from "dai-js/tools/nextTick"; import nextTick from "dai-js/tools/nextTick";
import Schema from "async-validator";
var map; var map;
var search; var search;
@ -349,14 +351,16 @@ export default {
}, },
editFixedParams: { editFixedParams: {
type: Object, type: Object,
default: () => { default: () => ({}),
return {};
},
}, },
editParamsDiv: { editParamsDiv: {
type: Number, type: Number,
default: 0, default: 0,
}, },
editElseRules: {
type: Object,
default: () => ({}),
},
}, },
data() { data() {
@ -460,7 +464,7 @@ export default {
// map TMap.Map() // map TMap.Map()
map = new window.TMap.Map(document.getElementById("app"), { map = new window.TMap.Map(document.getElementById("app"), {
center: center, // center: center, //
zoom: 17.2, // zoom: 15, //
pitch: 43.5, // pitch: 43.5, //
rotation: 45, // rotation: 45, //
}); });
@ -479,7 +483,7 @@ export default {
map.on("panend", (e) => { map.on("panend", (e) => {
this.handleMoveCenter(item, e); this.handleMoveCenter(item, e);
}); });
this.handleMoveCenter(item); // this.handleMoveCenter(item);
}, },
setMarker(lat, lng) { setMarker(lat, lng) {
@ -569,8 +573,15 @@ export default {
console.log("------------------------------------info", this.fmData); console.log("------------------------------------info", this.fmData);
await nextTick(800); await nextTick(800);
if (map && data.latitude) { if (map) {
map.setCenter(new TMap.LatLng(data.latitude, data.longitude)); if (data.latitude) {
map.setCenter(new TMap.LatLng(data.latitude, data.longitude));
} else {
if (this.$refs && this.$refs.mapSearch) {
console.log(this.$refs.mapSearch[0].handleClick);
this.$refs.mapSearch[0].handleClick();
}
}
} }
} else { } else {
this.$message.error(msg); this.$message.error(msg);
@ -587,12 +598,28 @@ export default {
this.btnDisable = false; this.btnDisable = false;
}, 5000); }, 5000);
console.log(this.$refs["ref_form"]);
this.$refs["ref_form"].validate((valid, messageObj) => { this.$refs["ref_form"].validate((valid, messageObj) => {
console.log(valid, messageObj);
if (!valid) { if (!valid) {
app.util.validateRule(messageObj); app.util.validateRule(messageObj);
this.btnDisable = false; this.btnDisable = false;
} else { } else {
this.submit(); if (this.editElseRules) {
const validator = new Schema(this.editElseRules);
validator
.validate(this.fmData)
.then(() => {
this.submit();
})
.catch(({ err, fields }) => {
console.log("--------------", err, fields);
app.util.validateRule(fields);
});
} else {
this.submit();
}
} }
}); });
}, },

30
src/views/modules/cpts/base/index.vue

@ -1,7 +1,7 @@
<template> <template>
<div class="div_main"> <div class="div_main">
<div v-show="true"> <div v-show="true">
<div class="div_search"> <div class="div_search" ref="ref_search">
<el-form :inline="true" ref="ref_searchform" label-width="100px"> <el-form :inline="true" ref="ref_searchform" label-width="100px">
<div> <div>
<el-form-item <el-form-item
@ -211,6 +211,7 @@
:editUrl="editUrl" :editUrl="editUrl"
:editParams="editParams" :editParams="editParams"
:editParamsDiv="editParamsDiv" :editParamsDiv="editParamsDiv"
:editElseRules="editElseRules"
:editFixedParams="editFixedParams" :editFixedParams="editFixedParams"
:formBtnFixed="formBtnFixed" :formBtnFixed="formBtnFixed"
@close="handleClose" @close="handleClose"
@ -234,6 +235,7 @@ import { requestPost } from "@/js/dai/request";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import axios from "axios"; import axios from "axios";
import editForm from "./cpts/edit"; import editForm from "./cpts/edit";
import nextTick from "dai-js/tools/nextTick";
export default { export default {
components: { editForm }, components: { editForm },
@ -304,11 +306,13 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
editElseRules: {
type: Object,
default: () => ({}),
},
editFixedParams: { editFixedParams: {
type: Object, type: Object,
default: () => { default: () => ({}),
return {};
},
}, },
editParamsDiv: { editParamsDiv: {
type: Number, type: Number,
@ -338,21 +342,24 @@ export default {
formShow: false, formShow: false,
formTitle: "详情", formTitle: "详情",
formType: "", // list add edit info formType: "", // list add edit info
ref_search_height: 100,
}; };
}, },
computed: { computed: {
maxTableHeight() { maxTableHeight() {
const { ref_search_height } = this;
return this.$store.state.inIframe return this.$store.state.inIframe
? this.clientHeight - 410 + this.iframeHeigh ? this.clientHeight - ref_search_height - 260 + this.iframeHeight
: this.clientHeight - 410; : this.clientHeight - ref_search_height - 260;
}, },
...mapGetters(["clientHeight", "iframeHeight"]), ...mapGetters(["clientHeight", "iframeHeight"]),
}, },
watch: {}, watch: {},
mounted() { async mounted() {
console.log(this.$store.state); console.log(this.$store.state);
this.user = this.$store.state.user; this.user = this.$store.state.user;
@ -361,8 +368,17 @@ export default {
this.iniSearchData(); this.iniSearchData();
this.getTableData(); this.getTableData();
await nextTick(100);
this.computeSearchHeight();
}, },
methods: { methods: {
computeSearchHeight() {
this.ref_search_height = this.$refs["ref_search"].clientHeight;
console.log(this.$refs["ref_search"]);
console.log(this.ref_search_height);
},
iniSearchData() { iniSearchData() {
const { searchParams } = this; const { searchParams } = this;
searchParams.forEach((item, index) => { searchParams.forEach((item, index) => {

8
src/views/modules/shequzhili/tuceng/anquan/weihua/index.vue

@ -12,6 +12,7 @@
:importUrl="importUrl" :importUrl="importUrl"
:mubanUrl="mubanUrl" :mubanUrl="mubanUrl"
:editParams="editParams" :editParams="editParams"
:editElseRules="editElseRules"
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" :editBtnName="(item) => (!item.latitude ? '待完善' : '修改')"
idName="icDangerousChemicalsId" idName="icDangerousChemicalsId"
></base-page> ></base-page>
@ -148,6 +149,13 @@ export default {
}, },
{ field: "备注", keyName: "remark", type: "textarea" }, { field: "备注", keyName: "remark", type: "textarea" },
], ],
editElseRules: {
longitude: {
type: "number",
required: true,
message: "请拖动地图选择坐标点",
},
},
}; };
}, },
components: { basePage }, components: { basePage },

8
src/views/modules/shequzhili/tuceng/anquan/xuncha/index.vue

@ -14,6 +14,7 @@
:importUrl="importUrl" :importUrl="importUrl"
:mubanUrl="mubanUrl" :mubanUrl="mubanUrl"
:editParams="editParams" :editParams="editParams"
:editElseRules="editElseRules"
:editFixedParams="editFixedParams" :editFixedParams="editFixedParams"
:editParamsDiv="5" :editParamsDiv="5"
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" :editBtnName="(item) => (!item.latitude ? '待完善' : '修改')"
@ -228,6 +229,13 @@ export default {
editFixedParams: { editFixedParams: {
agencyId: this.$store.state.user.agencyId, agencyId: this.$store.state.user.agencyId,
}, },
editElseRules: {
longitude: {
type: "number",
required: true,
message: "请拖动地图选择坐标点",
},
},
}; };
}, },
computed: {}, computed: {},

8
src/views/modules/shequzhili/tuceng/yingji/ziyuan/index.vue

@ -12,6 +12,7 @@
:importUrl="importUrl" :importUrl="importUrl"
:mubanUrl="mubanUrl" :mubanUrl="mubanUrl"
:editParams="editParams" :editParams="editParams"
:editElseRules="editElseRules"
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" :editBtnName="(item) => (!item.latitude ? '待完善' : '修改')"
idName="icSuperiorResourceId" idName="icSuperiorResourceId"
></base-page> ></base-page>
@ -119,6 +120,13 @@ export default {
], ],
}, },
], ],
editElseRules: {
longitude: {
type: "number",
required: true,
message: "请拖动地图选择坐标点",
},
},
}; };
}, },
components: { basePage }, components: { basePage },

4
src/views/modules/shequzhili/tuceng/zhonghe/base.vue

@ -194,7 +194,7 @@
<el-table-column <el-table-column
prop="HOME_ID" prop="HOME_ID"
label="所属家庭" label="所属房屋"
align="center" align="center"
min-width="160" min-width="160"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
@ -212,7 +212,7 @@
prop="MOBILE" prop="MOBILE"
width="140" width="140"
align="center" align="center"
label="手机" label="手机"
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
> >
</el-table-column> </el-table-column>

Loading…
Cancel
Save