From 971c936f801e76d94b2bd93457a32e3368531f5c Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 05 十一月 2026 20:23:23 +0800
Subject: [PATCH] 采购申请批量提交、订单导入重复弹框;修复考勤异常申请字段不匹配
---
src/api/hrm/attendance/exception/index.ts | 5
src/views/hrm/attendance/exception/detail/approve/index.vue | 10 +
src/views/hrm/attendance/exception/data.ts | 37 +++-
src/components/table-action/icons.ts | 1
src/views/erp/purchase/request/index.vue | 40 +++++
src/views/erp/purchase/request/modules/process-select-modal.vue | 99 ++++++++++++-
src/views/erp/purchase/order/modules/import-form.vue | 147 +++++++++++++++++++-
src/api/erp/purchase/request/index.ts | 20 ++
src/api/erp/purchase/order/index.ts | 22 ++
9 files changed, 338 insertions(+), 43 deletions(-)
diff --git a/src/api/erp/purchase/order/index.ts b/src/api/erp/purchase/order/index.ts
index 4f0c6d6..32982de 100644
--- a/src/api/erp/purchase/order/index.ts
+++ b/src/api/erp/purchase/order/index.ts
@@ -112,6 +112,18 @@
});
}
+/** 閲囪喘璁㈠崟瀵煎叆閲嶅椤� */
+export interface ImportDuplicate {
+ /** 瀵煎叆鏂囦欢涓殑閲囪喘鍗曠紪鍙凤紱缂栧彿涓虹┖鏃朵负琛屽彿 */
+ key: string;
+ /** 绯荤粺鍐呭凡瀛樺湪鐨勯噰璐鍗曠紪鍙� */
+ existingNo: string;
+ /** 绯荤粺鍐呭凡瀛樺湪鐨勯噰璐鍗曠紪鍙� */
+ existingId: number;
+ /** 閲嶅鍘熷洜 */
+ reason: string;
+}
+
/** 閲囪喘璁㈠崟瀵煎叆缁撴灉 */
export interface ImportResult {
/** 鍒涘缓鎴愬姛鐨勯噰璐崟缂栧彿 */
@@ -120,6 +132,8 @@
updateList?: string[];
/** 瀵煎叆澶辫触闆嗗悎锛宬ey 涓洪噰璐崟缂栧彿鎴栬鍙凤紝value 涓哄け璐ュ師鍥� */
failureList?: Record<string, string>;
+ /** 妫�娴嬪埌鐨勯噸澶嶈鍗曪紱鏈紑鍚鐩栨椂杩欎簺璁㈠崟涓嶄細瀵煎叆 */
+ duplicateList?: ImportDuplicate[];
}
/** 鑾峰彇閲囪喘瀹℃牳娴佺▼鍒楄〃鍝嶅簲 */
@@ -143,9 +157,13 @@
}
/** 瀵煎叆閲囪喘璁㈠崟 */
-export function importPurchaseOrder(file: File, directApprove: boolean) {
+export function importPurchaseOrder(
+ file: File,
+ directApprove: boolean,
+ overwrite = false,
+) {
return requestClient.upload<ImportResult>(
'/erp/purchase-order/import',
- { file, directApprove },
+ { file, directApprove, overwrite },
);
}
diff --git a/src/api/erp/purchase/request/index.ts b/src/api/erp/purchase/request/index.ts
index 128bdd0..3d01a64 100644
--- a/src/api/erp/purchase/request/index.ts
+++ b/src/api/erp/purchase/request/index.ts
@@ -75,6 +75,26 @@
return requestClient.put('/erp/purchase-request/submit', null, { params: { id, processDefinitionKey } });
}
+/** 閲囪喘鐢宠鎵归噺鎻愪氦缁撴灉 */
+export interface SubmitBatchResult {
+ /** 鎻愪氦鎴愬姛鐨勯噰璐敵璇风紪鍙� */
+ successIds?: number[];
+ /** 鎻愪氦澶辫触闆嗗悎锛宬ey 涓洪噰璐敵璇峰崟鍙凤紙鍙栦笉鍒板崟鍙锋椂涓虹紪鍙凤級锛寁alue 涓哄け璐ュ師鍥� */
+ failureMap?: Record<string, string>;
+}
+
+/** 鎵归噺鎻愪氦閲囪喘鐢宠瀹℃壒 */
+export function submitPurchaseRequestBatch(
+ ids: number[],
+ processDefinitionKey: string,
+) {
+ return requestClient.put<SubmitBatchResult>(
+ '/erp/purchase-request/submit-batch',
+ null,
+ { params: { ids: ids.join(','), processDefinitionKey } },
+ );
+}
+
/** 閲嶇疆琚┏鍥炵殑閲囪喘鐢宠涓鸿崏绋跨姸鎬� */
export function resetPurchaseRequestStatus(id: number) {
return requestClient.put('/erp/purchase-request/reset-status', null, { params: { id } });
diff --git a/src/api/hrm/attendance/exception/index.ts b/src/api/hrm/attendance/exception/index.ts
index 1adeb2a..1d510c5 100644
--- a/src/api/hrm/attendance/exception/index.ts
+++ b/src/api/hrm/attendance/exception/index.ts
@@ -10,9 +10,8 @@
userId?: number;
userName?: string;
deptName?: string;
- date?: string;
- exceptionType?: number;
- exceptionTypeName?: string;
+ exceptionDate?: string;
+ type?: number;
reason?: string;
blobIds?: number[];
attachmentList?: SystemStorageApi.StorageBlob[];
diff --git a/src/components/table-action/icons.ts b/src/components/table-action/icons.ts
index 578265f..44a9c29 100644
--- a/src/components/table-action/icons.ts
+++ b/src/components/table-action/icons.ts
@@ -13,4 +13,5 @@
CLOSE: 'lucide:x',
BOOK: 'lucide:book',
AUDIT: 'lucide:file-check',
+ SUBMIT: 'lucide:send',
};
diff --git a/src/views/erp/purchase/order/modules/import-form.vue b/src/views/erp/purchase/order/modules/import-form.vue
index 027d268..951e032 100644
--- a/src/views/erp/purchase/order/modules/import-form.vue
+++ b/src/views/erp/purchase/order/modules/import-form.vue
@@ -1,13 +1,23 @@
<script lang="ts" setup>
import type { FileType } from 'ant-design-vue/es/upload/interface';
-import type { ImportResult } from '#/api/erp/purchase/order';
+import type {
+ ImportDuplicate,
+ ImportResult,
+} from '#/api/erp/purchase/order';
-import { computed, ref } from 'vue';
+import { computed, h, ref } from 'vue';
import { useVbenModal } from '#/packages/effects/common-ui/src';
import { downloadFileFromBlobPart } from '#/packages/utils/src';
-import { Button, message, Progress, Switch, Upload } from 'ant-design-vue';
+import {
+ Button,
+ message,
+ Modal as AntModal,
+ Progress,
+ Switch,
+ Upload,
+} from 'ant-design-vue';
import {
importPurchaseOrder,
@@ -36,19 +46,35 @@
importing.value = true;
startMockProgress();
try {
- importResult.value = await importPurchaseOrder(
- fileList.value[0] as File,
- directApprove.value,
- );
- // 瀹屾垚锛氳繘搴︽潯璧版弧
+ // 1. 鍏堟寜鈥滀笉瑕嗙洊鈥濆鍏ワ細閲嶅璁㈠崟涓嶈惤搴擄紝杩斿洖缁欏墠绔脊妗嗙‘璁�
+ let result = await runImport(false);
stopMockProgress();
progressPercent.value = 100;
+
+ // 2. 妫�娴嬪埌閲嶅鏃跺脊妗嗘彁閱掞紝鐢ㄦ埛纭鍚庢墠浠ヨ鐩栨ā寮忛噸鏂板鍏�
+ const duplicates = result.duplicateList ?? [];
+ if (duplicates.length > 0) {
+ const overwrite = await askOverwrite(duplicates);
+ if (overwrite) {
+ startMockProgress();
+ result = await runImport(true);
+ stopMockProgress();
+ progressPercent.value = 100;
+ }
+ }
+
+ importResult.value = result;
await delay(300);
emit('success');
- const failedCount = Object.keys(importResult.value?.failureList ?? {}).length;
+ const failedCount = Object.keys(result.failureList ?? {}).length;
+ const duplicateCount = result.duplicateList?.length ?? 0;
if (failedCount > 0) {
message.warning(
- `瀵煎叆瀹屾垚锛氭柊澧� ${createCount.value} 鏉★紝澶辫触 ${failedCount} 鏉★紝璇锋煡鐪嬩笅鏂瑰け璐ユ槑缁哷,
+ `瀵煎叆瀹屾垚锛氭柊澧� ${createCount.value} 寮狅紝瑕嗙洊鏇存柊 ${updateCount.value} 寮狅紝澶辫触 ${failedCount} 寮狅紝璇锋煡鐪嬩笅鏂瑰け璐ユ槑缁哷,
+ );
+ } else if (duplicateCount > 0) {
+ message.warning(
+ `瀵煎叆瀹屾垚锛氭柊澧� ${createCount.value} 寮狅紱${duplicateCount} 寮犻噸澶嶈鍗曟湭瀵煎叆锛屽彲鍦ㄤ笅鏂归�夋嫨瑕嗙洊`,
);
} else {
message.success('瀵煎叆瀹屾垚');
@@ -64,6 +90,80 @@
}
},
});
+
+function runImport(overwrite: boolean) {
+ return importPurchaseOrder(
+ fileList.value[0] as File,
+ directApprove.value,
+ overwrite,
+ );
+}
+
+/** 閲嶅璁㈠崟寮规锛氱‘璁ゅ悗瑕嗙洊绯荤粺鍐呭凡鏈夎鍗� */
+function askOverwrite(duplicates: ImportDuplicate[]) {
+ return new Promise<boolean>((resolve) => {
+ const lines = duplicates.slice(0, 10).map((item) =>
+ h(
+ 'div',
+ { class: 'text-sm leading-6' },
+ `${item.key} 鈫� 宸插瓨鍦ㄨ鍗� ${item.existingNo}锛�${item.reason}锛塦,
+ ),
+ );
+ if (duplicates.length > 10) {
+ lines.push(
+ h(
+ 'div',
+ { class: 'text-sm leading-6 text-gray-500' },
+ `鈥︹�﹀彟鏈� ${duplicates.length - 10} 寮犻噸澶嶈鍗昤,
+ ),
+ );
+ }
+ AntModal.confirm({
+ title: `妫�娴嬪埌 ${duplicates.length} 寮犻噸澶嶉噰璐鍗昤,
+ width: 560,
+ zIndex: 1100,
+ content: h('div', [
+ h(
+ 'p',
+ { class: 'mb-2' },
+ '浠ヤ笅璁㈠崟鍦ㄧ郴缁熶腑宸插瓨鍦紝鏈鏈鍏ャ�傝鐩栦細鐢ㄦ枃浠跺唴瀹规洿鏂扮郴缁熷唴宸叉湁璁㈠崟锛涘凡鍏ュ簱銆佸凡閫�璐с�佸凡鍏宠仈鍙戠エ鎴栭噰璐敵璇枫�佸凡鎻愪氦瀹℃壒娴佺▼鐨勮鍗曚笉浼氳鐩栥�傚纭鏄甯哥殑鏂伴噰璐紙涓嶆槸閲嶅涓婁紶锛夛紝璇峰湪鏂囦欢涓~鍐欎竴涓郴缁熶腑涓嶅瓨鍦ㄧ殑閲囪喘鍗曠紪鍙峰悗閲嶆柊瀵煎叆銆�',
+ ),
+ ...lines,
+ ]),
+ okText: '瑕嗙洊閲嶅璁㈠崟',
+ cancelText: '涓嶈鐩栵紝浠呬繚鐣欓潪閲嶅椤�',
+ maskClosable: false,
+ onOk: () => resolve(true),
+ onCancel: () => resolve(false),
+ });
+ });
+}
+
+/** 瀵煎叆缁撴灉涓殑鈥滆鐩栭噸澶嶈鍗曗�濇寜閽� */
+async function handleOverwrite() {
+ if (importing.value || fileList.value.length === 0) return;
+ modalApi.lock();
+ importing.value = true;
+ startMockProgress();
+ try {
+ importResult.value = await runImport(true);
+ stopMockProgress();
+ progressPercent.value = 100;
+ emit('success');
+ const failedCount = Object.keys(importResult.value?.failureList ?? {}).length;
+ if (failedCount > 0) {
+ message.warning(
+ `瑕嗙洊瀹屾垚锛氭洿鏂� ${updateCount.value} 寮狅紝澶辫触 ${failedCount} 寮狅紝璇锋煡鐪嬩笅鏂瑰け璐ユ槑缁哷,
+ );
+ } else {
+ message.success(`瑕嗙洊瀹屾垚锛氭洿鏂� ${updateCount.value} 寮犻噰璐鍗昤);
+ }
+ } finally {
+ stopMockProgress();
+ importing.value = false;
+ modalApi.unlock();
+ }
+}
/** 妯℃嫙杩涘害鏉★細璇锋眰鏈熼棿浠� 0 璧板埌 90% */
function startMockProgress() {
@@ -110,6 +210,9 @@
const failureCount = computed(
() => Object.keys(importResult.value?.failureList ?? {}).length,
);
+const duplicateCount = computed(
+ () => importResult.value?.duplicateList?.length ?? 0,
+);
</script>
<template>
@@ -130,7 +233,8 @@
</div>
<div class="mt-2 rounded-md bg-gray-50 p-2 text-xs leading-5 text-gray-500">
<p>浠呭厑璁稿鍏� xls銆亁lsx 鏍煎紡鏂囦欢锛涙ā鏉夸腑鈥滀緵搴斿晢鍚嶇О鈥濇寜鍚嶇О锛堟垨缂栫爜锛夊~鍐欙紝闇�涓庣郴缁熷唴渚涘簲鍟嗕竴鑷达紱鈥滀骇鍝佺紪鐮佲�濇寜鐗╂枡缂栫爜濉啓锛堚�滀骇鍝佸悕绉扳�濆垪浠呬緵瀵圭収锛屽尮閰嶄互浜у搧缂栫爜涓哄噯锛夛紱鈥滈噰璐椂闂粹�濇牸寮忓 2026-01-01 10:00:00锛岀暀绌哄彇褰撳墠鏃堕棿銆�</p>
- <p>涓�寮犻噰璐崟鍙惈澶氭潯鏄庣粏锛氱浉鍚屸�滈噰璐崟缂栧彿鈥濈殑澶氳浼氬悎骞朵负涓�寮犺鍗曪紙涓昏〃瀛楁鍙栬缁勯琛岋級锛涒�滈噰璐崟缂栧彿鈥濈暀绌烘椂姣忎竴琛屽悇鐢熸垚涓�寮犳柊璁㈠崟銆傞噰璐崟缂栧彿宸插瓨鍦ㄦ椂浼氬鍏ュけ璐ャ��</p>
+ <p>涓�寮犻噰璐崟鍙惈澶氭潯鏄庣粏锛氱浉鍚屸�滈噰璐崟缂栧彿鈥濈殑澶氳浼氬悎骞朵负涓�寮犺鍗曪紙涓昏〃瀛楁鍙栬缁勯琛岋級锛涒�滈噰璐崟缂栧彿鈥濈暀绌烘椂姣忎竴琛屽悇鐢熸垚涓�寮犳柊璁㈠崟銆�</p>
+ <p>瀵煎叆鏃朵細鑷姩妫�娴嬮噸澶嶈鍗曪紙閲囪喘鍗曠紪鍙峰凡瀛樺湪锛屾垨渚涘簲鍟嗐�佹槑缁嗐�佹暟閲忋�佸崟浠枫�侀噾棰濅笌宸叉湁璁㈠崟瀹屽叏涓�鑷达級銆傛娴嬪埌閲嶅浼氬脊妗嗘彁閱掞紝鐢辨偍鍐冲畾鏄惁瑕嗙洊锛涘凡鍏ュ簱銆佸凡閫�璐с�佸凡鍏宠仈鍙戠エ鎴栭噰璐敵璇风殑璁㈠崟涓嶄細琚鐩栥��</p>
<p>璁㈠崟鐘舵�侊細鍕鹃�変笂鏂瑰紑鍏� = 鐩存帴缃负鈥滃凡瀹℃牳鈥濓紱涓嶅嬀閫� = 鈥滄湭瀹℃牳鈥濄�傚鍏ヤ笉浼氳嚜鍔ㄦ彁浜ゅ鎵规祦绋嬨��</p>
</div>
<!-- 瀵煎叆杩涘害鏉� -->
@@ -147,8 +251,29 @@
<div class="mb-2 flex gap-4">
<span class="text-green-600">鏂板锛歿{ createCount }} 寮�</span>
<span class="text-blue-600">瑕嗙洊鏇存柊锛歿{ updateCount }} 寮�</span>
+ <span class="text-amber-600">閲嶅鏈鍏ワ細{{ duplicateCount }} 寮�</span>
<span class="text-red-600">澶辫触锛歿{ failureCount }} 寮�</span>
</div>
+ <div v-if="duplicateCount > 0" class="mb-2">
+ <div class="max-h-40 overflow-y-auto">
+ <div
+ v-for="item in importResult.duplicateList"
+ :key="`${item.key}-${item.existingId}`"
+ class="text-sm leading-6 text-amber-600"
+ >
+ {{ item.key }} 鈫� 宸插瓨鍦ㄨ鍗� {{ item.existingNo }}锛坽{ item.reason }}锛�
+ </div>
+ </div>
+ <Button
+ class="mt-2"
+ type="primary"
+ danger
+ :loading="importing"
+ @click="handleOverwrite"
+ >
+ 瑕嗙洊閲嶅璁㈠崟
+ </Button>
+ </div>
<div v-if="failureCount > 0" class="max-h-40 overflow-y-auto">
<div
v-for="(reason, name) in importResult.failureList"
diff --git a/src/views/erp/purchase/request/index.vue b/src/views/erp/purchase/request/index.vue
index 9957565..04c7134 100644
--- a/src/views/erp/purchase/request/index.vue
+++ b/src/views/erp/purchase/request/index.vue
@@ -95,22 +95,48 @@
/** 鎻愪氦瀹℃壒 - 鍏堣幏鍙栨祦绋嬪垪琛� */
async function handleSubmit(row: ErpPurchaseRequestApi.PurchaseRequest) {
+ await openProcessModal([row.id!]);
+}
+
+/** 鎵撳紑瀹℃壒娴佺▼閫夋嫨寮圭獥锛堟敮鎸佸崟寮�/鎵归噺锛� */
+async function openProcessModal(ids: number[]) {
+ if (ids.length === 0) return;
const hideLoading = message.loading({
content: '鑾峰彇瀹℃壒娴佺▼...',
duration: 0,
});
try {
- const processList = await getApproveProcessList(row.id!);
+ const processList = await getApproveProcessList(ids[0]!);
hideLoading();
if (!processList || processList.length === 0) {
message.warning('鏆傛棤鍙敤瀹℃壒娴佺▼锛岃鍏堥厤缃� BPM 娴佺▼');
return;
}
// 鎵撳紑娴佺▼閫夋嫨寮圭獥
- processModalApi.setData({ id: row.id, processList }).open();
+ processModalApi.setData({ ids, processList }).open();
} catch {
hideLoading();
}
+}
+
+/** 鎵归噺鎻愪氦锛氬彧鎻愪氦鍙彁浜わ紙鏈彁浜�/瀹℃壒涓嶉�氳繃锛夌殑鐢宠 */
+function handleBatchSubmit() {
+ const eligible = checkedRows.value.filter(
+ (row) => row.status === 0 || Number(row.status) === 30,
+ );
+ if (eligible.length === 0) {
+ message.warning(
+ '鎵�閫夐噰璐敵璇蜂腑娌℃湁鍙彁浜ょ殑鍗曟嵁锛屽彧鏈夆�滄湭鎻愪氦鈥濇垨鈥滃鎵逛笉閫氳繃鈥濈殑鐢宠鍙互鎻愪氦',
+ );
+ return;
+ }
+ const skipped = checkedRows.value.length - eligible.length;
+ if (skipped > 0) {
+ message.info(
+ `宸茶嚜鍔ㄨ烦杩� ${skipped} 寮犱笉鍙彁浜ょ殑鐢宠锛屾湰娆℃彁浜� ${eligible.length} 寮燻,
+ );
+ }
+ openProcessModal(eligible.map((row) => row.id!));
}
/** 鐢熸垚閲囪喘璁㈠崟 */
@@ -119,11 +145,13 @@
}
const checkedIds = ref<number[]>([]);
+const checkedRows = ref<ErpPurchaseRequestApi.PurchaseRequest[]>([]);
function handleRowCheckboxChange({
records,
}: {
records: ErpPurchaseRequestApi.PurchaseRequest[];
}) {
+ checkedRows.value = records;
checkedIds.value = records.map((item) => item.id!);
}
@@ -220,6 +248,14 @@
onClick: handleImport,
},
{
+ label: '鎵归噺鎻愪氦',
+ type: 'primary',
+ disabled: isEmpty(checkedIds),
+ icon: ACTION_ICON.SUBMIT,
+ auth: ['erp:purchase-request:submit'],
+ onClick: handleBatchSubmit,
+ },
+ {
label: '鎵归噺鍒犻櫎',
type: 'primary',
danger: true,
diff --git a/src/views/erp/purchase/request/modules/process-select-modal.vue b/src/views/erp/purchase/request/modules/process-select-modal.vue
index 2204441..8b5e6d1 100644
--- a/src/views/erp/purchase/request/modules/process-select-modal.vue
+++ b/src/views/erp/purchase/request/modules/process-select-modal.vue
@@ -1,13 +1,16 @@
<script lang="ts" setup>
import type { ErpPurchaseRequestApi } from '#/api/erp/purchase/request';
-import { ref, computed } from 'vue';
+import { ref, computed, h } from 'vue';
import { useVbenModal } from '@vben/common-ui';
-import { message, Select } from 'ant-design-vue';
+import { message, Modal as AntModal, Select } from 'ant-design-vue';
-import { submitPurchaseRequest } from '#/api/erp/purchase/request';
+import {
+ submitPurchaseRequest,
+ submitPurchaseRequestBatch,
+} from '#/api/erp/purchase/request';
interface ProcessDefinition {
id: string;
@@ -18,7 +21,7 @@
const emit = defineEmits(['success']);
-const requestId = ref<number>();
+const requestIds = ref<number[]>([]);
const processList = ref<ProcessDefinition[]>([]);
const selectedProcessKey = ref<string>('');
@@ -29,42 +32,116 @@
}));
});
+const isBatch = computed(() => requestIds.value.length > 1);
+const modalTitle = computed(() =>
+ isBatch.value
+ ? `鎵归噺鎻愪氦閲囪喘鐢宠锛�${requestIds.value.length} 寮狅級`
+ : '閫夋嫨瀹℃壒娴佺▼',
+);
+
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
if (!selectedProcessKey.value) {
message.warning('璇烽�夋嫨瀹℃壒娴佺▼');
return;
}
+ if (requestIds.value.length === 0) return;
modalApi.lock();
try {
- await submitPurchaseRequest(requestId.value!, selectedProcessKey.value);
+ if (!isBatch.value) {
+ await submitPurchaseRequest(
+ requestIds.value[0]!,
+ selectedProcessKey.value,
+ );
+ message.success('鎻愪氦鎴愬姛');
+ } else {
+ // 鍒嗘壒鎻愪氦锛岄伩鍏嶄竴娆℃�ф彁浜よ繃澶氬鑷磋姹傝秴鏃�
+ const batchSize = 50;
+ const total = requestIds.value.length;
+ let successCount = 0;
+ const failures: [string, string][] = [];
+ const loadingKey = 'purchase-request-batch-submit';
+ message.open({
+ key: loadingKey,
+ type: 'loading',
+ content: `姝e湪鎻愪氦閲囪喘鐢宠锛�0/${total}`,
+ duration: 0,
+ });
+ try {
+ for (let i = 0; i < total; i += batchSize) {
+ const chunk = requestIds.value.slice(i, i + batchSize);
+ const result = await submitPurchaseRequestBatch(
+ chunk,
+ selectedProcessKey.value,
+ );
+ successCount += result.successIds?.length ?? 0;
+ failures.push(...Object.entries(result.failureMap ?? {}));
+ message.open({
+ key: loadingKey,
+ type: 'loading',
+ content: `姝e湪鎻愪氦閲囪喘鐢宠锛�${Math.min(
+ i + batchSize,
+ total,
+ )}/${total}`,
+ duration: 0,
+ });
+ }
+ } finally {
+ message.destroy(loadingKey);
+ }
+
+ if (failures.length > 0) {
+ AntModal.warning({
+ title: `鎵归噺鎻愪氦瀹屾垚锛氭垚鍔� ${successCount} 寮狅紝澶辫触 ${failures.length} 寮燻,
+ width: 600,
+ zIndex: 1100,
+ content: h(
+ 'div',
+ { class: 'max-h-80 overflow-y-auto' },
+ failures.map(([name, reason]) =>
+ h(
+ 'div',
+ { class: 'text-sm leading-6' },
+ `${name}锛�${reason}`,
+ ),
+ ),
+ ),
+ okText: '鐭ラ亾浜�',
+ });
+ } else {
+ message.success(`鎵归噺鎻愪氦鎴愬姛锛屽叡 ${successCount} 寮燻);
+ }
+ }
await modalApi.close();
emit('success');
- message.success('鎻愪氦鎴愬姛');
} finally {
modalApi.unlock();
}
},
async onOpenChange(isOpen: boolean) {
if (!isOpen) {
- requestId.value = undefined;
+ requestIds.value = [];
selectedProcessKey.value = '';
processList.value = [];
return;
}
- const data = modalApi.getData<{ id: number; processList: ProcessDefinition[] }>();
- requestId.value = data.id;
+ const data = modalApi.getData<{
+ id?: number;
+ ids?: number[];
+ processList: ProcessDefinition[];
+ }>();
+ requestIds.value = data.ids ?? (data.id ? [data.id] : []);
processList.value = data.processList || [];
// 榛樿閫夋嫨绗竴涓祦绋�
if (processList.value.length > 0) {
- selectedProcessKey.value = processList.value[0].key;
+ selectedProcessKey.value = processList.value[0]!.key;
}
},
});
</script>
<template>
- <Modal title="閫夋嫨瀹℃壒娴佺▼" class="w-1/3">
+ <Modal :title="modalTitle" class="w-1/3">
<div class="mb-4">
<span class="mr-2">瀹℃壒娴佺▼锛�</span>
<Select
diff --git a/src/views/hrm/attendance/exception/data.ts b/src/views/hrm/attendance/exception/data.ts
index ae61c76..5eb7e8c 100644
--- a/src/views/hrm/attendance/exception/data.ts
+++ b/src/views/hrm/attendance/exception/data.ts
@@ -8,6 +8,18 @@
/** 琛ㄥ崟绫诲瀷 */
export type FormType = 'create' | 'detail';
+/** 鑰冨嫟寮傚父绫诲瀷锛屼笌鍚庣 HrmAttendanceExceptionTypeEnum 淇濇寔涓�鑷� */
+const EXCEPTION_TYPE_OPTIONS = [
+ { label: '琛ュ崱', value: 1 },
+ { label: '鍔犵彮', value: 2 },
+ { label: '鍑哄樊', value: 3 },
+];
+
+/** 鑰冨嫟寮傚父绫诲瀷鍚嶇О */
+export function formatExceptionType(value?: number) {
+ return EXCEPTION_TYPE_OPTIONS.find((item) => item.value === value)?.label ?? '-';
+}
+
/** 鏂板鑰冨嫟寮傚父鐢宠鐨勮〃鍗� */
export function useFormSchema(formType: FormType): VbenFormSchema[] {
return [
@@ -20,28 +32,23 @@
},
},
{
- fieldName: 'date',
- label: '鑰冨嫟鏃ユ湡',
+ fieldName: 'exceptionDate',
+ label: '寮傚父鏃ユ湡',
component: 'DatePicker',
componentProps: {
- placeholder: '璇烽�夋嫨鑰冨嫟鏃ユ湡',
+ placeholder: '璇烽�夋嫨寮傚父鏃ユ湡',
valueFormat: 'YYYY-MM-DD',
style: { width: '100%' },
},
rules: 'required',
},
{
- fieldName: 'exceptionType',
+ fieldName: 'type',
label: '寮傚父绫诲瀷',
component: 'Select',
componentProps: {
placeholder: '璇烽�夋嫨寮傚父绫诲瀷',
- options: [
- { label: '婕忔墦鍗�', value: 1 },
- { label: '杩熷埌', value: 2 },
- { label: '鏃╅��', value: 3 },
- { label: '鍏朵粬', value: 4 },
- ],
+ options: EXCEPTION_TYPE_OPTIONS,
},
rules: 'selectRequired',
},
@@ -113,8 +120,14 @@
return [
{ field: 'userName', title: '鐢宠浜�', minWidth: 100 },
{ field: 'deptName', title: '閮ㄩ棬', minWidth: 120 },
- { field: 'date', title: '鑰冨嫟鏃ユ湡', width: 110 },
- { field: 'exceptionTypeName', title: '寮傚父绫诲瀷', width: 100 },
+ { field: 'exceptionDate', title: '寮傚父鏃ユ湡', width: 110 },
+ {
+ field: 'type',
+ title: '寮傚父绫诲瀷',
+ width: 100,
+ formatter: ({ cellValue }: { cellValue: number }) =>
+ formatExceptionType(cellValue),
+ },
{ field: 'reason', title: '寮傚父鍘熷洜', minWidth: 200 },
{
field: 'status',
diff --git a/src/views/hrm/attendance/exception/detail/approve/index.vue b/src/views/hrm/attendance/exception/detail/approve/index.vue
index e0fef3a..ffcfae3 100644
--- a/src/views/hrm/attendance/exception/detail/approve/index.vue
+++ b/src/views/hrm/attendance/exception/detail/approve/index.vue
@@ -14,6 +14,8 @@
import { DictTag } from '#/components/dict-tag';
import { useDescription } from '#/components/description';
+import { formatExceptionType } from '../../data';
+
defineOptions({ name: 'HrmAttendanceExceptionApproveDetail' });
const props = defineProps<{ id: string }>();
@@ -34,10 +36,14 @@
{ label: '鎵�灞為儴闂�', field: 'deptName', render: textRender },
{
label: '寮傚父鏃ユ湡',
- field: 'date',
+ field: 'exceptionDate',
render: (val) => formatDateTime(val) as string,
},
- { label: '寮傚父绫诲瀷', field: 'exceptionTypeName', render: textRender },
+ {
+ label: '寮傚父绫诲瀷',
+ field: 'type',
+ render: (val) => formatExceptionType(val as number),
+ },
{ label: '寮傚父璇存槑', field: 'reason', render: textRender },
{
label: '瀹℃壒鐘舵��',
--
Gitblit v1.9.3