实现报销材料合并预览与差旅概要(07-27-yang-jun-reimbursement-readiness)
这个提交包含在:
@@ -0,0 +1,11 @@
|
||||
import type { ReimbursementDetail } from "../api/reimbursements";
|
||||
|
||||
export function isTravelReimbursement(detail: ReimbursementDetail) {
|
||||
return Boolean(detail.travelSummary?.isTravel || detail.linkedTravelRequestId || detail.items.some((item) => item.expenseType?.category === "travel"));
|
||||
}
|
||||
|
||||
export function hasCompleteTravelSummary(detail: ReimbursementDetail) {
|
||||
if (!isTravelReimbursement(detail)) return true;
|
||||
const summary = detail.travelSummary;
|
||||
return Boolean(summary?.purpose && summary.location && summary.startDate && summary.endDate);
|
||||
}
|
||||
@@ -24,7 +24,7 @@ async function configuredWecomSdk() {
|
||||
}
|
||||
ww.register({
|
||||
corpId: config.corpId,
|
||||
jsApiList: ["previewFile", "previewImage"],
|
||||
jsApiList: ["previewFile"],
|
||||
async getConfigSignature(url) {
|
||||
const signed = await fetchWecomJsSdkSignature(url || currentPageUrl());
|
||||
return {
|
||||
@@ -58,19 +58,6 @@ export async function previewFileInWecom(file: NativePreviewFile) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function previewImagesInWecom(urls: string[], current = urls[0]) {
|
||||
if (!isWecomWebView()) {
|
||||
return false;
|
||||
}
|
||||
const normalized = urls.map((url) => url.trim()).filter(Boolean);
|
||||
if (!normalized.length || !current || !normalized.includes(current)) {
|
||||
throw new Error("图片预览信息不完整");
|
||||
}
|
||||
const ww = await configuredWecomSdk();
|
||||
await ww.previewImage({ current, urls: normalized });
|
||||
return true;
|
||||
}
|
||||
|
||||
export function openFileInBrowser(url: string) {
|
||||
window.open(url, "_blank", "noopener,noreferrer");
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户