diff --git a/weapp/images/word.svg b/weapp/images/word.svg new file mode 100644 index 0000000..8e60511 --- /dev/null +++ b/weapp/images/word.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.js b/weapp/package/inspectionReport/inspectionReport.js index 0fccf18..9d4afcc 100644 --- a/weapp/package/inspectionReport/inspectionReport.js +++ b/weapp/package/inspectionReport/inspectionReport.js @@ -1,18 +1,99 @@ // package/inspectionReport/inspectionReport.js +import { getStructuresList, getPatrolReport } from "../../utils/getApiUrl"; +import { Request } from "../../common"; +const moment = require("../../utils/moment"); + Page({ /** * 页面的初始数据 */ data: { + structures: [], // 结构物 + struLoading: false, + struVisible: false, + dateVisible: false, + curStru: 0, // 选中结构物index + startTime: new Date().getTime(), + endTime: new Date().getTime(), + formatStartTime: moment(new Date().getTime()).format('YYYY-MM-DD'), + formatEndTime: moment(new Date().getTime()).format('YYYY-MM-DD'), + report: [1, 2], // 巡检报告 + }, + + showPopup(e) { + const { item } = e.currentTarget.dataset; + this.setData({ [`${item}Visible`]: true }); + }, + onClose(e) { + const { item } = e.currentTarget.dataset; + this.setData({ [`${item}Visible`]: false }); + console.log('请求报告') + // 获取报告 + // const body = {} + // Request.get(getPatrolReport(body)).then(res => { + // console.log(res) + // }) + }, + + onStruChange(e) { + if (e.detail) { + const { value, index } = e.detail; + console.log(`当前值:${value}, 当前索引:${index}`); + this.setData({ + curStru: index + }) + } + }, + // 时间选择 + onStartTimeChange(event) { + this.setData({ + startTime: event.detail, + formatStartTime: moment(event.detail).format('YYYY-MM-DD') + }); + }, + onEndTimeChange(event) { + this.setData({ + endTime: event.detail, + formatEndTime: moment(event.detail).format('YYYY-MM-DD'), + }); + }, + + download() { + wx.showLoading({ title: '下载中...' }); + wx.downloadFile({ + url: 'http://10.8.16.102:5900/_file-server/project/d178aef7-4a88-41c4-aa82-4254fbcf884e/16518450744352.jpg', // 仅为示例,并非真实的资源 + success(downloadRes) { + wx.hideLoading(); + if (downloadRes.statusCode === 200) { + const filePath = downloadRes.tempFilePath; + wx.openDocument({ + filePath: filePath, + success: function (res) { + console.log('打开文档成功'); + } + }) + } + } + }) + }, + + getStructuresList() { + this.setData({ struLoading: true }); + Request.get(getStructuresList()).then(res => { + this.setData({ + struLoading: false, + structures: ['全部', ...res.rows.map(s => s.name)] + }) + }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + this.getStructuresList(); }, /** diff --git a/weapp/package/inspectionReport/inspectionReport.json b/weapp/package/inspectionReport/inspectionReport.json index 8835af0..edafa52 100644 --- a/weapp/package/inspectionReport/inspectionReport.json +++ b/weapp/package/inspectionReport/inspectionReport.json @@ -1,3 +1,15 @@ { - "usingComponents": {} + "navigationBarBackgroundColor": "#1979ff", + "navigationBarTextStyle": "white", + "navigationBarTitleText": "巡检报告", + "usingComponents": { + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index", + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index", + "van-button": "@vant/weapp/button/index", + "van-divider": "@vant/weapp/divider/index", + "van-empty": "@vant/weapp/empty/index" + } } \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.wxml b/weapp/package/inspectionReport/inspectionReport.wxml index 90de8ed..e29cddb 100644 --- a/weapp/package/inspectionReport/inspectionReport.wxml +++ b/weapp/package/inspectionReport/inspectionReport.wxml @@ -1,2 +1,29 @@ - -package/inspectionReport/inspectionReport.wxml + + + + + + + + + + + + + + + + + + + + + 2143654.docx + + 下载 + + + + + + \ No newline at end of file diff --git a/weapp/package/inspectionReport/inspectionReport.wxss b/weapp/package/inspectionReport/inspectionReport.wxss index b130672..15b9675 100644 --- a/weapp/package/inspectionReport/inspectionReport.wxss +++ b/weapp/package/inspectionReport/inspectionReport.wxss @@ -1 +1,31 @@ -/* package/inspectionReport/inspectionReport.wxss */ \ No newline at end of file +/* package/inspectionReport/inspectionReport.wxss */ +.time-option { + display: flex; + justify-content: space-evenly; +} + +.time-option .van-picker { + width: 45vw; +} + +.file-box { + width: 94%; + height: 100rpx; + padding: 0 20rpx; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid rgb(240, 239, 239); +} + +.file-box .file .logo { + width: 80rpx; + height: 80rpx; + float: left; + margin-right: 20rpx; +} + +.file-box .file { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/weapp/project.private.config.json b/weapp/project.private.config.json index 7aeb8b7..1e5f97d 100644 --- a/weapp/project.private.config.json +++ b/weapp/project.private.config.json @@ -21,6 +21,13 @@ "query": "shootingid=5", "launchMode": "default", "scene": null + }, + { + "name": "巡检报告", + "pathName": "package/inspectionReport/inspectionReport", + "query": "", + "launchMode": "default", + "scene": null } ] } diff --git a/weapp/utils/getApiUrl.js b/weapp/utils/getApiUrl.js index 154285b..747be14 100644 --- a/weapp/utils/getApiUrl.js +++ b/weapp/utils/getApiUrl.js @@ -47,4 +47,14 @@ exports.getStructuresUsers = () => { exports.editPatrolRecordIssueHandle = (id) => { return '/patrolRecord/issue/handle/' + id +} + +// 获取结构物 +exports.getStructuresList = () => { + return `/projectList` +} + +// 获取巡检报告 +exports.getPatrolReport = () => { + return `/getPatrolReport` } \ No newline at end of file