diff --git a/src/api/report/attReport.js b/src/api/report/attReport.js index 6095ea3..19d5ca5 100644 --- a/src/api/report/attReport.js +++ b/src/api/report/attReport.js @@ -163,3 +163,14 @@ export function updateMonthReportData(query) { params: query }) } + +export function singleUploadFile(data) { + return request({ + url: '/system/fileUpload/singleUploadFile', + headers: { + 'Content-Type': 'multipart/form-data' + }, + method: 'post', + data: data + }) +} diff --git a/src/utils/base64Utils.js b/src/utils/base64Utils.js new file mode 100644 index 0000000..89fb80e --- /dev/null +++ b/src/utils/base64Utils.js @@ -0,0 +1,56 @@ +// base64Utils.js +let _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +const useBase64 = { + encode64:(e) => { + let t = ""; + let f = 0; + e = useBase64.encodeUTF8(e); + while (f < e.length) { + const n = e.charCodeAt(f++); + const r = e.charCodeAt(f++); + const i = e.charCodeAt(f++); + let s = n >> 2; + let o = (n & 3) << 4 | r >> 4; + let u = (r & 15) << 2 | i >> 6; + let a = i & 63; + if (isNaN(r)) { + u = a = 64; + } else if (isNaN(i)) { + a = 64; + } + t += _keyStr[s] + _keyStr[o] + _keyStr[u] + _keyStr[a]; + } + return t; + }, + decode64: (e) => { + let t = ""; + let f = 0; + e = e.replace(/[^A-Za-z0-9+/=]/g, ""); + while (f < e.length) { + const s = _keyStr.indexOf(e.charAt(f++)); + const o = _keyStr.indexOf(e.charAt(f++)); + const u = _keyStr.indexOf(e.charAt(f++)); + const a = _keyStr.indexOf(e.charAt(f++)); + let n = s << 2 | o >> 4; + let r = (o & 15) << 4 | u >> 2; + let i = (u & 3) << 6 | a; + t += String.fromCharCode(n); + if (u !== 64) { + t += String.fromCharCode(r); + } + if (a !== 64) { + t += String.fromCharCode(i); + } + } + return useBase64.decodeUTF8(t); + }, + + encodeUTF8: (input) => { + return unescape(encodeURIComponent(input)); + }, + + decodeUTF8: (input) => { + return decodeURIComponent(escape(input)); + }, +} +export default useBase64; diff --git a/src/utils/bns-kkFile-preview.js b/src/utils/bns-kkFile-preview.js new file mode 100644 index 0000000..8ddf83f --- /dev/null +++ b/src/utils/bns-kkFile-preview.js @@ -0,0 +1,84 @@ +export function lookFile(){ + return 'http://192.168.0.14:21626/file/statics' //14服务器 + // return 'http://112.29.103.165:14413/file/statics' //1.6演示服务器 + // return 'http://218.21.27.6:1999/file/statics' //生产服务器 +} +export function lookFaceFile(){ + return 'http://192.168.0.14:21626/file/statics/' //14服务器 + //return 'http://112.29.103.165:14413/file/statics/' //1.6演示服务器 + // return 'http://218.21.27.6:1999/file/statics/' //生产服务器 +} +export function filePreview(){ + return 'http://192.168.0.14:8012/onlinePreview?url=' //14服务器 + // return 'http://112.29.103.165:8012/onlinePreview?url=' //1.6演示服务器 + // return 'http://218.21.27.6:18013/onlinePreview?url=' +} + +export function lookMioIoFile() { + // return 'http://218.21.27.6:19090/nxdt-courseware' //14服务器 + return 'http://192.168.0.14:9090/nxdt-courseware' //14服务器 + // return 'http://112.29.103.165:14413/file/statics' //1.6演示服务器 +} + +/** + * 下载文件 + * @param filePath 文件路径 + * @param fileName 文件名称 如果没有名称 请填写 "" 不要填 null + */ +export function downloadFile(filePath, fileName) { + let lookFiles = lookFile() + let lookFaceFiles = lookFaceFile() + showLoadingIndicator(); + //判断filePath第一个字符是否/ + if (filePath.charAt(0) === '/') { + filePath = filePath.includes('http') ? filePath : `${lookFiles}${filePath}` + }else{ + filePath = filePath.includes('http') ? filePath : `${lookFaceFiles}${filePath}` + } + const xhr = new XMLHttpRequest(); + xhr.open('GET', filePath, true); + xhr.responseType = 'blob'; + + xhr.onload = () => { + const blob = xhr.response; + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.style.display = 'none'; + a.href = url; + a.download = fileName === "" ? filePath.split("/")[filePath.split("/").length - 1] : fileName; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + // Hide loading indicator + hideLoadingIndicator(); + }; + + xhr.onerror = () => { + // Hide loading indicator in case of error + hideLoadingIndicator(); + console.error('File download failed'); + }; + xhr.send(); +} + +function showLoadingIndicator() { + const loadingDiv = document.createElement('div'); + loadingDiv.id = 'loading-indicator'; + loadingDiv.style.position = 'fixed'; + loadingDiv.style.top = '50%'; + loadingDiv.style.left = '50%'; + loadingDiv.style.transform = 'translate(-50%, -50%)'; + loadingDiv.style.padding = '15px'; + loadingDiv.style.backgroundColor = 'rgba(66,65,65,0.7)'; + loadingDiv.style.color = 'white'; + loadingDiv.style.borderRadius = '5px'; + loadingDiv.innerText = 'Loading...'; + document.body.appendChild(loadingDiv); +} + +function hideLoadingIndicator() { + const loadingDiv = document.getElementById('loading-indicator'); + if (loadingDiv) { + document.body.removeChild(loadingDiv); + } +} diff --git a/src/views/bns-kkFile-preview.vue b/src/views/bns-kkFile-preview.vue new file mode 100644 index 0000000..048510b --- /dev/null +++ b/src/views/bns-kkFile-preview.vue @@ -0,0 +1,197 @@ + + + + diff --git a/src/views/process/orgApply/index.vue b/src/views/process/orgApply/index.vue index f63d98b..c541e30 100644 --- a/src/views/process/orgApply/index.vue +++ b/src/views/process/orgApply/index.vue @@ -79,8 +79,8 @@ @@ -113,6 +113,12 @@ v-if="scope.row.isCheck==0||scope.row.isCheck==2||scope.row.isCheck==3" @click="handleDelete(scope.row)" >删除 + + 是否处理 @@ -223,6 +229,92 @@ 取 消 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -243,7 +335,7 @@ //组织机构 orgList:this.$store.state.user.orgList, //审核状态 - isCheckList:[{id:'0',name:"待审批"},{id:'1',name:"已通过"},{id:'2',name:"未通过"},{id:'3',name:"撤回"}], + isCheckList:[{id:'0',name:"待运维人员处理"},{id:'1',name:"已处理"}], // 遮罩层 loading: false, // 选中数组 @@ -262,6 +354,7 @@ title: "", // 是否显示弹出层 open: false, + openCheck: false, isEdit: false, isView: false, userList:[], @@ -364,6 +457,7 @@ // 取消按钮 cancel() { this.open = false; + this.openCheck = false; this.reset(); }, // 表单重置 @@ -530,6 +624,59 @@ }; }, + handleCheck(row) { + this.reset(); + const Id = row.id + getOrg(Id).then(orgResponse => { + // 更新表单的 org 信息 + this.form ={ + ...orgResponse.data, + newAttGroup:orgResponse.data.newAttGroup?Number(orgResponse.data.newAttGroup):"" + }; + this.form.attGroupName = orgResponse.data.oldOrgName; + // 更新视图状态 + this.openCheck = true; + this.title = "审核"; + }); + }, + + pass(){ + this.$refs["form"].validate(valid => { + var name = ""; + const selectedOrg = this.orgList.find(org => org.id == this.form.orgId); + if (selectedOrg) { + name = selectedOrg.name; + } else { + name = ''; + } + + if (valid) { + console.log("同意",this.form) + let param = { + id:this.form.id, + isCheck:'1', + examineOpinion:this.form.examineOpinion, + oldOrgId:this.form.oldOrgId, + oldOrgName:this.form.oldOrgName, + newOrgId:this.form.newOrgId, + newOrgName:this.form.newOrgName, + userId:this.form.userId, + } + this.changExamStatus(param) + } + }); + }, + + /** 提交 */ + changExamStatus(param) { + console.log(param) + changeOrgStatus(param).then(response => { + this.$modal.msgSuccess("操作成功"); + this.openCheck = false; + this.getList(); + }); + }, + } }; diff --git a/src/views/process/orgExam/index.vue b/src/views/process/orgExam/index.vue index cfefc09..9877d6f 100644 --- a/src/views/process/orgExam/index.vue +++ b/src/views/process/orgExam/index.vue @@ -406,7 +406,7 @@ // 更新视图状态 this.open = true; this.isView = false; - this.title = "编辑"; + this.title = "审核"; }); }, handleView(row) { diff --git a/src/views/report/attReport/index.vue b/src/views/report/attReport/index.vue index d8161f7..1e4a163 100644 --- a/src/views/report/attReport/index.vue +++ b/src/views/report/attReport/index.vue @@ -3,29 +3,43 @@ + @keyup.enter.native="handleQuery" + /> + style="width: 240px" + /> - + + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" + > - 搜索 - 重置 + 搜索 + + 重置 + 导出 + v-hasPermi="['att:attReport:export']" + >导出 + 异常数据导出 - 批量修改 + v-hasPermi="['att:attReport:abnormal']" + >异常数据导出 + + 批量修改 + 数据同步 @@ -45,14 +59,14 @@ - + - - + + + + + + + + + + width="180" + /> @@ -155,12 +199,34 @@ + width="180" + > + + + + + + - - + + + :limit.sync="queryRecord.pageSize" @pagination="getOutCountList" + /> + label-width="110px" + > @@ -226,12 +296,13 @@ {{ formatDate(scope.row.attCurrentDay) }} - - + + + :limit.sync="queryAttCount.pageSize" @pagination="getAttCountList" + /> @@ -240,62 +311,21 @@ + range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" + > - - - - - 1.模版数据(必须) - - - - 3.旷工更新(非必) - - - - 5.请假日更新(非必) - - - - 7.月报表模版(非必) - - - - - - 2.数据拉取(必须) - - - - 4.法假更新(非必) - - - - 6.日报表更新(必须) - - - - 8.月报表更新(必须) - - + + 1.模版数据(必须) + 2.数据拉取(必须) + 3.旷工更新(非必) + 4.法假更新(非必) + + + 5.请假日更新(非必) + 6.日报表更新(必须) + 7.月报表模版(非必) + 8.月报表更新(必须) + + + + + + @@ -324,17 +360,18 @@ import { insertDayReportData, insertMonthReportTempData, updateMonthReportData, -} from "@/api/report/attReport"; -import Treeselect from "@riophae/vue-treeselect"; -import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -import { checkPersonAssignment } from "@/api/system/userInfo"; -import { getDetail } from "@/api/report/monthlyError"; -import { Tooltip } from 'element-ui'; + singleUploadFile +} from '@/api/report/attReport' +import Treeselect from '@riophae/vue-treeselect' +import BnsKkFilePreview from '@/views/bns-kkFile-preview' +import '@riophae/vue-treeselect/dist/vue-treeselect.css' +import { checkPersonAssignment } from '@/api/system/userInfo' +import { getDetail } from '@/api/report/monthlyError' export default { - name: "AttDetails", + name: 'AttDetails', dicts: ['att_status'], - components: { Treeselect }, + components: { Treeselect,BnsKkFilePreview }, data() { return { // 遮罩层 @@ -352,7 +389,7 @@ export default { // 字典表格数据 typeList: [], // 弹出层标题 - title: "", + title: '', // 是否显示弹出层 open: false, dialogList: [], @@ -373,7 +410,7 @@ export default { pageSize: 10, userId: undefined, attCurrentDay: undefined, - userName: undefined, + userName: undefined }, showOutCount: false, totalTwo: 0, @@ -381,13 +418,12 @@ export default { loadingTwo: false, tableDataOutCount: [], - queryAttCount: { pageNum: 1, pageSize: 10, userId: undefined, attCurrentDay: undefined, - userName: undefined, + userName: undefined }, showAttCount: false, totalAttCount: 0, @@ -397,58 +433,65 @@ export default { dataAyscTitle: '数据同步', dataAyscOpen: false, form2: { - dateRange:[this.getToday(),this.getToday()] + dateRange: [this.getToday(), this.getToday()] }, - }; + + fileView: false, + fileData:[], + kkFilePreview: { + filePreviewUrl: "http://192.168.0.14:31909/file/ynRealName/proFile/2025/02/19/5bb40b949c3b490b85540e6289a24c962.docx", + fileName: "aaaa.docx", + } + } }, created() { - this.getWeekDates(); - this.getDeptList(); - this.getList(); + this.getWeekDates() + this.getDeptList() + this.getList() }, methods: { getWeekDates() { - const now = new Date(); - const dayOfWeek = now.getDay(); - const dayOffset = dayOfWeek === 0 ? -6 : 1 - dayOfWeek; + const now = new Date() + const dayOfWeek = now.getDay() + const dayOffset = dayOfWeek === 0 ? -6 : 1 - dayOfWeek - const monday = new Date(now); - monday.setDate(monday.getDate() + dayOffset); + const monday = new Date(now) + monday.setDate(monday.getDate() + dayOffset) - const sunday = new Date(monday); - sunday.setDate(sunday.getDate() + 6); - this.dateRange[0] = monday.toISOString().split('T')[0]; - this.dateRange[1] = sunday.toISOString().split('T')[0]; + const sunday = new Date(monday) + sunday.setDate(sunday.getDate() + 6) + this.dateRange[0] = monday.toISOString().split('T')[0] + this.dateRange[1] = sunday.toISOString().split('T')[0] }, formatDate(dateString) { - const date = new Date(dateString); // 创建日期对象 - const year = date.getFullYear(); // 获取年份 - const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份(注意:月份从0开始) - const day = String(date.getDate()).padStart(2, '0'); // 获取日期 - const weekdays = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; // 星期几数组 - const weekday = weekdays[date.getDay()]; // 获取星期几 + const date = new Date(dateString) // 创建日期对象 + const year = date.getFullYear() // 获取年份 + const month = String(date.getMonth() + 1).padStart(2, '0') // 获取月份(注意:月份从0开始) + const day = String(date.getDate()).padStart(2, '0') // 获取日期 + const weekdays = ['星期天', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] // 星期几数组 + const weekday = weekdays[date.getDay()] // 获取星期几 - return `${year}-${month}-${day} ${weekday}`; // 组合成所需格式 + return `${year}-${month}-${day} ${weekday}` // 组合成所需格式 }, getDeptList() { listDept().then(response => { - this.deptOptions = this.handleTree(response.data, "id"); - }); + this.deptOptions = this.handleTree(response.data, 'id') + }) }, /** 转换部门数据结构 */ normalizer(node) { if (node.children && !node.children.length) { - delete node.children; + delete node.children } return { id: node.id, label: node.orgName, children: node.children - }; + } }, /** 查询字典类型列表 */ getList() { - this.loading = true; + this.loading = true console.log(this.dateRange) if (this.dateRange && this.dateRange.length > 0) { this.queryParams.startDate = this.dateRange[0] @@ -458,89 +501,105 @@ export default { this.queryParams.endDate = undefined } getDetailsList(this.queryParams).then(response => { - this.typeList = response.rows; - this.total = response.total; - this.loading = false; - } - ); + this.typeList = response.rows + this.total = response.total + this.loading = false + } + ) }, /** 搜索按钮操作 */ handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); + this.queryParams.pageNum = 1 + this.getList() }, /** 重置按钮操作 */ resetQuery() { this.dateRange = [] - this.getWeekDates(); - this.resetForm("queryForm"); - this.handleQuery(); + this.getWeekDates() + this.resetForm('queryForm') + this.handleQuery() }, // 多选框选中数据 handleSelectionChange(selection) { - this.dialogList = selection.slice(); + this.dialogList = selection.slice() }, openDialog() { console.log(this.dialogList) if (this.dialogList.length > 0) { - this.open = true; - this.dialogListOld = JSON.parse(JSON.stringify(this.dialogList)); + this.open = true + this.dialogListOld = JSON.parse(JSON.stringify(this.dialogList)) } else { this.$message({ message: '请先勾选数据!', type: 'warning' }) } }, openData() { - this.dataAyscOpen = true; + this.dataAyscOpen = true }, getToday() { - const date = new Date(); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - return `${year}-${month}-${day}`; + const date = new Date() + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` }, - operMethod(type){ + operMethod(type) { const query = { - startDate:this.form2.dateRange[0], - endDate:this.form2.dateRange[1], + startDate: this.form2.dateRange[0], + endDate: this.form2.dateRange[1] } let loading = this.$loading({ lock: true, - text: "数据同步中,请稍候...", + text: '数据同步中,请稍候...', background: 'rgba(0,0,0,0.2)' }) - if(type === 1){ - getAttTempData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 2){ - getAttDataPull(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 3){ - getAbsenteeismData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 4){ - getLegalHolidayData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 5){ - getLeaveData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 6){ - insertDayReportData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 7){ - insertMonthReportTempData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); - }else if(type === 8){ - updateMonthReportData(query).then(res=>{ - loading.close(); - }).catch(err=>{loading.close();}); + if (type === 1) { + getAttTempData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 2) { + getAttDataPull(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 3) { + getAbsenteeismData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 4) { + getLegalHolidayData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 5) { + getLeaveData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 6) { + insertDayReportData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 7) { + insertMonthReportTempData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) + } else if (type === 8) { + updateMonthReportData(query).then(res => { + loading.close() + }).catch(err => { + loading.close() + }) } }, openData2() { @@ -557,23 +616,23 @@ export default { this.$modal.confirm(`是否开始数据同步"${this.queryParams.startDate}~${this.queryParams.endDate}"的数据项?`) .then(() => { // 开启加载状态 - this.loading = true; + this.loading = true // 执行同步操作 - return synchronous(param); + return synchronous(param) }) .then(response => { // 同步成功后关闭加载状态并显示成功信息 - this.loading = false; - this.$modal.msgSuccess("数据同步成功"); + this.loading = false + this.$modal.msgSuccess('数据同步成功') }) .catch(error => { // 处理任何可能发生的错误,包括确认对话框被取消的情况 - this.loading = false; // 确保加载状态关闭 + this.loading = false // 确保加载状态关闭 if (error && error !== 'cancel') { - this.$modal.msgError("数据同步失败:" + error.message || "未知错误"); + this.$modal.msgError('数据同步失败:' + error.message || '未知错误') } - }); + }) } else { this.$message({ message: '请先选择日期!', type: 'warning' }) } @@ -581,29 +640,32 @@ export default { submitEdit() { let paramList = [] - let hasError = false; + let hasError = false this.dialogList.forEach((newItem, index) => { - const oldItem = this.dialogListOld[index]; + const oldItem = this.dialogListOld[index] + // 检查toWorkAttCurrentTime或toWorkAttStatus是否改变 if ((newItem.toWorkAttCurrentTime !== oldItem.toWorkAttCurrentTime || newItem.toWorkAttStatus !== oldItem.toWorkAttStatus) && - (!newItem.toErrorRemake || newItem.toErrorRemake === "")) { - hasError = true; - this.$message({ message: '上班时间或状态改变时,原因说明不能为空!', type: 'warning' }); + (!newItem.toErrorRemake || newItem.toErrorRemake === '' || !this.hasAttachments(newItem.filesVoList, '1') )) { + hasError = true + this.$message({ message: '上班时间或状态改变时,原因说明、附件不能为空!', type: 'warning' }) } // 检查offWorkAttCurrentTime或offWorkAttStatus是否改变 if ((newItem.offWorkAttCurrentTime !== oldItem.offWorkAttCurrentTime || newItem.offWorkAttStatus !== oldItem.offWorkAttStatus) && - (!newItem.offErrorRemake || newItem.offErrorRemake === "")) { - hasError = true; - this.$message({ message: '下班时间或状态改变时,原因说明不能为空!', type: 'warning' }); + (!newItem.offErrorRemake || newItem.offErrorRemake === '' || !this.hasAttachments(newItem.filesVoList, '1') )) { + hasError = true + this.$message({ message: '下班时间或状态改变时,原因说明、附件不能为空!', type: 'warning' }) } + // 如果没有错误,则构建参数对象 if (!hasError) { let obj = { userId: newItem.userId, + userName:newItem.userName, orgId: newItem.orgId, attCurrentDay: newItem.attCurrentDay, toWorkAttCurrentTime: newItem.toWorkAttCurrentTime, @@ -612,76 +674,81 @@ export default { offWorkAttCurrentTime: newItem.offWorkAttCurrentTime, offWorkAttStatus: newItem.offWorkAttStatus, offErrorRemake: newItem.offErrorRemake, - }; - paramList.push(obj); + filesVoList: newItem.filesVoList + } + paramList.push(obj) } - }); + }) + console.log("aa=",paramList) if (!hasError) { updateAttDetails(paramList).then(response => { if (response.code === 200) { - this.$modal.msgSuccess("修改申请提交成功,耐心等待审批,请勿重复提交!"); - this.dialogList = []; - this.open = false; - this.getList(); + this.$modal.msgSuccess('修改申请提交成功,耐心等待审批,请勿重复提交!') + this.dialogList = [] + this.open = false + this.getList() } else { - this.$message({ message: '修改申请提交失败!', type: 'warning' }); + this.$message({ message: response.msg, type: 'warning' }) } - }); + }) } else { // 如果存在错误,则不清空或提交数据 - console.log("存在错误,未提交数据。"); + console.log('存在错误,未提交数据。') } }, cancel() { - this.getList(); - this.open = false; + this.getList() + this.open = false }, /** 导出按钮操作 */ handleExport() { - this.queryParams.exportType = "考勤明细" + this.queryParams.exportType = '考勤明细' exportAttRecord(this.queryParams).then(res => { - this.downloadFile({ fileName: `考勤记录_${new Date().getTime()}.xlsx`, fileData: res, fileType: 'application/vnd.ms-excel;charset=utf-8' }) + this.downloadFile({ + fileName: `考勤记录_${new Date().getTime()}.xlsx`, + fileData: res, + fileType: 'application/vnd.ms-excel;charset=utf-8' + }) }) }, - //打开工作时间外出次数 openOutCountList(row) { - this.title = "工作时间外出次数"; - this.queryRecord.userId = row.userId; - this.queryRecord.attCurrentDay = row.attCurrentDay; - this.showOutCount = true; - this.getOutCountList(); + this.title = '工作时间外出次数' + this.queryRecord.userId = row.userId + this.queryRecord.attCurrentDay = row.attCurrentDay + this.showOutCount = true + this.getOutCountList() }, /** 查询工作时间外出次数列表 */ getOutCountList() { - this.loadingTwo = true; + this.loadingTwo = true getOutCountList(this.queryRecord).then(response => { - this.tableDataOutCount = response.rows; - this.totalTwo = response.total; - this.loadingTwo = false; - }); + this.tableDataOutCount = response.rows + this.totalTwo = response.total + this.loadingTwo = false + }) }, //打开打卡次数记录 openAttCountList(row) { - this.title = "打卡记录"; - this.queryAttCount.userId = row.userId; - this.queryAttCount.userName = row.userName; - this.queryAttCount.attCurrentDay = row.attCurrentDay; - this.showAttCount = true; - this.getAttCountList(); + this.title = '打卡记录' + this.queryAttCount.userId = row.userId + this.queryAttCount.userName = row.userName + this.queryAttCount.attCurrentDay = row.attCurrentDay + this.showAttCount = true + this.getAttCountList() }, /** 查询打卡次数记录列表 */ getAttCountList() { - this.loadingAttCount = true; + this.loadingAttCount = true getAttCountList(this.queryAttCount).then(response => { - this.tableDataAttCount = response.rows; - this.totalAttCount = response.total; - this.loadingAttCount = false; - }); + this.tableDataAttCount = response.rows + this.totalAttCount = response.total + this.loadingAttCount = false + }) }, /** 导出按钮操作 */ @@ -695,8 +762,74 @@ export default { }) }, + //先上传文件 + async requestUpload(options, rowIndex, attType) { + const formData = new FormData() + formData.append('file', options.file) + try { + const response = await singleUploadFile(formData) + if (response.code == '200' || response.code == 200) { + var fileName = response.data.fileName + var filePath = response.data.filePath + + this.updateFilesVoList(rowIndex, fileName, filePath, attType); + } else { + this.$message.success(response.msg) + } + // 更新uploadedFiles或其他必要的操作 + } catch (error) { + this.$message.error('文件上传失败') + } + }, + + previewFile(filePath) { + // 根据文件路径打开预览窗口 + this.fileView= true; + this.fileData = filePath; + this.kkFilePreview = { + // filePreviewUrl: filePath.data[0].filePath, + // fileName: filePath.data[0].fileName, + filePreviewUrl: "http://192.168.0.14:31909/file/ynRealName/proFile/2025/02/19/5bb40b949c3b490b85540e6289a24c962.docx", + fileName: "aaaa.docx", + showDownloadButton: false + } + console.log(this.kkFilePreview) + }, + + //获取对应的文件名称 + getFileName(filesVoList, attType) { + if (!filesVoList) return ''; + const file = filesVoList.find(file => file.attType === attType); + return file ? file.fileName : ''; + }, + //获取对应的文件路径 + getFilePath(filesVoList, attType) { + if (!filesVoList) return ''; + const file = filesVoList.find(file => file.attType === attType); + return file ? file.filePath : ''; + }, + //更新对应的文件名称,路径 + updateFilesVoList(rowIndex, fileName, filePath, attType) { + const row = this.dialogList[rowIndex]; + if (!row.filesVoList) { + this.$set(row, 'filesVoList', []); + } + const existingFile = row.filesVoList.find(file => file.attType == attType); + if (existingFile) { + existingFile.fileName = fileName; + existingFile.filePath = filePath; + } else { + row.filesVoList.push({ fileName, filePath, attType }); + } + }, + + hasAttachments(filesVoList, attType) { + if (!filesVoList) return false; + return filesVoList.some(file => file.attType === attType); + } + } -}; +}