From c7ff9a52349f971b135e7667d8c18414a9279b5b Mon Sep 17 00:00:00 2001 From: liyuanchao <438964165@qq.com> Date: Fri, 5 Sep 2025 16:54:53 +0800 Subject: [PATCH] 1. --- common/config.js | 4 +- common/http.api.js | 12 +- components/CommonCalendar.vue | 300 +++++++++ pages.json | 30 +- pages/sys/user/myRecord/myRecord.vue | 269 +++----- pages/sys/user/myRepair/addRepair.vue | 15 +- pages/sys/user/myRepair/myRepair.vue | 6 +- pages/sys/user/myVisitor/creatVisitor.vue | 6 +- pages/sys/workbench/book/book.vue | 212 +++++++ .../workbench/earlyWarning/earlyWarning.vue | 32 +- pages/sys/workbench/inspection/inspection.vue | 261 +++++--- .../workbench/inspection/inspectionDetail.vue | 452 ++++++++++++++ .../workbench/inspection/inspectionOpt.vue | 573 +++++++++++++++++ .../inspection/inspectionProcess.vue | 565 +++++++++-------- pages/sys/workbench/leave/leave.vue | 583 ++++++++++++++++++ pages/sys/workbench/oa/oa.vue | 81 ++- pages/sys/workbench/order/order.vue | 6 +- pages/sys/workbench/workbench.vue | 33 +- static/ic_camera.png | Bin 0 -> 2646 bytes static/ic_dialog_01.png | Bin 0 -> 319518 bytes static/ic_exp.png | Bin 0 -> 1729 bytes static/ic_sq.png | Bin 0 -> 326 bytes 22 files changed, 2849 insertions(+), 591 deletions(-) create mode 100644 components/CommonCalendar.vue create mode 100644 pages/sys/workbench/book/book.vue create mode 100644 pages/sys/workbench/inspection/inspectionDetail.vue create mode 100644 pages/sys/workbench/inspection/inspectionOpt.vue create mode 100644 pages/sys/workbench/leave/leave.vue create mode 100644 static/ic_camera.png create mode 100644 static/ic_dialog_01.png create mode 100644 static/ic_exp.png create mode 100644 static/ic_sq.png diff --git a/common/config.js b/common/config.js index b5f9682..83ff890 100644 --- a/common/config.js +++ b/common/config.js @@ -27,8 +27,8 @@ const config = { // config.baseUrl = 'http://tc.cqsznc.com:7080/api'; //正式 -config.baseUrl = 'http://183.230.235.66:11010/api'; +// config.baseUrl = 'http://183.230.235.66:11010/api'; -// config.baseUrl = 'http://378a061a.r28.cpolar.top' +config.baseUrl = 'http://799004da.r28.cpolar.top'; export default config; diff --git a/common/http.api.js b/common/http.api.js index b8a397a..16caa68 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -64,7 +64,17 @@ const install = (Vue, vm) => { getImageUrl:(params = {}, ossIds) => vm.$u.get(config.adminPath+`/resource/oss/listByIds/${ossIds}`,params), //巡检任务列表 - getInspection:(params = {})=>vm.$u.get(config.adminPath+'/property/item/list',params), + getInspection:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/inspectionTask/list',params), + + // getTaskList:(params = {},taskId)=>vm.$u.get(config.adminPath+`/property/mobile/taskDetail/list/${taskId}`,params), + //巡检任务 + getTaskList:(params = {})=>vm.$u.get(config.adminPath+'/property/mobile/taskDetail/list',params), + //巡检签到 + taskSignIn:(params = {})=>vm.$u.post(config.adminPath+'/property/mobile/taskDetail/signIn',params), + //巡检提交 + taskSubmit:(params = {})=>vm.$u.post(config.adminPath+'/property/mobile/taskDetail/submit',params), + //巡检工单提报 + taskOrderSubmit:(params = {})=>vm.$u.post(config.adminPath+'/property/mobile/taskDetail/reportedOrder',params), // 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等 lang: (params = {}) => vm.$u.get('/lang/'+params.lang), diff --git a/components/CommonCalendar.vue b/components/CommonCalendar.vue new file mode 100644 index 0000000..a14e355 --- /dev/null +++ b/components/CommonCalendar.vue @@ -0,0 +1,300 @@ + + + + + diff --git a/pages.json b/pages.json index 8d9d26f..3ca434f 100644 --- a/pages.json +++ b/pages.json @@ -373,7 +373,7 @@ { "path": "pages/sys/user/myRecord/myRecord", "style": { - "navigationStyle": "custom" + "navigationBarTitleText": "我的考勤" } }, { @@ -479,6 +479,34 @@ { "navigationBarTitleText" : "巡检任务" } + }, + { + "path" : "pages/sys/workbench/inspection/inspectionOpt", + "style" : + { + "navigationBarTitleText" : "巡检详情" + } + }, + { + "path" : "pages/sys/workbench/inspection/inspectionDetail", + "style" : + { + "navigationBarTitleText" : "巡检详情" + } + }, + { + "path" : "pages/sys/workbench/book/book", + "style" : + { + "navigationBarTitleText" : " 通讯录" + } + }, + { + "path" : "pages/sys/workbench/leave/leave", + "style" : + { + "navigationBarTitleText" : "请假" + } } ], "tabBar": { diff --git a/pages/sys/user/myRecord/myRecord.vue b/pages/sys/user/myRecord/myRecord.vue index ef8e8ca..2922f8a 100644 --- a/pages/sys/user/myRecord/myRecord.vue +++ b/pages/sys/user/myRecord/myRecord.vue @@ -1,10 +1,5 @@ + + diff --git a/pages/sys/workbench/earlyWarning/earlyWarning.vue b/pages/sys/workbench/earlyWarning/earlyWarning.vue index b995b31..f213f12 100644 --- a/pages/sys/workbench/earlyWarning/earlyWarning.vue +++ b/pages/sys/workbench/earlyWarning/earlyWarning.vue @@ -86,10 +86,15 @@ this.loadAllTabsData() }, onShow() { - uni.$once('refreshData', () => { + // 使用$on替代$once,确保每次都能监听到事件 + uni.$on('refreshData', () => { this.loadAllTabsData() }); }, + // 页面卸载时移除事件监听器 + onUnload() { + uni.$off('refreshData'); + }, methods: { goBack() { uni.navigateBack(); @@ -141,16 +146,16 @@ this.tabLoaded[idx] = true; this.loading = false; }, - goDetail2(item) { - const itemStr = encodeURIComponent(JSON.stringify(item)); - if([20, 30, 31, 32].includes(item.state)){ - uni.navigateTo({ - url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr, - }); - }else{ - uni.navigateTo({ - url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr + "&pageType=detail", - }); + goDetail2(item) { + const itemStr = encodeURIComponent(JSON.stringify(item)); + if([20, 30, 31, 32].includes(item.state)){ + uni.navigateTo({ + url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr, + }); + }else{ + uni.navigateTo({ + url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr + "&pageType=detail", + }); } }, goStatistics() { @@ -161,6 +166,11 @@ // 添加预加载所有标签页数据的方法 async loadAllTabsData() { + // 重置状态 + this.pageNum = [1, 1]; + this.noMore = [false, false]; + this.tabData = [[], []]; + // 并行加载所有标签页数据,提高加载速度 const loadPromises = [0, 1].map((index) => { return this.loadTabData(index); diff --git a/pages/sys/workbench/inspection/inspection.vue b/pages/sys/workbench/inspection/inspection.vue index f2a6080..cf6e44d 100644 --- a/pages/sys/workbench/inspection/inspection.vue +++ b/pages/sys/workbench/inspection/inspection.vue @@ -8,24 +8,45 @@ - - - - - 保洁部日常巡检 {{ item.createTime.substring(0,11) }} - - {{ getStatusLabel(item.status) }} - - - - 巡检人:{{ item.createTime }} - 计划完成时间:{{ item.typeName }} - 实际完成时间:{{ item.location }} - 巡检进度:{{ item.location }} - - + + + + + + + {{item.planName || ''}} {{ item.createTime ? item.createTime.substring(0,11) : '' }} + + {{ getStatusLabel(item.status) }} + + + + 巡检人:{{ item.actUserName || '' }} + 计划完成时间:{{ item.planInsTime || '' }} + 实际完成时间:{{ item.location || '' }} + 巡检进度:{{ item.inspectionProgress || '' }} + + + + + 加载中... + + + 没有更多数据了 + + - @@ -33,65 +54,122 @@ export default { data() { return { - tabs: ['待进行', '处理中', '已完成'], + tabs: ['待进行', '处理中', '已完成', '已超时'], activeTab: 0, tabData: [ - [], - [], - [] - ], // 每个tab的数据 - tabLoaded: [false, false, false], // 每个tab是否已加载 - loading: false + { list: [], pageNum: 1, pageSize: 10 }, + { list: [], pageNum: 1, pageSize: 10 }, + { list: [], pageNum: 1, pageSize: 10 }, + { list: [], pageNum: 1, pageSize: 10 } + ], + pageNum: [1, 1, 1, 1], // 每个 tab 当前页码 + pageSize: 10, + noMore: [false, false, false, false], // 每个 tab 是否没有更多数据 + tabLoaded: [false, false, false, false], // tab 是否加载过 + loading: [false, false, false, false], // 每个 tab 的加载状态 + refresherTriggered: [false, false, false, false] // 每个 tab 的下拉刷新状态 } }, computed: { list() { - return this.tabData[this.activeTab]; + return this.tabData[this.activeTab].list; + }, + hasMore() { + return !this.noMore[this.activeTab]; } }, created() { - this.loadTabData(this.activeTab); // 初始化加载当前tab数据 + this.loadAllTabsData(); }, methods: { goBack() { uni.navigateBack(); }, + // 加载所有tab数据 + async loadAllTabsData() { + for (let idx = 0; idx < this.tabs.length; idx++) { + if (!this.tabLoaded[idx]) { + await this.loadTabData(idx); + } + } + }, + // 切换 tab async changeTab(idx) { this.activeTab = idx; if (!this.tabLoaded[idx]) { - await this.loadTabData(idx); + await this.onRefresh(); } }, + // 下拉刷新 + async onRefresh() { + this.refresherTriggered[this.activeTab] = true; + this.pageNum[this.activeTab] = 1; + this.noMore[this.activeTab] = false; + this.tabData[this.activeTab].list = []; + await this.loadTabData(this.activeTab); + this.refresherTriggered[this.activeTab] = false; + }, + // 滚动加载更多 + async loadMore() { + if (this.loading[this.activeTab] || this.noMore[this.activeTab]) return; + this.pageNum[this.activeTab]++; + this.loading[this.activeTab] = true; + await this.loadTabData(this.activeTab); + this.loading[this.activeTab] = false; + }, async loadTabData(idx) { - this.loading = true; - // 模拟接口请求,不同tab返回不同mock数据 - let params = {} - - - let data = []; + this.loading[idx] = true; + let params = { + pageNum: this.pageNum[idx], + pageSize: this.pageSize + }; + + // 根据tab索引设置不同的状态参数 + switch(idx) { + case 0: // 待进行 + params.status = '0'; + break; + case 1: // 处理中 + params.status = '1'; + break; + case 2: // 已完成 + params.status = '2'; + break; + case 3: // 已超时 + params.status = '3'; + break; + } let res = await this.$u.api.getInspection(params); if (res.code == '200') { - data = res.rows + let rows = res.rows || []; + if (rows.length < this.pageSize) { + this.noMore[idx] = true; + } + if (this.pageNum[idx] === 1) { + // 刷新时重置数据 + this.tabData[idx].list = rows; + } else { + // 加载更多时追加数据 + this.tabData[idx].list = [...this.tabData[idx].list, ...rows]; + } } - - this.$set(this.tabData, idx, data); this.$set(this.tabLoaded, idx, true); - this.loading = false; + this.loading[idx] = false; }, goProcess(item) { const detailItemStr = encodeURIComponent(JSON.stringify(item)); - uni.navigateTo({ - url: `/pages/sys/workbench/inspection/inspectionProcess?detailItem=${item}` + uni.navigateTo({ + url: `/pages/sys/workbench/inspection/inspectionProcess?item=${detailItemStr}` }); }, getStatusLabel(status) { const statusMap = { - 0: '待确认', - 1: '已确认', - 2: '已取消', - 3: '已完成' + 0: '待进行', + 1: '处理中', + 2: '已完成', + 3: '已超时' }; return statusMap[status] || ''; }, @@ -100,7 +178,8 @@ 0: '待确认', 1: 'orange', 2: '已取消', - 3: '已完成' + 3: 'done', + 4: 'done' }; return statusMap[status] || ''; } @@ -153,15 +232,15 @@ margin-top: 8rpx; } - .ins-list { - margin: 25rpx 0 0 0; - padding: 0 35rpx; + .ins-list-container { flex: 1; - /* 占据所有剩余空间 */ - overflow-y: auto; - /* 内容超出时,开启垂直滚动 */ - padding-bottom: 200rpx; - /* 为底部按钮留出空间 */ + overflow: hidden; + } + + .ins-list { + height: 100%; + padding: 25rpx 35rpx 0; + box-sizing: border-box; } .ins-card { @@ -180,43 +259,47 @@ margin-top: 25rpx; margin-left: 19rpx; margin-right: 50rpx; - } - - .ins-no { - font-size: 24rpx; - color: #0B0B0B; - font-weight: 500; - } - - .ins-status { - font-size: 24rpx; - font-weight: 500; - } - - .ins-line-image { - margin: left 29rpx; - margin-right: 39rpx; - height: 2rpx; - margin-bottom: 29rpx; - } - - .ins-status.orange { - color: #F3AB44; - } - - .ins-status.doing { - color: #00C9AA; - } - - .ins-status.done { - color: #8A8A8A; - } - - .ins-info { - font-size: 24rpx; - color: #888; - margin-bottom: 30rpx; - margin-left: 47rpx; + } + + .ins-no { + font-size: 24rpx; + color: #0B0B0B; + font-weight: 500; + } + + .ins-status { + font-size: 24rpx; + font-weight: 500; + } + + .ins-line-image { + margin: left 29rpx; + margin-right: 39rpx; + height: 2rpx; + margin-bottom: 29rpx; + } + + .ins-status.orange { + color: #F3AB44; + } + + .ins-status.doing { + color: #00C9AA; + } + + .ins-status.done { + color: #8A8A8A; + } + + .ins-status.overdue { + color: #FF4D4D; + } + + .ins-info { + font-size: 24rpx; + color: #888; + margin-bottom: 30rpx; + margin-left: 47rpx; } \ No newline at end of file diff --git a/pages/sys/workbench/inspection/inspectionDetail.vue b/pages/sys/workbench/inspection/inspectionDetail.vue new file mode 100644 index 0000000..8d4b356 --- /dev/null +++ b/pages/sys/workbench/inspection/inspectionDetail.vue @@ -0,0 +1,452 @@ + + + + + \ No newline at end of file diff --git a/pages/sys/workbench/inspection/inspectionOpt.vue b/pages/sys/workbench/inspection/inspectionOpt.vue new file mode 100644 index 0000000..814589b --- /dev/null +++ b/pages/sys/workbench/inspection/inspectionOpt.vue @@ -0,0 +1,573 @@ +