|
|
@ -12,6 +12,8 @@ Page({ |
|
|
|
* 页面的初始数据 |
|
|
|
*/ |
|
|
|
data: { |
|
|
|
optionsId:'', |
|
|
|
defaultMeasureNames:{label:'categoryName',value:'categoryCode',children:'childCateList'}, |
|
|
|
fmData: { |
|
|
|
gridId: '', |
|
|
|
attachmentList:[],//图片
|
|
|
@ -79,13 +81,6 @@ Page({ |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
onLoad(options) { |
|
|
|
this.data.qqMapWX = new QQMapWX({ |
|
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
|
}) |
|
|
|
// this.getLocation().then(() => {
|
|
|
|
// })
|
|
|
|
this.reverseLocation() |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
angencyId:app.globalData.user.agencyId, |
|
|
|
reportUserName:app.globalData.user.realName, |
|
|
@ -94,7 +89,298 @@ Page({ |
|
|
|
this.getAgencygridtree() |
|
|
|
this.getDemandoption() |
|
|
|
this.getDictList() |
|
|
|
if(options.id){ |
|
|
|
if(options.type === '0'){ |
|
|
|
this.getIcEventOldDetail(options.id) |
|
|
|
}else{ |
|
|
|
this.getDemandDetail(options.id) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
|
tabVal:options.type || 0, |
|
|
|
optionsId:options.id |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.data.qqMapWX = new QQMapWX({ |
|
|
|
key: 'CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ' |
|
|
|
}) |
|
|
|
// this.getLocation().then(() => {
|
|
|
|
// })
|
|
|
|
this.reverseLocation() |
|
|
|
}, |
|
|
|
getDemandDetail(id){ |
|
|
|
let parm = { |
|
|
|
demandRecId:id |
|
|
|
} |
|
|
|
api.getDemandDetail(parm).then(res=>{ |
|
|
|
console.log(res); |
|
|
|
this.setData({ |
|
|
|
'fmData.content':res.data.content, |
|
|
|
// 'fmData.voiceList':res.data.voiceList,
|
|
|
|
'fmData.gridId':res.data.gridId, |
|
|
|
'fmData.demandUserId':res.data.reportUserId, |
|
|
|
'fmData.categoryCode':res.data.categoryCode, |
|
|
|
'fmData.reportType':res.data.reportType, |
|
|
|
'fmData.happenTime':res.data.reportTime, |
|
|
|
'fmData.wantServiceTime':res.data.wantServiceTime, |
|
|
|
'fmData.resiId':res.data.icResiUserId, |
|
|
|
categoryName:res.data.parentCategoryName + res.data.firstCategoryName , |
|
|
|
agencyName:res.data.gridName, |
|
|
|
reportTypeName:res.data.reportTypeName, |
|
|
|
resiName:res.data.demandUserName, |
|
|
|
resiMobile:res.data.demandUserMobile, |
|
|
|
showTime:res.data.reportTime, |
|
|
|
showWantServiceTimeTime:res.data.wantServiceTime, |
|
|
|
// uploadImageList:res.data.imageList.map(item=>({ossUrl:{url:item},uploaded:true})),
|
|
|
|
// uploadRecord:res.data.voiceList[0],
|
|
|
|
// totalTime:this.format(res.data.voiceList[0].duration)
|
|
|
|
}) |
|
|
|
this.downLoadAudio() |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getIcEventOldDetail(id){ |
|
|
|
let parm = { |
|
|
|
icEventId:id |
|
|
|
} |
|
|
|
api.getIcEventOld(parm).then(res=>{ |
|
|
|
console.log(res); |
|
|
|
this.setData({ |
|
|
|
'fmData.content':res.data.eventContent, |
|
|
|
'fmData.voiceList':res.data.voiceList||[], |
|
|
|
'fmData.gridId':res.data.gridId, |
|
|
|
'fmData.happenTime':res.data.happenTime, |
|
|
|
'fmData.address':res.data.address, |
|
|
|
'fmData.resiId':res.data.reportUserId, |
|
|
|
'fmData.longitude':res.data.longitude, |
|
|
|
'fmData.latitude':res.data.latitude, |
|
|
|
agencyName:res.data.gridName, |
|
|
|
showTime:res.data.happenTime, |
|
|
|
addressContent:res.data.address, |
|
|
|
resiName:res.data.name, |
|
|
|
resiMobile:res.data.mobile, |
|
|
|
uploadImageList:res.data.imageList&&res.data.imageList.length>0?res.data.imageList.map(item=>({ossUrl:{url:item},uploaded:true})):[], |
|
|
|
uploadRecord:res.data.voiceList&& res.data.voiceList.length>0?res.data.voiceList[0]:null, |
|
|
|
totalTime:this.format(res.data.voiceList&&res.data.voiceList.length>0?res.data.voiceList[0].duration:0) |
|
|
|
}) |
|
|
|
if(this.data.uploadRecord){ |
|
|
|
this.downLoadAudio() |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
update(){ |
|
|
|
this.submitPersonalInfo() |
|
|
|
}, |
|
|
|
updateMeasure(){ |
|
|
|
this.setData({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
let {categoryCode,content,happenTime,resiId,gridId,attachmentList,voiceList,wantServiceTime,parentCode,reportType} = this.data.fmData |
|
|
|
const parm ={ |
|
|
|
categoryCode, |
|
|
|
content, |
|
|
|
reportUserName:this.data.reportUserName, |
|
|
|
reportTime:happenTime, |
|
|
|
reportUserMobile:this.data.reportUserMobile, |
|
|
|
demandUserId:resiId, |
|
|
|
gridId, |
|
|
|
reportType, |
|
|
|
// attachments:[...attachmentList,...voiceList],
|
|
|
|
wantServiceTime, |
|
|
|
parentCode:parentCode, |
|
|
|
demandRecId:this.data.optionsId |
|
|
|
} |
|
|
|
api.updateMeasure(parm).then(res=>{ |
|
|
|
if (res.code === 0) { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: `提交成功`, |
|
|
|
confirmText: '确认', |
|
|
|
showCancel: false, |
|
|
|
success: res => { |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false, |
|
|
|
uploadImageList: [], |
|
|
|
uploadRecord: { |
|
|
|
uploaded: true, |
|
|
|
url: "" |
|
|
|
}, |
|
|
|
agencyName:'', |
|
|
|
showTime:'', |
|
|
|
resiName:'', |
|
|
|
resiMobile:'', |
|
|
|
'fmData.gridId':'', |
|
|
|
'fmData.attachmentList':[],//图片
|
|
|
|
'fmData.voiceList':[], |
|
|
|
'fmData.latitude':"", |
|
|
|
'fmData.longitude':"", |
|
|
|
'fmData.resiId':"", |
|
|
|
'fmData.happenTime':"", |
|
|
|
'fmData.content':"",//内容
|
|
|
|
'fmData.wantServiceTime':"", |
|
|
|
'fmData.reportType':'' |
|
|
|
}) |
|
|
|
wx.navigateBack({ |
|
|
|
delta:1 |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
} else { |
|
|
|
console.log('提交失败'); |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
|
icon: "none", |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
|
icon: "none", |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
}) |
|
|
|
setTimeout(function(){ |
|
|
|
wx.hideLoading() |
|
|
|
},1000) |
|
|
|
}, |
|
|
|
updateEvent(){ |
|
|
|
wx.showLoading({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
const parm = this.data.fmData |
|
|
|
parm.icEventId = this.data.optionsId |
|
|
|
console.log(parm,'事件更新'); |
|
|
|
api.updateEvent(parm).then(res => { |
|
|
|
console.log(res); |
|
|
|
if (res.code === 0) { |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: `修改成功`, |
|
|
|
confirmText: '确认', |
|
|
|
showCancel: false, |
|
|
|
success: res => { |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false, |
|
|
|
uploadImageList: [], |
|
|
|
uploadRecord: { |
|
|
|
uploaded: true, |
|
|
|
url: "" |
|
|
|
}, |
|
|
|
agencyName:'', |
|
|
|
showTime:'', |
|
|
|
resiName:'', |
|
|
|
resiMobile:'', |
|
|
|
'fmData.gridId':'', |
|
|
|
'fmData.attachmentList':[],//图片
|
|
|
|
'fmData.voiceList':[], |
|
|
|
'fmData.latitude':"", |
|
|
|
'fmData.longitude':"", |
|
|
|
'fmData.resiId':"", |
|
|
|
'fmData.happenTime':"", |
|
|
|
'fmData.content':"",//内容
|
|
|
|
'fmData.wantServiceTime':"", |
|
|
|
'fmData.reportType':'' |
|
|
|
}) |
|
|
|
wx.navigateBack({ |
|
|
|
delta:1 |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
wx.removeStorageSync('resiDetail') |
|
|
|
} else { |
|
|
|
console.log('提交失败'); |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
|
icon: "none", |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
wx.showToast({ |
|
|
|
title: "提交失败,请重试~", |
|
|
|
icon: "none", |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
this.setData({ |
|
|
|
submitDisabled: false |
|
|
|
}) |
|
|
|
}) |
|
|
|
setTimeout(function(){ |
|
|
|
wx.hideLoading() |
|
|
|
},1000) |
|
|
|
}, |
|
|
|
delete(){ |
|
|
|
let that = this |
|
|
|
wx.showModal({ |
|
|
|
title: '提示', |
|
|
|
content: '确定要删除这条数据吗,删除后将无法找回,请谨慎操作', |
|
|
|
success (res) { |
|
|
|
if (res.confirm) { |
|
|
|
console.log(that.data.tabVal); |
|
|
|
if(that.data.tabVal == 0){ |
|
|
|
that.icEventOldDelete() |
|
|
|
}else{ |
|
|
|
that.userDemandCance() |
|
|
|
} |
|
|
|
} else if (res.cancel) { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
icEventOldDelete(){ |
|
|
|
api.icEventOldDelete([this.data.optionsId]).then(res=>{ |
|
|
|
if(res.code === 0){ |
|
|
|
wx.showToast({ |
|
|
|
title: '删除成功', |
|
|
|
icon:'none', |
|
|
|
success(){ |
|
|
|
setTimeout(()=>{ |
|
|
|
wx.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
},3000) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
userDemandCance(){ |
|
|
|
let parm ={ |
|
|
|
demandRecId:this.data.optionsId |
|
|
|
} |
|
|
|
api.userDemandCance(parm).then(res=>{ |
|
|
|
if(res.code === 0){ |
|
|
|
wx.showToast({ |
|
|
|
title: '删除成功', |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 组织树
|
|
|
|
getAgencygridtree() { |
|
|
|
let parm ={ |
|
|
@ -167,7 +453,7 @@ Page({ |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// // 获取经纬度
|
|
|
|
// 获取经纬度
|
|
|
|
// getLocation() {
|
|
|
|
// return new Promise((resolve, reject) => {
|
|
|
|
// const _this = this
|
|
|
@ -204,9 +490,10 @@ Page({ |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.data.uploadImageList); |
|
|
|
if (this.data.uploadImageList.length > 0) { |
|
|
|
this.data.uploadImageList.forEach(item => { |
|
|
|
imagesList.push({format:item.format,originFileName:item.originFileName,url:item.ossUrl.url,type:item.type}) |
|
|
|
imagesList.push({format:item.format ||'png',originFileName:item.originFileName ||'',url:item.ossUrl.url,type:item.type}) |
|
|
|
}) |
|
|
|
} |
|
|
|
this.setData({ |
|
|
@ -273,10 +560,9 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.data.tabVal === '1') { |
|
|
|
|
|
|
|
this.submitMeasure() |
|
|
|
this.data.optionsId ? this.updateMeasure() : this.submitMeasure(); |
|
|
|
} else { |
|
|
|
this.submitEven() |
|
|
|
this.data.optionsId ? this.updateEvent() : this.submitEven(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -289,9 +575,9 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
const para = this.data.fmData |
|
|
|
console.log(para,'事件'); |
|
|
|
api.addEvent(para).then(res => { |
|
|
|
const parm = this.data.fmData |
|
|
|
console.log(parm,'事件'); |
|
|
|
api.addEvent(parm).then(res => { |
|
|
|
console.log(res); |
|
|
|
if (res.code === 0) { |
|
|
|
wx.showModal({ |
|
|
@ -360,12 +646,11 @@ Page({ |
|
|
|
title: '提交中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
submitDisabled: true |
|
|
|
}) |
|
|
|
let {categoryCode,content,happenTime,resiId,gridId,attachmentList,voiceList,wantServiceTime,parentCode,reportType} = this.data.fmData |
|
|
|
const para ={ |
|
|
|
const parm ={ |
|
|
|
categoryCode, |
|
|
|
content, |
|
|
|
reportUserName:this.data.reportUserName, |
|
|
@ -374,12 +659,13 @@ Page({ |
|
|
|
demandUserId:resiId, |
|
|
|
gridId, |
|
|
|
reportType, |
|
|
|
attachmentList:[...attachmentList,...voiceList], |
|
|
|
// attachments:[...attachmentList],
|
|
|
|
voices:[...voiceList], |
|
|
|
wantServiceTime, |
|
|
|
parentCode:parentCode |
|
|
|
} |
|
|
|
console.log(para,'服务'); |
|
|
|
api.addMeasure(para).then(res => { |
|
|
|
console.log(parm,'服务'); |
|
|
|
api.addMeasure(parm).then(res => { |
|
|
|
console.log(res); |
|
|
|
if (res.data) { |
|
|
|
wx.showModal({ |
|
|
@ -488,7 +774,7 @@ Page({ |
|
|
|
if (res.tempFiles[0].size <= 5 * 1024 * 1024) { |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
ossUrl: {url:res.tempFiles[0].tempFilePath}, |
|
|
|
imgUrl: res.tempFiles[0].tempFilePath, |
|
|
|
imageId: ++_this.data.imageId, |
|
|
|
type:res.tempFiles[0].tempFilePath.substr(res.tempFiles[0].tempFilePath.length -3,3), |
|
|
@ -552,7 +838,7 @@ Page({ |
|
|
|
if (item.size <= 5 * 1024 * 1024) { |
|
|
|
uploadImageList.push({ |
|
|
|
uploaded: false, |
|
|
|
ossUrl: '', |
|
|
|
ossUrl: {url:item.tempFilePath}, |
|
|
|
imgUrl: item.tempFilePath, |
|
|
|
imageId: ++_this.data.imageId, |
|
|
|
format:"image", |
|
|
|