Browse Source

社区自组织

V1.0
jiangyy 3 years ago
parent
commit
65e4044b27
  1. 379
      src/views/modules/communityService/sqzzz/cpts/edit.vue
  2. 177
      src/views/modules/shequzhili/event/cpts/add.vue

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

@ -1,246 +1,217 @@
<template>
<div>
<div class="dialog-h-content scroll-h">
<el-form
ref="ref_form"
<el-form ref="ref_form"
:inline="true"
:model="dataForm"
:rules="dataRule"
:disabled="formType === 'detail'"
class="form"
>
<el-form-item
label="组织名称 "
class="form">
<el-form-item label="组织名称 "
prop="organizationName"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入组织名称 "
v-model="dataForm.organizationName"
>
v-model="dataForm.organizationName">
</el-input>
</el-form-item>
<el-form-item
label="分类名称 "
<el-form-item label="分类名称 "
prop="categoryCode"
label-width="150px"
style="display: block"
>
<el-select
v-model="dataForm.categoryCode"
style="display: block">
<el-select v-model="dataForm.categoryCode"
placeholder="请选择"
clearable
>
<el-option
v-for="item in categoryList"
clearable>
<el-option v-for="item in categoryList"
:key="item.value"
:label="item.label"
:value="item.value"
>
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="组织人数 "
<el-form-item label="组织人数 "
prop="organizationPersonCount"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
type="number"
maxlength="50"
show-word-limit
placeholder="请输入组织人数 "
v-model="dataForm.organizationPersonCount"
>
v-model="dataForm.organizationPersonCount">
</el-input>
</el-form-item>
<el-form-item
label="组织成员 "
<el-form-item label="组织成员 "
prop="organizationPersonnel"
label-width="150px"
style="display: block"
>
style="display: block">
<div class="m-staffs">
<div
class="item"
<div class="item"
:key="'staff' + index"
v-for="(item, index) in dataForm.organizationPersonnel"
>
<el-autocomplete
class="item_width_1"
v-for="(item, index) in dataForm.organizationPersonnel">
<el-autocomplete class="item_width_1"
v-model="item.personName"
:fetch-suggestions="querySearchVolunteer"
placeholder="成员姓名"
:maxlength="50"
show-word-limit
@select="(vItem) => handleSelectVolunteer(index, vItem)"
:disabled="item.icResiUserId != ''"
></el-autocomplete>
:disabled="item.icResiUserId != ''"></el-autocomplete>
<el-input
style="margin-left: 10px"
<el-input style="margin-left: 10px"
class="item_width_1"
show-word-limit
placeholder="联系电话"
:disabled="item.icResiUserId != ''"
v-model="item.personPhone"
/>
v-model="item.personPhone" />
<el-button
style="margin-left: 10px"
<el-button style="margin-left: 10px"
size="small"
@click="handleDelStaff(index)"
>删除</el-button
>
@click="handleDelStaff(index)">删除</el-button>
</div>
<div class="item-add">
<el-button size="small" @click="handleAddStaff">添加</el-button>
<el-button size="small"
@click="handleAddStaff">添加</el-button>
</div>
</div>
</el-form-item>
<el-form-item
label="服务事项"
<el-form-item label="服务事项"
prop="serviceItem"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="1000"
show-word-limit
:rows="3"
placeholder="请输入服务事项,不超过1000字"
v-model="dataForm.serviceItem"
></el-input>
v-model="dataForm.serviceItem"></el-input>
</el-form-item>
<el-form-item
label="负责人 "
<el-form-item label="负责人 "
prop="principalName"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入负责人 "
v-model="dataForm.principalName"
>
v-model="dataForm.principalName">
</el-input>
</el-form-item>
<el-form-item
label="联系电话 "
<el-form-item label="联系电话 "
prop="principalPhone"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入联系电话 "
v-model="dataForm.principalPhone"
>
v-model="dataForm.principalPhone">
</el-input>
</el-form-item>
<el-form-item
label="创建时间"
<el-form-item label="创建时间"
prop="organizationCreatedTime"
label-width="150px"
style="display: block"
>
<el-date-picker
v-model="dataForm.organizationCreatedTime"
style="display: block">
<el-date-picker v-model="dataForm.organizationCreatedTime"
placeholder="创建时间"
value-format="yyyy-MM-dd"
>
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item
label="位置坐标"
<el-form-item label="地图位置"
prop="longitude"
label-width="150px"
style="display: block"
>
style="display: block">
<div style="width: 500px">
<el-input
class="item_width_4"
<!-- <el-input class="item_width_4"
maxlength="50"
placeholder="请输入关键字"
v-model="dataForm.address"
>
v-model="keyWords">
</el-input>
<el-button
style="margin-left: 10px"
<el-button style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap"
>查询</el-button
>
<div id="app" class="div_map"></div>
<div style="margin-top: 10px" v-show="false">
@click="handleSearchMap">查询</el-button> -->
<el-select v-model="searchValue"
filterable
style="width: 500px"
remote
:reserve-keyword="true"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<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>
<div id="app"
class="div_map"></div>
<!-- <div style="margin-top: 10px"
v-show="false">
<span>经度</span>
<el-input
class="item_width_3"
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="dataForm.longitude"
>
v-model="dataForm.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input
class="item_width_3"
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="dataForm.latitude"
>
v-model="dataForm.latitude">
</el-input>
</div> -->
</div>
</div>
</el-form-item>
<el-form-item
label="备注"
<el-form-item label="所在位置 "
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入位置 "
v-model="dataForm.address">
</el-input>
</el-form-item>
<el-form-item label="备注"
prop="remark"
label-width="150px"
style="display: block"
>
<el-input
class="item_width_1"
style="display: block">
<el-input class="item_width_1"
type="textarea"
maxlength="500"
show-word-limit
:rows="3"
placeholder="请输入备注,不超过500字"
v-model="dataForm.remark"
></el-input>
v-model="dataForm.remark"></el-input>
</el-form-item>
</el-form>
</div>
<div class="div_btn resi-btns">
<el-button size="small" @click="handleCancle"> </el-button>
<el-button
v-if="formType != 'detail'"
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button v-if="formType != 'detail'"
type="primary"
size="small"
:disabled="btnDisable"
@click="handleComfirm"
> </el-button
>
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
@ -263,10 +234,15 @@ var geocoder; // 新建一个正逆地址解析类
export default {
components: {},
props: {},
data() {
data () {
return {
formType: "add", // addeditdetail
searchOptions: [],
searchValue: '',
resultList: [],
loading: false,
btnDisable: false,
orgId: "",
@ -289,7 +265,7 @@ export default {
};
},
computed: {
dataRule() {
dataRule () {
return {
organizationName: [
{ required: true, message: "组织名称 不能为空", trigger: "blur" },
@ -324,14 +300,56 @@ export default {
},
watch: {},
async mounted() {
async mounted () {
this.getCategoryList();
this.getVolunteerList();
this.initMap();
},
methods: {
querySearchVolunteer(queryString, cb) {
async remoteMethod (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.hotPointID}`, label: `${item.address + item.name}` };
});
}
} 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.dataForm.latitude = lonlat[0];
this.dataForm.longitude = lonlat[1];
this.dataForm.address = selPosition.address + selPosition.name
},
querySearchVolunteer (queryString, cb) {
const { volunteerList } = this;
var results = queryString
? volunteerList.filter((item) => {
@ -342,7 +360,7 @@ export default {
cb(results);
},
handleSelectVolunteer(index, vItem) {
handleSelectVolunteer (index, vItem) {
this.dataForm.organizationPersonnel[index] = {
personName: vItem.name,
personPhone: vItem.mobile,
@ -350,7 +368,7 @@ export default {
};
},
async getVolunteerList() {
async getVolunteerList () {
const url = "/epmetuser/icresiuser/volunteer-list";
const params = {};
const { data, code, msg } = await requestPost(url, params);
@ -368,7 +386,7 @@ export default {
}
},
async getCategoryList() {
async getCategoryList () {
const url = "/sys/dict/data/dictlist";
const params = {
dictType: "self_org_category",
@ -380,21 +398,42 @@ export default {
this.$message.error(msg);
}
},
handleAddStaff() {
handleAddStaff () {
this.dataForm.organizationPersonnel = [
...this.dataForm.organizationPersonnel,
{ personName: "", personPhone: "", icResiUserId: "" },
];
},
handleDelStaff(index) {
handleDelStaff (index) {
const { organizationPersonnel } = this.dataForm;
organizationPersonnel.splice(index, 1);
this.dataForm.organizationPersonnel = organizationPersonnel;
},
// init
initMap() {
async initForm (type, row) {
this.$refs.ref_form.resetFields();
this.formType = type;
console.log(row);
let { latitude, longitude } = this.$store.state.user;
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.orgId = this.dataForm.orgId;
} else {
this.dataForm.latitude = latitude
this.dataForm.longitude = longitude
}
if (!map) {
this.initMap(this.dataForm.latitude, this.dataForm.longitude);
}
},
// init
initMap (latitude, longitude) {
map = new daiMap(
document.getElementById("app"),
@ -410,22 +449,27 @@ export default {
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
},
async handleSearchMap() {
const { msg, data } = await map.searchNearby(this.dataForm.address);
if (msg == "success") {
const { lat, lng } = data;
map.setCenter(lat, lng);
map.setMarker(lat, lng);
this.dataForm.latitude = lat;
this.dataForm.longitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
async handleMoveCenter(e) {
// async handleSearchMap () {
// const { msg, data } = await map.searchNearby(this.keyWords);
// if (msg == "success") {
// const { lat, lng } = data;
// map.setCenter(lat, lng);
// map.setMarker(lat, lng);
// this.dataForm.latitude = lat;
// this.dataForm.longitude = lng;
// this.handleMoveCenter()
// } else {
// this.$message.error("");
// }
// },
async handleMoveCenter () {
//
const { lat, lng } = map.getCenter();
this.dataForm.latitude = lat;
@ -434,28 +478,16 @@ export default {
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.dataForm.address = data.address;
this.dataForm.address = data.address
this.searchValue = data.address
this.searchOptions = []
}
},
async initForm(type, row) {
this.$refs.ref_form.resetFields();
this.formType = type;
console.log(row);
if (row) {
this.dataForm = { ...this.dataForm, ...row };
this.orgId = this.dataForm.orgId;
await nextTick(800);
if (map) {
map.setCenter(row.latitude, row.longitude);
map.setMarker(row.latitude, row.longitude);
}
}
},
async handleComfirm() {
async handleComfirm () {
this.btnDisable = true;
setTimeout(() => {
this.btnDisable = false;
@ -488,7 +520,7 @@ export default {
});
},
async submit() {
async submit () {
let url = "";
if (this.formType === "add") {
url = "/heart/iccommunityselforganization/addcommunityselforganization";
@ -516,11 +548,16 @@ export default {
}
},
handleCancle() {
handleCancle () {
this.resetData();
this.$emit("dialogCancle");
},
resetData() {
resetData () {
this.searchValue = ''
this.searchOptions = []
this.resultList = []
this.orgId = "";
this.dataForm = {
organizationName: "",
@ -538,7 +575,7 @@ export default {
};
},
//
startLoading() {
startLoading () {
loading = Loading.service({
lock: true, //
text: "正在加载……", //
@ -546,7 +583,7 @@ export default {
});
},
//
endLoading() {
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close();

177
src/views/modules/shequzhili/event/cpts/add.vue

@ -143,34 +143,33 @@
label-width="150px"
style="display: block">
<div style="width: 500px">
<div class="div_map">
<div id="app"></div>
<div class="div_searchmap">
<el-input class="cell-width-map"
<el-input class="item_width_4"
maxlength="50"
size="mini"
placeholder="请输入关键字"
v-model="keyWords">
v-model="formData.address">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="mini"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
</div>
</div>
<!-- <div style="margin-top: 10px">
<div id="map_event"
class="div_map"></div>
<!-- <div style="margin-top: 10px" v-show="false">
<span>经度</span>
<el-input class="item_width_3"
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="formData.longitude">
v-model="formData.longitude"
>
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
<el-input
class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="formData.latitude">
v-model="formData.latitude"
>
</el-input>
</div> -->
</div>
@ -238,7 +237,7 @@
import { Loading } from "element-ui"; // Loading
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
import daiMap from "@/utils/dai-map";
import { isCard } from "@/utils/validate";
let loading; //
@ -388,6 +387,7 @@ export default {
async mounted () {
const { user } = this.$store.state;
this.agencyId = user.agencyId;
let { latitude, longitude } = this.$store.state.user;
if (!latitude || latitude == "" || latitude == "0") {
latitude = 39.9088810666821;
@ -398,6 +398,10 @@ export default {
this.formData.longitude = longitude;
this.initMap();
map.setCenter(this.formData.latitude, this.formData.longitude);
map.setMarker(this.formData.latitude, this.formData.longitude);
this.handleMoveCenter()
this.loadGrid();
this.getCategoryList();
},
@ -567,126 +571,47 @@ export default {
// init
initMap () {
//
var center = new window.TMap.LatLng(
this.formData.latitude,
this.formData.longitude
);
// map TMap.Map()
map = new window.TMap.Map(document.getElementById("app"), {
center: center, //
let { latitude, longitude } = this.$store.state.user;
map = new daiMap(
document.getElementById("map_event"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
});
search = new window.TMap.service.Search({ pageSize: 10 });
//
markers = new TMap.MultiMarker({
map: map,
geometries: [],
});
infoWindowList = Array(10);
geocoder = new TMap.service.Geocoder(); //
}
);
//
map.on("panend", () => {
this.handleMoveCenter();
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
this.handleMoveCenter();
// this.convert()
},
setMarker (lat, lng) {
markers.setGeometries([]);
markers.add([
{
id: "4",
styleId: "marker",
position: new TMap.LatLng(lat, lng),
properties: {
title: "marker4",
},
},
]);
},
handleSearchMap () {
infoWindowList.forEach((infoWindow) => {
infoWindow.close();
});
infoWindowList.length = 0;
markers.setGeometries([]);
//
search
.searchNearby({
keyword: this.keyWords,
radius: 1000,
autoExtend: true,
center: map.getCenter(),
})
.then((result) => {
let { data } = result;
if (Array.isArray(data) && data.length > 0) {
const {
location: { lat, lng },
} = data[0];
map.setCenter(new TMap.LatLng(lat, lng));
this.setMarker(lat, lng);
async handleSearchMap () {
const { msg, data } = await map.searchNearby(this.formData.address);
if (msg == "success") {
const { lat, lng } = data;
map.setCenter(lat, lng);
map.setMarker(lat, lng);
this.formData.latitude = lat;
this.formData.longitude = lng;
this.convert();
} else {
this.$message.error("未检索到相关位置坐标");
}
});
},
handleMoveCenter () {
async handleMoveCenter (e) {
//
const center = map.getCenter();
const lat = center.getLat();
const lng = center.getLng();
const { lat, lng } = map.getCenter();
this.formData.latitude = lat;
this.formData.longitude = lng;
this.setMarker(lat, lng);
this.convert(lat, lng);
},
map.setMarker(lat, lng);
convert (lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location;
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(
this.formData.latitude,
this.formData.longitude
);
let { msg, data } = await map.getAddress(lat, lng);
if (msg == "success") {
this.formData.address = data.address;
}
// map.setCenter(location);
markers.updateGeometries([
{
id: "main", //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
if (!this.isFirst) {
//
this.formData.address = result.result.address;
}
if (this.isFirst) {
this.isFirst = false;
}
});
},
resetData () {
@ -711,11 +636,17 @@ export default {
},
};
</script>
<style
lang="scss"
src="@/assets/scss/modules/shequzhili/event-info.scss"
scoped
></style>
<style lang="scss" scoped>
@import "@/assets/scss/modules/shequzhili/event-info.scss";
.item_width_4 {
width: 350px;
}
.div_map {
margin-top: 10px;
}
</style>
<style lang="scss">
.el-dialog__body {

Loading…
Cancel
Save