管理平台功能升级

This commit is contained in:
2026-06-04 16:20:45 +08:00
parent 86a383e719
commit d2d31b4bc5
43 changed files with 3533 additions and 56 deletions

View File

@@ -301,6 +301,11 @@
operateLabel="删除公司员工"
@requestOperate="requestOperate"
/>
<DownloadData
ref="downloadDataRef"
operateLabel="导出公司员工数据"
@downloadData="executeDownloadData"
/>
</div>
</template>
@@ -310,6 +315,7 @@ import { ElMessage } from "element-plus";
import TabelTools from "../operate/tabelTools.vue";
import AddNewData from "../operate/addNewData.vue";
import DownloadData from "../operate/downloadData.vue";
import TabelSelect from "../operate/tabelSelect.vue";
import SearchKey from "../search/searchKey.vue";
import SortSearch from "../search/sortSearch.vue";
@@ -330,6 +336,7 @@ import $url from "../../api/url";
import { encrypt } from "../../utils/aes";
import { judgment } from "../../utils/judgment.js";
import { hasNullOrEmptyPropertyWithTypeof } from "../../utils/hasNullOrEmptyPropertyWithTypeof.js";
import { downloadData } from "../../utils/downloadData.js";
const insidersMsgActive = insidersActiveStore();
@@ -363,6 +370,7 @@ const updatedSortDateTimeRef = ref(null);
const loginSortDateTimeRef = ref(null);
const PaginationRef = ref(null);
const addInsidersFormRef = ref(null);
const downloadDataRef = ref(null);
const editInsidersFormRef = ref(null);
const delPasswordOauthRef = ref(null);
const dialogSearchVisible = ref(false);
@@ -490,6 +498,9 @@ const showTools = (operateType) => {
dialogOperationVisible.value = !dialogOperationVisible.value;
insidersMsgActive.dialogOperationVisible = dialogOperationVisible.value;
break;
case "downloadData":
downloadDataRef.value.downloadDataDialogVisible = true;
break;
default:
break;
}
@@ -679,6 +690,70 @@ const requestOperate = () => {
});
};
const executeDownloadData = (form) => {
// 根据数据量大小来决定在前端还是后端导出数据
if (
tableData.value == [] ||
tableData.value == undefined ||
PaginationRef.value.dataCount == 0 ||
PaginationRef.value.dataCount == null
) {
ElMessage.error("暂无数据!");
return;
}
let dataClone = JSON.parse(JSON.stringify(tableData.value));
dataClone.forEach((item) => {
delete item.origin_time;
});
const dataHeaders = [
"员工uid",
"账号状态",
"账号角色",
"员工姓名",
"所属部门",
"信息变更描述",
"注册时间",
"信息变更时间",
"上次登录时间",
"登录状态"
];
downloadData(form, dataClone, dataHeaders);
if (PaginationRef.value.dataCount <= PaginationRef.value.limit) {
downloadData(form, dataClone, dataHeaders);
} else {
const data = {
form,
searchMsg: {
searchOptions: searchOptions,
sortOptions: sortOptions,
},
dataHeaders,
};
$http.post($url.downloadInsiders, data).then((res) => {
if (res.data.code === 200) {
ElMessage({
message: "数据导出成功!",
type: "success",
});
// 创建一个隐藏的<a>标签
const link = document.createElement("a");
link.style.display = "none";
link.href = res.data.fileUrl;
// 设置下载的文件名
link.download = res.data.fileName;
// 触发点击事件来下载文件
document.body.appendChild(link);
link.click();
// 清理
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
} else {
ElMessage.error("数据导出失败!");
}
});
}
};
defineExpose({ insidersMsg });
watch(searchOptions, (value) => {