From ec7f5ba1f7eb84507e1c8e7b6f66b1ecfbc22728 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期四, 17 四月 2025 17:31:25 +0800 Subject: [PATCH] 线上监管 --- model/enterprise.js | 3 components/stat-card/index.wxss | 2 pages/inspection/ranking/index.js | 86 +----- components/stat-card/index.wxml | 25 + pages/inspection/ranking/search/index.js | 158 +++++++++++++ pages/inspection/ranking/search/index.json | 7 pages/inspection/ranking/search/index.wxml | 70 +++++ pages/inspection/ranking/search/index.wxss | 61 +++++ project.private.config.json | 2 pages/home/inspection-proxy.js | 16 + miniprogram_npm/tdesign-miniprogram/progress/progress.wxss | 2 pages/inspection/ranking/index.wxss | 5 pages/simple-home/index.js | 7 app.json | 3 common/dataLocation.js | 76 +++--- model/sceneType.js | 2 pages/inspection/ranking/index.wxml | 85 ------ pages/home/supervision-proxy.js | 55 +++- pages/selfpatrol/components/patrol-task/index.wxss | 13 pages/home/inspection.wxml | 2 20 files changed, 456 insertions(+), 224 deletions(-) diff --git a/app.json b/app.json index 43e1e72..653678c 100644 --- a/app.json +++ b/app.json @@ -35,7 +35,8 @@ "pages/inspection/scene/info/index", "pages/inspection/scene/info/device-info/index", "pages/inspection/scene/info/device-status/index", - "pages/simple-home/index" + "pages/simple-home/index", + "pages/inspection/ranking/search/index" ], "tabBar": { "custom": true, diff --git a/common/dataLocation.js b/common/dataLocation.js index f756199..5af87a8 100644 --- a/common/dataLocation.js +++ b/common/dataLocation.js @@ -79,44 +79,44 @@ { label: '鍏卞拰鏂拌矾琛楅亾', value: '310106018' }, ], }, - { - label: '鏅檧鍖�', - value: '310107', - children: [ - { label: '鍏ㄩ儴琛楅晣', value: '-310107' }, - { label: '鏇规潹鏂版潙琛楅亾', value: '310107005' }, - { label: '涓囬噷琛楅亾', value: '310107021' }, - { label: '鐪熷闀囪閬�', value: '310107022' }, - { label: '闀垮緛闀�', value: '310107102' }, - { label: '妗冩郸闀�', value: '310107103' }, - { label: '鐭虫硥璺閬�', value: '310107017' }, - { label: '鐢樻硥璺閬�', value: '310107016' }, - { label: '闀垮璺閬�', value: '310107015' }, - { label: '闀块鏂版潙琛楅亾', value: '310107014' }, - { label: '瀹滃窛璺閬�', value: '310107020' }, - ], - }, - { - label: '闂佃鍖�', - value: '310112', - children: [ - { label: '鍏ㄩ儴琛楅晣', value: '-310112' }, - { label: '姹熷窛璺閬�', value: '310112001' }, - { label: '鍙ょ編琛楅亾', value: '310112006' }, - { label: '鏂拌櫣琛楅亾', value: '310112008' }, - { label: '娴﹂敠琛楅亾', value: '310112009' }, - { label: '鑾樺簞闀�', value: '310112101' }, - { label: '涓冨疂闀�', value: '310112102' }, - { label: '棰涙ˉ闀�', value: '310112103' }, - { label: '鍗庢紩闀�', value: '310112106' }, - { label: '铏规ˉ闀�', value: '310112107' }, - { label: '姊呴檱闀�', value: '310112108' }, - { label: '鍚存尘闀�', value: '310112110' }, - { label: '椹ˉ闀�', value: '310112112' }, - { label: '娴︽睙闀�', value: '310112114' }, - { label: '鑾樺簞宸ヤ笟鍖�', value: '310112501' }, - ], - }, + // { + // label: '鏅檧鍖�', + // value: '310107', + // children: [ + // { label: '鍏ㄩ儴琛楅晣', value: '-310107' }, + // { label: '鏇规潹鏂版潙琛楅亾', value: '310107005' }, + // { label: '涓囬噷琛楅亾', value: '310107021' }, + // { label: '鐪熷闀囪閬�', value: '310107022' }, + // { label: '闀垮緛闀�', value: '310107102' }, + // { label: '妗冩郸闀�', value: '310107103' }, + // { label: '鐭虫硥璺閬�', value: '310107017' }, + // { label: '鐢樻硥璺閬�', value: '310107016' }, + // { label: '闀垮璺閬�', value: '310107015' }, + // { label: '闀块鏂版潙琛楅亾', value: '310107014' }, + // { label: '瀹滃窛璺閬�', value: '310107020' }, + // ], + // }, + // { + // label: '闂佃鍖�', + // value: '310112', + // children: [ + // { label: '鍏ㄩ儴琛楅晣', value: '-310112' }, + // { label: '姹熷窛璺閬�', value: '310112001' }, + // { label: '鍙ょ編琛楅亾', value: '310112006' }, + // { label: '鏂拌櫣琛楅亾', value: '310112008' }, + // { label: '娴﹂敠琛楅亾', value: '310112009' }, + // { label: '鑾樺簞闀�', value: '310112101' }, + // { label: '涓冨疂闀�', value: '310112102' }, + // { label: '棰涙ˉ闀�', value: '310112103' }, + // { label: '鍗庢紩闀�', value: '310112106' }, + // { label: '铏规ˉ闀�', value: '310112107' }, + // { label: '姊呴檱闀�', value: '310112108' }, + // { label: '鍚存尘闀�', value: '310112110' }, + // { label: '椹ˉ闀�', value: '310112112' }, + // { label: '娴︽睙闀�', value: '310112114' }, + // { label: '鑾樺簞宸ヤ笟鍖�', value: '310112501' }, + // ], + // }, { label: '闀垮畞鍖�', value: '310105', diff --git a/components/stat-card/index.wxml b/components/stat-card/index.wxml index dbe7ca8..fa48062 100644 --- a/components/stat-card/index.wxml +++ b/components/stat-card/index.wxml @@ -2,7 +2,13 @@ <view class="wrap"> <view class="stat-card__title-wrap"> <view class="stat-card__title"> - <t-icon wx:if="{{icon}}" class="stat-card__title-icon" name="{{icon}}" size="36rpx" color="var(--td-brand-color)" /> + <t-icon + wx:if="{{icon}}" + class="stat-card__title-icon" + name="{{icon}}" + size="36rpx" + color="var(--td-brand-color)" + /> <text class="stat-card__title-text">{{title}}</text> </view> <text class="stat-card__sub-title" bind:tap="onSubTitleClick">{{subTitle}}</text> @@ -11,7 +17,6 @@ <t-loading theme="dots" size="50rpx" /> </view> <view wx:else class="stat-card__tags"> - <!-- <block wx:else> --> <view bindtap="handleClick" data-index="{{index}}" @@ -21,12 +26,18 @@ wx:index="index" > <view class="name"> - <text>{{item.name}}</text> - <t-icon name="chevron-right" size="var(--icon-width)" color="black" /> + <block wx:if="{{item.clickable != false}}"> + <text class="icon-text">{{item.name}}</text> + <t-icon name="chevron-right" size="var(--icon-width)" color="black" /> + </block> + <text wx:else>{{item.name}}</text> </view> - <view class="value" style="{{item.color ? 'color:' + item.color + ';' : ''}}"> {{item.value}} </view> - <view class="diff {{item.diff == '' ? 'diff-2' : ''}}"> {{item.diff == '' ? '0' : item.diff}} </view> + <view class="value" style="{{item.color ? 'color:' + item.color + ';' : ''}}"> + {{item.value}} + </view> + <view class="diff {{item.diff == '' ? 'diff-2' : ''}}"> + {{item.diff == '' ? '0' : item.diff}} + </view> </view> - <!-- </block> --> </view> </view> diff --git a/components/stat-card/index.wxss b/components/stat-card/index.wxss index 300c209..e4e4ad3 100644 --- a/components/stat-card/index.wxss +++ b/components/stat-card/index.wxss @@ -65,7 +65,7 @@ /* border: 1px black solid; */ } -.stat-card__tag .name>text { +.icon-text { margin-left: var(--icon-width); } diff --git a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss index dcfb073..3366120 100644 --- a/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss +++ b/miniprogram_npm/tdesign-miniprogram/progress/progress.wxss @@ -103,7 +103,7 @@ } .t-progress__canvas--circle .t-progress__info { margin: 0; - font-size: 40rpx; + font-size: var(--td-progress-info-font-size, 40rpx); font-weight: 700; line-height: 56rpx; overflow: hidden; diff --git a/model/enterprise.js b/model/enterprise.js index 4664f80..8f534f4 100644 --- a/model/enterprise.js +++ b/model/enterprise.js @@ -31,16 +31,19 @@ value: first, // diff: first == 0 ? '0%' : '100%', diff: '', + clickable: false, }, { name: '杩愯惀涓�', value: second, diff: first == 0 ? '0%' : `${p1}%`, + clickable: false, }, { name: '鍏抽棴', value: third, diff: first == 0 ? '0%' : `${p2}%`, + clickable: false, }, ]; } diff --git a/model/sceneType.js b/model/sceneType.js index 08251b7..8b8210a 100644 --- a/model/sceneType.js +++ b/model/sceneType.js @@ -23,7 +23,7 @@ let s = sceneMap[value] if (s == undefined) { if (value != undefined) { - s = '-1' + s = value } } return s diff --git a/pages/home/inspection-proxy.js b/pages/home/inspection-proxy.js index 06a155b..727361c 100644 --- a/pages/home/inspection-proxy.js +++ b/pages/home/inspection-proxy.js @@ -2,7 +2,7 @@ fetchInspectionStatistic, fetchSubtaskSummaryByArea, } from '../../services/inspection/fetchInspection'; -import dayjs from "dayjs"; +import dayjs from 'dayjs'; /** * 鐜板満宸℃煡鐩戠鐩稿叧淇℃伅鑾峰彇閫昏緫 @@ -17,7 +17,7 @@ fetchInspection(page) { this.setData({ inspectionLoading: true }); const { provinceCode, cityCode, districtCode, townCode, sceneTypeValue, time } = this.data; - const eTime = dayjs(time).endOf('M').format('YYYY-MM-DD HH:mm:ss') + const eTime = dayjs(time).endOf('M').format('YYYY-MM-DD HH:mm:ss'); fetchSubtaskSummaryByArea({ provincecode: provinceCode, citycode: cityCode, @@ -31,6 +31,7 @@ this.setData({ inspectionRes: res.data, }); + this.fetchSupervisionByDistrict(this.data.tabIndex); }) .finally(() => { this.setData({ inspectionLoading: false }); @@ -38,7 +39,18 @@ }, onTabsChange(e) { this.setData({ tabIndex: e.detail.value }); + this.fetchSupervisionByDistrict(e.detail.value); }, + + fetchSupervisionByDistrict(index) { + if (this.data.inspectionRes.length == 0) return; + + const { sceneTypeValue } = this.data; + const { provinceName, cityName, districtName } = this.data.inspectionRes[index]; + const params = { provinceName, cityName, districtName, sceneTypes: sceneTypeValue }; + this._fetchSupervision(1, params); + }, + navToInspection(e) { const i1 = e.detail.index; const { inspectionRes, time, sceneTypeText, sceneTypeValue, tabIndex } = this.data; diff --git a/pages/home/inspection.wxml b/pages/home/inspection.wxml index 684fbc4..056617f 100644 --- a/pages/home/inspection.wxml +++ b/pages/home/inspection.wxml @@ -29,7 +29,7 @@ </t-tabs> <stat-card - wx:elif="{{inspectionRes.length == 1}}" + wx:else title="鐜板満宸℃煡" subTitle="闂鍒嗘瀽 >" stats="{{inspectionRes[0].count}}" diff --git a/pages/home/supervision-proxy.js b/pages/home/supervision-proxy.js index ba39bdc..24823c8 100644 --- a/pages/home/supervision-proxy.js +++ b/pages/home/supervision-proxy.js @@ -13,6 +13,8 @@ riskRes: [], creditPeriod: '', creditRes: [], + // 鍙栨秷缃戠粶璇锋眰鏍囧織 + cancelFetch: [], }, lifetimes: { attached: function () {}, @@ -22,33 +24,53 @@ * 绾夸笂鐩戠缁熻淇℃伅 */ fetchSupervision(page) { + const { provinceName, cityName, districtName, townName, sceneTypeValue } = this.data; + const params = { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }; + this._fetchSupervision(page, params); + }, + + _fetchSupervision(page, params) { + // 鍙栨秷姝e湪杩涜涓殑涓婁竴娆¤姹� + let { cancelFetch } = this.data; + if (cancelFetch.length > 0) { + cancelFetch[0] = true; + cancelFetch = []; + } + let abort = false; + cancelFetch.push(abort); + this.setData({ cancelFetch }); this.setData({ supervisionLoading: true }); // 浼佷笟鏁伴噺 - const { provinceName, cityName, districtName, townName, sceneTypeValue } = this.data; const f1 = fetchEnterpriseCount({ - data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, + data: params, }).then(res => { - this.setData({ - enterpriseCountRes: res.data, - }); + if (!abort) { + this.setData({ + enterpriseCountRes: res.data, + }); + } }); // 缁煎悎椋庨櫓 const f2 = fetchRiskCount({ - data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, + data: params, }).then(res => { - this.setData({ - riskPeriod: res.data.period, - riskRes: res.data.count, - }); + if (!abort) { + this.setData({ + riskPeriod: res.data.period, + riskRes: res.data.count, + }); + } }); // 鐜俊鐮� const f3 = fetchCreditCodeCount({ - data: { provinceName, cityName, districtName, townName, sceneTypes: sceneTypeValue }, + data: params, }).then(res => { - this.setData({ - creditPeriod: res.data.period, - creditRes: res.data.count, - }); + if (!abort) { + this.setData({ + creditPeriod: res.data.period, + creditRes: res.data.count, + }); + } }); Promise.all([f1, f2, f3]).finally(() => { @@ -87,7 +109,8 @@ }, _navParams() { - const { provinceName, cityName, districtName, townName, sceneTypeValue, locationValue } = this.data; + const { provinceName, cityName, districtName, townName, sceneTypeValue, locationValue } = + this.data; let url = `?sceneType=${sceneTypeValue[0]}`; if (provinceName) url += `&province=${provinceName}`; if (cityName) url += `&city=${cityName}`; diff --git a/pages/inspection/ranking/index.js b/pages/inspection/ranking/index.js index 81dbd2f..1953f75 100644 --- a/pages/inspection/ranking/index.js +++ b/pages/inspection/ranking/index.js @@ -10,13 +10,7 @@ Page({ behaviors: [useLoading, useProblemChangeList, useStatistic, useSortOptions], data: { - // summaryList: [], - // sort: '', - // sortBy: 'pro', - // statistic: { - // proNum: 0, - // changeNum: 0, - // }, + placeholder: '杈撳叆鍏抽敭瀛楁悳绱㈠満鏅�', }, onLoad(options) { @@ -51,43 +45,6 @@ }); }, - // fetchSceneProSummary(params, page) { - // const params = _getParamsArea(this.data); - // return fetchSceneProSummary({ area: params, page }).then(res => { - // if (res.success) { - // this.setData({ - // summaryList: page == 1 ? res.data : this.data.summaryList.concat(res.data), - // }); - // } else { - // this.setData({ - // summaryList: [], - // }); - // } - // return res.head; - // }); - // }, - - // fetchProblems(params, page) { - // const params = _getParamsArea(this.data); - // return fetchProblemsStatistic(params).then(res => { - // let proNum = 0, - // changeNum = 0, - // changePer = 0; - // res.data.forEach(r => { - // proNum += r.count; - // changeNum += r.changeCount; - // }); - // if (proNum > 0) { - // changePer = Math.round((changeNum / proNum) * 1000) / 10; - // changePer += '%'; - // } - // this.setData({ - // statistic: { proNum, changeNum, changePer }, - // }); - // return res.head; - // }); - // }, - onTimePickerConfirm(e) { const { timeValue } = e.detail; this.setData({ @@ -115,29 +72,24 @@ this._startLoad(); }, - onSortChange(e) { - const { sorts } = e.detail; - const { type } = e.currentTarget.dataset; - this.setData({ - sort: sorts, - sortBy: type, - proSort: type == 'pro' ? sorts : 'default', - changeSort: type == 'changePer' ? sorts : 'default', - }); - this._startLoad(); - }, - - // navToDetail(e) { - // const { index } = e.currentTarget.dataset; - // const summary = this.data.summaryList[index]; - // wx.navigateTo({ - // url: '/pages/inspection/detail/index', - // success: result => { - // result.eventChannel.emit('acceptInspectionDetailData', { - // scene: summary.scene, - // time: this.data.time, - // }); - // }, + // onSortChange(e) { + // const { sorts } = e.detail; + // const { type } = e.currentTarget.dataset; + // this.setData({ + // sort: sorts, + // sortBy: type, + // proSort: type == 'pro' ? sorts : 'default', + // changeSort: type == 'changePer' ? sorts : 'default', // }); + // this._startLoad(); // }, + + navToSearchPage() { + wx.navigateTo({ + url: '/pages/inspection/ranking/search/index', + success: result => {}, + fail: res => {}, + complete: res => {}, + }); + }, }); diff --git a/pages/inspection/ranking/index.wxml b/pages/inspection/ranking/index.wxml index 2084d08..a3a8362 100644 --- a/pages/inspection/ranking/index.wxml +++ b/pages/inspection/ranking/index.wxml @@ -4,6 +4,9 @@ <view class="page"> <t-sticky> <view class="page-header"> + <view class="supervision-search" bind:tap="navToSearchPage"> + <t-search placeholder="{{placeholder}}" leftIcon="search" disabled> </t-search> + </view> <view class="filter-wrap"> <t-time-picker color="var(--td-font-white-1)" @@ -28,93 +31,11 @@ /> </view> <include src="/pages/inspection/ranking/statistic.wxml" /> - <!-- <view class="ranking-summary__item-abstract" style="margin-left: var(--td-spacer)"> - 闂鎬昏{{statistic.proNum}}涓紝宸叉暣鏀箋{statistic.changeNum}}涓紝鏈暣鏀箋{statistic.proNum - - statistic.changeNum}}涓紝鏁存敼鐜噞{statistic.changePer}} - </view> --> <include src="/pages/inspection/ranking/sort-options.wxml" /> - <!-- <view class="filter-wrap"> - <sort-btn - text="闂鏁�" - custom-class="flex-start " - icon-color="var(--td-warning-color-4)" - data-type="pro" - defaultSort="{{proSort}}" - bind:sortsChange="onSortChange" - ></sort-btn> - <sort-btn - text="鏁存敼鐜�" - custom-class="flex-start " - icon-color="var(--td-warning-color-4)" - data-type="changePer" - defaultSort="{{changeSort}}" - bind:sortsChange="onSortChange" - ></sort-btn> - </view> --> </view> </t-sticky> <view class="page-container"> <include src="./problem-change-list.wxml" /> - <!-- <template is="pulldown-loading" wx:if="{{pageLoading && summaryList.length != 0}}" /> - <block wx:if="{{summaryList.length > 0}}"> - <view - class="ranking-summary__item" - wx:for="{{summaryList}}" - data-index="{{index}}" - bind:tap="navToDetail" - > - <view style="flex: 1"> - <view class="ranking-summary__item-name">{{item.scene.name}} </view> - <t-divider /> - <view class="ranking-summary__item-tag__wrap"> - <view class="ranking-summary__item-abstract">鍦板潃锛歿{item.scene.location}} </view> - </view> - </view> - <view class="flex-v"> - <view class="ranking-summary__item-abstract flex-end" - >鏁存敼鐜囷細{{_.changePercent(item.proNum, item.changeNum)}}</view - > - <view class="ranking-summary__item-tag__wrap"> - <view class="ranking-summary__item-tag"> - <view class="ranking-summary__tag-count"> {{item.proNum}} </view> - <t-tag - max-width="{{130}}" - shape="square" - size="small" - theme="default" - variant="light-outline" - >闂</t-tag - > - </view> - <view class="ranking-summary__item-tag"> - <view - class="ranking-summary__tag-count {{_.tagBorderColor(item.proNum, item.changeNum)}}" - > - <text>{{item.changeNum}}</text> - <view></view> - </view> - <t-tag - max-width="{{130}}" - shape="square" - size="small" - theme="default" - variant="light-outline" - >鏁存敼</t-tag - > - </view> - </view> - <view class="ranking-summary__nav-icon"> - <t-icon name="chevron-right" size="24rpx" /> - </view> - </view> - </view> - </block> - <t-empty-page wx:elif="{{!pageLoading}}" description="鏆傛棤鐩稿叧璁板綍" /> - <load-more - list-is-empty="{{!summaryList.length}}" - status="{{loadStatus}}" - bind:retry="_startLoad" - /> --> </view> <view class="page-footer"></view> </view> diff --git a/pages/inspection/ranking/index.wxss b/pages/inspection/ranking/index.wxss index 83a1a31..25f1894 100644 --- a/pages/inspection/ranking/index.wxss +++ b/pages/inspection/ranking/index.wxss @@ -8,6 +8,11 @@ padding: initial; } +.supervision-search { + padding: 0 var(--td-spacer-1); + padding-top: 1px; +} + .filter-wrap { background: initial; } diff --git a/pages/inspection/ranking/search/index.js b/pages/inspection/ranking/search/index.js new file mode 100644 index 0000000..151dff6 --- /dev/null +++ b/pages/inspection/ranking/search/index.js @@ -0,0 +1,158 @@ +import { searchScene } from '../../../../services/inspection/fetchScene'; +import { useLoading } from '../../../../behaviors/loading'; + +Page({ + behaviors: [useLoading], + data: { + placeholder: '杈撳叆鍏抽敭璇嶆悳绱㈠満鏅�', + searchValue: '', + isSearch: false, + searchResult: [], + historyWords: [], + dialog: { + title: '纭鍒犻櫎褰撳墠鍘嗗彶璁板綍', + showCancelButton: true, + message: '', + }, + dialogShow: false, + }, + + historyTag: 'inspectionScene', + deleteType: 0, + deleteIndex: '', + + onLoad(options) {}, + + onShow() { + this.queryHistory(); + }, + + onReachBottom() { + this._loadMore(); + }, + + queryHistory() { + wx.getStorage({ + key: this.historyTag, + success: res => { + this.setData({ + historyWords: res.data, + }); + }, + }); + }, + + //鍒犻櫎鏌愪釜鍘嗗彶璁板綍 + deleteCurr(e) { + const { index } = e.currentTarget.dataset; + const { dialog } = this.data; + this.deleteIndex = index; + this.setData({ + dialog: { + ...dialog, + message: '纭鍒犻櫎褰撳墠鍘嗗彶璁板綍', + deleteType: 0, + }, + dialogShow: true, + }); + }, + + //娓呯┖鍘嗗彶璁板綍 + handleClearHistory() { + const { dialog } = this.data; + this.deleteType = 1; + this.setData({ + dialog: { + ...dialog, + message: '纭鍒犻櫎鎵�鏈夊巻鍙茶褰�', + }, + dialogShow: true, + }); + }, + + confirm() { + const { historyWords } = this.data; + const { deleteType, deleteIndex } = this; + if (deleteType === 0) { + historyWords.splice(deleteIndex, 1); + this.setData({ + historyWords, + dialogShow: false, + }); + } else { + this.setData({ historyWords: [], dialogShow: false }); + } + wx.setStorage({ + key: this.historyTag, + data: [], + }); + }, + + close() { + this.setData({ dialogShow: false }); + }, + + //鐐瑰嚮鍘嗗彶璁板綍 + handleHistoryTap(e) { + const { historyWords } = this.data; + const { dataset } = e.currentTarget; + const _searchValue = historyWords[dataset.index || 0] || ''; + if (_searchValue) { + this.setData({ searchValue: _searchValue }); + this._startLoad(); + } + }, + + //鐐瑰嚮鎼滅储 + handleSubmit() { + const { historyWords, searchValue } = this.data; + if (historyWords.indexOf(searchValue) == -1) { + historyWords.push(searchValue); + this.setData({ historyWords }); + } + wx.setStorage({ + key: this.historyTag, + data: historyWords, + }); + this._startLoad(); + }, + + //娓呴櫎鎼滅储 + handleClear() { + this.setData({ searchValue: '', searchResult: [], isSearch: false }); + }, + + handleChange() { + if (this.data.searchValue == '') { + this.setData({ searchResult: [], isSearch: false }); + } + }, + + _fetchData(page) { + const { searchValue } = this.data; + if (searchValue.length === 0) return; + this.setData({ isSearch: true }); + const area = { + sceneName: searchValue, + }; + return searchScene(area, page).then(res => { + this.setData({ + searchResult: page == 1 ? res.data : this.data.searchResult.concat(res.data), + }); + return res.head; + }); + }, + + handCellClick(e) { + const scene = e.detail; + wx.navigateTo({ + url: '/pages/inspection/detail/index', + success: result => { + result.eventChannel.emit('acceptInspectionDetailData', { + scene: scene, + time: new Date(), + }); + }, + }); + }, +}); diff --git a/pages/inspection/ranking/search/index.json b/pages/inspection/ranking/search/index.json new file mode 100644 index 0000000..dd371e0 --- /dev/null +++ b/pages/inspection/ranking/search/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "鎼滅储", + "onReachBottomDistance": 10, + "usingComponents": { + "scene-search-result": "/pages/inspection/scene/search/components/scene-search-result/index" + } +} \ No newline at end of file diff --git a/pages/inspection/ranking/search/index.wxml b/pages/inspection/ranking/search/index.wxml new file mode 100644 index 0000000..7cbc55b --- /dev/null +++ b/pages/inspection/ranking/search/index.wxml @@ -0,0 +1,70 @@ +<view class="page"> + <view class="page-header"> + <t-search + placeholder="{{placeholder}}" + model:value="{{searchValue}}" + bind:submit="handleSubmit" + bind:clear="handleClear" + bind:change="handleChange" + focus + > + </t-search> + </view> + + <view class="page-container"> + <scene-search-result + wx:for="{{searchResult}}" + wx:key="index" + wx:for-index="index" + result="{{item}}" + bind:click="handCellClick" + ></scene-search-result> + <load-more + list-is-empty="{{!searchResult.length}}" + status="{{loadStatus}}" + bind:retry="_startLoad" + /> + <t-empty + wx:if="{{loadStatus == 2 && isSearch && searchResult.length == 0}}" + icon="info-circle-filled" + description="鏃犲尮閰嶈褰�" + /> + <block wx:if="{{!isSearch}}"> + <view wx:if="{{historyWords.length > 0}}" class="history-wrap"> + <view class="search-header"> + <text class="search-title">鍘嗗彶鎼滅储</text> + <text class="search-clear" bind:tap="handleClearHistory">娓呴櫎</text> + </view> + <view class="search-content"> + <view + class="search-item" + hover-class="hover-history-item" + wx:for="{{historyWords}}" + bind:tap="handleHistoryTap" + bindlongpress="deleteCurr" + data-index="{{index}}" + wx:key="index" + > + {{item}} + </view> + </view> + </view> + <t-empty + wx:else + t-class-image="t-empty__image" + image="/res/nodata.png" + description="璇锋悳绱�" + /> + </block> + </view> + <view class="page-footer"></view> + <t-dialog + visible="{{dialogShow}}" + content="{{dialog.message}}" + bindconfirm="confirm" + bind:close="close" + confirm-btn="纭畾" + cancel-btn="{{dialog.showCancelButton ? '鍙栨秷' : null}}" + t-class-confirm="add-notes__confirm" + /> +</view> diff --git a/pages/inspection/ranking/search/index.wxss b/pages/inspection/ranking/search/index.wxss new file mode 100644 index 0000000..70c1d5c --- /dev/null +++ b/pages/inspection/ranking/search/index.wxss @@ -0,0 +1,61 @@ +.page { + background-color: var(--td-white-color1); +} + +.history-wrap { + margin-top: 44rpx; +} + +.search-header { + display: flex; + flex-flow: row nowrap; + justify-content: space-between; + align-items: center; +} + +.search-title { + font-size: 30rpx; + font-family: PingFangSC-Semibold, PingFang SC; + font-weight: 600; + color: rgba(51, 51, 51, 1); + line-height: 42rpx; +} + +.search-clear { + font-size: 24rpx; + font-family: PingFang SC; + line-height: 32rpx; + color: #999999; + font-weight: normal; +} + +.search-content { + overflow: hidden; + display: flex; + flex-flow: row wrap; + justify-content: flex-start; + align-items: flex-start; + margin-top: 24rpx; +} + +.search-item { + color: #333333; + font-size: 24rpx; + line-height: 32rpx; + font-weight: normal; + margin-right: 24rpx; + margin-bottom: 24rpx; + background: #f5f5f5; + border-radius: 38rpx; + padding: 12rpx 24rpx; +} + +.add-notes__confirm { + color: #fa4126 !important; + /* color: #0d80a3 !important; */ +} + +.t-empty__image { + width: 240rpx !important; + height: 240rpx !important; +} \ No newline at end of file diff --git a/pages/selfpatrol/components/patrol-task/index.wxss b/pages/selfpatrol/components/patrol-task/index.wxss index e1374ff..7ee1166 100644 --- a/pages/selfpatrol/components/patrol-task/index.wxss +++ b/pages/selfpatrol/components/patrol-task/index.wxss @@ -34,13 +34,14 @@ } .t-class-progress { - /* 鍘熸鏋朵腑鐨勬暣浣撳楂樻槸鍐欐鐨�224rpx锛屼慨鏀逛簡妗嗘灦娣诲姞涓や釜瀹介珮鍙橀噺 */ - --td-progress-width: 80rpx; - --td-progress-height: 80rpx; - /* 鏂囧瓧澶у皬鍚岀悊 */ + /* 锛�2023.10.11锛夊師妗嗘灦涓殑鏁翠綋瀹介珮鏄啓姝荤殑224rpx锛屼慨鏀逛簡妗嗘灦娣诲姞涓や釜瀹介珮鍙橀噺锛涳紙2024.11.19锛夋柊妗嗘灦鐗堟湰1.5.1 宸茬粡鍔犲叆鐩稿簲鐨勫彉閲� */ + --td-progress-circle-width: 80rpx; + /* --td-progress-width: 80rpx; + --td-progress-height: 80rpx; */ + /* 鏂囧瓧澶у皬鍘熸鏋朵腑娣诲姞浜嗕互涓嬭嚜瀹氫箟鍙橀噺 */ --td-progress-info-font-size: 20rpx; - /* 鍐呭湀瀹介珮鍚岀悊 */ - --td-progress-inner-size: calc(100% - 12rpx*1); + /* 鍐呭湀瀹介珮鍚岀悊锛涳紙2024.11.19锛夋柊妗嗘灦鐗堟湰1.5.1 宸茬粡鍔犲叆鐩稿簲鐨勫彉閲�*/ + --td-progress-stroke-circle-width: 6rpx; } /* .page .page-footer { diff --git a/pages/simple-home/index.js b/pages/simple-home/index.js index cf33640..cfc748d 100644 --- a/pages/simple-home/index.js +++ b/pages/simple-home/index.js @@ -44,6 +44,13 @@ this._loadMore(); }, + onScenePickerConfirm(e) { + this.setScene(e); + this.fetchSupervision(); + this.fetchInspection(); + this._startLoad(); + }, + /** * 鍒濆鍔犺浇 * 褰撴墍鏈夌瓫閫夋潯浠堕兘鑾峰彇鍒板垵濮嬪�煎悗锛屾墽琛屼竴娆″垵濮嬪寲鍔犺浇 diff --git a/project.private.config.json b/project.private.config.json index 0c5a5c1..50b824b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,7 +2,7 @@ "description": "椤圭洰绉佹湁閰嶇疆鏂囦欢銆傛鏂囦欢涓殑鍐呭灏嗚鐩� project.config.json 涓殑鐩稿悓瀛楁銆傞」鐩殑鏀瑰姩浼樺厛鍚屾鍒版鏂囦欢涓�傝瑙佹枃妗o細https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "ep-law-abiding-manage-weixin", "setting": { - "compileHotReLoad": false, + "compileHotReLoad": true, "urlCheck": false }, "libVersion": "3.5.3" -- Gitblit v1.9.3