|
@@ -1,6 +1,4 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { reactive, ref, nextTick, computed } from 'vue'
|
|
|
|
-import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
|
import {
|
|
import {
|
|
Overtime_User_list,
|
|
Overtime_User_list,
|
|
Overtime_Stat,
|
|
Overtime_Stat,
|
|
@@ -9,47 +7,50 @@ import {
|
|
Overtime_Edit
|
|
Overtime_Edit
|
|
} from '@/api/workAttendance/index'
|
|
} from '@/api/workAttendance/index'
|
|
import { User_List } from '@/api/user/index'
|
|
import { User_List } from '@/api/user/index'
|
|
|
|
+import { GlobalStore } from '@/stores/index'
|
|
import { UpFileToken } from '@/api/public/index'
|
|
import { UpFileToken } from '@/api/public/index'
|
|
-import Dialog from '@/components/dialog/Dialog.vue'
|
|
|
|
import Drawer from '@/components/Drawer/index.vue'
|
|
import Drawer from '@/components/Drawer/index.vue'
|
|
|
|
+import Dialog from '@/components/dialog/Dialog.vue'
|
|
|
|
+import { floatReg } from '@/views/salary/salary/relus'
|
|
|
|
+import { reactive, ref, nextTick } from 'vue'
|
|
|
|
+import TableBase from '@/components/TableBase/index.vue'
|
|
|
|
+import { getFormatDuration } from '@/utils/common'
|
|
import { Edit, Delete, View, Plus } from '@element-plus/icons-vue'
|
|
import { Edit, Delete, View, Plus } from '@element-plus/icons-vue'
|
|
-import type {
|
|
|
|
- FormInstance,
|
|
|
|
- FormRules,
|
|
|
|
- UploadFile,
|
|
|
|
- UploadInstance,
|
|
|
|
- UploadProps,
|
|
|
|
- UploadRawFile,
|
|
|
|
- UploadFiles
|
|
|
|
-} from 'element-plus'
|
|
|
|
import { ElMessageBox, ElMessage, genFileId } from 'element-plus'
|
|
import { ElMessageBox, ElMessage, genFileId } from 'element-plus'
|
|
-import { floatReg } from '@/views/salary/salary/relus'
|
|
|
|
-import { GlobalStore } from '@/stores/index'
|
|
|
|
-import { dayJs, getFormatDuration, qiniuUpLoadFun, upLoadQiniu } from '@/utils/common'
|
|
|
|
|
|
+import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
|
+import type { FormInstance, FormRules, UploadProps, UploadRawFile } from 'element-plus'
|
|
|
|
|
|
|
|
+let uuid = ''
|
|
|
|
+let isNew = true
|
|
|
|
+const search = ref('')
|
|
|
|
+const TableStatRef = ref()
|
|
|
|
+const disabled = ref(false)
|
|
|
|
+const tableApproverRef = ref()
|
|
const globalStore = GlobalStore()
|
|
const globalStore = GlobalStore()
|
|
|
|
+const formLabelWidth = ref('100px')
|
|
|
|
+const ruleFormRef = ref<FormInstance>()
|
|
|
|
+const dialog = ref<InstanceType<typeof Dialog> | null>(null)
|
|
|
|
+const drawerRef = ref<InstanceType<typeof Drawer> | null>(null)
|
|
|
|
+const TableRef = ref<InstanceType<typeof TableBase> | null>(null)
|
|
|
|
+const initParam = { User_tokey: globalStore.GET_User_tokey }
|
|
|
|
|
|
-const TableRef = ref()
|
|
|
|
-const TableStatRef = ref()
|
|
|
|
const columns: ColumnProps[] = [
|
|
const columns: ColumnProps[] = [
|
|
- { prop: 'T_start_time', label: '开始时间' },
|
|
|
|
- { prop: 'T_end_time', label: '结束时间' },
|
|
|
|
|
|
+ { prop: 'T_start_time', label: '开始时间', ellipsis: true },
|
|
|
|
+ { prop: 'T_end_time', label: '结束时间', ellipsis: true },
|
|
{ prop: 'T_duration', label: '时长', width: '100px', name: 'T_duration' },
|
|
{ prop: 'T_duration', label: '时长', width: '100px', name: 'T_duration' },
|
|
- { prop: 'T_State', label: '审核', width: '80px', name: 'T_State' },
|
|
|
|
- { prop: 'operation', label: '操作', width: 200, fixed: 'right' }
|
|
|
|
|
|
+ { prop: 'T_State', label: '审核', width: '100px', name: 'T_State' },
|
|
|
|
+ { prop: 'operation', label: '操作', width: 150, fixed: 'right' }
|
|
]
|
|
]
|
|
const columns_Stat: ColumnProps[] = [
|
|
const columns_Stat: ColumnProps[] = [
|
|
{ prop: 'T_duration', label: '时长', width: '100px', name: 'T_duration' },
|
|
{ prop: 'T_duration', label: '时长', width: '100px', name: 'T_duration' },
|
|
{ prop: 'RemainingTime', label: '剩余时长', width: '100px', name: 'RemainingTime' },
|
|
{ prop: 'RemainingTime', label: '剩余时长', width: '100px', name: 'RemainingTime' },
|
|
{ prop: 'T_type_name', label: '事项' },
|
|
{ prop: 'T_type_name', label: '事项' },
|
|
{ prop: 'T_approver_name', label: '处理人' },
|
|
{ prop: 'T_approver_name', label: '处理人' },
|
|
- { prop: 'UpdateTime', label: '时间' }
|
|
|
|
|
|
+ { prop: 'UpdateTime', label: '时间', ellipsis: true }
|
|
]
|
|
]
|
|
-const initParam = {
|
|
|
|
- User_tokey: globalStore.GET_User_tokey
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
const openDrawerOvertime = (str: string, row: any) => {
|
|
const openDrawerOvertime = (str: string, row: any) => {
|
|
- drawerRef.value.openDrawer()
|
|
|
|
|
|
+ drawerRef.value && drawerRef.value.openDrawer()
|
|
if (str === 'edit') {
|
|
if (str === 'edit') {
|
|
isNew = false
|
|
isNew = false
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
@@ -57,7 +58,7 @@ const openDrawerOvertime = (str: string, row: any) => {
|
|
uuid = row.T_approver
|
|
uuid = row.T_approver
|
|
form.value.T_approver = row.T_user_name
|
|
form.value.T_approver = row.T_user_name
|
|
form.value.T_id = row.Id
|
|
form.value.T_id = row.Id
|
|
- form.value.T_prove_img = 'https://erposs.baozhida.cn' + form.value.T_prove_img
|
|
|
|
|
|
+ form.value.T_prove_img = import.meta.env.VITE_BZD_ERPOSS_APP_API + form.value.T_prove_img
|
|
fileList.value.push({
|
|
fileList.value.push({
|
|
name: 'food.jpeg',
|
|
name: 'food.jpeg',
|
|
url: form.value.T_prove_img
|
|
url: form.value.T_prove_img
|
|
@@ -65,10 +66,10 @@ const openDrawerOvertime = (str: string, row: any) => {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-const disabled = ref(false)
|
|
|
|
|
|
+
|
|
const OvertimeView = (row: any) => {
|
|
const OvertimeView = (row: any) => {
|
|
disabled.value = true
|
|
disabled.value = true
|
|
- drawerRef.value.openDrawer()
|
|
|
|
|
|
+ drawerRef.value && drawerRef.value.openDrawer()
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
form.value = { ...row }
|
|
form.value = { ...row }
|
|
form.value.T_approver = row.T_user_name
|
|
form.value.T_approver = row.T_user_name
|
|
@@ -83,12 +84,9 @@ const OvertimeDelete = (row: any) => {
|
|
.then(async () => {
|
|
.then(async () => {
|
|
const res: any = await Overtime_Del({ User_tokey: globalStore.GET_User_tokey, T_id: row.Id })
|
|
const res: any = await Overtime_Del({ User_tokey: globalStore.GET_User_tokey, T_id: row.Id })
|
|
if (res.Code === 200) {
|
|
if (res.Code === 200) {
|
|
- ElMessage({
|
|
|
|
- type: 'success',
|
|
|
|
- message: '删除成功!'
|
|
|
|
- })
|
|
|
|
|
|
+ ElMessage.success('删除成功!')
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- TableRef.value.getTableList()
|
|
|
|
|
|
+ TableRef.value?.getTableList()
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -105,7 +103,7 @@ const AddOvertime = (formEl: FormInstance | undefined) => {
|
|
formEl.validate(async valid => {
|
|
formEl.validate(async valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
let res: any = {}
|
|
let res: any = {}
|
|
- form.value.T_duration = duration.value * 60
|
|
|
|
|
|
+ form.value.T_duration = form.value.T_duration * 60
|
|
if (isNew) {
|
|
if (isNew) {
|
|
res = await Overtime_Add({ ...form.value, T_approver: uuid })
|
|
res = await Overtime_Add({ ...form.value, T_approver: uuid })
|
|
} else {
|
|
} else {
|
|
@@ -114,8 +112,8 @@ const AddOvertime = (formEl: FormInstance | undefined) => {
|
|
if (res.Code === 200) {
|
|
if (res.Code === 200) {
|
|
ElMessage.success(`${isNew ? '申请' : '修改'}成功!`)
|
|
ElMessage.success(`${isNew ? '申请' : '修改'}成功!`)
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
- drawerRef.value.closeDrawer()
|
|
|
|
- TableRef.value.getTableList()
|
|
|
|
|
|
+ drawerRef.value?.closeDrawer()
|
|
|
|
+ TableRef.value?.getTableList()
|
|
resetForm(ruleFormRef.value)
|
|
resetForm(ruleFormRef.value)
|
|
isNew = true
|
|
isNew = true
|
|
})
|
|
})
|
|
@@ -125,9 +123,8 @@ const AddOvertime = (formEl: FormInstance | undefined) => {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
// Drawer
|
|
// Drawer
|
|
-const drawerRef = ref()
|
|
|
|
-const ruleFormRef = ref<FormInstance>()
|
|
|
|
type Fn = () => void
|
|
type Fn = () => void
|
|
const callbackDrawer = (done: Fn) => {
|
|
const callbackDrawer = (done: Fn) => {
|
|
disabled.value = false
|
|
disabled.value = false
|
|
@@ -153,6 +150,15 @@ const validate_float = (rule: any, value: any, callback: any) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+const form = ref({
|
|
|
|
+ T_id: '',
|
|
|
|
+ T_text: '',
|
|
|
|
+ T_duration: 0,
|
|
|
|
+ T_end_time: '',
|
|
|
|
+ T_approver: '',
|
|
|
|
+ T_prove_img: '',
|
|
|
|
+ T_start_time: ''
|
|
|
|
+})
|
|
const rules = reactive<FormRules>({
|
|
const rules = reactive<FormRules>({
|
|
T_type: [{ required: true, message: '请选择请假类型', trigger: 'blur' }],
|
|
T_type: [{ required: true, message: '请选择请假类型', trigger: 'blur' }],
|
|
T_start_time: [{ required: true, message: '请选择开始时间', trigger: 'blur' }],
|
|
T_start_time: [{ required: true, message: '请选择开始时间', trigger: 'blur' }],
|
|
@@ -160,35 +166,8 @@ const rules = reactive<FormRules>({
|
|
T_duration: [{ required: true, validator: validate_float, trigger: 'blur' }],
|
|
T_duration: [{ required: true, validator: validate_float, trigger: 'blur' }],
|
|
T_approver: [{ required: true, message: '请选择审批人', trigger: 'blur' }]
|
|
T_approver: [{ required: true, message: '请选择审批人', trigger: 'blur' }]
|
|
})
|
|
})
|
|
-let uuid = ''
|
|
|
|
-const duration = computed(() => {
|
|
|
|
- const end_time = dayJs(form.value.T_end_time)
|
|
|
|
- if (!form.value.T_end_time) {
|
|
|
|
- return 0
|
|
|
|
- }
|
|
|
|
- let count: number = end_time.diff(form.value.T_start_time, 'hour', true)
|
|
|
|
- let num: number = Number(count.toFixed(2))
|
|
|
|
- return Math.round(num * 10) / 10
|
|
|
|
-})
|
|
|
|
-const form = ref({
|
|
|
|
- T_start_time: '',
|
|
|
|
- T_end_time: '',
|
|
|
|
- T_duration: 0,
|
|
|
|
- T_text: '',
|
|
|
|
- T_approver: '',
|
|
|
|
- T_prove_img: '',
|
|
|
|
- T_id: ''
|
|
|
|
-})
|
|
|
|
-const formLabelWidth = ref('100px')
|
|
|
|
-let isNew = true
|
|
|
|
-const selectApprover = () => {
|
|
|
|
- dialog.value.DialogOpen()
|
|
|
|
-}
|
|
|
|
|
|
|
|
// dialog
|
|
// dialog
|
|
-const dialog = ref()
|
|
|
|
-const search = ref('')
|
|
|
|
-const tableApproverRef = ref()
|
|
|
|
const Dialogcolumns: ColumnProps[] = [{ prop: 'T_name', label: '名字', name: 'T_name' }]
|
|
const Dialogcolumns: ColumnProps[] = [{ prop: 'T_name', label: '名字', name: 'T_name' }]
|
|
const approverInitParam = {
|
|
const approverInitParam = {
|
|
User_tokey: globalStore.GET_User_tokey,
|
|
User_tokey: globalStore.GET_User_tokey,
|
|
@@ -199,10 +178,13 @@ const searchHandle = () => {
|
|
approverInitParam.T_name = search.value
|
|
approverInitParam.T_name = search.value
|
|
tableApproverRef.value.searchTable()
|
|
tableApproverRef.value.searchTable()
|
|
}
|
|
}
|
|
|
|
+const selectApprover = () => {
|
|
|
|
+ dialog.value?.DialogOpen()
|
|
|
|
+}
|
|
const getApproverInfo = (row: any) => {
|
|
const getApproverInfo = (row: any) => {
|
|
uuid = row.T_uuid
|
|
uuid = row.T_uuid
|
|
form.value.T_approver = row.T_name
|
|
form.value.T_approver = row.T_name
|
|
- dialog.value.DialogClose()
|
|
|
|
|
|
+ dialog.value?.DialogClose()
|
|
}
|
|
}
|
|
|
|
|
|
const onResize = () => {
|
|
const onResize = () => {
|
|
@@ -211,20 +193,24 @@ const onResize = () => {
|
|
}
|
|
}
|
|
|
|
|
|
// upload file
|
|
// upload file
|
|
|
|
+interface FileListType {
|
|
|
|
+ url: string
|
|
|
|
+ name: string
|
|
|
|
+}
|
|
|
|
+let prove_img = true
|
|
const upload = ref()
|
|
const upload = ref()
|
|
-let uploadData = { token: '', key: '' }
|
|
|
|
|
|
+const fileList = ref<FileListType[]>([])
|
|
const dialogImageUrl = ref('')
|
|
const dialogImageUrl = ref('')
|
|
const dialogVisible = ref(false)
|
|
const dialogVisible = ref(false)
|
|
-const fileList = ref<any>([])
|
|
|
|
-let prove_img = true
|
|
|
|
|
|
+let uploadData = { token: '', key: '' }
|
|
|
|
+
|
|
|
|
+// 图片查看 放大
|
|
const handlePictureCardPreview = async (file: any) => {
|
|
const handlePictureCardPreview = async (file: any) => {
|
|
- console.log(file, fileList)
|
|
|
|
dialogImageUrl.value = file.url as string
|
|
dialogImageUrl.value = file.url as string
|
|
dialogVisible.value = true
|
|
dialogVisible.value = true
|
|
}
|
|
}
|
|
|
|
+// 图片上传之前
|
|
const beforeUpload = async (file: any) => {
|
|
const beforeUpload = async (file: any) => {
|
|
- console.log(file)
|
|
|
|
-
|
|
|
|
let reg = /^image/g
|
|
let reg = /^image/g
|
|
if (!reg.test(file.type)) {
|
|
if (!reg.test(file.type)) {
|
|
ElMessage.error('必须上传图片!!')
|
|
ElMessage.error('必须上传图片!!')
|
|
@@ -236,31 +222,26 @@ const beforeUpload = async (file: any) => {
|
|
uploadData.token = res.Data
|
|
uploadData.token = res.Data
|
|
uploadData.key = file.name
|
|
uploadData.key = file.name
|
|
}
|
|
}
|
|
|
|
+// 图片上传超出界限
|
|
const handleExceed: UploadProps['onExceed'] = (files: any) => {
|
|
const handleExceed: UploadProps['onExceed'] = (files: any) => {
|
|
upload.value.clearFiles()
|
|
upload.value.clearFiles()
|
|
const file = files[0] as UploadRawFile
|
|
const file = files[0] as UploadRawFile
|
|
file.uid = genFileId()
|
|
file.uid = genFileId()
|
|
upload.value.handleStart(file)
|
|
upload.value.handleStart(file)
|
|
- submitUpload()
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const submitUpload = () => {
|
|
|
|
upload.value.submit()
|
|
upload.value.submit()
|
|
}
|
|
}
|
|
-
|
|
|
|
-const onSuccess = (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
|
|
|
- console.log(response, uploadFile, uploadFiles)
|
|
|
|
|
|
+// 图片上传成功
|
|
|
|
+const onSuccess = (response: any) => {
|
|
form.value.T_prove_img = response.key
|
|
form.value.T_prove_img = response.key
|
|
prove_img = true
|
|
prove_img = true
|
|
ElMessage.success('图片上传成功!!')
|
|
ElMessage.success('图片上传成功!!')
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+// 图片上传失败
|
|
const onError = () => {
|
|
const onError = () => {
|
|
ElMessage.error('图片上传失败!!')
|
|
ElMessage.error('图片上传失败!!')
|
|
}
|
|
}
|
|
-
|
|
|
|
-const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
|
|
|
- console.log(uploadFile, uploadFiles, fileList)
|
|
|
|
|
|
+// 图片移除
|
|
|
|
+const handleRemove: UploadProps['onRemove'] = () => {
|
|
form.value.T_prove_img = ''
|
|
form.value.T_prove_img = ''
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -323,7 +304,9 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
|
<template #table-header="{ pageable }">
|
|
<template #table-header="{ pageable }">
|
|
<el-button text
|
|
<el-button text
|
|
><h4>
|
|
><h4>
|
|
- <el-text class="mx-1" type="primary">剩余总时长:{{ getFormatDuration(pageable.RemainingTime) }}</el-text>
|
|
|
|
|
|
+ <el-text class="mx-1" type="primary"
|
|
|
|
+ >剩余总时长:{{ getFormatDuration(pageable.RemainingTime as number) }}</el-text
|
|
|
|
+ >
|
|
</h4></el-button
|
|
</h4></el-button
|
|
></template
|
|
></template
|
|
>
|
|
>
|
|
@@ -361,7 +344,7 @@ const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="加班时长:" :label-width="formLabelWidth" prop="T_duration">
|
|
<el-form-item label="加班时长:" :label-width="formLabelWidth" prop="T_duration">
|
|
- <el-input v-model.number="duration" autocomplete="off" :disabled="true" placeholder="请假时长" />
|
|
|
|
|
|
+ <el-input v-model.number="form.T_duration" autocomplete="off" placeholder="请假时长" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="取证:" :label-width="formLabelWidth">
|
|
<el-form-item label="取证:" :label-width="formLabelWidth">
|
|
<el-upload
|
|
<el-upload
|