Commit f08c3370 authored by 姬鋆屾's avatar 姬鋆屾

parent ac93781b
<template> <template>
<div class="container" v-if="open"> <div class="container" v-if="open">
<el-card style="min-height:80vh;padding:15px"> <el-card style="min-height:80vh;padding:15px">
<div class="flex flex_end"> <div class="flex flex_end">
<el-button type="primary" size="mini" @click="backTo">返回上一级</el-button> <el-button type="primary" size="mini" @click="backTo"
</div> >返回上一级</el-button
<tab-pane :activeName="activeName" :thirdList="thirdList"></tab-pane> >
<div class="mt20"> </div>
<div>考勤组名称</div> <tab-pane :activeName="activeName" :thirdList="thirdList"></tab-pane>
<el-input placeholder="请输入考勤组名称" maxlength="20" <div class="mt20">
v-model="setParams.groupName" style="width:320px" class="mt10"></el-input> <div>考勤组名称</div>
</div> <el-input
placeholder="请输入考勤组名称"
<div class="flex flex-align-center mt20"> maxlength="20"
<div>考勤人员</div> v-model="setParams.groupName"
<el-button type="text" class="ml20" @click="drawershow('drawer1')">设置</el-button> style="width:320px"
</div> class="mt10"
></el-input>
<div class="flex flex-align-center mt10" style="color:#999;font-size:14px" v-if="attendArr.length < 1"> </div>
<div>参与考勤人员</div>
<div class="ml20">未设置</div> <div class="flex flex-align-center mt20">
</div> <div>考勤人员</div>
<el-button type="text" class="ml20" @click="drawershow('drawer1')"
<!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px"> >设置</el-button
>
</div>
<div
class="flex flex-align-center mt10"
style="color:#999;font-size:14px"
v-if="attendArr.length < 1"
>
<div>参与考勤人员</div>
<div class="ml20">未设置</div>
</div>
<!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px">
<div>无需考勤人员</div> <div>无需考勤人员</div>
<div class="ml20">未设置</div> <div class="ml20">未设置</div>
</div> --> </div> -->
<div style="height:20px"></div>
<div class="flex flex-align-center mt20">
<div>考勤组负责人</div>
<el-button type="text" class="ml20" @click="drawershow('drawer2')">设置</el-button>
</div>
<div class="flex flex-align-center mt10" style="color:#999;font-size:14px" v-if="!groupResponsibleEntity.responsibleId"> <div style="height:20px"></div>
<div>主负责人</div>
<div class="ml20">未设置</div> <div class="flex flex-align-center mt20">
</div> <div>考勤组负责人</div>
<!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px"> <el-button type="text" class="ml20" @click="drawershow('drawer2')"
>设置</el-button
>
</div>
<div
class="flex flex-align-center mt10"
style="color:#999;font-size:14px"
v-if="!groupResponsibleEntity.responsibleId"
>
<div>主负责人</div>
<div class="ml20">未设置</div>
</div>
<!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px">
<div>子负责人</div> <div>子负责人</div>
<div class="ml20">未设置</div> <div class="ml20">未设置</div>
</div> --> </div> -->
<!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px"> <!-- <div class="flex flex-align-center mt10" style="color:#999;font-size:14px">
<div>子负责人权限</div> <div>子负责人权限</div>
<div class="ml20">未设置</div> <div class="ml20">未设置</div>
</div> --> </div> -->
<div style="height:20px"></div> <div style="height:20px"></div>
<div class="flex flex-align-center mt20"> <div class="flex flex-align-center mt20">
<div>考勤时间</div> <div>考勤时间</div>
<el-button type="text" class="ml20" @click="drawershow('drawer3')">设置</el-button> <el-button type="text" class="ml20" @click="drawershow('drawer3')"
</div> >设置</el-button
>
<div class="flex flex-align-center mt10" v-if="setParams.type === ''" style="color:#999;font-size:14px"> </div>
<div>考勤类型</div>
<div class="ml20">未设置</div> <div
</div> class="flex flex-align-center mt10"
v-if="setParams.type === ''"
<div class="flex flex-align-center mt10" style="color:#999;font-size:14px" v-if="setParams.type === ''"> style="color:#999;font-size:14px"
<div>工作日设置</div> >
<div class="ml20">未设置</div> <div>考勤类型</div>
</div> <div class="ml20">未设置</div>
</div>
<div style="height:20px"></div>
<div
<div class="flex flex-align-center mt20"> class="flex flex-align-center mt10"
<div>打卡方式</div> style="color:#999;font-size:14px"
<el-button type="text" class="ml20" @click="drawershow('drawer4')">设置</el-button> v-if="setParams.type === ''"
</div> >
<div>工作日设置</div>
<div class="flex flex-align-center mt10" style="color:#999;font-size:14px" <div class="ml20">未设置</div>
v-if="setParams.attendanceType == ''"> </div>
<div>考勤方式</div>
<div class="ml20">未设置</div> <div style="height:20px"></div>
</div>
<div class="mt20"> <div class="flex flex-align-center mt20">
<el-button type="primary" @click="saveSetform">保存设置</el-button> <div>打卡方式</div>
<el-button @click="allReset">全部重置</el-button> <el-button type="text" class="ml20" @click="drawershow('drawer4')"
</div> >设置</el-button
</el-card> >
<!-- 设置考勤人员 --> </div>
<el-drawer
title="考勤人员" <div
size="70%" class="flex flex-align-center mt10"
:beforeClose="closedrawer" style="color:#999;font-size:14px"
:visible.sync="drawer" v-if="setParams.attendanceType == ''"
direction="rtl"> >
<div style="padding:20px"> <div>考勤方式</div>
<!-- 考勤人员 --> <div class="ml20">未设置</div>
<div v-if="drawer1"> </div>
<div>参与考勤人员({{this.attendArr.length}})</div> <div class="mt20">
<el-input @focus="selectGroup(true)" type="textarea" maxlength="20" <el-button type="primary" @click="saveSetform">保存设置</el-button>
v-model="persons" style="width:80%" size="mini" placeholder="请选择"> <el-button @click="allReset">全部重置</el-button>
</el-input> </div>
</div> </el-card>
<!-- 设置考勤人员 -->
<!-- 考勤组 --> <el-drawer
<div class="mt10" v-if="drawer2"> title="考勤人员"
<div>考勤组负责人:</div> size="70%"
<el-select v-model="groupResponsibleEntity.responsibleId"> :beforeClose="closedrawer"
<el-option :visible.sync="drawer"
v-for="($label, $value) in responsiableList" direction="rtl"
:key="$value" >
:label="$label" <div style="padding:20px">
:value="$value" <!-- 考勤人员 -->
></el-option> <div v-if="drawer1">
</el-select> <div>参与考勤人员({{ this.attendArr.length }})</div>
</div> <el-input
<!-- <div class="mt10" v-if="drawer2"> @focus="selectGroup(true)"
type="textarea"
maxlength="20"
autosize
v-model="persons"
style="width:80%"
size="mini"
placeholder="请选择"
>
</el-input>
</div>
<!-- 考勤组 -->
<div class="mt10" v-if="drawer2">
<div>考勤组负责人:</div>
<el-select v-model="groupResponsibleEntity.responsibleId">
<el-option
v-for="($label, $value) in responsiableList"
:key="$value"
:label="$label"
:value="$value"
></el-option>
</el-select>
</div>
<!-- <div class="mt10" v-if="drawer2">
<div>主负责人:</div> <div>主负责人:</div>
<el-select></el-select> <el-select></el-select>
</div> </div>
...@@ -123,1038 +166,1228 @@ ...@@ -123,1038 +166,1228 @@
</el-select> </el-select>
</div> --> </div> -->
<!-- 考勤时间 --> <!-- 考勤时间 -->
<div class="mt20" v-if="drawer3"> <div class="mt20" v-if="drawer3">
<!-- --> <!-- -->
<el-radio-group v-model="setParams.type" @change="changeRadio"> <el-radio-group v-model="setParams.type" @change="changeRadio">
<div class="mt10" v-for="(item,index) in paibanType" :key="index"> <div class="mt10" v-for="(item, index) in paibanType" :key="index">
<el-radio :label="item.value">{{item.label}}</el-radio> <el-radio :label="item.value">{{ item.label }}</el-radio>
<div class="tips">{{item.des}}</div> <div class="tips">{{ item.des }}</div>
</div> </div>
</el-radio-group> </el-radio-group>
</div> </div>
<div class="mt20" v-if="drawer3"> <div class="mt20" v-if="drawer3">
<!-- 固定班次设置 -->
<!-- 固定班次设置 --> <div v-if="setParams.type == 1">
<div v-if="setParams.type == 1"> <div>工作日设置:</div>
<div>工作日设置:</div> <!-- <div class="mt10">
<!-- <div class="mt10">
<el-tag type="primary">快捷设置班次</el-tag> <el-tag type="primary">快捷设置班次</el-tag>
<span class="ml20">班次名称:</span> <span class="ml20">班次名称:</span>
<el-button type="text" @click="changeBanci('1')">更改班次</el-button> <el-button type="text" @click="changeBanci('1')">更改班次</el-button>
</div> --> </div> -->
<!-- 固定班次表 --> <!-- 固定班次表 -->
<banci-table :setParams="groupFixedworkEntity" @changebanci="changeBanci"></banci-table> <banci-table
</div> :setParams="groupFixedworkEntity"
@changebanci="changeBanci"
></banci-table>
<!-- 自用工时设置 --> </div>
<div v-if="setParams.type == 3">
<div class="mt20">工作日</div> <!-- 自用工时设置 -->
<div class="mt10"> <div v-if="setParams.type == 3">
<el-checkbox v-model="attendanceGroupFreeworkEntity.monday" :true-label="1" :false-label="0">周一</el-checkbox> <div class="mt20">工作日</div>
<el-checkbox v-model="attendanceGroupFreeworkEntity.tuesday" :true-label="1" :false-label="0">周二</el-checkbox> <div class="mt10">
<el-checkbox v-model="attendanceGroupFreeworkEntity.wednesday" :true-label="1" :false-label="0">周三</el-checkbox> <el-checkbox
<el-checkbox v-model="attendanceGroupFreeworkEntity.thursday" :true-label="1" :false-label="0">周四</el-checkbox> v-model="attendanceGroupFreeworkEntity.monday"
<el-checkbox v-model="attendanceGroupFreeworkEntity.friday" :true-label="1" :false-label="0">周五</el-checkbox> :true-label="1"
<el-checkbox v-model="attendanceGroupFreeworkEntity.saturday" :true-label="1" :false-label="0">周六</el-checkbox> :false-label="0"
<el-checkbox v-model="attendanceGroupFreeworkEntity.sunday" :true-label="1" :false-label="0">周日</el-checkbox> >周一</el-checkbox
>
</div> <el-checkbox
<div class="mt20">工作时长</div> v-model="attendanceGroupFreeworkEntity.tuesday"
<div class="mt10"> :true-label="1"
<el-input style="width:100px" v-model="attendanceGroupFreeworkEntity.workTime" minlength="5"></el-input> :false-label="0"
<span class="ml20">小时</span> >周二</el-checkbox
</div> >
</div> <el-checkbox
v-model="attendanceGroupFreeworkEntity.wednesday"
<div v-if="setParams.type != 2"> :true-label="1"
<div class="mt10"> :false-label="0"
<el-checkbox v-model="holidays" :true-label="1" :false-label="0">法定节假日自动排休</el-checkbox> >周三</el-checkbox
</div> >
<el-checkbox
<div class="mt10"> v-model="attendanceGroupFreeworkEntity.thursday"
<div>特殊日期</div> :true-label="1"
</div> :false-label="0"
>周四</el-checkbox
<div class="mt10"> >
<el-button @click="setMustTimes('must')"> <el-checkbox
+新增必须打卡的日期 v-model="attendanceGroupFreeworkEntity.friday"
</el-button> :true-label="1"
:false-label="0"
<div class="el-tag ml20" type="primary" size="mini" plain >周五</el-checkbox
v-if="mustDakaObj"> >
{{mustDakaObj.specialTime? <el-checkbox
mustDakaObj.specialTime:'未设置'}} v-model="attendanceGroupFreeworkEntity.saturday"
<i class="el-icon-close" @click="deleteSpecal('must')"></i> :true-label="1"
</div> :false-label="0"
>周六</el-checkbox
</div> >
<div class="mt10"> <el-checkbox
<el-button @click="setMustTimes('noneed')"> v-model="attendanceGroupFreeworkEntity.sunday"
+新增无需打卡的日期 :true-label="1"
</el-button> :false-label="0"
<div class="el-tag ml20" type="primary" size="mini" plain >周日</el-checkbox
v-if="noneedDakaObj&&noneedDakaObj.specialTime"> >
{{noneedDakaObj.specialTime}}
<i class="el-icon-close" @click="deleteSpecal('must')"></i>
</div>
<div class="el-tag ml20"
v-else-if="noneedDakaObj&&noneedDakaObj.specialStartTime">
{{noneedDakaObj.specialStartTime}}
{{noneedDakaObj.specialEndTime}}
<i class="el-icon-close" @click="deleteSpecal('noneed')"></i>
</div>
</div>
</div>
</div>
<div class="mt20" v-if="drawer4">
<div>考勤方式</div>
<el-radio-group v-model="setParams.attendanceType">
<div class="mt10" v-for="(item,index) in attendanceType" :key="index">
<el-radio :label="item.value">{{item.label}}</el-radio>
</div>
</el-radio-group>
</div>
</div> </div>
</el-drawer> <div class="mt20">工作时长</div>
<div class="mt10">
<!-- 选择成员 --> <el-input
<el-dialog :visible.sync="isshowgroup" title="选择人员" width="80%" :show-close="false"> style="width:100px"
<div> v-model="attendanceGroupFreeworkEntity.workTime"
<el-row type="flex"> minlength="5"
<!-- 左1 --> ></el-input>
<el-col :span="16"> <span class="ml20">小时</span>
</div>
<el-row type="flex"> </div>
<el-col :span="12">
<div class="titles">选择部门</div>
<el-scrollbar style="height: 50vh">
<el-tree
size="mini"
ref="siteTree"
:data="areaData"
id="el-tree"
node-key="id"
:load="loadNode"
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClickBumen"
>
</el-tree>
</el-scrollbar>
</el-col>
<el-col :span="12">
<div class="titles">人员列表</div>
<el-scrollbar style="height: 50vh">
<div v-if="currentSelect.length>0">
<el-checkbox label="0" v-model="CurrentAllchecked" @change="currentChangeAll">全部</el-checkbox>
</div>
<el-checkbox-group v-model="allSelectId" v-if="currentSelect.length>0">
<el-checkbox :label="item.staffId" @change="changegroupId"
v-for="(item,index) in currentSelect" :key="index">
{{item.staffName}}</el-checkbox>
</el-checkbox-group>
<div v-else class="tips mt10">
该部门没有可选择员工,请选择其他文件
</div>
</el-scrollbar>
</el-col>
</el-row>
</el-col>
<!-- 右1 -->
<el-col :span="8">
<div style="border-left:1px dotted #eee;padding-left:20px">
<div class="titles">已选择</div>
<el-scrollbar style="height: 50vh">
<div class="el-tag ml10 mt10" :key="index"
v-for="(item,index) in allSelect">
<span class="tags">{{item.staffName}}</span>
<i class="el-icon-close" @click="deleteOne(index)"></i>
</div>
</el-scrollbar>
</div>
</el-col>
</el-row>
<div v-if="setParams.type != 2">
<div class="mt10">
<el-checkbox v-model="holidays" :true-label="1" :false-label="0"
>法定节假日自动排休</el-checkbox
>
</div> </div>
<div class="mt20">
<el-button type="primary" size="mini" @click="saveBtnchoice">确定</el-button> <div class="mt10">
<el-button size="mini" @click="cancelChoice">取消</el-button> <div>特殊日期</div>
</div> </div>
</el-dialog>
<div class="mt10">
<!-- 选择班次 --> <el-button @click="setMustTimes('must')">
<el-dialog :visible.sync="isshowBanci" title="选择班次" :show-close="false"> +新增必须打卡的日期
选择班次 </el-button>
<banci-select :classArr="classArr" :currentArr="currentselectBanciRow" v-if="isshowBanci"
@saveRowBanci="saveRowBanci" @cancelBanci="cancelBanci"></banci-select> <div
</el-dialog> class="el-tag ml20"
type="primary"
<!-- 新增必须打卡时间 --> size="mini"
<el-dialog :visible.sync="mustDaka" title="新增必须打卡日期" :show-close="false"> plain
<div> v-if="mustDakaObj"
<span>选择日期</span> >
<el-date-picker type="date" placeholder="年/月/日" class="ml10" value-format="yyyy-MM-dd" {{
v-model="currentParams.specialTime"></el-date-picker> mustDakaObj.specialTime ? mustDakaObj.specialTime : "未设置"
}}
<i class="el-icon-close" @click="deleteSpecal('must')"></i>
</div>
</div> </div>
<div> <div class="mt10">
<!-- 选择日期 --> <el-button @click="setMustTimes('noneed')">
<banci-select :classArr="classArr" :currentArr="currentselectBanciRow" :isshow="mustDaka" +新增无需打卡的日期
@saveRowBanci="saveCurrentSpecial" @cancelBanci="cancelSpecial"></banci-select> </el-button>
<div
class="el-tag ml20"
type="primary"
size="mini"
plain
v-if="noneedDakaObj && noneedDakaObj.specialTime"
>
{{ noneedDakaObj.specialTime }}
<i class="el-icon-close" @click="deleteSpecal('must')"></i>
</div>
<div
class="el-tag ml20"
v-else-if="noneedDakaObj && noneedDakaObj.specialStartTime"
>
{{ noneedDakaObj.specialStartTime }}
{{ noneedDakaObj.specialEndTime }}
<i class="el-icon-close" @click="deleteSpecal('noneed')"></i>
</div>
</div> </div>
</el-dialog> </div>
</div>
<div class="mt20" v-if="drawer4">
<!-- 新增无需打卡时间 --> <div>考勤方式</div>
<el-dialog :visible.sync="noneedDaka" title="新增无需打卡日期" :show-close="false"> <el-radio-group v-model="setParams.attendanceType">
<div> <div
<span>选择添加方式</span> class="mt10"
<el-radio-group class="ml20" v-model="currentParams.addWay" @change="currentParams.specialTime = ''"> v-for="(item, index) in attendanceType"
<el-radio :label="0">单个日期</el-radio> :key="index"
<el-radio :label="1">时间段</el-radio> >
</el-radio-group> <el-radio :label="item.value">{{ item.label }}</el-radio>
</div> </div>
<div> </el-radio-group>
<div v-if="currentParams.addWay === 0" class="mt20"> </div>
<span>选择日期</span> </div>
<!-- 单个日期 --> </el-drawer>
<el-date-picker type="date" class="ml20" value-format="yyyy-MM-dd"
v-model="currentParams.specialTime"></el-date-picker> <!-- 选择成员 -->
</div> <el-dialog
<div v-else-if="currentParams.addWay === 1" class="mt20"> :visible.sync="isshowgroup"
<!-- 日期段 --> title="选择人员"
<el-date-picker width="80%"
v-model="noneedRange" :show-close="false"
@change="changeneedRange" >
type="daterange" <div>
value-format="yyyy-MM-dd" <el-row type="flex">
range-separator="至" <!-- 左1 -->
start-placeholder="开始日期" <el-col :span="16">
end-placeholder="结束日期"> <el-row type="flex">
</el-date-picker> <el-col :span="12">
<div class="titles">选择部门</div>
<el-scrollbar style="height: 50vh">
<el-tree
size="mini"
ref="siteTree"
:data="areaData"
id="el-tree"
node-key="id"
:load="loadNode"
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClickBumen"
>
</el-tree>
</el-scrollbar>
</el-col>
<el-col :span="12">
<div class="titles">人员列表</div>
<el-scrollbar style="height: 50vh">
<div v-if="currentSelect.length > 0">
<el-checkbox
label="0"
v-model="CurrentAllchecked"
@change="currentChangeAll"
>全部</el-checkbox
>
</div>
<el-checkbox-group
v-model="allSelectId"
v-if="currentSelect.length > 0"
>
<el-checkbox
:label="item.staffId"
@change="changegroupId"
v-for="(item, index) in currentSelect"
:key="index"
>
{{ item.staffName }}</el-checkbox
>
</el-checkbox-group>
<div v-else class="tips mt10">
该部门没有可选择员工,请选择其他文件
</div>
</el-scrollbar>
</el-col>
</el-row>
</el-col>
<!-- 右1 -->
<el-col :span="8">
<div style="border-left:1px dotted #eee;padding-left:20px">
<div class="titles">已选择</div>
<el-scrollbar style="height: 50vh">
<div
class="el-tag ml10 mt10"
:key="index"
v-for="(item, index) in allSelect"
>
<span class="tags">{{ item.staffName }}</span>
<i class="el-icon-close" @click="deleteOne(index)"></i>
</div> </div>
</el-scrollbar>
</div> </div>
<div class="mt20"> </el-col>
<el-button type="primary" size="mini" @click="saveNoneed">确定</el-button> </el-row>
<el-button size="mini" @click="cancelSpecial">取消</el-button> </div>
</div> <div class="mt20">
</el-dialog> <el-button type="primary" size="mini" @click="saveBtnchoice"
</div> >确定</el-button
>
<el-button size="mini" @click="cancelChoice">取消</el-button>
</div>
</el-dialog>
<!-- 选择班次 -->
<el-dialog :visible.sync="isshowBanci" title="选择班次" :show-close="false">
选择班次
<banci-select
:classArr="classArr"
:currentArr="currentselectBanciRow"
v-if="isshowBanci"
@saveRowBanci="saveRowBanci"
@cancelBanci="cancelBanci"
></banci-select>
</el-dialog>
<!-- 新增必须打卡时间 -->
<el-dialog
:visible.sync="mustDaka"
title="新增必须打卡日期"
:show-close="false"
>
<div>
<span>选择日期</span>
<el-date-picker
type="date"
placeholder="年/月/日"
class="ml10"
value-format="yyyy-MM-dd"
v-model="currentParams.specialTime"
></el-date-picker>
</div>
<div>
<!-- 选择日期 -->
<banci-select
:classArr="classArr"
:currentArr="currentselectBanciRow"
:isshow="mustDaka"
@saveRowBanci="saveCurrentSpecial"
@cancelBanci="cancelSpecial"
></banci-select>
</div>
</el-dialog>
<!-- 新增无需打卡时间 -->
<el-dialog
:visible.sync="noneedDaka"
title="新增无需打卡日期"
:show-close="false"
>
<div>
<span>选择添加方式</span>
<el-radio-group
class="ml20"
v-model="currentParams.addWay"
@change="currentParams.specialTime = ''"
>
<el-radio :label="0">单个日期</el-radio>
<el-radio :label="1">时间段</el-radio>
</el-radio-group>
</div>
<div>
<div v-if="currentParams.addWay === 0" class="mt20">
<span>选择日期</span>
<!-- 单个日期 -->
<el-date-picker
type="date"
class="ml20"
value-format="yyyy-MM-dd"
v-model="currentParams.specialTime"
></el-date-picker>
</div>
<div v-else-if="currentParams.addWay === 1" class="mt20">
<!-- 日期段 -->
<el-date-picker
v-model="noneedRange"
@change="changeneedRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</div>
</div>
<div class="mt20">
<el-button type="primary" size="mini" @click="saveNoneed"
>确定</el-button
>
<el-button size="mini" @click="cancelSpecial">取消</el-button>
</div>
</el-dialog>
</div>
</template> </template>
<script> <script>
import tabPane from '@/components/tabPane.vue' import tabPane from "@/components/tabPane.vue";
import banciTable from './banciTable/index' import banciTable from "./banciTable/index";
import banciSelect from './banciSelect/index.vue' import banciSelect from "./banciSelect/index.vue";
import form from "@/assets/mixins/formdialog" import form from "@/assets/mixins/formdialog";
export default { export default {
mixins: [form], mixins: [form],
components: { components: {
tabPane, tabPane,
banciTable, banciTable,
banciSelect banciSelect,
},
created() {
this.changePath("attendance/group");
},
methods: {
// 返回
backTo() {
this.open = false;
this.$emit("ok", true);
},
// 渲染前置处理
beforeRender(data) {
if (data.entity.attendanceGroupStaffList) {
this.attendanceGroupStaffList = data.entity.attendanceGroupStaffList;
}
return data;
},
/** 编辑 */
edit(row) {
this.allReset();
this.query = { id: row.id };
this.urls.currUrl = "attendance/group/edit";
this.getData();
this.pageInfo.type = "edit";
this.open = true;
},
/** 新增 */
add(row) {
this.allReset();
this.urls.currUrl = "attendance/group/add";
this.getData();
this.pageInfo.type = "add";
this.open = true;
},
/** 查看*/
view(row) {
this.allReset();
this.query = { id: row.id };
this.urls.currUrl = "attendance/group/view";
this.getData();
this.pageInfo.type = "view";
},
/**获取数据后弹框 */
afterRender(data) {
console.log(this.form, "返回数据");
this.dealDic();
let {
attendanceGroupStaffList,
groupName,
type,
attendanceType,
groupFixedworkEntity,
groupResponsibleEntity,
attendanceGroupFreeworkEntity,
id,
} = this.form;
if (id) {
this.setParams.id = id;
}
if (attendanceGroupStaffList) {
this.attendanceGroupStaffList = attendanceGroupStaffList; //参与考勤的人
}
//固定班制
if (groupFixedworkEntity) {
this.groupFixedworkEntity = groupFixedworkEntity;
let week = [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday",
];
for (let value of week) {
if (this.groupFixedworkEntity[value]) {
this.classArr.map((item) => {
if (item.id === this.groupFixedworkEntity[value + "ClassId"]) {
this.groupFixedworkEntity[value + "ClassTime"] = item;
}
});
} else {
this.groupFixedworkEntity[value + "ClassTime"] = [];
}
}
this.cancelBanci();
this.holidays = groupFixedworkEntity.holidays;
}
// 特殊日期
if (
groupFixedworkEntity &&
groupFixedworkEntity.attendanceGroupFixedworkSpecialList
) {
// 固定班制
this.noneedDakaObj = groupFixedworkEntity.attendanceGroupFixedworkSpecialList.find(
(item) => item.must === 0
);
this.mustDakaObj = groupFixedworkEntity.attendanceGroupFixedworkSpecialList.find(
(item) => item.must === 1
);
}
// 自由工时
if (attendanceGroupFreeworkEntity) {
this.attendanceGroupFreeworkEntity = attendanceGroupFreeworkEntity;
this.holidays = attendanceGroupFreeworkEntity.holidays;
}
if (
attendanceGroupFreeworkEntity &&
attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList
) {
this.noneedDakaObj = attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList.find(
(item) => item.must === 0
);
this.mustDakaObj = attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList.find(
(item) => item.must === 1
);
}
//负责人
if (groupResponsibleEntity) {
this.groupResponsibleEntity = groupResponsibleEntity;
this.groupResponsibleEntity.responsibleId = this.groupResponsibleEntity.responsibleId.toString();
}
// 处理考勤人回显
this.attendArrId = this.attendanceGroupStaffList.map(
(item) => item.staffId
);
this.attendArr = this.attendanceGroupStaffList;
this.setParams.groupName = groupName; //考勤组名称
this.setParams.type = type; //考勤类型
this.setParams.attendanceType = attendanceType; //打卡类型
},
afterSubmit(data) {
this.open = false;
this.allReset();
this.$emit("ok", true);
},
// 处理字典
dealDic() {
this.attendanceType = [];
this.classArr = this.dict.classId;
this.responsiableList = this.dict.workMan;
this.areaData = this.dict.deptId;
for (let key in this.dict.attendanceType) {
let obj = {
label: this.dict.attendanceType[key],
value: key,
};
this.attendanceType.push(obj);
}
// 类型
let typearr = [];
for (let key in this.dict.type) {
let obj = {
label: this.dict.type[key],
value: Number(key),
};
typearr.push(obj);
}
typearr.forEach((item, index) => {
let res = this.paibanType.filter(
(item1) => item1.label.indexOf(item.label) != -1
);
if (res.length > 0) {
res[0].value = typearr[index].value;
}
});
},
// ---- 班次选择 -------
// 当前班次选择
saveRowBanci(val) {
this.groupFixedworkEntity[this.currentWorkName + "ClassId"] = val.id; //存储班次id
this.groupFixedworkEntity[this.currentWorkName + "ClassName"] =
val.className; //存储班次名称
// this.groupFixedworkEntity[this.currentWorkName+'ClassTime'] = val
this.$set(
this.groupFixedworkEntity,
this.currentWorkName + "ClassTime",
val
);
console.log(
this.groupFixedworkEntity[this.currentWorkName + "ClassTime"],
"当前更改"
);
this.cancelBanci();
},
// 固定班制 ---- 触发班次选择
changeBanci(row) {
this.currentWorkName = row;
this.currentselectBanciRow = JSON.parse(
JSON.stringify(
this.groupFixedworkEntity[this.currentWorkName + "ClassTime"]
)
);
this.isshowBanci = true;
},
// 置空
cancelBanci() {
this.isshowBanci = false;
this.currentselectBanciRow = null;
},
// ----end ----
// ----- 特殊日期选择 ----
// 删除必须
deleteSpecal(from) {
if (from == "must") {
this.mustDakaObj = null;
} else {
this.noneedDakaObj = null;
}
},
// 新增必须打卡 --- 触发班次
setMustTimes(from) {
if (from == "must" && !this.mustDakaObj) {
this.mustDakaObj = {
must: 1, //必需打卡
specialStartTime: "", //时间段
specialEndTime: "", //
specialTime: "", //必须打卡日期
addWay: 0, //日期还是时间段
classId: "",
classArr: {},
};
} else if (from == "noneed" && !this.noneedDakaObj) {
this.noneedDakaObj = {
must: 0, //无需打卡
specialStartTime: "", //时间段
specialEndTime: "", //
specialTime: "", //必须打卡日期
addWay: 0, //日期还是时间段
classId: "",
classArr: {},
};
}
if (from == "must") {
this.mustDaka = true;
this.currentParams = this.mustDakaObj;
this.currentselectBanciRow = this.currentParams.classArr;
} else {
this.currentParams = this.noneedDakaObj;
if (this.currentParams.specialStartTime) {
this.noneedRange = [
this.currentParams.specialStartTime,
this.currentParams.specialEndTime,
];
} else {
this.noneedRange = [];
}
this.noneedDaka = true;
}
},
// 保存必须打卡
saveCurrentSpecial(val) {
this.currentParams.classArr = val;
this.currentParams.classId = val.id;
if (!this.currentParams.specialTime) {
this.$message.error("请选择日期");
return;
}
if (!this.currentParams.classId) {
this.$message.error("请选择班次");
return;
}
if (this.noneedDakaObj) {
if (this.noneedDakaObj.specialTime === this.currentParams.specialTime) {
this.$message.error("该日期已设置为无需打卡日,请重新选择");
return;
}
let timeStart = Date.parse(this.noneedDakaObj.specialStartTime); //无需开始时间戳
let timeEnd = Date.parse(this.noneedDakaObj.specialEndTime); //无需结束时间戳
let mustTime = Date.parse(this.currentParams.specialTime); //必须时间戳
if (mustTime >= timeStart && mustTime <= timeEnd) {
this.$message.error(
"必须打卡日期不能设置在无需打卡时间段内,请重新选择"
);
return false;
}
}
this.mustDakaObj = JSON.parse(JSON.stringify(this.currentParams));
this.cancelSpecial();
},
// 取消当前特殊日期设置
cancelSpecial() {
this.currentParams = {};
this.noneedRange = [];
this.mustDaka = false;
this.noneedDaka = false;
this.currentselectBanciRow = null;
},
// 无需时间段
changeneedRange() {
if (this.noneedRange) {
this.currentParams.specialStartTime = this.noneedRange[0];
this.currentParams.specialEndTime = this.noneedRange[1];
} else {
this.currentParams.specialStartTime = "";
this.currentParams.specialEndTime = "";
}
},
// 保存 无需打卡
saveNoneed() {
if (
this.currentParams.addWay === 0 &&
this.currentParams.specialTime == ""
) {
this.$message.error("请选择日期");
return;
}
if (
this.currentParams.addWay === 1 &&
this.currentParams.specialStartTime == ""
) {
this.$message.error("请选择时间段");
return;
}
if (this.mustDakaObj) {
if (
this.mustDakaObj.specialTime === this.currentParams.specialTime &&
this.mustDakaObj.specialTime != ""
) {
this.$message.error("该日期已设置为必须打卡日,请重新选择");
return;
}
let timeStart = Date.parse(this.currentParams.specialStartTime); //无需开始时间戳
let timeEnd = Date.parse(this.currentParams.specialEndTime); //无需结束时间戳
let mustTime = Date.parse(this.mustDakaObj.specialTime); //必须时间戳
if (mustTime >= timeStart && mustTime <= timeEnd) {
this.$message.error(
"无需打卡时间段内不能含有[必须打卡日期],请重新选择"
);
return false;
}
}
this.noneedDakaObj = JSON.parse(JSON.stringify(this.currentParams));
this.cancelSpecial();
},
// ---- end -------
// ---- 部门-人员选择 ------
// 触发部门选择
selectGroup(from) {
this.selectTyep = from;
if (this.selectTyep) {
this.allSelect = this.attendArr;
this.allSelectId = this.attendArrId;
} else {
this.allSelect = this.noattendArr;
this.allSelectId = this.attendArrId;
}
this.isshowgroup = true;
},
// 取消选择
cancelChoice() {
this.isshowgroup = false;
this.currentSelect = [];
this.allSelect = [];
this.allSelectId = [];
this.CurrentAllchecked = false;
},
// 确定当前选择
saveBtnchoice() {
this.CurrentAllchecked = false;
if (this.selectTyep) {
this.attendArr = this.allSelect;
this.attendArrId = this.allSelectId;
// 参与考勤
} else {
// 不参与考勤
this.noattendArr = this.allSelect;
this.attendArrId = this.allSelectId;
}
this.cancelChoice();
},
// 单独选择
changegroupId(val) {
let value;
if (val) {
// id
value = this.allSelectId.filter(
(item1) => !this.allSelect.some((item2) => item2.staffId === item1)
);
let obj = this.currentSelect.find((item) => item.staffId === value[0]);
this.allSelect.push(obj);
} else {
// 对象
value = this.allSelect.filter(
(item1) => !this.allSelectId.some((item2) => item2 === item1.staffId)
);
let index = this.allSelect.findIndex(
(item) => item.staffId == value[0].staffId
);
this.allSelect.splice(index, 1);
}
this.CurrentAllchecked = this.currentSelect.every((val) =>
this.allSelectId.includes(val.staffId)
);
console.log(value, "当前选择值");
},
// 点击触发
handleNodeClickBumen(val) {
if (this.selectTyep) {
} else {
}
this.currentSelect = val.personList; //人员信息
// 判断当前是不是全选
this.CurrentAllchecked = this.currentSelect.every((val) =>
this.allSelectId.includes(val.staffId)
);
},
// 全选操作
currentChangeAll() {
if (this.CurrentAllchecked) {
// 当前全选
let arr1 = this.currentSelect.filter(
(item) => !this.allSelect.some((item2) => item2 === item)
);
this.allSelect = [...this.allSelect, ...arr1]; //渲染列表
let arr2 = this.currentSelect.filter(
(item1) => !this.allSelectId.some((item2) => item2 === item1.staffId)
);
this.allSelectId = [
...this.allSelectId,
...arr2.map((item) => item.staffId),
]; //id信息
} else {
//取消当前全选
this.allSelect = this.allSelect.filter(
(item1) => !this.currentSelect.some((item2) => item2 === item1)
);
this.allSelectId = this.allSelectId.filter(
(item1) =>
!this.currentSelect.some((item2) => item2.staffId === item1)
);
}
},
// 删除某个选择
deleteOne(index) {
this.allSelect.splice(index, 1);
this.allSelectId.splice(index, 1);
this.CurrentAllchecked = this.currentSelect.every((val) =>
this.allSelectId.includes(val.staffId)
); //判断全选
},
// ---- end -------
// 考勤方式发生改变 -置空其他类别选项
changeRadio() {
// 自由工时置空
for (let key in this.attendanceGroupFreeworkEntity) {
this.attendanceGroupFreeworkEntity[key] = 0;
}
this.attendanceGroupFreeworkEntity.workTime = "";
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList = [];
// 固定班制置空
for (let key in this.groupFixedworkEntity) {
this.groupFixedworkEntity[key] = "";
}
for (let item of this.typeList) {
this.groupFixedworkEntity[item.value] = 0;
this.groupFixedworkEntity[item.value + "ClassTime"] = [];
this.groupFixedworkEntity[item.value + "ClassName"] = "";
this.groupFixedworkEntity[item.value + "ClassId"] = "";
}
this.attendanceGroupFixedworkSpecialList = [];
},
// 触发对应流程设置
drawershow(from) {
switch (from) {
case "drawer1":
this.drawer = true;
this.drawer1 = true;
break;
case "drawer2":
this.drawer = true;
this.drawer2 = true;
break;
case "drawer3":
this.drawer = true;
this.drawer3 = true;
break;
case "drawer4":
this.drawer = true;
this.drawer4 = true;
break;
default:
break;
}
},
// 关闭流程设置
closedrawer() {
this.drawer = false;
this.drawer1 = false;
this.drawer2 = false;
this.drawer3 = false;
this.drawer4 = false;
},
// 全部置空
allReset() {
// 置空无关项
this.changeRadio();
// 先大概处理
for (let key in this.setParams) {
this.setParams[key] = "";
}
this.setParams.attendanceGroupStaffList = [];
this.attendArr = [];
this.attendArrId = [];
this.allSelectId = [];
this.allSelect = [];
this.currentSelect = [];
this.cancelBanci();
},
// 提交保存
saveSetform() {
// 校验 考勤组名称、参与考勤人员、考勤组负责人、
// 考勤时间 固定班制 -- 校验 排班是否设置 排班id 日期是否参与考勤
// 自由时间 -- 是否参与考勤 工作时长
// 排班制 -- 不确定
// ---- 基础判断 ---
if (this.setParams.groupName === "") {
this.$message.error("请输入考勤组名称");
return;
}
if (this.attendArr.length < 1) {
this.$message.error("请设置参与考勤人员");
return;
}
if (this.groupResponsibleEntity.responsibleId == "") {
this.$message.error("请设置考勤负责人");
return;
}
if (this.setParams.type === "") {
this.$message.error("请设置考勤方式");
return;
}
if (this.setParams.attendanceType === "") {
this.$message.error("请设置打卡方式");
return false;
}
// -----end ---
// 处理特殊日期
if (this.mustDakaObj) {
this.attendanceGroupFixedworkSpecialList.push(this.mustDakaObj);
}
if (this.noneedDakaObj) {
this.attendanceGroupFixedworkSpecialList.push(this.noneedDakaObj);
}
// ---- 根据类型判断 ---
// 固定班制校验
if (this.setParams.type == 1) {
for (let item of this.typeList) {
if (
this.groupFixedworkEntity[item.value] &&
!this.groupFixedworkEntity[item.value + "ClassId"]
) {
this.$message.error(`${item.name} 考勤班次未设置`);
return false;
}
}
}
// 自由工时校验
if (this.setParams.type == 3) {
if (this.attendanceGroupFreeworkEntity.workTime == "") {
this.$message.error("请设置工作时长");
return false;
}
}
// ---- end ----
// ---- 处理数据 ----
if (this.attendArr.length > 0) {
this.setParams.attendanceGroupStaffList = this.attendArr.map((item) => {
return {
staffId: item.staffId,
staffName: item.staffName,
};
});
}
if (this.groupResponsibleEntity.responsibleId) {
// 给负责人进行赋值
this.groupResponsibleEntity.responsibleName = this.responsiableList[
this.groupResponsibleEntity.responsibleId
];
}
// 固定工时
if (this.setParams.type == 1) {
if (
this.attendanceGroupFixedworkSpecialList &&
this.attendanceGroupFixedworkSpecialList.length > 0
) {
this.groupFixedworkEntity.attendanceGroupFixedworkSpecialList = this.attendanceGroupFixedworkSpecialList; //特殊日期设置
}
this.setParams.groupFixedworkEntity = this.groupFixedworkEntity;
if (this.setParams.hasOwnProperty("attendanceGroupFreeworkEntity")) {
delete this.setParams.attendanceGroupFreeworkEntity;
}
}
// 自由工时
if (this.setParams.type == 3) {
if (
this.attendanceGroupFixedworkSpecialList &&
this.attendanceGroupFixedworkSpecialList.length > 0
) {
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList = this.attendanceGroupFixedworkSpecialList; //特殊日期
}
this.setParams.attendanceGroupFreeworkEntity = this.attendanceGroupFreeworkEntity;
if (this.setParams.hasOwnProperty("groupFixedworkEntity")) {
delete this.setParams.groupFixedworkEntity;
}
}
// 考勤负责人
this.setParams.groupResponsibleEntity = this.groupResponsibleEntity;
// ----- end ----
this.$post(
this.urls.saveUrl || this.pageInfo.saveUrl,
this.setParams
).then((res) => {
if (res.code == 1) {
this.afterSubmit();
}
});
},
},
computed: {
persons() {
let arrName = this.attendArr.map((item) => item.staffName);
return arrName.join(",");
},
},
data() {
return {
open: false,
activeName: "/attendance/group/view",
thirdList: [
{
name: "新增考勤组",
path: "/attendance/group/view",
}, },
created(){ ],
this.changePath("attendance/group") paibanType: [
{
label: "固定班制(固定时间上下班)",
value: 1,
des:
"考勤组中所有人按照相同的时间打卡,适用于办公室坐班,例如朝九晚五",
}, },
methods: { {
// 返回 label: "排班制(按排班上下班)",
backTo(){ value: 2,
this.open = false des: "自定义设置每人的班次,适用于工厂、门店等,例如三班倒",
this.$emit('ok',true)
},
// 渲染前置处理
beforeRender(data) {
if(data.entity.attendanceGroupStaffList) {
this.attendanceGroupStaffList = data.entity.attendanceGroupStaffList;
}
return data
},
/** 编辑 */
edit(row) {
this.allReset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/edit";
this.getData();
this.pageInfo.type="edit"
this.open = true;
},
/** 新增 */
add(row) {
this.allReset()
this.urls.currUrl = "attendance/group/add";
this.getData();
this.pageInfo.type="add"
this.open = true;
},
/** 查看*/
view(row) {
this.allReset()
this.query = { id: row.id };
this.urls.currUrl ="attendance/group/view";
this.getData();
this.pageInfo.type="view"
},
/**获取数据后弹框 */
afterRender(data) {
console.log(this.form,'返回数据')
this.dealDic()
let {attendanceGroupStaffList,groupName,type,attendanceType,groupFixedworkEntity,groupResponsibleEntity,attendanceGroupFreeworkEntity,id} = this.form
if(id){
this.setParams.id = id
}
if(attendanceGroupStaffList){
this.attendanceGroupStaffList = attendanceGroupStaffList//参与考勤的人
}
//固定班制
if(groupFixedworkEntity){
this.groupFixedworkEntity = groupFixedworkEntity
let week = ['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
for(let value of week){
if(this.groupFixedworkEntity[value]){
this.classArr.map(item => {
if(item.id === this.groupFixedworkEntity[value+'ClassId']){
this.groupFixedworkEntity[value+'ClassTime'] = item
}
})
}else{
this.groupFixedworkEntity[value+'ClassTime'] = []
}
}
this.cancelBanci()
this.holidays = groupFixedworkEntity.holidays
}
// 特殊日期
if(groupFixedworkEntity && groupFixedworkEntity.attendanceGroupFixedworkSpecialList){
// 固定班制
this.noneedDakaObj = groupFixedworkEntity.attendanceGroupFixedworkSpecialList.find(item => item.must === 0)
this.mustDakaObj = groupFixedworkEntity.attendanceGroupFixedworkSpecialList.find(item => item.must === 1)
}
// 自由工时
if(attendanceGroupFreeworkEntity){
this.attendanceGroupFreeworkEntity = attendanceGroupFreeworkEntity
this.holidays = attendanceGroupFreeworkEntity.holidays
}
if(attendanceGroupFreeworkEntity && attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList){
this.noneedDakaObj = attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList.find(item => item.must === 0)
this.mustDakaObj = attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList.find(item => item.must === 1)
}
//负责人
if(groupResponsibleEntity){
this.groupResponsibleEntity = groupResponsibleEntity
this.groupResponsibleEntity.responsibleId = this.groupResponsibleEntity.responsibleId.toString()
}
// 处理考勤人回显
this.attendArrId = this.attendanceGroupStaffList.map(item => item.staffId)
this.attendArr = this.attendanceGroupStaffList
this.setParams.groupName = groupName//考勤组名称
this.setParams.type = type//考勤类型
this.setParams.attendanceType = attendanceType//打卡类型
},
afterSubmit(data) {
this.open = false;
this.allReset()
this.$emit("ok",true);
},
// 处理字典
dealDic(){
this.attendanceType = []
this.classArr = this.dict.classId
this.responsiableList = this.dict.workMan
this.areaData = this.dict.deptId
for(let key in this.dict.attendanceType){
let obj = {
label:this.dict.attendanceType[key],
value:key
}
this.attendanceType.push(obj)
}
// 类型
let typearr = []
for(let key in this.dict.type){
let obj = {
label:this.dict.type[key],
value:Number(key)
}
typearr.push(obj)
}
typearr.forEach((item,index) => {
let res = this.paibanType.filter(item1 => item1.label.indexOf(item.label) != -1)
if(res.length>0){
res[0].value = typearr[index].value
}
})
},
// ---- 班次选择 -------
// 当前班次选择
saveRowBanci(val){
this.groupFixedworkEntity[this.currentWorkName+'ClassId'] = val.id//存储班次id
this.groupFixedworkEntity[this.currentWorkName+'ClassName'] = val.className//存储班次名称
// this.groupFixedworkEntity[this.currentWorkName+'ClassTime'] = val
this.$set(
this.groupFixedworkEntity,
this.currentWorkName+'ClassTime',
val
)
console.log(this.groupFixedworkEntity[this.currentWorkName+'ClassTime'],'当前更改')
this.cancelBanci()
},
// 固定班制 ---- 触发班次选择
changeBanci(row){
this.currentWorkName = row
this.currentselectBanciRow = JSON.parse(JSON.stringify(this.groupFixedworkEntity[this.currentWorkName+'ClassTime']))
this.isshowBanci = true
},
// 置空
cancelBanci(){
this.isshowBanci = false
this.currentselectBanciRow = null
},
// ----end ----
// ----- 特殊日期选择 ----
// 删除必须
deleteSpecal(from){
if(from == 'must'){
this.mustDakaObj = null
}else{
this.noneedDakaObj = null
}
},
// 新增必须打卡 --- 触发班次
setMustTimes(from){
if(from == 'must' && !this.mustDakaObj){
this.mustDakaObj = {
must:1,//必需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
}
}else if (from == 'noneed' && !this.noneedDakaObj){
this.noneedDakaObj = {
must:0,//无需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
}
}
if(from == 'must'){
this.mustDaka = true
this.currentParams = this.mustDakaObj
this.currentselectBanciRow = this.currentParams.classArr
}else{
this.currentParams = this.noneedDakaObj
if(this.currentParams.specialStartTime){
this.noneedRange = [this.currentParams.specialStartTime,this.currentParams.specialEndTime]
}else{
this.noneedRange = []
}
this.noneedDaka = true
}
},
// 保存必须打卡
saveCurrentSpecial(val){
this.currentParams.classArr = val
this.currentParams.classId = val.id
if(!this.currentParams.specialTime){
this.$message.error('请选择日期')
return
}
if(!this.currentParams.classId){
this.$message.error('请选择班次')
return
}
if(this.noneedDakaObj){
if(this.noneedDakaObj.specialTime === this.currentParams.specialTime){
this.$message.error('该日期已设置为无需打卡日,请重新选择')
return
}
let timeStart = Date.parse(this.noneedDakaObj.specialStartTime)//无需开始时间戳
let timeEnd = Date.parse(this.noneedDakaObj.specialEndTime)//无需结束时间戳
let mustTime = Date.parse(this.currentParams.specialTime)//必须时间戳
if(mustTime >= timeStart && mustTime <= timeEnd){
this.$message.error('必须打卡日期不能设置在无需打卡时间段内,请重新选择')
return false
}
}
this.mustDakaObj = JSON.parse(JSON.stringify(this.currentParams))
this.cancelSpecial()
},
// 取消当前特殊日期设置
cancelSpecial(){
this.currentParams = {}
this.noneedRange = []
this.mustDaka = false
this.noneedDaka = false
this.currentselectBanciRow = null
},
// 无需时间段
changeneedRange(){
if(this.noneedRange){
this.currentParams.specialStartTime = this.noneedRange[0]
this.currentParams.specialEndTime = this.noneedRange[1]
}else{
this.currentParams.specialStartTime = ''
this.currentParams.specialEndTime = ''
}
},
// 保存 无需打卡
saveNoneed(){
if(this.currentParams.addWay === 0 && this.currentParams.specialTime == ''){
this.$message.error('请选择日期')
return
}
if(this.currentParams.addWay === 1 && this.currentParams.specialStartTime == ''){
this.$message.error('请选择时间段')
return
}
if(this.mustDakaObj){
if(this.mustDakaObj.specialTime === this.currentParams.specialTime &&
this.mustDakaObj.specialTime != ''){
this.$message.error('该日期已设置为必须打卡日,请重新选择')
return
}
let timeStart = Date.parse(this.currentParams.specialStartTime)//无需开始时间戳
let timeEnd = Date.parse(this.currentParams.specialEndTime)//无需结束时间戳
let mustTime = Date.parse(this.mustDakaObj.specialTime)//必须时间戳
if(mustTime >= timeStart && mustTime <= timeEnd){
this.$message.error('无需打卡时间段内不能含有[必须打卡日期],请重新选择')
return false
}
}
this.noneedDakaObj = JSON.parse(JSON.stringify(this.currentParams))
this.cancelSpecial()
},
// ---- end -------
// ---- 部门-人员选择 ------
// 触发部门选择
selectGroup(from){
this.selectTyep = from
if(this.selectTyep){
this.allSelect = this.attendArr
this.allSelectId = this.attendArrId
}else{
this.allSelect = this.noattendArr
this.allSelectId = this.attendArrId
}
this.isshowgroup = true
},
// 取消选择
cancelChoice(){
this.isshowgroup = false
this.currentSelect = []
this.allSelect = []
this.allSelectId = []
this.CurrentAllchecked = false
},
// 确定当前选择
saveBtnchoice(){
this.CurrentAllchecked = false
if(this.selectTyep){
this.attendArr = this.allSelect
this.attendArrId = this.allSelectId
// 参与考勤
}else{
// 不参与考勤
this.noattendArr = this.allSelect
this.attendArrId = this.allSelectId
}
this.cancelChoice()
},
// 单独选择
changegroupId(val){
let value
if(val){
// id
value = this.allSelectId.filter(item1 => !this.allSelect.some(item2 => item2.staffId === item1))
let obj = this.currentSelect.find(item => item.staffId === value[0])
this.allSelect.push(obj)
}else{
// 对象
value = this.allSelect.filter(item1 => !this.allSelectId.some(item2 => item2 === item1.staffId))
let index = this.allSelect.findIndex(item => item.staffId == value[0].staffId)
this.allSelect.splice(index,1)
}
this.CurrentAllchecked = this.currentSelect.every(val => this.allSelectId.includes(val.staffId))
console.log(value,'当前选择值')
},
// 点击触发
handleNodeClickBumen(val){
if(this.selectTyep){
}else{
}
this.currentSelect = val.personList//人员信息
// 判断当前是不是全选
this.CurrentAllchecked = this.currentSelect.every(val => this.allSelectId.includes(val.staffId))
},
// 全选操作
currentChangeAll(){
if(this.CurrentAllchecked){
// 当前全选
let arr1 = this.currentSelect.filter(item => !this.allSelect.some(item2 => item2 === item))
this.allSelect = [...this.allSelect,...arr1]//渲染列表
let arr2 = this.currentSelect.filter(item1 => !this.allSelectId.some(item2 => item2 === item1.staffId))
this.allSelectId = [...this.allSelectId,...arr2.map(item=>item.staffId)]//id信息
}else{
//取消当前全选
this.allSelect = this.allSelect.filter(item1 => !this.currentSelect.some(item2 => item2 === item1))
this.allSelectId = this.allSelectId.filter(item1 => !this.currentSelect.some(item2 => item2.staffId === item1))
}
},
// 删除某个选择
deleteOne(index){
this.allSelect.splice(index,1)
this.allSelectId.splice(index,1)
this.CurrentAllchecked = this.currentSelect.every(val => this.allSelectId.includes(val.staffId)) //判断全选
},
// ---- end -------
// 考勤方式发生改变 -置空其他类别选项
changeRadio(){
// 自由工时置空
for(let key in this.attendanceGroupFreeworkEntity){
this.attendanceGroupFreeworkEntity[key] = 0
}
this.attendanceGroupFreeworkEntity.workTime = ''
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList = []
// 固定班制置空
for(let key in this.groupFixedworkEntity){
this.groupFixedworkEntity[key] = ''
}
for(let item of this.typeList){
this.groupFixedworkEntity[item.value] = 0
this.groupFixedworkEntity[item.value+'ClassTime'] = []
this.groupFixedworkEntity[item.value+'ClassName'] = ''
this.groupFixedworkEntity[item.value+'ClassId'] = ''
}
this.attendanceGroupFixedworkSpecialList = []
},
// 触发对应流程设置
drawershow(from){
switch(from){
case 'drawer1':
this.drawer = true
this.drawer1 = true
break;
case 'drawer2':
this.drawer = true
this.drawer2 = true
break;
case 'drawer3':
this.drawer = true
this.drawer3 = true
break;
case 'drawer4':
this.drawer = true
this.drawer4 = true
break;
default:
break;
}
},
// 关闭流程设置
closedrawer(){
this.drawer = false
this.drawer1 = false
this.drawer2 = false
this.drawer3 = false
this.drawer4 = false
},
// 全部置空
allReset(){
// 置空无关项
this.changeRadio()
// 先大概处理
for(let key in this.setParams){
this.setParams[key] = ''
}
this.setParams.attendanceGroupStaffList = []
this.attendArr = []
this.attendArrId = []
this.allSelectId = []
this.allSelect = []
this.currentSelect = []
this.cancelBanci()
},
// 提交保存
saveSetform(){
// 校验 考勤组名称、参与考勤人员、考勤组负责人、
// 考勤时间 固定班制 -- 校验 排班是否设置 排班id 日期是否参与考勤
// 自由时间 -- 是否参与考勤 工作时长
// 排班制 -- 不确定
// ---- 基础判断 ---
if(this.setParams.groupName === ''){
this.$message.error('请输入考勤组名称')
return
}
if(this.attendArr.length<1){
this.$message.error('请设置参与考勤人员')
return
}
if(this.groupResponsibleEntity.responsibleId == ''){
this.$message.error('请设置考勤负责人')
return
}
if(this.setParams.type === ''){
this.$message.error('请设置考勤方式')
return
}
if(this.setParams.attendanceType === ''){
this.$message.error('请设置打卡方式')
return false
}
// -----end ---
// 处理特殊日期
if(this.mustDakaObj){
this.attendanceGroupFixedworkSpecialList.push(this.mustDakaObj)
}
if(this.noneedDakaObj){
this.attendanceGroupFixedworkSpecialList.push(this.noneedDakaObj)
}
// ---- 根据类型判断 ---
// 固定班制校验
if(this.setParams.type == 1){
for(let item of this.typeList){
if(this.groupFixedworkEntity[item.value] && !this.groupFixedworkEntity[item.value+'ClassId']){
this.$message.error(`${item.name} 考勤班次未设置`)
return false
}
}
}
// 自由工时校验
if(this.setParams.type == 3){
if(this.attendanceGroupFreeworkEntity.workTime == '' ){
this.$message.error('请设置工作时长')
return false
}
}
// ---- end ----
// ---- 处理数据 ----
if(this.attendArr.length > 0){
this.setParams.attendanceGroupStaffList = this.attendArr.map(item => {
return{
staffId:item.staffId,
staffName:item.staffName
}
})
}
if(this.groupResponsibleEntity.responsibleId){
// 给负责人进行赋值
this.groupResponsibleEntity.responsibleName = this.responsiableList[this.groupResponsibleEntity.responsibleId]
}
// 固定工时
if(this.setParams.type == 1){
if(this.attendanceGroupFixedworkSpecialList&&this.attendanceGroupFixedworkSpecialList.length>0){
this.groupFixedworkEntity.attendanceGroupFixedworkSpecialList =
this.attendanceGroupFixedworkSpecialList//特殊日期设置
}
this.setParams.groupFixedworkEntity = this.groupFixedworkEntity
if(this.setParams.hasOwnProperty('attendanceGroupFreeworkEntity')){
delete this.setParams.attendanceGroupFreeworkEntity
}
}
// 自由工时
if(this.setParams.type == 3){
if(this.attendanceGroupFixedworkSpecialList && this.attendanceGroupFixedworkSpecialList.length>0){
this.attendanceGroupFreeworkEntity.attendanceGroupFreeworkSpecialList =
this.attendanceGroupFixedworkSpecialList//特殊日期
}
this.setParams.attendanceGroupFreeworkEntity = this.attendanceGroupFreeworkEntity
if(this.setParams.hasOwnProperty('groupFixedworkEntity')){
delete this.setParams.groupFixedworkEntity
}
}
// 考勤负责人
this.setParams.groupResponsibleEntity = this.groupResponsibleEntity
// ----- end ----
this.$post(this.urls.saveUrl || this.pageInfo.saveUrl,this.setParams).then(res => {
if(res.code == 1){
this.afterSubmit()
}
})
},
}, },
computed:{ {
persons(){ label: "自由工时(不固定时间上下班)",
let arrName = this.attendArr.map(item => item.staffName) value: 3,
return arrName.join(',') des: "上下班时间不固定,可随时打卡,适用于销售以及装修、家政等计时工",
}
}, },
data() { ],
return { typeList: [
open:false, {
activeName:'/attendance/group/view', name: "周一",
thirdList:[ value: "monday",
{ },
name:'新增考勤组', {
path:'/attendance/group/view' name: "周二",
} value: "tuesday",
], },
paibanType:[ {
{ name: "周三",
label:'固定班制(固定时间上下班)', value: "wednesday",
value:1, },
des:'考勤组中所有人按照相同的时间打卡,适用于办公室坐班,例如朝九晚五' {
}, name: "周四",
{ value: "thursday",
label:'排班制(按排班上下班)', },
value:2, {
des:'自定义设置每人的班次,适用于工厂、门店等,例如三班倒' name: "周五",
}, value: "friday",
{ },
label:'自由工时(不固定时间上下班)', {
value:3, name: "周六",
des:'上下班时间不固定,可随时打卡,适用于销售以及装修、家政等计时工' value: "saturday",
} },
], {
typeList:[ name: "周日",
{ value: "sunday",
name:'周一', },
value:'monday' ],
}, classArr: [], //公共字典 - 班次选择
{ attendanceType: [], //打卡类型 - 公共字典
name:'周二', areaData: [], //部门信息 - 公共字典
value:'tuesday' responsiableList: [], //负责人选择 -公共字典
},
{ // 当前选择员工
name:'周三', currentSelect: [],
value:'wednesday' // 员工总表
}, allSelect: [], //选择的列表
{ allSelectId: [], //选择的id
name:'周四', CurrentAllchecked: false,
value:'thursday' // 存储当前参与考勤人员
}, attendArr: [],
{ attendArrId: [],
name:'周五', // 存储当前不参与考勤人员
value:'friday' noattendArr: [],
}, noattendArrIc: [],
{
name:'周六', selectTyep: "", //选择人员类型 true参与考勤人员//false不参与考勤人员
value:'saturday' drawer1: false,
}, drawer2: false,
{ drawer3: false,
name:'周日', drawer4: false,
value:'sunday' drawer: false,
} isshowBanci: false, //班次展示
], isshowgroup: false, //人员选择
classArr:[],//公共字典 - 班次选择 mustDaka: false, //必须打卡设置
attendanceType:[],//打卡类型 - 公共字典 noneedDaka: false, //无需打卡
areaData:[],//部门信息 - 公共字典
responsiableList:[],//负责人选择 -公共字典 setParams: {
groupName: "", //考勤名称
// 当前选择员工 attendanceGroupStaffList: [], //参与考勤人员
currentSelect:[], type: "", //考勤方式
// 员工总表 attendanceType: "", //打卡类型
allSelect:[],//选择的列表 },
allSelectId:[],//选择的id // 考勤赋值
CurrentAllchecked:false, groupResponsibleEntity: {
// 存储当前参与考勤人员 responsibleId: "", //考勤负责人
attendArr:[], responsibleName: "", //考勤负责人姓名
attendArrId:[], },
// 存储当前不参与考勤人员
noattendArr:[], type: [],
noattendArrIc:[], currentselectBanciRow: "", //当前班次
// 当前工作日名称
selectTyep:'',//选择人员类型 true参与考勤人员//false不参与考勤人员 currentWorkName: "",
drawer1:false, noneedRange: [], //时间段选择
drawer2:false, // 当前特殊日期
drawer3:false, currentParams: {},
drawer4:false, // 自由工时配置
drawer:false, attendanceGroupFreeworkEntity: {
isshowBanci:false,//班次展示 monday: 0,
isshowgroup:false,//人员选择 tuesday: 0,
mustDaka:false,//必须打卡设置 wednesday: 0,
noneedDaka:false,//无需打卡 thursday: 0,
friday: 0,
setParams:{ saturday: 0,
groupName:'',//考勤名称 sunday: 0,
attendanceGroupStaffList:[],//参与考勤人员 workTime: "",
type:'',//考勤方式 // attendanceGroupFreeworkSpecialList:[]
attendanceType:'',//打卡类型 },
}, //固定班制
// 考勤赋值 groupFixedworkEntity: {
groupResponsibleEntity:{ monday: 0, //是否考勤(0.否,1,是)
responsibleId:'',//考勤负责人 mondayClassId: "",
responsibleName:''//考勤负责人姓名 mondayClassName: "",
}, mondayClassTime: [], //便于选择-传参删除
type:[], tuesday: 0, //是否考勤(0.否,1,是)
currentselectBanciRow:'',//当前班次 tuesdayClassId: "",
// 当前工作日名称 tuesdayClassName: "",
currentWorkName:'', tuesdayClassTime: [], //便于选择-传参删除
noneedRange:[],//时间段选择
// 当前特殊日期 wednesday: 0, //是否考勤(0.否,1,是)
currentParams:{}, wednesdayClassId: "",
// 自由工时配置 wednesdayClassName: "",
attendanceGroupFreeworkEntity:{ wednesdayClassTime: [], //便于选择-传参删除
monday:0,
tuesday:0, thursday: 0, //是否考勤(0.否,1,是)
wednesday:0, thursdayClassId: "",
thursday:0, thursdayClassName: "",
friday:0, thursdayClassTime: [],
saturday:0,
sunday:0, friday: 0, //是否考勤(0.否,1,是)
workTime:'', fridayClassId: "",
// attendanceGroupFreeworkSpecialList:[] fridayClassName: "",
}, fridayClassTime: "", //便于选择-传参删除
//固定班制
groupFixedworkEntity:{ saturday: 0, //是否考勤(0.否,1,是)
monday:0,//是否考勤(0.否,1,是) saturdayClassId: "",
mondayClassId:'', saturdayClassName: "",
mondayClassName:'', saturdayClassTime: [], //便于选择-传参删除
mondayClassTime:[],//便于选择-传参删除
sunday: 0, //是否考勤(0.否,1,是)
tuesday:0,//是否考勤(0.否,1,是) sundayClassId: "",
tuesdayClassId:'', sundayClassName: "",
tuesdayClassName:'', sundayClassTime: [], //便于选择-传参删除
tuesdayClassTime:[],//便于选择-传参删除 holidays: "",
// attendanceGroupFixedworkSpecialList:[],
wednesday:0,//是否考勤(0.否,1,是) },
wednesdayClassId:'',
wednesdayClassName:'', holidays: 0, // 假期排休 法定节假日自动排休(0.否,1.是)
wednesdayClassTime:[],//便于选择-传参删除
// 公共 - 特殊日期设置
thursday:0,//是否考勤(0.否,1,是) attendanceGroupFixedworkSpecialList: [],
thursdayClassId:'', // 必须打卡日期
thursdayClassName:'', mustDakaObj: {
thursdayClassTime:[], must: 1, //必需打卡
specialStartTime: "", //时间段
friday:0,//是否考勤(0.否,1,是) specialEndTime: "", //
fridayClassId:'', specialTime: "", //必须打卡日期
fridayClassName:'', addWay: 0, //日期还是时间段
fridayClassTime:'',//便于选择-传参删除 classId: "",
classArr: {},
saturday:0,//是否考勤(0.否,1,是) },
saturdayClassId:'', // 无需打卡日期
saturdayClassName:'', noneedDakaObj: {
saturdayClassTime:[],//便于选择-传参删除 must: 0, //无需打卡
specialStartTime: "", //时间段
sunday:0,//是否考勤(0.否,1,是) specialEndTime: "", //
sundayClassId:'', specialTime: "", //必须打卡日期
sundayClassName:'', addWay: 0, //日期还是时间段
sundayClassTime:[],//便于选择-传参删除 classId: "",
holidays:"", classArr: {},
// attendanceGroupFixedworkSpecialList:[], },
}, };
},
holidays:0,// 假期排休 法定节假日自动排休(0.否,1.是) };
// 公共 - 特殊日期设置
attendanceGroupFixedworkSpecialList:[],
// 必须打卡日期
mustDakaObj:{
must:1,//必需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
},
// 无需打卡日期
noneedDakaObj:{
must:0,//无需打卡
specialStartTime:'',//时间段
specialEndTime:'',//
specialTime:'',//必须打卡日期
addWay:0,//日期还是时间段
classId:'',
classArr:{}
}
}
}
}
</script> </script>
<style lang="less"> <style lang="less">
.container{ .container {
font-size: 15px; font-size: 15px;
} }
.labelClass{ .labelClass {
width: 200px; width: 200px;
} }
.el-descriptions__body{ .el-descriptions__body {
margin-left: 5px; margin-left: 5px;
margin-right: 5px; margin-right: 5px;
color: #606266; color: #606266;
background-color: #FFF; background-color: #fff;
} }
.contentClass{ .contentClass {
width: 600px; width: 600px;
} }
.titles{ .titles {
color: #409EFF; color: #409eff;
font-size: 16px; font-size: 16px;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.titles::before{ .titles::before {
content: ''; content: "";
width:6px; width: 6px;
height: 16px; height: 16px;
background-color: #409EFF; background-color: #409eff;
display: inline-block; display: inline-block;
margin-right: 10px; margin-right: 10px;
} }
.tips{ .tips {
color: #999; color: #999;
font-size: 12px; font-size: 12px;
} }
</style> </style>
...@@ -453,15 +453,16 @@ export default { ...@@ -453,15 +453,16 @@ export default {
: ""; : "";
} }
this.form.checkResult = 1; this.form.checkResult = 1;
this.form.view = "核查";
this.$post("/perform/rules/list", { this.$post("/perform/rules/list", {
page: 1, page: 1,
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
this.open = true;
}); });
this.form.view = "核查";
this.open = true;
} }
); );
this.pageInfo.type = "edit"; this.pageInfo.type = "edit";
......
...@@ -492,7 +492,7 @@ export default { ...@@ -492,7 +492,7 @@ export default {
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
}); });
this.form.view = "核查"; this.form.view = "核查";
this.open = true; this.open = true;
......
...@@ -465,7 +465,7 @@ export default { ...@@ -465,7 +465,7 @@ export default {
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
}); });
this.form.view = "核查"; this.form.view = "核查";
this.open = true; this.open = true;
......
...@@ -458,7 +458,7 @@ export default { ...@@ -458,7 +458,7 @@ export default {
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
}); });
this.form.view = "核查"; this.form.view = "核查";
this.open = true; this.open = true;
......
...@@ -457,7 +457,7 @@ export default { ...@@ -457,7 +457,7 @@ export default {
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
}); });
this.form.view = "核查"; this.form.view = "核查";
this.open = true; this.open = true;
......
...@@ -458,7 +458,7 @@ export default { ...@@ -458,7 +458,7 @@ export default {
size: -1, size: -1,
categoryId: this.form.categoryId, categoryId: this.form.categoryId,
}).then((res) => { }).then((res) => {
this.ruleArr = res.data.data; this.kaoqinArr = res.data.data;
}); });
this.form.view = "核查"; this.form.view = "核查";
this.open = true; this.open = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment