|
@@ -48,7 +48,9 @@ class PunchClocks extends Component {
|
|
|
addressLongitude: '',
|
|
|
distance: '',
|
|
|
dtails: {},
|
|
|
- data: {},
|
|
|
+ data: {
|
|
|
+ prdcList: []
|
|
|
+ },
|
|
|
loading: true,
|
|
|
isAbnormalOpen: false,
|
|
|
clockInRemarks: "",//打卡说明
|
|
@@ -233,13 +235,13 @@ class PunchClocks extends Component {
|
|
|
|
|
|
// 正常打卡
|
|
|
publicReleaseClockIn(uid) {
|
|
|
-
|
|
|
- if (this.state.dtails.status === 3) {
|
|
|
+ const { dtails } = this.state
|
|
|
+ if (dtails.status === 3) {
|
|
|
Taro.hideLoading()
|
|
|
Taro.showToast({ title: '申请已撤销,无法打卡', icon: 'none' });
|
|
|
return;
|
|
|
}
|
|
|
- if (Object.keys(this.state.dtails).length === 0) {
|
|
|
+ if (Object.keys(dtails).length === 0) {
|
|
|
Taro.hideLoading()
|
|
|
Taro.showToast({ title: '暂无公出申请,无法打卡', icon: 'none' });
|
|
|
return;
|
|
@@ -249,7 +251,7 @@ class PunchClocks extends Component {
|
|
|
Taro.showToast({ title: '定位错误,请联系管理员', icon: 'none' })
|
|
|
return;
|
|
|
}
|
|
|
- if (dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) {
|
|
|
+ if (dayjs().isBefore(dtails.releaseStarts) || dayjs().isAfter(dtails.releaseEnds)) {
|
|
|
Taro.hideLoading()
|
|
|
Taro.showToast({ title: '当前时间不在打卡时间范围内,无法打卡', icon: 'none' })
|
|
|
return;
|
|
@@ -259,6 +261,16 @@ class PunchClocks extends Component {
|
|
|
Taro.showToast({ title: '当前位置未处于可打卡范围,无法打卡', icon: 'none' })
|
|
|
return;
|
|
|
}
|
|
|
+ // if (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3)) {
|
|
|
+ // Taro.hideLoading()
|
|
|
+ // Taro.showToast({ title: '公出他人企业!需通过审核,才可打卡!', icon: 'none' });
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // if (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3)) {
|
|
|
+ // Taro.hideLoading()
|
|
|
+ // Taro.showToast({ title: '已超过合同规定时限,需审核通过,才可打卡!', icon: 'none' });
|
|
|
+ // return
|
|
|
+ // }
|
|
|
if (this.state.imgs.length === 0) {
|
|
|
Taro.hideLoading()
|
|
|
Taro.showToast({ title: '请上传打卡照片', icon: 'none' })
|
|
@@ -266,16 +278,23 @@ class PunchClocks extends Component {
|
|
|
}
|
|
|
|
|
|
publicReleaseClockIn({
|
|
|
- id: this.state.dtails.id,
|
|
|
+ id: dtails.id,
|
|
|
photoUrl: this.state.imgs.join(','),
|
|
|
clockIn: 1,
|
|
|
uid: this.state.data.uid,
|
|
|
}).then(v => {
|
|
|
Taro.hideLoading()
|
|
|
if (v.error.length === 0) {
|
|
|
- Taro.showToast({ title: '打卡成功', icon: 'none' });
|
|
|
+ Taro.showToast({
|
|
|
+ title: dtails.type == 1
|
|
|
+ ? ((dtails.techStartProcess == 1 || dtails.techStartProcess == 3)
|
|
|
+ ? '打卡成功!此次公出未通过营销审核!'
|
|
|
+ : '打卡成功!')
|
|
|
+ : '打卡成功!',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
this.imagePicker.clear();
|
|
|
- this.state.data.clockIn = 1;
|
|
|
+ this.state.data.prdcList[0].status = 1;
|
|
|
this.setState({
|
|
|
data: this.state.data,
|
|
|
imgs: []
|
|
@@ -309,7 +328,7 @@ class PunchClocks extends Component {
|
|
|
if (v.error.length === 0) {
|
|
|
Taro.showToast({ title: '打卡成功', icon: 'none' });
|
|
|
this.imagePicker.clear();
|
|
|
- this.state.data.clockIn = 2;
|
|
|
+ this.state.data.prdcList[0].status = 2;
|
|
|
this.setState({
|
|
|
data: this.state.data,
|
|
|
imgs: [],
|
|
@@ -423,6 +442,7 @@ class PunchClocks extends Component {
|
|
|
|
|
|
render() {
|
|
|
const { dtails, data } = this.state;
|
|
|
+ const newClockIn = !!data.prdcList && data.prdcList.length > 0 ? data.prdcList[0] : {};
|
|
|
return (
|
|
|
<View className='punchClock'>
|
|
|
<View className='header'>
|
|
@@ -446,16 +466,6 @@ class PunchClocks extends Component {
|
|
|
dtails.aname
|
|
|
}
|
|
|
</View>
|
|
|
- {/* <View className='address'>
|
|
|
- 公出企业:
|
|
|
- <View className='nickname'>
|
|
|
- {
|
|
|
- Object.keys(dtails).length <= 0 ?
|
|
|
- '无' :
|
|
|
- dtails.userNames
|
|
|
- }
|
|
|
- </View>
|
|
|
- </View> */}
|
|
|
<View className='types'
|
|
|
style={{ color: ["#1D4FEA", "#1E90FF", "#FF5500", "red"][dtails.type] }}
|
|
|
>
|
|
@@ -527,7 +537,7 @@ class PunchClocks extends Component {
|
|
|
<View className='userlist'>
|
|
|
<Text className='username'>
|
|
|
{data.userName}
|
|
|
- {(data.clockIn === 1 || data.clockIn === 2) && <Text style={{ color: "#72cb78" }}>(已打卡)</Text>}
|
|
|
+ {(newClockIn.status === 1 || newClockIn.status === 2) && <Text style={{ color: "#72cb78" }}>(已打卡)</Text>}
|
|
|
</Text>
|
|
|
{
|
|
|
this.state.dtails.prdList?.length > 1 &&
|
|
@@ -572,7 +582,7 @@ class PunchClocks extends Component {
|
|
|
false &&
|
|
|
<View
|
|
|
className="photographUnusual"
|
|
|
- style={{ background: data.clockIn === 1 ? "#f69c9f" : "red" }}
|
|
|
+ style={{ background: newClockIn.status === 1 ? "#f69c9f" : "red" }}
|
|
|
onClick={() => {
|
|
|
if (this.state.imgs.length === 0) {
|
|
|
Taro.hideLoading()
|
|
@@ -583,9 +593,8 @@ class PunchClocks extends Component {
|
|
|
isAbnormalOpen: true
|
|
|
})
|
|
|
}}
|
|
|
- >{(data.clockIn === 1 || data.clockIn === 2) ? "更新打卡" : "异常打卡"}</View>
|
|
|
+ >{(newClockIn.status === 1 || newClockIn.status === 2) ? "更新打卡" : "异常打卡"}</View>
|
|
|
}
|
|
|
-
|
|
|
<View className='punchClockContent'
|
|
|
onClick={() => {
|
|
|
let _this = this;
|
|
@@ -613,22 +622,35 @@ class PunchClocks extends Component {
|
|
|
}}
|
|
|
style={{
|
|
|
boxShadow:
|
|
|
+ // (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3))
|
|
|
+ // ? '1px 1px 15px 1px #828e83'
|
|
|
+ // : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3))
|
|
|
+ // ? '1px 1px 15px 1px #828e83'
|
|
|
+ // :
|
|
|
+ (!isNaN(parseInt(this.state.distance)))
|
|
|
+ && this.state.distance <= this.wxConfig.clockInRange
|
|
|
+ && this.state.distance >= 0
|
|
|
+ && !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds))
|
|
|
+ && dtails.status !== 3
|
|
|
+ ? ((newClockIn.status === 1 || newClockIn.status === 2) ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #72cb78')
|
|
|
+ : '1px 1px 15px 1px #828e83',
|
|
|
+ background:
|
|
|
+ // (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3))
|
|
|
+ // ? '#828e83'
|
|
|
+ // : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3))
|
|
|
+ // ? '#828e83'
|
|
|
+ // :
|
|
|
(!isNaN(parseInt(this.state.distance)))
|
|
|
- && this.state.distance <= this.wxConfig.clockInRange && this.state.distance >= 0 &&
|
|
|
- !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) &&
|
|
|
- dtails.status !== 3
|
|
|
- ? ((data.clockIn === 1 || data.clockIn === 2) ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #72cb78') : '1px 1px 15px 1px #828e83',
|
|
|
- background: (!isNaN(parseInt(this.state.distance)))
|
|
|
- &&
|
|
|
- this.state.distance <= this.wxConfig.clockInRange &&
|
|
|
- this.state.distance >= 0 &&
|
|
|
- !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) &&
|
|
|
- dtails.status !== 3
|
|
|
- ? ((data.clockIn === 1 || data.clockIn === 2) ? '#3f82e8' : '#72cb78') : '#828e83'
|
|
|
+ && this.state.distance <= this.wxConfig.clockInRange
|
|
|
+ && this.state.distance >= 0
|
|
|
+ && !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds))
|
|
|
+ && dtails.status !== 3
|
|
|
+ ? ((newClockIn.status === 1 || newClockIn.status === 2) ? '#3f82e8' : '#72cb78')
|
|
|
+ : '#828e83'
|
|
|
}}>
|
|
|
<View className='punchClockTitle'>
|
|
|
{
|
|
|
- (data.clockIn === 1 || data.clockIn === 2) ?
|
|
|
+ (newClockIn.status === 1 || newClockIn.status === 2) ?
|
|
|
'更新打卡' : '公出打卡'
|
|
|
}
|
|
|
</View>
|
|
@@ -655,7 +677,16 @@ class PunchClocks extends Component {
|
|
|
<Text className='stxt' onClick={this.selectArrder}>切换位置</Text>
|
|
|
</View>
|
|
|
}
|
|
|
-
|
|
|
+ {/* {
|
|
|
+ !(this.state.distance <= this.wxConfig.clockInRange && this.state.distance >= 0) ?
|
|
|
+ <View className='switchposition'>您不在打卡范围:
|
|
|
+ <Text className='stxt' onClick={this.selectArrder}>切换位置</Text>
|
|
|
+ </View> : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3)) ?
|
|
|
+ <View className='switchposition'>公出他人企业!需通过审核,才可打卡!</View>
|
|
|
+ : (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3)) ?
|
|
|
+ <View className='switchposition'>已超过合同规定时限,需审核通过,才可打卡!</View>
|
|
|
+ : null
|
|
|
+ } */}
|
|
|
<View className='map'>
|
|
|
<View className='locationContent'>
|
|
|
<View className='location' onClick={() => {
|