From b09c7e7aefd41a62326ea56460092aa0db54c083 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 21 四月 2026 17:30:52 +0800
Subject: [PATCH] 现场监管模块
---
app.wxss | 3
package_supervision/pages/menu_evidence/index.json | 3
config/index.js | 6
style/page.wxss | 1
package_supervision/pages/menu_evidence/index.wxml | 2
package_supervision/pages/subtask/subtaskitem.wxss | 42 ++
package_supervision/pages/menu_evidence/index.wxss | 1
package_supervision/pages/subtask/subtaskitem.wxml | 79 ++++
package_supervision/pages/subtask/subtaskitem-proxy.js | 139 +++++++
package_supervision/pages/subtask/index.wxss | 9
app.json | 4
package_supervision/pages/inspection/index.wxml | 70 +++
package_supervision/pages/subtask/index.wxml | 29
package_supervision/pages/subtask/index.js | 111 ++++-
package_supervision/api/taskApi.js | 58 +++
package_supervision/pages/menu_evidence/index.js | 66 +++
package_supervision/pages/inspection/index.js | 302 ++++++++++++++--
style/common.wxss | 12
package_supervision/pages/inspection/index.json | 6
package_supervision/pages/inspection/index.wxss | 104 +++++
package_supervision/pages/subtask/index.json | 6
21 files changed, 960 insertions(+), 93 deletions(-)
diff --git a/app.json b/app.json
index 3323913..88d3c4f 100644
--- a/app.json
+++ b/app.json
@@ -47,7 +47,8 @@
"root": "package_supervision",
"pages": [
"pages/inspection/index",
- "pages/subtask/index"
+ "pages/subtask/index",
+ "pages/menu_evidence/index"
]
}
],
@@ -82,6 +83,7 @@
"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",
diff --git a/app.wxss b/app.wxss
index 28ac8cb..e711111 100644
--- a/app.wxss
+++ b/app.wxss
@@ -5,4 +5,5 @@
@import 'style/text.wxss';
@import 'style/component.wxss';
@import 'style/panel.wxss';
-@import 'style/iconfont.wxss';
\ No newline at end of file
+@import 'style/iconfont.wxss';
+@import 'style/common.wxss';
\ No newline at end of file
diff --git a/config/index.js b/config/index.js
index f3d8c5e..7ad3490 100644
--- a/config/index.js
+++ b/config/index.js
@@ -9,10 +9,8 @@
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';
diff --git a/package_supervision/api/taskApi.js b/package_supervision/api/taskApi.js
index 9366794..a76913c 100644
--- a/package_supervision/api/taskApi.js
+++ b/package_supervision/api/taskApi.js
@@ -45,4 +45,62 @@
return res.data;
});
},
+
+ /**
+ * 鑾峰彇鍏蜂綋瀛愪换鍔′俊鎭�
+ * @param {String} dayTaskId 鏃ヤ换鍔′富閿甶d
+ * @param {String} userId 鐢ㄦ埛id锛屽綋鐢ㄦ埛绫诲瀷userType涓�1锛堢洃绠$敤鎴凤級鏃讹紝浼氭牴鎹敤鎴穒d鑾峰彇鍏舵潈闄愬唴鐨勭粺璁′俊鎭�
+ * @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);
+ },
};
diff --git a/package_supervision/pages/inspection/index.js b/package_supervision/pages/inspection/index.js
index b8e8be3..7664b8a 100644
--- a/package_supervision/pages/inspection/index.js
+++ b/package_supervision/pages/inspection/index.js
@@ -1,66 +1,282 @@
-// 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: 鏈墽琛� | 姝e湪鎵ц | 宸茬粨鏉�
+ * 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',
+ },
+ 姝e湪鎵ц: {
+ status: '姝e湪鎵ц',
+ 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 浠诲姟鐘舵�侊細 鏈墽琛� | 姝e湪鎵ц | 宸茬粨鏉�
*/
- onReady() {
-
+ refreshMenuStatus(status) {
+ const { menu1, menu2 } = this.data;
+ if (status == '姝e湪鎵ц') {
+ 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 == '姝e湪鎵ц') {
+ taskStatusDialog = {
+ show: true,
+ title: '瑕佺粨鏉熶换鍔″悧锛�',
+ content: '缁撴潫浠诲姟鍚庝笉鑳藉啀鏂板闂',
+ };
+ }
+ this.setData({ taskStatusDialog });
+ },
+
+ closeDialog() {
+ this.setData({ 'taskStatusDialog.show': false });
},
/**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
+ * 浠诲姟鐘舵�佸彉鏇翠簨浠跺鐞嗗嚱鏁�
*/
- onHide() {
-
+ 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.姝e湪鎵ц,
+ };
+ } else if (taskStatus.status == '姝e湪鎵ц') {
+ 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 }));
},
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
- */
- onUnload() {
-
- },
-
- /**
- * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
- */
- onReachBottom() {
-
- },
-
- /**
- * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
- */
- onShareAppMessage() {
-
- }
-})
\ No newline at end of file
+});
diff --git a/package_supervision/pages/inspection/index.json b/package_supervision/pages/inspection/index.json
index 8835af0..7cee190 100644
--- a/package_supervision/pages/inspection/index.json
+++ b/package_supervision/pages/inspection/index.json
@@ -1,3 +1,9 @@
{
+ "navigationBarTitleText": "鐜板満鐩戠",
+ "onReachBottomDistance": 10,
+ "backgroundTextStyle": "light",
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#fff",
+ "navigationStyle":"custom",
"usingComponents": {}
}
\ No newline at end of file
diff --git a/package_supervision/pages/inspection/index.wxml b/package_supervision/pages/inspection/index.wxml
index 30498df..09c9ed7 100644
--- a/package_supervision/pages/inspection/index.wxml
+++ b/package_supervision/pages/inspection/index.wxml
@@ -1,2 +1,68 @@
-<!--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"
+/>
diff --git a/package_supervision/pages/inspection/index.wxss b/package_supervision/pages/inspection/index.wxss
index b1453ca..4a2524b 100644
--- a/package_supervision/pages/inspection/index.wxss
+++ b/package_supervision/pages/inspection/index.wxss
@@ -1 +1,103 @@
-/* package_supervision/pages/inspection/index.wxss */
\ No newline at end of file
+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%);
+}
diff --git a/package_supervision/pages/menu_evidence/index.js b/package_supervision/pages/menu_evidence/index.js
new file mode 100644
index 0000000..d566c57
--- /dev/null
+++ b/package_supervision/pages/menu_evidence/index.js
@@ -0,0 +1,66 @@
+// package_supervision/pages/menu_evidence/index.js
+Page({
+
+ /**
+ * 椤甸潰鐨勫垵濮嬫暟鎹�
+ */
+ data: {
+
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
+ */
+ onLoad(options) {
+
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
+ */
+ onShow() {
+
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
+ */
+ onHide() {
+
+ },
+
+ /**
+ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇
+ */
+ onUnload() {
+
+ },
+
+ /**
+ * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
+ */
+ onPullDownRefresh() {
+
+ },
+
+ /**
+ * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
+ */
+ onReachBottom() {
+
+ },
+
+ /**
+ * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
+ */
+ onShareAppMessage() {
+
+ }
+})
\ No newline at end of file
diff --git a/package_supervision/pages/menu_evidence/index.json b/package_supervision/pages/menu_evidence/index.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/package_supervision/pages/menu_evidence/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/package_supervision/pages/menu_evidence/index.wxml b/package_supervision/pages/menu_evidence/index.wxml
new file mode 100644
index 0000000..fc6e6cf
--- /dev/null
+++ b/package_supervision/pages/menu_evidence/index.wxml
@@ -0,0 +1,2 @@
+<!--package_supervision/pages/menu_evidence/index.wxml-->
+<text>package_supervision/pages/menu_evidence/index.wxml</text>
\ No newline at end of file
diff --git a/package_supervision/pages/menu_evidence/index.wxss b/package_supervision/pages/menu_evidence/index.wxss
new file mode 100644
index 0000000..bdcbbfa
--- /dev/null
+++ b/package_supervision/pages/menu_evidence/index.wxss
@@ -0,0 +1 @@
+/* package_supervision/pages/menu_evidence/index.wxss */
\ No newline at end of file
diff --git a/package_supervision/pages/subtask/index.js b/package_supervision/pages/subtask/index.js
index 28cc91a..730ebe0 100644
--- a/package_supervision/pages/subtask/index.js
+++ b/package_supervision/pages/subtask/index.js
@@ -1,19 +1,30 @@
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: [],
},
@@ -22,6 +33,26 @@
*/
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,
+ });
},
/**
@@ -44,12 +75,23 @@
* 鍒囨崲鏈堜唤鎴栧勾浠戒簨浠跺鐞嗗嚱鏁�
*/
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();
},
@@ -60,21 +102,18 @@
* 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;
},
@@ -83,8 +122,14 @@
* 鐐瑰嚮鏃ユ湡浜嬩欢澶勭悊鍑芥暟
*/
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();
},
/**
@@ -96,16 +141,24 @@
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 => {
- return {
- label: r.name,
- value: r.tguid,
- };
- });
+ 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();
@@ -120,12 +173,22 @@
taskApi
.fetchDayTasks(this.data.toptask.value)
.then(res => {
- this.setData({ daytasks: res });
- setTimeout(() => {
- const _formatCalendarDay = this._formatCalendarDay;
- this.setData({ formatCalendarDay: _formatCalendarDay });
- }, 1000);
+ if (res) {
+ this.setData({ daytasks: res });
+ this.selectThisDay();
+ }
})
.finally(() => this.setData({ pageLoading: false }));
},
+
+ // 鐢ㄤ簬瑙﹀彂鏃ュ巻鐨勬棩鏈熸牸寮忓寲鍑芥暟锛屾樉绀烘瘡鏃ヤ换鍔″畬鎴愭儏鍐�
+ selectThisDay() {
+ setTimeout(() => {
+ const { thisDate } = this.data;
+ this.setData({
+ thisDate,
+ });
+ this.fetchSubtaskByDayTask();
+ }, 200);
+ },
});
diff --git a/package_supervision/pages/subtask/index.json b/package_supervision/pages/subtask/index.json
index 617a5eb..a5b940a 100644
--- a/package_supervision/pages/subtask/index.json
+++ b/package_supervision/pages/subtask/index.json
@@ -1,9 +1,9 @@
{
- "navigationBarTitleText": "鐜板満鐩戠",
+ "navigationBarTitleText": "宸℃煡鏃ョ▼",
"onReachBottomDistance": 10,
"backgroundTextStyle": "light",
- "navigationBarTextStyle": "black",
- "navigationBarBackgroundColor": "#fff",
+ "navigationBarTextStyle": "white",
+ "navigationBarBackgroundColor": "#389AFF",
"usingComponents": {
"scene-picker": "/components/scene-picker/index"
}
diff --git a/package_supervision/pages/subtask/index.wxml b/package_supervision/pages/subtask/index.wxml
index dfd28d2..bfed5f5 100644
--- a/package_supervision/pages/subtask/index.wxml
+++ b/package_supervision/pages/subtask/index.wxml
@@ -1,23 +1,25 @@
-<!--pages/enterprise/result/index.wxml-->
+<t-back-top theme="round" text="椤堕儴" scroll-top="{{scrollTop }}"> </t-back-top>
<view class="page">
<view class="page-header">
- <!-- <view class="subtask-header"> -->
- <t-dropdown-menu t-class-item="custom-dropdown-menu">
- <t-dropdown-item
- options="{{toptask.options}}"
- placement="right"
- value="{{toptask.value}}"
- bindchange="onToptaskChange"
- />
- </t-dropdown-menu>
- <!-- <scene-picker
+ <t-sticky style="z-index: 10000">
+ <!-- <view class="subtask-header"> -->
+ <t-dropdown-menu t-class-item="custom-dropdown-menu">
+ <t-dropdown-item
+ options="{{toptask.options}}"
+ placement="right"
+ value="{{toptask.value}}"
+ bindchange="onToptaskChange"
+ />
+ </t-dropdown-menu>
+ <!-- <scene-picker
style="background-color: white;margin: initial;"
sceneMode="{{0}}"
bind:sceneInitValue="initScene"
bind:scenePickerChange="onScenePickerConfirm"
>
</scene-picker> -->
- <!-- </view> -->
+ <!-- </view> -->
+ </t-sticky>
<t-loading
wx:if="{{pageLoading}}"
theme="circular"
@@ -42,6 +44,7 @@
bind:select="handleSelectDay"
value="{{thisDate}}"
/>
+ <include src="./subtaskitem.wxml" />
</view>
- <view class="page-footer"></view>
+ <view class="page-footer"> </view>
</view>
diff --git a/package_supervision/pages/subtask/index.wxss b/package_supervision/pages/subtask/index.wxss
index 9189b63..9fa00f7 100644
--- a/package_supervision/pages/subtask/index.wxss
+++ b/package_supervision/pages/subtask/index.wxss
@@ -1,6 +1,12 @@
+@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 {
@@ -22,5 +28,6 @@
}
.custom-calendar .t-calendar__dates-item {
- /* height: 80rpx; */
+ height: 80rpx;
+ align-items: flex-start;
}
diff --git a/package_supervision/pages/subtask/subtaskitem-proxy.js b/package_supervision/pages/subtask/subtaskitem-proxy.js
new file mode 100644
index 0000000..b855c2c
--- /dev/null
+++ b/package_supervision/pages/subtask/subtaskitem-proxy.js
@@ -0,0 +1,139 @@
+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 '姝e湪鎵ц':
+ 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();
+
+ },
+ },
+ });
+ },
+ },
+});
diff --git a/package_supervision/pages/subtask/subtaskitem.wxml b/package_supervision/pages/subtask/subtaskitem.wxml
new file mode 100644
index 0000000..0dced6e
--- /dev/null
+++ b/package_supervision/pages/subtask/subtaskitem.wxml
@@ -0,0 +1,79 @@
+<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>
diff --git a/package_supervision/pages/subtask/subtaskitem.wxss b/package_supervision/pages/subtask/subtaskitem.wxss
new file mode 100644
index 0000000..44bf002
--- /dev/null
+++ b/package_supervision/pages/subtask/subtaskitem.wxss
@@ -0,0 +1,42 @@
+.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;
+}
\ No newline at end of file
diff --git a/style/common.wxss b/style/common.wxss
new file mode 100644
index 0000000..7eb08fa
--- /dev/null
+++ b/style/common.wxss
@@ -0,0 +1,12 @@
+.m-t-4 {
+ margin-top: 4px;
+}
+.m-b-4 {
+ margin-bottom: 4px;
+}
+.m-r-4 {
+ margin-right: 4px;
+}
+.m-l-4 {
+ margin-left: 4px;
+}
\ No newline at end of file
diff --git a/style/page.wxss b/style/page.wxss
index 7c5c6eb..3995793 100644
--- a/style/page.wxss
+++ b/style/page.wxss
@@ -4,6 +4,7 @@
}
.page {
+ position: relative;
min-height: 100vh;
background-color: var(--td-bg-color);
padding-top: 0px;
--
Gitblit v1.9.3