Browse Source

转服务的坑

dev-登录返回旧业面
dai 3 years ago
parent
commit
affd6ba55d
  1. 579
      src/views/modules/shequzhili/event/cpts/process-form-demand.vue

579
src/views/modules/shequzhili/event/cpts/process-form-demand.vue

@ -1,10 +1,12 @@
<template>
<div class="">
<el-form ref="ref_form"
<el-form
ref="ref_form"
:inline="false"
:model="formData"
:rules="dataRule"
label-width="100px">
label-width="100px"
>
<!-- <el-form-item label="事件分类"
label-width="150px"
prop="categoryId">
@ -17,105 +19,124 @@
:show-all-levels="false"
@change="handleChangeCate"></el-cascader>
</el-form-item> -->
<el-form-item label="服务内容"
<el-form-item
label="服务内容"
label-width="150px"
:class="{'form-item':source==='visiual'}"
prop="content">
<div :class="{'visiual-form':source==='visiual'}">
<el-input v-model="formData.content"
:class="{ 'form-item': source === 'visiual' }"
prop="content"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-input
v-model="formData.content"
:autosize="{ minRows: 2, maxRows: 10 }"
type="textarea"
clearable
class="cell-width-area"
placeholder="请输入内容"></el-input>
placeholder="请输入内容"
></el-input>
</div>
</el-form-item>
<el-form-item label="服务类型"
<el-form-item
label="服务类型"
label-width="150px"
:class="{'form-item':source==='visiual'}"
prop="categoryCode">
<div :class="{'visiual-form':source==='visiual'}">
<el-cascader v-model="formData.categoryCode"
:class="{ 'form-item': source === 'visiual' }"
prop="categoryCode"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-cascader
v-model="formData.categoryCode"
:options="demandOptions"
clearable
class="cell-width-1"
@change="handleCateSlect"></el-cascader>
@change="handleCateSlect"
></el-cascader>
</div>
</el-form-item>
<el-form-item label="服务时间"
<el-form-item
label="服务时间"
label-width="150px"
:class="{'form-item':source==='visiual'}"
prop="wantServiceTime">
<div :class="{'visiual-form':source==='visiual'}">
<el-date-picker v-model="formData.wantServiceTime"
:class="{ 'form-item': source === 'visiual' }"
prop="wantServiceTime"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-date-picker
v-model="formData.wantServiceTime"
type="datetime"
class="cell-width-1"
clearable
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
placeholder="选择日期时间"
>
</el-date-picker>
</div>
</el-form-item>
<el-form-item label="需求人"
<el-form-item
label="需求人"
label-width="150px"
:class="{'form-item':source==='visiual'}"
prop="demandUserName">
<div :class="{'visiual-form':source==='visiual'}">
<el-input v-model="formData.demandUserName"
class="cell-width-1"></el-input>
:class="{ 'form-item': source === 'visiual' }"
prop="demandUserName"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-input
v-model="formData.demandUserName"
class="cell-width-1"
></el-input>
</div>
</el-form-item>
<el-form-item label="联系电话"
<el-form-item
label="联系电话"
label-width="150px"
:class="{'form-item':source==='visiual'}"
prop="demandUserMobile">
<div :class="{'visiual-form':source==='visiual'}">
<el-input v-model="formData.demandUserMobile"
class="cell-width-1"></el-input>
:class="{ 'form-item': source === 'visiual' }"
prop="demandUserMobile"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-input
v-model="formData.demandUserMobile"
class="cell-width-1"
></el-input>
</div>
</el-form-item>
<el-form-item label="服务地点"
<el-form-item
label="服务地点"
prop="serviceLocation"
:class="{'form-item':source==='visiual'}"
:class="{ 'form-item': source === 'visiual' }"
label-width="150px"
style="display: block">
<div :class="{'visiual-form':source==='visiual'}">
<el-input class="cell-width-1"
v-model="formData.serviceLocation">
style="display: block"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-input class="cell-width-1" v-model="formData.serviceLocation">
</el-input>
</div>
</el-form-item>
<el-form-item label="位置坐标"
:class="{'form-item':source==='visiual'}"
<el-form-item
label="位置坐标"
:class="{ 'form-item': source === 'visiual' }"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
style="display: block"
>
<div style="width: 500px">
<div class="div_map">
<div id="app_map">
</div>
<div id="app_map"></div>
<div class="div_searchmap">
<el-input class="cell-width-map"
<el-input
class="cell-width-map"
maxlength="50"
size="mini"
placeholder="请输入关键字"
v-model="keyWords">
v-model="keyWords"
>
</el-input>
<el-button style="margin-left: 10px"
<el-button
style="margin-left: 10px"
type="primary"
size="mini"
@click="handleSearchMap">查询</el-button>
@click="handleSearchMap"
>查询</el-button
>
</div>
</div>
@ -136,103 +157,108 @@
</div>
</el-form-item>
<el-form-item label="门牌号"
:class="{'form-item':source==='visiual'}"
<el-form-item
label="门牌号"
:class="{ 'form-item': source === 'visiual' }"
label-width="150px"
prop="locationDetail">
<div :class="{'visiual-form':source==='visiual'}">
<el-input v-model="formData.locationDetail"
class="cell-width-1"></el-input>
prop="locationDetail"
>
<div :class="{ 'visiual-form': source === 'visiual' }">
<el-input
v-model="formData.locationDetail"
class="cell-width-1"
></el-input>
</div>
</el-form-item>
<el-form-item label="服务方"
:class="{'form-item':source==='visiual'}"
<el-form-item
label="服务方"
:class="{ 'form-item': source === 'visiual' }"
label-width="150px"
prop="serverId">
prop="serverId"
>
<template>
<div :class="[{'single-select':source==='visiual'},'sel-service']">
<el-select v-model="formData.serviceType"
<div
:class="[{ 'single-select': source === 'visiual' }, 'sel-service']"
>
<el-select
v-model="formData.serviceType"
class="cell-width-1"
placeholder="请选择"
clearable
@change="handleServiceChange('add', $event)">
<el-option v-for="item in serviceOptions"
@change="handleServiceChange('add', $event)"
>
<el-option
v-for="item in serviceOptions"
:key="item.value"
:label="item.label"
:value="item.value">
:value="item.value"
>
</el-option>
</el-select>
-
<el-select v-model="formData.serverId"
<el-select
v-model="formData.serverId"
class="cell-width-1"
filterable
placeholder="请选择"
clearable>
<el-option v-for="item in serviceOptiondList"
clearable
>
<el-option
v-for="item in serviceOptiondList"
:key="item.value"
:label="item.label"
:value="item.value">
:value="item.value"
>
</el-option>
</el-select>
</div>
</template>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { Loading } from "element-ui"; // Loading
import { requestPost } from "@/js/dai/request";
import formVltHelper from "dai-js/tools/formVltHelper";
import { isCard } from "@/utils/validate";
import daiMap from "@/utils/dai-map";
let loading; //
var map
var search
var markers
var infoWindowList
var geocoder //
var map;
function iniFmData () {
function iniFmData() {
return {
operationType: '2',//[0: 1: 2:]
icEventId: '',//Id
gridId: '',//
categoryCode: '',//
parentCode: '',//
content: '',// 1000
reportType: 'self_help',// communitybuilding_caption;party;self_help
reportUserName: '',//
reportUserMobile: '',//
reportTime: '',//
demandUserId: '',// user.idic_resi_user.id
demandUserName: '',//
demandUserMobile: '',//
wantServiceTime: '',//
serviceType: '',
serverId: '',
locationDetail: '',
serviceLocation: '',//
latitude: '',//
longitude: '',//
operationType: "2", //[0: 1: 2:]
icEventId: "", //Id
gridId: "", //
categoryCode: "", //
parentCode: "", //
content: "", // 1000
reportType: "self_help", // communitybuilding_caption;party;self_help
reportUserName: "", //
reportUserMobile: "", //
reportTime: "", //
demandUserId: "", // user.idic_resi_user.id
demandUserName: "", //
demandUserMobile: "", //
wantServiceTime: "", //
serviceType: "",
serverId: "",
locationDetail: "",
serviceLocation: "", //
latitude: "", //
longitude: "", //
// categoryId: ''
};
}
export default {
data () {
data() {
return {
btnDisable: false,
customerId: localStorage.getItem("customerId"),
demandOptions: [],
serviceOptions: [
],
serviceOptions: [],
serviceOptiondList: [],
casOptions: [],
@ -241,25 +267,25 @@ export default {
selCateObj: {},
optionProps: {
multiple: false,
value: 'id',
label: 'name',
children: 'subCategory',
value: "id",
label: "name",
children: "subCategory",
},
formData: iniFmData(),
okflag: false,
//
keyWords: '',
keyWords: "",
eventDetailCopy: {}
eventDetailCopy: {},
};
},
components: {},
computed: {
dataRule () {
computed: {
dataRule() {
return {
// categoryId: [
// { required: true, message: "", trigger: "blur" },
@ -285,14 +311,11 @@ export default {
serverId: [
{ required: true, message: "服务方不能为空", trigger: "blur" },
],
};
},
},
props: {
props: {
demandUserId: {
type: String,
default: "",
@ -312,156 +335,142 @@ export default {
eventDetailData: {
type: Object,
default () {
return {}
}
default() {
return {};
},
},
source: {//manage visiual
source: {
//manage visiual
type: String,
default: 'manage'
}
default: "manage",
},
},
watch: {
demandUserName: function (val) {
this.formData.reportUserName = val
this.formData.demandUserName = val
this.formData.reportUserName = val;
this.formData.demandUserName = val;
},
demandUserMobile: function (val) {
this.formData.reportUserMobile = val
this.formData.demandUserMobile = val
this.formData.reportUserMobile = val;
this.formData.demandUserMobile = val;
},
demandUserId: function (val) {
this.formData.demandUserId = val
this.formData.demandUserId = val;
},
},
created () {
},
async mounted () {
const { user } = this.$store.state
this.agencyId = user.agencyId
this.getCategoryList();
this.getDemandOptions();
this.getServiceOption()
// this.formData = { ...this.formDataTemp }
this.initMap()
async mounted() {
const { user } = this.$store.state;
this.agencyId = user.agencyId;
if (this.eventId) {
this.eventDetailCopy = JSON.parse(JSON.stringify(this.eventDetailData));
this.formData.reportUserMobile = this.eventDetailCopy.mobile
this.formData.reportUserName = this.eventDetailCopy.name
this.formData.reportTime = this.eventDetailCopy.happenTime
this.formData.gridId = this.eventDetailCopy.gridId
this.formData.demandUserId = this.eventDetailCopy.reportUserId
this.formData.demandUserName = this.eventDetailCopy.name
this.formData.demandUserMobile = this.eventDetailCopy.mobile
if (this.eventDetailCopy.parentCategoryId && this.eventDetailCopy.categoryId) {
this.formData.reportUserMobile = this.eventDetailCopy.mobile;
this.formData.reportUserName = this.eventDetailCopy.name;
this.formData.reportTime = this.eventDetailCopy.happenTime;
this.formData.gridId = this.eventDetailCopy.gridId;
this.formData.demandUserId = this.eventDetailCopy.reportUserId;
this.formData.demandUserName = this.eventDetailCopy.name;
this.formData.demandUserMobile = this.eventDetailCopy.mobile;
if (
this.eventDetailCopy.parentCategoryId &&
this.eventDetailCopy.categoryId
) {
// this.selCategoryArray = []
// this.selCategoryArray.push(this.eventDetailCopy.parentCategoryId)
// this.selCategoryArray.push(this.eventDetailCopy.categoryId)
// this.formData.categoryId = this.eventDetailCopy.categoryId
// this.selCateObj = {
// name: this.eventDetailCopy.categoryName,
// id: this.eventDetailCopy.categoryId
// }
}
} else {
this.formData.demandUserName = this.demandUserName
this.formData.demandUserMobile = this.demandUserMobile
this.formData.demandUserId = this.demandUserId
this.formData.demandUserName = this.demandUserName;
this.formData.demandUserMobile = this.demandUserMobile;
this.formData.demandUserId = this.demandUserId;
}
this.getCategoryList();
this.getDemandOptions();
this.getServiceOption();
this.initMap();
},
methods: {
async getCategoryList() {
const url = "/gov/issue/issueprojectcategorydict/list";
async getCategoryList () {
const url = "/gov/issue/issueprojectcategorydict/list"
let params = {}
let params = {};
const { data, code, msg } = await requestPost(url, params)
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
let treeDataNew = this.filterTree(data)
let treeDataNew = this.filterTree(data);
//
++this.iscascaderShow
this.casOptions = []
this.casOptions = treeDataNew
++this.iscascaderShow;
this.casOptions = [];
this.casOptions = treeDataNew;
} else {
this.$message.error(msg)
this.$message.error(msg);
}
},
handleChangeCate () {
console.log(this.$refs["myCascader"].getCheckedNodes()[0].data)
this.selCateObj = this.$refs["myCascader"].getCheckedNodes()[0].data
this.formData.categoryId = this.selCateObj.id
handleChangeCate() {
console.log(this.$refs["myCascader"].getCheckedNodes()[0].data);
this.selCateObj = this.$refs["myCascader"].getCheckedNodes()[0].data;
this.formData.categoryId = this.selCateObj.id;
},
//
filterTree (arr) {
let childs = arr
filterTree(arr) {
let childs = arr;
for (let i = childs.length; i--; i > 0) {
if (childs[i].subCategory) {
if (childs[i].subCategory.length) {
this.filterTree(childs[i].subCategory)
this.filterTree(childs[i].subCategory);
} else {
delete childs[i].subCategory
delete childs[i].subCategory;
}
}
}
return arr
return arr;
},
async getDemandOptions () {
const url = "/heart/icresidemanddict/demandoption"
let params = {}
async getDemandOptions() {
const url = "/heart/icresidemanddict/demandoption";
let params = {};
const { data, code, msg } = await requestPost(url, params)
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.demandOptions = this.getFlagData(
this.getTreeData(data),
"usableFlag"
);
} else {
this.$message.error(msg)
this.$message.error(msg);
}
},
async getServiceOption () {
const url = "/sys/dict/data/dictlist"
let params = { dictType: "user_demand_service_type", }
async getServiceOption() {
const url = "/sys/dict/data/dictlist";
let params = { dictType: "user_demand_service_type" };
const { data, code, msg } = await requestPost(url, params)
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.serviceOptions = data;
} else {
this.$message.error(msg)
this.$message.error(msg);
}
},
getTreeData (data) {
getTreeData(data) {
if (!Array.isArray(data)) return [];
let arr = data.map((item) => {
let _item = {};
@ -476,7 +485,8 @@ export default {
});
return arr;
},
getFlagData (data, flag) {
getFlagData(data, flag) {
if (!Array.isArray(data)) return [];
let arr1 = data.filter((item) => item[flag]);
let arr2 = arr1.map((item) => {
@ -488,7 +498,7 @@ export default {
return arr2;
},
handleCateSlect (val) {
handleCateSlect(val) {
console.log("val", val);
if (val.length === 1) {
this.demandOptions.forEach((item) => {
@ -501,7 +511,7 @@ export default {
}
},
handleServiceChange (type, val) {
handleServiceChange(type, val) {
if (val === "social_org") {
if (type === "add") {
this.getServiceuserList(val, "add_demand");
@ -513,8 +523,7 @@ export default {
}
},
async getServiceuserList (serviceType, query) {
async getServiceuserList(serviceType, query) {
if (!serviceType) return false;
const { demandUserId } = this.formData;
const params = {
@ -523,154 +532,111 @@ export default {
queryPurpose: query,
};
const url = "/heart/userdemand/servicelist";
const url = "/heart/userdemand/servicelist"
const { data, code, msg } = await requestPost(url, params)
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.serviceOptiondList = data.filter(
(item) => item.value != demandUserId
);
} else {
this.$message.error(msg)
this.$message.error(msg);
}
},
async getDemandInfo () {
this.okflag = false
async getDemandInfo() {
this.okflag = false;
this.$refs["ref_form"].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj);
// this.formData.categoryId = this.selCateObj.id
} else {
this.okflag = true
this.okflag = true;
}
});
},
resetData() {},
resetData () {
},
// init
initMap () {
//
var center = new window.TMap.LatLng(36.0722275, 120.38945519)
// map TMap.Map()
map = new window.TMap.Map(document.getElementById('app_map'), {
center: center, //
zoom: 17.2, //
pitch: 43.5, //
rotation: 45 //
})
initMap() {
let { latitude, longitude } = this.$store.state.user;
search = new window.TMap.service.Search({ pageSize: 10 })
//
markers = new TMap.MultiMarker({
map: map,
geometries: []
})
infoWindowList = Array(10)
geocoder = new TMap.service.Geocoder(); //
map = new daiMap(
document.getElementById("app_map"),
{ latitude, longitude },
{
zoom: 16.2, //
pitch: 43.5, //
rotation: 45, //
}
);
//
map.on('panend', () => {
this.handleMoveCenter()
})
this.handleMoveCenter()
this.convert()
map.on("dragend", (e) => {
this.handleMoveCenter(e);
});
map.setCenter(latitude, longitude);
map.setMarker(latitude, longitude);
},
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
.searchRectangle({
keyword: this.keyWords,
bounds: map.getBounds()
})
.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)
this.formData.latitude = lat
this.formData.longitude = lng
this.convert()
} else {
this.$message.error('未检索到相关位置坐标')
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.address = data.address;
}
})
},
handleMoveCenter () {
//
const center = map.getCenter()
const lat = center.getLat()
const lng = center.getLng()
this.formData.latitude = lat
this.formData.longitude = lng
this.setMarker(lat, lng)
this.convert(lat, lng)
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.formData.latitude = lat;
this.formData.longitude = lng;
} else {
this.$message.error("未检索到相关位置坐标");
}
},
convert (lat, lng) {
convert(lat, lng) {
markers.setGeometries([]);
// var input = document.getElementById('location').value.split(',');
let location
let location;
if (lat && lng) {
location = new TMap.LatLng(lat, lng);
} else {
location = new TMap.LatLng(this.formData.latitude, this.formData.longitude);
location = new TMap.LatLng(
this.formData.latitude,
this.formData.longitude
);
}
// map.setCenter(location);
markers.updateGeometries([
{
id: 'main', //
id: "main", //
position: location,
},
]);
geocoder
.getAddress({ location: location }) //
.then((result) => {
this.formData.serviceLocation = result.result.address
this.formData.serviceLocation = result.result.address;
//
});
},
//
startLoading () {
startLoading() {
loading = Loading.service({
lock: true, //
text: "正在加载……", //
@ -678,7 +644,7 @@ export default {
});
},
//
endLoading () {
endLoading() {
// clearTimeout(timer);
if (loading) {
loading.close();
@ -688,14 +654,11 @@ export default {
};
</script>
<style lang='scss' scoped>
<style lang="scss" scoped>
@import "@/assets/scss/modules/visual/a_customize.scss";
@import "@/assets/scss/modules/shequzhili/event-info.scss";
</style>
<style>
.el-dialog__body {
padding: 0 10px 20px !important;

Loading…
Cancel
Save