现场监管模块
1. 完成任务的开始结束(新增了后台接口)
2. 日历界面完成任务状态和完成情况的同步
| | |
| | | "root": "package_supervision", |
| | | "pages": [ |
| | | "pages/inspection/index", |
| | | "pages/subtask/index" |
| | | "pages/subtask/index", |
| | | "pages/menu_evidence/index" |
| | | ] |
| | | } |
| | | ], |
| | |
| | | "t-avatar": "tdesign-miniprogram/avatar/avatar", |
| | | "t-badge": "tdesign-miniprogram/badge/badge", |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-back-top": "tdesign-miniprogram/back-top/back-top", |
| | | "t-cell": "tdesign-miniprogram/cell/cell", |
| | | "t-cell-group": "tdesign-miniprogram/cell-group/cell-group", |
| | | "t-collapse": "tdesign-miniprogram/collapse/collapse", |
| | |
| | | @import 'style/component.wxss'; |
| | | @import 'style/panel.wxss'; |
| | | @import 'style/iconfont.wxss'; |
| | | @import 'style/common.wxss'; |
| | |
| | | const baseFileUrl = `${bu}/meeting/file/`; |
| | | |
| | | // 线ä¸ç管 |
| | | const inspectUrl = 'https://fyami.com.cn:447'; |
| | | // const inspectUrl = 'http://192.168.0.138:9001'; |
| | | // const inspectUrl = 'http://192.168.0.138:8080'; |
| | | // const inspectUrl = 'http://192.168.1.8:8080'; |
| | | // const inspectUrl = 'https://fyami.com.cn:447'; |
| | | const inspectUrl = 'http://192.168.1.7:9001'; |
| | | |
| | | // 线ä¸ç管å¾ç |
| | | const iu = 'https://fyami.com.cn:447'; |
| | |
| | | return res.data; |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * è·åå
·ä½åä»»å¡ä¿¡æ¯ |
| | | * @param {String} dayTaskId æ¥ä»»å¡ä¸»é®id |
| | | * @param {String} userId ç¨æ·idï¼å½ç¨æ·ç±»åuserType为1ï¼çç®¡ç¨æ·ï¼æ¶ï¼ä¼æ ¹æ®ç¨æ·idè·åå
¶æéå
çç»è®¡ä¿¡æ¯ |
| | | * @param {String} userType ç¨æ·ç±»åï¼0ï¼ç®¡çåï¼1ï¼çç®¡ç¨æ·ï¼2ï¼æ¿åºé¨é¨ï¼3ï¼ä¼ä¸ |
| | | */ |
| | | fetchSubtaskByDayTask(dayTaskId, userId = '', userType = '0') { |
| | | return get( |
| | | { |
| | | url: `/subtask/byDayTaskId`, |
| | | params: { |
| | | dayTaskId, |
| | | userId, |
| | | userType, |
| | | }, |
| | | }, |
| | | inspectUrl, |
| | | ).then(res => { |
| | | return res.data; |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * è·ååä»»å¡çå·¡æ¥ä¿¡æ¯ï¼è¿å
æ¬é®é¢å表ãæé²è®¾æ½å表 |
| | | * @param {String} subTaskId |
| | | */ |
| | | fetchInspectionData(subTaskId) { |
| | | return get( |
| | | { |
| | | url: `/inspection/find/${subTaskId}`, |
| | | }, |
| | | inspectUrl, |
| | | ).then(res => { |
| | | res.data.problemList.forEach(p => { |
| | | p.mediafileList.forEach(m => { |
| | | m.url = `${inspectPicUrl}${m.extension1}${m.guid}.jpg`; |
| | | }); |
| | | }); |
| | | return res.data; |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * ä¿®æ¹ä»»å¡ç¶æï¼æªæ§è¡ -> æ§è¡ä¸ -> ç»æ |
| | | * @param {string} stGuid |
| | | */ |
| | | changeSubTaskStatus(stGuid) { |
| | | return post( |
| | | { |
| | | url: `/subtask/status`, |
| | | params: { |
| | | stGuid, |
| | | }, |
| | | }, |
| | | inspectUrl, |
| | | ).then(res => res.data); |
| | | }, |
| | | }; |
| | |
| | | // package_supervision/pages/inspection/index.js |
| | | Page({ |
| | | import { inspectPicUrl } from '../../../config/index'; |
| | | import taskApi from '../../api/taskApi'; |
| | | import { fetchScene } from '../../../services/inspection/fetchScene'; |
| | | import Message from 'tdesign-miniprogram/message/index'; |
| | | |
| | | /** |
| | | * status: æªæ§è¡ | æ£å¨æ§è¡ | å·²ç»æ |
| | | * action: å¼å§ä»»å¡ | ç»æä»»å¡ | å·²ç»æ |
| | | * theme: primary | danger | default |
| | | * icon: play-circle-stroke | pause-circle-stroke | stop-circle |
| | | */ |
| | | const TASK_STATUS = { |
| | | æªæ§è¡: { |
| | | status: 'æªæ§è¡', |
| | | action: 'å¼å§ä»»å¡', |
| | | theme: 'primary', |
| | | icon: 'play-circle-stroke', |
| | | }, |
| | | æ£å¨æ§è¡: { |
| | | status: 'æ£å¨æ§è¡', |
| | | action: 'ç»æä»»å¡', |
| | | theme: 'danger', |
| | | icon: 'pause-circle-stroke', |
| | | }, |
| | | å·²ç»æ: { |
| | | status: 'å·²ç»æ', |
| | | action: 'å·²ç»æ', |
| | | theme: 'default', |
| | | icon: 'stop-circle-stroke', |
| | | }, |
| | | }; |
| | | |
| | | Page({ |
| | | /** |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | title: 'ç°åºç管', |
| | | // å·¡æ¥åä»»å¡ |
| | | subtask: {}, |
| | | // åºæ¯ä¿¡æ¯ |
| | | scene: {}, |
| | | inspeciton: {}, |
| | | // |
| | | mapMarkers: [], |
| | | // åè½èå |
| | | menu1: [ |
| | | { |
| | | name: 'é®é¢å¤æ ¸', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_check.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'é®é¢åè¯', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_new_question.png`, |
| | | disabled: true, |
| | | url: '/package_supervision/pages/menu_evidence/index' |
| | | }, |
| | | { |
| | | name: 'é®é¢æ¸
å', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_question_list.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'ç°åºæ´æ¹', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_change.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'ä»»ææç
§', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_camera.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: '导èª', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_navi.png`, |
| | | disabled: false, |
| | | }, |
| | | { |
| | | name: 'éæ°å®ä½', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_latlng.png`, |
| | | disabled: false, |
| | | }, |
| | | { |
| | | name: 'ä¿®æ¹ä¿¡æ¯', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_edit.png`, |
| | | disabled: false, |
| | | }, |
| | | { |
| | | name: 'é®é¢å®¡æ ¸', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_online.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'æ´æ¹å®¡æ ¸', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_promiss.png`, |
| | | disabled: true, |
| | | }, |
| | | ], |
| | | menu2: [ |
| | | { |
| | | name: 'å¾çåè¯', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_new_question.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'æ´æ¹æ¿è¯º', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_promiss.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: '综åè¯å', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_rate.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'ä¸é®å享', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_submit.png`, |
| | | disabled: true, |
| | | }, |
| | | { |
| | | name: 'æé²æªæ½', |
| | | icon: `${inspectPicUrl}icons/icon_patrol_newgit.png`, |
| | | disabled: true, |
| | | }, |
| | | ], |
| | | |
| | | // ä»»å¡ç¶æ |
| | | taskStatus: { |
| | | loading: false, |
| | | ...TASK_STATUS.å·²ç»æ, |
| | | }, |
| | | // ä»»å¡ç¶ææé®å è½½æ ·å¼ |
| | | loadProps: { |
| | | theme: 'spinner', |
| | | tClass: 'ins-buttons__loading', |
| | | }, |
| | | // ä»»å¡ç¶ææ´æ¹ç¡®è®¤å¼¹åºæ¡ |
| | | taskStatusDialog: { |
| | | show: false, |
| | | title: 'è¦å¼å§ä»»å¡åï¼', |
| | | content: '', |
| | | }, |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å è½½ |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | // è·åå·¡æ¥ä»»å¡åæ° subtaskï¼å¹¶æ´æ°ä»»å¡ç¶æ taskStatus |
| | | this.getOpenerEventChannel().on('acceptSubTaskData', data => { |
| | | if (data) { |
| | | this.setData({ |
| | | subtask: data.subtask, |
| | | taskStatus: { |
| | | loading: false, |
| | | ...TASK_STATUS[data.subtask.status], |
| | | }, |
| | | }); |
| | | this.fetchInspectionData(); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å次渲æå®æ |
| | | * æ ¹æ®ä»»å¡ç¶æï¼æ´æ°æé®æ¯å¦å¯ç¹å» |
| | | * @param {string} status ä»»å¡ç¶æï¼ æªæ§è¡ | æ£å¨æ§è¡ | å·²ç»æ |
| | | */ |
| | | onReady() { |
| | | |
| | | refreshMenuStatus(status) { |
| | | const { menu1, menu2 } = this.data; |
| | | if (status == 'æ£å¨æ§è¡') { |
| | | menu1.forEach(m => { |
| | | m.disabled = false; |
| | | }); |
| | | menu2.forEach(m => { |
| | | m.disabled = false; |
| | | }); |
| | | } else if (status == 'å·²ç»æ') { |
| | | menu1[1].disabled = true; |
| | | menu2[0].disabled = true; |
| | | } else { |
| | | menu1.forEach(m => { |
| | | m.disabled = true; |
| | | }); |
| | | menu2.forEach(m => { |
| | | m.disabled = true; |
| | | }); |
| | | [5, 6, 7].forEach(i => { |
| | | menu1[i].disabled = false; |
| | | }); |
| | | } |
| | | this.setData({ menu1, menu2 }); |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢æ¾ç¤º |
| | | * è·åå·¡æ¥ä¿¡æ¯ååºæ¯ä¿¡æ¯ |
| | | */ |
| | | onShow() { |
| | | fetchInspectionData() { |
| | | const { subtask } = this.data; |
| | | taskApi.fetchInspectionData(subtask.stguid).then(res => { |
| | | this.setData({ |
| | | inspeciton: res, |
| | | }); |
| | | }); |
| | | fetchScene(subtask.scenseid).then(res => { |
| | | const { mapMarkers } = this.data; |
| | | mapMarkers.push({ |
| | | id: 1, |
| | | longitude: res.longitude, |
| | | latitude: res.latitude, |
| | | title: res.name, |
| | | callout: res.name, |
| | | width: 16, |
| | | height: 24, |
| | | }); |
| | | this.setData({ |
| | | scene: res, |
| | | mapMarkers, |
| | | title: res.name, |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | showTaskStatusChangeDialog() { |
| | | let { taskStatusDialog, taskStatus } = this.data; |
| | | if (taskStatus.status == 'æªæ§è¡') { |
| | | taskStatusDialog = { |
| | | show: true, |
| | | title: 'è¦å¼å§ä»»å¡åï¼', |
| | | content: '', |
| | | }; |
| | | } else if (taskStatus.status == 'æ£å¨æ§è¡') { |
| | | taskStatusDialog = { |
| | | show: true, |
| | | title: 'è¦ç»æä»»å¡åï¼', |
| | | content: 'ç»æä»»å¡åä¸è½åæ°å¢é®é¢', |
| | | }; |
| | | } |
| | | this.setData({ taskStatusDialog }); |
| | | }, |
| | | |
| | | closeDialog() { |
| | | this.setData({ 'taskStatusDialog.show': false }); |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢éè |
| | | * ä»»å¡ç¶æåæ´äºä»¶å¤ç彿° |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å¸è½½ |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页é¢ç¸å
³äºä»¶å¤ç彿°--çå¬ç¨æ·ä¸æå¨ä½ |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页é¢ä¸æè§¦åºäºä»¶çå¤ç彿° |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * ç¨æ·ç¹å»å³ä¸è§å享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | handleTaskStatusChange() { |
| | | this.closeDialog(); |
| | | let { taskStatus, subtask } = this.data; |
| | | this.setData({ 'taskStatus.loading': true }); |
| | | if (taskStatus.status == 'å·²ç»æ') { |
| | | return; |
| | | } |
| | | if (taskStatus.status == 'æªæ§è¡') { |
| | | taskStatus = { |
| | | loading: true, |
| | | ...TASK_STATUS.æ£å¨æ§è¡, |
| | | }; |
| | | } else if (taskStatus.status == 'æ£å¨æ§è¡') { |
| | | taskStatus = { |
| | | loading: true, |
| | | ...TASK_STATUS.å·²ç»æ, |
| | | }; |
| | | } |
| | | taskApi |
| | | .changeSubTaskStatus(subtask.stguid) |
| | | .then(res => { |
| | | if (res.success) { |
| | | this.setData({ taskStatus }); |
| | | this.getOpenerEventChannel().emit('changeStatusEvent', { subtask: res.data }); |
| | | this.refreshMenuStatus(taskStatus.status) |
| | | } else { |
| | | Message.error({ |
| | | context: this, |
| | | offset: [90, 32], |
| | | duration: 2000, |
| | | content: res.message, |
| | | }); |
| | | } |
| | | }) |
| | | .finally(() => this.setData({ 'taskStatus.loading': false })); |
| | | }, |
| | | }); |
| | |
| | | { |
| | | "navigationBarTitleText": "ç°åºç管", |
| | | "onReachBottomDistance": 10, |
| | | "backgroundTextStyle": "light", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "navigationStyle":"custom", |
| | | "usingComponents": {} |
| | | } |
| | |
| | | <!--package_supervision/pages/inspection/index.wxml--> |
| | | <text>package_supervision/pages/inspection/index.wxml</text> |
| | | <t-message id="t-message" /> |
| | | <t-navbar left-arrow class="custom-navbar"> |
| | | <view slot="left" class="custom-title"> {{title}} </view> |
| | | </t-navbar> |
| | | <view class="page"> |
| | | <map |
| | | class="ins-map" |
| | | longitude="{{scene.longitude}}" |
| | | latitude="{{scene.latitude}}" |
| | | markers="{{mapMarkers}}" |
| | | /> |
| | | <view class="ins-buttons"> |
| | | <t-button |
| | | loading="{{taskStatus.loading}}" |
| | | loading-props="{{loadProps}}" |
| | | class="ins-buttons__status" |
| | | shape="square" |
| | | theme="{{taskStatus.theme}}" |
| | | content="{{taskStatus.action}}" |
| | | size="large" |
| | | variant="base" |
| | | disabled="{{taskStatus.loading || taskStatus.status == 'å·²ç»æ'}}" |
| | | icon="{{taskStatus.loading ? '' : taskStatus.icon}}" |
| | | bind:tap="showTaskStatusChangeDialog" |
| | | > |
| | | </t-button> |
| | | </view> |
| | | <view class="ins-menu"> |
| | | <t-tabs animation="{{ { duration: 0.6 } }}" defaultValue="{{0}}" class="custom-tabs"> |
| | | <t-tab-panel label="é项ä¸" value="0"> |
| | | <t-grid theme="card" class="custom-grid" column="{{5}}" hover> |
| | | <t-grid-item |
| | | wx:for="{{menu1}}" |
| | | wx:key="index" |
| | | class="{{item.disabled ? 'diabled-grid-item' : ''}}" |
| | | text="{{item.name}}" |
| | | image="{{item.icon}}" |
| | | url="{{item.disabled ? '' : item.url}}" |
| | | > |
| | | </t-grid-item> |
| | | </t-grid> |
| | | <t-icon class="icon-right" size="16" name="caret-right"></t-icon> |
| | | </t-tab-panel> |
| | | <t-tab-panel label="é项äº" value="1"> |
| | | <t-grid theme="card" class="custom-grid" column="{{5}}" hover> |
| | | <t-grid-item |
| | | class="{{item.disabled ? 'diabled-grid-item' : ''}}" |
| | | wx:for="{{menu2}}" |
| | | wx:key="index" |
| | | text="{{item.name}}" |
| | | image="{{item.icon}}" |
| | | > |
| | | </t-grid-item> |
| | | </t-grid> |
| | | <t-icon class="icon-left" size="16" name="caret-left"></t-icon> |
| | | </t-tab-panel> |
| | | </t-tabs> |
| | | </view> |
| | | </view> |
| | | <t-dialog |
| | | visible="{{taskStatusDialog.show}}" |
| | | title="{{taskStatusDialog.title}}" |
| | | content="{{taskStatusDialog.content}}" |
| | | confirm-btn="{{ {content: 'ç¡®å®', theme:'danger'} }}" |
| | | cancel-btn="åæ¶" |
| | | bind:confirm="handleTaskStatusChange" |
| | | bind:cancel="closeDialog" |
| | | /> |
| | |
| | | /* package_supervision/pages/inspection/index.wxss */ |
| | | page { |
| | | /* --header-bottom-padding: 600rpx; */ |
| | | } |
| | | |
| | | .page .page-header { |
| | | /* background: linear-gradient(var(--td-primary-color-7), var(--td-bg-color)); */ |
| | | /* padding-bottom: var(--header-bottom-padding); */ |
| | | } |
| | | |
| | | .page .page-container { |
| | | /* margin-top: calc(0rpx - var(--header-bottom-padding)); */ |
| | | padding: 0; |
| | | } |
| | | |
| | | .custom-navbar { |
| | | --td-navbar-color: #fff; |
| | | --td-navbar-bg-color: var(--td-primary-color); |
| | | --td-navbar-title-font-size: var(--td-font-size-base); |
| | | } |
| | | |
| | | .custom-title { |
| | | font-size: var(--td-font-size-base); |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .ins-map { |
| | | width: 100%; |
| | | height: 90vh; |
| | | } |
| | | |
| | | .ins-buttons { |
| | | position: absolute; |
| | | right: 10px; |
| | | top: 10px; |
| | | } |
| | | |
| | | .ins-buttons .ins-buttons__status { |
| | | --td-button-primary-bg-color: rgb(0, 177, 0); |
| | | --td-button-primary-border-color: rgb(0, 177, 0); |
| | | --td-button-primary-disabled-bg: rgb(125, 201, 125); |
| | | --td-button-primary-disabled-border-color: rgba(0, 177, 0, 0.2); |
| | | --td-button-primary-active-bg-color: rgba(0, 128, 0, 0.534); |
| | | --td-button-primary-active-border-color: rgba(0, 128, 0, 0.534); |
| | | --td-button-default-disabled-border-color: rgba(0, 0, 0, 0.2); |
| | | |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .ins-buttons .ins-buttons__status .t-button__content { |
| | | /* position: absolute; */ |
| | | font-size: var(--td-font-size-xs); |
| | | /* bottom: 0; */ |
| | | line-height: initial; |
| | | margin: initial !important; |
| | | } |
| | | |
| | | .ins-buttons .t-loading { |
| | | --td-loading-color: white; |
| | | } |
| | | |
| | | .ins-menu { |
| | | position: absolute; |
| | | bottom: calc(env(safe-area-inset-bottom) + 96rpx); |
| | | left: 0; |
| | | right: 0; |
| | | padding-bottom: calc(env(safe-area-inset-bottom) + 96rpx); |
| | | } |
| | | |
| | | .custom-grid { |
| | | box-shadow: var(--td-shadow-2); |
| | | margin-bottom: 16px !important; |
| | | } |
| | | .custom-grid .diabled-grid-item { |
| | | position: relative; |
| | | opacity: 0.5; |
| | | } |
| | | |
| | | .custom-tabs .t-tabs__wrapper { |
| | | display: none; |
| | | } |
| | | |
| | | .t-tabs { |
| | | background: transparent !important; |
| | | margin-bottom: -16px; |
| | | } |
| | | |
| | | .t-tab-panel { |
| | | position: relative; |
| | | } |
| | | |
| | | .icon-right { |
| | | position: absolute; |
| | | right: 32rpx; |
| | | bottom: calc(50%); |
| | | } |
| | | |
| | | .icon-left { |
| | | position: absolute; |
| | | left: 32rpx; |
| | | bottom: calc(50%); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // package_supervision/pages/menu_evidence/index.js |
| | | Page({ |
| | | |
| | | /** |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å è½½ |
| | | */ |
| | | onLoad(options) { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å次渲æå®æ |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢æ¾ç¤º |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢éè |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å¸è½½ |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页é¢ç¸å
³äºä»¶å¤ç彿°--çå¬ç¨æ·ä¸æå¨ä½ |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页é¢ä¸æè§¦åºäºä»¶çå¤ç彿° |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * ç¨æ·ç¹å»å³ä¸è§å享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | } |
| | | }) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "usingComponents": {} |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!--package_supervision/pages/menu_evidence/index.wxml--> |
| | | <text>package_supervision/pages/menu_evidence/index.wxml</text> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /* package_supervision/pages/menu_evidence/index.wxss */ |
| | |
| | | import taskApi from '../../api/taskApi'; |
| | | import dayjs from 'dayjs'; |
| | | import { useSubTaskItem } from './subtaskitem-proxy.js'; |
| | | |
| | | const app = getApp(); |
| | | |
| | | Page({ |
| | | behaviors: [useSubTaskItem], |
| | | /** |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | minDate: new Date(2026, 0, 1).getTime(), |
| | | // æ¥åæ¾ç¤ºæ¥æèå´ |
| | | minDate: new Date(2026, 2, 1).getTime(), |
| | | maxDate: new Date(2026, 3, 30).getTime(), |
| | | thisDate: new Date().getTime(), |
| | | |
| | | // éä¸çæ¥æ |
| | | thisDate: new Date().getTime(), |
| | | // 䏿¬¡éä¸çæ¥æ |
| | | lastDate: new Date().getTime(), |
| | | |
| | | // 彿æ»ä»»å¡é项åéä¸çä»»å¡ |
| | | toptask: { |
| | | options: [], |
| | | value: '', |
| | | }, |
| | | // é䏿»ä»»å¡ä¸å¯¹åºçæ¥ä»»å¡ |
| | | daytasks: [], |
| | | }, |
| | | |
| | |
| | | */ |
| | | onLoad(options) { |
| | | this.fetchToptask(); |
| | | // 页é¢å è½½å®æåï¼è®¾å®æ¥åçæ ¼å¼åæ¥æå½æ° |
| | | const _formatCalendarDay = this._formatCalendarDay; |
| | | this.setData({ |
| | | formatCalendarDay: _formatCalendarDay, |
| | | }); |
| | | |
| | | // 设置æ¥åèµ·æ¢æ¶é´ |
| | | this.setData({ |
| | | minDate: dayjs().startOf('month').add(-1, 'month').toDate().getTime(), |
| | | maxDate: dayjs().endOf('month').toDate().getTime(), |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * çå¬é¡µé¢æ»å¨ |
| | | */ |
| | | onPageScroll(e) { |
| | | this.setData({ |
| | | scrollTop: e.scrollTop, |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 忢æä»½æå¹´ä»½äºä»¶å¤ç彿° |
| | | */ |
| | | handelMonthChange(e) { |
| | | console.log('handelMonthChange', e); |
| | | // é䏿¥æåæ¥åæ¢ä¸ä¸ªæ |
| | | const { year, month } = e.detail; |
| | | let thisDay = dayjs(this.data.thisDate); |
| | | thisDay = thisDay.year(year); |
| | | thisDay = thisDay.month(month - 1); |
| | | this.setData({ thisDate: thisDay.toDate().getTime() }); |
| | | |
| | | // 妿忢åçæä»½ä¸ºå½åæ¥åèå´çèµ·å§æä»½ï¼åä¿®æ¹èµ·å§æä»½åå°ä¸ä¸ªæï¼ç¡®ä¿ç¨æ·å¯ç»§ç»æ¥çå岿份 |
| | | const _minDate = dayjs(this.data.minDate); |
| | | if (thisDay.month() == _minDate.month()) { |
| | | this.setData({ |
| | | minDate: _minDate.add(-1, 'month').toDate().getTime(), |
| | | }); |
| | | } |
| | | |
| | | this.setData({ |
| | | thisDate: thisDay.toDate().getTime(), |
| | | }); |
| | | this.fetchToptask(); |
| | | }, |
| | | |
| | |
| | | * type TDateType = 'selected' | 'disabled' | 'start' | 'start-end' |'centre' | 'end' | '' |
| | | */ |
| | | _formatCalendarDay(day) { |
| | | console.log('_formatCalendarDay', day); |
| | | if (!this) return; |
| | | const { date } = day; |
| | | const year = date.getFullYear(); |
| | | const month = date.getMonth() + 1; |
| | | const curDate = date.getDate(); |
| | | |
| | | const { daytasks } = this.data; |
| | | |
| | | // æ¥æ¾å½å¤©æ¯å¦ææ¥ä»»å¡ |
| | | const fdt = daytasks.find(d => { |
| | | return dayjs(d.date).isSame(dayjs(date), 'day'); |
| | | return dayjs(d.date).isSame(dayjs(date), 'day') && d.totalTaskNum > 0; |
| | | }); |
| | | |
| | | if (fdt) { |
| | | day.suffix = `${fdt.completeTaskNum}/${fdt.totalTaskNum}`; |
| | | day.className = 'has-task'; |
| | | } |
| | | return day; |
| | | }, |
| | |
| | | * ç¹å»æ¥æäºä»¶å¤ç彿° |
| | | */ |
| | | handleSelectDay(e) { |
| | | console.log('app', app); |
| | | const date = new Date(e.detail.value); |
| | | console.log('handleSelectDay', date); |
| | | const { thisDate } = this.data; |
| | | this.setData({ |
| | | lastDate: thisDate, |
| | | thisDate: date.getTime(), |
| | | }); |
| | | this.fetchSubtaskByDayTask(); |
| | | }, |
| | | |
| | | /** |
| | |
| | | const starttime = thisDay.startOf('month').format('YYYY-MM-DD HH:mm:ss'); |
| | | const endtime = thisDay.endOf('month').format('YYYY-MM-DD HH:mm:ss'); |
| | | taskApi.fetchTopTasks({ starttime, endtime }).then(res => { |
| | | const options = res.data.map(r => { |
| | | const options = |
| | | res.data.length > 0 |
| | | ? res.data.map(r => { |
| | | return { |
| | | label: r.name, |
| | | value: r.tguid, |
| | | }; |
| | | }); |
| | | }) |
| | | : [ |
| | | { |
| | | label: 'æ¬ææ ç管任å¡', |
| | | value: null, |
| | | }, |
| | | ]; |
| | | this.setData({ |
| | | toptask: { |
| | | options, |
| | | value: options.length > 0 ? options[0].value : '', |
| | | options: options, |
| | | value: options[0].value, |
| | | }, |
| | | }); |
| | | this.fetchDayTasks(); |
| | |
| | | taskApi |
| | | .fetchDayTasks(this.data.toptask.value) |
| | | .then(res => { |
| | | if (res) { |
| | | this.setData({ daytasks: res }); |
| | | setTimeout(() => { |
| | | const _formatCalendarDay = this._formatCalendarDay; |
| | | this.setData({ formatCalendarDay: _formatCalendarDay }); |
| | | }, 1000); |
| | | this.selectThisDay(); |
| | | } |
| | | }) |
| | | .finally(() => this.setData({ pageLoading: false })); |
| | | }, |
| | | |
| | | // ç¨äºè§¦åæ¥åçæ¥ææ ¼å¼å彿°ï¼æ¾ç¤ºæ¯æ¥ä»»å¡å®ææ
åµ |
| | | selectThisDay() { |
| | | setTimeout(() => { |
| | | const { thisDate } = this.data; |
| | | this.setData({ |
| | | thisDate, |
| | | }); |
| | | this.fetchSubtaskByDayTask(); |
| | | }, 200); |
| | | }, |
| | | }); |
| | |
| | | { |
| | | "navigationBarTitleText": "ç°åºç管", |
| | | "navigationBarTitleText": "å·¡æ¥æ¥ç¨", |
| | | "onReachBottomDistance": 10, |
| | | "backgroundTextStyle": "light", |
| | | "navigationBarTextStyle": "black", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "navigationBarTextStyle": "white", |
| | | "navigationBarBackgroundColor": "#389AFF", |
| | | "usingComponents": { |
| | | "scene-picker": "/components/scene-picker/index" |
| | | } |
| | |
| | | <!--pages/enterprise/result/index.wxml--> |
| | | <t-back-top theme="round" text="é¡¶é¨" scroll-top="{{scrollTop }}"> </t-back-top> |
| | | <view class="page"> |
| | | <view class="page-header"> |
| | | <t-sticky style="z-index: 10000"> |
| | | <!-- <view class="subtask-header"> --> |
| | | <t-dropdown-menu t-class-item="custom-dropdown-menu"> |
| | | <t-dropdown-item |
| | |
| | | > |
| | | </scene-picker> --> |
| | | <!-- </view> --> |
| | | </t-sticky> |
| | | <t-loading |
| | | wx:if="{{pageLoading}}" |
| | | theme="circular" |
| | |
| | | bind:select="handleSelectDay" |
| | | value="{{thisDate}}" |
| | | /> |
| | | <include src="./subtaskitem.wxml" /> |
| | | </view> |
| | | <view class="page-footer"></view> |
| | | </view> |
| | |
| | | @import './subtaskitem.wxss'; |
| | | |
| | | .subtask-header { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .has-task:not(.t-calendar__dates-item--selected) { |
| | | color: #e34d59; |
| | | } |
| | | /* ç»ä»¶t-dropdown-menu */ |
| | | .custom-dropdown-menu { |
| | |
| | | } |
| | | |
| | | .custom-calendar .t-calendar__dates-item { |
| | | /* height: 80rpx; */ |
| | | height: 80rpx; |
| | | align-items: flex-start; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import dayjs from 'dayjs'; |
| | | import taskApi from '../../api/taskApi'; |
| | | |
| | | /** |
| | | * åä»»å¡å表模å |
| | | */ |
| | | export const useSubTaskItem = Behavior({ |
| | | data: { |
| | | subTaskLoading: false, |
| | | // 彿¥çåä»»å¡ |
| | | subtaskList: [], |
| | | }, |
| | | methods: { |
| | | statusType(status) { |
| | | switch (status) { |
| | | case 'æªæ§è¡': |
| | | return { |
| | | type: 'danger', |
| | | icon: 'assignment-error-filled', |
| | | }; |
| | | case 'æ£å¨æ§è¡': |
| | | return { |
| | | type: 'success', |
| | | icon: 'time', |
| | | }; |
| | | case 'å·²ç»æ': |
| | | return { |
| | | type: '', |
| | | icon: 'assignment-checked-filled', |
| | | }; |
| | | default: |
| | | return { |
| | | type: 'danger', |
| | | icon: 'assignment-error-filled', |
| | | }; |
| | | } |
| | | }, |
| | | /** |
| | | * è·ååä»»å¡ |
| | | */ |
| | | fetchSubtaskByDayTask() { |
| | | this.setData({ subTaskLoading: true }); |
| | | const { thisDate, daytasks } = this.data; |
| | | const fdt = daytasks.find(d => { |
| | | return dayjs(d.date).isSame(dayjs(thisDate), 'day'); |
| | | }); |
| | | if (fdt) { |
| | | taskApi |
| | | .fetchSubtaskByDayTask(fdt.guid) |
| | | .then(res => { |
| | | this.setData({ |
| | | subtaskList: res |
| | | .sort((a, b) => { |
| | | if (a.sceneTypeId != b.sceneTypeId) { |
| | | return a.sceneTypeId - b.sceneTypeId; |
| | | } else { |
| | | return dayjs(b.executionstarttime).unix() - dayjs(a.executionstarttime).unix(); |
| | | } |
| | | }) |
| | | .map(stask => { |
| | | const changePerType = () => { |
| | | if (status.value.changeNum == 0) { |
| | | if (status.value.proNum == 0) { |
| | | return 'success'; |
| | | } else { |
| | | return 'danger'; |
| | | } |
| | | } else if (status.value.proNum == status.value.changeNum) { |
| | | return 'success'; |
| | | } else { |
| | | return 'warning'; |
| | | } |
| | | }; |
| | | const timeformat = date => { |
| | | return date ? dayjs(date).format('YYYY-MM-DD HH:mm') : '----/--/-- --:--'; |
| | | }; |
| | | return { |
| | | ...stask, |
| | | startTime: timeformat(stask.executionstarttime), |
| | | endTime: timeformat(stask.executionendtime), |
| | | statusType: this.statusType(stask.status), |
| | | }; |
| | | }), |
| | | }); |
| | | }) |
| | | .finally(() => this.setData({ subTaskLoading: false })); |
| | | } else { |
| | | this.setData({ |
| | | subtaskList: [], |
| | | subTaskLoading: false, |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * ç¹å»åä»»å¡äºä»¶å¤ç彿° |
| | | */ |
| | | handleItemClick(e) { |
| | | const { index } = e.currentTarget.dataset; |
| | | const { subtaskList } = this.data; |
| | | const subtask = subtaskList[index]; |
| | | wx.navigateTo({ |
| | | url: '/package_supervision/pages/inspection/index', |
| | | success: result => { |
| | | result.eventChannel.emit('acceptSubTaskData', { |
| | | subtask, |
| | | }); |
| | | }, |
| | | events: { |
| | | // ä»»å¡ç¶æåæ´äºä»¶ |
| | | changeStatusEvent: data => { |
| | | const { daytasks } = this.data; |
| | | subtask.status = data?.subtask?.status; |
| | | subtask.statusType = this.statusType(subtask.status); |
| | | // è¥ä»»å¡ç»æï¼åæ´æ°æ¥ä»»å¡ä¸ç宿任塿°éç»è®¡ |
| | | if (subtask.status == 'å·²ç»æ') { |
| | | let _index; |
| | | const daytask = daytasks.find((d, i) => { |
| | | if (d.guid == subtask.tsguid) { |
| | | _index = i; |
| | | return true; |
| | | } |
| | | }); |
| | | daytask.completeTaskNum++; |
| | | this.setData({ |
| | | [`daytasks[${_index}]`]: daytask, |
| | | }); |
| | | } |
| | | this.setData({ |
| | | [`subtaskList[${index}]`]: subtask, |
| | | }); |
| | | this.selectThisDay(); |
| | | |
| | | }, |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <t-loading |
| | | wx:if="{{subTaskLoading}}" |
| | | theme="circular" |
| | | size="40rpx" |
| | | text="å è½½ä¸..." |
| | | loading |
| | | t-class="sti-loading" |
| | | > |
| | | </t-loading> |
| | | <t-empty |
| | | wx:if="{{!subTaskLoading && subtaskList.length == 0}}" |
| | | t-class-image="t-empty__image" |
| | | image="/res/nodata.png" |
| | | description="æ å·¡æ¥ä»»å¡" |
| | | /> |
| | | <block wx:else> |
| | | <view |
| | | class="wrapper m-t-4" |
| | | wx:for="{{subtaskList}}" |
| | | wx:for-index="index" |
| | | wx:key="index" |
| | | data-index="{{index}}" |
| | | bind:tap="handleItemClick" |
| | | > |
| | | <view class="m-t-4" style="display: flex; justify-content: space-between"> |
| | | <view style="width: 100%"> |
| | | <view class="text-title"> |
| | | <t-tag |
| | | size="small" |
| | | theme="{{item.statusType.type}}" |
| | | variant="light-outline" |
| | | class="m-r-4 m-b-4" |
| | | > |
| | | <view style="display: flex; align-items: center; gap: 4px"> |
| | | <t-icon size="16" name="{{item.statusType.icon}}"></t-icon> |
| | | <text>{{item.status}}</text> |
| | | </view> |
| | | </t-tag> |
| | | {{item.name}} |
| | | </view> |
| | | <view class="text-info"> |
| | | <view class="text-label"> |
| | | <t-icon class="m-r-4" size="16" name="location"></t-icon> |
| | | <text>å°åï¼</text> |
| | | </view> |
| | | {{item.scenseaddress}} |
| | | </view> |
| | | <view class="text-info"> |
| | | <view class="text-label"> |
| | | <t-icon class="m-r-4" size="16" name="alarm"></t-icon> |
| | | <text>æ¶é´ï¼</text> |
| | | </view> |
| | | {{item.startTime}}è³{{item.endTime}} |
| | | </view> |
| | | <view class="text-info"> |
| | | <view class="text-label"> |
| | | <t-icon class="m-r-4" size="16" name="user"></t-icon> |
| | | <text>人åï¼</text> |
| | | </view> |
| | | {{item.executorrealtimes}} |
| | | </view> |
| | | <view |
| | | style="display: flex; justify-content: space-between; align-items: center" |
| | | class="m-t-4" |
| | | > |
| | | <view style="display: flex; gap: 8px; align-items: center"> |
| | | <t-tag size="small" variant="light-outline" theme="primary" |
| | | >{{item.sceneTypeName}}</t-tag |
| | | > |
| | | <t-tag size="small" variant="light-outline" theme="primary" |
| | | >{{item.type}}</t-tag |
| | | > |
| | | </view> |
| | | <t-icon size="16" name="arrow-right"></t-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </block> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | .sti-loading { |
| | | width: 100%; |
| | | text-align: center; |
| | | padding: 4px; |
| | | /* background-color: aliceblue; */ |
| | | } |
| | | |
| | | .wrapper { |
| | | /* width: 300px; */ |
| | | border: 1px solid var(--td-text-color-brand); |
| | | border-radius: var(--td-border-radius); |
| | | padding: 4px 8px; |
| | | background-color: white; |
| | | } |
| | | |
| | | .wrapper:active { |
| | | background-color: var(--td-bg-color); |
| | | } |
| | | |
| | | .text-title { |
| | | font-weight: 600; |
| | | color: var(--td-text-color-primary); |
| | | font-size: var(--td-font-size-m); |
| | | } |
| | | |
| | | .text-info { |
| | | display: flex; |
| | | align-items: flex-start; |
| | | color: var(--td-text-color-secondary); |
| | | font-size: var(--td-font-size-s); |
| | | } |
| | | |
| | | .text-label { |
| | | display: flex; |
| | | align-items: center; |
| | | white-space: nowrap; |
| | | } |
| | | |
| | | .t-empty__image { |
| | | width: 240rpx !important; |
| | | height: 240rpx !important; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | .m-t-4 { |
| | | margin-top: 4px; |
| | | } |
| | | .m-b-4 { |
| | | margin-bottom: 4px; |
| | | } |
| | | .m-r-4 { |
| | | margin-right: 4px; |
| | | } |
| | | .m-l-4 { |
| | | margin-left: 4px; |
| | | } |
| | |
| | | } |
| | | |
| | | .page { |
| | | position: relative; |
| | | min-height: 100vh; |
| | | background-color: var(--td-bg-color); |
| | | padding-top: 0px; |