<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-select
|
v-model="query.approvalUserId"
|
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-select
|
v-model="query.outOfOfficeType"
|
filterable
|
clearable
|
placeholder="外出类型"
|
style="width: 185px;"
|
class="filter-item"
|
@keyup.enter.native="crud.toQuery"
|
>
|
<el-option
|
v-for="item in dict[dictGoOutTypr]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<el-select
|
v-model="query.approvalStatus"
|
filterable
|
clearable
|
placeholder="审批状态"
|
style="width: 185px;"
|
class="filter-item"
|
@keyup.enter.native="crud.toQuery"
|
>
|
<el-option
|
v-for="item in dict[dictApprovalStart]"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
<el-date-picker
|
v-model="query.outStartTime"
|
type="daterange"
|
clearable
|
class="date-item"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
placeholder="选择日期时间"
|
range-separator=" : "
|
start-placeholder="开始时间"
|
end-placeholder="开始时间"
|
@change="handleDateChange"
|
/>
|
<el-date-picker
|
v-model="query.outEndTime"
|
type="daterange"
|
clearable
|
class="date-item"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
placeholder="选择日期时间"
|
range-separator=" : "
|
start-placeholder="结束时间"
|
end-placeholder="结束时间"
|
@change="handleDateChange1"
|
/>
|
<rrOperation />
|
</div>
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<crudOperation :permission="permission">
|
<el-button
|
slot="right"
|
v-permission="permission.updateAgree"
|
class="filter-item"
|
size="mini"
|
type="primary"
|
icon="el-icon-circle-check"
|
:disabled="
|
crud.selections.length < 1 ||
|
!crud.selections.every(
|
selection => selection.approvalStatus === dictGoOutAppRev
|
)
|
"
|
style="margin-left: 4px !important;"
|
@click="toAgree(1, crud.selections)"
|
>
|
批量同意
|
</el-button>
|
<el-button
|
slot="right"
|
v-permission="permission.updateAgree"
|
class="filter-item"
|
size="mini"
|
type="primary"
|
icon="el-icon-error"
|
:disabled="
|
crud.selections.length < 1 ||
|
!crud.selections.every(
|
selection => selection.approvalStatus === dictGoOutAppRev
|
)
|
"
|
style="margin-left: 4px !important;"
|
@click="toAgree(2, crud.selections)"
|
>
|
批量拒绝
|
</el-button>
|
<el-button
|
slot="right"
|
v-permission="permission.updateAgree"
|
class="filter-item"
|
size="mini"
|
type="primary"
|
icon="el-icon-upload"
|
:disabled="crud.selections.length < 1"
|
style="margin-left: 4px !important;"
|
@click="toReflash(crud.selections)"
|
>
|
时间刷新
|
</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="110px"
|
>
|
<el-form-item label="申请人" prop="userId">
|
<el-select
|
v-model="form.userId"
|
filterable
|
clearable
|
placeholder="请选择"
|
style="width: 340px;"
|
:disabled="disabledUser(form) || form.wecomSpNo !== null"
|
>
|
<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="approvalUserId">
|
<el-select
|
v-if="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"
|
v-model="form.approvalUserId"
|
filterable
|
clearable
|
placeholder="请选择"
|
style="width: 340px;"
|
:disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn || form.wecomSpNo !== null"
|
>
|
<el-option
|
v-for="item in users"
|
:key="item.id"
|
:label="item.nickName"
|
:value="item.id"
|
/>
|
</el-select>
|
<el-select
|
v-else
|
v-model="form.approvalUserId"
|
filterable
|
clearable
|
placeholder="请选择"
|
style="width: 340px;"
|
:disabled="form.approvalStatus == dictGoOutAgree || form.approvalStatus == dictGoOutReturn || form.wecomSpNo !== null"
|
>
|
<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="外出类型" prop="outOfOfficeType">
|
<el-select
|
v-model="form.outOfOfficeType"
|
filterable
|
clearable
|
placeholder="请选择"
|
style="width: 340px;"
|
:disabled="form.wecomSpNo !== null"
|
>
|
<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="outStartTime">
|
<el-date-picker
|
v-model="form.outStartTime"
|
:type="'datetime'"
|
placeholder="选择日期时间"
|
style="width: 340px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.outEndTime
|
? time.getTime() >
|
new Date(form.outEndTime).getTime() - 8.64e7
|
: false;
|
}
|
}"
|
:default-time="
|
$store.state.user.user.sysRostering.workStartTime + ':00'
|
"
|
:disabled="
|
form.approvalStatus == dictGoOutAgree ||
|
form.approvalStatus == dictGoOutReturn ||
|
form.wecomSpNo !== null
|
"
|
@change="checkTime"
|
/>
|
</el-form-item>
|
<el-form-item label="外出结束时间" prop="outEndTime">
|
<el-date-picker
|
v-model="form.outEndTime"
|
:type="'datetime'"
|
placeholder="选择日期时间"
|
style="width: 340px;"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
align="right"
|
:picker-options="{
|
disabledDate(time) {
|
return form.outStartTime
|
? time.getTime() <
|
new Date(form.outStartTime).getTime() - 8.64e7
|
: false;
|
}
|
}"
|
:default-time="
|
$store.state.user.user.sysRostering.workEndTime + ':00'
|
"
|
:disabled="
|
form.approvalStatus == dictGoOutAgree ||
|
form.approvalStatus == dictGoOutReturn ||
|
form.wecomSpNo !== null
|
"
|
@change="checkTime"
|
/>
|
</el-form-item>
|
<el-form-item label="外出时长" prop="outDuration">
|
<el-input v-model="form.outDuration" disabled style="width: 340px;">
|
<template slot="append">{{
|
dict.label[dictLeaveTimeType][form.durationUnit]
|
}}</template>
|
</el-input>
|
</el-form-item>
|
<el-form-item label="外出原因">
|
<el-input
|
v-model="form.outReason"
|
type="textarea"
|
rows="3"
|
style="width: 340px;"
|
:disabled="
|
form.approvalStatus == dictGoOutAgree ||
|
form.approvalStatus == dictGoOutReturn ||
|
form.wecomSpNo !== null
|
"
|
/>
|
</el-form-item>
|
<el-form-item label="审批说明">
|
<el-input
|
v-model="form.approvalDescription"
|
type="textarea"
|
rows="3"
|
style="width: 340px;"
|
disabled
|
/>
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input
|
v-model="form.remarks"
|
type="textarea"
|
rows="3"
|
style="width: 340px;"
|
:disabled="
|
form.approvalStatus == dictGoOutAgree ||
|
form.approvalStatus == dictGoOutReturn ||
|
form.wecomSpNo !== null
|
"
|
/>
|
</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="外出审批"
|
width="500px"
|
>
|
<el-form
|
ref="form"
|
:model="form"
|
:rules="rules"
|
size="small"
|
label-width="110px"
|
>
|
<el-form-item label="申请人">
|
{{ form.userName }}
|
</el-form-item>
|
<el-form-item label="外出类型">
|
{{ dict.label[dictGoOutTypr][form.outOfOfficeType] }}
|
</el-form-item>
|
<el-form-item label="外出开始时间">
|
{{ form.outStartTime }}
|
</el-form-item>
|
<el-form-item label="外出结束时间">
|
{{ form.outEndTime }}
|
</el-form-item>
|
<el-form-item label="外出时长">
|
{{
|
form.outDuration +
|
"(" +
|
dict.label[dictLeaveTimeType][form.durationUnit] +
|
")"
|
}}
|
</el-form-item>
|
<el-form-item label="外出原因">
|
{{ form.outReason }}
|
</el-form-item>
|
<el-form-item
|
v-if="form.approvalStatus === dictGoOutReturn"
|
label="退回原因"
|
prop="approvalDescription"
|
>
|
<div style="color: red;">
|
*审核退回需要填写退回原因,请填写后再次点击审核退回
|
</div>
|
<el-input
|
v-model="form.approvalDescription"
|
type="textarea"
|
:rows="3"
|
style="width: 340px;"
|
/>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button
|
type="danger"
|
style="margin-right: 10px;"
|
@click="approveFunction(1, form)"
|
>审核退回</el-button>
|
<el-button
|
v-if="form.approvalStatus !== dictGoOutReturn"
|
:loading="successLoading"
|
type="success"
|
@click="approveFunction(2, form)"
|
>审核通过</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="申请人"
|
min-width="100"
|
fixed="left"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<el-tag>{{ scope.row.userName }}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="appUserName"
|
label="审批者"
|
min-width="100"
|
fixed="left"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<el-popover
|
v-if="scope.row.wecomSpNo && scope.row.event"
|
placement="right-start"
|
width="600"
|
trigger="click"
|
>
|
<approvalLine :event-data="scope.row.event" :user-list="users" />
|
<el-tag slot="reference" effect="dark">
|
<i class="el-icon-search" />
|
<span>详细</span>
|
</el-tag>
|
</el-popover>
|
|
<el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag>
|
<el-tag v-else>暂无</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="outStartTime"
|
label="外出开始时间"
|
min-width="140"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
prop="outEndTime"
|
label="外出结束时间"
|
min-width="140"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
prop="outDuration"
|
label="外出时长"
|
min-width="80"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
{{
|
scope.row.outDuration +
|
"(" +
|
dict.label[dictLeaveTimeType][scope.row.durationUnit] +
|
")"
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="outOfOfficeType"
|
label="外出类型"
|
min-width="80"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<el-tag>{{
|
dict.label[dictGoOutTypr][scope.row.outOfOfficeType]
|
}}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="outReason"
|
label="外出原因"
|
min-width="140"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
prop="approvalStatus"
|
label="审批状态"
|
min-width="80"
|
show-overflow-tooltip
|
>
|
<template slot-scope="scope">
|
<el-tag
|
v-if="scope.row.approvalStatus === dictGoOutAppRev"
|
type="warning"
|
>{{
|
dict.label[dictApprovalStart][scope.row.approvalStatus]
|
}}</el-tag>
|
<el-tag
|
v-if="scope.row.approvalStatus === dictGoOutAgree"
|
type="success"
|
>{{
|
dict.label[dictApprovalStart][scope.row.approvalStatus]
|
}}</el-tag>
|
<el-tag
|
v-if="scope.row.approvalStatus === dictGoOutReturn"
|
type="danger"
|
>{{
|
dict.label[dictApprovalStart][scope.row.approvalStatus]
|
}}</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column
|
prop="approvalDescription"
|
label="审批说明"
|
min-width="140"
|
show-overflow-tooltip
|
/>
|
<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', 'attendanceGoOut:approve'])"
|
label="审核操作"
|
width="180px"
|
align="center"
|
fixed="right"
|
>
|
<template slot-scope="scope">
|
<el-button
|
v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo"
|
v-permission="permission.approve"
|
:loading="crud.status.cu === 2"
|
size="mini"
|
type="primary"
|
icon="el-icon-s-check"
|
:disabled="
|
scope.row.approvalStatus === dictGoOutAppRev ? false : true
|
"
|
@click="toApprove(scope.row)"
|
>审核
|
</el-button>
|
<el-popover :ref="`popover_${scope.row.id}`" width="200">
|
<p>确定撤销该记录?</p>
|
<div style="text-align: right; margin: 0">
|
<el-button
|
size="mini"
|
type="primary"
|
@click="canel(scope.row)"
|
>取消</el-button>
|
<el-button
|
:loading="successLoading"
|
type="primary"
|
size="mini"
|
@click="revoke(scope.row)"
|
>确定</el-button>
|
</div>
|
<el-button
|
v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo"
|
slot="reference"
|
v-permission="permission.approve"
|
type="danger"
|
icon="el-icon-edit-outline"
|
size="mini"
|
:disabled="
|
scope.row.approvalStatus === dictGoOutAppRev ? true : false
|
"
|
>撤销
|
</el-button>
|
</el-popover>
|
<el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link>
|
</template>
|
</el-table-column>
|
<el-table-column
|
v-if="
|
checkPer(['admin', 'attendanceGoOut:edit', 'attendanceGoOut:del'])
|
"
|
label="操作"
|
width="150px"
|
align="center"
|
fixed="right"
|
>
|
<template slot-scope="scope">
|
<udOperation v-if="!scope.row.wecomSpNo" :data="scope.row" :permission="permission" />
|
<el-button
|
v-if="scope.row.wecomSpNo && user.id === scope.row.userId && scope.row.approvalStatus === dictGoOutReturn"
|
size="mini"
|
type="primary"
|
icon="el-icon-refresh-right"
|
@click="reAdd(scope.row)"
|
/>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!--分页组件-->
|
<pagination />
|
|
<cp-approval-del-dialog ref="cpApprovalDelDialog" />
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import crudAttendanceGoOut from '@/api/attendance/attendanceGoOut'
|
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import rrOperation from '@crud/RR.operation'
|
import { mapGetters } from 'vuex'
|
import crudUser from '@/api/system/user'
|
import crudOperation from '@crud/CRUD.operation'
|
import udOperation from '@crud/UD.operation'
|
import pagination from '@crud/Pagination'
|
import approvalLine from '@/components/ApprovalLine'
|
import cpApprovalDelDialog from '@/components/CpApprovalDelDialog'
|
import constant from '@/utils/constant'
|
|
const defaultForm = {
|
id: null,
|
userId: null,
|
approvalUserId: null,
|
outStartTime: null,
|
outEndTime: null,
|
outDuration: null,
|
durationUnit: null,
|
outOfOfficeType: null,
|
outReason: null,
|
approvalStatus: null,
|
approvalDescription: null,
|
remarks: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
wecomSpNo: null,
|
event: null
|
}
|
export default {
|
name: 'AttendanceGoOut',
|
components: { pagination, crudOperation, rrOperation, udOperation, approvalLine, cpApprovalDelDialog },
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
cruds() {
|
return CRUD({
|
title: '外出记录',
|
url: 'api/attendanceGoOut',
|
idField: 'id',
|
sort: 'outStartTime,desc',
|
crudMethod: { ...crudAttendanceGoOut }
|
})
|
},
|
// 数据字典
|
dicts: [
|
constant.LEAVE_TIME_TYPE,
|
constant.GO_OUT_TYPE,
|
constant.GO_OUT_APPROVE_STATUS,
|
constant.APPROVAL_SITE_TYPE
|
],
|
data() {
|
return {
|
permission: {
|
add: ['admin', 'attendanceGoOut:add'],
|
edit: ['admin', 'attendanceGoOut:edit'],
|
del: ['admin', 'attendanceGoOut:del'],
|
download: ['admin', 'attendanceGoOut:download'],
|
approve: ['admin', 'attendanceGoOut:approve'],
|
updateAgree: ['admin', 'attendanceGoOut:updateAgree']
|
},
|
rules: {
|
userId: [
|
{ required: true, message: '申请人不能为空', trigger: 'change' }
|
],
|
approvalUserId: [
|
{ required: true, message: '审批者不能为空', trigger: 'change' }
|
],
|
outStartTime: [
|
{ required: true, message: '外出开始时间不能为空', trigger: 'change' }
|
],
|
outEndTime: [
|
{ required: true, message: '外出结束时间不能为空', trigger: 'change' }
|
],
|
outDuration: [
|
{ required: true, message: '外出时长不能为空', trigger: 'blur' }
|
],
|
durationUnit: [
|
{ required: true, message: '时长单位不能为空', trigger: 'change' }
|
],
|
outOfOfficeType: [
|
{ required: true, message: '外出类型不能为空', trigger: 'change' }
|
],
|
approvalStatus: [
|
{ required: true, message: '审批状态不能为空', trigger: 'change' }
|
],
|
approvalDescription: [
|
{ required: true, message: '审批说明不能为空', trigger: 'blur' }
|
]
|
},
|
users: [],
|
approvalUsers: [],
|
dictLeaveTimeType: constant.LEAVE_TIME_TYPE,
|
dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR,
|
dictGoOutTypr: constant.GO_OUT_TYPE,
|
dictApprovalStart: constant.GO_OUT_APPROVE_STATUS,
|
dictGoOutAppRev: constant.GO_OUT_APPROVE_STATUS_REVIEWED,
|
dictGoOutAgree: constant.GO_OUT_APPROVE_STATUS_AGREE,
|
dictGoOutReturn: constant.GO_OUT_APPROVE_STATUS_REFUSE,
|
dictApprovalSiteType: constant.APPROVAL_SITE_TYPE,
|
makeUpCardVisible: false,
|
successLoading: false,
|
userRolesLevelMin: null,
|
// 角色级别:普通用户
|
roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
|
// 角色级别: 总经理
|
roleLevelGenerl: constant.ROLE_LEVEL_GENERAL,
|
// 企微审核判断
|
wecomApprovalVisible: false
|
}
|
},
|
computed: {
|
...mapGetters(['user'])
|
},
|
created() {
|
const that = this
|
that.getUsers()
|
that.getApprovalUsers()
|
that.$on('dictReady', () => {
|
const dictData = { ...that.dict }
|
const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom')
|
if (filterData.length > 0) {
|
that.wecomApprovalVisible = true
|
}
|
})
|
},
|
methods: {
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
[CRUD.HOOK.beforeRefresh]() {
|
// 用户角色级别数组
|
const userRolesLevel = this.user.roles.map(({ level }) => level)
|
// 用户最大角色级别
|
this.userRolesLevelMin = Math.min(...userRolesLevel)
|
return true
|
},
|
// 钩子:新建 - 之前
|
[CRUD.HOOK.beforeToAdd]() {
|
// 判断用户最大角色级别是否大于总经理角色:赋值
|
if (this.userRolesLevelMin > this.roleLevelGenerl) {
|
// 表单赋值
|
this.form.userId = this.user.id
|
}
|
},
|
// 钩子:删除 - 之前
|
[CRUD.HOOK.beforeDelete]() {
|
const that = this
|
if (that.crud.selections.some(selection => selection.wecomSpNo !== null && selection.wecomSpNo !== undefined && selection.wecomSpNo !== '')) {
|
that.$refs.cpApprovalDelDialog.handleOpen()
|
that.crud.delAllLoading = false
|
return false
|
}
|
return true
|
},
|
// 禁用
|
disabledUser(data) {
|
if (this.userRolesLevelMin > this.roleLevelGenerl) {
|
return true
|
}
|
if (
|
(data.approvalStatus !== null &&
|
data.approvalStatus === this.dictGoOutAgree) ||
|
data.approvalStatus === this.dictGoOutReturn
|
) {
|
return true
|
}
|
},
|
// 查询员工
|
getUsers() {
|
crudUser.getAll().then(res => {
|
this.users = res
|
})
|
},
|
// 查询审核人
|
getApprovalUsers() {
|
crudUser.getApprovalUsers().then(res => {
|
this.approvalUsers = res
|
})
|
},
|
// 设定条件查询日期结尾
|
handleDateChange(value) {
|
if (value && value[1]) {
|
this.query.outStartTime[1] = value[1].substring(0, 11) + '23:59:59'
|
}
|
},
|
handleDateChange1(value) {
|
if (value && value[1]) {
|
this.query.outEndTime[1] = value[1].substring(0, 11) + '23:59:59'
|
}
|
},
|
// 计算时长
|
checkTime() {
|
if (this.form.outStartTime && this.form.outEndTime) {
|
this.form.durationUnit = this.dictLeaveTimeTypeHour
|
var data = JSON.stringify({
|
outStartTime: this.form.outStartTime,
|
outEndTime: this.form.outEndTime
|
})
|
crudAttendanceGoOut.getRemainingTime(data).then(res => {
|
this.form.outDuration = res
|
})
|
}
|
},
|
// 批量审核
|
toAgree(Number, data) {
|
const msg = Number === 2 ? '批量拒绝' : '批量同意'
|
const msg1 = Number === 2 ? 'error' : 'success'
|
// 确认框
|
this.$confirm('此操作将' + msg + '审核内容是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: msg1
|
}).then(() => {
|
const ids = []
|
// 循环数据
|
for (let i = 0; i < data.length; i++) {
|
// ID列表
|
if (data[i].wecomSpNo) {
|
continue
|
}
|
ids.push(data[i].id)
|
}
|
crudAttendanceGoOut
|
.updateAgree({
|
num: Number,
|
ids: ids
|
})
|
.then(res => {
|
// 消息提示
|
this.$message({
|
type: 'success',
|
message: msg + '!'
|
})
|
// 刷新数据
|
this.crud.refresh()
|
})
|
})
|
},
|
|
// 时间同步
|
toReflash(data) {
|
const ids = []
|
// 循环数据
|
for (let i = 0; i < data.length; i++) {
|
// ID列表
|
ids.push(data[i].id)
|
}
|
crudAttendanceGoOut
|
.reflashTime(ids)
|
.then(res => {
|
// 消息提示
|
this.$message({
|
type: 'success',
|
message: '刷新成功!'
|
})
|
// 刷新数据
|
this.crud.refresh()
|
})
|
},
|
|
// 审批页面赋值
|
toApprove(data, Number) {
|
if (Number !== '1') {
|
this.makeUpCardVisible = true
|
}
|
this.form.id = data.id
|
this.form.userId = data.userId
|
this.form.userName = data.userName
|
this.form.outOfOfficeType = data.outOfOfficeType
|
this.form.outStartTime = data.outStartTime
|
this.form.outEndTime = data.outEndTime
|
this.form.outDuration = data.outDuration
|
this.form.durationUnit = data.durationUnit
|
this.form.approvalStatus = data.approvalStatus
|
this.form.outReason = data.outReason
|
this.form.remarks = data.remarks
|
},
|
// 审核提交功能
|
approveFunction(Number, data) {
|
this.form.userId = data.userId
|
const msg = Number === 2 ? '通过' : '拒绝'
|
this.$refs['form'].validate(valid => {
|
if (!valid) {
|
return
|
}
|
// 判断通过状态
|
if (Number === 2) {
|
this.form.approvalStatus = this.dictGoOutAgree
|
} else {
|
// 退回改状态显示退回原因
|
this.form.approvalStatus = this.dictGoOutReturn
|
if (this.form.approvalDescription == null) {
|
return
|
}
|
}
|
this.successLoading = true
|
crudAttendanceGoOut
|
.approve(this.form)
|
.then(res => {
|
this.crud.refresh()
|
this.makeUpCardVisible = false
|
this.successLoading = false
|
this.$message({
|
type: 'success',
|
message: '审核' + msg + '成功'
|
})
|
})
|
.catch(() => {
|
this.makeUpCardVisible = false
|
this.successLoading = false
|
})
|
if (this.$refs['form']) {
|
this.$refs['form'].resetFields()
|
}
|
})
|
},
|
// 撤消功能
|
revoke(data) {
|
this.toApprove(data, '1')
|
this.form.approvalStatus = this.dictGoOutAppRev
|
this.successLoading = true
|
crudAttendanceGoOut
|
.approve(this.form)
|
.then(res => {
|
this.crud.refresh()
|
this.successLoading = false
|
this.$message({ type: 'success', message: '撤销成功' })
|
this.$refs[`popover_${data.id}`].showPopper = false
|
})
|
.catch(error => {
|
this.$message({
|
type: 'error',
|
message: error.response.data.message
|
})
|
})
|
if (this.$refs['form']) {
|
this.$refs['form'].resetFields()
|
}
|
this.crud.cancelCU()
|
},
|
// 关闭
|
closeCard() {
|
if (this.$refs['form']) {
|
this.$refs['form'].resetFields()
|
}
|
this.crud.cancelCU()
|
this.makeUpCardVisible = false
|
},
|
// 取消
|
canel(data) {
|
this.$refs[`popover_${data.id}`].showPopper = false
|
},
|
// 再新增(企微)
|
reAdd(data) {
|
const that = this
|
that.crud.toAdd()
|
that.$set(that.form, 'userId', data.userId)
|
that.$set(that.form, 'approvalUserId', data.approvalUserId)
|
that.$set(that.form, 'outOfOfficeType', data.outOfOfficeType)
|
that.$set(that.form, 'outStartTime', data.outStartTime)
|
that.$set(that.form, 'outEndTime', data.outEndTime)
|
that.$set(that.form, 'outDuration', data.outDuration)
|
that.$set(that.form, 'durationUnit', data.durationUnit)
|
that.$set(that.form, 'outReason', data.outReason)
|
that.$set(that.form, 'remarks', data.remarks)
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.form-item {
|
width: 100%;
|
display: flex;
|
margin-bottom: 20px;
|
}
|
.form-item-label {
|
width: 20%;
|
display: flex;
|
padding-left: 20px;
|
}
|
.form-item-value {
|
width: 80%;
|
display: flex;
|
padding-left: 25px;
|
padding-right: 25px;
|
}
|
</style>
|