1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 23:11:24 +08:00

Split the punch card assembly

This commit is contained in:
gzw
2023-06-08 00:40:01 +08:00
parent dce4b7d391
commit cc293fa784
4 changed files with 89 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
<template>
<el-form ref="ruleForm" :rules="rules" :model="form" :label-width="formLabelWidth">
<el-form-item label="用户" prop="userId">
<el-form-item label="用户" prop="userId">
<el-select
v-model="form.userId"
filterable

View File

@@ -0,0 +1,80 @@
<template>
<el-form ref="ruleForm" :model="form" :label-width="formLabelWidth">
<el-form-item label="考勤时间" prop="attTime">
<el-date-picker v-model="form.attTime" type="datetime" disabled style="width: 200px" />
</el-form-item>
</el-form>
<div>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm()">确认</el-button>
<el-button @click="cancel">取消</el-button>
</span>
</div>
</template>
<script>
import { ElMessage } from 'element-plus'
import _ from 'lodash'
import request from '@/services'
import { DATABASE_SAVE_OK } from '@/constants/Common.constants'
export default {
name: 'EditOneAttendance',
data() {
return {
formLabelWidth: '80px',
form: {
attTime: new Date()
},
nowTime: new Date()
}
},
props: {
formData: {}
},
methods: {
submitForm() {
this.doSave()
},
// 点击取消
cancel() {
ElMessage({
message: '取消操作',
type: 'warning'
})
this.$emit('setDialogVisible', false)
},
alarm() {
setInterval(() => {
this.form.attTime = new Date()
}, 500)
},
doSave() {
request
.post('/attendance/saveOneAttendance', this.form)
.then((response) => {
if (response.data.code === DATABASE_SAVE_OK) {
ElMessage({
message: '签到成功',
type: 'success'
})
this.$emit('setDialogVisible', false)
}
})
.catch((reportError) => {
ElMessage({
message: '签到成功',
type: 'success'
})
})
}
},
created() {
this.alarm()
if (this.formData) {
this.form = _.cloneDeep(this.formData)
}
}
}
</script>
<style scoped></style>

View File

@@ -130,6 +130,7 @@
width="25% "
:close-on-click-modal="false"
:show-close="false"
style="min-width: 320px"
>
<edit-attendance
:users="users"
@@ -144,6 +145,7 @@
width="25% "
:close-on-click-modal="false"
:show-close="false"
style="min-width: 320px"
>
<edit-attendance
:users="users"

View File

@@ -73,6 +73,7 @@
</template>
</el-table-column>
</el-table>
<el-dialog
v-model="dialogFormVisible"
title="考勤信息"
@@ -80,18 +81,7 @@
:close-on-click-modal="false"
:show-close="false"
>
<el-form ref="ruleForm" :model="form" :label-width="formLabelWidth">
<el-form-item label="考勤时间" v-model="attTime" prop="attTime">
<el-date-picker v-model="nowTime" type="datetime" disabled style="width: 200px" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="submitForm()">确认</el-button>
<el-button @click="cancel">取消</el-button>
</span>
</template>
<edit-one-attendance @setDialogVisible="setDialogVisible"></edit-one-attendance>
</el-dialog>
</template>
@@ -113,11 +103,7 @@ export default {
attTime: [],
attTimeB: [],
status: '',
pageNum: 1,
pageSize: 10,
total: 0,
nowTime: new Date(),
formLabelWidth: '80px',
dataLoading: true,
value1: '',
form: {
@@ -152,6 +138,10 @@ export default {
newFormat = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss
return newFormat
},
setDialogVisible(dialogVisible) {
this.dialogFormVisible = dialogVisible
this.getAttendancesByUserId()
},
// 重置参数
resetParam() {
@@ -215,44 +205,9 @@ export default {
handleAdd() {
this.dialogFormVisible = true
// this.getNowDate()
this.nowTime = new Date()
this.form.attTime = this.nowTime
this.$nextTick(() => {
this.form.userId = this.userId + ''
})
},
doSave() {
request
.post('/attendance/saveOneAttendance', this.form)
.then((response) => {
this.dialogFormVisible = false
this.getAttendancesByUserId()
})
.catch((reportError) => {})
},
submitForm() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.doSave()
ElMessage({
message: '操作成功',
type: 'success'
})
} else {
ElMessage.error('操作失败')
return false
}
})
},
// 点击取消
cancel() {
this.dialogFormVisible = false
ElMessage({
message: '取消操作',
type: 'warning'
})
this.getAttendancesByUserId()
}
},