Commit 05c35287 by 张立顺

Merge branch 'SAAS+V5.5.3' into 'SAAS+v5.5.3'

Saas+v5.5.3

See merge request !3
2 parents d2c22fae 916df509
...@@ -419,5 +419,9 @@ module.exports = { ...@@ -419,5 +419,9 @@ module.exports = {
// 查询订单是否支持状态变更 // 查询订单是否支持状态变更
getOrderRefundStep(data) { getOrderRefundStep(data) {
return api.post('dj.api.smartcarlife.refundApplyRecord.isExist', 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: 900rpx;
overflow-y: scroll;
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 = { ...@@ -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) { saveTempReport(data) {
return api.post('dj.api.mindworkplate.app.daily.report.save', data) return api.post('dj.api.mindworkplate.app.daily.report.save', data)
...@@ -366,8 +390,8 @@ module.exports = { ...@@ -366,8 +390,8 @@ module.exports = {
getQYTechnicianList(data) { getQYTechnicianList(data) {
return api.post('dj.api.smartcarlife.roleTechnician.list.effective', data) return api.post('dj.api.smartcarlife.roleTechnician.list.effective', data)
}, },
/**施工单状态统计 */ /**施工单状态统计 */
statByStatus(data) { statByStatus(data) {
let params = data || {} let params = data || {}
return api.post('dj.api.smartcarlife.construction.summary.status', { return api.post('dj.api.smartcarlife.construction.summary.status', {
...params ...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 \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ 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 \ 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 \ 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 \ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ 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 \ 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 \ No newline at end of file
...@@ -297,6 +297,758 @@ export const tempRuleFnObj = { ...@@ -297,6 +297,758 @@ export const tempRuleFnObj = {
} }
} }
}, },
currentMonthOperationStrategyResult019: {
/** 直营门店 */
directStores019: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '直营门店请输入两位数字' }
}
},
/** 目标 */
target019: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '目标请输入仅有两位小数的数字' }
}
},
/** 实际达成 */
actualAchievement019: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `实际达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '实际达成请输入仅有两位小数的数字' }
}
},
/** 完成率 */
completionRate019: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `完成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '完成率请输入仅有两位小数的数字' }
}
}
},
/** 业绩报告 */
performanceReport012: {
/** 本周启动门店 */
weeklyStartedStores012: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周启动门店请输入两位数字' }
}
},
/** 本周流失门店 */
weeklyLostStores012: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周流失门店请输入两位数字' }
}
},
/** 本周新店新增业绩 */
weeklyNewStoreRevenue012: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周新店新增业绩请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周新店新增业绩请输入仅有两位小数的数字' }
}
},
/** 本月门店产值目标 */
monthlyStoreOutputTarget012: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店产值目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店产值目标请输入仅有两位小数的数字' }
}
},
/** 本月门店累计达成 */
monthlyStoreCumulativeAchievement012: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店累计达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店累计达成请输入仅有两位小数的数字' }
}
},
/** 本月时间进度 */
monthlyTimeProgress012: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月时间进度请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月时间进度请输入仅有两位小数的数字' }
}
},
/** 本月产值达成率 */
monthlyOutputAchievementRate012: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月产值达成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值达成率请输入仅有两位小数的数字' }
}
},
/** 本月达成差距 */
monthlyAchievementGap012: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月达成差距请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月达成差距请输入仅有两位小数的数字' }
}
},
},
/** 人员问题 */
personnelIssues012: {
/** 本周入职人数 */
weeklyNewHires012: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周入职人数请输入两位数字' }
}
},
/** 本周离职人数 */
weeklyDepartures012: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周离职人数请输入两位数字' }
}
},
/** 本周待招人数 */
weeklyPendingRecruitment012: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周待招人数请输入两位数字' }
}
},
},
/** 业绩报告 */
performanceReport013: {
/** 本周启动门店 */
weeklyStartedStores013: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周启动门店请输入两位数字' }
}
},
/** 本周流失门店 */
weeklyLostStores013: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周流失门店请输入两位数字' }
}
},
/** 本周新店新增业绩 */
weeklyNewStoreRevenue013: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周新店新增业绩请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周新店新增业绩请输入仅有两位小数的数字' }
}
},
/** 本月门店产值目标 */
monthlyStoreOutputTarget013: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店产值目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店产值目标请输入仅有两位小数的数字' }
}
},
/** 本月门店累计达成 */
monthlyStoreCumulativeAchievement013: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店累计达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店累计达成请输入仅有两位小数的数字' }
}
},
/** 本月时间进度 */
monthlyTimeProgress013: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月时间进度请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月时间进度请输入仅有两位小数的数字' }
}
},
/** 本月产值达成率 */
monthlyOutputAchievementRate013: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月产值达成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值达成率请输入仅有两位小数的数字' }
}
},
/** 本月达成差距 */
monthlyAchievementGap013: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月达成差距请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月达成差距请输入仅有两位小数的数字' }
}
},
},
/** 人员问题 */
personnelIssues013: {
/** 本周入职人数 */
weeklyNewHires013: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周入职人数请输入两位数字' }
}
},
/** 本周离职人数 */
weeklyDepartures013: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周离职人数请输入两位数字' }
}
},
/** 本周待招人数 */
weeklyPendingRecruitment013: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周待招人数请输入两位数字' }
}
},
},
/** 业绩报告 */
performanceReport014: {
/** 本周启动门店 */
weeklyStartedStores014: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周启动门店请输入两位数字' }
}
},
/** 本周流失门店 */
weeklyLostStores014: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周流失门店请输入两位数字' }
}
},
/** 本周新店新增业绩 */
weeklyNewStoreRevenue014: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周新店新增业绩请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周新店新增业绩请输入仅有两位小数的数字' }
}
},
/** 本月门店产值目标 */
monthlyStoreOutputTarget014: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店产值目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店产值目标请输入仅有两位小数的数字' }
}
},
/** 本月门店累计达成 */
monthlyStoreCumulativeAchievement014: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月门店累计达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月门店累计达成请输入仅有两位小数的数字' }
}
},
/** 本月时间进度 */
monthlyTimeProgress014: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月时间进度请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月时间进度请输入仅有两位小数的数字' }
}
},
/** 本月产值达成率 */
monthlyOutputAchievementRate014: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月产值达成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值达成率请输入仅有两位小数的数字' }
}
},
/** 本月达成差距 */
monthlyAchievementGap014: {
ruleFn: (rule, value) => {
const maxValue = 100
if (value < 0 || value > maxValue) {
return { message: `本月达成差距请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月达成差距请输入仅有两位小数的数字' }
}
},
},
/** 人员问题 */
personnelIssues014: {
/** 本周入职人数 */
weeklyNewHires014: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周入职人数请输入两位数字' }
}
},
/** 本周离职人数 */
weeklyDepartures014: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周离职人数请输入两位数字' }
}
},
/** 本周待招人数 */
weeklyPendingRecruitment014: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '本周待招人数请输入两位数字' }
}
},
},
/** 2.1运营主管周报 - 业绩报告 */
performanceReport015: {
/** 本周交车 */
weeklyCarDelivery015: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周交车请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周交车请输入五位数字' }
}
},
/** 本周触客 */
weeklyCustomerContact015: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周触客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周触客请输入五位数字' }
}
},
/** 本周成交 */
weeklyTransaction015: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周成交请输入五位数字' }
}
},
/** 本周产值 */
weeklyOutput015: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周产值请输入仅有两位小数的数字' }
}
},
/** 本月谈客 */
monthlyCustomerTalk015: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction015: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput015: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
}
},
/** 1.1运营主管周报 - 业绩报告 */
performanceReport016: {
/** 本周交车 */
weeklyCarDelivery016: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周交车请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周交车请输入五位数字' }
}
},
/** 本周触客 */
weeklyCustomerContact016: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周触客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周触客请输入五位数字' }
}
},
/** 本周成交 */
weeklyTransaction016: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周成交请输入五位数字' }
}
},
/** 本周产值 */
weeklyOutput016: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周产值请输入仅有两位小数的数字' }
}
},
/** 本月谈客 */
monthlyCustomerTalk016: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction016: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput016: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
}
},
/** 2.3运营主管周报 - 业绩报告 */
performanceReport017: {
/** 本周交车 */
weeklyCarDelivery017: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周交车请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周交车请输入五位数字' }
}
},
/** 本周触客 */
weeklyCustomerContact017: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周触客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周触客请输入五位数字' }
}
},
/** 本周成交 */
weeklyTransaction017: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本周成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本周成交请输入五位数字' }
}
},
/** 本周产值 */
weeklyOutput017: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本周产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本周产值请输入仅有两位小数的数字' }
}
},
/** 本月谈客 */
monthlyCustomerTalk017: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction017: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput017: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
}
},
/** 1.1 区域经理月报模版 - 运营策略及结果总结 */
currentMonthOperationStrategyResult018: {
/** 直营门店 */
directStores018: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '直营门店请输入两位数字' }
}
},
/** 目标 */
target018: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '目标请输入仅有两位小数的数字' }
}
},
/** 实际达成 */
actualAchievement018: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `实际达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '实际达成请输入仅有两位小数的数字' }
}
},
/** 完成率 */
completionRate018: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `完成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '完成率请输入仅有两位小数的数字' }
}
}
},
/** 2.3 区域经理月报模版 - 运营策略及结果总结 */
currentMonthOperationStrategyResult020: {
/** 直营门店 */
directStores020: {
ruleFn: (rule, value) => {
return /^$|^\d{1}$|^[1-9]\d{0,1}$/.test(value) ? null : { message: '直营门店请输入两位数字' }
}
},
/** 目标 */
target020: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `目标请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '目标请输入仅有两位小数的数字' }
}
},
/** 实际达成 */
actualAchievement020: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `实际达成请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '实际达成请输入仅有两位小数的数字' }
}
},
/** 完成率 */
completionRate020: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `完成率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '完成率请输入仅有两位小数的数字' }
}
}
},
/** 2.1运营主管月报模版 - 业绩报告 */
performanceReport021: {
/** 本月谈客 */
monthlyCustomerTalk021: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction021: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput021: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
},
/** 本月成交率 */
monthlyTransactionRate021: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交率请输入仅有两位小数的数字' }
}
}
},
/** 1.1运营主管月报模版 - 业绩报告 */
performanceReport022: {
/** 本月谈客 */
monthlyCustomerTalk022: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction022: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput022: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
},
/** 本月成交率 */
monthlyTransactionRate022: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交率请输入仅有两位小数的数字' }
}
}
},
/** 2.3运营主管月报模版 - 业绩报告 */
performanceReport023: {
/** 本月谈客 */
monthlyCustomerTalk023: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月谈客请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月谈客请输入五位数字' }
}
},
/** 本月成交 */
monthlyTransaction023: {
ruleFn: (rule, value) => {
const maxValue = 10000
if (value < 0 || value > maxValue) {
return { message: `本月成交请输入0-${maxValue}` }
}
return /^$|^\d{1}$|^[1-9]\d{0,4}$/.test(value) ? null : { message: '本月成交请输入五位数字' }
}
},
/** 本月产值 */
monthlyOutput023: {
ruleFn: (rule, value) => {
const maxValue = 100000000
if (value < 0 || value > maxValue) {
return { message: `本月产值请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月产值请输入仅有两位小数的数字' }
}
},
/** 本月成交率 */
monthlyTransactionRate023: {
ruleFn: (rule, value) => {
const maxValue = 999
if (value < 0 || value > maxValue) {
return { message: `本月成交率请输入0-${maxValue}` }
}
return /^$|^[0]$|^\d{1}(\.\d{1,2})$|^([1-9]\d*)(\.\d{1,2})?$/.test(value) ? null : { message: '本月成交率请输入仅有两位小数的数字' }
}
}
},
/** 工作总结 */ /** 工作总结 */
workReport: {} workReport: {}
/** 工作总结 */ /** 工作总结 */
......
...@@ -12,7 +12,6 @@ import { ...@@ -12,7 +12,6 @@ import {
} from '~/store/index' } from '~/store/index'
const app = getApp() const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
* selectWeek 0代表的本周 1代表下一周 -1代表上一周 * selectWeek 0代表的本周 1代表下一周 -1代表上一周
...@@ -27,22 +26,29 @@ Page({ ...@@ -27,22 +26,29 @@ Page({
isTodayEdit: false, isTodayEdit: false,
// userInfo: {}, // userInfo: {},
// 轻改区域日报模版code // 轻改区域日报模版code
qgReportCode: null, // qgReportCode: null,
title: '', title: "",
// 模版表单提交数据 // 模版表单提交数据
tmlpFormData: {}, tmlpFormData: {},
timeBean: {}, timeBean: {},
selectWeek: 0, selectWeek: 0,
tabActive: '', tabActive: "",
tabList: [], tabList: [],
dataAttrName: 'tmlpFormData', dataAttrName: "tmlpFormData",
dailyReportTempList: ["qinggai-temp-001", "uuid-temp-001", "uuid-temp-011"],
/** 模版表单数据对象 /** 模版表单数据对象
* { 模版key: [ 模版下面的表单项数据对象 ] } * { 模版key: [ 模版下面的表单项数据对象 ] }
*/ */
tmlpObj: null, tmlpObj: null,
// 往日可编辑的模版 // 往日可编辑的模版
tmlpEditList: [], tmlpEditList: [],
tmlpCode: '', tmlpCode: "",
routeParams: {},
titleTxtObj: {
daily: "工作日报",
weekly: "工作周报",
monthly: "工作月报",
},
/** 模版表单数据对象验证规则对象 /** 模版表单数据对象验证规则对象
* { 模版key: [ 模版下面的表单项数据对象 ] } * { 模版key: [ 模版下面的表单项数据对象 ] }
*/ */
...@@ -53,11 +59,11 @@ Page({ ...@@ -53,11 +59,11 @@ Page({
tmlpItemObj: {}, tmlpItemObj: {},
isLoading: false, isLoading: false,
// 适配不同“带教配置”模版字段,organizeTraining/organizeTraining_1/organizeTraining_2 // 适配不同“带教配置”模版字段,organizeTraining/organizeTraining_1/organizeTraining_2
trainTmlpSuffix: '', trainTmlpSuffix: "",
imgObj: { imgObj: {
trainingPhotos: [], trainingPhotos: [],
trainingPhotos_1: [], trainingPhotos_1: [],
trainingPhotos_2: [] trainingPhotos_2: [],
}, },
mutiOption: { mutiOption: {
attendingStaff: {}, attendingStaff: {},
...@@ -70,98 +76,132 @@ Page({ ...@@ -70,98 +76,132 @@ Page({
staffCheckList: [], staffCheckList: [],
staffCheckList_1: [], staffCheckList_1: [],
staffCheckList_2: [], staffCheckList_2: [],
currentYear: new Date().getFullYear(),
selectedMonth: new Date().getMonth() + 1,
weekList: [],
selectedWeek: 1,
monthList: [],
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if(options.refresh) { console.log(options, "-----");
this.setData({ const { titleTxtObj } = this.data;
qgReportCode: options?.templateCode || null, if (options.refresh) {
title: options?.templateCode ? '轻改区域日报' : '延保区域日报' const { routeParams } = this.data;
}) console.log(routeParams, "----");
this.initData(options) this.initData(options);
} }
wx.$router.getData((route) => { wx.$router.getData((route) => {
console.log(route, "route");
const routeParams = route?.params || {};
this.setData({ this.setData({
qgReportCode: route?.params?.templateCode || null, routeParams: routeParams,
title: route?.params?.templateCode ? '轻改区域日报' : '延保区域日报' tmlpCode: routeParams.code || null,
}) reportType: routeParams.reportType || 1,
this.initData(options) title: titleTxtObj[routeParams.reportTypeAttr || "daily"],
}) });
this.initData(options);
});
}, },
async initData(options) { async initData(options) {
// 获取配置服务数据 const { routeParams } = this.data;
let baseConfigData = await setConfigInfo(app.globalData) // 获取配置服务数据
this.setData({ let baseConfigData = await setConfigInfo(app.globalData);
tmlpEditList: baseConfigData?.dailyTmlpEditList?.map(item => item.code) this.setData({
}) tmlpEditList: baseConfigData?.dailyTmlpEditList?.map((item) => item.code),
// 初始化日期 });
this.setData({
reportDate: options.reportDate, if (routeParams.reportTypeAttr === "weekly") {
timeBean: util.getWeekDayList(this.data.selectWeek), const { currentYear, selectedMonth } = this.data;
isChangeTab: true try {
}); const res = await api.getMonthCalWeek({
this.resetTempData() yearWithMonth: currentYear + String(selectedMonth).padStart(2, "0"),
this.getRecordDetail() });
this.setData({ const list = Array.isArray(res) ? res : res.data || [];
flag: true, const now = new Date();
}); const today = now.format("yyyyMMdd");
const currentWeekItem = list.find(
(item) => today >= item.startDateStr && today <= item.endDateStr
);
if (currentWeekItem) {
this.setData({ selectedWeek: currentWeekItem.weekNumber });
}
} catch (e) {
console.error(e);
}
}
// 初始化日期
this.setData({
reportDate: options.reportDate,
timeBean: util.getWeekDayList(this.data.selectWeek),
isChangeTab: true,
});
this.resetTempData();
this.getRecordDetail();
this.setData({
flag: true,
});
}, },
dealOrganizeTraining() { dealOrganizeTraining() {
let { trainTmlpSuffix } = this.data let { trainTmlpSuffix } = this.data;
const params = { const params = {
target: { target: {
id: 'organizeTraining' + trainTmlpSuffix id: "organizeTraining" + trainTmlpSuffix,
}, },
detail: { detail: {
attr: 'isTrainingOrganized' + trainTmlpSuffix attr: "isTrainingOrganized" + trainTmlpSuffix,
} },
} };
this.radioEvent(params) this.radioEvent(params);
}, },
radioEvent(e) { radioEvent(e) {
let pAttr = e.target.id let pAttr = e.target.id;
let { let { attr } = e.detail;
attr let { tmlpFormData, tmlpObj, trainTmlpSuffix, tmlpCode, dailyReportTempList } = this.data;
} = e.detail tmlpObj["organizeTraining" + trainTmlpSuffix]?.forEach((item) => {
let { tmlpFormData, tmlpObj, trainTmlpSuffix, tmlpCode } = this.data if (!item.name.includes("isTrainingOrganized")) {
tmlpObj['organizeTraining' + trainTmlpSuffix]?.forEach(item => { item.isHide = tmlpFormData[attr] == "否" ? true : false;
if (!item.name.includes('isTrainingOrganized')) {
item.isHide = tmlpFormData[attr] == '否' ? true : false
} }
}) });
if (allRuleObj[pAttr] && pAttr == ('organizeTraining' + trainTmlpSuffix)) { if (allRuleObj[pAttr] && pAttr == "organizeTraining" + trainTmlpSuffix) {
let keyList = Object.keys(allRuleObj[pAttr]) let keyList = Object.keys(allRuleObj[pAttr]);
keyList.forEach(item => { keyList.forEach((item) => {
if (item != ('isTrainingOrganized' + trainTmlpSuffix) && allRuleObj[pAttr][item]) { if (
allRuleObj[pAttr][item][0].required = tmlpFormData[attr] == '否' ? false : true item != "isTrainingOrganized" + trainTmlpSuffix &&
allRuleObj[pAttr][item]
) {
allRuleObj[pAttr][item][0].required =
tmlpFormData[attr] == "否" ? false : true;
} }
}) });
} }
const pAttrList = Object.keys(allRuleObj) const pAttrList = Object.keys(allRuleObj);
console.log(tmlpCode, 'pAttrList---') console.log(tmlpCode, "pAttrList---");
if (['qinggai-temp-001', 'uuid-temp-001'].includes(tmlpCode)) { if (dailyReportTempList.includes(tmlpCode)) {
pAttrList.forEach(pAttrItem => { pAttrList.forEach((pAttrItem) => {
tmlpObj[pAttrItem].forEach(item => { tmlpObj[pAttrItem].forEach((item) => {
if (!item.name.includes('dayOffStatus')) { if (!item.name.includes("dayOffStatus")) {
item.required = tmlpFormData['dayOffStatus'] == '是' ? false : true item.required = tmlpFormData["dayOffStatus"] == "是" ? false : true;
} }
}) });
let keyList = Object.keys(allRuleObj[pAttrItem]) let keyList = Object.keys(allRuleObj[pAttrItem]);
keyList.forEach(item => { keyList.forEach((item) => {
if (item != 'dayOffStatus' && allRuleObj[pAttrItem][item]) { if (item != "dayOffStatus" && allRuleObj[pAttrItem][item]) {
allRuleObj[pAttrItem][item][0].required = tmlpFormData['dayOffStatus'] == '是' ? false : true allRuleObj[pAttrItem][item][0].required =
tmlpFormData["dayOffStatus"] == "是" ? false : true;
} }
}) });
}) });
} }
console.log(tmlpObj, attr) console.log(tmlpObj, attr);
this.setData({ this.setData({
tmlpObj tmlpObj,
}) });
}, },
jump() { jump() {
...@@ -175,173 +215,387 @@ Page({ ...@@ -175,173 +215,387 @@ Page({
}, },
onClickShow(e) { onClickShow(e) {
const { name } = e.target.dataset const { name } = e.target.dataset;
this.setData({ imgShow: true, imgName: name }) this.setData({ imgShow: true, imgName: name });
}, },
onClickHide() { onClickHide() {
this.setData({ imgShow: false }) this.setData({ imgShow: false });
}, },
resetTempData() { resetTempData() {
allRuleObj = {} allRuleObj = {};
this.setData({ this.setData({
tmlpInitData: null, tmlpInitData: null,
tmlpFormData: {}, tmlpFormData: {},
tmlpObj: null, tmlpObj: null,
selectedStr: '', selectedStr: "",
selectTxt: '' selectTxt: "",
}) });
}, },
/** 查询用户指定日期的日报详情 */ /** 查询用户指定日期的日报详情 */
getRecordDetail() { async getRecordDetail() {
let { timeBean, qgReportCode } = this.data let {
timeBean,
tmlpCode,
routeParams,
dateObj,
currentYear,
selectedMonth,
} = this.data;
let params = { let params = {
date: timeBean.weekDayList[timeBean.selectDay].date templateCode: tmlpCode,
date: timeBean.weekDayList[timeBean.selectDay].date,
};
if (routeParams.reportTypeAttr == "monthly") {
// 月报取当月最后一天
const lastDay = new Date(currentYear, selectedMonth, 0).getDate();
params.date = `${currentYear}-${String(selectedMonth).padStart(
2,
"0"
)}-${String(lastDay).padStart(2, "0")}`;
} }
if(qgReportCode) { if (routeParams.reportTypeAttr == "weekly") {
params.templateCode = qgReportCode // 周报取当月最后一天
const resList = await api.getMonthCalWeek({
yearWithMonth: currentYear + String(selectedMonth).padStart(2, "0"),
});
console.log(resList, "res---");
const weekItem = (resList?.data || []).find(
(w) => w.weekNumber == this.data.selectedWeek
);
console.log(weekItem, this.data.selectedWeek, "weekItem--");
if (weekItem) {
params.date = weekItem.endDateStr.replace(
/^(\d{4})(\d{2})(\d{2})$/,
"$1-$2-$3"
);
}
} }
wx.$util.showLoading() wx.$util.showLoading();
api.getRecordDetail(params).then(res => { api
if (res.data == null) { .getRecordDetail(params)
this.resetTempData(); .then((res) => {
if (res.data == null) {
this.resetTempData();
this.setData({
isChangeTab: false,
});
return true;
}
this.setData({ this.setData({
isChangeTab: false, // tmlpCode: res.data.templateCode,
tmlpInitData: res.data.types,
}); });
return true; this.getDynamicForm();
} this.setReportDate();
this.setData({ })
tmlpCode: res.data.templateCode, .finally(() => {
tmlpInitData: res.data.types, wx.hideLoading();
}); });
this.getDynamicForm();
this.setReportDate();
}).finally(() => {
wx.hideLoading()
})
}, },
/** 查询用户指定日期范围内填写日报的日期 */ /** 查询用户指定日期范围内填写日报的日期 */
getDateRecord() { async getDateRecord() {
let { timeBean, isDisable, tmlpEditList, tmlpCode, qgReportCode } = this.data let {
console.log(tmlpEditList, 'tmlpEditList') timeBean,
console.log(tmlpCode, 'tmlpCode') isDisable,
tmlpEditList,
tmlpCode,
routeParams,
currentYear,
selectedMonth,
selectedWeek,
dailyReportTempList
} = this.data;
console.log(tmlpEditList, "tmlpEditList");
console.log(tmlpCode, "tmlpCode");
const apiName = {
daily: "getDateRecord",
weekly: "getWeeklyRecordDetail",
monthly: "getMonthlyRecordDetail",
};
// console.log(timeBean.weekDayList, 'timeBean.weekDayList--') // console.log(timeBean.weekDayList, 'timeBean.weekDayList--')
let params = { let params = {};
sDate: timeBean.reportStartDate, switch (routeParams.reportTypeAttr) {
eDate: timeBean.reportEndDate case "daily":
} params = {
if(qgReportCode) { sDate: timeBean.reportStartDate,
params.templateCode = qgReportCode eDate: timeBean.reportEndDate,
templateCode: tmlpCode,
};
break;
case "weekly":
params = {
yearWithMonth: currentYear + String(selectedMonth).padStart(2, "0"),
code: tmlpCode,
};
break;
case "monthly":
params = {
year: currentYear,
code: tmlpCode,
};
break;
} }
this.setData({ this.setData({
hasDailyValue: false, hasDailyValue: false,
isTodayEdit: ['qinggai-temp-001', 'uuid-temp-001'].includes(tmlpCode) isTodayEdit: dailyReportTempList.includes(tmlpCode),
}) });
wx.$util.showLoading() wx.$util.showLoading();
api.getDateRecord(params).then(res => {
console.log(res, 'res-----') // For weekly, we also need the week definitions
let list = res.data || [] let weekDefinitions = [];
list.forEach(item => { if (routeParams.reportTypeAttr === "weekly") {
let currDate = new Date(item).format('yyyy-MM-dd') try {
let idx = timeBean.weekDayList.findIndex(k => k.date == currDate) let weekRes = await api.getMonthCalWeek({
if (idx != -1) { yearWithMonth: currentYear + String(selectedMonth).padStart(2, "0"),
timeBean.weekDayList[idx].hasDailyValue = true });
} weekDefinitions = weekRes.data || [];
}) } catch (e) {
if (timeBean.weekDayList[timeBean.selectDay].date == new Date().format('yyyy-MM-dd')) { console.error(e);
//改----------------
this.setData({
isDisable: timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false,
hasDailyValue: timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false
})
} else if (tmlpEditList.includes(tmlpCode)) {
// 往期编辑
this.setData({
isDisable: timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false
})
} }
this.setData({ }
timeBean
api[apiName[routeParams.reportTypeAttr || "daily"]](params)
.then((res) => {
console.log(res, "res-----");
if (routeParams.reportTypeAttr === "monthly") {
let list = res.data || [];
let monthList = [];
const now = new Date();
const currentYear = now.getFullYear();
const currentMonth = now.getMonth() + 1;
const selectedYear = this.data.currentYear;
for (let i = 1; i <= 12; i++) {
let item = list.find((m) => m.month == i) || {};
// 判断是否是未来月份
let isFutureMonth = false;
if (selectedYear > currentYear) {
isFutureMonth = true;
} else if (selectedYear === currentYear && i > currentMonth) {
isFutureMonth = true;
}
// 只要不是未来月份,都可以点击
let disabled = isFutureMonth;
monthList.push({
month: i,
beAbleSubmit: item.beAbleSubmit,
disabled: disabled,
hasSubmit: item.hasSubmit === true,
});
}
this.setData({ monthList });
let currentMonthData = monthList.find(
(m) => m.month == this.data.selectedMonth
);
if (currentMonthData) {
const isCurrentMonth =
selectedYear === currentYear &&
this.data.selectedMonth === currentMonth;
let updates = {};
// If not current month, remove edit capability (hides Modify button)
if (!isCurrentMonth) {
updates.isTodayEdit = false;
}
if (currentMonthData.hasSubmit) {
updates.isDisable = true;
updates.hasDailyValue = true;
// If submitted and can be submitted (editable), allow modify
// Prioritize beAbleSubmit from API
if (currentMonthData.beAbleSubmit === true) {
updates.isTodayEdit = true;
} else {
updates.isTodayEdit = false;
}
} else {
// Disable if future (disabled) OR if API says not able to submit
let disable = currentMonthData.disabled;
if (!disable) {
// If clickable, check API beAbleSubmit status
// Default to disabled if beAbleSubmit is not explicitly true
disable = currentMonthData.beAbleSubmit !== true;
}
updates.isDisable = disable;
updates.hasDailyValue = false;
updates.isTodayEdit = false;
}
this.setData(updates);
}
} else if (routeParams.reportTypeAttr === "weekly") {
let list = Array.isArray(res) ? res : res.data || [];
let weekList = [];
if (weekDefinitions && weekDefinitions.length) {
weekDefinitions.forEach((def) => {
let item = list.find((l) => l.weekCode == def.weekCode) || {};
// Simple future check using end date
const now = new Date();
const today = now.format("yyyyMMdd"); // Compare with string format
let isFuture = false;
if (def.startDateStr > today) {
isFuture = true;
}
let disabled = isFuture;
weekList.push({
week: def.weekNumber,
label:
def.displayText || `${selectedMonth}月第${def.weekNumber}周`,
beAbleSubmit: item.beAbleSubmit,
disabled: disabled,
hasSubmit: item.hasSubmit === true,
});
});
}
this.setData({ weekList });
let currentWeekData = weekList.find(
(w) => w.week == this.data.selectedWeek
);
if (currentWeekData) {
let updates = {};
// Prioritize local disabled (future) check + API beAbleSubmit
let canOperate =
!currentWeekData.disabled &&
currentWeekData.beAbleSubmit === true;
if (canOperate) {
if (currentWeekData.hasSubmit) {
// Submitted -> Show Modify
updates.isDisable = true;
updates.hasDailyValue = true;
updates.isTodayEdit = true;
} else {
// Not submitted -> Show Submit
updates.isDisable = false;
updates.hasDailyValue = false;
updates.isTodayEdit = false;
}
} else {
// Cannot operate -> Read Only
updates.isDisable = true;
updates.hasDailyValue = currentWeekData.hasSubmit;
updates.isTodayEdit = false;
}
this.setData(updates);
}
} else {
let list = res.data || [];
list.forEach((item) => {
let currDate = new Date(item).format("yyyy-MM-dd");
let idx = timeBean.weekDayList.findIndex((k) => k.date == currDate);
if (idx != -1) {
timeBean.weekDayList[idx].hasDailyValue = true;
}
});
if (
timeBean.weekDayList[timeBean.selectDay].date ==
new Date().format("yyyy-MM-dd")
) {
//改----------------
this.setData({
isDisable:
timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false,
hasDailyValue:
timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false,
});
} else if (tmlpEditList.includes(tmlpCode)) {
// 往期编辑
this.setData({
isDisable:
timeBean.weekDayList[timeBean.selectDay].hasDailyValue || false,
});
}
this.setData({
timeBean,
});
}
}) })
}).finally(() => { .finally(() => {
wx.hideLoading() wx.hideLoading();
}) });
}, },
handleInput(e) { handleInput(e) {
let value = e.detail let value = e.detail;
let { let { attr } = e.target.dataset;
attr let { trainTmlpSuffix } = this.data;
} = e.target.dataset
let { trainTmlpSuffix } = this.data
this.setData({ this.setData({
['tmlpFormData.' + attr + trainTmlpSuffix]: value ["tmlpFormData." + attr + trainTmlpSuffix]: value,
}) });
}, },
// 图片上传 // 图片上传
upLoad(event) { upLoad(event) {
let _this = this let _this = this;
const { file } = event.detail const { file } = event.detail;
const { attr, idx } = event.currentTarget.dataset const { attr, idx } = event.currentTarget.dataset;
let { imgObj, trainTmlpSuffix } = this.data let { imgObj, trainTmlpSuffix } = this.data;
let tempFiles = file?.url let tempFiles = file?.url;
let imgType = tempFiles.split('.')[1] let imgType = tempFiles.split(".")[1];
let type = imgType == 'unknown' ? 'jpg' : imgType let type = imgType == "unknown" ? "jpg" : imgType;
wx.getFileSystemManager().readFile({ wx.getFileSystemManager().readFile({
filePath: tempFiles, //选择图片返回的相对路径 filePath: tempFiles, //选择图片返回的相对路径
encoding: 'base64', //编码格式 encoding: "base64", //编码格式
success(_res) { success(_res) {
wx.$util.showLoading('上传中...') wx.$util.showLoading("上传中...");
apiDefault apiDefault
.uploadImg({ .uploadImg({
file: `${type}@${_res.data}` file: `${type}@${_res.data}`,
}) })
.then(img => { .then((img) => {
wx.$util.hideLoading() wx.$util.hideLoading();
let { code, data, message } = img let { code, data, message } = img;
if (code == 0) { if (code == 0) {
// imgObj[attr].push({ url: data }) // imgObj[attr].push({ url: data })
imgObj[attr + trainTmlpSuffix][0] = { url: data } imgObj[attr + trainTmlpSuffix][0] = { url: data };
_this.setData({ _this.setData({
['tmlpFormData.' + attr + trainTmlpSuffix]: data, ["tmlpFormData." + attr + trainTmlpSuffix]: data,
imgObj imgObj,
}) });
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message);
} }
}) });
} },
}) });
}, },
// 图片删除 // 图片删除
handleDeleteImg(e) { handleDeleteImg(e) {
const { attr } = e.currentTarget.dataset const { attr } = e.currentTarget.dataset;
let { imgObj, trainTmlpSuffix } = this.data let { imgObj, trainTmlpSuffix } = this.data;
const { index } = e.detail const { index } = e.detail;
imgObj[attr + trainTmlpSuffix].splice(index, 1) imgObj[attr + trainTmlpSuffix].splice(index, 1);
this.setData({ this.setData({
imgObj imgObj,
}) });
}, },
// 与会驻店选择 // 与会驻店选择
handleStaffPicker(e) { handleStaffPicker(e) {
let { pname, name } = e.currentTarget.dataset; let { pname, name } = e.currentTarget.dataset;
let { isDisable, trainTmlpSuffix } = this.data let { isDisable, trainTmlpSuffix } = this.data;
pname = pname + trainTmlpSuffix pname = pname + trainTmlpSuffix;
name = name + trainTmlpSuffix name = name + trainTmlpSuffix;
if (isDisable) { if (isDisable) {
return true return true;
} }
let { tmlpObj, mutiOption } = this.data let { tmlpObj, mutiOption } = this.data;
const idx = tmlpObj?.[pname].findIndex(k => k.name == name) const idx = tmlpObj?.[pname].findIndex((k) => k.name == name);
mutiOption[name] = { mutiOption[name] = {
optionList: tmlpObj[pname][idx].optionList optionList: tmlpObj[pname][idx].optionList,
} };
this.setData({ this.setData({
mutiOption, mutiOption,
selectItemTitle: '与会驻店人员', selectItemTitle: "与会驻店人员",
selectPName: pname, selectPName: pname,
selectItemName: name, selectItemName: name,
showSelectItemPopup: true, showSelectItemPopup: true,
...@@ -355,108 +609,111 @@ Page({ ...@@ -355,108 +609,111 @@ Page({
tmlpFormData[selectItemName + "Txt"] = ""; tmlpFormData[selectItemName + "Txt"] = "";
} }
// 与会驻店人员的ids // 与会驻店人员的ids
tmlpFormData['staffIds' + trainTmlpSuffix] = ""; tmlpFormData["staffIds" + trainTmlpSuffix] = "";
var list = []; var list = [];
var ids = [] var ids = [];
// console.log(trainTmlpSuffix, 'trainTmlpSuffix---') // console.log(trainTmlpSuffix, 'trainTmlpSuffix---')
// console.log( this.data['staffCheckList' + trainTmlpSuffix], 'trainTmlpSuffix---') // console.log( this.data['staffCheckList' + trainTmlpSuffix], 'trainTmlpSuffix---')
this.data['staffCheckList' + trainTmlpSuffix].forEach((item) => { this.data["staffCheckList" + trainTmlpSuffix].forEach((item) => {
list.push(item.staffName); list.push(item.staffName);
ids.push(item.id) ids.push(item.id);
}); });
if (selectItemName) { if (selectItemName) {
tmlpFormData[selectItemName] = list.join(","); tmlpFormData[selectItemName] = list.join(",");
tmlpFormData[selectItemName + 'Txt'] = list.join(',') tmlpFormData[selectItemName + "Txt"] = list.join(",");
} }
tmlpFormData['staffIds' + trainTmlpSuffix] = ids.join(",") tmlpFormData["staffIds" + trainTmlpSuffix] = ids.join(",");
let selectedStr = list.slice(0, 2).join(';') let selectedStr = list.slice(0, 2).join(";");
let selectTxt = (list.length > 2 ? ';等' + list.length + '人' : '') let selectTxt = list.length > 2 ? ";等" + list.length + "人" : "";
this.setData( this.setData({
{ showSelectItemPopup: false,
showSelectItemPopup: false, tmlpFormData,
tmlpFormData, selectedStr,
selectedStr, selectTxt,
selectTxt });
}
);
}, },
staffSearch(e) { staffSearch(e) {
let { staffName } = e.detail let { staffName } = e.detail;
console.log(staffName, 'staffname') console.log(staffName, "staffname");
this.getStaffList(staffName) this.getStaffList(staffName);
}, },
click(e) { click(e) {
let { idx, item } = e.detail let { idx, item } = e.detail;
let { mutiOption, selectPName, let { mutiOption, selectPName, selectItemName, trainTmlpSuffix } =
selectItemName, trainTmlpSuffix } = this.data this.data;
let staffCheckList = this.data['staffCheckList' + trainTmlpSuffix] let staffCheckList = this.data["staffCheckList" + trainTmlpSuffix];
const checkIdx = staffCheckList.findIndex(k => k.id == item.id) const checkIdx = staffCheckList.findIndex((k) => k.id == item.id);
checkIdx == -1 ? staffCheckList.push(item) : staffCheckList.splice(checkIdx, 1) checkIdx == -1
? staffCheckList.push(item)
: staffCheckList.splice(checkIdx, 1);
this.setData({ this.setData({
[`mutiOption.${selectItemName}.optionList[${idx}].active`]: !this.data.mutiOption[selectItemName].optionList[idx].active, [`mutiOption.${selectItemName}.optionList[${idx}].active`]:
[`staffCheckList${trainTmlpSuffix}`]: staffCheckList !this.data.mutiOption[selectItemName].optionList[idx].active,
}) [`staffCheckList${trainTmlpSuffix}`]: staffCheckList,
});
this.setData({ this.setData({
showSelectItemPopup: true, showSelectItemPopup: true,
mutiOption mutiOption,
// formData, // formData,
}); });
}, },
getDynamicForm() { getDynamicForm() {
this.dealTab() this.dealTab();
}, },
tabChange(e) { tabChange(e) {
let { let { key } = e.currentTarget.dataset;
key let trainTmlpSuffix = this.fitTraninTmlp(key);
} = e.currentTarget.dataset this.setData(
let trainTmlpSuffix = this.fitTraninTmlp(key) {
this.setData({ tabActive: key,
tabActive: key, tabChange: false,
tabChange: false, trainTmlpSuffix: trainTmlpSuffix,
trainTmlpSuffix: trainTmlpSuffix, selectItemName: "attendingStaff" + trainTmlpSuffix,
selectItemName: 'attendingStaff' + trainTmlpSuffix },
}, () => { () => {
this.setData({ this.setData({
tabChange: true tabChange: true,
}) });
this.changeStaff() this.changeStaff();
this.dealOrganizeTraining() this.dealOrganizeTraining();
}) }
);
}, },
dealTab() { dealTab() {
let { tmlpInitData } = this.data let { tmlpInitData } = this.data;
let tabList = [] let tabList = [];
tmlpInitData?.forEach(item => { tmlpInitData?.forEach((item) => {
tabList.push({ tabList.push({
name: item.name, name: item.name,
key: item.key key: item.key,
}) });
}) });
this.setData({ this.setData({
tabList, tabList,
tabActive: tmlpInitData.length ? tmlpInitData[0].key : '', tabActive: tmlpInitData.length ? tmlpInitData[0].key : "",
trainTmlpSuffix: this.fitTraninTmlp(tmlpInitData.length ? tmlpInitData[0].key : '') trainTmlpSuffix: this.fitTraninTmlp(
}) tmlpInitData.length ? tmlpInitData[0].key : ""
this.dealDynamicForm() ),
});
this.dealDynamicForm();
}, },
/** /**
* 适配“带教培训”模版 * 适配“带教培训”模版
*/ */
fitTraninTmlp(tabName, matchStr = 'organizeTraining') { fitTraninTmlp(tabName, matchStr = "organizeTraining") {
let afterMatch = '' let afterMatch = "";
let index = tabName.indexOf(matchStr); let index = tabName.indexOf(matchStr);
if (index !== -1) { if (index !== -1) {
// 获取匹配字符串后面的所有字符 // 获取匹配字符串后面的所有字符
afterMatch = tabName.substring(index + matchStr.length); afterMatch = tabName.substring(index + matchStr.length);
} }
return afterMatch return afterMatch;
}, },
/** /**
...@@ -465,52 +722,59 @@ Page({ ...@@ -465,52 +722,59 @@ Page({
dealDynamicForm() { dealDynamicForm() {
// imgObj.trainingPhotos, selectedStr // imgObj.trainingPhotos, selectedStr
this.setData({ this.setData({
tmlpObj: null tmlpObj: null,
}) });
wx.$util.showLoading() wx.$util.showLoading();
let { tmlpInitData, tabList, imgObj, selectedStr, selectTxt, timeBean } = this.data let { tmlpInitData, tabList, imgObj, selectedStr, selectTxt, timeBean } =
this.data;
// console.log(tabList, 'tabList--') // console.log(tabList, 'tabList--')
// tmlpObj // tmlpObj
var obj = {} var obj = {};
var tempTmlpItemObj = {} var tempTmlpItemObj = {};
let tmlpFormData = {} let tmlpFormData = {};
imgObj.trainingPhotos = [] imgObj.trainingPhotos = [];
imgObj.trainingPhotos_1 = [] imgObj.trainingPhotos_1 = [];
imgObj.trainingPhotos_2 = [] imgObj.trainingPhotos_2 = [];
selectedStr = '' selectedStr = "";
selectTxt = '' selectTxt = "";
// var ruleObj = {} // var ruleObj = {}
tabList.forEach(val => { tabList.forEach((val) => {
let list = [] let list = [];
allRuleObj[val.key] = {} allRuleObj[val.key] = {};
// 模版的表单项 // 模版的表单项
tempTmlpItemObj[val.key] = {} tempTmlpItemObj[val.key] = {};
let trainSuffix = '' let trainSuffix = "";
// 带教培训后缀适配 // 带教培训后缀适配
if (val.key.includes('organizeTraining')) { if (val.key.includes("organizeTraining")) {
trainSuffix = this.fitTraninTmlp(val.key) trainSuffix = this.fitTraninTmlp(val.key);
} }
let formList = tmlpInitData.find(k => k.key == val.key)?.items || [] let formList = tmlpInitData.find((k) => k.key == val.key)?.items || [];
formList.forEach((k, kIdx) => { formList.forEach((k, kIdx) => {
// console.log(k.frontRule, 'k.frontRule--') // console.log(k.frontRule, 'k.frontRule--')
var frontConfig = JSON.parse(k.frontRule) var frontConfig = JSON.parse(k.frontRule);
// console.log(frontConfig, 'frontConfig--') // console.log(frontConfig, 'frontConfig--')
if (k.key.includes('attendingStaff')) { if (k.key.includes("attendingStaff")) {
this.data['staffCheckList' + trainSuffix] = k.value ? k.value.split(',').map(item => { return { staffName: item } }) : [] this.data["staffCheckList" + trainSuffix] = k.value
? k.value.split(",").map((item) => {
return { staffName: item };
})
: [];
} }
if (k.key.includes('trainingPhotos') && k.value) { if (k.key.includes("trainingPhotos") && k.value) {
imgObj['trainingPhotos' + trainSuffix] = [{ url: k.value }] imgObj["trainingPhotos" + trainSuffix] = [{ url: k.value }];
} }
if (frontConfig.type == 'select') { if (frontConfig.type == "select") {
frontConfig.labelName = k.key + 'Txt' frontConfig.labelName = k.key + "Txt";
} }
if (frontConfig.type == 'slot') { if (frontConfig.type == "slot") {
frontConfig.slotName = trainSuffix ? k.key.split(trainSuffix)[0] : k.key frontConfig.slotName = trainSuffix
? k.key.split(trainSuffix)[0]
: k.key;
} }
tempTmlpItemObj[val.key][k.key] = { tempTmlpItemObj[val.key][k.key] = {
placeholder: k.placeholder, placeholder: k.placeholder,
maxlength: frontConfig.maxlength || '140' maxlength: frontConfig.maxlength || "140",
} };
list.push({ list.push({
label: k.name, label: k.name,
name: k.key, name: k.key,
...@@ -518,308 +782,350 @@ Page({ ...@@ -518,308 +782,350 @@ Page({
suffix: k.suffix, suffix: k.suffix,
type: frontConfig.type, type: frontConfig.type,
labelWidth: frontConfig.labelWidth, labelWidth: frontConfig.labelWidth,
maxlength: frontConfig.maxlength || '140', maxlength: frontConfig.maxlength || "140",
isAgreeTrim: frontConfig.isAgreeTrim || false, isAgreeTrim: frontConfig.isAgreeTrim || false,
isLabelNoLine: frontConfig.isLabelNoLine, isLabelNoLine: frontConfig.isLabelNoLine,
inputAlign: frontConfig.inputAlign || 'right', inputAlign: frontConfig.inputAlign || "right",
optionList: frontConfig.optionList || [], optionList: frontConfig.optionList || [],
optionId: frontConfig.optionId || [], optionId: frontConfig.optionId || [],
optionLabel: frontConfig.optionLabel || [], optionLabel: frontConfig.optionLabel || [],
noCellHeight: frontConfig.noCellHeight || false, noCellHeight: frontConfig.noCellHeight || false,
fieldType: frontConfig.fieldType || 'text', fieldType: frontConfig.fieldType || "text",
rows: frontConfig.rows || '1', rows: frontConfig.rows || "1",
slotName: frontConfig.slotName || k.key, slotName: frontConfig.slotName || k.key,
// select的选项合集 // select的选项合集
labelName: frontConfig.labelName, labelName: frontConfig.labelName,
inputLimit: frontConfig.inputLimit || {}, inputLimit: frontConfig.inputLimit || {},
isOnlyPc: frontConfig.isOnlyPc || false isOnlyPc: frontConfig.isOnlyPc || false,
}) });
if (!frontConfig.isOnlyPc) { if (!frontConfig.isOnlyPc) {
tmlpFormData[k.key] = k.value tmlpFormData[k.key] = k.value;
} }
if (frontConfig.type == 'select') { if (frontConfig.type == "select") {
tmlpFormData[frontConfig.labelName] = k.value tmlpFormData[frontConfig.labelName] = k.value;
} }
if (frontConfig.rule) { if (frontConfig.rule) {
allRuleObj[val.key][k.key] = JSON.parse(JSON.stringify(frontConfig.rule)) allRuleObj[val.key][k.key] = JSON.parse(
JSON.stringify(frontConfig.rule)
);
for (let i = 0; i < allRuleObj[val.key][k.key].length; i++) { for (let i = 0; i < allRuleObj[val.key][k.key].length; i++) {
let temp = allRuleObj[val.key][k.key] let temp = allRuleObj[val.key][k.key];
if (temp[i]?.required) { if (temp[i]?.required) {
list[kIdx].required = true list[kIdx].required = true;
} }
if (temp[i]?.validator) { if (temp[i]?.validator) {
if (tempRuleFnObj[val.key] && tempRuleFnObj[val.key][k.key] && tempRuleFnObj[val.key][k.key][temp[i]?.validator]) { if (
allRuleObj[val.key][k.key][i].validator = tempRuleFnObj[val.key][k.key][temp[i].validator] tempRuleFnObj[val.key] &&
tempRuleFnObj[val.key][k.key] &&
tempRuleFnObj[val.key][k.key][temp[i]?.validator]
) {
allRuleObj[val.key][k.key][i].validator =
tempRuleFnObj[val.key][k.key][temp[i].validator];
// console.log(allRuleObj[val.key][k.key][i].validator, 'itemRuleObj[k.key][i].validator') // console.log(allRuleObj[val.key][k.key][i].validator, 'itemRuleObj[k.key][i].validator')
} }
// temp[i]?.validator = temp[i]?.validator.replace(/\"/g, '') // temp[i]?.validator = temp[i]?.validator.replace(/\"/g, '')
} }
} }
} }
}) });
list = list.filter(m => !m.isOnlyPc) list = list.filter((m) => !m.isOnlyPc);
// console.log(allRuleObj[val.key], 'itemRuleObj---') // console.log(allRuleObj[val.key], 'itemRuleObj---')
obj[val.key] = JSON.parse(JSON.stringify(list)) obj[val.key] = JSON.parse(JSON.stringify(list));
// ruleObj[val.key] = itemRuleObj // ruleObj[val.key] = itemRuleObj
}) });
console.log(allRuleObj, 'allRuleObj') console.log(allRuleObj, "allRuleObj");
// 是否组织培训默认值 // 是否组织培训默认值
if (timeBean.weekDayList[timeBean.selectDay].date == new Date().format('yyyy-MM-dd')) { if (
timeBean.weekDayList[timeBean.selectDay].date ==
new Date().format("yyyy-MM-dd")
) {
if (obj?.organizeTraining && !tmlpFormData.isTrainingOrganized) { if (obj?.organizeTraining && !tmlpFormData.isTrainingOrganized) {
tmlpFormData.isTrainingOrganized = '是' tmlpFormData.isTrainingOrganized = "是";
} }
} }
wx.hideLoading() wx.hideLoading();
this.setData({ this.setData(
tmlpObj: obj, {
tmlpFormData, tmlpObj: obj,
tmlpItemObj: tempTmlpItemObj, tmlpFormData,
imgObj, tmlpItemObj: tempTmlpItemObj,
selectedStr, imgObj,
selectTxt, selectedStr,
isChangeTab: false, selectTxt,
staffCheckList: this.data.staffCheckList, isChangeTab: false,
staffCheckList_1: this.data.staffCheckList_1, staffCheckList: this.data.staffCheckList,
staffCheckList_2: this.data.staffCheckList_2 staffCheckList_1: this.data.staffCheckList_1,
}, () => { staffCheckList_2: this.data.staffCheckList_2,
this.getStaffList() },
// const staffIdx = obj?.organizeTraining?.findIndex(k => k.name == 'attendingStaff') || -1 () => {
// if (staffIdx != -1) { // this.getStaffList()
// this.getStaffList() // const staffIdx = obj?.organizeTraining?.findIndex(k => k.name == 'attendingStaff') || -1
// } // if (staffIdx != -1) {
let keys = Object.keys(obj) // this.getStaffList()
keys.forEach(item => { // }
let trainSuffix = this.fitTraninTmlp(item) let keys = Object.keys(obj);
let staffIdx = obj?.['organizeTraining' + trainSuffix]?.findIndex(k => k.name.includes('attendingStaff')) || -1 keys.forEach((item) => {
if (staffIdx != -1) { let trainSuffix = this.fitTraninTmlp(item);
this.getStaffList('', trainSuffix) let staffIdx =
} obj?.["organizeTraining" + trainSuffix]?.findIndex((k) =>
}) k.name.includes("attendingStaff")
this.changeStaff() ) || -1;
this.dealOrganizeTraining() if (staffIdx != -1) {
}) // this.getStaffList('', trainSuffix)
}
});
this.changeStaff();
this.dealOrganizeTraining();
}
);
}, },
getStaffList(staffName, suffix) { getStaffList(staffName, suffix) {
const { qgReportCode } = this.data const { qgReportCode } = this.data;
if(qgReportCode == 'qinggai-temp-001') { if (qgReportCode == "qinggai-temp-001") {
return true return true;
} }
var trainSuffix = suffix || this.data.trainTmlpSuffix var trainSuffix = suffix || this.data.trainTmlpSuffix;
let that = this let that = this;
let params = { let params = {
staffName: staffName, staffName: staffName,
pageNum: 1, pageNum: 1,
pageSize: 99999 pageSize: 99999,
} };
api.getStaffList(params).then(res => { api
// console.log(res, 'res-staff----') .getStaffList(params)
let { tmlpObj, mutiOption } = that.data .then((res) => {
const staffIdx = tmlpObj?.['organizeTraining' + trainSuffix]?.findIndex(k => k.name.includes('attendingStaff')) || -1 // console.log(res, 'res-staff----')
if (staffIdx != -1) { let { tmlpObj, mutiOption } = that.data;
if (this.data['staffCheckList' + trainSuffix].length) { const staffIdx =
this.data['staffCheckList' + trainSuffix].forEach(item => { tmlpObj?.["organizeTraining" + trainSuffix]?.findIndex((k) =>
let findIdx = res.data.list.findIndex(i => i.id == item.id) k.name.includes("attendingStaff")
if (findIdx != -1) { ) || -1;
res.data.list[findIdx].active = true if (staffIdx != -1) {
} if (this.data["staffCheckList" + trainSuffix].length) {
}) this.data["staffCheckList" + trainSuffix].forEach((item) => {
} let findIdx = res.data.list.findIndex((i) => i.id == item.id);
tmlpObj['organizeTraining' + trainSuffix][staffIdx].optionId = 'id' if (findIdx != -1) {
tmlpObj['organizeTraining' + trainSuffix][staffIdx].optionLabel = 'staffName' res.data.list[findIdx].active = true;
tmlpObj['organizeTraining' + trainSuffix][staffIdx].optionList = res.data.list }
mutiOption['attendingStaff' + trainSuffix] = { });
optionList: tmlpObj['organizeTraining' + trainSuffix][staffIdx].optionList }
tmlpObj["organizeTraining" + trainSuffix][staffIdx].optionId = "id";
tmlpObj["organizeTraining" + trainSuffix][staffIdx].optionLabel =
"staffName";
tmlpObj["organizeTraining" + trainSuffix][staffIdx].optionList =
res.data.list;
mutiOption["attendingStaff" + trainSuffix] = {
optionList:
tmlpObj["organizeTraining" + trainSuffix][staffIdx].optionList,
};
this.setData({
mutiOption,
tmlpObj,
});
} }
this.setData({
mutiOption,
tmlpObj
})
}
}).finally(() => {
const staffPopup = this.selectComponent("#staffPopup");
wx.$util.hideLoading()
staffPopup.setData({
isLoad: false
}) })
}) .finally(() => {
const staffPopup = this.selectComponent("#staffPopup");
wx.$util.hideLoading();
staffPopup.setData({
isLoad: false,
});
});
}, },
getPageData() { getPageData() {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance();
return thisPage?.data[this.data.dataAttrName] return thisPage?.data[this.data.dataAttrName];
}, },
dealParams() { dealParams() {
let { tmlpObj } = this.data let { tmlpObj } = this.data;
let list = Object.keys(tmlpObj) let list = Object.keys(tmlpObj);
let params = JSON.parse(JSON.stringify(this.getPageData())) let params = JSON.parse(JSON.stringify(this.getPageData()));
const changeValueAttrList = ['select'] const changeValueAttrList = ["select"];
list.forEach(item => { list.forEach((item) => {
tmlpObj[item].forEach(k => { tmlpObj[item].forEach((k) => {
if (changeValueAttrList.includes(k.type)) { if (changeValueAttrList.includes(k.type)) {
params[k.name] = params[k.labelName] params[k.name] = params[k.labelName];
delete params[k.labelName] delete params[k.labelName];
} }
}) });
}) });
let trainList = [{ let trainList = [
tmlpName: 'organizeTraining', {
isTrain: 'isTrainingOrganized' tmlpName: "organizeTraining",
}, { isTrain: "isTrainingOrganized",
tmlpName: 'organizeTraining_1', },
isTrain: 'isTrainingOrganized_1' {
}, { tmlpName: "organizeTraining_1",
tmlpName: 'organizeTraining_2', isTrain: "isTrainingOrganized_1",
isTrain: 'isTrainingOrganized_2' },
}] {
let staffIds = [] tmlpName: "organizeTraining_2",
trainList.forEach(k => { isTrain: "isTrainingOrganized_2",
let trainSuffix = this.fitTraninTmlp(k.tmlpName) },
];
let staffIds = [];
trainList.forEach((k) => {
let trainSuffix = this.fitTraninTmlp(k.tmlpName);
// 没有组织培训,需删掉的属性 // 没有组织培训,需删掉的属性
let noOrganAttrList = tmlpObj[k.tmlpName]?.map(item => { let noOrganAttrList = tmlpObj[k.tmlpName]?.map((item) => {
return item.name != k.isTrain ? item.name : '' return item.name != k.isTrain ? item.name : "";
}) });
if (params[k.isTrain] == '否') { if (params[k.isTrain] == "否") {
noOrganAttrList.forEach(item => { noOrganAttrList.forEach((item) => {
delete params[item] delete params[item];
}) });
delete params['staffIds' + trainSuffix] delete params["staffIds" + trainSuffix];
delete params['attendingStaff' + trainSuffix + 'Txt'] delete params["attendingStaff" + trainSuffix + "Txt"];
} else { } else {
staffIds = staffIds.concat(params['staffIds' + trainSuffix]?.split(',') || []) staffIds = staffIds.concat(
params["staffIds" + trainSuffix]?.split(",") || []
);
} }
}) });
params.staffIds = staffIds.join(',') params.staffIds = staffIds.join(",");
if (params.attendingStaff) { if (params.attendingStaff) {
params.attendingStaff = params.attendingStaffTxt params.attendingStaff = params.attendingStaffTxt;
delete params.attendingStaffTxt delete params.attendingStaffTxt;
} }
return JSON.stringify(params) return JSON.stringify(params);
}, },
secondConfirm(params) { secondConfirm(params) {
let that = this let that = this;
const { titleTxtObj, routeParams } = this.data;
wx.showModal({ wx.showModal({
title: "确认提示", title: "确认提示",
content: "日报提交后将触发群消息推送,是否确认提交?", content:
titleTxtObj[routeParams.reportTypeAttr || "daily"] +
"提交后将触发群消息推送,是否确认提交?",
// showCancel: false, // showCancel: false,
cancelText: '取消', // '取消 cancelText: "取消", // '取消
cancelColor: "#292D33", cancelColor: "#292D33",
confirmText: "确定", confirmText: "确定",
confirmColor: "#2C66F7", confirmColor: "#347BFF",
complete(res) { complete(res) {
if (res.confirm) { if (res.confirm) {
api.saveTempReport(params).then(res => { api
if (res.code == '0' || res.code == '-3') { .saveTempReport(params)
that.getRecordDetail() .then((res) => {
} if (res.code == "0" || res.code == "-3") {
wx.$util.showToast(res.code == '0' ? '提交成功' : res.message) that.getRecordDetail();
}).finally(() => { }
that.setData({ wx.$util.showToast(res.code == "0" ? "提交成功" : res.message);
isConfirm: false
}) })
}) .finally(() => {
that.setData({
isConfirm: false,
});
});
} else { } else {
that.setData({ that.setData({
isConfirm: false isConfirm: false,
}) });
} }
} },
}); });
}, },
validLink(formData, attr) { validLink(formData, attr) {
if (!formData[attr]) { if (!formData[attr]) {
return false return false;
} }
//https://meeting.tencent.com/crm/;无录屏 //https://meeting.tencent.com/crm/;无录屏
if (/https:\/\/meeting.tencent.com\/crm\//.test(formData[attr]) || formData[attr].includes('无录屏')) { if (
return false /https:\/\/meeting.tencent.com\/crm\//.test(formData[attr]) ||
formData[attr].includes("无录屏")
) {
return false;
} else { } else {
wx.showModal({ wx.showModal({
title: '温馨提示', title: "温馨提示",
content: '请参考示例,填写正确的录屏链接,如没有录屏链接则填写“无录屏”。', content:
confirmText: '好的', "请参考示例,填写正确的录屏链接,如没有录屏链接则填写“无录屏”。",
confirmColor: '#2C66F7', confirmText: "好的",
confirmColor: "#347BFF",
showCancel: false, showCancel: false,
success(res) { success(res) {},
} });
}) return true;
return true
} }
}, },
changeVal(attr, val) { changeVal(attr, val) {
this.setData({ this.setData({
[attr]: val [attr]: val,
}) });
}, },
handleEdit() { handleEdit() {
this.changeVal('isDisable', false) this.changeVal("isDisable", false);
}, },
handleCancel() { handleCancel() {
const { qgReportCode } = this.data // const { tmlpCode } = this.data
this.changeVal('isDisable', true) this.changeVal("isDisable", true);
this.onLoad({ refresh: true, templateCode: qgReportCode }) this.onLoad({ refresh: true });
}, },
handleConfirm() { handleConfirm() {
let { isConfirm, qgReportCode } = this.data let { isConfirm, tmlpCode } = this.data;
if (isConfirm) { if (isConfirm) {
return true return true;
} }
this.setData({ this.setData({
isConfirm: true isConfirm: true,
}) });
let formData = this.getPageData() let formData = this.getPageData();
const attrList = Object.keys(allRuleObj) const attrList = Object.keys(allRuleObj);
console.log(attrList, 'attrList----') console.log(attrList, "attrList----");
for (let i = 0; i < attrList.length; i++) { for (let i = 0; i < attrList.length; i++) {
let formRule = allRuleObj[attrList[i]] let formRule = allRuleObj[attrList[i]];
console.log(formRule, 'formRule----') console.log(formRule, "formRule----");
let validObj = fn.checkRequired(formData, formRule) let validObj = fn.checkRequired(formData, formRule);
if (validObj) { if (validObj) {
this.setData({ this.setData({
isConfirm: false isConfirm: false,
}) });
wx.$util.showToast(validObj.message) wx.$util.showToast(validObj.message);
return return;
} }
} }
let linkList = ['tencentMeetingRecordingLink', 'tencentMeetingRecordingLink_1', 'tencentMeetingRecordingLink_2'] let linkList = [
"tencentMeetingRecordingLink",
"tencentMeetingRecordingLink_1",
"tencentMeetingRecordingLink_2",
];
for (let i = 0; i < linkList.length; i++) { for (let i = 0; i < linkList.length; i++) {
if (this.validLink(formData, linkList[i])) { if (this.validLink(formData, linkList[i])) {
this.setData({ this.setData({
isConfirm: false isConfirm: false,
}) });
return return;
} }
} }
let params = { let params = {
formJson: this.dealParams() formJson: this.dealParams(),
} templateCode: tmlpCode,
if(qgReportCode) { };
params.templateCode = qgReportCode console.log(JSON.parse(params.formJson), "params-----");
}
console.log(JSON.parse(params.formJson), 'params-----')
// 删----要给新字段加校验++++ // 删----要给新字段加校验++++
// this.setData({ // this.setData({
// isConfirm: false // isConfirm: false
// }) // })
// wx.$util.showToast('提交成功') // wx.$util.showToast('提交成功')
this.secondConfirm(params) this.secondConfirm(params);
}, },
/** /**
* 点击了上一周,选择周数字减一,然后直接调用工具类中一个方法获取到数据 * 点击了上一周,选择周数字减一,然后直接调用工具类中一个方法获取到数据
*/ */
lastWeek: function (e) { lastWeek: function (e) {
let { isChangeTab } = this.data let { isChangeTab } = this.data;
if (isChangeTab) { if (isChangeTab) {
return true return true;
} }
var selectWeek = --this.data.selectWeek; var selectWeek = --this.data.selectWeek;
var timeBean = this.data.timeBean; var timeBean = this.data.timeBean;
...@@ -831,9 +1137,9 @@ Page({ ...@@ -831,9 +1137,9 @@ Page({
this.setData({ this.setData({
timeBean, timeBean,
selectWeek, selectWeek,
isChangeTab: true isChangeTab: true,
}); });
this.resetTempData() this.resetTempData();
// this.setReportDate(); // this.setReportDate();
this.getRecordDetail(); this.getRecordDetail();
// this.getStaffReport(); // this.getStaffReport();
...@@ -843,9 +1149,9 @@ Page({ ...@@ -843,9 +1149,9 @@ Page({
* 点击了下一周,选择周数字加一,然后直接调用工具类中一个方法获取到数据 * 点击了下一周,选择周数字加一,然后直接调用工具类中一个方法获取到数据
*/ */
nextWeek: function (e) { nextWeek: function (e) {
let { isChangeTab } = this.data let { isChangeTab } = this.data;
if (isChangeTab) { if (isChangeTab) {
return true return true;
} }
var selectWeek = ++this.data.selectWeek; var selectWeek = ++this.data.selectWeek;
var timeBean = this.data.timeBean; var timeBean = this.data.timeBean;
...@@ -861,9 +1167,9 @@ Page({ ...@@ -861,9 +1167,9 @@ Page({
this.setData({ this.setData({
timeBean, timeBean,
selectWeek, selectWeek,
isChangeTab: true isChangeTab: true,
}); });
this.resetTempData() this.resetTempData();
// this.setReportDate(); // this.setReportDate();
this.getRecordDetail(); this.getRecordDetail();
// this.getStaffReport(); // this.getStaffReport();
...@@ -874,35 +1180,152 @@ Page({ ...@@ -874,35 +1180,152 @@ Page({
* 选中了某一日,改变selectDay为选中日 * 选中了某一日,改变selectDay为选中日
*/ */
dayClick: function (e) { dayClick: function (e) {
let { isChangeTab } = this.data let { isChangeTab } = this.data;
if (isChangeTab) { if (isChangeTab) {
return true return true;
} }
this.setData({ this.setData({
["timeBean.selectDay"]: e.detail, ["timeBean.selectDay"]: e.detail,
isChangeTab: true, isChangeTab: true,
}); });
this.resetTempData() this.resetTempData();
// this.setReportDate(); // this.setReportDate();
this.getRecordDetail(); this.getRecordDetail();
// this.getStaffReport(); // this.getStaffReport();
}, },
// 设置报告日期 // 设置报告日期
setReportDate() { setReportDate() {
let { timeBean, tmlpFormData, templateCode } = this.data; let {
timeBean,
tmlpFormData,
templateCode,
routeParams,
currentYear,
selectedMonth,
} = this.data;
if (routeParams.reportTypeAttr === "monthly") {
let date = `${currentYear}-${String(selectedMonth).padStart(2, "0")}-01`;
this.setData({
["tmlpFormData.reportDate"]: date,
isEditReport: false,
});
this.getDateRecord();
return;
}
console.log(timeBean, "nextWeek"); console.log(timeBean, "nextWeek");
let date = timeBean.weekDayList[timeBean.selectDay].date; let date = timeBean.weekDayList[timeBean.selectDay].date;
var time = new Date(date); var time = new Date(date);
var y = time.getFullYear(); var y = time.getFullYear();
var m = time.getMonth() + 1; var m = time.getMonth() + 1;
console.log(timeBean.weekDayList[timeBean.selectDay].date, 'timeBean.weekDayList[timeBean.selectDay].date') console.log(
console.log(new Date().format('yyyy-MM-dd')) timeBean.weekDayList[timeBean.selectDay].date,
"timeBean.weekDayList[timeBean.selectDay].date"
);
console.log(new Date().format("yyyy-MM-dd"));
this.setData({ this.setData({
["timeBean.yearMonth"]: y + "-" + m, ["timeBean.yearMonth"]: y + "-" + m,
["tmlpFormData.reportDate"]: date, ["tmlpFormData.reportDate"]: date,
isEditReport: false, isEditReport: false,
isDisable: timeBean.weekDayList[timeBean.selectDay].date != new Date().format('yyyy-MM-dd') isDisable:
timeBean.weekDayList[timeBean.selectDay].date !=
new Date().format("yyyy-MM-dd"),
});
this.getDateRecord();
},
onLastMonth() {
let { currentYear, selectedMonth } = this.data;
selectedMonth--;
if (selectedMonth < 1) {
currentYear--;
selectedMonth = 12;
}
let updates = {
currentYear,
selectedMonth,
selectedWeek: 1,
tmlpInitData: null,
tmlpFormData: {},
tmlpObj: null,
selectedStr: "",
selectTxt: "",
};
this.setData(updates);
this.getDateRecord(); // Fetch week list for new month
this.getRecordDetail(); // Fetch detail for week 1
},
onNextMonth() {
let { currentYear, selectedMonth } = this.data;
selectedMonth++;
if (selectedMonth > 12) {
currentYear++;
selectedMonth = 1;
}
let updates = {
currentYear,
selectedMonth,
selectedWeek: 1,
tmlpInitData: null,
tmlpFormData: {},
tmlpObj: null,
selectedStr: "",
selectTxt: "",
};
this.setData(updates);
this.getDateRecord();
this.getRecordDetail();
},
onWeekClick(e) {
const { week } = e.detail;
this.setData({
selectedWeek: week,
isChangeTab: true,
tmlpInitData: null,
tmlpFormData: {},
tmlpObj: null,
selectedStr: "",
selectTxt: "",
}); });
this.getDateRecord() this.getRecordDetail();
},
onLastYear() {
const lastYear = this.data.currentYear - 1;
const realCurrentYear = new Date().getFullYear();
let updates = { currentYear: lastYear };
if (lastYear === realCurrentYear) {
updates.selectedMonth = new Date().getMonth() + 1;
}
this.setData(updates);
this.resetTempData();
this.getDateRecord();
this.getRecordDetail();
},
onNextYear() {
const nextYear = this.data.currentYear + 1;
const realCurrentYear = new Date().getFullYear();
let updates = { currentYear: nextYear };
if (nextYear === realCurrentYear) {
updates.selectedMonth = new Date().getMonth() + 1;
}
this.setData(updates);
this.resetTempData();
this.getDateRecord();
this.getRecordDetail();
},
onMonthClick(e) {
const { month } = e.detail;
this.setData({ selectedMonth: month, isChangeTab: true });
this.resetTempData();
this.getDateRecord();
this.getRecordDetail();
}, },
})
\ No newline at end of file \ No newline at end of file
});
\ No newline at end of file \ 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 \ 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 \ No newline at end of file
...@@ -70,7 +70,7 @@ page { ...@@ -70,7 +70,7 @@ page {
} }
.tab-item.active { .tab-item.active {
color: #2C66F7; color: #347bff;
} }
.tab-item.active::after { .tab-item.active::after {
position: absolute; position: absolute;
...@@ -79,7 +79,7 @@ page { ...@@ -79,7 +79,7 @@ page {
transform: translateX(-50%); transform: translateX(-50%);
width: 64rpx; width: 64rpx;
height: var(--fontSize4); height: var(--fontSize4);
background-color: #2C66F7; background-color: #347BFF;
content: ''; content: '';
} }
} }
...@@ -111,7 +111,7 @@ page { ...@@ -111,7 +111,7 @@ page {
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.example-btn { .example-btn {
color: #2C66F7; color: #347bff;
font-size: 24rpx; font-size: 24rpx;
margin-left: 8rpx; margin-left: 8rpx;
} }
...@@ -165,8 +165,8 @@ page { ...@@ -165,8 +165,8 @@ page {
text-align: center; text-align: center;
font-size: var(--fontSize32); font-size: var(--fontSize32);
color: #FFFFFF; color: #FFFFFF;
background: #2C66F7; background: #347BFF;
border-radius: var(--fontSize24); border-radius: var(--fontSize12);
margin: var(--fontSize126) var(--fontSize64) var(--fontSize20); margin: var(--fontSize126) var(--fontSize64) var(--fontSize20);
} }
...@@ -237,7 +237,7 @@ page { ...@@ -237,7 +237,7 @@ page {
.btns .btns-con view { .btns .btns-con view {
border: var(--fontSize2) solid #0075F9; border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24); border-radius: var(--fontSize12);
height: var(--fontSize80); height: var(--fontSize80);
box-sizing: border-box; box-sizing: border-box;
} }
...@@ -251,11 +251,11 @@ page { ...@@ -251,11 +251,11 @@ page {
.btns.two-btns .btns-con view { .btns.two-btns .btns-con view {
width: 45%; width: 45%;
border: var(--fontSize2) solid #0075F9; border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24); border-radius: var(--fontSize12);
height: var(--fontSize80); height: var(--fontSize80);
box-sizing: border-box; box-sizing: border-box;
color: #fff; color: #fff;
background-color: #2C66F7; background-color: #347BFF;
} }
.btns-con .cancel { .btns-con .cancel {
...@@ -266,7 +266,7 @@ page { ...@@ -266,7 +266,7 @@ page {
.confirm { .confirm {
border: var(--fontSize2) solid #0075F9; border: var(--fontSize2) solid #0075F9;
border-radius: var(--fontSize24); border-radius: var(--fontSize12);
height: var(--fontSize80); height: var(--fontSize80);
box-sizing: border-box; box-sizing: border-box;
} }
...@@ -275,5 +275,5 @@ page { ...@@ -275,5 +275,5 @@ page {
// width: var(--fontSize480); // width: var(--fontSize480);
width: 100%; width: 100%;
color: #fff; color: #fff;
background-color: #2C66F7; background-color: #347BFF;
} }
\ No newline at end of file \ No newline at end of file
<!--tabWorkOrder/pages/supervisorDaily/supervisorDaily.wxml--> <!--tabWorkOrder/pages/supervisorDaily/supervisorDaily.wxml-->
<view class="layout {{ flag ? 'opacity' : '' }}" v-loading="true"> <view class="layout {{ flag ? 'opacity' : '' }}" v-loading="true">
<navigation-bar bindback="jump" bindnavbarReady="navbarReady" showBack="true"> <navigation-bar bindback="jump" bindnavbarReady="navbarReady" showBack="true">
<view class="navigation-title"> <view class="navigation-title">
<view class="navigation-title-text text-hide">{{title}}</view> <view class="navigation-title-text text-hide">{{title}}</view>
</view>
</navigation-bar>
<view style="margin-top:{{ navBarHeight }}px">
<weekCalendar wx:if="{{ !routeParams.reportTypeAttr || routeParams.reportTypeAttr == 'daily' }}" timeBean="{{ timeBean }}" bind:lastWeek="lastWeek" bind:nextWeek="nextWeek" bind:dayClick="dayClick"></weekCalendar>
<monthCalendar wx:if="{{ routeParams.reportTypeAttr == 'monthly' }}" year="{{ currentYear }}" selectedMonth="{{ selectedMonth }}" monthList="{{ monthList }}" bind:lastYear="onLastYear" bind:nextYear="onNextYear" bind:monthClick="onMonthClick"></monthCalendar>
<weeklyCalendar wx:if="{{ routeParams.reportTypeAttr == 'weekly' }}" year="{{ currentYear }}" month="{{ selectedMonth }}" selectedWeek="{{ selectedWeek }}" weekList="{{ weekList }}" bind:lastMonth="onLastMonth" bind:nextMonth="onNextMonth" bind:weekClick="onWeekClick"></weeklyCalendar>
</view> </view>
</navigation-bar> <view class="main {{ isFullSucreen ? 'isFullSucreen':'' }}">
<view style="margin-top:{{ navBarHeight }}px"> <view wx:if="{{tmlpInitData.length}}" style="margin-bottom: 100px;">
<weekCalendar timeBean="{{ timeBean }}" bind:lastWeek="lastWeek" bind:nextWeek="nextWeek" bind:dayClick="dayClick"></weekCalendar> <scroll-view class="tab-box" scroll-x enable-flex scroll-with-animation>
</view> <view class="tab-item {{ tabActive == item.key ? 'active' : ''}}" wx:for="{{tabList}}" wx:key="index" bindtap="tabChange" data-key="{{item.key}}">{{item.name}}</view>
<view class="main {{ isFullSucreen ? 'isFullSucreen':'' }}"> </scroll-view>
<view wx:if="{{tmlpInitData.length}}" style="margin-bottom: 100px;"> <!-- 动态表单 -->
<scroll-view class="tab-box" scroll-x enable-flex scroll-with-animation> <view class="cust-form-box">
<view class="tab-item {{ tabActive == item.key ? 'active' : ''}}" wx:for="{{tabList}}" wx:key="index" bindtap="tabChange" data-key="{{item.key}}">{{item.name}}</view> <gl-cust-form wx:if="{{tmlpObj && tabChange}}" id="{{tabActive}}" formData="{{ tmlpFormData }}" disable="{{isDisable}}" dataAttrName="{{ dataAttrName }}" formDataList="{{ tmlpObj[tabActive] }}" bind:radioEvent="radioEvent">
</scroll-view> <!-- 与会人员 -->
<!-- 动态表单 --> <view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='attendingStaff' class="attendingStaff">
<view class="cust-form-box"> <view class="picker" bindtap="handleStaffPicker" data-name="attendingStaff" data-pname="organizeTraining">
<gl-cust-form wx:if="{{tmlpObj && tabChange}}" id="{{tabActive}}" formData="{{ tmlpFormData }}" disable="{{isDisable}}" dataAttrName="{{ dataAttrName }}" formDataList="{{ tmlpObj[tabActive] }}" bind:radioEvent="radioEvent"> <image class="pickerArrow" src="/components/images/arrow-x.png" />
<!-- 与会人员 --> <view class="flex" wx:if="{{selectedStr}}">
<view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='attendingStaff' class="attendingStaff"> <view class="text-hide">{{ selectedStr }}</view>
<view class="picker" bindtap="handleStaffPicker" data-name="attendingStaff" data-pname="organizeTraining"> <view class="selectTxt">{{selectTxt}}</view>
<image class="pickerArrow" src="/components/images/arrow-x.png" /> </view>
<view class="flex" wx:if="{{selectedStr}}"> <text class="placeholder" wx:else>点击选择</text>
<view class="text-hide">{{ selectedStr }}</view> </view>
<view class="selectTxt">{{selectTxt}}</view> </view>
</view> <!-- 腾讯会议录屏链接 -->
<text class="placeholder" wx:else>点击选择</text> <view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='tencentMeetingRecordingLink' class="meeting-box">
</view> <view class="example-tips">会议录制文件权限需设置为「所有人可查看」<text class="example-btn" bindclick="handleLookPictrue" bind:tap="onClickShow" data-name="example-meeting">示例</text></view>
</view> <view class="meeting-textarea">
<!-- 腾讯会议录屏链接 --> <van-field value="{{tmlpFormData['tencentMeetingRecordingLink' + trainTmlpSuffix]}}" hold-keyboard type="textarea" rows="4" autosize="{ minHeight: 50 }" show-word-limit placeholder="录制:驻店人员预定的会议 录指纹键:http://meeting.tencent.com/crm/2rejORzKc560" maxlength="100" disabled="{{isDisable}}" data-attr="tencentMeetingRecordingLink" bindinput="handleInput" />
<view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='tencentMeetingRecordingLink' class="meeting-box"> </view>
<view class="example-tips">会议录制文件权限需设置为「所有人可查看」<text class="example-btn" bindclick="handleLookPictrue" bind:tap="onClickShow" data-name="example-meeting">示例</text></view> </view>
<view class="meeting-textarea"> <!-- 培训照片 -->
<van-field value="{{tmlpFormData['tencentMeetingRecordingLink' + trainTmlpSuffix]}}" hold-keyboard type="textarea" rows="4" autosize="{ minHeight: 50 }" show-word-limit placeholder="录制:驻店人员预定的会议 录指纹键:http://meeting.tencent.com/crm/2rejORzKc560" maxlength="100" disabled="{{isDisable}}" data-attr="tencentMeetingRecordingLink" bindinput="handleInput" /> <view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='trainingPhotos' class="trainingPhotos">
</view> <view class="example-tips">线下培训上传「与会人员照片」<text class="example-btn" bind:tap="onClickShow" data-name="example-xianxia">示例</text></view>
<view class="example-tips">线上培训上传「会议上线截图」<text class="example-btn" bind:tap="onClickShow" data-name="example-xianshang">示例</text></view>
<van-uploader class="plus" file-list="{{ imgObj['trainingPhotos'+trainTmlpSuffix] }}" upload-text="上传照片" max-count="1" deletable="{{!isDisable}}" preview-size="var(--fontSize192)" disabled="{{isDisable}}" bind:after-read="upLoad" bind:delete="handleDeleteImg" data-attr="trainingPhotos"></van-uploader>
</view>
<!-- 工作总结 -->
<view wx:if="{{tabActive == 'workSummary'}}" slot='todaySummary' class="meeting-box">
<view class="meeting-textarea">
<van-field value="{{tmlpFormData.todaySummary}}" autosize hold-keyboard type="textarea" rows="4" show-word-limit placeholder="{{tmlpItemObj.workSummary.todaySummary.placeholder}}" maxlength="{{tmlpItemObj.workSummary.todaySummary.maxlength}}" disabled="{{isDisable}}" data-attr="todaySummary" bindinput="handleInput" />
</view>
</view>
<!-- 明日计划 -->
<view wx:if="{{tabActive == 'workSummary'}}" slot='tomorrowPlan' class="meeting-box">
<view class="meeting-textarea">
<van-field value="{{tmlpFormData.tomorrowPlan}}" autosize hold-keyboard type="textarea" rows="4" show-word-limit placeholder="{{tmlpItemObj.workSummary.tomorrowPlan.placeholder}}" maxlength="{{tmlpItemObj.workSummary.tomorrowPlan.maxlength}}" disabled="{{isDisable}}" data-attr="tomorrowPlan" bindinput="handleInput" />
</view>
</view>
</gl-cust-form>
</view> </view>
<!-- 培训照片 --> <view class="btns {{ isFullSucreen ? 'isFullSucreen-btn':'' }}" wx:if="{{!isDisable}}">
<view wx:if="{{tabActive == ('organizeTraining' + trainTmlpSuffix)}}" slot='trainingPhotos' class="trainingPhotos"> <view class="btns-con">
<view class="example-tips">线下培训上传「与会人员照片」<text class="example-btn" bind:tap="onClickShow" data-name="example-xianxia">示例</text></view> <view class="confirm text-center" bindtap="handleConfirm">提交</view>
<view class="example-tips">线上培训上传「会议上线截图」<text class="example-btn" bind:tap="onClickShow" data-name="example-xianshang">示例</text></view> </view>
<van-uploader class="plus" file-list="{{ imgObj['trainingPhotos'+trainTmlpSuffix] }}" upload-text="上传照片" max-count="1" deletable="{{!isDisable}}" preview-size="var(--fontSize192)" disabled="{{isDisable}}" bind:after-read="upLoad" bind:delete="handleDeleteImg" data-attr="trainingPhotos"></van-uploader>
</view>
<!-- 工作总结 -->
<view wx:if="{{tabActive == 'workSummary'}}" slot='todaySummary' class="meeting-box">
<view class="meeting-textarea">
<van-field value="{{tmlpFormData.todaySummary}}" autosize hold-keyboard type="textarea" rows="4" show-word-limit placeholder="{{tmlpItemObj.workSummary.todaySummary.placeholder}}" maxlength="{{tmlpItemObj.workSummary.todaySummary.maxlength}}" disabled="{{isDisable}}" data-attr="todaySummary" bindinput="handleInput" />
</view>
</view> </view>
<!-- 明日计划 --> <view class="btns two-btns {{ isFullSucreen ? 'isFullSucreen-btn':'' }}" wx:if="{{isTodayEdit && hasDailyValue}}">
<view wx:if="{{tabActive == 'workSummary'}}" slot='tomorrowPlan' class="meeting-box"> <view class="btns-con" wx:if="{{isDisable}}">
<view class="meeting-textarea"> <view class="confirm text-center" style="width: 100%;" bindtap="handleEdit">修改</view>
<van-field value="{{tmlpFormData.tomorrowPlan}}" autosize hold-keyboard type="textarea" rows="4" show-word-limit placeholder="{{tmlpItemObj.workSummary.tomorrowPlan.placeholder}}" maxlength="{{tmlpItemObj.workSummary.tomorrowPlan.maxlength}}" disabled="{{isDisable}}" data-attr="tomorrowPlan" bindinput="handleInput" /> </view>
</view> <view wx:else class="btns-con">
<view class="cancel text-center" bindtap="handleCancel">取消</view>
<view class="edit text-center" bindtap="handleConfirm">提交</view>
</view>
</view> </view>
</gl-cust-form>
</view>
<view class="btns {{ isFullSucreen ? 'isFullSucreen-btn':'' }}" wx:if="{{!isDisable}}">
<view class="btns-con">
<view class="confirm text-center" bindtap="handleConfirm">提交</view>
</view>
</view> </view>
<view class="btns two-btns {{ isFullSucreen ? 'isFullSucreen-btn':'' }}" wx:if="{{isTodayEdit && hasDailyValue}}"> <!-- 未配置模版 -->
<view class="btns-con" wx:if="{{isDisable}}"> <view wx:else class="empty-box">
<view class="confirm text-center" style="width: 100%;" bindtap="handleEdit">修改</view> <view>
</view> <!-- <gl-image class="icon-empty" src="/miniProgram/daily-empty.png"></gl-image> -->
<view wx:else class="btns-con"> <image class="icon-empty" src="{{IMG_URL}}empty-data.png" mode=""/>
<view class="cancel text-center" bindtap="handleCancel">取消</view> <view>总部尚未配置日报信息</view>
<view class="edit text-center" bindtap="handleConfirm">提交</view> <view class="sub-txt">请查阅其他日期或联系总部</view>
</view> </view>
</view> </view>
</view> </view>
<!-- 未配置模版 -->
<view wx:else class="empty-box">
<view>
<!-- <gl-image class="icon-empty" src="/miniProgram/daily-empty.png"></gl-image> -->
<image class="icon-empty" src="{{IMG_URL}}empty-data.png" mode=""/>
<view>总部尚未配置日报信息</view>
<view class="sub-txt">请查阅其他日期或联系总部</view>
</view>
</view>
</view>
</view> </view>
<!-- 与会人员多选 --> <!-- 与会人员多选 -->
<!-- <select-item-popup show="{{showSelectItemPopup}}" title="{{selectItemTitle}}" optionList="{{mutiOption[selectItemName].optionList}}" index="1" optionLabel="staffName" bindconfirm="changeStaff" bindcancel="closeSlectItemPopup" bindclick="click" /> --> <!-- <select-item-popup show="{{showSelectItemPopup}}" title="{{selectItemTitle}}" optionList="{{mutiOption[selectItemName].optionList}}" index="1" optionLabel="staffName" bindconfirm="changeStaff" bindcancel="closeSlectItemPopup" bindclick="click" /> -->
<select-popup show="{{showSelectItemPopup}}" id="staffPopup" title="{{selectItemTitle}}" optionList="{{mutiOption[selectItemName].optionList}}" index="1" optionLabel="staffName" bindconfirm="changeStaff" bindcancel="closeSlectItemPopup" bindclick="click" bindsearch="staffSearch"></select-popup> <select-popup show="{{showSelectItemPopup}}" id="staffPopup" title="{{selectItemTitle}}" optionList="{{mutiOption[selectItemName].optionList}}" index="1" optionLabel="staffName" bindconfirm="changeStaff" bindcancel="closeSlectItemPopup" bindclick="click" bindsearch="staffSearch"></select-popup>
<van-overlay show="{{ imgShow }}" bind:click="onClickHide" z-index="99999999"> <van-overlay show="{{ imgShow }}" bind:click="onClickHide" z-index="99999999">
<view class="wrapper"> <view class="wrapper">
<image src="{{IMG_URL}}/{{imgName}}.png" mode="widthFix" /> <image src="{{IMG_URL}}/{{imgName}}.png" mode="widthFix" />
</view> </view>
</van-overlay> </van-overlay>
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
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 { import {
getWaitAuditCountAPI, getWaitAuditCountAPI,
waitstaffstateAPI waitstaffstateAPI,
getStaffTemplate
} from '~/api/api' } from '~/api/api'
Page({ Page({
...@@ -25,18 +26,26 @@ Page({ ...@@ -25,18 +26,26 @@ Page({
icon: "resident-manage", icon: "resident-manage",
trackingCode: 'regional-assistant-resident-manage' trackingCode: 'regional-assistant-resident-manage'
}, { }, {
name: "轻改区域日报", name: "工作日报",
url: "packageWorkspace.supervisorDaily", url: "packageWorkspace.supervisorDaily",
icon: "modifications-supervisor-daily", icon: "modifications-supervisor-daily",
params: { reportTypeAttr: 'daily',
templateCode: 'qinggai-temp-001' reportTypeVal: '1',
},
trackingCode: 'regional-modifications-supervisor-daily' trackingCode: 'regional-modifications-supervisor-daily'
}, { }, {
name: "延保区域日报", name: "工作周报",
url: "packageWorkspace.supervisorDaily", url: "packageWorkspace.supervisorDaily",
icon: "warranty-supervisor-daily", icon: "modifications-supervisor-week",
trackingCode: 'regional-warranty-supervisor-daily' 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: [{ staffDevelopmentMenus: [{
name: "招聘管理", name: "招聘管理",
...@@ -49,7 +58,10 @@ Page({ ...@@ -49,7 +58,10 @@ Page({
url: "packageWorkspace.talentAnalysis", url: "packageWorkspace.talentAnalysis",
icon: "talent-analysis", icon: "talent-analysis",
trackingCode: 'regional-assistant-talent-analysis' trackingCode: 'regional-assistant-talent-analysis'
}] }],
showReportPopup: false,
reportTemplateList: [],
currentReportItem: null,
}, },
/** /**
...@@ -79,6 +91,32 @@ Page({ ...@@ -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({ ...@@ -136,19 +174,19 @@ Page({
let { staffDevelopmentMenus } = this.data let { staffDevelopmentMenus } = this.data
let index = staffDevelopmentMenus.findIndex(e => e.name == '招聘管理') let index = staffDevelopmentMenus.findIndex(e => e.name == '招聘管理')
waitstaffstateAPI() waitstaffstateAPI()
.then(result => { .then(result => {
let { let {
code, code,
data data
} = result } = result
if (code == 0) { if (code == 0) {
console.log("调统计招聘",data); console.log("调统计招聘", data);
this.setData({ this.setData({
[`staffDevelopmentMenus[${index}].tipsNum`]: data.waitProcessCount [`staffDevelopmentMenus[${index}].tipsNum`]: data.waitProcessCount
}) })
} }
}) })
.catch(err => { }) .catch(err => { })
}, },
jump(e) { jump(e) {
...@@ -159,8 +197,37 @@ Page({ ...@@ -159,8 +197,37 @@ Page({
this.throttledJump(e); // 调用节流后的函数 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) { jumpTo(e) {
let { url, query, trackingCode, params } = e.currentTarget.dataset.target 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() let userInfo = wx.$util.getUserInfo()
// 埋点 // 埋点
wx.$track.setTrackData(0, trackingCode, {}, '', userInfo?.sceneType) wx.$track.setTrackData(0, trackingCode, {}, '', userInfo?.sceneType)
...@@ -170,7 +237,7 @@ Page({ ...@@ -170,7 +237,7 @@ Page({
}) })
} }
wx.$router.go(url, { wx.$router.go(url, {
params: params || {}, params: params || {},
}) })
}, },
......
{ {
"usingComponents": {}, "usingComponents": {
"report-template-popup": "/components/report-template-popup/report-template-popup"
},
"navigationStyle": "custom" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
...@@ -44,4 +44,10 @@ ...@@ -44,4 +44,10 @@
</view> </view>
</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!