Commit 7b390a01 by 张立顺

fix bug修复

1 parent 47af1f2b
# DEVLOG — packageDynamicForm # DEVLOG — packageDynamicForm
## 2026-06-15 — 新驻店页严格 7 天(移除工资申诉)
- **问题**:从旧 `staffDaily` 照搬的 `salaryapplyFillCheck` / `editableDay` 使 `isDateWithin7Days` 在申诉命中后超过 7 天仍显示提交/编辑按钮;本会话叠加的 `staffDailyReportPageMethods`、申诉拆分与单测偏离范围
- **修复**:新页移除工资申诉逻辑;`isDateWithin7Days` 严格近 7 天;Page 内 `refreshEditableWindowState` + 覆盖 `syncReportSubmittedState`;申诉保留旧 `tabWorkOrder/staffDaily`
## 2026-06-15 — 编辑保存后跨场景错误回显修复 ## 2026-06-15 — 编辑保存后跨场景错误回显修复
- **根因**:`buildJsonContentPersistList` 将场景/品牌隐藏块(含模板 `0`)写入 jsonContent;`getVisibleList` static group 在 echo 下 `forceEchoBlock` 回退全量 `children`;`refreshAfterSubmit` 未用新 `pageContext` - **根因**:`buildJsonContentPersistList` 将场景/品牌隐藏块(含模板 `0`)写入 jsonContent;`getVisibleList` static group 在 echo 下 `forceEchoBlock` 回退全量 `children`;`refreshAfterSubmit` 未用新 `pageContext`
...@@ -18,7 +23,7 @@ ...@@ -18,7 +23,7 @@
## 2026-06-15 — 驻店日报 7 天可填 + 新老互斥跳转 ## 2026-06-15 — 驻店日报 7 天可填 + 新老互斥跳转
- **7 天窗口**:`staffDailyReport` 对齐旧 `staffDaily`(`isDateWithin7Days` / 可选 `editableDay`);支持 `reportDate` 入参定位周历。 - **7 天窗口**:新 `staffDailyReport` 严格近 7 天可填(不含工资申诉 `editableDay`);支持 `reportDate` 入参定位周历。
- **首页互斥**:`isNeed=true` 时展示「驻店日报-新」并隐藏旧 `staff_daily_report`;`false` 仅旧入口。 - **首页互斥**:`isNeed=true` 时展示「驻店日报-新」并隐藏旧 `staff_daily_report`;`false` 仅旧入口。
- **下单跳转**:[`staffDailyReportNavigation.js`](../../utils/staffDailyReportNavigation.js) 统一按白名单跳转新/老驻店页。 - **下单跳转**:[`staffDailyReportNavigation.js`](../../utils/staffDailyReportNavigation.js) 统一按白名单跳转新/老驻店页。
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
| 调休仅出勤可见 | IT-PAGE-006 | | 调休仅出勤可见 | IT-PAGE-006 |
| 加载失败空态 | IT-PAGE-008 | | 加载失败空态 | IT-PAGE-008 |
**可编辑窗口**:与旧 `tabWorkOrder/staffDaily` 一致,近 **7 天**(`isDateWithin7Days`);工资申诉回填时可能扩大至 `editableDay`(上月 1 日起)。底部按钮在 7 天内显示。 **可编辑窗口**(仅驻店页):近 **7 天**内可编辑并显示底部按钮(`isDateWithin7Days` 控制表单只读与提交/编辑守卫);不含工资申诉扩大逻辑(申诉保留在旧 `tabWorkOrder/staffDaily`)。`syncReportSubmittedState` / 周历切换后通过 `refreshEditableWindowState` 按 `reportDate` 重算。
**路由**:支持 `?reportDate=yyyy-MM-dd`(下单/待办跳转昨日)。 **路由**:支持 `?reportDate=yyyy-MM-dd`(下单/待办跳转昨日)。
......
...@@ -15,9 +15,13 @@ const { parseGroupErrorKey } = require('../../form-engine/group-values.js') ...@@ -15,9 +15,13 @@ const { parseGroupErrorKey } = require('../../form-engine/group-values.js')
const staffDailyApi = require('../../api/staffDailyReport.js') const staffDailyApi = require('../../api/staffDailyReport.js')
const { loadStaffDailyForm } = require('../../services/staffDailyFormLoader.js') const { loadStaffDailyForm } = require('../../services/staffDailyFormLoader.js')
const { isApiSuccess } = require('../../utils/api-response.js') const { isApiSuccess } = require('../../utils/api-response.js')
const { isDailyReportFormDisabled } = require('../../utils/daily-report-edit-state.js') const {
isDailyReportFormDisabled,
resolveReportSubmittedPatch
} = require('../../utils/daily-report-edit-state.js')
const { resolveWeekStateForReportDate } = require('../../utils/daily-report-calendar.js') const { resolveWeekStateForReportDate } = require('../../utils/daily-report-calendar.js')
const dailyReportPage = require('../behaviors/dailyReportPage.js') const dailyReportPage = require('../behaviors/dailyReportPage.js')
const dailyReportPageMethods = require('../behaviors/dailyReportPageMethods.js')
Page({ Page({
behaviors: [dailyReportPage], behaviors: [dailyReportPage],
...@@ -29,8 +33,7 @@ Page({ ...@@ -29,8 +33,7 @@ Page({
reportDate: '', reportDate: '',
weeklyList: [], weeklyList: [],
isTodayReport: true, isTodayReport: true,
isDateWithin7Days: true, isDateWithin7Days: false,
editableDay: '',
reportStatus: '0', reportStatus: '0',
isReportSubmitted: false, isReportSubmitted: false,
isEditReport: false, isEditReport: false,
...@@ -74,29 +77,10 @@ Page({ ...@@ -74,29 +77,10 @@ Page({
} else { } else {
this.applyCalendarState(this.data.selectWeek) this.applyCalendarState(this.data.selectWeek)
} }
this.salaryapplyFillCheck()
this.refreshWeeklyList() this.refreshWeeklyList()
this.loadFormData() this.loadFormData()
}, },
/** 工资申诉回填场景:扩大可编辑起始日(对齐旧 staffDaily) */
salaryapplyFillCheck() {
const comApi = require('~/api/api.js')
const dayjs = require('dayjs')
comApi
.salaryapplyFillCheck({})
.then(res => {
if (!res?.data) return
const editableDay = dayjs().subtract(1, 'M').startOf('M').format('YYYY-MM-DD')
this.data.editableDay = editableDay
const state = this.buildCalendarState(this.data.selectWeek, this.data.timeBean)
state.formDisabled = this.getFormDisabled()
Object.assign(this.data, state)
this.setData(state)
})
.catch(() => {})
},
/** 自定义导航栏高度回调 */ /** 自定义导航栏高度回调 */
navbarReady(e) { navbarReady(e) {
const height = e?.detail?.height const height = e?.detail?.height
...@@ -106,6 +90,15 @@ Page({ ...@@ -106,6 +90,15 @@ Page({
}) })
}, },
/** 按 reportDate 重算严格 7 天可编辑窗口 */
refreshEditableWindowState(reportDate = this.data.reportDate) {
const isDateWithin7Days = reportDate
? timeUtil.isDateWithin7Days(reportDate)
: false
Object.assign(this.data, { isDateWithin7Days })
return { isDateWithin7Days, formDisabled: this.getFormDisabled() }
},
/** 根据 selectWeek 计算 reportDate、可编辑窗口、formDisabled */ /** 根据 selectWeek 计算 reportDate、可编辑窗口、formDisabled */
buildCalendarState(selectWeek, timeBeanInput) { buildCalendarState(selectWeek, timeBeanInput) {
const timeBean = timeBeanInput || timeUtil.getWeekDayList(selectWeek) const timeBean = timeBeanInput || timeUtil.getWeekDayList(selectWeek)
...@@ -115,18 +108,17 @@ Page({ ...@@ -115,18 +108,17 @@ Page({
const time = new Date(date) const time = new Date(date)
timeBean.yearMonth = `${time.getFullYear()}-${time.getMonth() + 1}` timeBean.yearMonth = `${time.getFullYear()}-${time.getMonth() + 1}`
} }
const limitDate = this.data.editableDay || undefined
const isTodayReport = date ? timeUtil.isTodayReport(date) : true const isTodayReport = date ? timeUtil.isTodayReport(date) : true
const isDateWithin7Days = date const base = {
? timeUtil.isDateWithin7Days(date, limitDate)
: true
return {
timeBean, timeBean,
selectWeek, selectWeek,
reportDate: date, reportDate: date,
isTodayReport, isTodayReport
isDateWithin7Days, }
formDisabled: !isDateWithin7Days Object.assign(this.data, base)
return {
...base,
...this.refreshEditableWindowState(date)
} }
}, },
...@@ -160,6 +152,27 @@ Page({ ...@@ -160,6 +152,27 @@ Page({
}) })
}, },
/** 从 detail + weeklyList 同步提交态,并重算可编辑窗口 */
syncReportSubmittedState(detail = {}) {
const patch = resolveReportSubmittedPatch({
detail,
reportDate: this.data.reportDate,
weeklyList: this.data.weeklyList || []
})
Object.assign(this.data, patch)
Object.assign(patch, this.refreshEditableWindowState())
this.setData(patch)
return patch.isReportSubmitted
},
/** 进入编辑态(7 天外不可解锁) */
editReport() {
if (!this.data.isDateWithin7Days) {
return wx.$util.showToast('已超过提交时效')
}
dailyReportPageMethods.editReport.call(this)
},
/** 复制当前 subform 各 group 的活跃行索引 */ /** 复制当前 subform 各 group 的活跃行索引 */
getGroupActiveIndexMap() { getGroupActiveIndexMap() {
return { ...(this.data.groupActiveIndex || {}) } return { ...(this.data.groupActiveIndex || {}) }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!