From f2a0ea849099f49a3d2a9c7e5c44d033df22468f Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 14 八月 2024 14:55:38 +0800 Subject: [PATCH] 设备管理模块 --- pages/usercenter/menu.js | 2 miniprogram_npm/tdesign-miniprogram/cascader/cascader.json | 1 pages/inspection/scene/index.js | 4 custom-tab-bar/index.js | 14 services/inspection/fetchInspection.js | 8 miniprogram_npm/tdesign-miniprogram/cascader/cascader.js | 158 +------- app.js | 2 miniprogram_npm/tdesign-miniprogram/cascader/README.md | 33 - pages/enterprise/ledger/history/index.js | 1 pages/inspection/scene/info/devicelist.wxml | 4 pages/inspection/scene/search/index.wxml | 73 +++ services/inspection/fetchDevice.js | 3 behaviors/loadConfig.js | 1 pages/inspection/scene/search/index.wxss | 62 +++ components/search/index.js | 40 ++ components/search/index.wxml | 70 +++ pages/inspection/scene/search/components/scene-search-result/index.js | 35 + pages/inspection/scene/search/index.js | 198 ++++++++-- components/search/index.wxss | 1 miniprogram_npm/tdesign-miniprogram/cascader/props.js | 4 components/filter/index.wxml | 8 custom-tab-bar/index.wxss | 4 custom-tab-bar/index.wxml | 21 config/index.js | 10 pages/inspection/scene/index.wxml | 7 model/device.js | 29 + miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml | 4 pages/inspection/scene/info/components/device-location/index.wxml | 67 ++- miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss | 44 +- pages/inspection/scene/info/components/device-location/index.wxss | 11 project.private.config.json | 4 pages/inspection/scene/search/components/scene-search-result/index.json | 4 pages/inspection/scene/search/components/scene-search-result/index.wxml | 31 + custom-tab-bar/data.js | 14 miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts | 4 common/dataLocation.js | 8 pages/inspection/scene/search/components/scene-search-result/index.wxss | 8 pages/inspection/scene/info/device-info-items.js | 4 miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts | 28 - miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md | 29 - components/search/index.json | 4 pages/inspection/scene/search/index.json | 6 pages/usercenter/index.js | 5 common/dataMaintainFrequency.js | 2 44 files changed, 698 insertions(+), 372 deletions(-) diff --git a/app.js b/app.js index bdf0d7e..19baf5b 100644 --- a/app.js +++ b/app.js @@ -10,6 +10,8 @@ }); }, globalData: { + // 閲嶅惎鏃跺緟鍔炰簨椤� + onLaunch:[], userInfo: { district: undefined, }, diff --git a/behaviors/loadConfig.js b/behaviors/loadConfig.js index 261b67f..8a1daaf 100644 --- a/behaviors/loadConfig.js +++ b/behaviors/loadConfig.js @@ -8,7 +8,6 @@ function loadConfig() { const pList = []; - const userId = app.globalData.accessToken.userId; const f1 = fetchSceneTypes({ userId }).then(res => { wx.setStorage({ diff --git a/common/dataLocation.js b/common/dataLocation.js index f680f08..f756199 100644 --- a/common/dataLocation.js +++ b/common/dataLocation.js @@ -1,6 +1,8 @@ const app = getApp(); -// 鑾峰彇鐢ㄦ埛閰嶇疆淇℃伅 -const userConfig = app.globalData.userConfig; +// 鍒囨崲璐﹀彿鏃�,閲嶇疆鍙�夎鏀垮尯鍒� +app.globalData.onLaunch.push(() => { + remoteLocations = []; +}); const _locations = [ { @@ -142,6 +144,8 @@ function locations() { if (remoteLocations.length > 0) return remoteLocations; + // 鑾峰彇鐢ㄦ埛閰嶇疆淇℃伅 + const userConfig = app.globalData.userConfig; if (!userConfig) { remoteLocations = _locations; return remoteLocations; diff --git a/common/dataMaintainFrequency.js b/common/dataMaintainFrequency.js index 0abafde..c419647 100644 --- a/common/dataMaintainFrequency.js +++ b/common/dataMaintainFrequency.js @@ -2,7 +2,7 @@ * 璁惧杩愮淮棰戞 */ const freq = [ - { value: '0', label: '姣忓懆涓�娆�' }, + // { value: '0', label: '姣忓懆涓�娆�' }, { value: '1', label: '姣忔湀涓�娆�' }, { value: '2', label: '姣忓搴︿竴娆�' }, { value: '3', label: '姣忓崐骞翠竴娆�' }, diff --git a/components/filter/index.wxml b/components/filter/index.wxml index 2353a01..94d15a8 100644 --- a/components/filter/index.wxml +++ b/components/filter/index.wxml @@ -5,17 +5,17 @@ <view class="filter-item" bind:tap="handleSort"> <text style="color: {{sorts !== '' ? color : '' }}">璇勫垎</text> <view class="filter-sort"> - <!-- <t-icon + <t-icon prefix="wr" name="arrow_drop_up" size="18rpx" style="color:{{sorts === 'asc' ? color : '#bbb'}}" - /> --> - <t-icon + /> + <!-- <t-icon name="component-grid" size="18rpx" style="color:{{sorts === 'asc' ? color : '#bbb'}}" - /> + /> --> <t-icon prefix="wr" name="arrow_drop_down" diff --git a/components/search/index.js b/components/search/index.js new file mode 100644 index 0000000..8e4f582 --- /dev/null +++ b/components/search/index.js @@ -0,0 +1,40 @@ +import { useLoading } from '../../../behaviors/loading'; + +Component({ + behaviors: [useLoading], + options: { + multipleSlots: true, // 鍦ㄧ粍浠跺畾涔夋椂鐨勯�夐」涓惎鐢ㄥslot鏀寔 + }, + properties: { + placeholder: '杈撳叆鍏抽敭璇嶆悳绱�', + // 鎼滅储缂撳瓨鍘嗗彶璁板綍瀛樺偍鏍囩 + historyTag: 'historyWords', + // 鎼滅储缁撴灉 + searchResult: [], + }, + data: { + searchValue: '', + isSearch: false, + historyWords: [], + dialog: { + title: '纭鍒犻櫎褰撳墠鍘嗗彶璁板綍', + showCancelButton: true, + message: '', + }, + dialogShow: false, + deleteType: 0, + deleteIndex: '', + }, + lifetimes: { + attached: function () { + // 鍦ㄧ粍浠跺疄渚嬭繘鍏ラ〉闈㈣妭鐐规爲鏃舵墽琛� + let optionList = optionListFunc; + if (typeof optionListFunc === 'function') { + optionList = optionListFunc(); + } + this.setSelectOptions(keyword, optionList); + this.onInitialValue(keyword); + }, + }, + methods: {}, +}); diff --git a/components/search/index.json b/components/search/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/search/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/search/index.wxml b/components/search/index.wxml new file mode 100644 index 0000000..59307e6 --- /dev/null +++ b/components/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"> + <enterprise-search-result + wx:for="{{searchResult}}" + wx:key="index" + wx:for-index="index" + result="{{item}}" + bind:click="handCellClick" + ></enterprise-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/components/search/index.wxss b/components/search/index.wxss new file mode 100644 index 0000000..135f80d --- /dev/null +++ b/components/search/index.wxss @@ -0,0 +1 @@ +/* components/search/index.wxss */ \ No newline at end of file diff --git a/config/index.js b/config/index.js index 275f3d3..3998b06 100644 --- a/config/index.js +++ b/config/index.js @@ -8,14 +8,16 @@ const baseFileUrl = `${bu}/meeting/file/`; // 绾夸笂鐩戠 -// const inspectUrl = 'https://fyami.com.cn:447'; +const inspectUrl = 'https://fyami.com.cn:447'; // const inspectUrl = 'http://192.168.0.138:8082'; -const inspectUrl = 'http://192.168.1.8:8080'; +// const inspectUrl = 'http://192.168.0.138:8080'; +// const inspectUrl = 'http://192.168.1.8:8080'; const iu = 'https://fyami.com.cn:447'; const inspectPicUrl = `${iu}/images/`; +// const inspectPicUrl = `${inspectUrl}/images/`; -const mode = 'debug'; -// const mode = 'prod'; +// const mode = 'debug'; +const mode = 'prod'; export { basePicUrl, baseUrl, baseFileUrl, baseIconUrl, inspectUrl, inspectPicUrl, mode }; diff --git a/custom-tab-bar/data.js b/custom-tab-bar/data.js index 9dd3b4a..ac7639a 100644 --- a/custom-tab-bar/data.js +++ b/custom-tab-bar/data.js @@ -1,27 +1,33 @@ -import { baseIconUrl } from "../config/index"; - export default [ { icon: 'home', text: '棣栭〉', url: 'pages/home/index', + level: 2, }, { icon: 'app', text: '绮剧粏鍖栫洃绠�', url: 'pages/supervision/index', + level: 2, }, { // icon: `${baseIconUrl}tab-slef-patrol.png`, icon: 'root-list', text: '搴旀�ヨ嚜宸℃煡', url: 'pages/selfpatrol/index', - // url: '', + level: 2, }, + // { + // icon: 'system-device', + // text: '璁惧绠$悊', + // url: 'pages/inspection/scene/index', + // level: 1, + // }, { icon: 'user', text: '涓汉涓績', url: 'pages/usercenter/index', - // url: '', + level: 2, }, ]; diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 4384ee3..9991a7a 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -1,10 +1,18 @@ import TabMenu from './data'; +const app = getApp(); + Component({ data: { active: 0, list: TabMenu, }, - + attached() { + const menu = TabMenu.map(v => { + v.visible = app.globalData.userInfo.usertypeid <= v.level; + return v; + }); + this.setData({ list: menu }); + }, methods: { onChange(event) { let index = event.detail.value; @@ -29,9 +37,7 @@ const page = getCurrentPages().pop(); const route = page ? page.route.split('?')[0] : ''; const active = this.data.list.findIndex( - item => - (item.url.startsWith('/') ? item.url.substr(1) : item.url) === - `${route}`, + item => (item.url.startsWith('/') ? item.url.substr(1) : item.url) === `${route}`, ); this.setData({ active }); }, diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 52e0ca1..e68dbb9 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,18 +1,9 @@ <view class="custom-tab-bar"> - <t-tab-bar - value="{{active}}" - bindchange="onChange" - split="{{false}}" - shape="normal" - > - <t-tab-bar-item - wx:for="{{list}}" - wx:for-item="item" - wx:for-index="index" - wx:key="index" - icon="{{item.icon}}" - > - {{ item.text }} - </t-tab-bar-item> + <t-tab-bar value="{{active}}" bindchange="onChange" split="{{false}}" shape="normal"> + <block wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index"> + <t-tab-bar-item class="{{item.visible ? '' : 'hidden'}}" icon="{{item.icon}}"> + {{ item.text }} + </t-tab-bar-item> + </block> </t-tab-bar> </view> diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index f7b33d5..fb2481f 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -2,3 +2,7 @@ --td-tab-bar-color: rgb(163, 163, 163); /* --td-tab-bar-active-color: #333; */ } + +.hidden{ + /* display: none; */ +} \ No newline at end of file diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md b/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md index 2382bd0..45c9106 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md +++ b/miniprogram_npm/tdesign-miniprogram/cascader/README.en-US.md @@ -5,13 +5,12 @@ name | type | default | description | required -- | -- | -- | -- | -- -close-btn | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N -keys | Object | - | Typescript锛歚KeysType`銆俒see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N +close-btn | Boolean / Slot | true | \- | N +keys | Object | - | Typescript锛歚KeysType` | N options | Array | [] | Typescript锛歚Array<CascaderOption>` | N -placeholder | String | 閫夋嫨閫夐」 | \- | N sub-titles | Array | [] | Typescript锛歚Array<string>` | N -theme | String | step | options: step/tab | N -title | String / Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N +theme | String | step | options锛歴tep/tab | N +title | String / Slot | - | \- | N value | String / Number | null | \- | N default-value | String / Number | undefined | uncontrolled property | N visible | Boolean | false | \- | N @@ -23,23 +22,3 @@ change | `(value: string \| number, selectedOptions: string[])` | `1.0.1` close | `(trigger: TriggerSource)` | `1.0.1`銆俒see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)銆�<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> pick | `(value: string \| number, index: number)` | `1.0.1` - - -### CSS Variables -The component provides the following CSS variables, which can be used to customize styles. -Name | Default Value | Description --- | -- | -- ---td-cascader-active-color | @brand-color | - ---td-cascader-bg-color | @bg-color-container | - ---td-cascader-border-color | @component-stroke | - ---td-cascader-content-height | 78vh | - ---td-cascader-disabled-color | @text-color-disabled | - ---td-cascader-options-height | calc(100% - @cascader-step-height) | - ---td-cascader-options-title-color | @text-color-placeholder | - ---td-cascader-step-arrow-color | @text-color-placeholder | - ---td-cascader-step-dot-size | 16rpx | - ---td-cascader-step-height | 88rpx | - ---td-cascader-title-color | @text-color-primary | - ---td-cascader-title-height | 26rpx | - ---td-cascader-title-padding | @spacer-2 | - ---td-cascder-title-font-size | 36rpx | - diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/README.md b/miniprogram_npm/tdesign-miniprogram/cascader/README.md index b277c16..a5f543a 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/README.md +++ b/miniprogram_npm/tdesign-miniprogram/cascader/README.md @@ -24,12 +24,6 @@ ## 浠g爜婕旂ず -<a href="https://developers.weixin.qq.com/s/i75I6imI7TSh" title="鍦ㄥ紑鍙戣�呭伐鍏蜂腑棰勮鏁堟灉" target="_blank" rel="noopener noreferrer"> 鍦ㄥ紑鍙戣�呭伐鍏蜂腑棰勮鏁堟灉 </a> - -<blockquote style="background-color: #d9e1ff; font-size: 15px; line-height: 26px;margin: 16px 0 0;padding: 16px; border-radius: 6px; color: #0052d9" > -<p>Tips: 璇风‘淇濆紑鍙戣�呭伐鍏蜂负鎵撳紑鐘舵�併�傚鍏ュ紑鍙戣�呭伐鍏峰悗锛屼緷娆℃墽琛岋細npm i > 鏋勫缓npm鍖� > 鍕鹃�� "灏咼S缂栬瘧鎴怑S5"</p> -</blockquote> - ### 鍩虹鐢ㄦ硶 {{ base }} @@ -57,13 +51,12 @@ 鍚嶇О | 绫诲瀷 | 榛樿鍊� | 璇存槑 | 蹇呬紶 -- | -- | -- | -- | -- -close-btn | Boolean / Slot | true | 鍏抽棴鎸夐挳銆俒閫氱敤绫诲瀷瀹氫箟](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N -keys | Object | - | 鐢ㄦ潵瀹氫箟 value / label 鍦� `options` 涓搴旂殑瀛楁鍒悕銆俆S 绫诲瀷锛歚KeysType`銆俒閫氱敤绫诲瀷瀹氫箟](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N +close-btn | Boolean / Slot | true | 鍏抽棴鎸夐挳 | N +keys | Object | - | 鐢ㄦ潵瀹氫箟 value / label 鍦� `options` 涓搴旂殑瀛楁鍒悕銆俆S 绫诲瀷锛歚KeysType` | N options | Array | [] | 鍙�夐」鏁版嵁婧愩�俆S 绫诲瀷锛歚Array<CascaderOption>` | N -placeholder | String | 閫夋嫨閫夐」 | 鏈�変腑鏃剁殑鎻愮ず鏂囨 | N sub-titles | Array | [] | 姣忕骇灞曠ず鐨勬鏍囬銆俆S 绫诲瀷锛歚Array<string>` | N theme | String | step | 灞曠ず椋庢牸銆傚彲閫夐」锛歴tep/tab | N -title | String / Slot | - | 鏍囬銆俒閫氱敤绫诲瀷瀹氫箟](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N +title | String / Slot | - | 鏍囬 | N value | String / Number | null | 閫夐」鍊� | N default-value | String / Number | undefined | 閫夐」鍊笺�傞潪鍙楁帶灞炴�� | N visible | Boolean | false | 鏄惁灞曠ず | N @@ -75,23 +68,3 @@ change | `(value: string \| number, selectedOptions: string[])` | `1.0.1`銆傚�煎彂鐢熷彉鏇存椂瑙﹀彂 close | `(trigger: TriggerSource)` | `1.0.1`銆傚叧闂椂瑙﹀彂銆俒璇︾粏绫诲瀷瀹氫箟](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/cascader/type.ts)銆�<br/>`type TriggerSource = 'overlay' \| 'close-btn' \| 'finish'`<br/> pick | `(value: string \| number, index: number)` | `1.0.1`銆傞�夋嫨鍚庤Е鍙� - - -### CSS Variables -缁勪欢鎻愪緵浜嗕笅鍒� CSS 鍙橀噺锛屽彲鐢ㄤ簬鑷畾涔夋牱寮忋�� -鍚嶇О | 榛樿鍊� | 鎻忚堪 --- | -- | -- ---td-cascader-active-color | @brand-color | - ---td-cascader-bg-color | @bg-color-container | - ---td-cascader-border-color | @component-stroke | - ---td-cascader-content-height | 78vh | - ---td-cascader-disabled-color | @text-color-disabled | - ---td-cascader-options-height | calc(100% - @cascader-step-height) | - ---td-cascader-options-title-color | @text-color-placeholder | - ---td-cascader-step-arrow-color | @text-color-placeholder | - ---td-cascader-step-dot-size | 16rpx | - ---td-cascader-step-height | 88rpx | - ---td-cascader-title-color | @text-color-primary | - ---td-cascader-title-height | 26rpx | - ---td-cascader-title-padding | @spacer-2 | - ---td-cascder-title-font-size | 36rpx | - diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts index a7de69e..de3b6d5 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts +++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.d.ts @@ -6,53 +6,35 @@ export default class Cascader extends SuperComponent { externalClasses: string[]; options: WechatMiniprogram.Component.ComponentOptions; - properties: TdCascaderProps<import("../common/common").TreeOptionData<string | number>>; + properties: TdCascaderProps<import("../common/common").TreeOptionData>; controlledProps: { key: string; event: string; }[]; - state: { - contentHeight: number; - stepHeight: number; - tabsHeight: number; - subTitlesHeight: number; - stepsInitHeight: number; - }; data: { prefix: string; name: string; stepIndex: number; selectedIndexes: any[]; selectedValue: any[]; + defaultOptionLabel: string; scrollTopList: any[]; - steps: any[]; - _optionsHeight: number; + steps: string[]; }; observers: { visible(v: any): void; - value(): void; - options(): void; - selectedIndexes(): void; + 'selectedIndexes, options'(): void; stepIndex(): Promise<void>; }; methods: { - updateOptionsHeight(steps: number): void; - initOptionsHeight(steps: number): Promise<void>; initWithValue(): void; - getIndexesByValue(options: import("../common/common").TreeOptionData<string | number>[], value: any): any[]; + getIndexesByValue(options: import("../common/common").TreeOptionData[], value: any): any[]; updateScrollTop(): void; hide(trigger: any): void; onVisibleChange(): void; onClose(): void; onStepClick(e: any): void; onTabChange(e: any): void; - genItems(): { - selectedValue: any[]; - steps: any[]; - items: { - [x: string]: any; - }[][]; - }; handleSelect(e: any): void; }; } diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js index 1efa191..0bc55d8 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js +++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.js @@ -19,31 +19,13 @@ import { getRect } from '../common/utils'; const { prefix } = config; const name = `${prefix}-cascader`; -function parseOptions(options, keys) { - var _a, _b; - const label = (_a = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _a !== void 0 ? _a : 'label'; - const value = (_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'; - return options.map((item) => { - return { - [label]: item[label], - [value]: item[value], - }; - }); -} -const defaultState = { - contentHeight: 0, - stepHeight: 0, - tabsHeight: 0, - subTitlesHeight: 0, - stepsInitHeight: 0, -}; +const defaultOptionLabel = '閫夋嫨閫夐」'; let Cascader = class Cascader extends SuperComponent { constructor() { super(...arguments); this.externalClasses = [`${prefix}-class`]; this.options = { multipleSlots: true, - pureDataPattern: /^options$/, }; this.properties = props; this.controlledProps = [ @@ -52,56 +34,51 @@ event: 'change', }, ]; - this.state = Object.assign({}, defaultState); this.data = { prefix, name, stepIndex: 0, selectedIndexes: [], selectedValue: [], + defaultOptionLabel, scrollTopList: [], - steps: [], - _optionsHeight: 0, + steps: [defaultOptionLabel], }; this.observers = { visible(v) { if (v) { const $tabs = this.selectComponent('#tabs'); $tabs === null || $tabs === void 0 ? void 0 : $tabs.setTrack(); - $tabs === null || $tabs === void 0 ? void 0 : $tabs.getTabHeight().then((res) => { - this.state.tabsHeight = res.height; - }); - this.initOptionsHeight(this.data.steps.length); this.updateScrollTop(); this.initWithValue(); } - else { - this.state = Object.assign({}, defaultState); + }, + 'selectedIndexes, options'() { + var _a, _b, _c, _d; + const { options, selectedIndexes, keys } = this.data; + const selectedValue = []; + const steps = []; + const items = [options]; + if (options.length > 0) { + for (let i = 0, size = selectedIndexes.length; i < size; i += 1) { + const index = selectedIndexes[i]; + const next = items[i][index]; + selectedValue.push(next[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value']); + steps.push(next[(_b = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _b !== void 0 ? _b : 'label']); + if (next[(_c = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _c !== void 0 ? _c : 'children']) { + items.push(next[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']); + } + } } - }, - value() { - this.initWithValue(); - }, - options() { - const { selectedValue, steps, items } = this.genItems(); + if (steps.length < items.length) { + steps.push(defaultOptionLabel); + } this.setData({ steps, items, selectedValue, stepIndex: items.length - 1, }); - }, - selectedIndexes() { - const { visible, theme } = this.properties; - const { selectedValue, steps, items } = this.genItems(); - this.setData({ - steps, - selectedValue, - stepIndex: items.length - 1, - }); - if (visible && theme === 'step') { - this.updateOptionsHeight(steps.length); - } }, stepIndex() { return __awaiter(this, void 0, void 0, function* () { @@ -113,35 +90,6 @@ }, }; this.methods = { - updateOptionsHeight(steps) { - const { contentHeight, stepsInitHeight, stepHeight, subTitlesHeight } = this.state; - this.setData({ - _optionsHeight: contentHeight - stepsInitHeight - subTitlesHeight - (steps - 1) * stepHeight, - }); - }, - initOptionsHeight(steps) { - return __awaiter(this, void 0, void 0, function* () { - const { theme, subTitles } = this.properties; - const { height } = yield getRect(this, `.${name}__content`); - this.state.contentHeight = height; - if (theme === 'step') { - yield Promise.all([getRect(this, `.${name}__steps`), getRect(this, `.${name}__step`)]).then(([stepsRect, stepRect]) => { - this.state.stepsInitHeight = stepsRect.height - (steps - 1) * stepRect.height; - this.state.stepHeight = stepRect.height; - }); - } - if (subTitles.length > 0) { - const { height } = yield getRect(this, `.${name}__options-title`); - this.state.subTitlesHeight = height; - } - const optionsInitHeight = this.state.contentHeight - this.state.subTitlesHeight; - this.setData({ - _optionsHeight: theme === 'step' - ? optionsInitHeight - this.state.stepsInitHeight - (steps - 1) * this.state.stepHeight - : optionsInitHeight - this.state.tabsHeight, - }); - }); - }, initWithValue() { if (this.data.value != null && this.data.value !== '') { const selectedIndexes = this.getIndexesByValue(this.data.options, this.data.value); @@ -201,70 +149,24 @@ stepIndex: value, }); }, - genItems() { - var _a, _b, _c, _d, _e; - const { options, selectedIndexes, keys, placeholder } = this.data; - const selectedValue = []; - const steps = []; - const items = [parseOptions(options, keys)]; - if (options.length > 0) { - let current = options; - for (let i = 0, size = selectedIndexes.length; i < size; i += 1) { - const index = selectedIndexes[i]; - const next = current[index]; - current = next[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children']; - selectedValue.push(next[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value']); - steps.push(next[(_c = keys === null || keys === void 0 ? void 0 : keys.label) !== null && _c !== void 0 ? _c : 'label']); - if (next[(_d = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _d !== void 0 ? _d : 'children']) { - items.push(parseOptions(next[(_e = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _e !== void 0 ? _e : 'children'], keys)); - } - } - } - if (steps.length < items.length) { - steps.push(placeholder); - } - return { - selectedValue, - steps, - items, - }; - }, handleSelect(e) { - var _a, _b, _c, _d; + var _a, _b, _c; const { level } = e.target.dataset; const { value } = e.detail; - const { selectedIndexes, items, keys, options } = this.data; + const { selectedIndexes, items, keys } = this.data; const index = items[level].findIndex((item) => { var _a; return item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'] === value; }); - let item = selectedIndexes.slice(0, level).reduce((acc, item, index) => { - var _a; - if (index === 0) { - return acc[item]; - } - return acc[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][item]; - }, options); - if (level === 0) { - item = item[index]; - } - else { - item = item[(_a = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _a !== void 0 ? _a : 'children'][index]; - } + const item = items[level][index]; if (item.disabled) { return; } selectedIndexes[level] = index; selectedIndexes.length = level + 1; - this.triggerEvent('pick', { value: item[(_b = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _b !== void 0 ? _b : 'value'], index, level }); - const { items: newItems } = this.genItems(); - if ((_d = item === null || item === void 0 ? void 0 : item[(_c = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _c !== void 0 ? _c : 'children']) === null || _d === void 0 ? void 0 : _d.length) { - this.setData({ - selectedIndexes, - [`items[${level + 1}]`]: newItems[level + 1], - }); + this.triggerEvent('pick', { value: item[(_a = keys === null || keys === void 0 ? void 0 : keys.value) !== null && _a !== void 0 ? _a : 'value'], index, level }); + if ((_c = item === null || item === void 0 ? void 0 : item[(_b = keys === null || keys === void 0 ? void 0 : keys.children) !== null && _b !== void 0 ? _b : 'children']) === null || _c === void 0 ? void 0 : _c.length) { + this.setData({ selectedIndexes }); } else { - this.setData({ - selectedIndexes, - }, () => { + this.setData({ selectedIndexes }, () => { var _a; const { items } = this.data; this._trigger('change', { diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json index 6f4fec8..9fb1ae8 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json +++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.json @@ -1,6 +1,5 @@ { "component": true, - "styleIsolation": "apply-shared", "usingComponents": { "t-icon": "../icon/icon", "t-popup": "../popup/popup", diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml index f106894..af1d0a4 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml +++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxml @@ -15,7 +15,7 @@ <view wx:if="{{theme == 'step'}}" class="{{name}}__steps"> <view wx:for="{{steps}}" wx:key="index" class="{{name}}__step" bind:tap="onStepClick" data-index="{{index}}"> <view - class="{{name}}__step-dot {{name}}__step-dot--{{item !== placeholder ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}" + class="{{name}}__step-dot {{name}}__step-dot--{{item !== defaultOptionLabel ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}" ></view> <view class="{{name}}__step-label {{name}}__step-label--{{index === stepIndex ? 'active' : ''}}"> {{ item }} @@ -43,8 +43,6 @@ class="{{name}}__options" scroll-y scroll-top="{{scrollTopList[index]}}" - type="list" - style="height: {{_optionsHeight}}px" > <view class="cascader-radio-group-{{index}}"> <t-radio-group diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss index 5845aa2..72a758b 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss +++ b/miniprogram_npm/tdesign-miniprogram/cascader/cascader.wxss @@ -28,45 +28,49 @@ .t-cascader { display: flex; flex-direction: column; - background-color: var(--td-cascader-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff))); - color: var(--td-cascader-title-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9)))); - border-radius: var(--td-radius-extra-large, 24rpx) var(--td-radius-extra-large, 24rpx) 0 0; + background-color: #fff; + color: var(--td-cascader-title-color, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))); + border-radius: 24rpx 24rpx 0 0; --td-radio-icon-checked-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); --td-tab-item-active-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); --td-tab-track-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); } .t-cascader__close-btn { - right: 32rpx; - top: 24rpx; + right: 16px; + top: 12px; position: absolute; } .t-cascader__title { position: relative; font-weight: 700; text-align: center; - line-height: var(--td-cascader-title-height, 26rpx); - padding: var(--td-cascader-title-padding, var(--td-spacer-2, 32rpx)); + line-height: 48px; font-size: var(--td-cascder-title-font-size, 36rpx); } .t-cascader__content { width: 100%; - height: var(--td-cascader-content-height, 78vh); + flex: 1; display: flex; flex-direction: column; } .t-cascader__options { width: 100vw; + height: var(--td-cascader-options-height, 640rpx); } .t-cascader__options-title { - color: var(--td-cascader-options-title-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)))); - font-size: var(--td-font-size-base, 28rpx); + margin-top: 40rpx; + color: var(--td-cascader-options-title-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))); + font-size: 28rpx; line-height: 44rpx; - padding-top: 40rpx; - padding-left: var(--td-spacer-2, 32rpx); - box-sizing: border-box; + padding-left: 16px; +} +.t-cascader__options-content { + flex: 1; + height: 100%; + overflow: auto; + padding-left: 16px; } .t-cascader__options-container { - flex: 1; display: flex; transition: all ease 0.3s; } @@ -87,7 +91,7 @@ bottom: 0; left: unset; right: unset; - background-color: var(--td-cascader-border-color, var(--td-component-stroke, var(--td-gray-color-3, #e7e7e7))); + background-color: var(--td-cascader-border-color, var(--td-border-color, var(--td-gray-color-3, #e7e7e7))); } .t-cascader__steps::after { height: 1px; @@ -100,7 +104,7 @@ width: var(--td-cascader-step-dot-size, 16rpx); height: var(--td-cascader-step-dot-size, 16rpx); border-radius: 50%; - border: 2rpx solid var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); + border: 1px solid var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); box-sizing: border-box; } .t-cascader__step-dot:not(.t-cascader__step-dot--last)::after { @@ -110,7 +114,7 @@ left: 50%; top: calc(var(--td-cascader-step-dot-size, 16rpx) + 14rpx); height: 36rpx; - width: 2rpx; + width: 1px; background: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); transform: translateX(-50%); } @@ -119,14 +123,14 @@ border-color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); } .t-cascader__step-label { - padding-left: var(--td-spacer-2, 32rpx); - font-size: var(--td-font-size-m, 32rpx); + padding-left: 16px; + font-size: 16px; } .t-cascader__step-label--active { color: var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9))); font-weight: 600; } .t-cascader__step-arrow { - color: var(--td-cascader-step-arrow-color, var(--td-text-color-placeholder, var(--td-font-gray-3, rgba(0, 0, 0, 0.4)))); + color: var(--td-cascader-step-arrow-color, var(--td-font-gray-3, rgba(0, 0, 0, 0.4))); margin-left: auto; } diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/props.js b/miniprogram_npm/tdesign-miniprogram/cascader/props.js index 14a99de..d2f12b9 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/props.js +++ b/miniprogram_npm/tdesign-miniprogram/cascader/props.js @@ -10,10 +10,6 @@ type: Array, value: [], }, - placeholder: { - type: String, - value: '閫夋嫨閫夐」', - }, subTitles: { type: Array, value: [], diff --git a/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts b/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts index 9d58f80..624c2c5 100644 --- a/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts +++ b/miniprogram_npm/tdesign-miniprogram/cascader/type.d.ts @@ -12,10 +12,6 @@ type: ArrayConstructor; value?: Array<CascaderOption>; }; - placeholder?: { - type: StringConstructor; - value?: string; - }; subTitles?: { type: ArrayConstructor; value?: Array<string>; diff --git a/model/device.js b/model/device.js index 506b788..0592124 100644 --- a/model/device.js +++ b/model/device.js @@ -5,9 +5,12 @@ import { toLabel as toLabelMonitor } from '../common/dataMonitorDeviceType'; import { toLabel as toLabelTreatment } from '../common/dataTreatmentDeviceType'; import { toLabel as toLabelProduction } from '../common/dataProductionDeviceType'; +import { inspectPicUrl } from '../config/index'; // 鐩戞祴璁惧 export function getMonitorDevice(data) { + data._name = data.diName + data._deviceCode = data.diDeviceCode data._updateTime = dayjs(data.diUpdateTime).format('YYYY骞碝M鏈圖D鏃�'); data._maintainFrequency = toLabelFreq(data.diMaintainFrequency); data._ownership = toLabelOwner(data.diOwnership); @@ -15,11 +18,13 @@ const labelArr = toLabelMonitor(data.diSceneTypeId, [data.diTypeId, data.diSubtypeId]); data._type = labelArr[0]; data._subType = labelArr[1]; - return data + return data; } // 娌荤悊璁惧 export function getTreatmentDevice(data) { + data._name = data.piName + data._deviceCode = data.piDeviceCode data._updateTime = dayjs(data.piUpdateTime).format('YYYY骞碝M鏈圖D鏃�'); data._maintainFrequency = toLabelFreq(data.piMaintainFrequency); data._ownership = toLabelOwner(data.piOwnership); @@ -27,18 +32,20 @@ const labelArr = toLabelTreatment(data.piSceneTypeId, [data.piTypeId, data.piSubtypeId]); data._type = labelArr[0]; data._subType = labelArr[1]; - return data + return data; } // 鐢熶骇璁惧 export function getProductionDevice(data) { + data._name = data.wiName + data._deviceCode = data.wiDeviceCode data._updateTime = dayjs(data.wiUpdateTime).format('YYYY骞碝M鏈圖D鏃�'); data._ownership = toLabelOwner(data.wiOwnership); data._runningStatus = toLabelStatus(data.wiRunningStatus); const labelArr = toLabelProduction(data.wiSceneTypeId, [data.wiTypeId, data.wiSubtypeId]); data._type = labelArr[0]; data._subType = labelArr[1]; - return data + return data; } export function getDeviceList(dataList, deviceType) { @@ -46,14 +53,26 @@ // 鐩戞祴璁惧 if (deviceType == 0) { return getMonitorDevice(item); - } + } // 娌荤悊璁惧 else if (deviceType == 1) { return getTreatmentDevice(item); - } + } // 鐢熶骇璁惧 else if (deviceType == 2) { return getProductionDevice(item); } }); } + +export function getDeviceStatus(data) { + data._createTime = dayjs(data.dlCreateTime).format('YYYY骞碝M鏈圖D鏃�'); + data._imgPath = data.dlPicUrl.split(';').map(p => inspectPicUrl + p); + return data; +} + +export function getDeviceStatusList(dataList) { + return dataList.map(item => { + return getDeviceStatus(item); + }); +} diff --git a/pages/enterprise/ledger/history/index.js b/pages/enterprise/ledger/history/index.js index 2aec4f6..124411b 100644 --- a/pages/enterprise/ledger/history/index.js +++ b/pages/enterprise/ledger/history/index.js @@ -115,7 +115,6 @@ bindYearChange(e) { let year = `${e.detail.value}`; - debugger if (this.data.year != year) { this.setData({ year, diff --git a/pages/inspection/scene/index.js b/pages/inspection/scene/index.js index a74171a..2f823e9 100644 --- a/pages/inspection/scene/index.js +++ b/pages/inspection/scene/index.js @@ -12,6 +12,10 @@ onLoad(options) {}, + onShow() { + this.getTabBar().init(); + }, + onReachBottom() { this._loadMore(); }, diff --git a/pages/inspection/scene/index.wxml b/pages/inspection/scene/index.wxml index 7624129..46a9d69 100644 --- a/pages/inspection/scene/index.wxml +++ b/pages/inspection/scene/index.wxml @@ -19,10 +19,15 @@ style-mode="picker" picker-class="picker-location" bind:onChange="onLocationChange" + bind:locationInitValue="onLocationChange" ></location-picker> </view> <view class="filter-wrap-2"> - <scene-picker sceneMode="{{1}}" bind:scenePickerChange="onScenePickerConfirm" bind:sceneInitValue="onScenePickerConfirm"/> + <scene-picker + sceneMode="{{1}}" + bind:scenePickerChange="onScenePickerConfirm" + bind:sceneInitValue="onScenePickerConfirm" + /> </view> </view> </t-sticky> diff --git a/pages/inspection/scene/info/components/device-location/index.wxml b/pages/inspection/scene/info/components/device-location/index.wxml index 854451f..a069e05 100644 --- a/pages/inspection/scene/info/components/device-location/index.wxml +++ b/pages/inspection/scene/info/components/device-location/index.wxml @@ -1,28 +1,10 @@ -<view wx:if="{{time}}" class="flex-h"> +<view wx:if="{{_createTime}}" class="flex-h"> <!-- <t-divider content="鍙樻洿鏃堕棿: {{time}}" align="left" /> --> - <view>{{index}}. 鍙樻洿鏃堕棿: {{time}}</view> - <view wx:if="{{readOnly}}"> + <view>{{index}}. 鍙樻洿鏃堕棿: {{_createTime}}</view> + <!-- <view wx:if="{{readOnly}}"> <t-button theme="primary" size="extra-small" bind:tap="changeEdit">淇敼</t-button> - </view> + </view> --> </view> -<t-input - label="瀹夎浣嶇疆" - placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" - model:value="{{dlLocation}}" - disabled="{{readOnly}}" -/> -<t-input - label="缁忓害" - placeholder="璇疯緭鍏ョ粡搴�" - model:value="{{dlLongitude}}" - disabled="{{readOnly}}" -/> -<t-input - label="缁村害" - placeholder="璇疯緭鍏ョ淮搴�" - model:value="{{dlLatitude}}" - disabled="{{readOnly}}" -/> <t-cell title="鏄惁瑙勮寖"> <t-switch model:value="{{dlStandard}}" @@ -34,12 +16,51 @@ /> </t-cell> <t-input + label="璁惧浣嶇疆" + placeholder="璇疯緭鍏ュ畨瑁呬綅缃�" + model:value="{{dlLocation}}" + disabled="{{readOnly}}" +/> +<!-- <t-input + label="缁忓害" + placeholder="璇疯緭鍏ョ粡搴�" + model:value="{{dlLongitude}}" + disabled="{{readOnly}}" +/> +<t-input + label="缁村害" + placeholder="璇疯緭鍏ョ淮搴�" + model:value="{{dlLatitude}}" + disabled="{{readOnly}}" +/> --> +<t-input wx:if="{{!dlStandard}}" label="涓嶈鑼冭鏄�" placeholder="璇疯緭鍏ヨ鏄�" model:value="{{dlUnstandardReason}}" disabled="{{readOnly}}" /> +<!-- <t-input + label="鏇存柊鏃堕棿" + placeholder="璇疯緭鍏ユ洿鏂版椂闂�" + model:value="{{_createTime}}" + disabled="{{readOnly}}" +/> --> +<block wx:if="{{_imgPath.length > 0}}"> + <t-cell title="鐜板満鍥剧墖"> + <view class="img-group" slot="description"> + <view wx:for="{{_imgPath}}" wx:key="index" wx:for-item="m"> + <t-image + src="{{m}}" + t-class="img-group_img" + shape="round" + bindtap="previewImage" + data-index="{{index}}" + /> + </view> + </view> + </t-cell> +</block> <view wx:if="{{!readOnly}}" style="display: flex; gap: 4"> <t-button theme="light" block size="small" bind:tap="cancel">鍙栨秷</t-button> <t-button wx:if="{{!isUpdate}}" theme="primary" block block size="small" bind:tap="confirm" @@ -47,4 +68,4 @@ > <t-button wx:else theme="primary" block block size="small" bind:tap="update">鏇存柊</t-button> </view> -<!-- <t-divider /> --> +<t-divider /> diff --git a/pages/inspection/scene/info/components/device-location/index.wxss b/pages/inspection/scene/info/components/device-location/index.wxss index 51d9aa7..de60c1c 100644 --- a/pages/inspection/scene/info/components/device-location/index.wxss +++ b/pages/inspection/scene/info/components/device-location/index.wxss @@ -6,4 +6,15 @@ /* background-color: blanchedalmond; */ padding: 0 16px; margin-top: 8px; +} + +.img-group { + display: flex; + flex-wrap: wrap; + gap: 2px; +} + +.img-group .img-group_img { + width: 30vw; + height: 30vw; } \ No newline at end of file diff --git a/pages/inspection/scene/info/device-info-items.js b/pages/inspection/scene/info/device-info-items.js index 4623da1..36516ce 100644 --- a/pages/inspection/scene/info/device-info-items.js +++ b/pages/inspection/scene/info/device-info-items.js @@ -69,7 +69,7 @@ hideInputItem('鍦烘櫙id', 'piSceneGuid'), hideInputItem('鍦烘櫙绫诲瀷', 'piSceneTypeId'), - baseInputItem('绔欑偣鍚嶇О', 'piName', true), + baseInputItem('璁惧鍚嶇О', 'piName', true), baseInputItem('璁惧缂栧彿', 'piDeviceCode'), // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀� baseInputItem( @@ -112,7 +112,7 @@ hideInputItem('鍦烘櫙id', 'piSceneGuid'), hideInputItem('鍦烘櫙绫诲瀷', 'piSceneTypeId'), - baseInputItem('绔欑偣鍚嶇О', 'piName', true), + baseInputItem('璁惧鍚嶇О', 'piName', true), baseInputItem('璁惧缂栧彿', 'piDeviceCode'), // 璁惧绫诲瀷鍜岃澶囧瓙绫诲悎骞剁敤绾ц仈閫夋嫨鍣ㄥ睍绀� baseInputItem( diff --git a/pages/inspection/scene/info/devicelist.wxml b/pages/inspection/scene/info/devicelist.wxml index 0a98617..cc6b410 100644 --- a/pages/inspection/scene/info/devicelist.wxml +++ b/pages/inspection/scene/info/devicelist.wxml @@ -35,7 +35,7 @@ <block wx:for="{{item.items}}" wx:key="index1" wx:for-item="device" wx:for-index="index1"> <view class="scene__item" > <view class="flex-h" style="align-items: flex-start"> - <view class="scene__item-name">{{device.diName}} </view> + <view class="scene__item-name">{{device._name}} </view> <view> <t-tag max-width="{{130}}" @@ -48,7 +48,7 @@ </view> </view> <view class="flex-h"> - <view class="scene__item-abstract">缂栧彿锛歿{device.diDeviceCode}} </view> + <view class="scene__item-abstract">缂栧彿锛歿{device._deviceCode}} </view> <view class="scene__item-abstract">{{device._runningStatus}} </view> </view> <view class="scene__item-abstract">鏇存柊鏃堕棿锛歿{device._updateTime}} </view> diff --git a/pages/inspection/scene/search/components/scene-search-result/index.js b/pages/inspection/scene/search/components/scene-search-result/index.js new file mode 100644 index 0000000..46fc6ae --- /dev/null +++ b/pages/inspection/scene/search/components/scene-search-result/index.js @@ -0,0 +1,35 @@ +// pages/inspection/scene/search/components/scene-search-result/index.js +Component({ + options: { + addGlobalClass: true, + }, + /** + * 缁勪欢鐨勫睘鎬у垪琛� + */ + properties: { + result: { + type: Object, + value: { + name: '', + districtname: '', + type: '', + }, + }, + }, + + /** + * 缁勪欢鐨勫垵濮嬫暟鎹� + */ + data: { + + }, + + /** + * 缁勪欢鐨勬柟娉曞垪琛� + */ + methods: { + handCellClick(e) { + this.triggerEvent('click', this.data.result); + }, + } +}) \ No newline at end of file diff --git a/pages/inspection/scene/search/components/scene-search-result/index.json b/pages/inspection/scene/search/components/scene-search-result/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/pages/inspection/scene/search/components/scene-search-result/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/inspection/scene/search/components/scene-search-result/index.wxml b/pages/inspection/scene/search/components/scene-search-result/index.wxml new file mode 100644 index 0000000..c09f6aa --- /dev/null +++ b/pages/inspection/scene/search/components/scene-search-result/index.wxml @@ -0,0 +1,31 @@ +<t-cell title="{{result.name}}" hover bind:click="handCellClick"> + <view slot="description" class="enterprise-info__tag"> + <t-tag + max-width="{{130}}" + shape="square" + size="small" + theme="{{result.extension1 == '1' ? 'success' : 'danger'}}" + variant="light-outline" + disabled + >{{result.extension1 == '1' ? '涓婄嚎涓�' : '宸蹭笅绾�'}}</t-tag + > + <t-tag + t-class="t-class-tag" + max-width="{{130}}" + shape="square" + size="small" + theme="default" + variant="light" + >{{result.districtname}}</t-tag + > + <t-tag + t-class="t-class-tag" + max-width="{{130}}" + shape="square" + size="small" + theme="default" + variant="light" + >{{result.type}}</t-tag + > + </view> +</t-cell> diff --git a/pages/inspection/scene/search/components/scene-search-result/index.wxss b/pages/inspection/scene/search/components/scene-search-result/index.wxss new file mode 100644 index 0000000..b9ecf47 --- /dev/null +++ b/pages/inspection/scene/search/components/scene-search-result/index.wxss @@ -0,0 +1,8 @@ +.enterprise-info__tag { + display: flex; + justify-content: flex-end; +} + +.t-class-tag { + margin-left: 16rpx; +} \ No newline at end of file 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, + }); + }, + }); + }, +}); diff --git a/pages/inspection/scene/search/index.json b/pages/inspection/scene/search/index.json index 8835af0..be36215 100644 --- a/pages/inspection/scene/search/index.json +++ b/pages/inspection/scene/search/index.json @@ -1,3 +1,7 @@ { - "usingComponents": {} + "navigationBarTitleText": "鎼滅储", + "onReachBottomDistance": 10, + "usingComponents": { + "scene-search-result": "./components/scene-search-result/index" + } } \ No newline at end of file diff --git a/pages/inspection/scene/search/index.wxml b/pages/inspection/scene/search/index.wxml index 88d4e2e..184d347 100644 --- a/pages/inspection/scene/search/index.wxml +++ b/pages/inspection/scene/search/index.wxml @@ -1,2 +1,71 @@ -<!--pages/inspection/scene/search/index.wxml--> -<text>pages/inspection/scene/search/index.wxml</text> \ No newline at end of file +<!--pages/search/index.wxml--> +<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/scene/search/index.wxss b/pages/inspection/scene/search/index.wxss index deec10a..70c1d5c 100644 --- a/pages/inspection/scene/search/index.wxss +++ b/pages/inspection/scene/search/index.wxss @@ -1 +1,61 @@ -/* pages/inspection/scene/search/index.wxss */ \ No newline at end of file +.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/usercenter/index.js b/pages/usercenter/index.js index 9e653e2..82e78fd 100644 --- a/pages/usercenter/index.js +++ b/pages/usercenter/index.js @@ -90,6 +90,11 @@ }, logout() { + app.globalData.onLaunch.forEach(fun => { + if (typeof fun === 'function') { + fun(); + } + }); wx.reLaunch({ url: '/pages/usercenter/login/login-home/index', }); diff --git a/pages/usercenter/menu.js b/pages/usercenter/menu.js index a49fd6d..27b9e61 100644 --- a/pages/usercenter/menu.js +++ b/pages/usercenter/menu.js @@ -1,7 +1,7 @@ export const menuData = [ [ { - title: '鐜板満鐩戠', + title: '璁惧绠$悊', tit: '', url: '', type: 'supervision', diff --git a/project.private.config.json b/project.private.config.json index 48095cd..0c5a5c1 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,8 +2,8 @@ "description": "椤圭洰绉佹湁閰嶇疆鏂囦欢銆傛鏂囦欢涓殑鍐呭灏嗚鐩� project.config.json 涓殑鐩稿悓瀛楁銆傞」鐩殑鏀瑰姩浼樺厛鍚屾鍒版鏂囦欢涓�傝瑙佹枃妗o細https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "ep-law-abiding-manage-weixin", "setting": { - "compileHotReLoad": true, + "compileHotReLoad": false, "urlCheck": false }, - "libVersion": "3.4.10" + "libVersion": "3.5.3" } \ No newline at end of file diff --git a/services/inspection/fetchDevice.js b/services/inspection/fetchDevice.js index c3442da..dd735b0 100644 --- a/services/inspection/fetchDevice.js +++ b/services/inspection/fetchDevice.js @@ -5,7 +5,7 @@ import { get, post, put } from '../baseRequset'; import { inspectUrl, inspectPicUrl } from '../../config/index'; import { transSceneType } from '../../model/sceneType'; -import { getDeviceList } from '../../model/device'; +import { getDeviceList, getDeviceStatusList } from '../../model/device'; /** * 鑾峰彇鍦烘櫙璁惧鍩烘湰淇℃伅 @@ -86,6 +86,7 @@ }, inspectUrl, ).then(res => { + res.data.data = getDeviceStatusList(res.data.data) return res.data; }); } diff --git a/services/inspection/fetchInspection.js b/services/inspection/fetchInspection.js index b4de0d8..be9f290 100644 --- a/services/inspection/fetchInspection.js +++ b/services/inspection/fetchInspection.js @@ -95,10 +95,10 @@ }, inspectUrl, ).then(res => { - res.data.data = getInspectionStatisticList(res.data.data); - return res.data; - // res.data = getInspectionStatisticList(res.data); - // return res; + // res.data.data = getInspectionStatisticList(res.data.data); + // return res.data; + res.data = getInspectionStatisticList(res.data); + return res; }); } -- Gitblit v1.9.3