111
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# title
|
||||
VITE_GLOB_APP_TITLE = 未病局管理系统
|
||||
VITE_GLOB_APP_TITLE = 员工文件管理系统
|
||||
|
||||
# 本地运行端口号
|
||||
VITE_PORT = 8848
|
||||
|
||||
@@ -62,7 +62,7 @@ interface LoginProps {
|
||||
|
||||
//默认值
|
||||
const props = reactive<LoginProps>({
|
||||
sysName: "未病局管理系统",
|
||||
sysName: "员工文件管理系统",
|
||||
sysVersion: "",
|
||||
sysLogo: "",
|
||||
sysTenantOption: TenantEnum.CLOSE,
|
||||
|
||||
@@ -598,11 +598,9 @@
|
||||
type="primary"
|
||||
plain
|
||||
icon="Download"
|
||||
:loading="isContractOpening(c.id)"
|
||||
:disabled="isContractOpening(c.id)"
|
||||
@click="previewAndDownloadContract(c)"
|
||||
>
|
||||
下载 / 查阅合同原文
|
||||
下载并查看合同
|
||||
</el-button>
|
||||
|
||||
<el-checkbox
|
||||
@@ -664,7 +662,6 @@ const submitting = ref(false);
|
||||
const error = ref("");
|
||||
const currentStep = ref(0);
|
||||
const uploadingMaterials = reactive<Record<string, boolean>>({});
|
||||
const openingContracts = reactive<Record<string, boolean>>({});
|
||||
|
||||
const task = ref<OnboardingTask | null>(null);
|
||||
const contracts = ref<any[]>([]);
|
||||
@@ -1014,47 +1011,19 @@ async function isMessageBoxConfirmed(confirmPromise: Promise<unknown>) {
|
||||
}
|
||||
}
|
||||
|
||||
async function previewAndDownloadContract(c: any) {
|
||||
if (isContractOpening(c.id)) {
|
||||
return;
|
||||
}
|
||||
function previewAndDownloadContract(c: any) {
|
||||
const url = onboardingPublicApi.contractSourceUrl({
|
||||
token: token.value,
|
||||
taskContractId: c.id
|
||||
});
|
||||
|
||||
// 必须在用户点击的同步阶段创建窗口,否则手机浏览器会拦截异步完成后的 window.open。
|
||||
const previewWindow = window.open("about:blank", "_blank");
|
||||
openingContracts[String(c.id)] = true;
|
||||
try {
|
||||
if (previewWindow) {
|
||||
previewWindow.document.title = "合同生成中";
|
||||
previewWindow.document.body.innerHTML = `
|
||||
<div style="padding:40px 20px;text-align:center;font-family:sans-serif;color:#475569;">
|
||||
正在生成合同文件,请稍候…
|
||||
</div>`;
|
||||
}
|
||||
if (canEdit.value) {
|
||||
await saveCurrentEmployeeInfo();
|
||||
}
|
||||
const url = onboardingPublicApi.contractSourceUrl({
|
||||
token: token.value,
|
||||
taskContractId: c.id
|
||||
});
|
||||
if (previewWindow && !previewWindow.closed) {
|
||||
previewWindow.location.replace(url);
|
||||
} else {
|
||||
// 微信等内置浏览器拦截新窗口时,退回当前页直接发起下载。
|
||||
window.location.assign(url);
|
||||
}
|
||||
} catch (err: any) {
|
||||
previewWindow?.close();
|
||||
ElMessage.error(err?.message || "合同生成失败,请稍后重试");
|
||||
} finally {
|
||||
openingContracts[String(c.id)] = false;
|
||||
// 下载必须直接发生在用户点击事件中,避免手机浏览器拦截异步打开或二次跳转。
|
||||
const downloadWindow = window.open(url, "_blank");
|
||||
if (!downloadWindow) {
|
||||
window.location.assign(url);
|
||||
}
|
||||
}
|
||||
|
||||
function isContractOpening(taskContractId: number) {
|
||||
return Boolean(openingContracts[String(taskContractId)]);
|
||||
}
|
||||
|
||||
async function submitAll() {
|
||||
const unconfirmed = contracts.value.filter(c => !c.isAgreed);
|
||||
if (unconfirmed.length) {
|
||||
|
||||
Reference in New Issue
Block a user