Commit 0e1cbeda by chenwq

feat: 完善考勤详情页并优化申诉表单显示

- 新增考勤汇总与明细 API 接口
- 考勤详情页改为调用真实接口,支持查看每日打卡记录
- 申诉详情页格式化创建时间并调整文案显示
- 有效引荐编辑页根据 updateFlag 控制编辑状态
- 修复组件中未知业务显示为空白的问题
1 parent 5318f190
...@@ -441,6 +441,20 @@ module.exports = { ...@@ -441,6 +441,20 @@ module.exports = {
'/rop-dj-staff-miniprogram/router') '/rop-dj-staff-miniprogram/router')
}, },
/** 考勤明细汇总 */
getStaffAttendSummary(data) {
return api.post('dj.staff.api.attendance.summary', data,
[],
'/rop-dj-staff-miniprogram/router')
},
/** 考勤明细 */
getStaffDailyDetail(data) {
return api.post('dj.staff.api.attendance.daily.detail', data,
[],
'/rop-dj-staff-miniprogram/router')
},
/** 员工工资申诉记录分页查询 */ /** 员工工资申诉记录分页查询 */
getSalaryApplyList(data) { getSalaryApplyList(data) {
return api.post('dj.api.staff.miniprogram.salaryapply.page', data, return api.post('dj.api.staff.miniprogram.salaryapply.page', data,
......
...@@ -21,18 +21,21 @@ Page({ ...@@ -21,18 +21,21 @@ Page({
this.getDetailInfo() this.getDetailInfo()
}, },
dealInfo(data) {
data.createdDateTxt = new Date(data.createdDate).format("yyyy-MM-dd hh:mm:ss")
return data || {}
},
getDetailInfo() { getDetailInfo() {
const {routerParams } = this.data const {routerParams } = this.data
console.log(routerParams, '----')
const params = { const params = {
id: routerParams.id id: routerParams.id
} }
api.getSalaryApplyDetail(params).then(res => { api.getSalaryApplyDetail(params).then(res => {
let { code, data, message } = res; let { code, data, message } = res;
console.log(data)
if (code == 0) { if (code == 0) {
this.setData({ this.setData({
info: data, info: this.dealInfo(data),
appealTypeStr: this.getAppealTypeStr(data.appealType) appealTypeStr: this.getAppealTypeStr(data.appealType)
}) })
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<!-- Header Card --> <!-- Header Card -->
<view class="card header-card"> <view class="card header-card">
<view class="row-between"> <view class="row-between">
<view class="name">{{info.staffName}} <text class="time">{{info.createdDate}}提交申请</text></view> <view class="name">{{info.staffName}} <text class="time">{{info.createdDateTxt}}提交申请</text></view>
<!-- <view class="status">{{info.dealStatus === 1 ? '已通过' : (info.dealStatus === 2 ? '已驳回' : '待审核')}}</view> --> <!-- <view class="status">{{info.dealStatus === 1 ? '已通过' : (info.dealStatus === 2 ? '已驳回' : '待审核')}}</view> -->
</view> </view>
<view class="row mt-20"> <view class="row mt-20">
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<text class="value ml-20 bold">{{appealTypeStr}}</text> <text class="value ml-20 bold">{{appealTypeStr}}</text>
</view> </view>
<block wx:if="{{info.appealType == 1 || info.appealType == 3}}"> <block wx:if="{{info.appealType == 1}}">
<view class="row mt-20"> <view class="row mt-20">
<text class="label">本月实际出勤天数</text> <text class="label">本月实际出勤天数</text>
<text class="value ml-20">{{info.actualAttendanceDays || ''}}天</text> <text class="value ml-20">{{info.actualAttendanceDays || ''}}天</text>
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
</block> </block>
<!-- Pad Info --> <!-- Pad Info -->
<block wx:if="{{info.appealType == 2 || info.appealType == 3}}"> <block wx:if="{{info.appealType == 2}}">
<view class="row mt-20"> <view class="row mt-20">
<text class="label">平板录音数</text> <text class="label">平板录音完成总数</text>
<text class="value ml-20">{{info.padRecordNum || ''}}条</text> <text class="value ml-20">{{info.padRecordNum || ''}}条</text>
</view> </view>
<view class="row mt-20"> <view class="row mt-20">
<text class="label">申诉修改平板录音数</text> <text class="label">申诉修改录音完成总数</text>
<text class="value ml-20">{{info.applyPadRecordNum || ''}}条</text> <text class="value ml-20">{{info.applyPadRecordNum || ''}}条</text>
</view> </view>
</block> </block>
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
data-urls="{{info.attachmentList}}" data-urls="{{info.attachmentList}}"
></image> ></image>
</block> </block>
<view wx-if="{{!info.attachmentList.length}}">-</view>
</view> </view>
<view class="row mt-30 align-start"> <view class="row mt-30 align-start">
...@@ -69,7 +70,7 @@ ...@@ -69,7 +70,7 @@
<view class="card reply-card" wx-if="{{info.dealStatus == 2}}"> <view class="card reply-card" wx-if="{{info.dealStatus == 2}}">
<view class="card-title">总部回复</view> <view class="card-title">总部回复</view>
<!-- Attendance Reply --> <!-- Attendance Reply -->
<block wx:if="{{info.appealType == 1 || info.appealType == 3}}"> <block wx:if="{{info.appealType == 1}}">
<view class="row mt-30"> <view class="row mt-30">
<text class="label">确认实际出勤天数</text> <text class="label">确认实际出勤天数</text>
<text class="value ml-20">{{info.confirmActualAttendanceDays || ''}}天</text> <text class="value ml-20">{{info.confirmActualAttendanceDays || ''}}天</text>
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
</block> </block>
<!-- Pad Reply --> <!-- Pad Reply -->
<block wx:if="{{info.appealType == 2 || info.appealType == 3}}"> <block wx:if="{{info.appealType == 2}}">
<view class="row mt-30"> <view class="row mt-30">
<text class="label">确认平板录音数</text> <text class="label">确认平板录音数</text>
<text class="value ml-20">{{info.confirmPadRecordNum || ''}}条</text> <text class="value ml-20">{{info.confirmPadRecordNum || ''}}条</text>
......
// packageWorkspace/pages/attendanceStatis/attendanceDetail/attendanceDetail.js // packageWorkspace/pages/attendanceStatis/attendanceDetail/attendanceDetail.js
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/' const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
import api from "../../../api";
// Store daily info at module level to be accessible by formatter // Store daily info at module level to be accessible by formatter
let dailyInfos = []; let dailyInfos = [];
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMG_URL, IMG_URL,
detail: { routerParams: {},
mobilePhone: "", summaryInfo: {},
name: "", detail: {},
positionName: "延保驻店销售",
attendanceMonth: "",
totalWorkHours: 0.0,
lateEarlyHours: 0.0,
missingPunchCount: 0,
attendanceDailyInfoDTOs: []
},
formattedMonth: "", formattedMonth: "",
minDate: new Date().getTime(), minDate: new Date().getTime(),
maxDate: new Date().getTime(), maxDate: new Date().getTime(),
selectedDate: '', // YYYY-MM-DD selectedDate: "", // YYYY-MM-DD
currentDayInfo: null, // { workTime, offWorkTime } currentDayInfo: null, // { workTime, offWorkTime }
formatter(day) { formatter(day) {
const date = new Date(day.date); const date = new Date(day.date);
const year = date.getFullYear(); const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0'); const month = (date.getMonth() + 1).toString().padStart(2, "0");
const d = date.getDate().toString().padStart(2, '0'); const d = date.getDate().toString().padStart(2, "0");
const dateStr = `${year}-${month}-${d}`; const dateStr = `${year}-${month}-${d}`;
// Find info for this date // Find info for this date
const info = dailyInfos.find(item => item.date === dateStr); const info = dailyInfos.find((item) => item.date === dateStr);
// Workday style (Has record): workTime OR offWorkTime is present
// Weekend style (No record): Both are missing/empty
const hasRecord = info && (info.workTime || info.offWorkTime); const hasRecord = info && (info.workTime || info.offWorkTime);
if (!hasRecord) { if (!hasRecord) {
day.className = 'weekend-day'; day.className = "weekend-day";
} }
return day; return day;
} },
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// 模拟从上一页传递或接口获取数据 this.setData({
// 实际场景可能需要根据 options.id 去请求详情接口 routerParams: JSON.parse(options.info),
// 这里直接使用 Mock 数据展示 UI });
this.getSummary();
this.getDetail(); this.getDetail();
}, },
getSummary() {
const { mobilePhone, attendanceMonth } = this.data.routerParams;
const params = {
mobilePhone,
attendanceMonth,
};
api.getStaffAttendSummary(params).then((res) => {
console.log(res);
let { code, data, message } = res;
if (code == "0") {
this.setData({
summaryInfo: data,
});
}
});
},
getDetail() { getDetail() {
// 模拟接口返回数据 const { mobilePhone, attendanceMonth } = this.data.routerParams;
const mockData = { const params = {
mobilePhone: "13800138000", mobilePhone,
name: "董天天", attendanceMonth,
positionName: "延保驻店销售",
attendanceMonth: "2026-01",
totalWorkHours: 7.2,
lateEarlyHours: 0,
missingPunchCount: 0,
attendanceDailyInfoDTOs: [
{ date: "2026-01-01", workTime: "09:00", offWorkTime: "18:00" },
{ date: "2026-01-03", workTime: "08:55", offWorkTime: "18:05" },
{ date: "2026-01-05", workTime: "", offWorkTime: "18:00" }, // 缺卡示例
{ date: "2026-01-06", workTime: "09:00", offWorkTime: "" }, // 缺卡示例
{ date: "2026-01-07", workTime: "", offWorkTime: "" } // 缺卡示例
]
}; };
api.getStaffDailyDetail(params).then((res) => {
console.log(res);
let { code, data, message } = res;
if (code == "0") {
// Update module-level variable
data.attendanceDailyInfoDTOs.forEach((item) => {
// 截取不要秒,格式 HH:MM
item.offWorkTime = item.offWorkTime
? item.offWorkTime.slice(0, 5)
: "";
item.workTime = item.workTime ? item.workTime.slice(0, 5) : "";
});
dailyInfos = data.attendanceDailyInfoDTOs || [];
// Update module-level variable // Calculate min and max date based on attendanceMonth
dailyInfos = mockData.attendanceDailyInfoDTOs || []; let minDate = new Date().getTime();
let maxDate = new Date().getTime();
// Calculate min and max date based on attendanceMonth let defaultDate = new Date().getTime();
let minDate = new Date().getTime();
let maxDate = new Date().getTime();
let defaultDate = new Date().getTime();
if (mockData.attendanceMonth) {
const parts = mockData.attendanceMonth.split('-');
if (parts.length === 2) {
const year = parseInt(parts[0]);
const month = parseInt(parts[1]);
// minDate: 1st day of the month
minDate = new Date(year, month - 1, 1).getTime();
// maxDate: Last day of the month
maxDate = new Date(year, month, 0).getTime();
// Default to the 5th for demo purposes as per screenshot, or minDate
defaultDate = new Date(year, month - 1, 5).getTime();
// Ensure defaultDate is within range
if (defaultDate < minDate) defaultDate = minDate;
if (defaultDate > maxDate) defaultDate = maxDate;
}
}
this.setData({ if (data.attendanceMonth) {
detail: mockData, const parts = data.attendanceMonth.split("-");
formattedMonth: this.formatMonth(mockData.attendanceMonth), if (parts.length === 2) {
minDate, const year = parseInt(parts[0]);
maxDate, const month = parseInt(parts[1]);
defaultDate // minDate: 1st day of the month
}); minDate = new Date(year, month - 1, 1).getTime();
// maxDate: Last day of the month
maxDate = new Date(year, month, 0).getTime();
// Default to the 5th for demo purposes as per screenshot, or minDate
defaultDate = minDate;
// Ensure defaultDate is within range
if (defaultDate < minDate) defaultDate = minDate;
if (defaultDate > maxDate) defaultDate = maxDate;
}
}
this.setData({
detail: data,
formattedMonth: this.formatMonth(data.attendanceMonth),
minDate,
maxDate,
defaultDate,
});
// Initialize selection (simulate selecting the default date) // Initialize selection (simulate selecting the default date)
const dateObj = new Date(defaultDate); const dateObj = new Date(defaultDate);
this.handleDateSelect(dateObj); this.handleDateSelect(dateObj);
}
});
}, },
formatMonth(monthStr) { formatMonth(monthStr) {
if (!monthStr) return ""; if (!monthStr) return "";
// 假设 monthStr 格式为 "YYYY-MM" // 假设 monthStr 格式为 "YYYY-MM"
const parts = monthStr.split('-'); const parts = monthStr.split("-");
if (parts.length === 2) { if (parts.length === 2) {
return `${parts[0]}年${parseInt(parts[1])}月`; // parseInt 去掉月份前导0 return `${parts[0]}年${parseInt(parts[1])}月`; // parseInt 去掉月份前导0
} }
...@@ -132,16 +141,18 @@ Page({ ...@@ -132,16 +141,18 @@ Page({
handleDateSelect(date) { handleDateSelect(date) {
const year = date.getFullYear(); const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0'); const month = (date.getMonth() + 1).toString().padStart(2, "0");
const day = date.getDate().toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, "0");
const dateStr = `${year}-${month}-${day}`; const dateStr = `${year}-${month}-${day}`;
// Find info for this date // Find info for this date
const dayInfo = this.data.detail.attendanceDailyInfoDTOs.find(item => item.date === dateStr); const dayInfo = this.data.detail.attendanceDailyInfoDTOs.find(
(item) => item.date === dateStr,
);
this.setData({ this.setData({
selectedDate: dateStr, selectedDate: dateStr,
currentDayInfo: dayInfo || null currentDayInfo: dayInfo || null,
}); });
} },
}) });
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<view class="card user-card"> <view class="card user-card">
<image class="avatar" src="{{IMG_URL}}default-avatar.png" /> <image class="avatar" src="{{IMG_URL}}default-avatar.png" />
<view class="user-info"> <view class="user-info">
<view class="name ellipsis">{{detail.name}}</view> <view class="name ellipsis">{{summaryInfo.name}}</view>
<view class="position ellipsis">{{detail.positionName}}</view> <view class="position ellipsis">{{summaryInfo.positionName}}</view>
</view> </view>
</view> </view>
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
<view class="summary-title">{{formattedMonth}}汇总</view> <view class="summary-title">{{formattedMonth}}汇总</view>
<view class="summary-grid"> <view class="summary-grid">
<view class="grid-item"> <view class="grid-item">
<view class="value">{{detail.totalWorkHours}}</view> <view class="value">{{summaryInfo.totalWorkHours}}</view>
<view class="label">出勤工时 (H)</view> <view class="label">出勤工时 (H)</view>
</view> </view>
<view class="grid-item"> <view class="grid-item">
<view class="value">{{detail.lateEarlyHours}}</view> <view class="value">{{summaryInfo.lateEarlyHours}}</view>
<view class="label">迟到早退 (H)</view> <view class="label">迟到早退 (H)</view>
</view> </view>
<view class="grid-item"> <view class="grid-item">
<view class="value">{{detail.missingPunchCount}}</view> <view class="value">{{summaryInfo.missingPunchCount}}</view>
<view class="label">缺卡 (次数)</view> <view class="label">缺卡 (次数)</view>
</view> </view>
</view> </view>
......
...@@ -121,8 +121,8 @@ Page({ ...@@ -121,8 +121,8 @@ Page({
let { target } = e.currentTarget.dataset; let { target } = e.currentTarget.dataset;
wx.navigateTo({ wx.navigateTo({
url: url:
"/packageWorkspace/pages/attendanceStatis/attendanceDetail/attendanceDetail?id=" + "/packageWorkspace/pages/attendanceStatis/attendanceDetail/attendanceDetail?info=" +
target.id, JSON.stringify(target),
}); });
}, },
}); });
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<view class="header"> <view class="header">
<view class="title-bar"> <view class="title-bar">
<image src="{{IMG_URL}}title_icon.png" mode=""/> <image src="{{IMG_URL}}title_icon.png" mode=""/>
<text class="title">{{sceneMap[item.sceneType] || '未知业务'}}</text> <text class="title">{{sceneMap[item.sceneType] || ''}}</text>
</view> </view>
</view> </view>
...@@ -29,12 +29,12 @@ ...@@ -29,12 +29,12 @@
<!-- Column 1: Delivery Count --> <!-- Column 1: Delivery Count -->
<view class="grid-col"> <view class="grid-col">
<view class="label-text">{{utils.formatBrandName(dto.brandName)}}交车数</view> <view class="label-text">{{utils.formatBrandName(dto.brandName)}}交车数</view>
<view class="value-text">{{dto.deliveryCount}}</view> <view class="value-text">{{dto.deliveryCount || '-'}}</view>
</view> </view>
<!-- Column 2: Effective Referral Count --> <!-- Column 2: Effective Referral Count -->
<view class="grid-col"> <view class="grid-col">
<view class="label-text">有效引荐数</view> <view class="label-text">有效引荐数</view>
<view class="value-text">{{dto.effectiveReferralCount}}</view> <view class="value-text">{{dto.effectiveReferralCount || '-'}}</view>
</view> </view>
<!-- Column 3: Reviewed Effective Count --> <!-- Column 3: Reviewed Effective Count -->
<view class="grid-col"> <view class="grid-col">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<view class="header"> <view class="header">
<view class="title-bar"> <view class="title-bar">
<image src="{{IMG_URL}}title_icon.png" mode=""/> <image src="{{IMG_URL}}title_icon.png" mode=""/>
<text class="title">{{sceneMap[item.sceneType] || '未知业务'}}</text> <text class="title">{{sceneMap[item.sceneType] || ''}}</text>
</view> </view>
</view> </view>
......
...@@ -27,8 +27,9 @@ Page({ ...@@ -27,8 +27,9 @@ Page({
defaultFillVal(data) { defaultFillVal(data) {
data.sceneTypeEffectiveReferrals.forEach(item => { data.sceneTypeEffectiveReferrals.forEach(item => {
// updateFlag 是否可编辑:0-不可编辑,1-可编辑(优先级最高)
// 状态:0-未提交,1-草稿,2-已提交 // 状态:0-未提交,1-草稿,2-已提交
if (item.status == 0) { if (item.status == 0 && data.updateFlag == 1) {
if (item.effectiveReferralCountDTOS && item.effectiveReferralCountDTOS.length) { if (item.effectiveReferralCountDTOS && item.effectiveReferralCountDTOS.length) {
item.effectiveReferralCountDTOS.forEach(k => { item.effectiveReferralCountDTOS.forEach(k => {
k.effectiveReferralCount = (k.deliveryCount || 0) + '' k.effectiveReferralCount = (k.deliveryCount || 0) + ''
...@@ -41,9 +42,10 @@ Page({ ...@@ -41,9 +42,10 @@ Page({
// Simulate fetching data from backend // Simulate fetching data from backend
getDetail() { getDetail() {
let { merchantId } = this.data.routerParams let { merchantId, reviewMonth } = this.data.routerParams
const params = { const params = {
merchantId merchantId,
reviewMonth
} }
api.getReferralDetail(params).then(res => { api.getReferralDetail(params).then(res => {
let { code, data, message } = res; let { code, data, message } = res;
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
<view wx:for="{{detailInfo.sceneTypeEffectiveReferrals}}" class="edit-box"> <view wx:for="{{detailInfo.sceneTypeEffectiveReferrals}}" class="edit-box">
<view class="merchant-name" wx:if="{{index == 0}}">{{detailInfo.merchantName}}</view> <view class="merchant-name" wx:if="{{index == 0}}">{{detailInfo.merchantName}}</view>
<!-- Render Detail View if status is 2 (Submitted) --> <!-- updateFlag 是否可编辑:0-不可编辑,1-可编辑(优先级最高)
<block wx:if="{{item.status == 2}}"> status 状态:0-未提交,1-草稿,2-已提交 -->
<block wx:if="{{item.status == 2 || detailInfo.updateFlag == 0 }}">
<detail-item <detail-item
item="{{item}}" item="{{item}}"
class="edit-item-wrapper" class="edit-item-wrapper"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!