From 3282e95db0207ee133d1e98d9771dec9d83b0fc4 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期四, 02 四月 2026 16:24:38 +0800
Subject: [PATCH] 2026.4.2 新增专题管理功能
---
pages/inspection/scene/search/index.js | 198 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 145 insertions(+), 53 deletions(-)
diff --git a/pages/inspection/scene/search/index.js b/pages/inspection/scene/search/index.js
index 7c29cc3..396e984 100644
--- a/pages/inspection/scene/search/index.js
+++ b/pages/inspection/scene/search/index.js
@@ -1,66 +1,158 @@
-// pages/inspection/scene/search/index.js
+import { fetchEnterprise } from '../../../../services/enterprise/fetchEnterprise';
+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,
},
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
- */
- onLoad(options) {
+ historyTag: 'historyScene',
+ deleteType: 0,
+ deleteIndex: '',
- },
+ onLoad(options) {},
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
- */
- onReady() {
-
- },
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
- */
onShow() {
-
+ this.queryHistory();
},
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
- */
- onHide() {
-
- },
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
- */
- onUnload() {
-
- },
-
- /**
- * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
- */
onReachBottom() {
-
+ this._loadMore();
},
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage() {
+ queryHistory() {
+ wx.getStorage({
+ key: this.historyTag,
+ success: res => {
+ this.setData({
+ historyWords: res.data,
+ });
+ },
+ });
+ },
- }
-})
\ No newline at end of file
+ //鍒犻櫎鏌愪釜鍘嗗彶璁板綍
+ 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/scene/info/index',
+ success: result => {
+ result.eventChannel.emit('acceptSceneData', {
+ scene: scene,
+ });
+ },
+ });
+ },
+});
--
Gitblit v1.9.3