diff --git a/miniprogram/app.json b/miniprogram/app.json index 47efdbc..c7b7084 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -1,14 +1,15 @@ { "pages": [ - "pages/evaluation/evaluation", - "pages/loading/loading", "pages/work/work", + "pages/loading/loading", "pages/mine/mine", "pages/bind/bind", + "pages/evaluation/evaluation", "pages/queryList/queryList", "pages/approvalWarning/approvalWarning", "pages/taskWarning/taskWarning", - "pages/approvalWarning/approvalForm/approvalForm" + "pages/approvalWarning/approvalForm/approvalForm", + "pages/workReport/workReport" ], "window": { "backgroundTextStyle": "light", diff --git a/miniprogram/pages/approvalWarning/approvalForm/approvalForm.js b/miniprogram/pages/approvalWarning/approvalForm/approvalForm.js index 3c03797..a57f3c2 100644 --- a/miniprogram/pages/approvalWarning/approvalForm/approvalForm.js +++ b/miniprogram/pages/approvalWarning/approvalForm/approvalForm.js @@ -42,7 +42,6 @@ Page({ //预览图片或文件 handlePreView(e){ let _url = e.currentTarget.dataset.url; - console.log(_url,'ddd'); if(_url.indexOf('.jpg') > -1 || _url.indexOf('.png') > -1){ //预览图片 wx.previewImage({ urls:[_url], @@ -114,7 +113,8 @@ Page({ }else{ wx.showToast({ title:res.msg, - duration:1500 + duration:1500, + icon:'none' }); } }) @@ -142,7 +142,8 @@ Page({ }else{ wx.showToast({ title:res.msg, - duration:1500 + duration:1500, + icon:'none' }); } }) diff --git a/miniprogram/pages/queryList/queryList.wxml b/miniprogram/pages/queryList/queryList.wxml index 0e823d9..0edf501 100644 --- a/miniprogram/pages/queryList/queryList.wxml +++ b/miniprogram/pages/queryList/queryList.wxml @@ -29,6 +29,7 @@ 部门:{{item.deptName?item.deptName:'暂无'}} 考核类型:{{item.type?item.type:'暂无'}} 考核指标:{{item.target?item.target:'暂无'}} + 指标明细:{{item.detailed?item.detailed:'暂无'}} 标准分:{{item.score?item.score:'暂无'}} 当前分数:{{item.nowScore?item.nowScore:'暂无'}} 当前分数:{{item.point}} diff --git a/miniprogram/pages/taskWarning/taskWarning.js b/miniprogram/pages/taskWarning/taskWarning.js index c4b82ed..88db7cf 100644 --- a/miniprogram/pages/taskWarning/taskWarning.js +++ b/miniprogram/pages/taskWarning/taskWarning.js @@ -42,7 +42,9 @@ Page({ //上传资料 handleSubmitFile(e){ let _data = e.currentTarget.dataset.item; - console.log(_data,'打印_data'); + wx.navigateTo({ + url:'../workReport/workReport?type='+_data.type+'&isRadio=true'+'&data='+JSON.stringify(_data) + }) }, /** diff --git a/miniprogram/pages/work/work.js b/miniprogram/pages/work/work.js index 14253ad..6fe0079 100644 --- a/miniprogram/pages/work/work.js +++ b/miniprogram/pages/work/work.js @@ -6,7 +6,7 @@ Page({ * 页面的初始数据 */ data: { - + typeOpt:['党务及意识形态','党风廉政建设','日常考核指标','年度考核指标'] }, /** @@ -16,6 +16,15 @@ Page({ }, + //跳转页面 + handleSwitch(e){ + let _type = e.currentTarget.dataset.type; + let typeName = this.data.typeOpt[Number(_type)]; + wx.navigateTo({ + url:'../workReport/workReport?type='+typeName + }) + }, + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/miniprogram/pages/work/work.wxml b/miniprogram/pages/work/work.wxml index a23af8f..782b9b1 100644 --- a/miniprogram/pages/work/work.wxml +++ b/miniprogram/pages/work/work.wxml @@ -1,18 +1,18 @@ - + 党务意识形态汇报 - + 党风廉政建设汇报 - + 日常考核汇报 - + 年度考核汇报 diff --git a/miniprogram/pages/workReport/workReport.js b/miniprogram/pages/workReport/workReport.js new file mode 100644 index 0000000..86276b9 --- /dev/null +++ b/miniprogram/pages/workReport/workReport.js @@ -0,0 +1,355 @@ +// pages/workReport/workReport.js +const {API: $api} = require("../../utils/api"); +import {base_url} from '../../utils/http'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + searchForm:{ + type:'', + target:'', + targetId:'' + }, + //搜索 + typeOpt:[ + {text:'请选择类型',value:''}, + {text:'党务及意识形态',value:'党务及意识形态'}, + {text:'党风廉政建设',value:'党风廉政建设'}, + {text:'日常考核指标',value:'日常考核指标'}, + {text:'年度考核指标',value:'年度考核指标'}, + ], + typeShow:false, + targetOpt:[], + targetShow:false, + mainActiveIndex:0, + activeId:null, + detailData:null, + fileList:[], + isRadio:false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if(options && JSON.stringify(options) !== '{}'){ + this.setData({ + "searchForm.type":options.type, + isRadio:options.isRadio?options.isRadio:false + }) + if(this.data.isRadio){ + this.setData({ + detailData:JSON.parse(options.data) + }) + }else{ + this.loadTargetData({type:options.type}); + } + } + }, + + //类型搜索 + handleTypeOpen(){ + this.setData({ + typeShow:true + }) + }, + handleTypeClose(){ + this.setData({ + typeShow:false + }) + }, + handleTypeChange(e){ + this.setData({ + "searchForm.type": e.detail, + typeShow:false, + targetOpt:[], + mainActiveIndex:0, + activeId:null, + detailData:null, + "searchForm.target":"" + }); + this.loadTargetData({type:this.data.searchForm.type}); + }, + handleTypeClick(event) { + const { name } = event.currentTarget.dataset; + this.setData({ + "searchForm.type": name, + typeShow:false, + targetOpt:[], + mainActiveIndex:0, + activeId:null, + detailData:null, + "searchForm.target":"" + }); + this.loadTargetData({type:this.data.searchForm.type}); + }, + + //指标搜索 + handleTargetOpen(){ + this.setData({ + targetShow:true + }) + }, + handleTargetClose(){ + this.setData({ + targetShow:false + }) + }, + handleTargetNav(e){ + this.setData({ + mainActiveIndex:e.detail.index + }) + }, + handleTargettem(e){ + this.setData({ + "searchForm.target":e.detail.text, + "searchForm.targetId":e.detail.id, + activeId:e.detail.id, + targetShow:false, + }) + this.loadDetailData(); + }, + + //上传之前 + handleBeforeUpload(e){ + const { file, callback } = e.detail; + if(file.url.indexOf('.jpg') > -1 || file.url.indexOf('.png') > -1 || file.url.indexOf('.pdf') > -1 || + file.url.indexOf('.jpg') > -1 || file.url.indexOf(".doc")>-1 || file.url.indexOf(".docx")>-1 || file.url.indexOf(".xlsx")>-1 || + file.url.indexOf(".xls")>-1){ + callback(true); + }else{ + wx.showToast({ + title:'支持jpg,png,pdf,doc,docx,xlsx,xls格式的文件!', + duration:2000, + icon:'none' + }) + callback(false); + } + }, + //上传数据 + handleUploadFile(e){ + const { file } = e.detail; + console.log(file,'file'); + let _fileList = this.data.fileList; + _fileList.push({ + name:file.name, + url:file.url, + index:_fileList.length + }); + this.setData({ + fileList:_fileList + }) + }, + + //预览文件 + handlePreView(e){ + let _url = e.currentTarget.dataset.url; + if(_url.indexOf('.jpg') > -1 || _url.indexOf('.png') > -1){ //预览图片 + wx.previewImage({ + urls:[_url], + current:_url + }) + }else{ //下载文件 + wx.downloadFile({ + url: _url, //仅为示例,并非真实的资源 + success (res) { + if(res.statusCode === 200){ + wx.openDocument({ + filePath: res.tempFilePath, + success: function (res) { + console.log(res,'打开文档成功') + } + }) + } + } + }) + } + }, + //删除文件 + handleDelFile(e){ + let _index = e.currentTarget.dataset.index; + let _fileList = this.data.fileList; + _fileList.forEach((val,idx) => { + if(val.index === _index){ + _fileList.splice(idx,1); + } + }); + _fileList.forEach((val,idx) => { + val.index = idx; + }) + this.setData({ + fileList:_fileList + }) + }, + //封装单个上传的方法 + uploadFile(params){ + return new Promise((resolve, reject) => { + wx.uploadFile({ + url: base_url+"/common/upload", + filePath: params.url, + name: 'file', + success: function(data){ + resolve(data); + }, + fail(data) { + reject(data); + } + }) + }) + }, + //批量上传多个文件的方法 + uploadFiles(fileList){ + let promises = fileList.map(item => this.uploadFile(item)); + return Promise.all(promises); + }, + //保存数据 + handleSubmit(){ + let _this = this; + if(!_this.data.detailData){ + wx.showToast({ + title:'请先查询上方汇报数据!', + duration:1500, + icon:'none' + }) + return false; + } + if(_this.data.fileList.length === 0){ + wx.showToast({ + title:'请上传附件!', + duration:1500, + icon:'none' + }) + return false; + } + let _data = _this.data.detailData; + let _files = []; + let _fileList = _this.data.fileList; + _this.uploadFiles(_fileList).then(obj => { + obj.forEach(item => { + let _data = JSON.parse(item.data); + _files.push(_data.fileName); + }) + let _submitForm = { + header:_data.header, + deptName:_data.deptName, + shotName:_data.shotName, + remark:_data.remark, + id:_data.id, + files:_files.join(',') + }; + $api.commit(_submitForm).then(res => { + if(res.code === 0){ + wx.showToast({ + title:'保存成功', + duration:1500 + }); + setTimeout(function () { + _this.setData({ + "searchForm.target":'', + "searchForm.targetId":'', + targetOpt:[], + mainActiveIndex:0, + activeId:null, + detailData:null, + fileList:[] + }) + },1500) + }else{ + wx.showToast({ + title:res.msg, + duration:1500, + icon:'none' + }); + } + }) + }) + + }, + + //加载指标 + loadTargetData(param){ + let _this = this; + $api.queryTree(param).then(res => { + if(res.code === 0){ + res.data.forEach((item,index) => { + item.index = index; + }) + _this.setData({ + targetOpt:res.data + }) + } + }) + }, + + //加载详情数据 + loadDetailData(){ + let _this = this; + $api.queryList({ + pageNum:1, + pageSize:10, + type:_this.data.searchForm.type, + id:_this.data.searchForm.targetId + }).then(res => { + if(res.code === 0){ + let _data = null; + if(res.rows.length>0){ + _data = res.rows[0]; + } + _this.setData({ + detailData:_data + }) + } + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/miniprogram/pages/workReport/workReport.json b/miniprogram/pages/workReport/workReport.json new file mode 100644 index 0000000..c1701b6 --- /dev/null +++ b/miniprogram/pages/workReport/workReport.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "工作汇报" +} \ No newline at end of file diff --git a/miniprogram/pages/workReport/workReport.wxml b/miniprogram/pages/workReport/workReport.wxml new file mode 100644 index 0000000..f491fc1 --- /dev/null +++ b/miniprogram/pages/workReport/workReport.wxml @@ -0,0 +1,99 @@ + + + + + + + + + + + 考核类型:{{detailData.type?detailData.type:'暂无'}} + 考核指标:{{detailData.target?detailData.target:'暂无'}} + 提交人:{{detailData.head?detailData.head:'暂无'}} + 提交时间:{{detailData.updateTime?detailData.updateTime:'暂无'}} + 考核要求:{{detailData.method?detailData.method:'暂无'}} + 督办科室:{{detailData.deptName?detailData.deptName:'暂无'}} + 评分办法:{{detailData.detailed?detailData.detailed:'暂无'}} + + + + + 附件上传 + + + 上传附件 + + + + + + + + + 保存 + + + + + + + + + + + + + + + + + + + + 暂无数据(请先选择类型) + diff --git a/miniprogram/pages/workReport/workReport.wxss b/miniprogram/pages/workReport/workReport.wxss new file mode 100644 index 0000000..ba04a7e --- /dev/null +++ b/miniprogram/pages/workReport/workReport.wxss @@ -0,0 +1,107 @@ +/* pages/workReport/workReport.wxss */ +.report_wrap{ + width: 100%; + height: 100vh; + overflow-y: auto; + box-sizing: border-box; + padding: 10px; + background-color: #e8e8e8; +} +.search_list{ + width: 100%; + background-color: #fff; + border-radius: 8px; + box-sizing: border-box; + padding: 10px; +} +.report_detail{ + width: 100%; + border-radius: 8px; + box-sizing: border-box; + padding: 10px; + margin-top: 10px; + font-size: 30rpx; + color: #5d5d5d; +} +.upload_file_wrap{ + width: 100%; + background-color: #fff; + border-radius: 8px; + box-sizing: border-box; + padding: 10px; + margin-top: 10px; + font-size: 30rpx; + color: #5d5d5d; +} +.file_title{ + font-size: 34rpx; + display: flex; + flex-direction: row; + align-items: center; +} +.file_btn{ + margin-left: 20px; +} +.file_list{ + width: 100%; + height: 40vh; + overflow-y: auto; + box-sizing: border-box; + padding: 10px; + border-radius: 4px; + border:1px solid silver; + margin-top: 20px; +} +.file_list_content{ + width: 100%; + height: 36vh; + overflow-y: auto; +} +.list_item{ + color: #5199ff; + font-size: 30rpx; + display: flex; + flex-direction: row; + align-items: center; + margin: 5px 0; +} +.list_item_left{ + width: 80%; + word-break: break-all; +} +.list_item_right{ + width: 15%; + margin-left: 5%; + height: 25px; + line-height: 25px; + text-align: center; + background-color: #f82222; + color: #fff; + border-radius: 4px; +} +.target_wrap{ + width: 100%; + height: 40vh; + overflow-y: auto; +} +.file_no_data{ + width: 100%; + margin-top: 10px; + text-align: center; + font-size: 30rpx; + color: #8d8d8d; +} +.no_data{ + width: 100%; + height: 40vh; + overflow-y: auto; + margin-top: 10px; + text-align: center; + font-size: 30rpx; + color: #8d8d8d; +} +.submit_btn{ + margin-top: 20px; + width: 100%; + text-align: center; +} \ No newline at end of file diff --git a/miniprogram/utils/api.js b/miniprogram/utils/api.js index cc6eecc..ae75078 100644 --- a/miniprogram/utils/api.js +++ b/miniprogram/utils/api.js @@ -28,6 +28,8 @@ const API = { deptList:data => http.request("POST","/wx/index/deptList",data,true), //人员数据 personList:data => http.request("POST","/wx/index/personList",data,true), + //上传 + upload:data => http.request("POST","/common/uploads",data,true) } module.exports = { API:API