diff --git a/constant/UrlConstant.js b/constant/UrlConstant.js index b3a53fd..6d1741d 100644 --- a/constant/UrlConstant.js +++ b/constant/UrlConstant.js @@ -73,9 +73,16 @@ const listRepairStaffs = baseUrl + "app/ownerRepair.listRepairStaffs"; //查询员工报修单 const listStaffRepairs = baseUrl + "app/ownerRepair.listStaffRepairs"; +//查询报修师傅查询 +const listRepairTypeUsers = baseUrl + "app/repair.listRepairTypeUsers"; + + + //查询完成报修单 const listStaffFinishRepairs = baseUrl +"app/ownerRepair.listStaffFinishRepairs"; +const repairDispatch = baseUrl+"app/ownerRepair.repairDispatch"; + module.exports = { @@ -113,5 +120,7 @@ module.exports = { updateInspectionTaskDetail:updateInspectionTaskDetail, listRepairStaffs:listRepairStaffs, listStaffRepairs:listStaffRepairs, - listStaffFinishRepairs:listStaffFinishRepairs + listStaffFinishRepairs:listStaffFinishRepairs, + listRepairTypeUsers:listRepairTypeUsers, + repairDispatch:repairDispatch }; \ No newline at end of file diff --git a/pages/repairDispatch/repairDispatch.vue b/pages/repairDispatch/repairDispatch.vue index 548d862..541d3a7 100644 --- a/pages/repairDispatch/repairDispatch.vue +++ b/pages/repairDispatch/repairDispatch.vue @@ -32,9 +32,9 @@ - - - + + + @@ -110,7 +110,8 @@ console.log('_item',_item); //wx.setStorageSync("_toModifyComplaint_"+_item.complaintId, _item); uni.navigateTo({ - url:"/pages/repairDetail/repairDetail?repairId=" + _item.repairId+'&storeId='+this.storeId + url:"/pages/repairDetail/repairDetail?repairId=" + + _item.repairId+'&storeId='+this.storeId }); }, @@ -119,6 +120,8 @@ url:'/pages/repairHandle/repairHandle?action=' +action+"&repairId="+item.repairId +"&repairType="+item.repairType + +"&preStaffId="+item.preStaffId + +"&preStaffName="+item.preStaffName }); } } diff --git a/pages/repairHandle/repairHandle.vue b/pages/repairHandle/repairHandle.vue index cacfb6d..70178eb 100644 --- a/pages/repairHandle/repairHandle.vue +++ b/pages/repairHandle/repairHandle.vue @@ -1,18 +1,22 @@ @@ -46,32 +50,48 @@ export default { data() { return { - staffCloums:[], - action:'', - repairId:'', - repairType:'', - imgList:[] - + staffCloums: [{ + staffName: '请选择员工' + }], + action: '', + repairId: '', + repairType: '', + imgList: [], + photos: [], + repairStaffIndex: 0, + staffId: '', + staffName: '', + context: '', + userId:'', + userName:'' } }, onLoad(options) { this.action = options.action; this.repairId = options.repairId; - this.repairType=options.repairType; + this.repairType = options.repairType; + let _userInfo = this.java110Context.getUserInfo(); + this.userId = _userInfo.userId; + this.userName = _userInfo.userName; + if(this.action == 'BACK'){ + this.staffId = options.preStaffId + this.staffName = options.preStaffName + } this._loadRepairStaff(); }, methods: { - - _loadRepairStaff:function(){ + + _loadRepairStaff: function() { let _that = this; - let _data={ - repairType:this.repairType, - communtiyId:this.java110Context.getCurrentCommunity().communityId, - page:1, - row:50 + let _data = { + repairType: this.repairType, + communtiyId: this.java110Context.getCurrentCommunity().communityId, + page: 1, + row: 50, + state: '9999' } this.java110Context.request({ - url: _that.java110Constant.url.listRepairStaffs, + url: _that.java110Constant.url.listRepairTypeUsers, header: _that.java110Context.getHeaders(), method: "GET", data: _data, //动态数据 @@ -86,7 +106,7 @@ return; } let _data = _json.data; - _that.staffCloums = _data; + _that.staffCloums = _that.staffCloums.concat(_data); }, fail: function(e) { wx.showToast({ @@ -96,8 +116,114 @@ }); } }); - } - + }, + staffChange: function(e) { + + this.repairStaffIndex = e.target.value //取其下标 + if (this.repairStaffIndex == 0) { + this.staffId = '' //选中的id + this.staffName = '' + return; + } + let selected = this.staffCloums[this.repairStaffIndex] //获取选中的数组 + + this.staffId = selected.staffId //选中的id + this.staffName = selected.staffName + }, + _deleteImage: function(e) { + let imageArr = this.imgList; + imageArr.splice(e, 1); + this.photos.splice(e, 1); + }, + _chooseImage: function(e) { + let that = this; + wx.chooseImage({ + count: 4, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album'], //从相册选择 + success: (res) => { + console.log(res); + that.imgList.push(res.tempFilePaths[0]); + let _base64Photo = ''; + this.java110Factory.base64.urlTobase64(res.tempFilePaths[0]).then(function(_res) { + _base64Photo = _res; + console.log('base64', _base64Photo); + that.photos.push(_base64Photo); + }); + } + }); + }, + + _dispatchRepair: function(e) { + let obj = { + "staffId": this.staffId, + "staffName": this.staffName, + "context": this.context, + "repairId": this.repairId, + "repairType": this.repairType, + "action": this.action, + "communityId":this.java110Context.getCurrentCommunity().communityId, + "photos":[], + "userId":this.userId, + "userName":this.userName + } + let _photos = this.photos; + _photos.forEach(function(_item) { + obj.photos.push({ + "photo": _item + }); + }); + + let msg = ""; + if (obj.context == "") { + msg = "请填写处理意见"; + } else if (obj.staffId == "") { + msg = "请填写师傅"; + } else if (obj.staffName == "") { + msg = "请填写师傅"; + } else if (obj.repairId == "") { + msg = "数据错误"; + } + + if (msg != "") { + wx.showToast({ + title: msg, + icon: 'none', + duration: 2000 + }); + return; + } + this.java110Context.request({ + url: this.java110Constant.url.repairDispatch, // http://hc.demo.winqi.cn:8012/appApi/ownerRepair.saveOwnerRepair + header: this.java110Context.getHeaders(), + method: "POST", + data: obj, //动态数据 + success: function(res) { + let _json = res.data; + if (_json.code == 0) { + uni.navigateBack({ + delta: 1 + }) + return; + } + wx.showToast({ + title: _json.msg, + icon: 'none', + duration: 2000 + }) + }, + fail: function(e) { + wx.showToast({ + title: "服务器异常了", + icon: 'none', + duration: 2000 + }) + } + }); + + + }, + } }