2026.1.20
新增自巡查承诺相关功能(待完成)
| | |
| | | "pages/mSelfPatrol/patrolhome/index", |
| | | "pages/mUser/sceneauthentication/industrial/index", |
| | | "pages/mExtra/pSupervisionSummary/index", |
| | | "pages/mLedger/home/index" |
| | | "pages/mLedger/home/index", |
| | | "pages/mSelfPatrol/patrolpromise/index" |
| | | ], |
| | | "window": { |
| | | "backgroundTextStyle": "light", |
| | |
| | | if (app.globalData.userSetting.selfPatrolPromise == undefined) { |
| | | app.globalData.userSetting.selfPatrolPromise = false |
| | | } |
| | | // èªå·¡æ¥æ¿è¯ºä¹¦ææ¬æ¢è¡ç¬¦æ ¼å¼å |
| | | if (app.globalData.userSetting.spPromiseContent != undefined) { |
| | | app.globalData.userSetting.spPromiseContent = app.globalData.userSetting.spPromiseContent.replaceAll('\\n', '\n') |
| | | } |
| | | wx.setStorage({ |
| | | key: 'user_setting', |
| | | data: res.data, |
| | |
| | | const moment = require('../utils/moment.min'); |
| | | const app = getApp(); |
| | | const DEADLINEDAY = app.globalData.userSetting.ledgerDeadline; |
| | | |
| | | function name(params) { |
| | | const DEADLINEDAY = app.globalData.userSetting.ledgerDeadline; |
| | | let monthInfo = { |
| | | totalMust: 0, |
| | | finishedMust: 0, |
| | |
| | | * @param {Boolean} isSelfPatrol æ¯å¦ç»è®¡èªå·¡æ¥ç±»å |
| | | */ |
| | | function _parse(subtypes, isSelfPatrol) { |
| | | const DEADLINEDAY = 10; |
| | | // æåº¦ç»è®¡ |
| | | let monthInfo = { |
| | | // å
¨é¨å¿
å¡«æ° |
| | |
| | | <view class="head_row"> |
| | | <view class="head_tag">æ¬æå°è´¦æäº¤æ¥ï¼{{deadline}}</view> |
| | | <block wx:if="{{thisMonthInfo.percent < 1}}"> |
| | | <view wx:if="{{leftday > 0}}" class="head_tag" |
| | | >å©ä½<text>{{leftday}}</text>天</view |
| | | <view wx:if="{{leftday >= 0}}" class="head_tag" |
| | | >å©ä½<text>{{leftday + 1}}</text>天</view |
| | | > |
| | | <view wx:else class="head_tag" |
| | | >龿 <text>{{thisMonthInfo.overtime}}</text>天</view |
| | |
| | | @import '../ledgerhome/ledgerhome.wxss';.banner-bg { |
| | | .banner-bg { |
| | | position: fixed; |
| | | width: 100%; |
| | | height: 60%; |
| | |
| | | import { parseSelfPatrol, refreshLedgerStatus } from '../../../../model/ledger'; |
| | | import { |
| | | parseSelfPatrol, |
| | | refreshLedgerStatus |
| | | } from '../../../../model/ledger'; |
| | | import configservice from '../../../../service/configservice'; |
| | | const ledgerservice = require('../../../../service/ledgerservice'); |
| | | const moment = require('../../../../utils/moment.min'); |
| | |
| | | data: { |
| | | refresh: false, |
| | | thisMonth: '', |
| | | tags1: { count: 0 }, |
| | | tags1: { |
| | | count: 0 |
| | | }, |
| | | pageList1: [], |
| | | // æ¯å¦ææéå¯ä»¥è¿è¡èªå·¡æ¥æ¿è¯º |
| | | promiseValid: app.globalData.userSetting.selfPatrolPromise, |
| | | promised: false |
| | | // æ¯å¦å·²æ¿è¯º |
| | | promised: false, |
| | | }, |
| | | |
| | | lifetimes: { |
| | |
| | | const now = moment(); |
| | | const nowStr = now.format('YYYY-MM-DD'); |
| | | const thisMonth = now.format('YYYYå¹´MMæ'); |
| | | this.setData({ thisMonth }); |
| | | this.setData({ |
| | | thisMonth |
| | | }); |
| | | this.getLedgerType(nowStr, r => { |
| | | this.setData({ |
| | | tags1: { |
| | |
| | | refresh: false, |
| | | }); |
| | | }); |
| | | this.getPromise() |
| | | }, |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·æ¯å¦å®æèªå·¡æ¥æ¿è¯º |
| | | */ |
| | | getPromise() { |
| | | configservice.fetchUserSettingRecord(app.globalData.accessToken.userId, { |
| | | success: res => { |
| | | |
| | | }, |
| | | }) |
| | | if (this.data.promiseValid) { |
| | | configservice.fetchUserSettingRecord(app.globalData.accessToken.userId, { |
| | | success: res => { |
| | | const nowYear = moment().year() |
| | | const promiseYear = moment(res.data?.lastPromisedTime).year() |
| | | this.setData({ |
| | | promised: (res.data?.selfPatrolPromised == true) && (nowYear == promiseYear) |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | getLedgerType(time, success, lastMonth) { |
| | |
| | | ledgerservice.getLedgerSummary( |
| | | app.globalData.accessToken.userId, |
| | | app.globalData.userInfo.extension2, |
| | | time, |
| | | { |
| | | time, { |
| | | success(res) { |
| | | let r = parseSelfPatrol(res); |
| | | success(r); |
| | |
| | | }, |
| | | |
| | | gotoLedgerDetail(e) { |
| | | const { index } = e.currentTarget.dataset; |
| | | const { |
| | | index |
| | | } = e.currentTarget.dataset; |
| | | const indexGroup = index; |
| | | var ledger = this.data.pageList1[index]; |
| | | var that = this; |
| | |
| | | }, |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 跳转è³èªå·¡æ¥æ¿è¯ºçé¢ |
| | | */ |
| | | gotoPromise() { |
| | | wx.navigateTo({ |
| | | url: '/pages/mSelfPatrol/patrolpromise/index', |
| | | events: { |
| | | doPromiseDone: (data)=> { |
| | | this.setData({ |
| | | promised: data.promised |
| | | }) |
| | | }, |
| | | }, |
| | | success: (res)=> { |
| | | // éè¿ eventChannel å被æå¼é¡µé¢ä¼ éæ°æ® |
| | | // res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | |
| | | // }); |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
| | | }); |
| | |
| | | <view class="self-patrol-promise" bindtap="gotoPromise"> |
| | | <t-icon name="notification-error" size="32rpx"/> |
| | | <view |
| | | wx:if="{{promiseValid && !promised}}" |
| | | class="self-patrol-promise" |
| | | bindtap="gotoPromise" |
| | | > |
| | | <t-icon name="notification-error" size="32rpx" /> |
| | | <text class="promise-text"></text> |
| | | <text class="promise_btn">廿¿è¯º ></text> |
| | | </view> |
| | | <view |
| | | wx:else |
| | | class="self-patrol-promise-done" |
| | | > |
| | | <t-icon name="check" size="32rpx" /> |
| | | <text class="promise-done-text">èªå·¡æ¥æ¿è¯ºå·²ç¾ç½²</text> |
| | | </view> |
| | | <view class="self-patrol-static"> |
| | | <view class="head_right"> |
| | | <view style="font-size: 14px"> {{thisMonth}} </view> |
| | |
| | | .self-patrol-promise { |
| | | color: var(--fyui-text-color_1); |
| | | color: white; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | font-size: 12px; |
| | | padding: 8rpx 8rpx; |
| | | background-color: var(--fyui-primary-color-2); |
| | | background-color: #c44e00; |
| | | } |
| | | .promise_btn { |
| | | font-weight: 600; |
| | |
| | | } |
| | | } |
| | | |
| | | .self-patrol-promise-done { |
| | | color: white; |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | align-items: center; |
| | | font-size: 12px; |
| | | padding: 8rpx 8rpx; |
| | | background-color: #51be82; |
| | | } |
| | | .promise-done-text { |
| | | /* white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; */ |
| | | position: relative; |
| | | display: -webkit-box; |
| | | -webkit-line-clamp: 1; |
| | | -webkit-box-orient: vertical; |
| | | overflow-x: hidden; |
| | | text-overflow: ellipsis; |
| | | width: 100%; |
| | | height: 20px; |
| | | line-height: 20px; |
| | | } |
| | | |
| | | .self-patrol-static { |
| | | margin: 16rpx 32rpx; |
| | | padding: 4rpx; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import selfpatrolservice from "../../../service/selfpatrolservice"; |
| | | import moment from "../../../utils/moment.min"; |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | | * 页é¢çåå§æ°æ® |
| | | */ |
| | | data: { |
| | | date: '2026å¹´01æ20æ¥', |
| | | promiseText: app.globalData.userSetting.spPromiseContent, |
| | | showDialog: false, |
| | | promiseContent: 'å°æ¬çç¨æ·ï¼\nç¾ç½²æ¬æ¿è¯ºä¹¦åï¼æ¨æ¬å¹´åº¦å
å·²ä¸ä¼ çææèªå·¡æ¥è®°å½å°æ 鿝æéå¤ä¸ä¼ ï¼ç³»ç»å°è§å
¶ä¸ºé¿æææãæ¨ä»å¯éæ¶ä¸ä¼ æ°çå·¡æ¥è®°å½ã\n请确ä¿å¡«åä¿¡æ¯åç¡®ï¼æ¿è¯ºå
容çå®ãèåæ¿è¯ºå¯è½å¯¼è´æå¡ç»æ¢å¹¶æ¿æ
ç¸åºè´£ä»»ã', |
| | | agree: false, |
| | | confirmBtn: { |
| | | content: '确认', |
| | | variant: 'base' |
| | | }, |
| | | }, |
| | | |
| | | /** |
| | | * çå½å¨æå½æ°--çå¬é¡µé¢å è½½ |
| | | */ |
| | | onLoad(options) { |
| | | var now = moment(); |
| | | this.setData({ |
| | | date: now.format('YYYYå¹´MMæDDæ¥'), |
| | | }); |
| | | }, |
| | | |
| | | checkboxChange(e) { |
| | | var a = !this.data.agree; |
| | | this.setData({ |
| | | agree: a, |
| | | }); |
| | | }, |
| | | |
| | | waitAgree() { |
| | | if (this.data.agree) { |
| | | return true; |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请å¾éåææ¡æ¬¾', |
| | | icon: 'none', |
| | | }); |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | showCheckDialog() { |
| | | if (this.waitAgree()) { |
| | | this.setData({ |
| | | showDialog: true |
| | | }) |
| | | } |
| | | }, |
| | | closeCheckDialog() { |
| | | this.setData({ |
| | | showDialog: false |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * ç¾ç½²èªå·¡æ¥æ¿è¯ºä¹¦ |
| | | */ |
| | | doPromise() { |
| | | selfpatrolservice.signPromise(app.globalData.accessToken.userId, { |
| | | success: res => { |
| | | // app.globalData.userSetting = res.data |
| | | this.getOpenerEventChannel().emit('doPromiseDone', { |
| | | promised: res.data.selfPatrolPromised, |
| | | promiseTime: res.data.lastPromisedTime, |
| | | }); |
| | | wx.navigateBack({ |
| | | delta: 1, |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | }) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "navigationBarTitleText": "èªå·¡æ¥æ¿è¯º", |
| | | "navigationBarBackgroundColor": "#57E4CB", |
| | | "navigationBarTextStyle": "white", |
| | | "usingComponents": {} |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="page"> |
| | | <view class="banner-bg"></view> |
| | | <view class="page__bd"> |
| | | <view class="fyui-panel"> |
| | | <view class="p-title">ç¯ä¿èªå·¡æ¥æ¿è¯ºä¹¦</view> |
| | | <text class="p-content"> {{promiseText}} </text> |
| | | <text style="text-align: end">\nç¾ç½²æ¶é´ï¼{{date}}</text> |
| | | <text style="font-weight: 600" |
| | | >\n*请ä»ç»é
è¯»ä»¥ä¸æ¿è¯ºæ¡æ¬¾ï¼ç¡®è®¤æ 误å请å¨ä¸æ¹ç¾ç½²</text |
| | | > |
| | | </view> |
| | | </view> |
| | | <view class="page__ft"> |
| | | <view class="weui-agree"> |
| | | <label bindtap="checkboxChange"> |
| | | <checkbox |
| | | class="weui-agree__checkbox-check" |
| | | value="{{agree}}" |
| | | checked="{{agree}}" |
| | | /> |
| | | <span class="weui-agree__checkbox"></span> |
| | | <span class="weui-agree__text" |
| | | >æå·²é
读ãç解并åæä»¥ä¸ãç¯ä¿èªå·¡æ¥æ¿è¯ºä¹¦ãçå
¨é¨å
容ã</span |
| | | > |
| | | </label> |
| | | </view> |
| | | <view class="submit" bindtap="showCheckDialog">ç¾ç½²</view> |
| | | </view> |
| | | </view> |
| | | <t-dialog |
| | | visible="{{showDialog}}" |
| | | prevent-scroll-through |
| | | confirm-btn="{{confirmBtn}}" |
| | | cancel-btn="åæ¶" |
| | | bind:confirm="doPromise" |
| | | bind:cancel="closeCheckDialog" |
| | | > |
| | | <scroll-view slot="content" scroll-y class="long-content"> |
| | | <text class="content-container" user-select="{{true}}" |
| | | >{{promiseContent}} |
| | | </text> |
| | | </scroll-view> |
| | | </t-dialog> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | .page__bd { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .banner-bg { |
| | | position: fixed; |
| | | width: 100%; |
| | | height: 5vh; |
| | | background-color: #57E4CB; |
| | | } |
| | | |
| | | .fyui-panel { |
| | | padding: 8px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .p-title { |
| | | text-align: center; |
| | | padding-top: 16px; |
| | | font-size: 20px; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .p-content { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .p-sign { |
| | | font-size: 12px; |
| | | color: var(--fyui-text-color_2); |
| | | } |
| | | |
| | | .submit { |
| | | border-radius: 4px; |
| | | background: linear-gradient(to right, #6DF1A9, #62EBCF); |
| | | margin: 8px; |
| | | color: white; |
| | | padding: 8px; |
| | | } |
| | | |
| | | .sign-btn { |
| | | width: 96px; |
| | | height: 96px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .sign-img { |
| | | float: left; |
| | | margin-right: 8px; |
| | | margin-bottom: 8px; |
| | | width: 96px; |
| | | height: 96px; |
| | | background: no-repeat 50%; |
| | | background-size: cover |
| | | } |
| | | |
| | | .top-right { |
| | | margin-top: 6px; |
| | | margin-right: 6px; |
| | | } |
| | | |
| | | .weui-agree { |
| | | /* font-size: 12px; */ |
| | | text-align: left; |
| | | } |
| | | |
| | | .weui-agree__text { |
| | | color: var(--fyui-primary-color-1); |
| | | font-weight: 600; |
| | | } |
| | |
| | | fun.url = bUrl + url; |
| | | } |
| | | var fun1 = util.deepCopy(fun); |
| | | if (mode == 'debug') { |
| | | console.log( |
| | | '|------------------------------------------------------------------------------------------------------------', |
| | | ); |
| | | console.log('|--访é®: ', fun.url); |
| | | console.log('|--åæ°: ', fun.data); |
| | | } |
| | | fun1.success = function (res) { |
| | | if (mode == 'debug') { |
| | | console.log( |
| | | '|------------------------------------------------------------------------------------------------------------', |
| | | ); |
| | | console.log('|--访é®: ', fun.url); |
| | | console.log('|--åæ°: ', fun.data); |
| | | console.log('|--ç»æ: ', res); |
| | | } |
| | | |
| | |
| | | }; |
| | | fun1.fail = function (error) { |
| | | if (mode == 'debug') { |
| | | console.log( |
| | | '|------------------------------------------------------------------------------------------------------------', |
| | | ); |
| | | console.log('|--访é®: ', fun.url); |
| | | console.log('|--åæ°: ', fun.data); |
| | | console.log('|--é误: ', error); |
| | | } |
| | | wx.showToast({ |
| | |
| | | |
| | | //ä¸ä¼ èªå·¡æ¥ |
| | | uploadSelfPatrol: function (userId, taskId, selfPatrol, paths, fun) { |
| | | const fields = [ |
| | | { |
| | | const fields = [{ |
| | | name: 'params', |
| | | value: JSON.stringify([selfPatrol]), |
| | | }, |
| | |
| | | |
| | | $f.get(fun1); |
| | | }, |
| | | }; |
| | | |
| | | // ç¾ç½²èªå·¡æ¥æ¿è¯º |
| | | signPromise: function ( |
| | | userId, |
| | | fun, |
| | | ) { |
| | | let cb = { |
| | | url: '/selfPatrol/promise', |
| | | params: { |
| | | userId: userId, |
| | | }, |
| | | }; |
| | | Object.assign(cb, fun); |
| | | |
| | | $f.post(cb); |
| | | }, |
| | | }; |