优化员工排班与规划月视图体验

This commit is contained in:
2026-06-27 00:08:18 +08:00
parent 5fc0e35759
commit 13916e61b7
21 changed files with 413 additions and 73 deletions
@@ -82,8 +82,6 @@ Page({
workDays: [1, 2, 3, 4, 5],
startTime: '09:00',
endTime: '17:00',
slotMinutes: 60,
capacity: 1,
remark: ''
},
exceptionForm: {
@@ -91,8 +89,6 @@ Page({
exceptionType: 'REST',
startTime: '10:00',
endTime: '18:00',
slotMinutes: 60,
capacity: 1,
remark: ''
}
},
@@ -117,8 +113,6 @@ Page({
workDays: copyWorkDays(rule.workDays || preset.workDays),
startTime: String(rule.startTime || preset.startTime).slice(0, 5),
endTime: String(rule.endTime || preset.endTime).slice(0, 5),
slotMinutes: rule.slotMinutes || 60,
capacity: rule.capacity || 1,
remark: rule.remark || ''
}
this.setData({
@@ -235,11 +229,10 @@ Page({
workDays,
startTime: form.startTime,
endTime: form.endTime,
slotMinutes: Number(form.slotMinutes) || 60,
capacity: Number(form.capacity) || 1,
status: 1,
remark: String(form.remark || '').trim()
})
this.markPlanningRefresh()
wx.showToast({ title: '排班规则已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
@@ -267,10 +260,9 @@ Page({
exceptionType: form.exceptionType,
startTime: form.exceptionType === 'REST' ? null : form.startTime,
endTime: form.exceptionType === 'REST' ? null : form.endTime,
slotMinutes: Number(form.slotMinutes) || 60,
capacity: Number(form.capacity) || 1,
remark: String(form.remark || '').trim()
})
this.markPlanningRefresh()
wx.showToast({ title: '例外已保存', icon: 'success' })
await this.loadRule()
} catch (error) {
@@ -282,5 +274,17 @@ Page({
back() {
wx.navigateBack()
},
markPlanningRefresh() {
const app = getApp()
app.globalData.planningNeedRefresh = true
wx.setStorageSync('planningNeedRefresh', '1')
const pages = getCurrentPages()
pages.forEach(page => {
if (page.route === 'pages/planning/index') {
page._needRefresh = true
}
})
}
})
@@ -21,14 +21,6 @@
<text class="field-label">结束时间</text>
<picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker>
</view>
<view class="field">
<text class="field-label">预约间隔</text>
<input type="number" value="{{form.slotMinutes}}" data-field="slotMinutes" bindinput="onInput" />
</view>
<view class="field">
<text class="field-label">容量</text>
<input type="number" value="{{form.capacity}}" data-field="capacity" bindinput="onInput" />
</view>
<view class="field">
<text class="field-label">备注</text>
<input value="{{form.remark}}" data-field="remark" bindinput="onInput" placeholder="可选" />
@@ -55,14 +47,6 @@
<text class="field-label">结束时间</text>
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker>
</view>
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
<text class="field-label">预约间隔</text>
<input type="number" value="{{exceptionForm.slotMinutes}}" data-field="slotMinutes" bindinput="onExceptionInput" />
</view>
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field">
<text class="field-label">容量</text>
<input type="number" value="{{exceptionForm.capacity}}" data-field="capacity" bindinput="onExceptionInput" />
</view>
<view class="field">
<text class="field-label">备注</text>
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
@@ -23,6 +23,7 @@
color: #5f5951;
font-size: 24rpx;
font-weight: 700;
transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.preset-chip.active,
@@ -30,6 +31,7 @@
border-color: #6f8f83;
background: #e5eee9;
color: #55786d;
transform: translateY(-2rpx);
}
.field-block {
@@ -49,6 +51,16 @@
text-align: right;
}
.field-value {
min-height: 58rpx;
padding: 14rpx 20rpx;
border-radius: 999rpx;
background: #f4f0ea;
color: #4d473f;
font-size: 26rpx;
font-weight: 700;
}
.exception-btn {
margin-top: 22rpx;
}
@@ -68,6 +80,11 @@
color: #4c4740;
font-size: 24rpx;
font-weight: 700;
transition: transform 180ms ease, box-shadow 180ms ease;
}
.exception-card:active {
transform: scale(0.99);
}
.exception-remark {