Browse Source

巡检报告页面

master
liujiangyong 2 years ago
parent
commit
b0ad098b53
  1. 1
      weapp/images/word.svg
  2. 83
      weapp/package/inspectionReport/inspectionReport.js
  3. 14
      weapp/package/inspectionReport/inspectionReport.json
  4. 31
      weapp/package/inspectionReport/inspectionReport.wxml
  5. 30
      weapp/package/inspectionReport/inspectionReport.wxss
  6. 7
      weapp/project.private.config.json
  7. 10
      weapp/utils/getApiUrl.js

1
weapp/images/word.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1677747046135" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2531" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M616.746667 85.333333L896 347.904V853.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H213.333333a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667a85.333333 85.333333 0 0 1 85.333333-85.333334h403.413334z m244.352 295.381334L581.802667 118.186667v177.237333a85.333333 85.333333 0 0 0 85.333333 85.333333h193.962667z m-107.264 76.373333h-49.152l-79.488 227.157333-109.354667-227.114666h-13.226667l-110.506666 226.688-77.824-226.688H265.130667l113.749333 328.192h13.226667l117.12-239.36 114.858666 239.36h13.781334l115.968-328.192z" fill="#0F90E3" p-id="2532"></path></svg>

After

Width:  |  Height:  |  Size: 916 B

83
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();
},
/**

14
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"
}
}

31
weapp/package/inspectionReport/inspectionReport.wxml

@ -1,2 +1,29 @@
<!--package/inspectionReport/inspectionReport.wxml-->
<text>package/inspectionReport/inspectionReport.wxml</text>
<!-- package/inspectionReport/inspectionReport.wxml -->
<view>
<van-cell-group>
<van-cell title="结构物" value="{{structures[curStru]}}" is-link arrow-direction="down" data-item="stru" bind:click="showPopup" />
<van-popup show="{{ struVisible }}" data-item="stru" bind:close="onClose" round position="bottom" custom-style="height: 40%">
<van-picker columns="{{ structures }}" bind:change="onStruChange" default-index="{{ curStru }}" loading="{{struLoading}}" />
</van-popup>
<van-cell title="时间" title-width="80rpx" value="{{formatStartTime + ' - ' + formatEndTime}}" is-link arrow-direction="down" data-item="date" bind:click="showPopup" />
<van-popup show="{{ dateVisible }}" data-item="date" bind:close="onClose" round position="bottom" custom-style="height: 40%">
<view style="max-height:100%; display:flex" class="time-option">
<van-datetime-picker type="datetime" show-toolbar="{{false}}" type="date" value="{{ startTime }}" bind:input="onStartTimeChange" />
<view style="display:flex; align-items:center">至</view>
<van-datetime-picker type="datetime" show-toolbar="{{false}}" type="date" value="{{ endTime }}" bind:input="onEndTimeChange" />
</view>
</van-popup>
</van-cell-group>
<view wx:if="{{report.length}}">
<view class="file-box" wx:for="{{report}}">
<view class="file">
<image class="logo" src="/images/word.svg"></image>
<view>2143654.docx</view>
</view>
<van-button type="primary" size="small" color="#169bd5" bind:click="download">下载</van-button>
</view>
</view>
<view wx:else>
<van-empty description="暂无数据" />
</view>
</view>

30
weapp/package/inspectionReport/inspectionReport.wxss

@ -1 +1,31 @@
/* 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;
}

7
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
}
]
}

10
weapp/utils/getApiUrl.js

@ -48,3 +48,13 @@ exports.getStructuresUsers = () => {
exports.editPatrolRecordIssueHandle = (id) => {
return '/patrolRecord/issue/handle/' + id
}
// 获取结构物
exports.getStructuresList = () => {
return `/projectList`
}
// 获取巡检报告
exports.getPatrolReport = () => {
return `/getPatrolReport`
}
Loading…
Cancel
Save