Commit 5637c169 by 张立顺

fix 需求评审功能修改

1 parent 799a320b
...@@ -513,5 +513,18 @@ module.exports = { ...@@ -513,5 +513,18 @@ module.exports = {
'dj.api.smartcarlife.goodsOrder.abnormalOrder.lock.select', 'dj.api.smartcarlife.goodsOrder.abnormalOrder.lock.select',
{} {}
) )
},
// http://localhost:8081/rop-dj-riskmanage/router//dj.api.staff.miniprogram.salaryapply.daily.report.fill.check/1.0.0
// 检查今天是否在T1-T5之间
salaryapplyFillCheck(data) {
return api.post(
'dj.api.staff.miniprogram.salaryapply.daily.report.fill.check',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
// return api.post(
// 'dj.api.staff.miniprogram.salaryapply.daily.report.fill.check'
// )
} }
} }
...@@ -61,13 +61,16 @@ var filterTemplateList = function (arr, value) { ...@@ -61,13 +61,16 @@ var filterTemplateList = function (arr, value) {
} }
} }
var filterDisabled = function (role, weeklyList, date, disabledStatus) { var filterDisabled = function (role, weeklyList, date, disabledStatus, isDynamicDateWithinRange) {
// console.log(role, weeklyList) // console.log(role, weeklyList)
if (role == 'staff') { if (role == 'staff') {
// 员工七天内可操作 // 员工七天内可操作
var isWithin =
isDynamicDateWithinRange !== undefined
? isDynamicDateWithinRange
: isDateWithin7Days(date)
return ( return (
(weeklyList.indexOf(date) > -1 && !disabledStatus) || (weeklyList.indexOf(date) > -1 && !disabledStatus) || !isWithin
!isDateWithin7Days(date)
) )
} else if (role == 'super') { } else if (role == 'super') {
// 超管60天内可操作 // 超管60天内可操作
......
// tabWorkOrder/pages/staffDaily/staffDaily.js // tabWorkOrder/pages/staffDaily/staffDaily.js
var util = require('~/utils/timeFormat/time-utils.js') var util = require('~/utils/timeFormat/time-utils.js')
import dayjs from 'dayjs'
import { import {
trafficProblemList, trafficProblemList,
skillProblemList, skillProblemList,
...@@ -438,7 +439,7 @@ Page({ ...@@ -438,7 +439,7 @@ Page({
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -448,7 +449,7 @@ Page({ ...@@ -448,7 +449,7 @@ Page({
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -580,7 +581,7 @@ Page({ ...@@ -580,7 +581,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -719,7 +720,7 @@ Page({ ...@@ -719,7 +720,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -1118,7 +1119,7 @@ Page({ ...@@ -1118,7 +1119,7 @@ Page({
sceneType: 0 sceneType: 0
}) })
const { carBandId } = await setConfigInfo({}) const { carBandId } = await setConfigInfo({})
console.log(result, carBandId, 'result') // console.log(result, carBandId, 'result')
let { code, data } = result let { code, data } = result
// let reportType = 0 // let reportType = 0
let carBandList = [] let carBandList = []
...@@ -1194,6 +1195,24 @@ Page({ ...@@ -1194,6 +1195,24 @@ Page({
} }
}) })
}, },
salaryapplyFillCheck() {
apiCon.salaryapplyFillCheck({}).then(res => {
// console.log(res, 'salaryapplyFillCheck')
if (res?.data) {
const editableDay = dayjs()
.subtract(1, 'M')
.startOf('M')
.format('YYYY-MM-DD')
this.setData({
editableDay,
['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
this.data.orderObj.reportDate,
editableDay
)
})
}
})
},
getStaffReport() { getStaffReport() {
let { let {
orderObj: { yqMerchantId, merchantId, staffUuid, reportDate }, orderObj: { yqMerchantId, merchantId, staffUuid, reportDate },
...@@ -1235,7 +1254,7 @@ Page({ ...@@ -1235,7 +1254,7 @@ Page({
return ele.firstBrandId == item.firstBrandId return ele.firstBrandId == item.firstBrandId
} }
}) })
console.log(carBand, 'carBand') // console.log(carBand, 'carBand')
if (carBand != null) { if (carBand != null) {
let { let {
firstBrandId, firstBrandId,
...@@ -1272,7 +1291,7 @@ Page({ ...@@ -1272,7 +1291,7 @@ Page({
return item return item
}) })
} }
console.log(carBandList, 'carBandList') // console.log(carBandList, 'carBandList')
if (data.approvalList) { if (data.approvalList) {
data.approvalList = data.approvalList.map(item => { data.approvalList = data.approvalList.map(item => {
let date = new Date(item.createdDate) let date = new Date(item.createdDate)
...@@ -1302,8 +1321,10 @@ Page({ ...@@ -1302,8 +1321,10 @@ Page({
hwOhterObjArray, hwOhterObjArray,
carBandList, carBandList,
formData, formData,
['orderObj.isDateWithin7Days']: ['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
util.isDateWithin7Days(reportDate), reportDate,
this.data.editableDay
),
['orderObj.isDateWithin60Days']: ['orderObj.isDateWithin60Days']:
util.isDateWithin60Days(reportDate), util.isDateWithin60Days(reportDate),
['orderObj.remark']: remark, ['orderObj.remark']: remark,
...@@ -1433,6 +1454,7 @@ Page({ ...@@ -1433,6 +1454,7 @@ Page({
: data[staffCurrent].staffName : data[staffCurrent].staffName
}) })
!value && this.getMerchantCarBandList() !value && this.getMerchantCarBandList()
!value && this.salaryapplyFillCheck()
} }
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -1442,7 +1464,7 @@ Page({ ...@@ -1442,7 +1464,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => {}) .catch(err => { })
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1544,6 +1566,7 @@ Page({ ...@@ -1544,6 +1566,7 @@ Page({
console.log(this.data.role, 'roleOther') console.log(this.data.role, 'roleOther')
if (this.data.role == 'other' || approvedSource == '3') { if (this.data.role == 'other' || approvedSource == '3') {
this.getMerchantCarBandList() this.getMerchantCarBandList()
this.salaryapplyFillCheck()
return return
} }
}) })
...@@ -1575,6 +1598,7 @@ Page({ ...@@ -1575,6 +1598,7 @@ Page({
merchantRange: [{ merchantName: shopMerchantName }] merchantRange: [{ merchantName: shopMerchantName }]
}) })
this.getMerchantCarBandList() this.getMerchantCarBandList()
this.salaryapplyFillCheck()
} }
// console.log(userInfo.isSuper, 'userInfo.isSuper') // console.log(userInfo.isSuper, 'userInfo.isSuper')
if ( if (
...@@ -1651,7 +1675,7 @@ Page({ ...@@ -1651,7 +1675,7 @@ Page({
} }
// } // }
}) })
.catch(err => {}) .catch(err => { })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1773,5 +1797,5 @@ Page({ ...@@ -1773,5 +1797,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {} onReady: function () { }
}) })
// tabWorkOrder/pages/staffDaily/staffDaily.js // tabWorkOrder/pages/staffDaily/staffDaily.js
var util = require('~/utils/timeFormat/time-utils.js') var util = require('~/utils/timeFormat/time-utils.js')
import dayjs from 'dayjs'
import { import {
trafficProblemList, trafficProblemList,
skillProblemList, skillProblemList,
...@@ -335,7 +336,7 @@ Page({ ...@@ -335,7 +336,7 @@ Page({
}, },
showStorePicker() { showStorePicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -345,7 +346,7 @@ Page({ ...@@ -345,7 +346,7 @@ Page({
}, },
showStaffPicker() { showStaffPicker() {
let { userInfo } = this.data let { userInfo } = this.data
;(userInfo?.isSuper || ; (userInfo?.isSuper ||
userInfo?.loginRole == 3 || userInfo?.loginRole == 3 ||
userInfo?.loginRole == 5) && userInfo?.loginRole == 5) &&
this.setData({ this.setData({
...@@ -476,7 +477,7 @@ Page({ ...@@ -476,7 +477,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -617,7 +618,7 @@ Page({ ...@@ -617,7 +618,7 @@ Page({
showCancel: false, showCancel: false,
confirmText: '确定', confirmText: '确定',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) {} success(res) { }
}) })
} else { } else {
// console.log(object); // console.log(object);
...@@ -1002,6 +1003,24 @@ Page({ ...@@ -1002,6 +1003,24 @@ Page({
isEditReport: false isEditReport: false
}) })
}, },
salaryapplyFillCheck() {
apiCon.salaryapplyFillCheck({}).then(res => {
// console.log(res, 'salaryapplyFillCheck')
if (res?.data) {
const editableDay = dayjs()
.subtract(1, 'M')
.startOf('M')
.format('YYYY-MM-DD')
this.setData({
editableDay,
['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
this.data.orderObj.reportDate,
editableDay
)
})
}
})
},
async getMerchantCarBandList() { async getMerchantCarBandList() {
let { orderObj, hwObjArray, otherObjArray } = this.data let { orderObj, hwObjArray, otherObjArray } = this.data
if (!orderObj.merchantId) return false if (!orderObj.merchantId) return false
...@@ -1192,8 +1211,10 @@ Page({ ...@@ -1192,8 +1211,10 @@ Page({
hwOhterObjArray, hwOhterObjArray,
carBandList, carBandList,
formData, formData,
['orderObj.isDateWithin7Days']: ['orderObj.isDateWithin7Days']: util.isDateWithin7Days(
util.isDateWithin7Days(reportDate), reportDate,
this.data.editableDay
),
['orderObj.isDateWithin60Days']: ['orderObj.isDateWithin60Days']:
util.isDateWithin60Days(reportDate), util.isDateWithin60Days(reportDate),
['orderObj.remark']: remark, ['orderObj.remark']: remark,
...@@ -1320,6 +1341,7 @@ Page({ ...@@ -1320,6 +1341,7 @@ Page({
: data[staffCurrent].staffName : data[staffCurrent].staffName
}) })
!value && this.getMerchantCarBandList() !value && this.getMerchantCarBandList()
!value && this.salaryapplyFillCheck()()
} }
} else { } else {
wx.$util.showToast(message) wx.$util.showToast(message)
...@@ -1329,7 +1351,7 @@ Page({ ...@@ -1329,7 +1351,7 @@ Page({
wx.$util.message(message) wx.$util.message(message)
} }
}) })
.catch(err => {}) .catch(err => { })
}, },
inputSearch(e) { inputSearch(e) {
let { pickerType } = this.data let { pickerType } = this.data
...@@ -1430,6 +1452,7 @@ Page({ ...@@ -1430,6 +1452,7 @@ Page({
console.log(this.data.role, 'roleOther') console.log(this.data.role, 'roleOther')
if (this.data.role == 'other' || approvedSource == '3') { if (this.data.role == 'other' || approvedSource == '3') {
this.getMerchantCarBandList() this.getMerchantCarBandList()
this.salaryapplyFillCheck()
return return
} }
}) })
...@@ -1460,6 +1483,7 @@ Page({ ...@@ -1460,6 +1483,7 @@ Page({
merchantRange: [{ merchantName: shopMerchantName }] merchantRange: [{ merchantName: shopMerchantName }]
}) })
this.getMerchantCarBandList() this.getMerchantCarBandList()
this.salaryapplyFillCheck()
} }
// console.log(userInfo.isSuper, 'userInfo.isSuper') // console.log(userInfo.isSuper, 'userInfo.isSuper')
if ( if (
...@@ -1536,7 +1560,7 @@ Page({ ...@@ -1536,7 +1560,7 @@ Page({
} }
// } // }
}) })
.catch(err => {}) .catch(err => { })
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -1649,5 +1673,5 @@ Page({ ...@@ -1649,5 +1673,5 @@ Page({
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady: function () {} onReady: function () { }
}) })
...@@ -229,13 +229,19 @@ function getWeeksDiff(startDate, endDate) { ...@@ -229,13 +229,19 @@ function getWeeksDiff(startDate, endDate) {
return weeksDiff return weeksDiff
} }
function isDateWithin7Days(date) { function isDateWithin7Days(date, limitDate) {
console.log(date, 'isDateWithin7Daysdate') // console.log(date, 'isDateWithin7Daysdate')
// console.log(date, 'date');
const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数 const oneDay = 24 * 60 * 60 * 1000 // 一天的毫秒数
const currentDate = new Date() // 当前日期 const currentDate = new Date() // 当前日期
const targetDate = new Date(date) // 给定的日期 const targetDate = new Date(date) // 给定的日期
// 如果传了限制时间,则使用限制时间判断
if (limitDate) {
const limit = new Date(limitDate)
// 比较时间戳
return targetDate.getTime() >= limit.getTime()
}
// 计算给定日期与当前日期的时间差(以毫秒为单位) // 计算给定日期与当前日期的时间差(以毫秒为单位)
const diffMilliseconds = targetDate - currentDate const diffMilliseconds = targetDate - currentDate
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!