|
@@ -0,0 +1,604 @@
|
|
|
+<template>
|
|
|
+ <div class="calendarAttendance">
|
|
|
+ <!-- 头部 -->
|
|
|
+ <div class="calendarAttendance-title">
|
|
|
+ <div class="calendarAttendance-title-left">
|
|
|
+ <el-date-picker v-model="currentMonth" type="month" placeholder="选择月" size="small" value-format="yyyy-MM"
|
|
|
+ :clearable="false" @change="refreshTabData(false)"></el-date-picker>
|
|
|
+
|
|
|
+ <el-radio-group v-model="tabValue" size="small" style="margin-left: 20px;" @change="refreshTabData(true)">
|
|
|
+ <el-radio-button label="出勤日历"></el-radio-button>
|
|
|
+ <el-radio-button label="员工日历"></el-radio-button>
|
|
|
+ <el-radio-button label="员工考勤"></el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+
|
|
|
+ <template v-if="tabValue != '出勤日历' && haveYouViewedAllOfThem">
|
|
|
+ <el-select v-model="userId" placeholder="请选择" clearable filterable @change="refreshTabData(true)" size="small"
|
|
|
+ style="margin-left: 20px;">
|
|
|
+ <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="calendarAttendance-title-right">
|
|
|
+ <el-button type="primary" size="small" @click="displayExamRules()">考勤规则</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="importAttendanceShow()">导入考勤</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="displayHighTemperatureDaySettings()">高温日设置</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="displaySpecialDaySettings()">特殊节假日设置</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 主体内容 -->
|
|
|
+ <div class="calendarAttendance-content">
|
|
|
+ <transition name="fade" mode="out-in">
|
|
|
+ <component :is="currentTabComponent" :key="tabValue" ref="tabComponentRef" />
|
|
|
+ </transition>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 导入考勤 -->
|
|
|
+ <el-dialog title="导入考勤" :visible.sync="importAttendanceVisable" customClass="customWidth" width="500px">
|
|
|
+ <p>1. 下载
|
|
|
+ <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/考勤模板.xlsx"
|
|
|
+ :download="`考勤导入模板.xlsx`">考勤导入模板.xlsx</el-link>
|
|
|
+ </p>
|
|
|
+ <p>1. 导入月份
|
|
|
+ <el-date-picker v-model="currentMonthExport" type="month" placeholder="选择月" size="small" value-format="yyyy-MM" style="margin-left:5px;"
|
|
|
+ :clearable="false"></el-date-picker>
|
|
|
+ </p>
|
|
|
+ <!-- <p>2. 填写excel模板,请确保模板中的项目和人员已添加到系统中。</p> -->
|
|
|
+ <p style="display: flex;justify-content: center;padding:1em 0">
|
|
|
+ <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
|
|
|
+ <el-button type="primary" :underline="false" :loading="startImportingLoading">开始导入</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </p>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 高温日设置 -->
|
|
|
+ <el-dialog title="高温日设置" :visible.sync="highTemperatureDayVisable" customClass="customWidth" width="900px"
|
|
|
+ top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-table ref="highTemperatureDayTable" :data="highTemperatureDayList" style="width: 100%" height="50vh" border
|
|
|
+ @selection-change="highTemperatureSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
+ <el-table-column prop="date" label="日期" width="250">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.startDate }} 至 {{ scope.row.endDate }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="描述"></el-table-column>
|
|
|
+ <el-table-column label="编辑" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" size="small" @click="editHighTemperatureDay(scope.row)">编辑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <el-button type="danger" size="small" :disabled="!selectHighTemperatureDay.length"
|
|
|
+ @click="batchDeleteHighTemperature()">批量删除</el-button>
|
|
|
+ <div>
|
|
|
+ <el-button size="small" @click="highTemperatureDayVisable = false">关闭</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="editHighTemperatureDay()">新增高温日</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 新增编辑高温日 -->
|
|
|
+ <el-dialog title="新增编辑高温日" :visible.sync="editHighTemperatureDayVisible" customClass="customWidth" width="900px"
|
|
|
+ top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="hotDayForm" label-width="80px">
|
|
|
+ <el-form-item label="时间段">
|
|
|
+ <el-date-picker v-model="hotDayForm.timeSlot" type="daterange" range-separator="至" start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期" value-format="yyyy-MM-dd" :clearable="false"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="描述">
|
|
|
+ <el-input type="textarea" :rows="8" v-model="hotDayForm.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <el-button size="small" @click="editHighTemperatureDayVisible = false">关闭</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="saveHighTemperatureDay()" :disabled="!hotDayForm.timeSlot.length">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 特殊节假日设置 -->
|
|
|
+ <el-dialog title="特殊节假日设置" :visible.sync="specialDayVisable" customClass="customWidth" width="900px" top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-table ref="specialDayTable" :data="specialDayList" style="width: 100%" height="50vh" border
|
|
|
+ @selection-change="specialDaySelectionChange" v-loading="specialDayLoading">
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
+ <el-table-column prop="specialDate" label="日期" width="250"></el-table-column>
|
|
|
+ <el-table-column prop="type" label="类型" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.type === 0 ? '节假日' : '工作日' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="描述"></el-table-column>
|
|
|
+ <el-table-column label="编辑" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" size="small" @click="editSpecialDay(scope.row)">编辑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <el-button type="danger" size="small" :disabled="!selectSpecialDay.length"
|
|
|
+ @click="batchDeleteSpecialDay()">批量删除</el-button>
|
|
|
+ <div>
|
|
|
+ <el-button size="small" @click="specialDayVisable = false">关闭</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="editSpecialDay()">新增特殊节假日</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 新增编辑特殊节假日 -->
|
|
|
+ <el-dialog :title="specialDayForm.id ? '编辑特殊节假日' : '新增特殊节假日'" :visible.sync="editSpecialDayVisible"
|
|
|
+ customClass="customWidth" width="900px" top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-form ref="specialDayFormRef" :model="specialDayForm" label-width="80px">
|
|
|
+ <el-form-item label="日期" required>
|
|
|
+ <el-date-picker v-model="specialDayForm.specialDate" type="date" placeholder="选择日期"
|
|
|
+ value-format="yyyy-MM-dd" :clearable="false"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="类型" required>
|
|
|
+ <el-select v-model="specialDayForm.type" placeholder="请选择">
|
|
|
+ <el-option label="节假日" :value="0"></el-option>
|
|
|
+ <el-option label="工作日" :value="1"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="描述">
|
|
|
+ <el-input type="textarea" :rows="8" v-model="specialDayForm.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <el-button size="small" @click="editSpecialDayVisible = false">关闭</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="saveSpecialDay()"
|
|
|
+ :disabled="!specialDayForm.specialDate">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 考勤规则 -->
|
|
|
+ <el-dialog title="考勤规则" :visible.sync="attendanceRulesVisible" customClass="customWidth" width="900px" top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-table ref="attendanceRulesTable" :data="attendanceRulesList" style="width: 100%" height="50vh" border
|
|
|
+ v-loading="attendanceRulesLoading">
|
|
|
+ <el-table-column type="index" label="序号" width="60"></el-table-column>
|
|
|
+ <el-table-column prop="name" label="考勤状态" width="150"></el-table-column>
|
|
|
+ <el-table-column label="上班打卡时间范围">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.beginWorkStartTime }} - {{ scope.row.beginWorkEndTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="下班打卡时间范围">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.endWorkStartTime }} - {{ scope.row.endWorkEndTime }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="primary" size="small" @click="editAttendanceRule(scope.row)">编辑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <div></div>
|
|
|
+ <el-button size="small" @click="attendanceRulesVisible = false">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 编辑考勤规则 -->
|
|
|
+ <el-dialog :title="'编辑考勤规则 - ' + attendanceRuleForm.name" :visible.sync="editAttendanceRuleVisible"
|
|
|
+ customClass="customWidth" width="900px" top="6.5vh">
|
|
|
+ <div>
|
|
|
+ <el-form ref="attendanceRuleFormRef" :model="attendanceRuleForm" label-width="120px" :rules="attendanceRuleRules">
|
|
|
+ <el-form-item label="上班开始时间" prop="beginWorkStartTime" required>
|
|
|
+ <el-time-picker v-model="attendanceRuleForm.beginWorkStartTime" format="HH:mm" value-format="HH:mm" :clearable="false"></el-time-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="上班结束时间" prop="beginWorkEndTime" required>
|
|
|
+ <el-time-picker v-model="attendanceRuleForm.beginWorkEndTime" format="HH:mm" value-format="HH:mm" :clearable="false"></el-time-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="下班开始时间" prop="endWorkStartTime" required>
|
|
|
+ <el-time-picker v-model="attendanceRuleForm.endWorkStartTime" format="HH:mm" value-format="HH:mm" :clearable="false"></el-time-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="下班结束时间" prop="endWorkEndTime" required>
|
|
|
+ <el-time-picker v-model="attendanceRuleForm.endWorkEndTime" format="HH:mm" value-format="HH:mm" :clearable="false"></el-time-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div class="bottomOfHighTemperatureDay">
|
|
|
+ <el-button size="small" @click="editAttendanceRuleVisible = false">关闭</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="saveAttendanceRule()">保存</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import AttendanceCalendar from './attendanceCalendar.vue';
|
|
|
+import EmployeeCalendar from './employeeCalendar.vue';
|
|
|
+import EmployeeAttendance from './employeeAttendance.vue';
|
|
|
+export default {
|
|
|
+ components: { AttendanceCalendar, EmployeeCalendar, EmployeeAttendance },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ currentMonth: this.dayjs().format("YYYY-MM"),
|
|
|
+ currentMonthExport: '',
|
|
|
+ userId: '',
|
|
|
+ userList: [],
|
|
|
+ highTemperatureDayList: [],
|
|
|
+ selectHighTemperatureDay: [],
|
|
|
+ tabValue: '出勤日历',
|
|
|
+ hotDayForm: {
|
|
|
+ timeSlot: [],
|
|
|
+ remark: ''
|
|
|
+ },
|
|
|
+ importAttendanceVisable: false,
|
|
|
+ highTemperatureDayVisable: false,
|
|
|
+ editHighTemperatureDayVisible: false,
|
|
|
+ highTemperatureDayTableLoading: false,
|
|
|
+ startImportingLoading: false,
|
|
|
+ specialDayVisable: false,
|
|
|
+ specialDayLoading: false,
|
|
|
+ specialDayList: [],
|
|
|
+ selectSpecialDay: [],
|
|
|
+ editSpecialDayVisible: false,
|
|
|
+ specialDayForm: {
|
|
|
+ specialDate: '',
|
|
|
+ type: 0,
|
|
|
+ remark: ''
|
|
|
+ },
|
|
|
+ attendanceRulesVisible: false,
|
|
|
+ attendanceRulesLoading: false,
|
|
|
+ attendanceRulesList: [],
|
|
|
+ editAttendanceRuleVisible: false,
|
|
|
+ attendanceRuleForm: {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ beginWorkStartTime: '',
|
|
|
+ beginWorkEndTime: '',
|
|
|
+ endWorkStartTime: '',
|
|
|
+ endWorkEndTime: ''
|
|
|
+ },
|
|
|
+
|
|
|
+ haveYouViewedAllOfThem: false,
|
|
|
+ user: JSON.parse(sessionStorage.getItem('user')),
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentTabComponent() {
|
|
|
+ switch (this.tabValue) {
|
|
|
+ case '出勤日历':
|
|
|
+ return 'AttendanceCalendar';
|
|
|
+ case '员工日历':
|
|
|
+ return 'EmployeeCalendar';
|
|
|
+ case '员工考勤':
|
|
|
+ return 'EmployeeAttendance';
|
|
|
+ default:
|
|
|
+ return 'AttendanceCalendar';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tabComponentRef() {
|
|
|
+ switch (this.tabValue) {
|
|
|
+ case '出勤日历':
|
|
|
+ return 'attendanceCalendarRef';
|
|
|
+ case '员工日历':
|
|
|
+ return 'employeeCalendarRef';
|
|
|
+ case '员工考勤':
|
|
|
+ return 'employeeAttendanceRef';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 显示考勤规则
|
|
|
+ displayExamRules() {
|
|
|
+ this.attendanceRulesVisible = true
|
|
|
+ this.getAttendanceRules()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取考勤规则
|
|
|
+ getAttendanceRules() {
|
|
|
+ this.attendanceRulesLoading = true
|
|
|
+ this.postData('/attendance-rule/getAllList', {}).then(res => {
|
|
|
+ this.attendanceRulesList = (res.data || []).map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ beginWorkStartTime: item.beginWorkStartTime && item.beginWorkStartTime.slice(0, 5),
|
|
|
+ beginWorkEndTime: item.beginWorkEndTime && item.beginWorkEndTime.slice(0, 5),
|
|
|
+ endWorkStartTime: item.endWorkStartTime && item.endWorkStartTime.slice(0, 5),
|
|
|
+ endWorkEndTime: item.endWorkEndTime && item.endWorkEndTime.slice(0, 5),
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).finally(() => {
|
|
|
+ this.attendanceRulesLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 编辑考勤规则
|
|
|
+ editAttendanceRule(row) {
|
|
|
+ this.attendanceRuleForm = {
|
|
|
+ id: row.id,
|
|
|
+ name: row.name,
|
|
|
+ beginWorkStartTime: row.beginWorkStartTime,
|
|
|
+ beginWorkEndTime: row.beginWorkEndTime,
|
|
|
+ endWorkStartTime: row.endWorkStartTime,
|
|
|
+ endWorkEndTime: row.endWorkEndTime
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.attendanceRuleFormRef.clearValidate()
|
|
|
+ }, 0)
|
|
|
+ this.editAttendanceRuleVisible = true
|
|
|
+ },
|
|
|
+
|
|
|
+ // 保存考勤规则
|
|
|
+ saveAttendanceRule() {
|
|
|
+ this.postData('/attendance-rule/updateAttendanceRule', {
|
|
|
+ id: this.attendanceRuleForm.id,
|
|
|
+ beginWorkStartTime: this.attendanceRuleForm.beginWorkStartTime + ':00',
|
|
|
+ beginWorkEndTime: this.attendanceRuleForm.beginWorkEndTime + ':00',
|
|
|
+ endWorkStartTime: this.attendanceRuleForm.endWorkStartTime + ':00',
|
|
|
+ endWorkEndTime: this.attendanceRuleForm.endWorkEndTime + ':00'
|
|
|
+ }).then(res => {
|
|
|
+ this.$message({ type: 'success', message: '保存成功' })
|
|
|
+ this.editAttendanceRuleVisible = false
|
|
|
+ this.getAttendanceRules()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ importAttendanceShow() {
|
|
|
+ this.currentMonthExport = this.currentMonth
|
|
|
+ this.importAttendanceVisable = true
|
|
|
+ },
|
|
|
+ saveHighTemperatureDay() {
|
|
|
+ const formVal = {
|
|
|
+ ...this.hotDayForm,
|
|
|
+ startDate: this.hotDayForm.timeSlot[0],
|
|
|
+ endDate: this.hotDayForm.timeSlot[1],
|
|
|
+ }
|
|
|
+
|
|
|
+ delete formVal.timeSlot;
|
|
|
+
|
|
|
+ this.postData(`/high-temperature-set/saveOrUpdate`, {...formVal}).then((res) => {
|
|
|
+ this.$message({ type: 'success', message: '保存成功' })
|
|
|
+ this.editHighTemperatureDayVisible = false
|
|
|
+ this.getHighTemperatureDaySettings()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editHighTemperatureDay(row = false) {
|
|
|
+ if (!row) {
|
|
|
+ this.hotDayForm = {
|
|
|
+ timeSlot: [],
|
|
|
+ remark: ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.hotDayForm = {
|
|
|
+ id: row.id,
|
|
|
+ timeSlot: [row.startDate, row.endDate],
|
|
|
+ remark: row.remark
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.editHighTemperatureDayVisible = true
|
|
|
+ },
|
|
|
+ batchDeleteHighTemperature() {
|
|
|
+ this.$confirm('确定删除选中数据吗?', '批量删除', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const ids = this.selectHighTemperatureDay.map(item => item.id).join(',')
|
|
|
+ this.postData(`/high-temperature-set/deleteHigh`, { ids }).then((res) => {
|
|
|
+ this.$message({ type: 'success', message: '删除成功' })
|
|
|
+ this.getHighTemperatureDaySettings()
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ highTemperatureSelectionChange(val) {
|
|
|
+ this.selectHighTemperatureDay = val || []
|
|
|
+ },
|
|
|
+ displayHighTemperatureDaySettings() {
|
|
|
+ this.highTemperatureDayVisable = true
|
|
|
+ this.selectHighTemperatureDay = []
|
|
|
+ this.getHighTemperatureDaySettings()
|
|
|
+ },
|
|
|
+ getHighTemperatureDaySettings() {
|
|
|
+ this.highTemperatureDayTableLoading = true
|
|
|
+ this.postData('/high-temperature-set/list', {}).then(res => {
|
|
|
+ this.selectHighTemperatureDay = []
|
|
|
+ this.highTemperatureDayList = res.data || []
|
|
|
+ }).finally(() => {
|
|
|
+ this.highTemperatureDayTableLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getAllPersonnel() {
|
|
|
+ this.postData(`/user/getEmployeeList`, { pageIndex: 1, pageSize: 300, status: 1, departmentId: -1 }).then((res) => {
|
|
|
+ this.userList = res.data.records || []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ batchImportData(item) {
|
|
|
+ let str = item.file.name.split(".");
|
|
|
+ let format = str[str.length - 1];
|
|
|
+ if (format != "xls" && format != "xlsx") {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.startImportingLoading = true
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("file", item.file);
|
|
|
+ formData.append("month", this.currentMonthExport);
|
|
|
+ this.http.uploadFile('/attendance/importAttendanceData', formData,
|
|
|
+ res => {
|
|
|
+ this.startImportingLoading = false
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.importAttendanceVisable = false
|
|
|
+ this.importResultMsg = `导入成功`
|
|
|
+ this.refreshTabData(true);
|
|
|
+ } else {
|
|
|
+ this.importResultMsg = `导入失败` + res.msg;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.startImportingLoading = false
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 单独封装请求
|
|
|
+ async postData(urls, param) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this.http.post(urls, { ...param },
|
|
|
+ res => {
|
|
|
+ if (res.code == 'ok') {
|
|
|
+ resolve(res)
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ reject(res)
|
|
|
+ }
|
|
|
+ resolve(res)
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ reject(error)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ });
|
|
|
+ },
|
|
|
+ refreshTabData(directRequest = false) {
|
|
|
+ const dateVal = this.currentMonth
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.tabComponentRef.refreshData({ dateVal, directRequest, userId: this.userId });
|
|
|
+ }, 500)
|
|
|
+ },
|
|
|
+
|
|
|
+ // 特殊节假日设置相关方法
|
|
|
+ displaySpecialDaySettings() {
|
|
|
+ this.specialDayVisable = true
|
|
|
+ this.selectSpecialDay = []
|
|
|
+ this.getSpecialDayList()
|
|
|
+ },
|
|
|
+ getSpecialDayList() {
|
|
|
+ this.specialDayLoading = true
|
|
|
+ this.postData('/special-date-set/list', {}).then(res => {
|
|
|
+ this.specialDayList = res.data || []
|
|
|
+ }).finally(() => {
|
|
|
+ this.specialDayLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editSpecialDay(row = false) {
|
|
|
+ if (!row) {
|
|
|
+ this.specialDayForm = {
|
|
|
+ specialDate: '',
|
|
|
+ type: 0,
|
|
|
+ remark: ''
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.specialDayForm = {
|
|
|
+ id: row.id,
|
|
|
+ specialDate: row.specialDate,
|
|
|
+ type: row.type,
|
|
|
+ remark: row.remark
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.editSpecialDayVisible = true
|
|
|
+ },
|
|
|
+ saveSpecialDay() {
|
|
|
+ this.postData('/special-date-set/saveOrUpdate', this.specialDayForm).then(res => {
|
|
|
+ this.$message({ type: 'success', message: '保存成功' })
|
|
|
+ this.editSpecialDayVisible = false
|
|
|
+ this.getSpecialDayList()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ batchDeleteSpecialDay() {
|
|
|
+ this.$confirm('确定删除选中数据吗?', '批量删除', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const ids = this.selectSpecialDay.map(item => item.id).join(',')
|
|
|
+ this.postData('/special-date-set/deleteSpecial', { ids }).then(res => {
|
|
|
+ this.$message({ type: 'success', message: '删除成功' })
|
|
|
+ this.getSpecialDayList()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ specialDaySelectionChange(val) {
|
|
|
+ this.selectSpecialDay = val || []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() { },
|
|
|
+ mounted() {
|
|
|
+ this.getAllPersonnel()
|
|
|
+ this.refreshTabData(true)
|
|
|
+ // 查看全部员工
|
|
|
+ const permissionList = this.user.functionList || []
|
|
|
+ const list = permissionList.filter(item => item.name == '查看全部员工')
|
|
|
+ if(list.length) {
|
|
|
+ this.haveYouViewedAllOfThem = true
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log(this.haveYouViewedAllOfThem, '<====== this.haveYouViewedAllOfThem')
|
|
|
+ },
|
|
|
+ beforeDestroy() { },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.calendarAttendance {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .calendarAttendance-title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20px 20px;
|
|
|
+ border-bottom: 1px solid #e6e6e6;
|
|
|
+
|
|
|
+ .calendarAttendance-title-left {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .calendarAttendance-content {
|
|
|
+ flex: 1;
|
|
|
+ padding: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bottomOfHighTemperatureDay {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin-top: 20px;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/* 淡入淡出动画 */
|
|
|
+.fade-enter-active,
|
|
|
+.fade-leave-active {
|
|
|
+ transition: opacity 0.3s ease;
|
|
|
+}
|
|
|
+
|
|
|
+.fade-enter,
|
|
|
+.fade-leave-to {
|
|
|
+ opacity: 0;
|
|
|
+}
|
|
|
+</style>
|