This commit is contained in:
java110 2023-04-11 14:51:26 +08:00
parent 26d44d2490
commit c7be217389
2 changed files with 117 additions and 76 deletions

View File

@ -63,7 +63,13 @@
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "物业员工巡检需要获取巡检地方位置"
}
},
"requiredPrivateInfos": ["getLocation"]
},
"mp-alipay" : {
"usingComponents" : true

View File

@ -13,7 +13,8 @@
</radio>
</view>
</radio-group>
<checkbox-group class="block" @change="checkboxChange($event,item)" v-else-if="item.titleType == '2002'">
<checkbox-group class="block" @change="checkboxChange($event,item)"
v-else-if="item.titleType == '2002'">
<view class="cu-form-group " v-for="(valueItem,valueIndex) in item.inspectionItemTitleValueDtos">
<view class="title">{{valueItem.itemValue}}</view>
<checkbox :class="item.radio[valueIndex].selected == '1'?'checked':''"
@ -29,7 +30,9 @@
</view>
</view>
<uploadImageAsync ref="vcUploadRef" :communityId="communityId" :sourceType="sourceType" :maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle" @sendImagesData="sendImagesData" style="margin-top: 30rpx;"></uploadImageAsync>
<uploadImageAsync ref="vcUploadRef" :communityId="communityId" :sourceType="sourceType"
:maxPhotoNum="uploadImage.maxPhotoNum" :canEdit="uploadImage.canEdit" :title="uploadImage.imgTitle"
@sendImagesData="sendImagesData" style="margin-top: 30rpx;"></uploadImageAsync>
<view class="cu-form-group margin-top" v-if="mapKey">
<view class="title">当前位置</view>
@ -46,48 +49,56 @@
<script>
import conf from '../../conf/config.js'
import {preventClick} from '../../lib/java110/utils/common.js';
import {queryDictInfo,queryInspectionItemTitle} from '../../api/inspection/inspection.js';
import {getCurrentCommunity} from '../../api/community/community.js'
import {
preventClick
} from '../../lib/java110/utils/common.js';
import {
queryDictInfo,
queryInspectionItemTitle
} from '../../api/inspection/inspection.js';
import {
getCurrentCommunity
} from '../../api/community/community.js'
import url from '../../constant/url.js'
import uploadImageAsync from "../../components/vc-upload-async/vc-upload-async.vue";
import Vue from 'vue'
Vue.prototype.$preventClick = preventClick;
import QQMapWX from '@/lib/qqmap-wx-jssdk.min.js';
export default {
data() {
return {
onoff: true,
taskId:'',
taskDetailId:'',
inspectionId:'',
inspectionName:'',
taskId: '',
taskDetailId: '',
inspectionId: '',
inspectionName: '',
pointStartTime: '',
pointEndTime: '',
patrolTypes:[{
patrolTypes: [{
name: '请选择'
}],
patrolIndex:0,
patrolType:'10001',
patrolTypeName:'请选择',
description:'',
photos:[],
imgList:[],
communityId:'',
userId:'',
userName:'',
patrolIndex: 0,
patrolType: '10001',
patrolTypeName: '请选择',
description: '',
photos: [],
imgList: [],
communityId: '',
userId: '',
userName: '',
latitude: '',
longitude: '',
location: '',
reverseGeocoderSimplify: '正在获取...',
titles: [],
itemId:'',
mapKey:'',
itemId: '',
mapKey: '',
uploadImage: {
maxPhotoNum: 4,
imgTitle: '巡检图片',
canEdit: true
},
sourceType:[ 'camera']
sourceType: ['camera']
}
},
@ -103,7 +114,13 @@
success: (res) => {
this.latitude = res.latitude;
this.longitude = res.longitude;
// #ifdef H5
this.getCurrentLocation();
// #endiff
// #ifdef MP-WEIXIN
this.getMiniWechatLocation();
// #endif
}
});
this.taskDetailId = option.taskDetailId;
@ -120,17 +137,17 @@
this._loadInspectionItem();
},
methods: {
sendImagesData: function(e){
sendImagesData: function(e) {
this.photos = [];
if(e.length > 0){
if (e.length > 0) {
e.forEach((img) => {
this.photos.push(img.fileId);
})
}
},
_loadInspectionItem:function(){
_loadInspectionItem: function() {
let that = this;
queryInspectionItemTitle(this,{
queryInspectionItemTitle(this, {
communityId: that.communityId,
itemId: that.itemId,
page: 1,
@ -157,10 +174,28 @@
that.titles = _data.data;
})
},
getMiniWechatLocation: function() {
let qqmapsdk = new QQMapWX({
key: this.mapKey
});
qqmapsdk.reverseGeocoder({
location: {
latitude: this.latitude,
longitude: this.longitude
},
success: (locaRes) => {
this.reverseGeocoderSimplify = locaRes.result.address
},
fail: (err) => {
}
})
},
//
getCurrentLocation: function(){
getCurrentLocation: function() {
let locationObj = this.latitude + ',' + this.longitude;
let url = 'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
let url =
'https://apis.map.qq.com/ws/geocoder/v1?coord_type=5&get_poi=1&output=jsonp&poi_options=page_size=1;page_index=1';
this.$jsonp(url, {
key: this.mapKey,
location: locationObj
@ -173,18 +208,18 @@
});
},
//
_loadPatrolTypesList: function(){
_loadPatrolTypesList: function() {
let _that = this;
let _objData = {
'name': "inspection_task_detail",
'type': "patrol_type",
};
queryDictInfo(this,_objData)
.then(function(res){
queryDictInfo(this, _objData)
.then(function(res) {
_that.patrolTypes = _that.patrolTypes.concat(res);
})
},
patrolChange:function(e){
patrolChange: function(e) {
this.patrolIndex = e.target.value //
if (this.patrolIndex == 0) {
@ -200,20 +235,20 @@
_submitExcuteInspection: function() {
let _that = this;
uni.showLoading({
title:'请稍后...'
title: '请稍后...'
});
this.description = '';
this.titles.forEach(item=>{
this.titles.forEach(item => {
let _itemValue = ''
if(item.titleType == '2002'){
if (item.titleType == '2002') {
item.radio.forEach(_radio => {
if (_radio.selected == '1') {
_itemValue += (_radio.itemValue+',')
_itemValue += (_radio.itemValue + ',')
}
})
this.description +=(item.itemTitle+':'+_itemValue+';')
}else{
this.description +=(item.itemTitle+':'+item.radio+';')
this.description += (item.itemTitle + ':' + _itemValue + ';')
} else {
this.description += (item.itemTitle + ':' + item.radio + ';')
}
})
let obj = {
@ -222,8 +257,8 @@
"inspectionId": this.inspectionId,
"inspectionName": this.inspectionName,
"communityId": this.communityId,
"patrolType":this.patrolType,
"description":this.description,
"patrolType": this.patrolType,
"description": this.description,
"photos": this.photos,
"userId": this.userId,
"userName": this.userName,
@ -261,7 +296,8 @@
uni.hideLoading();
} else {
this.java110Context.request({
url: url.updateInspectionTaskDetail, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair
url: url
.updateInspectionTaskDetail, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair
header: this.java110Context.getHeaders(),
method: "POST",
data: obj, //
@ -269,7 +305,7 @@
_that.onoff = true;
if (res.statusCode == 200) {
uni.navigateBack({
delta:1
delta: 1
})
return;
}
@ -305,7 +341,7 @@
})
item.radio.forEach(value => {
e.detail.value.forEach(_dValue =>{
e.detail.value.forEach(_dValue => {
if (value.itemValue == _dValue) {
if (value.selected == '0') {
value.selected = '1';
@ -327,8 +363,7 @@
margin: 0;
font-weight: 400;
font-size: 14px;
color: rgba(69,90,100,.6);
color: rgba(69, 90, 100, .6);
padding: 40rpx 30rpx 20rpx;
}
</style>