<template>
|
<div class="app-container">
|
<!--工具栏-->
|
<div class="head-container">
|
<div>
|
<el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in users"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
<el-date-picker
|
v-model="query.attendanceDate"
|
type="daterange"
|
clearable
|
class="filter-item"
|
value-format="yyyy-MM-dd"
|
placeholder="请选择考勤日期"
|
range-separator=" ~ "
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
style="width: 285px;"
|
/>
|
<el-select v-model="query.startLocationResults" filterable clearable placeholder="开始位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in dict[lacationResules]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<el-select v-model="query.startClockResults" filterable clearable placeholder="开始打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in dict[attendanceState]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<el-select v-model="query.endLocationResults" filterable clearable placeholder="结束位置结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in dict[lacationResules]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<el-select v-model="query.endClockResults" filterable clearable placeholder="结束打卡结果" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery">
|
<el-option
|
v-for="item in dict[attendanceState]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<rrOperation />
|
</div>
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<crudOperation :permission="permission">
|
<el-button
|
slot="right"
|
size="mini"
|
type="primary"
|
icon="el-icon-timer"
|
class="filter-item"
|
:disabled="crud.selections.length !== 1"
|
@click="makeUpCardOnDuty(crud.selections[0],1)"
|
>上班补卡
|
</el-button>
|
<el-button
|
slot="right"
|
size="mini"
|
type="primary"
|
icon="el-icon-timer"
|
class="filter-item"
|
:disabled="crud.selections.length !== 1"
|
style="margin-left: 4px !important;"
|
@click="makeUpCardOnDuty(crud.selections[0],2)"
|
>下班补卡
|
</el-button>
|
<el-button
|
slot="right"
|
size="mini"
|
type="primary"
|
icon="el-icon-suitcase-1"
|
class="filter-item"
|
:disabled="crud.selections.length == null"
|
style="margin-left: 4px !important;"
|
@click="toGoOutRequest('goOut')"
|
>外出申请
|
</el-button>
|
<el-button
|
slot="right"
|
size="mini"
|
type="primary"
|
icon="el-icon-timer"
|
class="filter-item"
|
:disabled="crud.selections.length == null"
|
style="margin-left: 4px !important;"
|
@click="toGoOutRequest()"
|
>出差申请
|
</el-button>
|
<el-button
|
slot="right"
|
v-permission="permission.addAttendanceInfo"
|
size="mini"
|
type="primary"
|
icon="el-icon-plus"
|
class="filter-item"
|
:disabled="crud.selections.length == null"
|
style="margin-left: 4px !important;"
|
@click="toSupplementInfo()"
|
>考勤生成
|
</el-button>
|
</crudOperation>
|
<!--表单组件-->
|
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
|
<el-form-item label="所属员工" prop="userId">
|
<el-select v-model="form.userId" clearable filterable placeholder="请选择" style="width: 310px;" @change="getRosteTime(form)">
|
<el-option
|
v-for="item in users"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="考勤日期" prop="attendanceDate">
|
<el-date-picker v-model="form.attendanceDate" style="width: 310px;" type="date" placeholder="选择日期" @change="getRosteTime(form)" />
|
</el-form-item>
|
<el-form-item label="排班工作开始时间" prop="rosteringWorkStartTime">
|
<el-date-picker
|
v-model="form.rosteringWorkStartTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 310px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.rosteringWorkEndTime ? time.getTime() > new Date(form.rosteringWorkEndTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
|
/>
|
</el-form-item>
|
<el-form-item label="实际工作开始时间" prop="actualWorkStartTime">
|
<el-date-picker
|
v-model="form.actualWorkStartTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 310px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.actualWorkEndTime ? time.getTime() > new Date(form.actualWorkEndTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
|
/>
|
</el-form-item>
|
<el-form-item label="开始位置结果" prop="startLocationResults">
|
<el-select v-model="form.startLocationResults" style="width: 310px;">
|
<el-option
|
v-for="item in dict[lacationResules]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="开始打卡结果" prop="startClockResults">
|
<el-select v-model="form.startClockResults" style="width: 310px;">
|
<el-option
|
v-for="item in dict[attendanceState]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="排班工作结束时间" prop="rosteringWorkEndTime">
|
<el-date-picker
|
v-model="form.rosteringWorkEndTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 310px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.rosteringWorkStartTime ? time.getTime() < new Date(form.rosteringWorkStartTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
|
/>
|
</el-form-item>
|
<el-form-item label="实际工作结束时间" prop="actualWorkEndTime">
|
<el-date-picker
|
v-model="form.actualWorkEndTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 310px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.actualWorkStartTime ? time.getTime() < new Date(form.actualWorkStartTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
|
/>
|
</el-form-item>
|
<el-form-item label="结束位置结果" prop="endLocationResults">
|
<el-select v-model="form.endLocationResults" style="width: 310px;">
|
<el-option
|
v-for="item in dict[lacationResules]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="结束打卡结果" prop="endClockResults">
|
<el-select v-model="form.endClockResults" style="width: 310px;">
|
<el-option
|
v-for="item in dict[attendanceState]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="日期类型" prop="dateType">
|
<el-select v-model="form.dateType" style="width: 310px;">
|
<el-option
|
v-for="item in dict[dateType]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input v-model="form.remarks" type="textarea" rows="3" style="width: 310px;" />
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--补卡表单-->
|
<el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="makeUpCardVisible" :title="makeUpCardTitle" width="500px">
|
<el-form ref="makeUpCardForm" :model="makeUpCardForm" :rules="makeRules" size="small" label-width="80px">
|
<el-form-item label="基准时间">
|
<span>{{ makeUpCardForm.rosterTime }}</span>
|
</el-form-item>
|
<el-form-item label="补卡时间" prop="cardReplacementTime">
|
<div>
|
<label style="margin-right: 5px">日期:</label>
|
<span>{{ makeUpCardForm.checkDate }}</span>
|
</div>
|
<div>
|
<label style="margin-right: 5px">时间:</label>
|
<el-time-picker
|
v-model="makeUpCardForm.cardReplacementTime"
|
placeholder="选择时间"
|
format="HH:mm:ss"
|
value-format="HH:mm:ss"
|
style="width: 330px;"
|
/>
|
</div>
|
</el-form-item>
|
<el-form-item label="审批人" prop="approvalUserId">
|
<el-select v-model="makeUpCardForm.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in approvalUsers"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="补卡原因">
|
<el-input v-model="makeUpCardForm.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input v-model="makeUpCardForm.remarks" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="closeCard">取消</el-button>
|
<el-button :loading="makeUpCardLoading" type="primary" @click="submitMakeUpCard">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--外出表单-->
|
<el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="goOutVisible" :title="goOutTitle" width="500px">
|
<el-form ref="goOutForm" :model="goOutForm" :rules="goOutRules" size="small" label-width="80px">
|
<el-form-item label="开始时间" prop="outStartTime">
|
<el-date-picker
|
v-model="goOutForm.outStartTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 370px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return goOutForm.outEndTime ? time.getTime() > new Date(goOutForm.outEndTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workStartTime + ':00'"
|
@change="checkTime('goOut')"
|
/>
|
</el-form-item>
|
<el-form-item label="结束时间" prop="outEndTime">
|
<el-date-picker
|
v-model="goOutForm.outEndTime"
|
type="datetime"
|
placeholder="选择日期时间"
|
style="width: 370px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return goOutForm.outStartTime ? time.getTime() < new Date(goOutForm.outStartTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
:default-time="$store.state.user.user.sysRostering.workEndTime + ':00'"
|
@change="checkTime('goOut')"
|
/>
|
</el-form-item>
|
<el-form-item label="外出时长" prop="outDuration">
|
<el-input v-model="goOutForm.outDuration" disabled style="width: 370px;">
|
<template slot="append">{{ dict.label[dictLeaveTimeType][goOutForm.durationUnit] }}</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="外出类型" prop="outOfOfficeType">
|
<el-select v-model="goOutForm.outOfOfficeType" filterable clearable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in dict[dictGoOutTypr]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="审批员工" prop="approvalUserId">
|
<el-select v-model="goOutForm.approvalUserId" filterable clearable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in approvalUsers"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="外出原因">
|
<el-input v-model="goOutForm.outReason" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input v-model="goOutForm.remarks" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="closeCard">取消</el-button>
|
<el-button :loading="goSuccessLoading" type="primary" @click="submitGoOut">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--出差表单-->
|
<el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="bussVisible" :title="bussTitle" width="500px">
|
<el-form ref="bussForm" :model="bussForm" :rules="bussRules" size="small" label-width="80px">
|
<el-form-item label="开始日期" prop="travelStartTime">
|
<el-date-picker
|
v-model="bussForm.travelStartTime"
|
type="date"
|
placeholder="选择日期"
|
style="width: 370px;"
|
value-format="yyyy-MM-dd"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return bussForm.travelEndTime ? time.getTime() > new Date(bussForm.travelEndTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
@change="checkTime()"
|
/>
|
</el-form-item>
|
<el-form-item label="结束日期" prop="travelEndTime">
|
<el-date-picker
|
v-model="bussForm.travelEndTime"
|
type="date"
|
placeholder="选择日期"
|
style="width: 370px;"
|
value-format="yyyy-MM-dd"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return bussForm.travelStartTime ? time.getTime() < new Date(bussForm.travelStartTime).getTime() - 8.64e7 : false;
|
}
|
}"
|
@change="checkTime()"
|
/>
|
</el-form-item>
|
<el-form-item label="出差时长" prop="travelDuration">
|
<el-input v-model="bussForm.travelDuration" disabled style="width: 370px;">
|
<template slot="append">{{ dict.label[dictLeaveTimeType][bussForm.durationUnit] }}</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="审批员工" prop="approvalUserId">
|
<el-select v-model="bussForm.approvalUserId" filterable clearable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in approvalUsers"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="出差原因">
|
<el-input v-model="bussForm.travelReason" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="出发城市">
|
<el-input v-model="bussForm.departureCity" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="到达城市">
|
<el-input v-model="bussForm.arrivalCity" style="width: 370px;" />
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input v-model="bussForm.remarks" type="textarea" rows="3" style="width: 370px;" />
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="closeCard">取消</el-button>
|
<el-button :loading="bussSuccessLoading" type="primary" @click="submitBuss">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--考勤信息补充-->
|
<el-dialog :close-on-click-modal="false" :before-close="closeCard" :visible.sync="attendVisible" :title="attendTitle" width="500px">
|
<el-form ref="attform" :model="attform" :rules="attRules" size="small" label-width="80px">
|
<el-form-item label="考勤日期" prop="attendTime">
|
<el-date-picker
|
v-model="attform.attendTime"
|
type="date"
|
placeholder="选择日期"
|
style="width: 370px;"
|
value-format="yyyy-MM-dd"
|
align="right"
|
/>
|
</el-form-item>
|
<el-form-item label="所属员工" prop="userId">
|
<el-select v-model="attform.userId" filterable clearable placeholder="请选择" style="width: 370px;">
|
<el-option
|
v-for="item in users"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<div class="attCss" style="color: red;">*选择员工则更新选中员工的考勤信息,未选择员工则更新所有员工的考勤信息</div>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="text" @click="closeCard">取消</el-button>
|
<el-button :loading="attendLoading" type="primary" @click="submitAttendance">确认</el-button>
|
</div>
|
</el-dialog>
|
<!--表格渲染-->
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
<el-table-column type="selection" width="55" />
|
<el-table-column prop="userName" label="所属员工" fixed="left" width="100" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.userName }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="attendanceDate" label="考勤日期" fixed="left" width="100" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ crud.toDate(scope.row.attendanceDate) }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="rosteringWorkStartTime" min-width="140" label="排班工作开始时间" show-overflow-tooltip />
|
<el-table-column prop="actualWorkStartTime" min-width="140" label="实际工作开始时间" show-overflow-tooltip />
|
<el-table-column prop="startLocationResults" min-width="100" label="开始位置结果" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.startLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.startLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.startLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.startLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="startClockResults" min-width="100" label="开始打卡结果" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictEndanceStateLackOfTime" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.startClockResults === dictStartLate" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="rosteringWorkEndTime" min-width="140" label="排班工作结束时间" show-overflow-tooltip />
|
<el-table-column prop="actualWorkEndTime" min-width="140" label="实际工作结束时间" show-overflow-tooltip />
|
<el-table-column prop="endLocationResults" min-width="100" label="结束位置结果" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.endLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.endLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.endLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
|
<el-tag v-if="scope.row.endLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="endClockResults" min-width="100" label="结束打卡结果" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictEndanceStateLackOfTime" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
<el-tag v-if="scope.row.endClockResults === dictStartEarly" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="dateType" min-width="80" label="日期类型" show-overflow-tooltip>
|
<template slot-scope="scope">
|
<el-tag>{{ dict.label[dateType][scope.row.dateType] }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column prop="remarks" label="备注" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="createTime" label="创建时间" min-width="140" show-overflow-tooltip />
|
<el-table-column v-if="checkPer(['admin','attendance:edit','attendance:del'])" label="操作" width="150px" align="center" fixed="right">
|
<template slot-scope="scope">
|
<udOperation
|
:data="scope.row"
|
:permission="permission"
|
/>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!--分页组件-->
|
<pagination />
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import crudAttendance from '@/api/attendance/attendance'
|
import crudAttendanceCardreplacement from '@/api/attendance/attendanceCardreplacement'
|
import crudAttendanceGoOut from '@/api/attendance/attendanceGoOut'
|
import crudAttendanceBusinessTravel from '@/api/attendance/attendanceBusinessTravel'
|
import crudUser from '@/api/system/user'
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import rrOperation from '@crud/RR.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
import udOperation from '@crud/UD.operation'
|
import pagination from '@crud/Pagination'
|
import constant from '@/utils/constant'
|
|
const defaultForm = { id: null, userId: null, attendanceDate: null, rosteringWorkStartTime: null, actualWorkStartTime: null, startLocationResults: null, startClockResults: null, rosteringWorkEndTime: null, actualWorkEndTime: null, endLocationResults: null, endClockResults: null, dateType: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
|
export default {
|
name: 'Attendance',
|
components: { pagination, crudOperation, rrOperation, udOperation },
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
cruds() {
|
return CRUD({ title: '考勤记录', url: 'api/attendance', idField: 'id', sort: 'attendanceDate,desc', crudMethod: { ...crudAttendance }})
|
},
|
// 数据字典
|
dicts: [constant.ATTENDANCE_STATE, constant.DATE_TYPE, constant.LOCATION_RESULTS, constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.GO_OUT_TYPE],
|
data() {
|
return {
|
permission: {
|
add: ['admin', 'attendance:add'],
|
edit: ['admin', 'attendance:edit'],
|
del: ['admin', 'attendance:del'],
|
download: ['admin', 'attendance:download'],
|
addAttendanceInfo: ['admin', 'attendance:addAttendanceInfo']
|
},
|
rules: {
|
userId: [
|
{ required: true, message: '所属员工不能为空', trigger: 'change' }
|
],
|
attendanceDate: [
|
{ required: true, message: '考勤日期不能为空', trigger: 'blur' }
|
],
|
rosteringWorkStartTime: [
|
{ required: true, message: '排班工作开始时间不能为空', trigger: 'blur' }
|
],
|
rosteringWorkEndTime: [
|
{ required: true, message: '排班工作结束时间不能为空', trigger: 'blur' }
|
],
|
dateType: [
|
{ required: true, message: '日期类型不能为空', trigger: 'change' }
|
]
|
},
|
makeRules: {
|
cardReplacementTime: [
|
{ required: true, message: '补卡时间不能为空', trigger: 'change' }
|
],
|
approvalUserId: [
|
{ required: true, message: '审批人不能为空', trigger: 'change' }
|
]
|
},
|
goOutRules: {
|
outStartTime: [
|
{ required: true, message: '开始时间不能为空', trigger: 'blur' }
|
],
|
outEndTime: [
|
{ required: true, message: '结束时间不能为空', trigger: 'blur' }
|
],
|
outDuration: [
|
{ required: true, message: '外出时长不能为空', trigger: 'change' }
|
],
|
outOfOfficeType: [
|
{ required: true, message: '外出类型不能为空', trigger: 'change' }
|
],
|
approvalUserId: [
|
{ required: true, message: '审批人不能为空', trigger: 'change' }
|
]
|
},
|
bussRules: {
|
travelStartTime: [
|
{ required: true, message: '开始时间不能为空', trigger: 'blur' }
|
],
|
travelEndTime: [
|
{ required: true, message: '结束时间不能为空', trigger: 'blur' }
|
],
|
travelDuration: [
|
{ required: true, message: '出差时长不能为空', trigger: 'change' }
|
],
|
approvalUserId: [
|
{ required: true, message: '审批人不能为空', trigger: 'change' }
|
]
|
},
|
attRules: {
|
attendTime: [
|
{ required: true, message: '考勤日期不能为空', trigger: 'change' }
|
]
|
},
|
attendanceState: constant.ATTENDANCE_STATE,
|
lacationResules: constant.LOCATION_RESULTS,
|
dateType: constant.DATE_TYPE,
|
dictlocationResultsNormal: constant.LOCATION_RESULTS_NORMAL,
|
dictlocationResultsOutside: constant.LOCATION_RESULTS_OUTSIDE,
|
dictlocationResultsNotSigned: constant.LOCATION_RESULTS_NOTSIGNED,
|
dictlocationResultsRest: constant.LOCATION_RESULTS_REST,
|
dictAttendanceStateWaitFor: constant.ATTENDANCE_STATE_WAITFOR,
|
dictAttendanceStateNormal: constant.ATTENDANCE_STATE_NORMAL,
|
dictAttendanceStateNotSigned: constant.ATTENDANCE_STATE_NOTSIGNED,
|
dictAttendanceStateGoOut: constant.ATTENDANCE_STATE_GOOUT,
|
dictAttendanceStateBusiness: constant.ATTENDANCE_STATE_BUSINESS,
|
dictAttendanceStateLeave: constant.ATTENDANCE_STATE_LEAVE,
|
dictAttendanceStateRest: constant.ATTENDANCE_STATE_REST,
|
dictEndanceStateLackOfTime: constant.ATTENDANCE_STATE_LACK_OF_TIME,
|
dictStartEarly: constant.ATTENDANCE_STATE_EARLY,
|
dictStartLate: constant.ATTENDANCE_STATE_LATE,
|
users: [],
|
approvalUsers: [],
|
makeUpCardVisible: false,
|
makeUpCardLoading: false,
|
makeUpCardTitle: '',
|
makeUpCardForm: {
|
id: null,
|
userId: null,
|
approvalUserId: null,
|
cardReplacementTime: null,
|
cardReplacementReason: null,
|
approvalStatus: null,
|
approvalDescription: null,
|
cardReplacementDistinguish: null,
|
remarks: null,
|
rosterTime: null,
|
timeResult: null,
|
checkDate: null
|
},
|
goOutForm: {
|
id: null,
|
userId: null,
|
approvalUserId: null,
|
outStartTime: null,
|
outEndTime: null,
|
outDuration: null,
|
outReason: null,
|
remarks: null
|
},
|
bussForm: {
|
id: null,
|
userId: null,
|
approvalUserId: null,
|
travelStartTime: null,
|
travelEndTime: null,
|
travelDuration: null,
|
travelReason: null,
|
departureCity: null,
|
arrivalCity: null,
|
remarks: null
|
},
|
attform: {
|
attendTime: null,
|
userId: null
|
},
|
dictCardReplacementGoOn: constant.CARD_REPLACEMENT_DIFFERENTIATION_GOON,
|
dictCardReplacementOffOn: constant.CARD_REPLACEMENT_DIFFERENTIATION_GOOFF,
|
dictCardApproveStatusReviewed: constant.CARD_APPROVE_STATUS_REVIEWED,
|
goOutVisible: false,
|
goSuccessLoading: false,
|
dictLeaveTimeType: constant.LEAVE_TIME_TYPE,
|
dictGoOutTypr: constant.GO_OUT_TYPE,
|
goOutTitle: '外出申请',
|
dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR,
|
dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY,
|
bussVisible: false,
|
bussSuccessLoading: false,
|
bussTitle: '出差申请',
|
attendVisible: false,
|
attendLoading: false,
|
attendTitle: '考勤信息补充' }
|
},
|
methods: {
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
[CRUD.HOOK.beforeRefresh]() {
|
this.getUsers()
|
this.getApprovalUsers()
|
return true
|
},
|
// 查询员工
|
getUsers() {
|
crudUser.getAll().then(res => {
|
this.users = res
|
})
|
},
|
// 查询审核人
|
getApprovalUsers() {
|
crudUser.getApprovalUsers().then(res => {
|
this.approvalUsers = res
|
})
|
},
|
// 获取表格上下班排班时间
|
getRosteTime(data) {
|
if (data.userId !== null && data.attendanceDate !== null) {
|
// 根据用户id查询排班时间
|
crudUser.getAll({ id: data.userId }).then(res => {
|
this.form.rosteringWorkStartTime = new Date(this.crud.toDate(data.attendanceDate) + ' ' + res[0].sysRostering.workStartTime)
|
this.form.rosteringWorkEndTime = new Date(this.crud.toDate(data.attendanceDate) + ' ' + res[0].sysRostering.workEndTime)
|
})
|
}
|
},
|
// 补卡页面
|
makeUpCardOnDuty(data, Number) {
|
this.makeUpCardForm.checkDate = this.crud.toDate(data.attendanceDate)
|
this.makeUpCardForm.userId = data.userId
|
this.makeUpCardForm.approvalStatus = this.dictCardApproveStatusReviewed
|
// 除了超管总经理只能补自己的卡
|
crudAttendance.getUserMakeUpCard(this.makeUpCardForm.userId).then(res => {
|
// 判断上班打卡状态,给提示
|
if (Number === 1) {
|
if (data.startClockResults !== null && data.startClockResults === this.dictAttendanceStateNotSigned) {
|
this.makeUpCardTitle = '上班补卡'
|
this.makeUpCardForm.timeResult = data.startClockResults
|
this.makeUpCardForm.rosterTime = data.rosteringWorkStartTime
|
this.makeUpCardForm.cardReplacementTime = data.rosteringWorkStartTime.substring(11, 19)
|
this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementGoOn
|
this.makeUpCardVisible = true
|
} else {
|
this.crud.notify('上班无需补卡', CRUD.NOTIFICATION_TYPE.ERROR)
|
}
|
}
|
// 判断下班打卡状态,给提示
|
if (Number === 2) {
|
if (data.endClockResults !== null && data.endClockResults === this.dictAttendanceStateNotSigned) {
|
this.makeUpCardTitle = '下班补卡'
|
this.makeUpCardForm.timeResult = data.endClockResults
|
this.makeUpCardForm.rosterTime = data.rosteringWorkEndTime
|
this.makeUpCardForm.cardReplacementTime = data.rosteringWorkEndTime.substring(11, 19)
|
this.makeUpCardForm.cardReplacementDistinguish = this.dictCardReplacementOffOn
|
this.makeUpCardVisible = true
|
} else {
|
this.crud.notify('下班无需补卡', CRUD.NOTIFICATION_TYPE.ERROR)
|
}
|
}
|
}).catch(() => {
|
})
|
},
|
// 补卡提交
|
submitMakeUpCard() {
|
this.$refs['makeUpCardForm'].validate(valid => {
|
if (!valid) {
|
return
|
}
|
this.makeUpCardLoading = true
|
this.makeUpCardForm.cardReplacementTime = this.makeUpCardForm.checkDate + ' ' + this.makeUpCardForm.cardReplacementTime
|
crudAttendanceCardreplacement.add(this.makeUpCardForm).then(res => {
|
this.makeUpCardVisible = false
|
this.makeUpCardLoading = false
|
this.crud.notify('补卡提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
if (this.$refs['makeUpCardForm']) {
|
this.$refs['makeUpCardForm'].resetFields()
|
}
|
}).catch(() => {
|
this.makeUpCardLoading = false
|
})
|
})
|
},
|
// 外出和出差打开画面
|
toGoOutRequest(data) {
|
if (data === 'goOut') {
|
this.goOutVisible = true
|
this.goOutForm.durationUnit = this.dictLeaveTimeTypeHour
|
} else {
|
this.bussVisible = true
|
this.bussForm.durationUnit = this.dictLeaveTimeTypeDay
|
}
|
},
|
// 计算时长
|
checkTime(data) {
|
if (data === 'goOut') {
|
const params = JSON.stringify({
|
'outStartTime': this.goOutForm.outStartTime,
|
'outEndTime': this.goOutForm.outEndTime
|
})
|
crudAttendanceGoOut.getRemainingTime(params).then(res => {
|
this.goOutForm.outDuration = res
|
})
|
} else {
|
const params = JSON.stringify({
|
'travelStartTime': this.bussForm.travelStartTime,
|
'travelEndTime': this.bussForm.travelEndTime
|
})
|
crudAttendanceBusinessTravel.getRemainingTime(params).then(res => {
|
this.bussForm.travelDuration = res
|
})
|
}
|
},
|
// 外出提交
|
submitGoOut() {
|
this.$refs['goOutForm'].validate(valid => {
|
if (!valid) {
|
return
|
}
|
this.goSuccessLoading = true
|
crudAttendanceGoOut.add(this.goOutForm).then(res => {
|
this.goOutVisible = false
|
this.goSuccessLoading = false
|
this.crud.notify('外出提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
if (this.$refs['goOutForm']) {
|
this.$refs['goOutForm'].resetFields()
|
}
|
}).catch(() => {
|
this.goSuccessLoading = false
|
})
|
})
|
},
|
// 出差提交
|
submitBuss() {
|
this.$refs['bussForm'].validate(valid => {
|
if (!valid) {
|
return
|
}
|
this.bussSuccessLoading = true
|
crudAttendanceBusinessTravel.add(this.bussForm).then(res => {
|
this.bussVisible = false
|
this.bussSuccessLoading = false
|
this.crud.notify('出差提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
if (this.$refs['bussForm']) {
|
this.$refs['bussForm'].resetFields()
|
}
|
}).catch(() => {
|
this.bussSuccessLoading = false
|
})
|
})
|
},
|
// 考勤信息补充画面打开
|
toSupplementInfo() {
|
this.attendVisible = true
|
},
|
// 考勤信息提交
|
submitAttendance() {
|
this.$refs['attform'].validate(valid => {
|
if (!valid) {
|
return
|
}
|
this.attendLoading = true
|
var data = JSON.stringify({
|
'attendanceDate': this.attform.attendTime,
|
'userId': this.attform.userId
|
})
|
crudAttendance.addAttendanceInfo(data).then(res => {
|
this.attendVisible = false
|
this.attendLoading = false
|
this.crud.notify('考勤信息提交成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.toQuery()
|
if (this.$refs['attform']) {
|
this.$refs['attform'].resetFields()
|
}
|
}).catch(() => {
|
this.attendLoading = false
|
})
|
})
|
},
|
// 关闭
|
closeCard() {
|
if (this.$refs['makeUpCardForm']) {
|
this.$refs['makeUpCardForm'].resetFields()
|
}
|
if (this.$refs['goOutForm']) {
|
this.$refs['goOutForm'].resetFields()
|
}
|
if (this.$refs['bussForm']) {
|
this.$refs['bussForm'].resetFields()
|
}
|
if (this.$refs['attform']) {
|
this.$refs['attform'].resetFields()
|
}
|
this.crud.cancelCU()
|
this.makeUpCardVisible = false
|
this.goOutVisible = false
|
this.bussVisible = false
|
this.attendVisible = false
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.attCss {
|
font-size: 12px;
|
text-align: center;
|
}
|
</style>
|