-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
-
-
-
-
-
删除
+
+ handleSelectVolunteer(index, vItem)"
+ :disabled="item.icResiUserId != ''"
+ >
+
+
+
+ 删除
- 添加
+ 添加
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
- 查询
-
+ 查询
+
经度
-
+
纬度
-
+
-
-
+
+
- 取 消
- 确 定
+ 取 消
+ 确 定
@@ -189,15 +250,19 @@ import { mapGetters } from "vuex";
import { Loading } from "element-ui"; // 引入Loading服务
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
+import nextTick from "dai-js/tools/nextTick";
var map;
var search;
var markers;
var infoWindowList;
let loading; // 加载动画
+var geocoder; // 新建一个正逆地址解析类
export default {
- data () {
+ components: {},
+ props: {},
+ data() {
return {
formType: "add", //表单操作类型 add新增,edit编辑,detail详情
@@ -219,11 +284,11 @@ export default {
organizationPersonnel: [],
},
categoryList: [],
+ volunteerList: [],
};
},
- components: {},
computed: {
- dataRule () {
+ dataRule() {
return {
organizationName: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" },
@@ -255,18 +320,53 @@ export default {
};
},
},
- props: {},
watch: {},
- async created () {
+ async mounted() {
this.getCategoryList();
- },
- async mounted () {
+ this.getVolunteerList();
this.initMap();
},
methods: {
- async getCategoryList () {
+ querySearchVolunteer(queryString, cb) {
+ const { volunteerList } = this;
+ var results = queryString
+ ? volunteerList.filter((item) => {
+ return item.value.indexOf(queryString) !== -1;
+ })
+ : volunteerList;
+ // 调用 callback 返回建议列表的数据
+ cb(results);
+ },
+
+ handleSelectVolunteer(index, vItem) {
+ this.dataForm.organizationPersonnel[index] = {
+ personName: vItem.name,
+ personPhone: vItem.mobile,
+ icResiUserId: vItem.icResiUserId,
+ };
+ },
+
+ async getVolunteerList() {
+ const url = "/epmetuser/icresiuser/volunteer-list";
+ const params = {};
+ const { data, code, msg } = await requestPost(url, params);
+ if (code === 0) {
+ this.volunteerList = data.map((item) => {
+ return {
+ name: item.name,
+ value: item.label,
+ mobile: item.mobile,
+ icResiUserId: item.icResiUserId,
+ };
+ });
+ } else {
+ this.$message.error(msg);
+ }
+ },
+
+ async getCategoryList() {
const url = "/sys/dict/data/dictlist";
const params = {
dictType: "self_org_category",
@@ -278,19 +378,19 @@ export default {
this.$message.error(msg);
}
},
- handleAddStaff () {
+ handleAddStaff() {
this.dataForm.organizationPersonnel = [
...this.dataForm.organizationPersonnel,
- { personName: "", personPhone: "" },
+ { personName: "", personPhone: "", icResiUserId: "" },
];
},
- handleDelStaff (index) {
+ handleDelStaff(index) {
const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel;
},
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义
- initMap () {
+ initMap() {
// 定义地图中心点坐标
var center = new window.TMap.LatLng(36.0722275, 120.38945519);
// 定义map变量,调用 TMap.Map() 构造函数创建地图
@@ -309,14 +409,16 @@ export default {
});
infoWindowList = Array(10);
+ geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
+
// 监听地图平移结束
- map.on("panend", () => {
- this.handleMoveCenter();
+ map.on("panend", (e) => {
+ this.handleMoveCenter(e);
});
this.handleMoveCenter();
},
- setMarker (lat, lng) {
+ setMarker(lat, lng) {
markers.setGeometries([]);
markers.add([
{
@@ -330,7 +432,7 @@ export default {
]);
},
- handleSearchMap () {
+ handleSearchMap() {
infoWindowList.forEach((infoWindow) => {
infoWindow.close();
});
@@ -358,7 +460,8 @@ export default {
});
},
- handleMoveCenter () {
+ handleMoveCenter(e) {
+ console.log(e);
//修改地图中心点
const center = map.getCenter();
const lat = center.getLat();
@@ -366,9 +469,17 @@ export default {
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
this.setMarker(lat, lng);
+
+ if (e && e.originalEvent) {
+ geocoder
+ .getAddress({ location: new TMap.LatLng(lat, lng) }) // 将给定的坐标位置转换为地址
+ .then((result) => {
+ this.dataForm.address = result.result.address;
+ });
+ }
},
- async initForm (type, row) {
+ async initForm(type, row) {
this.$refs.ref_form.resetFields();
this.formType = type;
@@ -376,11 +487,15 @@ export default {
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.orgId = this.dataForm.orgId;
- map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
+
+ await nextTick(800);
+ if (map) {
+ map.setCenter(new TMap.LatLng(row.latitude, row.longitude));
+ }
}
},
- async handleComfirm () {
+ async handleComfirm() {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
@@ -400,10 +515,7 @@ export default {
dataForm: { organizationPersonnel },
} = this;
let vlt = organizationPersonnel.every((item) => {
- return (
- item.personName &&
- item.personPhone
- );
+ return item.personName && item.personPhone;
});
if (!vlt) {
return this.$message({
@@ -416,7 +528,7 @@ export default {
});
},
- async submit () {
+ async submit() {
let url = "";
if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization";
@@ -444,11 +556,11 @@ export default {
}
},
- handleCancle () {
+ handleCancle() {
this.resetData();
this.$emit("dialogCancle");
},
- resetData () {
+ resetData() {
this.orgId = "";
this.dataForm = {
organizationName: "",
@@ -466,7 +578,7 @@ export default {
};
},
// 开启加载动画
- startLoading () {
+ startLoading() {
loading = Loading.service({
lock: true, // 是否锁定
text: "正在加载……", // 加载中需要显示的文字
@@ -474,7 +586,7 @@ export default {
});
},
// 结束加载动画
- endLoading () {
+ endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
diff --git a/src/views/modules/shequzhili/tuceng/zhonghe/base.vue b/src/views/modules/shequzhili/tuceng/zhonghe/base.vue
index 0df94681..e1279300 100644
--- a/src/views/modules/shequzhili/tuceng/zhonghe/base.vue
+++ b/src/views/modules/shequzhili/tuceng/zhonghe/base.vue
@@ -277,6 +277,23 @@
:gridName="currentPepeleGridName"
@close="showedPeopleMoreInfo = false"
/>
+
+
+
+