Commit 402205aa by chenwq

feat(workspace): 新增员工日报/周报/月报模版选择功能

- 添加获取员工模版API接口
- 新增report-template-popup组件用于模版选择
- 在workspace页面集成模版选择功能
- 添加月报和周报日历组件
- 扩展表单验证规则支持多种报表类型
1 parent fe4efe46
......@@ -419,5 +419,9 @@ module.exports = {
// 查询订单是否支持状态变更
getOrderRefundStep(data) {
return api.post('dj.api.smartcarlife.refundApplyRecord.isExist', data)
},
// 获取员工日报/周报/月报模版
getStaffTemplate(data) {
return api.post('dj.api.carboutique.find.staff.good.news.template', data)
}
}
Component({
properties: {
show: {
type: Boolean,
value: false
},
templateList: {
type: Array,
value: []
}
},
methods: {
onModalBtn(e) {
// modal button click: 0 is Cancel
this.triggerEvent('cancel');
},
onSelect(e) {
const item = e.currentTarget.dataset.item;
this.triggerEvent('select', item);
}
}
})
{
"component": true,
"usingComponents": {
"modal": "/components/modal/modal",
"gl-image": "/components/GlImage/index"
}
}
<modal show="{{show}}" custom="{{true}}" tapTitle="选择模板" title="" btns="{{[]}}" binddidClickBtn="onModalBtn">
<view class="template-list">
<block wx:for="{{templateList}}" wx:key="index">
<view class="template-item" bindtap="onSelect" data-item="{{item}}">
<view class="item-name">{{item.name}}</view>
<view class="arrow-right">
<image src="/images/arrow-right.png" class="arrow-img" />
</view>
</view>
</block>
</view>
<view class="cancel-btn-box" bindtap="onModalBtn">
<view class="cancel-btn">取消</view>
</view>
</modal>
.template-list {
max-height: 600rpx;
overflow-y: auto;
padding: 0 30rpx;
margin-top: 40rpx;
}
.template-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
margin-bottom: 24rpx;
background-color: #F7F8FA;
border-radius: 16rpx;
}
.item-name {
flex: 1;
color: #292d33;
font-size: 28rpx;
font-weight: 500;
}
.arrow-right {
width: 32rpx;
height: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.arrow-img {
width: 13.2rpx;
height: 24rpx;
}
.cancel-btn-box {
padding: 0 32rpx 0;
border-top: 1px solid #ebedf0;
}
.cancel-btn {
height: 96rpx;
line-height: 96rpx;
text-align: center;
background-color: #fff;
color: #333333;
font-size: 32rpx;
font-weight: 500;
}
......@@ -260,6 +260,30 @@ module.exports = {
)
},
/** 根据月份查询查询员工周报提交 */
getWeeklyRecordDetail(data) {
return api.post(
'dj.api.carboutique.assign.month.find.staff.weekly.report.submit',
data
)
},
/** 根据月份查询查询周 */
getMonthCalWeek(data) {
return api.post(
'dj.api.carboutique.assign.month.cal.week',
data
)
},
/** 根据年份查询查询员工月报提交 */
getMonthlyRecordDetail(data) {
return api.post(
'dj.api.carboutique.assign.year.find.staff.monthly.report.submit',
data
)
},
/** 用户提交日报 */
saveTempReport(data) {
return api.post('dj.api.mindworkplate.app.daily.report.save', data)
......@@ -366,8 +390,8 @@ module.exports = {
getQYTechnicianList(data) {
return api.post('dj.api.smartcarlife.roleTechnician.list.effective', data)
},
/**施工单状态统计 */
statByStatus(data) {
/**施工单状态统计 */
statByStatus(data) {
let params = data || {}
return api.post('dj.api.smartcarlife.construction.summary.status', {
...params
......
Component({
properties: {
year: {
type: Number,
value: new Date().getFullYear()
},
selectedMonth: {
type: Number,
value: new Date().getMonth() + 1
},
monthList: {
type: Array,
value: [] // 数组结构:{ month: 1, disabled: false, hasSubmit: true }
}
},
data: {
showNextYear: true
},
observers: {
'year': function(year) {
const currentYear = new Date().getFullYear();
this.setData({
showNextYear: year < currentYear
});
}
},
methods: {
lastYear() {
this.triggerEvent('lastYear')
},
nextYear() {
this.triggerEvent('nextYear')
},
itemClick(e) {
const { index, disabled } = e.currentTarget.dataset
if (disabled) return
this.triggerEvent('monthClick', { month: index + 1 })
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="line"></view>
<view class="row year-select">
<view class="row last-year" bindtap="lastYear">
<gl-image class="icon left" src="{{ '/miniProgram/arrow-left.png' }}" webp></gl-image>
<view>上一年</view>
</view>
<view class="timeType">{{year}}年</view>
<view class="row next-year" bindtap="nextYear" style="visibility: {{showNextYear ? 'visible' : 'hidden'}}">
<!-- 下一年 -->
<view style="">下一年</view>
<gl-image class="icon right" src="{{ '/miniProgram/arrow-right.png' }}" webp></gl-image>
</view>
</view>
<scroll-view class="month-scroll" scroll-x="{{true}}" scroll-into-view="month-{{selectedMonth > 2 ? selectedMonth - 2 : 0}}">
<view class="month-container">
<block wx:for="{{monthList}}" wx:key="index">
<view
id="month-{{index}}"
class="month-item {{item.month == selectedMonth ? 'selected' : ''}} {{item.disabled ? 'disabled' : ''}}"
bindtap="itemClick"
data-index="{{index}}"
data-disabled="{{item.disabled}}"
>
<view class="month-text">{{item.month}}月</view>
<view class="empty-badge" wx:if="{{!item.hasSubmit && !item.disabled}}">空</view>
</view>
</block>
</view>
</scroll-view>
\ No newline at end of file
.row {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
background: #fff;
}
.year-select {
height: 80rpx;
flex-direction: row;
justify-content: space-between;
padding: 0 30rpx;
}
.last-year,
.next-year {
flex-direction: row;
font-size: 28rpx;
color: #666;
}
.icon {
width: 30rpx;
height: 30rpx;
}
.left {
margin-right: 10rpx;
}
.right {
margin-left: 10rpx;
}
.timeType {
font-size: 32rpx;
font-weight: 500;
color: #333;
}
.month-scroll {
width: 100%;
white-space: nowrap;
background: #fff;
}
.month-container {
display: flex;
padding: 40rpx 20rpx 20rpx 20rpx;
}
.month-item {
box-sizing: border-box;
padding: 20rpx 20rpx;
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 111rpx;
height: 64rpx;
margin: 0 10rpx;
border-radius: 364rpx;
position: relative;
flex-shrink: 0;
}
.month-text {
font-size: 30rpx;
color: #333;
}
.month-item.selected {
background-color: #347BFF;
}
.month-item.selected .month-text {
color: #fff;
}
.month-item.disabled .month-text {
color: #ccc;
}
.empty-badge {
position: absolute;
top: 0;
right: 0;
background-color: #F24724;
color: #fff;
height: 32rpx;
line-height: 32rpx;
font-size: 22rpx;
padding: 2rpx 6rpx;
border-radius: 16rpx;
transform: translate(30%, -30%);
z-index: 10;
white-space: nowrap;
}
\ No newline at end of file
Component({
properties: {
year: {
type: Number,
value: new Date().getFullYear()
},
month: {
type: Number,
value: new Date().getMonth() + 1
},
selectedWeek: {
type: Number,
value: 1
},
weekList: {
type: Array,
value: [] // 数组结构:{ week: 1, label: '12月第1周', disabled: false, hasSubmit: true }
}
},
data: {
showNextMonth: true
},
observers: {
'year, month': function(year, month) {
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth() + 1;
let showNextMonth = true;
if (year > currentYear) {
showNextMonth = false;
} else if (year === currentYear && month >= currentMonth) {
showNextMonth = false;
}
this.setData({
showNextMonth
});
}
},
methods: {
lastMonth() {
this.triggerEvent('lastMonth')
},
nextMonth() {
this.triggerEvent('nextMonth')
},
itemClick(e) {
const { week, disabled } = e.currentTarget.dataset
if (disabled) return
this.triggerEvent('weekClick', { week: week })
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="line"></view>
<view class="row year-select">
<view class="row last-year" bindtap="lastMonth">
<gl-image class="icon left" src="{{ '/miniProgram/arrow-left.png' }}" webp></gl-image>
<view>上个月</view>
</view>
<view class="timeType">{{year}}-{{month < 10 ? '0' + month : month}}</view>
<view class="row next-year" bindtap="nextMonth" style="visibility: {{showNextMonth ? 'visible' : 'hidden'}}">
<!-- 下一个月 -->
<view style="">下个月</view>
<gl-image class="icon right" src="{{ '/miniProgram/arrow-right.png' }}" webp></gl-image>
</view>
</view>
<scroll-view class="month-scroll" scroll-x="{{true}}" scroll-into-view="week-{{selectedWeek > 1 ? selectedWeek - 1 : 0}}">
<view class="month-container">
<block wx:for="{{weekList}}" wx:key="index">
<view
id="week-{{index}}"
class="month-item {{item.week == selectedWeek ? 'selected' : ''}} {{item.disabled ? 'disabled' : ''}}"
bindtap="itemClick"
data-index="{{index}}"
data-week="{{item.week}}"
data-disabled="{{item.disabled}}"
>
<view class="month-text">{{item.label}}</view>
<view class="empty-badge" wx:if="{{!item.hasSubmit && !item.disabled}}">空</view>
</view>
</block>
</view>
</scroll-view>
\ No newline at end of file
.row {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
background: #fff;
}
.line {
height: 1rpx;
width: 100%;
background-color: gainsboro;
}
.year-select {
height: 80rpx;
flex-direction: row;
justify-content: space-between;
padding: 0 30rpx;
}
.last-year,
.next-year {
flex-direction: row;
font-size: 28rpx;
color: #181A1F;
align-items: center;
}
.icon {
width: 36rpx;
height: 36rpx;
}
.left {
margin-right: 10rpx;
}
.left {
margin-left: 10rpx;
}
.right {
margin-right: 10rpx;
}
.timeType {
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 28rpx;
color: #181A1F;
width: 280rpx;
height: 64rpx;
text-align: center;
line-height: 64rpx;
border-radius: 20px;
background: #f2f3f5;
}
.month-scroll {
width: 100%;
white-space: nowrap;
background: #fff;
padding-top: 12rpx;
/* padding: 30rpx 0; */
}
.month-container {
display: flex;
padding: 15rpx 30rpx 30rpx 30rpx;
}
.month-item {
box-sizing: border-box;
padding: 10rpx 20rpx;
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
/* width: 160rpx; */
min-width: 180rpx;
height: 64rpx;
margin: 0 10rpx;
border-radius: 364rpx;
position: relative;
flex-shrink: 0;
}
.month-text {
font-size: 28rpx;
color: #292D33;
}
.month-item.selected {
background-color: #347BFF;
}
.month-item.selected .month-text {
color: #fff;
}
.month-item.disabled .month-text {
color: #BEC1C7;
}
.empty-badge {
position: absolute;
top: 0;
right: 0;
background-color: #F24724;
color: #fff;
height: 32rpx;
line-height: 32rpx;
font-size: 22rpx;
padding: 2rpx 6rpx;
border-radius: 16rpx;
transform: translate(30%, -30%);
z-index: 10;
white-space: nowrap;
}
\ No newline at end of file
{
"navigationStyle": "custom",
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"weekCalendar": "./components/weekCalendar/weekCalendar",
"select-item-popup": "./components/selectItemPopup/selectItemPopup",
"select-popup": "./components/selectPopup/selectPopup"
}
}
\ No newline at end of file
"navigationStyle": "custom",
"usingComponents": {
"van-overlay": "@vant/weapp/overlay/index",
"weekCalendar": "./components/weekCalendar/weekCalendar",
"select-item-popup": "./components/selectItemPopup/selectItemPopup",
"select-popup": "./components/selectPopup/selectPopup",
"monthCalendar": "./components/monthCalendar/monthCalendar",
"weeklyCalendar": "./components/weeklyCalendar/weeklyCalendar"
}
}
\ No newline at end of file
......@@ -70,7 +70,7 @@ page {
}
.tab-item.active {
color: #2C66F7;
color: #347bff;
}
.tab-item.active::after {
position: absolute;
......@@ -79,7 +79,7 @@ page {
transform: translateX(-50%);
width: 64rpx;
height: var(--fontSize4);
background-color: #2C66F7;
background-color: #347BFF;
content: '';
}
}
......@@ -111,7 +111,7 @@ page {
margin-bottom: 8rpx;
}
.example-btn {
color: #2C66F7;
color: #347bff;
font-size: 24rpx;
margin-left: 8rpx;
}
......@@ -165,8 +165,8 @@ page {
text-align: center;
font-size: var(--fontSize32);
color: #FFFFFF;
background: #2C66F7;
border-radius: var(--fontSize24);
background: #347BFF;
border-radius: var(--fontSize12);
margin: var(--fontSize126) var(--fontSize64) var(--fontSize20);
}
......@@ -237,7 +237,7 @@ page {
.btns .btns-con view {
border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24);
border-radius: var(--fontSize12);
height: var(--fontSize80);
box-sizing: border-box;
}
......@@ -251,11 +251,11 @@ page {
.btns.two-btns .btns-con view {
width: 45%;
border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24);
border-radius: var(--fontSize12);
height: var(--fontSize80);
box-sizing: border-box;
color: #fff;
background-color: #2C66F7;
background-color: #347BFF;
}
.btns-con .cancel {
......@@ -266,7 +266,7 @@ page {
.confirm {
border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24);
border-radius: var(--fontSize12);
height: var(--fontSize80);
box-sizing: border-box;
}
......@@ -275,5 +275,5 @@ page {
// width: var(--fontSize480);
width: 100%;
color: #fff;
background-color: #2C66F7;
background-color: #347BFF;
}
\ No newline at end of file
......@@ -2,7 +2,8 @@
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
import {
getWaitAuditCountAPI,
waitstaffstateAPI
waitstaffstateAPI,
getStaffTemplate
} from '~/api/api'
Page({
......@@ -25,18 +26,26 @@ Page({
icon: "resident-manage",
trackingCode: 'regional-assistant-resident-manage'
}, {
name: "轻改区域日报",
name: "工作日报",
url: "packageWorkspace.supervisorDaily",
icon: "modifications-supervisor-daily",
params: {
templateCode: 'qinggai-temp-001'
},
reportTypeAttr: 'daily',
reportTypeVal: '1',
trackingCode: 'regional-modifications-supervisor-daily'
}, {
name: "延保区域日报",
name: "工作周报",
url: "packageWorkspace.supervisorDaily",
icon: "warranty-supervisor-daily",
trackingCode: 'regional-warranty-supervisor-daily'
icon: "modifications-supervisor-week",
reportTypeAttr: 'weekly',
reportTypeVal: '2',
trackingCode: 'regional-modifications-supervisor-daily'
}, {
name: "工作月报",
url: "packageWorkspace.supervisorDaily",
icon: "modifications-supervisor-month",
reportTypeAttr: 'monthly',
reportTypeVal: '3',
trackingCode: 'regional-modifications-supervisor-daily'
}],
staffDevelopmentMenus: [{
name: "招聘管理",
......@@ -49,7 +58,10 @@ Page({
url: "packageWorkspace.talentAnalysis",
icon: "talent-analysis",
trackingCode: 'regional-assistant-talent-analysis'
}]
}],
showReportPopup: false,
reportTemplateList: [],
currentReportItem: null,
},
/**
......@@ -79,6 +91,32 @@ Page({
})
},
onReportPopupCancel() {
this.setData({
showReportPopup: false,
});
},
onReportPopupSelect(e) {
const selectedTemplate = e.detail;
this.setData({
showReportPopup: false,
});
console.log(selectedTemplate, 'selectedTemplate---')
const item = this.data.currentReportItem;
if (!item) return;
// Merge params
const params = {
// ...(item.params || {}),
reportTypeAttr: item.reportTypeAttr,
...(selectedTemplate || {}),
};
wx.$router.go(item.url, {
params: params,
});
},
/**
* 生命周期函数--监听页面显示
*/
......@@ -136,19 +174,19 @@ Page({
let { staffDevelopmentMenus } = this.data
let index = staffDevelopmentMenus.findIndex(e => e.name == '招聘管理')
waitstaffstateAPI()
.then(result => {
let {
code,
data
} = result
if (code == 0) {
console.log("调统计招聘",data);
this.setData({
[`staffDevelopmentMenus[${index}].tipsNum`]: data.waitProcessCount
})
}
})
.catch(err => { })
.then(result => {
let {
code,
data
} = result
if (code == 0) {
console.log("调统计招聘", data);
this.setData({
[`staffDevelopmentMenus[${index}].tipsNum`]: data.waitProcessCount
})
}
})
.catch(err => { })
},
jump(e) {
......@@ -159,8 +197,37 @@ Page({
this.throttledJump(e); // 调用节流后的函数
},
openWorkReportTemp(targetItem) {
const tipTxtObj = {
'daily': '暂无可填日报模版,请找总部运营配置',
'weekly': '暂无可填周报模版,请找总部运营配置',
'monthly': '暂无可填月报模版,请找总部运营配置'
}
getStaffTemplate({ reportType: targetItem.reportTypeVal }).then(res => {
let { code, data } = res
console.log(data)
if (!data.length) {
wx.$util.showToast(tipTxtObj[targetItem.reportTypeAttr])
return
}
if (code == 0) {
this.setData({
showReportPopup: true,
reportTemplateList: data,
currentReportItem: targetItem || null
});
}
})
},
jumpTo(e) {
let { url, query, trackingCode, params } = e.currentTarget.dataset.target
let item = e.currentTarget.dataset.target
console.log(item, '00000')
if (item.url == "packageWorkspace.supervisorDaily") {
this.openWorkReportTemp(item)
return;
}
let userInfo = wx.$util.getUserInfo()
// 埋点
wx.$track.setTrackData(0, trackingCode, {}, '', userInfo?.sceneType)
......@@ -170,7 +237,7 @@ Page({
})
}
wx.$router.go(url, {
params: params || {},
params: params || {},
})
},
......
{
"usingComponents": {},
"usingComponents": {
"report-template-popup": "/components/report-template-popup/report-template-popup"
},
"navigationStyle": "custom"
}
\ No newline at end of file
......@@ -44,4 +44,10 @@
</view>
</view>
<report-template-popup
show="{{showReportPopup}}"
templateList="{{reportTemplateList}}"
bind:cancel="onReportPopupCancel"
bind:select="onReportPopupSelect"
/>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!