|
@@ -0,0 +1,118 @@
|
|
|
+<template>
|
|
|
+ <el-dialog
|
|
|
+ v-if="dialogVisible"
|
|
|
+ v-model="dialogVisible"
|
|
|
+ title="修改"
|
|
|
+ width="30%"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
+ <div class="content">
|
|
|
+ <div class="fromBox">
|
|
|
+ <p class="m-b10px">部门:</p>
|
|
|
+ <el-input v-model="bmName" disabled />
|
|
|
+ </div>
|
|
|
+ <div class="fromBox">
|
|
|
+ <p class="m-b10px">姓名:</p>
|
|
|
+ <el-input v-model="userName" disabled />
|
|
|
+ </div>
|
|
|
+ <div class="fromBox">
|
|
|
+ <p class="m-b10px m-t20px">考勤状态:</p>
|
|
|
+ <el-select v-model="kqState" placeholder="请选择考勤状态">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in getDictOptions(DICT_TYPE.ADM_ATTENDANCE_STATUS)"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="commitClick"> 确认 </el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+</template>
|
|
|
+<script setup lang="ts">
|
|
|
+defineOptions({ name: 'AttendanceDep' })
|
|
|
+import * as MineApi from '@/api/oa/attendanceCenter'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
|
|
+import moment from 'moment'
|
|
|
+const dialogVisible = ref(false)
|
|
|
+const kqState = ref('')
|
|
|
+const userName = ref('')
|
|
|
+const bmName = ref('')
|
|
|
+const userParams = ref({
|
|
|
+ id: '',
|
|
|
+ userId: '',
|
|
|
+ deptId: ''
|
|
|
+})
|
|
|
+const toMonth = ref([])
|
|
|
+const handleClose = (done: () => void) => {
|
|
|
+ done()
|
|
|
+}
|
|
|
+
|
|
|
+const initShow = (row, item, index, month) => {
|
|
|
+ dialogVisible.value = true
|
|
|
+ userParams.value.id = row.id
|
|
|
+ userParams.value.userId = row.userId
|
|
|
+ userParams.value.deptId = row.deptId
|
|
|
+ bmName.value = row.deptName
|
|
|
+ userName.value = row.nickName
|
|
|
+
|
|
|
+ let today = item.date
|
|
|
+ let toMoseMonths: any = []
|
|
|
+ toMoseMonths[0] = moment(today).startOf('months').format('YYYY-MM-DD') + ' 00:00:00'
|
|
|
+ toMoseMonths[1] = moment(today).endOf('months').format('YYYY-MM-DD') + ' 23:59:59'
|
|
|
+ toMonth.value = toMoseMonths
|
|
|
+ row.attendArray.forEach((item) => {
|
|
|
+ if (item.date == today) {
|
|
|
+ if (index == 1) {
|
|
|
+ kqState.value = item.swAttendanceStatus + ''
|
|
|
+ } else {
|
|
|
+ kqState.value = item.xwAttendanceStatus + ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+const emit = defineEmits(['updataInit'])
|
|
|
+const commitClick = () => {
|
|
|
+ let params = {
|
|
|
+ id: userParams.value.id, // 考勤状态,示例值(2)
|
|
|
+ userId: userParams.value.userId, // 考勤状态,示例值(2)
|
|
|
+ deptId: userParams.value.deptId, // 考勤状态,示例值(2)
|
|
|
+ attendanceStatus: Number(kqState.value) // 考勤状态,示例值(2)
|
|
|
+ }
|
|
|
+ if (kqState.value == '') {
|
|
|
+ ElMessage({
|
|
|
+ message: '请选择考勤状态!',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ MineApi.updateWorkdayList(params).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ dialogVisible.value = false
|
|
|
+ emit('updataInit', toMonth.value)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+defineExpose({
|
|
|
+ initShow
|
|
|
+})
|
|
|
+onMounted(() => {})
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.content {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-between;
|
|
|
+ .fromBox {
|
|
|
+ width: calc(50% - 10px);
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|