diff --git a/weapp/app.json b/weapp/app.json index 8f0f3f8..057624e 100644 --- a/weapp/app.json +++ b/weapp/app.json @@ -60,5 +60,6 @@ "requiredPrivateInfos": [ "getLocation" ], - "sitemapLocation": "sitemap.json" + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents" } \ No newline at end of file diff --git a/weapp/app.wxss b/weapp/app.wxss index 06c6fc9..4c14ea7 100644 --- a/weapp/app.wxss +++ b/weapp/app.wxss @@ -1,4 +1,13 @@ /**app.wxss**/ +.page { + /* vant 全局CSS变量 */ + /* DropdownMenu */ + --dropdown-menu-background-color: transparent; + --dropdown-menu-box-shadow: none; + --dropdown-menu-title-active-text-color: #1684FF; + --dropdown-menu-option-active-color: #1684FF; +} + .container { height: 100%; display: flex; @@ -7,4 +16,4 @@ justify-content: space-between; padding: 200rpx 0; box-sizing: border-box; -} +} diff --git a/weapp/images/noData.svg b/weapp/images/noData.svg new file mode 100644 index 0000000..3d77e8f --- /dev/null +++ b/weapp/images/noData.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/weapp/images/title_icon.svg b/weapp/images/title_icon.svg new file mode 100644 index 0000000..a4d0de7 --- /dev/null +++ b/weapp/images/title_icon.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/weapp/package/polling/polling.js b/weapp/package/polling/polling.js index 4a7fe44..f6626ac 100644 --- a/weapp/package/polling/polling.js +++ b/weapp/package/polling/polling.js @@ -15,7 +15,7 @@ Page({ page: 0, //当前页 count: '', //总条数 hidden: true, - currentTab: '0', + currentTab: 0, /* 巡检记录 */ ResList: [ //阅读状态 { @@ -31,12 +31,12 @@ Page({ text: '异常', } ], - ResIndex: 0, //巡检结果 + ResIndex: 'all', //巡检结果 recordDataList: [], isPickerRender: false, isPickerShow: false, - startTime: "开始日期", //开始日期 - endTime: "结束日期", //结束日期 + startTime: moment().subtract(7, 'days').valueOf(), //开始日期 + endTime: moment().startOf('days').valueOf(), //结束日期 pickerConfig: { //自定义时间选择器配置项 endDate: true, //是否需要结束时间,为true时显示开始时间和结束时间两个picker column: "day", //可选的最小时间范围day、hour、minute、second @@ -50,18 +50,18 @@ Page({ }, // 顶部tab切换 - clickTab (e) { + onChange(event) { this.setData({ - currentTab: e.currentTarget.dataset.current + currentTab: event.detail.name }) - if (e.currentTarget.dataset.current == '0') { + if (event.detail.name === 0) { this.setData({ page: 0, dataList: [] }, () => { this.getPatrolPlan(); }) - } else if (e.currentTarget.dataset.current == '1') { + } else if (event.detail.name === 1) { this.getPatrolRecord(); } }, @@ -112,44 +112,22 @@ Page({ /***** 巡检记录的方法 *****/ // 巡检结果 bindPickerRes (e) { - let that = this; - that.setData({ - ResIndex: e.detail.value + this.setData({ + ResIndex: e.detail }) }, - - // 时间选择器显示 - pickerShow: function () { + // 时间选择 + onStartTimeChange (event) { this.setData({ - isPickerShow: true, - isPickerRender: true, + startTime: event.detail, }); }, - - // 时间选择器隐藏 - pickerHide: function () { + onEndTimeChange (event) { this.setData({ - isPickerShow: false, + endTime: event.detail, }); }, - // 获取选择时间 - setPickerTime: function (val) { - let data = val.detail; - this.setData({ - startTime: data.startTime, - endTime: data.endTime - }); - }, - - // 清空提交日期筛选框 - bindClearDate () { - this.setData({ - startTime: '开始日期', - endTime: '结束日期' - }) - }, - // 查询 bindSearch () { this.getPatrolRecord(); @@ -166,14 +144,12 @@ Page({ // 获取巡检记录 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; + let { endTime, startTime, ResIndex } = that.data; + let alarm = ResIndex == 'all' ? 'null' : ResIndex == '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 => { + Request.get(getPatrolRecord('all', moment(startTime).format('YYYY-MM-DD') + ' 00:00:00', moment(endTime).format('YYYY-MM-DD') + ' 23:59:59', alarm, 'null')).then(res => { if (res.length == 0) { that.setData({ recordDataList: res, @@ -241,7 +217,7 @@ Page({ */ onPullDownRefresh () { let that = this; - if (that.data.currentTab == '0') { + if (that.data.currentTab === 0) { that.setData({ dataList: [], page: 0, //当前页 @@ -250,12 +226,12 @@ Page({ that.getPatrolPlan() // 手动控制回弹 wx.stopPullDownRefresh(); - } else if (that.data.currentTab == '1') { + } else if (that.data.currentTab === 1) { that.setData({ recordDataList: [], - ResIndex: 0, //巡检结果 - startTime: "开始日期", //开始日期 - endTime: "结束日期", //结束日期 + ResIndex: 'all', //巡检结果 + startTime: moment().subtract(7, 'days').valueOf(), //开始日期 + endTime: moment().startOf('days').valueOf(), //结束日期 }) that.getPatrolRecord() // 手动控制回弹 @@ -268,7 +244,7 @@ Page({ */ onReachBottom () { let _that = this; - if (_that.data.currentTab == '0') { + if (_that.data.currentTab === 0) { let page = _that.data.page + 1; //获取当前页数并+1 let { dataList, count } = _that.data; if (dataList.length == count) { diff --git a/weapp/package/polling/polling.json b/weapp/package/polling/polling.json index 2d92c4b..b7423fa 100644 --- a/weapp/package/polling/polling.json +++ b/weapp/package/polling/polling.json @@ -4,6 +4,11 @@ "navigationBarTitleText": "巡检", "enablePullDownRefresh": true, "usingComponents": { - "timePicker": "/components/timePicker/index" + "timePicker": "/components/timePicker/index", + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index", + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index", + "van-datetime-picker": "@vant/weapp/datetime-picker/index" } } \ No newline at end of file diff --git a/weapp/package/polling/polling.wxml b/weapp/package/polling/polling.wxml index 44a1df7..0707fbe 100644 --- a/weapp/package/polling/polling.wxml +++ b/weapp/package/polling/polling.wxml @@ -1,99 +1,83 @@ - - - 待巡检 - 巡检记录 - - - - - - - - - - {{item.name}} + + + + + + + + + + {{item.name}} + + + 计划时间: + {{item.startTime}}至{{item.endTime}} + + + 计划时间: + {{item.way}}({{item.frequency}}) + + + 开始巡检 + - - 计划时间: - {{item.startTime}}至{{item.endTime}} - - - 计划时间: - {{item.way}}({{item.frequency}}) - - 开始巡检 - + - - - - - - - - - - - 时间范围: - - - - - {{startTime}} - - {{endTime}} - - - - - - - - - - 巡检结果: - - {{ResList[ResIndex].text}} - - - - 查询 + + - - - - - - - {{item.points.project.name}} + + + + + + + + + - - 本次巡检日期: - {{item.inspectionTime}} + + + + + + + + + + {{item.points.project.name}} + + + 本次巡检日期: + {{item.inspectionTime}} + + + + 巡检人: + {{item.points.user.name}} + + + 巡检结果: + {{item.alarm ? '异常' : '正常'}} + + + + 查看详情 + - - 巡检人: - {{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 06ece3f..1606588 100644 --- a/weapp/package/polling/polling.wxss +++ b/weapp/package/polling/polling.wxss @@ -16,7 +16,6 @@ top: 0; z-index: 100; background: #fff; - border-bottom: 2rpx solid #e8e8e8; } .swiper-tab-item { @@ -27,18 +26,34 @@ position: relative; } +.divider { + width: 100%; + height: 0px; + border-top: 1px solid #F5F5F5; + margin-top: 19px; + margin-bottom: 9px; +} + +.flex-between { + display: flex; + justify-content: space-between; +} + +.time-option .van-picker{ + width: 45vw; +} + .wait-patrol { /* 暂无数据 */ } .wait-patrol .contentBox { - padding: 110rpx 30rpx 20rpx; + padding: 0rpx 30rpx 20rpx; } .wait-patrol .listBox { background-color: #fff; border-radius: 10rpx; - box-shadow: 0rpx 0rpx 10rpx #ddd; margin: 30rpx auto; overflow: hidden; } @@ -46,27 +61,49 @@ .wait-patrol .titleBox { overflow: hidden; padding-bottom: 20rpx; - padding-top: 40rpx; + padding-top: 38rpx; +} + +.wait-patrol .icon { + float: left; + width: 24px; + height: 24px; + margin-right: 5px; } .wait-patrol .title { float: left; - font-size: 32rpx; - width: 460rpx; + font-size: 16px; + line-height: 24px; font-weight: bold; + color: #333333; +} + +.wait-patrol .text-key { + font-weight: 400; + font-size: 14px; + color: #000000a6; +} + +.wait-patrol .text-value { + font-weight: 400; + font-size: 14px; + color: #000000d9; } .wait-patrol .btn { - width: 130rpx; + float: right; + margin-right: 12px; + margin-bottom: 10px; + width: 76px; + height: 26px; + background: #1684FF; + border-radius: 16px; + font-weight: 400; + font-size: 13px; + line-height: 26px; + color: #FFFFFF; text-align: center; - font-size: 30rpx; - padding: 20rpx; - background: #1979ff; - color: #fff; - border-radius: 10rpx; - float: left; - margin-left: 30rpx; - margin-top: 20rpx; } .wait-patrol .noData { @@ -91,13 +128,13 @@ } #patrol-record .contentBox { - padding: 300rpx 30rpx 20rpx; + padding: 0rpx 30rpx 20rpx; + margin-top: -15px; } #patrol-record .listBox { background-color: #fff; border-radius: 10rpx; - box-shadow: 0rpx 0rpx 10rpx #ddd; margin: 30rpx auto; overflow: hidden; } @@ -105,27 +142,49 @@ #patrol-record .titleBox { overflow: hidden; padding-bottom: 20rpx; - padding-top: 40rpx; + padding-top: 38rpx; +} + +#patrol-record .icon { + float: left; + width: 24px; + height: 24px; + margin-right: 5px; } #patrol-record .title { float: left; - font-size: 32rpx; - width: 460rpx; + font-size: 16px; + line-height: 24px; font-weight: bold; + color: #333333; +} + +#patrol-record .text-key { + font-weight: 400; + font-size: 14px; + color: #000000a6; +} + +#patrol-record .text-value { + font-weight: 400; + font-size: 14px; + color: #000000d9; } #patrol-record .btn { - width: 130rpx; + float: right; + margin-right: 12px; + margin-bottom: 10px; + width: 76px; + height: 26px; + background: #1684FF; + border-radius: 16px; + font-weight: 400; + font-size: 13px; + line-height: 26px; + color: #FFFFFF; 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 { @@ -149,7 +208,7 @@ width: 254rpx; height: 298rpx; display: block; - margin: 280rpx auto 16rpx; + margin: 100rpx auto 16rpx; } #patrol-record .noTxt {