|
@@ -8,7 +8,6 @@ import {
|
|
|
} from '@/api/workAttendance/index'
|
|
|
import { User_List } from '@/api/user/index'
|
|
|
import { GlobalStore } from '@/stores/index'
|
|
|
-import { UpFileToken } from '@/api/public/index'
|
|
|
import Drawer from '@/components/Drawer/index.vue'
|
|
|
import Dialog from '@/components/dialog/Dialog.vue'
|
|
|
import { floatReg } from '@/views/salary/salary/relus'
|
|
@@ -16,9 +15,10 @@ 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 { ElMessageBox, ElMessage, genFileId } from 'element-plus'
|
|
|
+import { ElMessageBox, ElMessage } from 'element-plus'
|
|
|
import { ColumnProps } from '@/components/TableBase/interface/index'
|
|
|
-import type { FormInstance, FormRules, UploadProps, UploadRawFile } from 'element-plus'
|
|
|
+import type { FormInstance, FormRules } from 'element-plus'
|
|
|
+import Upload from '@/components/Upload/index.vue'
|
|
|
|
|
|
let uuid = ''
|
|
|
let isNew = true
|
|
@@ -32,6 +32,7 @@ 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 uploadRef = ref<InstanceType<typeof Upload> | null>(null)
|
|
|
const initParam = { User_tokey: globalStore.GET_User_tokey }
|
|
|
|
|
|
const columns: ColumnProps[] = [
|
|
@@ -58,11 +59,7 @@ const openDrawerOvertime = (str: string, row: any) => {
|
|
|
uuid = row.T_approver
|
|
|
form.value.T_approver = row.T_user_name
|
|
|
form.value.T_id = row.Id
|
|
|
- form.value.T_prove_img = import.meta.env.VITE_BZD_ERPOSS_APP_API + form.value.T_prove_img
|
|
|
- fileList.value.push({
|
|
|
- name: 'food.jpeg',
|
|
|
- url: form.value.T_prove_img
|
|
|
- })
|
|
|
+ form.value.T_duration = row.T_duration / 60
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -96,18 +93,14 @@ const OvertimeDelete = (row: any) => {
|
|
|
}
|
|
|
const AddOvertime = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return
|
|
|
- if (!prove_img) {
|
|
|
- ElMessage.warning('请等待图片上传完成')
|
|
|
- return
|
|
|
- }
|
|
|
formEl.validate(async valid => {
|
|
|
if (valid) {
|
|
|
let res: any = {}
|
|
|
- form.value.T_duration = form.value.T_duration * 60
|
|
|
+ let time = form.value.T_duration * 60
|
|
|
if (isNew) {
|
|
|
- res = await Overtime_Add({ ...form.value, T_approver: uuid })
|
|
|
+ res = await Overtime_Add({ ...form.value, T_approver: uuid, T_duration: time })
|
|
|
} else {
|
|
|
- res = await Overtime_Edit({ ...form.value, T_approver: uuid })
|
|
|
+ res = await Overtime_Edit({ ...form.value, T_approver: uuid, T_duration: time })
|
|
|
}
|
|
|
if (res.Code === 200) {
|
|
|
ElMessage.success(`${isNew ? '申请' : '修改'}成功!`)
|
|
@@ -136,7 +129,6 @@ const callbackDrawer = (done: Fn) => {
|
|
|
}
|
|
|
const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return
|
|
|
- fileList.value = []
|
|
|
formEl.resetFields()
|
|
|
}
|
|
|
const validate_float = (rule: any, value: any, callback: any) => {
|
|
@@ -191,59 +183,6 @@ const onResize = () => {
|
|
|
const height = document.documentElement.clientHeight
|
|
|
return height / 2
|
|
|
}
|
|
|
-
|
|
|
-// upload file
|
|
|
-interface FileListType {
|
|
|
- url: string
|
|
|
- name: string
|
|
|
-}
|
|
|
-let prove_img = true
|
|
|
-const upload = ref()
|
|
|
-const fileList = ref<FileListType[]>([])
|
|
|
-const dialogImageUrl = ref('')
|
|
|
-const dialogVisible = ref(false)
|
|
|
-let uploadData = { token: '', key: '' }
|
|
|
-
|
|
|
-// 图片查看 放大
|
|
|
-const handlePictureCardPreview = async (file: any) => {
|
|
|
- dialogImageUrl.value = file.url as string
|
|
|
- dialogVisible.value = true
|
|
|
-}
|
|
|
-// 图片上传之前
|
|
|
-const beforeUpload = async (file: any) => {
|
|
|
- let reg = /^image/g
|
|
|
- if (!reg.test(file.type)) {
|
|
|
- ElMessage.error('必须上传图片!!')
|
|
|
- return
|
|
|
- }
|
|
|
- prove_img = false
|
|
|
- let suffix = file.type.split('/')[1]
|
|
|
- const res: any = await UpFileToken({ User_tokey: globalStore.GET_User_tokey, T_suffix: suffix })
|
|
|
- uploadData.token = res.Data
|
|
|
- uploadData.key = file.name
|
|
|
-}
|
|
|
-// 图片上传超出界限
|
|
|
-const handleExceed: UploadProps['onExceed'] = (files: any) => {
|
|
|
- upload.value.clearFiles()
|
|
|
- const file = files[0] as UploadRawFile
|
|
|
- file.uid = genFileId()
|
|
|
- upload.value.handleStart(file)
|
|
|
- upload.value.submit()
|
|
|
-}
|
|
|
-// 图片上传成功
|
|
|
-const onSuccess = (response: any) => {
|
|
|
- form.value.T_prove_img = response.key
|
|
|
- prove_img = true
|
|
|
- ElMessage.success('图片上传成功!!')
|
|
|
-}
|
|
|
-// 图片上传失败
|
|
|
-const onError = () => {
|
|
|
- ElMessage.error('图片上传失败!!')
|
|
|
-}
|
|
|
-// 图片移除
|
|
|
-const handleRemove: UploadProps['onRemove'] = () => {
|
|
|
- form.value.T_prove_img = ''
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -353,27 +292,9 @@ const handleRemove: UploadProps['onRemove'] = () => {
|
|
|
<el-input v-model.number="form.T_duration" autocomplete="off" placeholder="请假时长" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="取证:" :label-width="formLabelWidth">
|
|
|
- <el-upload
|
|
|
- ref="upload"
|
|
|
- :disabled="disabled"
|
|
|
- v-model:file-list="fileList"
|
|
|
- action="https://up-z2.qiniup.com"
|
|
|
- list-type="picture-card"
|
|
|
- :limit="1"
|
|
|
- :auto-upload="true"
|
|
|
- :before-upload="beforeUpload"
|
|
|
- :on-success="onSuccess"
|
|
|
- :on-error="onError"
|
|
|
- :on-exceed="handleExceed"
|
|
|
- :on-remove="handleRemove"
|
|
|
- :on-preview="handlePictureCardPreview"
|
|
|
- :data="uploadData"
|
|
|
- >
|
|
|
+ <Upload ref="uploadRef" :isImg="true" :limit="1" v-model="form.T_prove_img" accept="image/*">
|
|
|
<el-icon><Plus /></el-icon>
|
|
|
- </el-upload>
|
|
|
- <el-dialog v-model="dialogVisible">
|
|
|
- <img w-full :src="dialogImageUrl" class="full-img" alt="Preview Image" />
|
|
|
- </el-dialog>
|
|
|
+ </Upload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="内容:" :label-width="formLabelWidth" prop="T_text">
|
|
|
<el-input
|