diff --git a/weapp/app.json b/weapp/app.json
index 5443628..cc80f52 100644
--- a/weapp/app.json
+++ b/weapp/app.json
@@ -9,10 +9,9 @@
"root": "package",
"pages": [
"polling/polling",
+ "polling/inspectionRecordDetail/inspectionRecordDetail",
"basic/basic",
- "startInspection/startInspection",
- "inspectionRecord/inspectionRecord",
- "inspectionRecord/inspectionRecordDetail/inspectionRecordDetail"
+ "startInspection/startInspection"
]
}],
"window": {
diff --git a/weapp/components/timePicker/index.wxml b/weapp/components/timePicker/index.wxml
index 5c2299e..b6db0c3 100644
--- a/weapp/components/timePicker/index.wxml
+++ b/weapp/components/timePicker/index.wxml
@@ -5,7 +5,7 @@
-
+
diff --git a/weapp/package/inspectionRecord/inspectionRecord.js b/weapp/package/inspectionRecord/inspectionRecord.js
deleted file mode 100644
index 3f83ba9..0000000
--- a/weapp/package/inspectionRecord/inspectionRecord.js
+++ /dev/null
@@ -1,193 +0,0 @@
-// package/inspectionRecord/inspectionRecord.js
-import { getPatrolRecord } from "../../utils/getApiUrl";
-import { Request } from "../../common";
-const moment = require("../../utils/moment");
-
-Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- ResList: [ //阅读状态
- {
- value: 'all',
- text: '全部',
- },
- {
- value: 'normal',
- text: '正常',
- },
- {
- value: 'abnormal',
- text: '异常',
- }
- ],
- ResIndex: 0, //巡检结果
- dataList: [],
- isPickerRender: false,
- isPickerShow: false,
- startTime: "开始日期", //开始日期
- endTime: "结束日期", //结束日期
- pickerConfig: { //自定义时间选择器配置项
- endDate: true, //是否需要结束时间,为true时显示开始时间和结束时间两个picker
- column: "day", //可选的最小时间范围day、hour、minute、second
- dateLimit: true, //是否现在时间可选范围,false时可选任意时间;当为数字n时,范围是当前时间的最近n天
- initStartTime: "", //picker初始时间
- initEndTime: "", //picker初始结束时间
- // limitStartTime: "", //最小可选时间
- // limitEndTime: "" //最大可选时间
- },
- hidden: true,
- },
-
- // 巡检结果
- bindPickerRes(e) {
- let that = this;
- that.setData({
- ResIndex: e.detail.value
- })
- },
-
- // 时间选择器显示
- pickerShow: function () {
- this.setData({
- isPickerShow: true,
- isPickerRender: true,
- });
- },
-
- // 时间选择器隐藏
- pickerHide: function () {
- this.setData({
- isPickerShow: false,
- });
- },
-
- // 获取选择时间
- setPickerTime: function (val) {
- let data = val.detail;
- this.setData({
- startTime: data.startTime,
- endTime: data.endTime
- });
- },
-
- // 清空提交日期筛选框
- bindClearDate() {
- this.setData({
- startTime: '开始日期',
- endTime: '结束日期'
- })
- },
-
- // 查询
- bindSearch() {
- this.getPatrolRecord();
- },
-
- // 查看详情
- bindDetail(e) {
- let data = JSON.stringify(e.currentTarget.dataset.item);
- wx.navigateTo({
- url: '/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail?data=' + encodeURIComponent(data),
- })
- },
-
- // 获取巡检记录
- getPatrolRecord: function () {
- let that = this;
- let { endTime, startTime, ResList, ResIndex } = that.data;
- let sevenYearAgo = moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00');
- let currentData = moment().startOf('days').format('YYYY-MM-DD 23:59:59');
- let alarm = ResList[ResIndex].value == 'all' ? 'null' : ResList[ResIndex].value == 'normal' ? false : true;
- wx.showLoading({
- title: '加载中'
- })
- Request.get(getPatrolRecord('all', startTime == '开始日期' ? sevenYearAgo : startTime + ' 00:00:00', endTime == '结束日期' ? currentData : endTime + ' 23:59:59', alarm, 'null')).then(res => {
- if (res.length == 0) {
- that.setData({
- dataList: res,
- hidden: false
- })
- wx.hideLoading()
- return;
- }
- let dataSource = res.map(e => {
- e.lastInspectionTime = moment(e.lastInspectionTime).format('YYYY-MM-DD');
- e.inspectionTime = moment(e.inspectionTime).format('YYYY-MM-DD');
- return e;
- })
- that.setData({
- dataList: dataSource,
- hidden: true
- })
- wx.hideLoading()
- })
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.getPatrolRecord();
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- let that = this;
- that.setData({
- dataList: [],
- ResIndex: 0, //巡检结果
- startTime: "开始日期", //开始日期
- endTime: "结束日期", //结束日期
- })
- that.getPatrolRecord()
- // 手动控制回弹
- wx.stopPullDownRefresh();
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
-})
\ No newline at end of file
diff --git a/weapp/package/inspectionRecord/inspectionRecord.json b/weapp/package/inspectionRecord/inspectionRecord.json
deleted file mode 100644
index ceacfdc..0000000
--- a/weapp/package/inspectionRecord/inspectionRecord.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "navigationBarBackgroundColor": "#1979ff",
- "navigationBarTextStyle": "white",
- "navigationBarTitleText": "巡检记录",
- "enablePullDownRefresh": true,
- "usingComponents": {
- "timePicker": "/components/timePicker/index"
- }
-}
\ No newline at end of file
diff --git a/weapp/package/inspectionRecord/inspectionRecord.wxml b/weapp/package/inspectionRecord/inspectionRecord.wxml
deleted file mode 100644
index f792566..0000000
--- a/weapp/package/inspectionRecord/inspectionRecord.wxml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
- 时间范围:
-
-
-
- {{startTime}} 至 {{endTime}}
-
-
-
-
-
-
-
-
-
-
-
- 巡检结果:
-
- {{ResList[ResIndex].text}}
-
-
- 查询
-
-
-
-
-
-
-
-
- {{item.points.project.name}}
-
-
- 本次巡检日期:{{item.inspectionTime}}
-
-
- 巡检人:{{item.points.user.name}}
-
-
- 巡检结果:{{item.alarm ? '异常' : '正常'}}
-
- 查看详情
-
-
-
-
-
-
-
- 暂无数据~
-
\ No newline at end of file
diff --git a/weapp/package/inspectionRecord/inspectionRecord.wxss b/weapp/package/inspectionRecord/inspectionRecord.wxss
deleted file mode 100644
index 2d2b196..0000000
--- a/weapp/package/inspectionRecord/inspectionRecord.wxss
+++ /dev/null
@@ -1,79 +0,0 @@
-/* package/inspectionRecord/inspectionRecord.wxss */
-page {
- background: #F7F7FA;
-}
-
-.my-picker {
- white-space: nowrap;
- width: 100rpx;
-}
-
-.contentBox {
- padding: 210rpx 30rpx 20rpx;
-}
-
-.listBox {
- background-color: #fff;
- border-radius: 10rpx;
- box-shadow: 0rpx 0rpx 10rpx #ddd;
- margin: 30rpx auto;
- overflow: hidden;
-}
-
-.titleBox {
- overflow: hidden;
- padding-bottom: 20rpx;
- padding-top: 40rpx;
-}
-
-.title {
- float: left;
- font-size: 32rpx;
- width: 460rpx;
- font-weight: bold;
-}
-
-.btn {
- width: 130rpx;
- text-align: center;
- font-size: 30rpx;
- padding: 20rpx;
- background: #1979ff;
- color: #fff;
- border-radius: 10rpx;
- float: left;
- margin-left: 30rpx;
- margin-top: 20rpx;
-}
-
-.page-date {
- text-align: center;
- padding-top: 6rpx;
- margin-right: 20rpx;
- background: #fff;
-}
-
-.clearDate {
- float: left;
- line-height: 50rpx;
-}
-
-.clearDate image {
- width: 20rpx;
- height: 20rpx;
-}
-
-/* 暂无数据 */
-.noData {
- width: 254rpx;
- height: 298rpx;
- display: block;
- margin: 280rpx auto 16rpx;
-}
-
-.noTxt {
- font-size: 30rpx;
- color: #999;
- font-weight: bold;
- text-align: center;
-}
\ No newline at end of file
diff --git a/weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.js b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js
similarity index 100%
rename from weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.js
rename to weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.js
diff --git a/weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.json b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.json
similarity index 100%
rename from weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.json
rename to weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.json
diff --git a/weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.wxml b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.wxml
similarity index 100%
rename from weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.wxml
rename to weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.wxml
diff --git a/weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.wxss b/weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.wxss
similarity index 100%
rename from weapp/package/inspectionRecord/inspectionRecordDetail/inspectionRecordDetail.wxss
rename to weapp/package/polling/inspectionRecordDetail/inspectionRecordDetail.wxss
diff --git a/weapp/package/polling/polling.js b/weapp/package/polling/polling.js
index ace2ba1..aa4d6c9 100644
--- a/weapp/package/polling/polling.js
+++ b/weapp/package/polling/polling.js
@@ -1,5 +1,5 @@
// package/polling/polling.js
-import { getPatrolPlan } from "../../utils/getApiUrl";
+import { getPatrolPlan, getPatrolRecord } from "../../utils/getApiUrl";
import { Request } from "../../common";
const moment = require("../../utils/moment");
@@ -9,11 +9,44 @@ Page({
* 页面的初始数据
*/
data: {
+ /* 待巡检 */
dataList: [],
limit: 10, //条数
page: 0, //当前页
count: '', //总条数
hidden: true,
+ currentTab: '0',
+ /* 巡检记录 */
+ ResList: [ //阅读状态
+ {
+ value: 'all',
+ text: '全部',
+ },
+ {
+ value: 'normal',
+ text: '正常',
+ },
+ {
+ value: 'abnormal',
+ text: '异常',
+ }
+ ],
+ ResIndex: 0, //巡检结果
+ recordDataList: [],
+ isPickerRender: false,
+ isPickerShow: false,
+ startTime: "开始日期", //开始日期
+ endTime: "结束日期", //结束日期
+ pickerConfig: { //自定义时间选择器配置项
+ endDate: true, //是否需要结束时间,为true时显示开始时间和结束时间两个picker
+ column: "day", //可选的最小时间范围day、hour、minute、second
+ dateLimit: true, //是否现在时间可选范围,false时可选任意时间;当为数字n时,范围是当前时间的最近n天
+ initStartTime: "", //picker初始时间
+ initEndTime: "", //picker初始结束时间
+ // limitStartTime: "", //最小可选时间
+ // limitEndTime: "" //最大可选时间
+ },
+ recordHidden: true,
},
// 顶部tab切换
@@ -22,12 +55,18 @@ Page({
currentTab: e.currentTarget.dataset.current
})
if (e.currentTarget.dataset.current == '0') {
- wx.navigateTo({
- url: '/package/inspectionRecord/inspectionRecord',
+ this.setData({
+ page: 0,
+ dataList: []
+ }, () => {
+ this.getPatrolPlan();
})
+ } else if (e.currentTarget.dataset.current == '1') {
+ this.getPatrolRecord();
}
},
+ /***** 待巡检的方法 *****/
// 开始巡检
bindStart(e) {
let data = JSON.stringify(e.currentTarget.dataset.item);
@@ -70,6 +109,92 @@ Page({
})
},
+ /***** 巡检记录的方法 *****/
+ // 巡检结果
+ bindPickerRes(e) {
+ let that = this;
+ that.setData({
+ ResIndex: e.detail.value
+ })
+ },
+
+ // 时间选择器显示
+ pickerShow: function () {
+ this.setData({
+ isPickerShow: true,
+ isPickerRender: true,
+ });
+ },
+
+ // 时间选择器隐藏
+ pickerHide: function () {
+ this.setData({
+ isPickerShow: false,
+ });
+ },
+
+ // 获取选择时间
+ setPickerTime: function (val) {
+ let data = val.detail;
+ this.setData({
+ startTime: data.startTime,
+ endTime: data.endTime
+ });
+ },
+
+ // 清空提交日期筛选框
+ bindClearDate() {
+ this.setData({
+ startTime: '开始日期',
+ endTime: '结束日期'
+ })
+ },
+
+ // 查询
+ bindSearch() {
+ this.getPatrolRecord();
+ },
+
+ // 查看详情
+ bindDetail(e) {
+ let data = JSON.stringify(e.currentTarget.dataset.item);
+ wx.navigateTo({
+ url: '/package/polling/inspectionRecordDetail/inspectionRecordDetail?data=' + encodeURIComponent(data),
+ })
+ },
+
+ // 获取巡检记录
+ getPatrolRecord: function () {
+ let that = this;
+ let { endTime, startTime, ResList, ResIndex } = that.data;
+ let sevenYearAgo = moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00');
+ let currentData = moment().startOf('days').format('YYYY-MM-DD 23:59:59');
+ let alarm = ResList[ResIndex].value == 'all' ? 'null' : ResList[ResIndex].value == 'normal' ? false : true;
+ wx.showLoading({
+ title: '加载中'
+ })
+ Request.get(getPatrolRecord('all', startTime == '开始日期' ? sevenYearAgo : startTime + ' 00:00:00', endTime == '结束日期' ? currentData : endTime + ' 23:59:59', alarm, 'null')).then(res => {
+ if (res.length == 0) {
+ that.setData({
+ recordDataList: res,
+ recordHidden: false
+ })
+ wx.hideLoading()
+ return;
+ }
+ let dataSource = res.map(e => {
+ e.lastInspectionTime = moment(e.lastInspectionTime).format('YYYY-MM-DD');
+ e.inspectionTime = moment(e.inspectionTime).format('YYYY-MM-DD');
+ return e;
+ })
+ that.setData({
+ recordDataList: dataSource,
+ recordHidden: true
+ })
+ wx.hideLoading()
+ })
+ },
+
/**
* 生命周期函数--监听页面加载
*/
@@ -125,19 +250,31 @@ Page({
*/
onReachBottom() {
let _that = this;
- let page = _that.data.page + 1; //获取当前页数并+1
- let { dataList, count } = _that.data;
- if (dataList.length == count) {
- wx.showToast({
- title: '没有更多数据了...',
- icon: 'none',
+ if (_that.data.currentTab == '0') {
+ let page = _that.data.page + 1; //获取当前页数并+1
+ let { dataList, count } = _that.data;
+ if (dataList.length == count) {
+ wx.showToast({
+ title: '没有更多数据了...',
+ icon: 'none',
+ })
+ return;
+ }
+ _that.setData({
+ page: page, //更新当前页数
})
- return;
+ _that.getPatrolPlan()
+ } else if (_that.data.currentTab == '1') {
+ _that.setData({
+ recordDataList: [],
+ ResIndex: 0, //巡检结果
+ startTime: "开始日期", //开始日期
+ endTime: "结束日期", //结束日期
+ })
+ _that.getPatrolRecord()
+ // 手动控制回弹
+ wx.stopPullDownRefresh();
}
- _that.setData({
- page: page, //更新当前页数
- })
- _that.getPatrolPlan()
},
/**
diff --git a/weapp/package/polling/polling.json b/weapp/package/polling/polling.json
index 763c7d4..2d92c4b 100644
--- a/weapp/package/polling/polling.json
+++ b/weapp/package/polling/polling.json
@@ -2,5 +2,8 @@
"navigationBarBackgroundColor": "#1979ff",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "巡检",
- "enablePullDownRefresh": true
+ "enablePullDownRefresh": true,
+ "usingComponents": {
+ "timePicker": "/components/timePicker/index"
+ }
}
\ No newline at end of file
diff --git a/weapp/package/polling/polling.wxml b/weapp/package/polling/polling.wxml
index 0462163..44a1df7 100644
--- a/weapp/package/polling/polling.wxml
+++ b/weapp/package/polling/polling.wxml
@@ -1,36 +1,99 @@
-
+
- 巡检记录
-
+ 待巡检
+ 巡检记录
-
- 待巡检
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+ 计划时间:
+ {{item.startTime}}至{{item.endTime}}
+
+
+ 计划时间:
+ {{item.way}}({{item.frequency}})
+
+ 开始巡检
+
+
+
+
+
+
+
+ 暂无数据~
+
-
-
-
-
-
- {{item.name}}
-
-
- 计划时间:{{item.startTime}}至{{item.endTime}}
+
+
+
+
+ 时间范围:
+
+
+
+
+ {{startTime}}
+ 至
+ {{endTime}}
+
-
- 计划时间:{{item.way}}({{item.frequency}})
+
+
- 开始巡检
+
-
-
-
-
-
-
- 暂无数据~
+
+ 巡检结果:
+
+ {{ResList[ResIndex].text}}
+
+
+
+ 查询
+
+
+
+
+
+
+
+
+ {{item.points.project.name}}
+
+
+ 本次巡检日期:
+ {{item.inspectionTime}}
+
+
+ 巡检人:
+ {{item.points.user.name}}
+
+
+ 巡检结果:
+ {{item.alarm ? '异常' : '正常'}}
+
+ 查看详情
+
+
+
+
+
+
+
+ 暂无数据~
+
\ No newline at end of file
diff --git a/weapp/package/polling/polling.wxss b/weapp/package/polling/polling.wxss
index f2c7ece..06ece3f 100644
--- a/weapp/package/polling/polling.wxss
+++ b/weapp/package/polling/polling.wxss
@@ -27,16 +27,15 @@
position: relative;
}
-.active {
- color: #1979ff;
- position: relative;
+.wait-patrol {
+ /* 暂无数据 */
}
-.contentBox {
- padding: 210rpx 30rpx 20rpx;
+.wait-patrol .contentBox {
+ padding: 110rpx 30rpx 20rpx;
}
-.listBox {
+.wait-patrol .listBox {
background-color: #fff;
border-radius: 10rpx;
box-shadow: 0rpx 0rpx 10rpx #ddd;
@@ -44,20 +43,20 @@
overflow: hidden;
}
-.titleBox {
+.wait-patrol .titleBox {
overflow: hidden;
padding-bottom: 20rpx;
padding-top: 40rpx;
}
-.title {
+.wait-patrol .title {
float: left;
font-size: 32rpx;
width: 460rpx;
font-weight: bold;
}
-.btn {
+.wait-patrol .btn {
width: 130rpx;
text-align: center;
font-size: 30rpx;
@@ -70,15 +69,90 @@
margin-top: 20rpx;
}
-/* 暂无数据 */
-.noData {
+.wait-patrol .noData {
+ width: 254rpx;
+ height: 298rpx;
+ display: block;
+ margin: 280rpx auto 16rpx;
+}
+
+.wait-patrol .noTxt {
+ font-size: 30rpx;
+ color: #999;
+ font-weight: bold;
+ text-align: center;
+}
+
+#patrol-record {}
+
+#patrol-record .my-picker {
+ white-space: nowrap;
+ width: 100rpx;
+}
+
+#patrol-record .contentBox {
+ padding: 300rpx 30rpx 20rpx;
+}
+
+#patrol-record .listBox {
+ background-color: #fff;
+ border-radius: 10rpx;
+ box-shadow: 0rpx 0rpx 10rpx #ddd;
+ margin: 30rpx auto;
+ overflow: hidden;
+}
+
+#patrol-record .titleBox {
+ overflow: hidden;
+ padding-bottom: 20rpx;
+ padding-top: 40rpx;
+}
+
+#patrol-record .title {
+ float: left;
+ font-size: 32rpx;
+ width: 460rpx;
+ font-weight: bold;
+}
+
+#patrol-record .btn {
+ width: 130rpx;
+ text-align: center;
+ font-size: 30rpx;
+ padding: 20rpx;
+ background: #1979ff;
+ color: #fff;
+ border-radius: 10rpx;
+ float: left;
+ margin-left: 30rpx;
+ margin-top: 20rpx;
+}
+
+#patrol-record .page-date {
+ text-align: center;
+ padding-top: 6rpx;
+ margin-right: 20rpx;
+ background: #fff;
+}
+
+#patrol-record .clearDate {
+ float: left;
+ line-height: 50rpx;
+}
+
+#patrol-record .clearDate image {
+ width: 20rpx;
+ height: 20rpx;
+}
+
+#patrol-record .noData {
width: 254rpx;
height: 298rpx;
display: block;
margin: 280rpx auto 16rpx;
}
-.noTxt {
+#patrol-record .noTxt {
font-size: 30rpx;
color: #999;
font-weight: bold;