From 61ba730ab32691e8f92ed455bb202f0fe33891e7 Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Mon, 24 Mar 2025 17:17:37 +0800
Subject: [PATCH] 1
---
src/api/attendance.js | 9 ++
src/api/flow/index.js | 8 +
src/utils/downloadRequest.js | 95 ++++++++++++
src/views/attendance/SignHandle.vue | 56 +++++--
src/views/attendance/components/AddSign.vue | 130 ++++++++++++++++
src/views/flow/components/FieldExport.vue | 164 ++++++++++++++++++++
src/views/flow/list.vue | 15 +-
7 files changed, 466 insertions(+), 11 deletions(-)
create mode 100644 src/utils/downloadRequest.js
create mode 100644 src/views/attendance/components/AddSign.vue
create mode 100644 src/views/flow/components/FieldExport.vue
diff --git a/src/api/attendance.js b/src/api/attendance.js
index 57ec8d9..52a5c87 100644
--- a/src/api/attendance.js
+++ b/src/api/attendance.js
@@ -18,6 +18,15 @@ export function sign(params,isLoading = true) {
})
}
+export function updateSign(params, isLoading = true) {
+ return request({
+ method: 'get',
+ url: '/api/oa/attendance/update-sign',
+ params,
+ isLoading
+ })
+}
+
export function signIp(params,isLoading = true) {
return request({
method: 'get',
diff --git a/src/api/flow/index.js b/src/api/flow/index.js
index cb4bc97..38accec 100644
--- a/src/api/flow/index.js
+++ b/src/api/flow/index.js
@@ -96,6 +96,14 @@ export function flowList(type,params,isLoading = false) {
})
}
+export function listGroup(params,isLoading) {
+ return request({
+ method: 'get',
+ url: '/api/oa/flow/list-groups',
+ params,
+ isLoading
+ })
+}
// 统计
export function todoTotal() {
return request({
diff --git a/src/utils/downloadRequest.js b/src/utils/downloadRequest.js
new file mode 100644
index 0000000..e8a73f7
--- /dev/null
+++ b/src/utils/downloadRequest.js
@@ -0,0 +1,95 @@
+import axios from "axios";
+import { getToken } from "@/utils/auth";
+import { Loading, Message } from "element-ui";
+
+/*
+ * @params {string} url 请求拼接地址
+ * @params {string} method get|post
+ * @params {object} info 请求参数params或data
+ * @params {string} filename 文件名
+ */
+
+let loading;
+export async function download(url, method = "get", info, filename, paramsSerializer) {
+ loading = Loading.service({
+ lock: true,
+ background: "rgba(0,0,0,0.4)",
+ text: "文件正在生成中...",
+ });
+
+ let options = {
+ baseURL: process.env.VUE_APP_BASE_API,
+ url,
+ method,
+ responseType: "blob",
+ timeout: 10000,
+ headers: {
+ Accept: "application/json",
+ "Content-Type": "application/json; charset=utf-8",
+ withCredentials: true,
+ Authorization: "Bearer " + getToken(),
+ },
+ paramsSerializer
+ };
+ if (method === "get") {
+ Object.defineProperty(options, "params", {
+ value: info,
+ enumerable: true,
+ writable: false,
+ });
+ }
+ if (method === "post") {
+ Object.defineProperty(options, "data", {
+ value: info,
+ enumerable: true,
+ writable: false,
+ });
+ }
+
+ try {
+ const response = await axios.request(options);
+
+ loading.close();
+
+ // 提取文件名
+ if (!filename) {
+ filename =
+ response.headers["content-disposition"]?.match(/filename=(.*)/)[1] ||
+ `${new Date().valueOf()}.xlsx`;
+ }
+
+ // 将二进制流转为blob
+ const blob = new Blob([response.data], {
+ type: "application/octet-stream",
+ });
+ if (typeof window.navigator.msSaveBlob !== "undefined") {
+ // 兼容IE,window.navigator.msSaveBlob:以本地方式保存文件
+ window.navigator.msSaveBlob(blob, decodeURI(filename));
+ } else {
+ // 创建新的URL并指向File对象或者Blob对象的地址
+ const blobURL = window.URL.createObjectURL(blob);
+ // 创建a标签,用于跳转至下载链接
+ const tempLink = document.createElement("a");
+ tempLink.style.display = "none";
+ tempLink.href = blobURL;
+ tempLink.setAttribute("download", decodeURI(filename));
+ // 兼容:某些浏览器不支持HTML5的download属性
+ if (typeof tempLink.download === "undefined") {
+ tempLink.setAttribute("target", "_blank");
+ }
+ // 挂载a标签
+ document.body.appendChild(tempLink);
+ tempLink.click();
+ document.body.removeChild(tempLink);
+ // 释放blob URL地址
+ window.URL.revokeObjectURL(blobURL);
+ }
+ } catch (err) {
+ console.error(err);
+ loading.close();
+ Message({
+ type: "error",
+ message: err,
+ });
+ }
+}
diff --git a/src/views/attendance/SignHandle.vue b/src/views/attendance/SignHandle.vue
index 8e14a0c..a03dc3c 100644
--- a/src/views/attendance/SignHandle.vue
+++ b/src/views/attendance/SignHandle.vue
@@ -3,14 +3,18 @@
+
+
+
+ value-format="yyyy-MM"
+ style="width: 160px;margin-left: 10px;">
- 搜索
+ 搜索
+ 补卡
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/flow/components/FieldExport.vue b/src/views/flow/components/FieldExport.vue
new file mode 100644
index 0000000..5ca9b1f
--- /dev/null
+++ b/src/views/flow/components/FieldExport.vue
@@ -0,0 +1,164 @@
+
+
+
$emit('update:isShow',e)"
+ >
+
+
当前导出流程: {{ config.name }}
+
+
导出文件名:
+
+
需要导出字段:
+
全选
+
+
+ {{ field.label }}
+
+
+
+
+ 确认
+
+
+
+
+
+
+
+
diff --git a/src/views/flow/list.vue b/src/views/flow/list.vue
index d907304..3f3cef8 100644
--- a/src/views/flow/list.vue
+++ b/src/views/flow/list.vue
@@ -77,6 +77,14 @@
@click="getList(true)"
>搜索
+ 导出
@@ -446,6 +454,7 @@
+
@@ -455,16 +464,20 @@ import moment from "moment/moment";
import ListPopover from "./components/ListPopover.vue";
import MultiDeal from "./components/MultiDeal.vue"
import share from "./components/share.vue";
+import FieldExport from "./components/FieldExport.vue";
import { departmentListNoAuth } from "@/api/common"
export default {
name: "flowList",
components: {
share,
ListPopover,
- MultiDeal
+ MultiDeal,
+ FieldExport
},
data() {
return {
+ isShowFieldExport: false,
+
todoTotal: [],
isShowMultiDeal: false,
multiDealFlows: [],