mirror of
https://gitee.com/java110/PropertyApp.git
synced 2026-02-23 13:26:41 +08:00
优化代码
This commit is contained in:
commit
ad36dbf4b5
@ -63,7 +63,13 @@
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
"usingComponents" : true,
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "物业员工巡检需要获取巡检地方位置"
|
||||
}
|
||||
},
|
||||
"requiredPrivateInfos": ["getLocation"]
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
|
||||
@ -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':''"
|
||||
@ -28,69 +29,79 @@
|
||||
</view>
|
||||
</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>
|
||||
<input type="text" v-model="reverseGeocoderSimplify" disabled="disabled" />
|
||||
</view>
|
||||
</form>
|
||||
|
||||
|
||||
<view class="padding flex flex-direction">
|
||||
<button class="cu-btn bg-green margin-tb-sm lg" @tap="$preventClick(_submitExcuteInspection)">提交</button>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<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']
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
components: {
|
||||
uploadImageAsync
|
||||
},
|
||||
@ -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;
|
||||
@ -111,7 +128,7 @@
|
||||
this.inspectionId = option.inspectionId;
|
||||
this.inspectionName = option.inspectionName;
|
||||
this.itemId = option.itemId;
|
||||
|
||||
|
||||
this.communityId = getCurrentCommunity().communityId;
|
||||
let _userInfo = this.java110Context.getUserInfo();
|
||||
this.userName = _userInfo.userName;
|
||||
@ -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,36 +174,54 @@
|
||||
that.titles = _data.data;
|
||||
})
|
||||
},
|
||||
// 地址逆解析
|
||||
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';
|
||||
this.$jsonp(url, {
|
||||
key: this.mapKey,
|
||||
location: locationObj
|
||||
})
|
||||
.then(res => {
|
||||
this.reverseGeocoderSimplify = res.result.address;
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
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() {
|
||||
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';
|
||||
this.$jsonp(url, {
|
||||
key: this.mapKey,
|
||||
location: locationObj
|
||||
})
|
||||
.then(res => {
|
||||
this.reverseGeocoderSimplify = res.result.address;
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
// 查询字典表 信息
|
||||
_loadPatrolTypesList: function(){
|
||||
_loadPatrolTypesList: function() {
|
||||
let _that = this;
|
||||
let _objData = {
|
||||
'name': "inspection_task_detail",
|
||||
'type': "patrol_type",
|
||||
};
|
||||
queryDictInfo(this,_objData)
|
||||
.then(function(res){
|
||||
_that.patrolTypes = _that.patrolTypes.concat(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) {
|
||||
this.patrolTypeName = '';
|
||||
this.patrolType = '';
|
||||
@ -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,15 +257,15 @@
|
||||
"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,
|
||||
"latitude": this.latitude,
|
||||
"longitude": this.longitude
|
||||
}
|
||||
|
||||
|
||||
let msg = "";
|
||||
if (obj.taskId == "") {
|
||||
msg = "数据异常,巡检任务为空";
|
||||
@ -250,7 +285,7 @@
|
||||
msg = "请上传巡检图片";
|
||||
}
|
||||
console.log(obj);
|
||||
|
||||
|
||||
if (msg != "") {
|
||||
_that.onoff = true;
|
||||
wx.showToast({
|
||||
@ -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;
|
||||
}
|
||||
@ -296,16 +332,16 @@
|
||||
console.log(e, item)
|
||||
item.radio = e.detail.value;
|
||||
console.log('item.radio', item.radio, e)
|
||||
|
||||
|
||||
},
|
||||
checkboxChange: function(e, item) {
|
||||
item.radio.forEach(value => {
|
||||
value.selected = '0';
|
||||
value.checked = false;
|
||||
})
|
||||
|
||||
|
||||
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';
|
||||
@ -314,21 +350,20 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
console.log('item.radio', item.radio, e)
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.block__title {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69,90,100,.6);
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69, 90, 100, .6);
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@ -63,10 +63,11 @@
|
||||
},
|
||||
dateChange: function(e) {
|
||||
this.bindDate = e.detail.value;
|
||||
this._loadTodayInspectionReport();
|
||||
},
|
||||
gotoDetail:function(_inpection){
|
||||
uni.navigateTo({
|
||||
url:'/pages/inspection/staffNoInspection?staffId='+_inpection.staffId+"&staffName="+_inpection.staffName
|
||||
url:'/pages/inspection/staffNoInspection?staffId='+_inpection.staffId+"&staffName="+_inpection.staffName+"&queryTime="+this.bindDate
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="block__title">{{staffName}}巡检情况</view>
|
||||
<view class="cu-form-group arrow">
|
||||
<!-- <view class="cu-form-group arrow">
|
||||
<view class="title">查询日期</view>
|
||||
<picker mode="date" :value="bindDate" start="2020-09-01" end="2050-09-01" @change="dateChange">
|
||||
<view class="picker">
|
||||
{{bindDate}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="cu-list menu margin-top" v-if="inpections && inpections.length > 0" v-for="(inspection, idx) in inpections" :key="idx"
|
||||
:data-item="inspection"
|
||||
@click="gotoDetail(inspection)">
|
||||
<view class="cu-item arrow">
|
||||
>
|
||||
<view class="cu-item ">
|
||||
<view class="content padding-tb-sm">
|
||||
<view>
|
||||
<view class="text-cut" style="width:85%;">{{inspection.inspectionName}}({{inspection.stateName}})</view>
|
||||
@ -50,7 +50,7 @@
|
||||
onLoad(options) {
|
||||
this.staffId = options.staffId;
|
||||
this.staffName = options.staffName;
|
||||
this.bindDate = formatDate(new Date());
|
||||
this.bindDate = options.queryTime;
|
||||
this._loadTodayInspectionReportDetail();
|
||||
|
||||
},
|
||||
@ -61,7 +61,7 @@
|
||||
listInspectionTaskDetails(this,{
|
||||
communityId: getCurrentCommunity().communityId,
|
||||
planUserId:this.staffId,
|
||||
state:'20200405',
|
||||
//state:'20200405',
|
||||
queryTime:this.bindDate,
|
||||
page:1,
|
||||
row:100
|
||||
|
||||
@ -4,40 +4,40 @@
|
||||
巡检任务(补检)
|
||||
</view>
|
||||
<view class="cu-form-group arrow" >
|
||||
<view class="title">补检日期</view>
|
||||
<view class="title" style="width: 200upx;">补检日期</view>
|
||||
<uni-datetime-picker type="date" :clear-icon="false" v-model="planInsTime" @change="maskClick" :border="false"/>
|
||||
</view>
|
||||
<view v-if="noData==false">
|
||||
<view v-for="(item,index) in tasks" :key="index" class="bg-white margin-bottom margin-right-xs radius margin-left-xs padding-top padding-left padding-right">
|
||||
<view class="flex padding-bottom-xs solid-bottom justify-between">
|
||||
<view>{{item.taskId}}</view>
|
||||
<view class="text-gray">{{item.stateName}}</view>
|
||||
<view v-if="tasks && tasks.length>0" class="margin-top">
|
||||
<view v-for="(item,index) in tasks" :key="index" class="bg-white margin-bottom margin-right-xs radius margin-left-xs padding-top padding-left padding-right">
|
||||
<view class="flex padding-bottom-xs solid-bottom justify-between">
|
||||
<view>{{item.taskId}}</view>
|
||||
<view class="text-gray">{{item.stateName}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top justify-between">
|
||||
<view class="text-gray">巡检计划</view>
|
||||
<view class="text-gray">{{item.inspectionPlanName}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">计划编码</view>
|
||||
<view class="text-gray">{{item.inspectionPlanId}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检人</view>
|
||||
<view class="text-gray">{{item.planUserName}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检时间</view>
|
||||
<view class="text-gray">{{item.planInsTime }}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检方式</view>
|
||||
<view class="text-gray">{{item.signTypeName}}</view>
|
||||
</view>
|
||||
<view class="solid-top flex justify-end margin-top padding-top-sm padding-bottom-sm">
|
||||
<!-- <button class="cu-btn sm bg-blue margin-left" @click="_transferInspection(item)">流转</button> -->
|
||||
<button class="cu-btn sm bg-green margin-left" @click="_startInspection(item)">补检</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex margin-top justify-between">
|
||||
<view class="text-gray">巡检计划</view>
|
||||
<view class="text-gray">{{item.inspectionPlanName}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">计划编码</view>
|
||||
<view class="text-gray">{{item.inspectionPlanId}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检人</view>
|
||||
<view class="text-gray">{{item.planUserName}}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检时间</view>
|
||||
<view class="text-gray">{{item.planInsTime }}</view>
|
||||
</view>
|
||||
<view class="flex margin-top-xs justify-between">
|
||||
<view class="text-gray">巡检方式</view>
|
||||
<view class="text-gray">{{item.signTypeName}}</view>
|
||||
</view>
|
||||
<view class="solid-top flex justify-end margin-top padding-top-sm padding-bottom-sm">
|
||||
<!-- <button class="cu-btn sm bg-blue margin-left" @click="_transferInspection(item)">流转</button> -->
|
||||
<button class="cu-btn sm bg-green margin-left" @click="_startInspection(item)">补检</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<no-data-page></no-data-page>
|
||||
@ -82,13 +82,6 @@
|
||||
},
|
||||
methods: {
|
||||
_startInspection:function(_item){
|
||||
// if(dateUtil.compareDate(_item.planInsTime.replace(/-/g, '/'), dateUtil.getCurrentDateTime().replace(/-/g, '/'))){
|
||||
// uni.showToast({
|
||||
// title: "尚未开始",
|
||||
// icon: "none"
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
console.log('开始巡检',_item);
|
||||
uni.navigateTo({
|
||||
url:'/pages/excuteInspection/excuteInspection?taskId='+_item.taskId+'&inspectionPlanName='+_item.inspectionPlanName
|
||||
@ -96,7 +89,6 @@
|
||||
},
|
||||
_queryInstpectionTasks: function() {
|
||||
let _that = this;
|
||||
|
||||
_that.java110Context.request({
|
||||
header: _that.java110Context.getHeaders(),
|
||||
url: url.listInspectionTasks,
|
||||
@ -104,17 +96,18 @@
|
||||
data: {
|
||||
communityId: _that.communityId,
|
||||
page: 1,
|
||||
row: 10,
|
||||
row: 20,
|
||||
planUserId: _that.userId,
|
||||
moreState:'20200405,20200406',
|
||||
canReexamine:'2000',
|
||||
planInsTime: _that.planInsTime,
|
||||
isToday: null
|
||||
//isToday: 1
|
||||
|
||||
},
|
||||
success: function(res) {
|
||||
// TODO 判断
|
||||
console.log(res);
|
||||
res.data.inspectionTasks.forEach(function(item, index) {
|
||||
res.data.inspectionTasks.forEach(item => {
|
||||
item.timeStr = item.planInsTime.replace(/:\d{1,2}$/, ' ');
|
||||
});
|
||||
_that.tasks = res.data.inspectionTasks;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user