Commit 1a06a474 by chenwq

feat(申诉单): 新增申诉单详情页并完善列表页功能

- 新增申诉单详情页面,包含申诉内容展示、图片预览和总部回复
- 为申诉单列表页添加筛选组件,支持按日期范围筛选申诉记录
- 扩展 FilterBar 组件,增加日期范围选择器功能
- 在 app.json 中注册申诉单详情页面路由
1 parent 8978b967
......@@ -84,7 +84,8 @@
"pages/performanceRating/rateDetail/rateDetail",
"pages/performanceRating/batchOperation/batchOperation",
"pages/validReferralCount/referraCountEdit/referraCountEdit",
"pages/attendanceStatis/attendanceDetail/attendanceDetail"
"pages/attendanceStatis/attendanceDetail/attendanceDetail",
"pages/appealFormManage/appealFormDetail/appealFormDetail"
]
},
{
......
......@@ -31,7 +31,7 @@ Component({
type: String,
value: "keyword",
},
// Array of filter objects: { type: 'month'|'select', label: 'Label', key: 'key', optionList: [], value: '' }
// Array of filter objects: { type: 'month'|'select'|'date-range', label: 'Label', key: 'key', optionList: [], value: '', startKey: '', endKey: '' }
filters: {
type: Array,
value: [],
......@@ -54,6 +54,13 @@ Component({
pickerViewValue: new Date().getTime(),
minDate: new Date(2020, 0, 1).getTime(),
maxDate: new Date(new Date().getFullYear() + 5, 11, 31).getTime(),
maxDateForCalendar: (function () {
const d = new Date();
const y = d.getFullYear();
const m = (d.getMonth() + 1).toString().padStart(2, "0");
const day = d.getDate().toString().padStart(2, "0");
return `${y}-${m}-${day}`;
})(),
tempSelectIndex: 0,
},
......@@ -122,6 +129,32 @@ Component({
this.triggerEvent("filterChange", this.getFilterData());
},
// Date Range Logic
onDateRangeSelect(e) {
const index = e.currentTarget.dataset.index;
const filter = this.properties.filters[index];
const { start, end } = e.detail.date;
if (!start || !end) return;
const displayValue = `${start} 至 ${end}`;
const updates = {};
// Update formData with the display string for the main key (for display in FilterBar)
this.updateForm(filter, displayValue, displayValue, updates);
// Update startKey and endKey if configured
if (filter.startKey) {
updates[`formData.${filter.startKey}`] = start;
}
if (filter.endKey) {
updates[`formData.${filter.endKey}`] = end;
}
this.setData(updates);
this.triggerEvent("filterChange", this.getFilterData());
},
// Date Logic
initDatePicker(currentValue, pickerType = "year-month") {
let val = new Date().getTime();
......@@ -161,7 +194,7 @@ Component({
getSelectOptions(filter) {
let optionList = filter.optionList || [];
if (!filter.hideAllOption) {
optionList = [{ confId: '', confLabel: '全部' }, ...optionList];
optionList = [{ confId: "", confLabel: "全部" }, ...optionList];
}
return optionList;
},
......@@ -170,15 +203,15 @@ Component({
const filter = this.properties.filters[this.data.activeFilterIndex];
const optionList = this.getSelectOptions(filter);
let index = 0;
if (currentValue) {
index = optionList.findIndex(item => item.confId == currentValue);
index = optionList.findIndex((item) => item.confId == currentValue);
if (index == -1) index = 0;
} else {
// If currentValue is empty, it might mean "All" is selected (if available) or no selection.
// If "All" option exists (confId: ''), index should be 0.
// If no "All" option, but optionList exist, default to first.
index = 0;
// If currentValue is empty, it might mean "All" is selected (if available) or no selection.
// If "All" option exists (confId: ''), index should be 0.
// If no "All" option, but optionList exist, default to first.
index = 0;
}
// Default to first option if empty and not "All" (which is also empty string but valid)
......@@ -188,29 +221,41 @@ Component({
// If it's effectively "All" or unselected, we sync it.
const firstOption = optionList[0];
const updateData = {};
this.updateForm(filter, firstOption.confId, firstOption.confLabel, updateData);
this.updateForm(
filter,
firstOption.confId,
firstOption.confLabel,
updateData,
);
this.setData(updateData);
}
console.log(index, 'index---')
console.log(index, "index---");
this.setData({
tempSelectIndex: index,
currentSelectOptions: optionList // Store current optionList to use in wxml or change handler
currentSelectOptions: optionList, // Store current optionList to use in wxml or change handler
});
},
onSelectPickerChange(e) {
const { index } = e.detail;
// We need to use the same optionList list as displayed
const filter = this.properties.filters[this.data.activeFilterIndex];
const optionList = this.data.currentSelectOptions || this.getSelectOptions(filter);
const optionList =
this.data.currentSelectOptions || this.getSelectOptions(filter);
const value = optionList[index];
const updateData = {
tempSelectIndex: index
tempSelectIndex: index,
};
// Update showKey if present
this.updateForm(filter, value ? value.confId : '', value ? value.confLabel : '', updateData);
this.updateForm(
filter,
value ? value.confId : "",
value ? value.confLabel : "",
updateData,
);
this.setData(updateData);
},
......@@ -238,6 +283,8 @@ Component({
const updates = {};
this.properties.filters.forEach((f) => {
this.updateForm(f, "", "", updates);
if (f.startKey) updates[`formData.${f.startKey}`] = "";
if (f.endKey) updates[`formData.${f.endKey}`] = "";
});
this.setData(updates);
......@@ -252,18 +299,26 @@ Component({
this.properties.filters.forEach((f) => {
let keyVal = this.data.formData[f.key] || "";
let showKeyVal = f.showKey ? (this.data.formData[f.showKey] || "") : "";
let showKeyVal = f.showKey ? this.data.formData[f.showKey] || "" : "";
// 如果当前选中的confId为空并且confLabel为全部,则传‘’
// If the value is empty and the label is "全部", treat label as empty string for output
if (keyVal == "" && showKeyVal == "全部") {
showKeyVal = "";
showKeyVal = "";
}
result[f.key] = keyVal;
if (f.showKey) {
result[f.showKey] = showKeyVal;
}
// Add startKey and endKey if they exist
if (f.startKey) {
result[f.startKey] = this.data.formData[f.startKey] || "";
}
if (f.endKey) {
result[f.endKey] = this.data.formData[f.endKey] || "";
}
});
return result;
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"TopToolbarPopup": "../TopToolbarPopup/TopToolbarPopup",
"van-datetime-picker": "@vant/weapp/datetime-picker/index",
"van-picker": "@vant/weapp/picker/index"
"van-picker": "@vant/weapp/picker/index",
"calendar": "../Calendar/Calendar"
}
}
......@@ -14,11 +14,35 @@
<view class="filter-box" wx:if="{{filters.length > 0}}">
<view class="filter-list">
<block wx:for="{{filters}}" wx:key="key">
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}" bindtap="onFilterTagTap" data-index="{{index}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<!-- Using local images based on assumption, adjust filenames if needed -->
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
<!-- Date Range Filter -->
<block wx:if="{{item.type === 'date-range'}}">
<calendar
class="calendar-wrapper"
allowSameDay
shortcut
bindselect="onDateRangeSelect"
calenderColor="#347BFF"
vertical
dateType='range'
minDate="2020-01-01"
maxDate="{{ maxDateForCalendar }}"
isComponents
data-index="{{index}}"
>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</calendar>
</block>
<!-- Other Filters (Month, Select) -->
<block wx:else>
<view class="filter-item {{searchObj[item.key] ? 'active' : ''}}" bindtap="onFilterTagTap" data-index="{{index}}">
<text class="filter-text">{{searchObj[item.showKey || item.key] || item.label}}</text>
<image class="filter-icon" src="{{IMG_URL}}{{searchObj[item.key] ? 'expand_icon_blue' : 'expand_icon'}}.png" mode="" />
</view>
</block>
</block>
</view>
......@@ -58,4 +82,4 @@
</block>
</block>
</TopToolbarPopup>
\ No newline at end of file
</TopToolbarPopup>
// packageWorkspace/pages/appealFormManage/appealFormDetail/appealFormDetail.js
Page({
/**
* 页面的初始数据
*/
data: {
info: {},
appealTypeStr: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// In a real scenario, use options.id to fetch data
// this.getDetail(options.id);
// For now, use mock data based on user request
this.setMockData();
},
setMockData() {
const mockData = {
"id": 123,
"staffName": "方敏",
"staffPhone": "13800000000",
"appealType": 1, // 1:考勤,2:平板录音
"dealStatus": 1,
"appealMonth": "2025-01",
"sceneType": 1,
"merchantId": 1001,
"actualAttendanceDays": 22,
"applyActualAttendanceDays": 26,
"confirmActualAttendanceDays": 26,
"padRecordNum": 0,
"applyPadRecordNum": 0,
"confirmPadRecordNum": 0,
"remark": "分享时机,在不同的时机分析用户是否有分享的意愿,提供给他们合适的分享内容,能让分享的效果更好。尤其是刚上线的产品,很难通过产品的内部体系来实现快速的用户增长,所以会更加依赖于分享来达到广泛的传播,获取目标用户。所以监听用户的截图操作,提示用户进行分享,既缩短了以前分享截图的操作路径,避免了在之前长路径中的行为流失(比如截图完成后忘记分享或觉得麻烦放弃分享等等),也让用户觉得更加贴心。共200个字显示样式。",
"otherAbnormalMessage": "",
"replyContent": "分享时机,在不同的时机分析用户是否有分享的意愿,提供给他们合适的分享内容,能让分享的效果更好。尤其是刚上线的产品,很难通过产品的内部体系来实现快速的用户增长,所以会更加依赖于分享来达到广泛的传播,获取目标用户。所以监听用户的截图操作,提示用户进行分享,既缩短了以前分享截图的操作路径,避免了在之前长路径中的行为流失(比如截图完成后忘记分享或觉得麻烦放弃分享等等),也让用户觉得更加贴心。共200个字显示样式。",
"createdBy": "方敏",
"createdDate": "2025-01-05 14:30:20",
"attachmentList": [
{ "fileName": "img1.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" },
{ "fileName": "img2.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" },
{ "fileName": "img3.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" },
{ "fileName": "img4.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" },
{ "fileName": "img5.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" },
{ "fileName": "img6.jpg", "fileUrl": "https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/recruit-insert.png" }
]
};
this.setData({
info: mockData,
appealTypeStr: this.getAppealTypeStr(mockData.appealType)
});
},
getAppealTypeStr(type) {
const map = {
1: '考勤',
2: '平板录音',
3: '考勤、平板录音' // Assuming 3 is combination if needed
};
return map[type] || '未知';
},
/**
* Preview Image
*/
previewImage(e) {
const current = e.currentTarget.dataset.url;
const urls = e.currentTarget.dataset.urls.map(item => item.fileUrl);
wx.previewImage({
current,
urls
});
}
})
\ No newline at end of file
{
"usingComponents": {
"van-icon": "@vant/weapp/icon/index"
},
"navigationBarTitleText": "申诉单详情",
"navigationBarBackgroundColor": "#FFFFFF"
}
\ No newline at end of file
/* packageWorkspace/pages/appealFormManage/appealFormDetail/appealFormDetail.wxss */
page {
background: #F2F3F7;
padding-bottom: 40rpx;
}
.detail-page {
padding: 24rpx;
}
.card {
background: #FFFFFF;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
}
.card-title {
font-size: 32rpx;
font-weight: 600;
color: #222222;
margin-bottom: 10rpx;
}
.row {
display: flex;
align-items: center;
}
.row-between {
display: flex;
justify-content: space-between;
align-items: center;
}
.align-start {
align-items: flex-start;
}
.mt-20 {
margin-top: 20rpx;
}
.mt-30 {
margin-top: 30rpx;
}
.ml-20 {
margin-left: 20rpx;
}
.name {
font-size: 32rpx;
font-weight: 600;
color: #222222;
}
.time {
font-size: 24rpx;
color: #999999;
font-weight: 400;
margin-left: 16rpx;
}
.label {
font-size: 28rpx;
color: #999999;
flex-shrink: 0;
}
.value {
font-size: 28rpx;
color: #222222;
}
.bold {
font-weight: 500;
}
.nowrap {
white-space: nowrap;
}
.desc-text {
line-height: 1.6;
text-align: justify;
}
.image-grid {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
}
.img {
width: 200rpx;
height: 200rpx;
border-radius: 8rpx;
background-color: #f8f8f8;
}
.flex-1 {
flex: 1;
}
<!--packageWorkspace/pages/appealFormManage/appealFormDetail/appealFormDetail.wxml-->
<view class="detail-page">
<!-- Header Card -->
<view class="card header-card">
<view class="row-between">
<view class="name">{{info.staffName}} <text class="time">{{info.createdDate}}提交申请</text></view>
<!-- <view class="status">{{info.dealStatus === 1 ? '已通过' : (info.dealStatus === 2 ? '已驳回' : '待审核')}}</view> -->
</view>
<view class="row mt-20">
<text class="label">申诉类型:</text>
<text class="value">{{appealTypeStr}}</text>
</view>
</view>
<!-- Content Card -->
<view class="card content-card">
<view class="card-title">申诉内容</view>
<view class="row mt-30">
<text class="label">申诉类型</text>
<text class="value ml-20 bold">{{appealTypeStr}}</text>
</view>
<!-- Attendance Info -->
<block wx:if="{{info.appealType == 1 || info.appealType == 3}}">
<view class="row mt-20">
<text class="label">本月实际出勤天数</text>
<text class="value ml-20">{{info.actualAttendanceDays}}天</text>
</view>
<view class="row mt-20">
<text class="label">申诉修改实际出勤天数</text>
<text class="value ml-20">{{info.applyActualAttendanceDays}}天</text>
</view>
</block>
<!-- Pad Info -->
<block wx:if="{{info.appealType == 2 || info.appealType == 3}}">
<view class="row mt-20">
<text class="label">平板录音数</text>
<text class="value ml-20">{{info.padRecordNum}}</text>
</view>
<view class="row mt-20">
<text class="label">申诉修改平板录音数</text>
<text class="value ml-20">{{info.applyPadRecordNum}}</text>
</view>
</block>
<view class="section-label mt-30 label">上传截图说明</view>
<view class="image-grid mt-20">
<block wx:for="{{info.attachmentList}}" wx:key="index">
<image
class="img"
src="{{item.fileUrl}}"
mode="aspectFill"
bindtap="previewImage"
data-url="{{item.fileUrl}}"
data-urls="{{info.attachmentList}}"
></image>
</block>
</view>
<view class="row mt-30 align-start">
<text class="label nowrap">备注说明</text>
<text class="value ml-20 flex-1 desc-text">{{info.remark || '无'}}</text>
</view>
</view>
<!-- Reply Card -->
<view class="card reply-card">
<view class="card-title">总部回复</view>
<!-- Attendance Reply -->
<block wx:if="{{info.appealType == 1 || info.appealType == 3}}">
<view class="row mt-30">
<text class="label">确认实际出勤天数</text>
<text class="value ml-20">{{info.confirmActualAttendanceDays}}天</text>
</view>
</block>
<!-- Pad Reply -->
<block wx:if="{{info.appealType == 2 || info.appealType == 3}}">
<view class="row mt-30">
<text class="label">确认平板录音数</text>
<text class="value ml-20">{{info.confirmPadRecordNum}}</text>
</view>
</block>
<view class="row mt-30 align-start">
<text class="label nowrap">备注说明</text>
<text class="value ml-20 flex-1 desc-text">{{info.replyContent || '无'}}</text>
</view>
</view>
</view>
\ No newline at end of file
// packageWorkspace/pages/appealFormManage/appealFormList/appealFormList.js
Page({
/**
* 页面的初始数据
*/
data: {
searchObj: {
staffName: "",
applyStartTime: "",
applyEndTime: "",
},
filterConfig: [
{
type: "date-range",
label: "申诉日期",
key: "appealDate",
startKey: "applyStartTime",
endKey: "applyEndTime",
},
],
list: [],
triggered: false,
nothing: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.search();
},
/**
* 生命周期函数--监听页面初次渲染完成
* 筛选回调
*/
onReady() {
onFilterChange(e) {
this.setData({
searchObj: e.detail,
});
this.search();
},
/**
* 生命周期函数--监听页面显示
* 搜索
*/
onShow() {
search() {
this.setData({
list: [],
nothing: false,
});
// 模拟接口请求
setTimeout(() => {
this.getList();
}, 500);
},
/**
* 生命周期函数--监听页面隐藏
* 获取列表数据 (Mock)
*/
onHide() {
getList() {
// 模拟数据
const mockList = [
{
id: 1,
staffName: "张三",
applyDate: "2026-01-10",
appealType: "补卡申请",
status: "待审批",
},
{
id: 2,
staffName: "李四",
applyDate: "2026-01-12",
appealType: "请假申请",
status: "已通过",
},
];
let filteredList = mockList;
this.setData({
list: [filteredList], // 二维数组结构
triggered: false,
nothing: true,
});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
* 下拉刷新
*/
onPullDownRefresh() {
this.search();
},
/**
* 页面上拉触底事件的处理函数
* 上拉加载
*/
onReachBottom() {
// Mock no more data
},
/**
* 用户点击右上角分享
* 跳转详情 (如果有)
*/
onShareAppMessage() {
}
})
\ No newline at end of file
handleDetail(e) {
let { target } = e.currentTarget.dataset;
wx.navigateTo({
url:
"/packageWorkspace/pages/appealFormManage/appealFormDetail/appealFormDetail?id=" +
target.id,
});
},
});
\ No newline at end of file
{
"usingComponents": {},
"usingComponents": {
"FilterBar": "/components/FilterBar/FilterBar",
"van-icon": "@vant/weapp/icon/index"
},
"navigationBarTitleText": "申诉单列表"
}
\ No newline at end of file
/* packageWorkspace/pages/appealFormManage/appealFormList/appealFormList.wxss */
\ No newline at end of file
/* packageWorkspace/pages/appealFormManage/appealFormList/appealFormList.wxss */
page {
background: #F2F3F7;
}
.list-page {
.top-box {
background: #FFFFFF;
}
.list {
.empty-box {
width: 100%;
height: 24rpx;
}
.item {
margin: 0 24rpx 24rpx;
border-radius: 32rpx;
background: #FFFFFF;
padding: 32rpx;
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24rpx;
.name {
font-size: 32rpx;
font-weight: 600;
color: #222222;
}
.ellipsis {
overflow: hidden;
display: -webkit-box !important;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
word-break: break-all;
}
.date-row {
display: flex;
align-items: center;
flex-shrink: 0;
margin-left: 20rpx;
.date {
font-size: 28rpx;
color: #333333;
margin-right: 8rpx;
}
}
}
.item-body {
display: flex;
align-items: center;
.stat-item {
display: flex;
align-items: center;
.label {
font-size: 26rpx;
color: #999999;
margin-right: 16rpx;
}
.value {
font-size: 28rpx;
color: #222222;
font-weight: 500;
}
}
.stat-item:first-child {
margin-right: 16rpx;
}
}
}
.list-nothing {
text-align: center;
font-size: 24rpx;
color: #999;
padding: 20rpx 0;
}
}
}
\ No newline at end of file
<!--packageWorkspace/pages/appealFormManage/appealFormList/appealFormList.wxml-->
<text>packageWorkspace/pages/appealFormManage/appealFormList/appealFormList.wxml</text>
\ No newline at end of file
<view class="list-page">
<view class="top-box">
<FilterBar
searchPlaceholder="员工姓名"
searchKey="staffName"
filters="{{filterConfig}}"
searchObj="{{searchObj}}"
bind:filterChange="onFilterChange"
></FilterBar>
</view>
<scroll-view
scroll-y
enable-back-to-top
refresher-enabled="{{ true }}"
bindrefresherrefresh="search"
bindscrolltolower="onReachBottom"
class="list"
style="height:calc(100vh - var(--fontSize184));"
refresher-threshold="104"
refresher-triggered="{{ triggered }}"
>
<block wx:if="{{ list.length > 0 }}">
<view class="empty-box"></view>
<block wx:for="{{ list }}" wx:key="index">
<block wx:for="{{ item }}" wx:for-item="li" wx:for-index="ind" wx:key="ind">
<view class="item" bindtap="handleDetail" data-target="{{li}}">
<view class="item-header">
<view class="name ellipsis">{{li.staffName}}</view>
<view class="date-row">
<van-icon name="arrow" color="#ccc" size="16px" />
</view>
</view>
<view class="item-body">
<view class="stat-item">
<text class="label">申诉日期</text>
<text class="value">{{li.applyDate}}</text>
</view>
<view class="stat-item">
<text class="label">申诉类型</text>
<text class="value">{{li.appealType}}</text>
</view>
</view>
</view>
</block>
</block>
<block wx:if="{{ nothing }}">
<view class="list-nothing">到底了~</view>
</block>
</block>
<block wx:else>
<empty-data />
</block>
</scroll-view>
</view>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!