From 0cd08f4a03daa6516d7600e409c2e15859d237d8 Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 05 十一月 2026 13:49:12 +0800
Subject: [PATCH] feat(bpm/hrm): 流程模型默认流程图、考勤统计按日筛选

---
 src/views/bpm/components/bpmn-process-designer/package/designer/plugins/defaultEmpty.js |   53 ++++++++++++++++++++++++++
 src/views/hrm/attendance/summary/index.vue                                              |   20 +++++++++-
 src/api/hrm/attendance/summary/index.ts                                                 |   13 ++++++
 src/views/hrm/attendance/summary/data.ts                                                |   16 ++++----
 4 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/src/api/hrm/attendance/summary/index.ts b/src/api/hrm/attendance/summary/index.ts
index ec25193..4bba791 100644
--- a/src/api/hrm/attendance/summary/index.ts
+++ b/src/api/hrm/attendance/summary/index.ts
@@ -28,10 +28,21 @@
     deptId?: number;
     userId?: number;
   }
+
+  /** 鑰冨嫟缁熻鏌ヨ鍙傛暟锛堜紶浜� startDate/endDate 鍒欐寜鏃ュ尯闂村疄鏃剁粺璁★級 */
+  export interface SummaryPageParams extends PageParam {
+    userId?: number;
+    deptId?: number;
+    yearMonth?: string;
+    startDate?: string;
+    endDate?: string;
+  }
 }
 
 /** 鏌ヨ鑰冨嫟缁熻鍒嗛〉鍒楄〃 */
-export function getAttendanceSummaryPage(params: PageParam) {
+export function getAttendanceSummaryPage(
+  params: HrmAttendanceSummaryApi.SummaryPageParams,
+) {
   return requestClient.get<PageResult<HrmAttendanceSummaryApi.AttendanceSummary>>(
     '/hrm/attendance/summary/page',
     { params },
diff --git a/src/views/bpm/components/bpmn-process-designer/package/designer/plugins/defaultEmpty.js b/src/views/bpm/components/bpmn-process-designer/package/designer/plugins/defaultEmpty.js
index 5c25d8e..e468097 100644
--- a/src/views/bpm/components/bpmn-process-designer/package/designer/plugins/defaultEmpty.js
+++ b/src/views/bpm/components/bpmn-process-designer/package/designer/plugins/defaultEmpty.js
@@ -1,8 +1,24 @@
+/**
+ * 鐢熸垚榛樿鐨� BPMN 娴佺▼鍥� XML
+ *
+ * 鍘嗗彶闂锛氳繖閲屽師鏈彧鐢熸垚涓�涓┖鐨� <bpmn2:process>锛屾病鏈変换浣曡妭鐐癸紝
+ * 鎵撳紑銆屾祦绋嬫ā鍨� 鈫� 淇敼 鈫� 娴佺▼璁捐銆嶆椂鐢诲竷涓�鐗囩┖鐧斤紝瀹㈡埛鍙嶉銆屾病鏈夋祦绋嬫ā鍨嬶紝闇�瑕侀厤缃竴涓嬨�嶃��
+ *
+ * 鐜版敼涓虹敓鎴愪竴涓彲鐢ㄧ殑鏈�灏忔祦绋嬮鏋讹細鍙戣捣浜� 鈫� 瀹℃壒浜� 鈫� 缁撴潫锛�
+ * 瀹㈡埛鎵撳紑鍗冲彲鍦ㄧ敾甯冧笂鐩存帴閫変腑鑺傜偣閰嶇疆瀹℃壒浜猴紝鎴栫户缁鍒犺妭鐐广��
+ * 娉ㄦ剰锛氬鎵硅妭鐐规晠鎰忎笉棰勭疆鍔炵悊浜猴紝鐢卞鎴峰湪鍙充晶灞炴�ч潰鏉块噷閫夋嫨銆�
+ */
 function defaultEmpty(key, name, type) {
   if (!type) type = 'camunda';
   const TYPE_TARGET = {
     activiti: 'http://activiti.org/bpmn',
     camunda: 'http://bpmn.io/schema/bpmn',
+    flowable: 'http://flowable.org/bpmn',
+  };
+  // 鎵╁睍灞炴�э紙濡� flowable:assignee锛夌殑鍛藉悕绌洪棿锛宑amunda 涓� bpmn.io 鐨� targetNamespace 涓嶅悓
+  const TYPE_EXTENSION_NS = {
+    activiti: 'http://activiti.org/bpmn',
+    camunda: 'http://camunda.org/schema/1.0/bpmn',
     flowable: 'http://flowable.org/bpmn',
   };
   return `<?xml version="1.0" encoding="UTF-8"?>
@@ -12,12 +28,49 @@
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
   xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
   xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
+  xmlns:${type}="${TYPE_EXTENSION_NS[type]}"
   id="diagram_${key}"
   targetNamespace="${TYPE_TARGET[type]}">
   <bpmn2:process id="${key}" name="${name}" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1" name="鍙戣捣浜�">
+      <bpmn2:outgoing>Flow_1</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:sequenceFlow id="Flow_1" sourceRef="StartEvent_1" targetRef="Activity_1" />
+    <bpmn2:userTask id="Activity_1" name="瀹℃壒浜�">
+      <bpmn2:incoming>Flow_1</bpmn2:incoming>
+      <bpmn2:outgoing>Flow_2</bpmn2:outgoing>
+    </bpmn2:userTask>
+    <bpmn2:sequenceFlow id="Flow_2" sourceRef="Activity_1" targetRef="EndEvent_1" />
+    <bpmn2:endEvent id="EndEvent_1" name="缁撴潫">
+      <bpmn2:incoming>Flow_2</bpmn2:incoming>
+    </bpmn2:endEvent>
   </bpmn2:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}">
+      <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
+        <dc:Bounds x="180" y="160" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="187" y="203" width="22" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="Activity_1_di" bpmnElement="Activity_1">
+        <dc:Bounds x="280" y="138" width="100" height="80" />
+        <bpmndi:BPMNLabel />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1_di" bpmnElement="EndEvent_1">
+        <dc:Bounds x="432" y="160" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="439" y="203" width="22" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="Flow_1_di" bpmnElement="Flow_1">
+        <di:waypoint x="216" y="178" />
+        <di:waypoint x="280" y="178" />
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="Flow_2_di" bpmnElement="Flow_2">
+        <di:waypoint x="380" y="178" />
+        <di:waypoint x="432" y="178" />
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn2:definitions>`;
diff --git a/src/views/hrm/attendance/summary/data.ts b/src/views/hrm/attendance/summary/data.ts
index 02c53a2..3a51a95 100644
--- a/src/views/hrm/attendance/summary/data.ts
+++ b/src/views/hrm/attendance/summary/data.ts
@@ -10,16 +10,16 @@
 export function useGridFormSchema(): VbenFormSchema[] {
   return [
     {
-      fieldName: 'yearMonth',
-      label: '骞存湀',
-      component: 'DatePicker',
+      // 鎸夋棩鍖洪棿绛涢�夛細浼犱簡鏃ユ湡灏卞疄鏃剁粺璁″尯闂村唴鐨勮�冨嫟锛涗笉浼犲垯鐪嬪凡鐢熸垚鐨勬湀搴︽眹鎬�
+      fieldName: 'dateRange',
+      label: '缁熻鏃ユ湡',
+      component: 'RangePicker',
       componentProps: {
-        picker: 'month',
         allowClear: true,
-        valueFormat: 'YYYY-MM',
-        format: 'YYYY-MM',
+        valueFormat: 'YYYY-MM-DD',
+        format: 'YYYY-MM-DD',
         style: { width: '100%' },
-        placeholder: '閫夋嫨骞存湀',
+        placeholder: ['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡'],
       },
     },
     {
@@ -56,7 +56,7 @@
   return [
     { field: 'userName', title: '鍛樺伐濮撳悕', minWidth: 100 },
     { field: 'deptName', title: '閮ㄩ棬', minWidth: 120 },
-    { field: 'yearMonth', title: '骞存湀', width: 100 },
+    { field: 'yearMonth', title: '缁熻鍖洪棿', width: 190 },
     { field: 'workDays', title: '搴斿嚭鍕ゅぉ鏁�', width: 100 },
     { field: 'actualDays', title: '瀹為檯鍑哄嫟澶╂暟', width: 110 },
     {
diff --git a/src/views/hrm/attendance/summary/index.vue b/src/views/hrm/attendance/summary/index.vue
index f3a2552..de8a9ea 100644
--- a/src/views/hrm/attendance/summary/index.vue
+++ b/src/views/hrm/attendance/summary/index.vue
@@ -24,6 +24,20 @@
   gridApi.query();
 }
 
+/**
+ * 鎶婅〃鍗曢噷鐨勬棩鏈熷尯闂存媶鎴愬悗绔渶瑕佺殑 startDate / endDate
+ *
+ * 涓嶉�夋棩鏈熸椂鍚庣璧般�屾湀搴︽眹鎬昏〃銆嶆煡璇紱閫変簡鏃ユ湡鍒欐寜鏃ュ尯闂村疄鏃剁粺璁℃墦鍗¤褰曘��
+ */
+function buildQueryParams(formValues: any) {
+  const { dateRange, ...rest } = formValues || {};
+  return {
+    ...rest,
+    startDate: dateRange?.[0],
+    endDate: dateRange?.[1],
+  };
+}
+
 /** 鐢熸垚缁熻 */
 function handleGenerate() {
   generateModalApi.open();
@@ -31,7 +45,9 @@
 
 /** 瀵煎嚭鑰冨嫟缁熻 */
 async function handleExport() {
-  const data = await exportAttendanceSummary(await gridApi.formApi.getValues());
+  const data = await exportAttendanceSummary(
+    buildQueryParams(await gridApi.formApi.getValues()),
+  );
   downloadFileFromBlobPart({ fileName: '鑰冨嫟缁熻.xls', source: data });
 }
 
@@ -49,7 +65,7 @@
           await getAttendanceSummaryPage({
             pageNo: page.currentPage,
             pageSize: page.pageSize,
-            ...formValues,
+            ...buildQueryParams(formValues),
           }),
       },
     },

--
Gitblit v1.9.3