From 0d83276e2c40c2cde837a3a5dd5aa84a99988c2f Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Wed, 16 Mar 2022 11:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/inspection/inspection.js | 25 ++++ constant/url.js | 1 + lib/java110/utils/translate-image.js | 1 + pages/excuteInspection/excuteInspection.vue | 2 +- .../excuteOneInspection.vue | 113 ++++++++++++++++-- 5 files changed, 128 insertions(+), 14 deletions(-) diff --git a/api/inspection/inspection.js b/api/inspection/inspection.js index a9975b4..beb9191 100644 --- a/api/inspection/inspection.js +++ b/api/inspection/inspection.js @@ -47,4 +47,29 @@ export function queryDictInfo(_that,_data){ } }) }); +} + +/** + * 投票问卷 + * @param {Object} _data 评价内容 + */ +export function queryInspectionItemTitle(_that,_data) { + return new Promise((resolve, reject) => { + let moreRooms = []; + _that.context.get({ + url: url.listInspectionItemTitle, + data: _data, //动态数据 + success: function(res) { + let _data = res.data; + if (_data.code == 0) { + resolve(_data); + return ; + } + reject(_data.msg); + }, + fail: function(e) { + reject(e); + } + }); + }) } \ No newline at end of file diff --git a/constant/url.js b/constant/url.js index 6e7f827..c5366bc 100644 --- a/constant/url.js +++ b/constant/url.js @@ -155,4 +155,5 @@ export default { listFeeDetail: baseUrl + "callComponent/propertyFee/listFeeDetail", repairStop: baseUrl + "callComponent/ownerRepair.repairStop", repairStart: baseUrl + "callComponent/ownerRepair.repairStart", + listInspectionItemTitle: baseUrl + "app/inspectionItemTitle.listInspectionItemTitle" } diff --git a/lib/java110/utils/translate-image.js b/lib/java110/utils/translate-image.js index 84f114e..c1e538d 100644 --- a/lib/java110/utils/translate-image.js +++ b/lib/java110/utils/translate-image.js @@ -38,6 +38,7 @@ function imageToBease64(imageUrl, callback) { success: ress => { let base64 = wx.arrayBufferToBase64(ress.data); base64 = 'data:image/jpeg;base64,' + base64 + callback(base64) }, fail: (e) => { console.log("图片转换失败"); } diff --git a/pages/excuteInspection/excuteInspection.vue b/pages/excuteInspection/excuteInspection.vue index 98a5ec4..d45d466 100644 --- a/pages/excuteInspection/excuteInspection.vue +++ b/pages/excuteInspection/excuteInspection.vue @@ -117,7 +117,7 @@ console.log('巡检点', _item); uni.navigateTo({ url: '/pages/excuteOneInspection/excuteOneInspection?taskDetailId=' + _item.taskDetailId + "&taskId=" + _item.taskId + - "&inspectionId=" + _item.inspectionId + "&inspectionName=" + _item.inspectionName + "&inspectionId=" + _item.inspectionId + "&inspectionName=" + _item.inspectionName+"&itemId="+_item.itemId }); }, preview: function(_src) { diff --git a/pages/excuteOneInspection/excuteOneInspection.vue b/pages/excuteOneInspection/excuteOneInspection.vue index e879e51..cb2fda8 100644 --- a/pages/excuteOneInspection/excuteOneInspection.vue +++ b/pages/excuteOneInspection/excuteOneInspection.vue @@ -2,17 +2,31 @@ {{inspectionName}}巡检
- - 巡检情况 - - - {{patrolTypes[patrolIndex].name}} + + {{item.itemTitle}} + + + {{valueItem.itemValue}} + + - - - - - + + + + {{valueItem.itemValue}} + + + + + + + + + + @@ -52,7 +66,7 @@ import conf from '../../conf/config.js' import * as TanslateImage from '../../lib/java110/utils/translate-image.js'; import {preventClick} from '../../lib/java110/utils/common.js'; - import {queryDictInfo} from '../../api/inspection/inspection.js'; + import {queryDictInfo,queryInspectionItemTitle} from '../../api/inspection/inspection.js'; import {getCurrentCommunity} from '../../api/community/community.js' import url from '../../constant/url.js' import Vue from 'vue' @@ -71,7 +85,7 @@ name: '请选择' }], patrolIndex:0, - patrolType:'', + patrolType:'10001', patrolTypeName:'请选择', description:'', photos:[], @@ -82,7 +96,9 @@ latitude: '', longitude: '', location: '', - reverseGeocoderSimplify: '正在获取...' + reverseGeocoderSimplify: '正在获取...', + titles: [], + itemId:'' } }, onLoad(option) { @@ -101,14 +117,45 @@ this.taskId = option.taskId; 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; this.userId = _userInfo.userId; this._loadPatrolTypesList(); + this._loadInspectionItem(); }, methods: { + _loadInspectionItem:function(){ + let that = this; + queryInspectionItemTitle(this,{ + communityId: that.communityId, + itemId: that.itemId, + page: 1, + row: 100 + }) + .then(_data => { + _data.data.forEach(item => { + if (item.titleType == '1001') { + item.radio = '' + } else if (item.titleType == '2002') { + // checked: false + item.radio = []; + item.inspectionItemTitleValueDtos.forEach(value => { + item.radio.push({ + checked: false, + itemValue: value.itemValue, + selected: '0' + }) + }) + } else { + item.radio = '' + } + }) + that.titles = _data.data; + }) + }, // 地址逆解析 getCurrentLocation: function(){ let locationObj = this.latitude + ',' + this.longitude; @@ -176,6 +223,7 @@ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 sourceType: ['camera'], //手机拍照 success: (res) => { + that.$data.imgList.push(res.tempFilePaths[0]); var tempFilePaths = res.tempFilePaths[0] @@ -190,6 +238,20 @@ let _that = this; uni.showLoading({ title:'请稍后...' + }); + this.description = ''; + this.titles.forEach(item=>{ + let _itemValue = '' + if(item.titleType == '2002'){ + item.radio.forEach(_radio => { + if (_radio.selected == '1') { + _itemValue += (_radio.itemValue+',') + } + }) + this.description +=(item.itemTitle+':'+_itemValue+';') + }else{ + this.description +=(item.itemTitle+':'+item.radio+';') + } }) let obj = { "taskId": this.taskId, @@ -275,6 +337,31 @@ } }, + radioChange: function(e, item) { + 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 =>{ + if (value.itemValue == _dValue) { + if (value.selected == '0') { + value.selected = '1'; + value.checked = true; + } + } + }) + }) + + console.log('item.radio', item.radio, e) + }, } }