From 94227d6729a9c489730435e406e3238354dec334 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 12 九月 2025 09:36:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master' into dev
---
public/DHDCico.ico | 0
src/api/personnelManagement/scheduling.js | 32
src/views/personnelManagement/scheduling/index.vue | 483 +++---
src/api/collaborativeApproval/knowledgeBase.js | 55
src/api/collaborativeApproval/sealManagement.js | 116 +
src/views/inventoryManagement/stockWarning/index.vue | 582 ++-----
src/views/personnelManagement/selfService/index.vue | 486 +++++-
src/views/collaborativeApproval/sealManagement/index.vue | 519 +++++--
.env.staging | 6
src/api/inventoryManagement/stockWarning.js | 15
src/layout/components/Sidebar/Logo.vue | 4
index.html | 4
src/assets/indexViews/DHDCLogo.png | 0
src/views/collaborativeApproval/planTemplate/index.vue | 295 ++-
src/api/collaborativeApproval/rpaManagement.js | 13
src/views/collaborativeApproval/knowledgeBase/index.vue | 216 +-
src/api/collaborativeApproval/notificationManagement.js | 63
src/assets/logo/敦煌鼎诚.png | 0
src/views/collaborativeApproval/attendanceManagement/index.vue | 509 +++++--
src/assets/indexViews/DHDCView.png | 0
src/api/personnelManagement/selfService.js | 71 +
src/api/collaborativeApproval/planTemplate.js | 64
.env.development | 4
src/api/collaborativeApproval/attendanceManagement.js | 136 +
src/views/login.vue | 2
src/views/collaborativeApproval/notificationManagement/index.vue | 343 ++--
package.json | 2
.env.production | 6
src/views/collaborativeApproval/rpaManagement/index.vue | 205 +-
29 files changed, 2,661 insertions(+), 1,570 deletions(-)
diff --git a/.env.development b/.env.development
index e3c6324..6df7fee 100644
--- a/.env.development
+++ b/.env.development
@@ -1,8 +1,8 @@
# 椤甸潰鏍囬
-VITE_APP_TITLE = 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘
+VITE_APP_TITLE = 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�
# 寮�鍙戠幆澧冮厤缃�
VITE_APP_ENV = 'development'
-# 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘/寮�鍙戠幆澧�
+# 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�/寮�鍙戠幆澧�
VITE_APP_BASE_API = '/dev-api'
diff --git a/.env.production b/.env.production
index 31b8b49..cd8dfbe 100644
--- a/.env.production
+++ b/.env.production
@@ -1,11 +1,11 @@
# 椤甸潰鏍囬
-VITE_APP_TITLE = 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘
+VITE_APP_TITLE = 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�
# 鐢熶骇鐜閰嶇疆
VITE_APP_ENV = 'production'
-# 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘/鐢熶骇鐜
+# 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�/鐢熶骇鐜
VITE_APP_BASE_API = '/prod-api'
# 鏄惁鍦ㄦ墦鍖呮椂寮�鍚帇缂╋紝鏀寔 gzip 鍜� brotli
-VITE_BUILD_COMPRESS = gzip
\ No newline at end of file
+VITE_BUILD_COMPRESS = gzip
diff --git a/.env.staging b/.env.staging
index 73c5359..1f28ac6 100644
--- a/.env.staging
+++ b/.env.staging
@@ -1,11 +1,11 @@
# 椤甸潰鏍囬
-VITE_APP_TITLE = 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘
+VITE_APP_TITLE = 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�
# 鐢熶骇鐜閰嶇疆
VITE_APP_ENV = 'staging'
-# 涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘/鐢熶骇鐜
+# 娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�/鐢熶骇鐜
VITE_APP_BASE_API = '/stage-api'
# 鏄惁鍦ㄦ墦鍖呮椂寮�鍚帇缂╋紝鏀寔 gzip 鍜� brotli
-VITE_BUILD_COMPRESS = gzip
\ No newline at end of file
+VITE_BUILD_COMPRESS = gzip
diff --git a/index.html b/index.html
index 738c782..d14eb4b 100644
--- a/index.html
+++ b/index.html
@@ -8,8 +8,8 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
/>
- <link rel="icon" href="/favicon.ico" />
- <title>涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘</title>
+ <link rel="icon" href="/ZQHXico.ico" />
+ <title>娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�</title>
<!--[if lt IE 11
]><script>
window.location.href = "/html/ie.html";
diff --git a/package.json b/package.json
index e2368c1..9f1dc17 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "ruoyi",
"version": "3.8.9",
- "description": "涓皬浼佷笟鏁板瓧鍖栬浆鍨嬩簩绾у椁愬寘",
+ "description": "娴嬭瘯杩涢攢瀛樼鐞嗙郴缁�",
"author": "鑻ヤ緷",
"license": "MIT",
"type": "module",
diff --git a/public/DHDCico.ico b/public/DHDCico.ico
new file mode 100644
index 0000000..b4c4363
--- /dev/null
+++ b/public/DHDCico.ico
Binary files differ
diff --git a/src/api/collaborativeApproval/attendanceManagement.js b/src/api/collaborativeApproval/attendanceManagement.js
new file mode 100644
index 0000000..3c99775
--- /dev/null
+++ b/src/api/collaborativeApproval/attendanceManagement.js
@@ -0,0 +1,136 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鍋囨湡璁剧疆鍒楄〃
+export function listHolidaySettings(query) {
+ return request({
+ url: "/holidaySettings/getList",
+ method: "get",
+ params: query,
+ });
+}
+//鏌ヨ骞村亣瑙勫垯鍒楄〃
+export function listAnnualLeaveSettingList(query) {
+ return request({
+ url: "/holidaySettings/getAnnualLeaveSettingList",
+ method: "get",
+ params: query,
+ });
+}
+//鏌ヨ鍔犵彮瑙勫垯鍒楄〃
+export function listOvertimeSettingList(query) {
+ return request({
+ url: "/holidaySettings/getOvertimeSettingList",
+ method: "get",
+ params: query,
+ });
+}
+//鏌ヨ宸ヤ綔鏃堕棿瑙勫垯鍒楄〃
+export function listWorkingHoursSettingList(query) {
+ return request({
+ url: "/holidaySettings/getWorkingHoursSettingList",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏂板鍋囨湡璁剧疆
+export function addHolidaySettings(data) {
+ return request({
+ url: "/holidaySettings/add",
+ method: "post",
+ data: data,
+ });
+}
+//鏂板骞村亣瑙勫垯
+export function addAnnualLeaveSetting(data) {
+ return request({
+ url: "/holidaySettings/addAnnualLeaveSetting",
+ method: "post",
+ data: data,
+ });
+}
+//鏂板鍔犵彮瑙勫垯
+export function addOvertimeSetting(data) {
+ return request({
+ url: "/holidaySettings/addOvertimeSetting",
+ method: "post",
+ data: data,
+ });
+}
+//鏂板宸ヤ綔鏃堕棿瑙勫垯
+export function addWorkingHoursSetting(data) {
+ return request({
+ url: "/holidaySettings/addWorkingHoursSetting",
+ method: "post",
+ data: data,
+ });
+}
+
+
+// 淇敼鍋囨湡璁剧疆
+export function updateHolidaySettings(data) {
+ return request({
+ url: "/holidaySettings/update",
+ method: "post",
+ data: data,
+ });
+}
+// 淇敼骞村亣瑙勫垯
+export function updateAnnualLeaveSetting(data) {
+ return request({
+ url: "/holidaySettings/updateAnnualLeaveSetting",
+ method: "post",
+ data: data,
+ });
+}
+// 淇敼鍔犵彮瑙勫垯
+export function updateOvertimeSetting(data) {
+ return request({
+ url: "/holidaySettings/updateOvertimeSetting",
+ method: "post",
+ data: data,
+ });
+}
+// 淇敼宸ヤ綔鏃堕棿瑙勫垯
+export function updateWorkingHoursSetting(data) {
+ return request({
+ url: "/holidaySettings/updateWorkingHoursSetting",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鎵归噺鍒犻櫎鍋囨湡璁剧疆
+export function delHolidaySettings(query) {
+ return request({
+ url: "/holidaySettings/delete",
+ method: "delete",
+ data: query,
+ });
+}
+// 鎵归噺鍒犻櫎骞村亣瑙勫垯
+export function delAnnualLeaveSetting(query) {
+ return request({
+ url: "/holidaySettings/deleteAnnualLeaveSetting",
+ method: "delete",
+ data: query,
+ });
+}
+// 鎵归噺鍒犻櫎鍔犵彮瑙勫垯
+export function delOvertimeSetting(query) {
+ return request({
+ url: "/holidaySettings/deleteOvertimeSetting",
+ method: "delete",
+ data: query,
+ });
+}
+// 鎵归噺鍒犻櫎宸ヤ綔鏃堕棿瑙勫垯
+export function delWorkingHoursSetting(query) {
+ return request({
+ url: "/holidaySettings/deleteWorkingHoursSetting",
+ method: "delete",
+ data: query,
+ });
+}
+
+
diff --git a/src/api/collaborativeApproval/knowledgeBase.js b/src/api/collaborativeApproval/knowledgeBase.js
new file mode 100644
index 0000000..b195525
--- /dev/null
+++ b/src/api/collaborativeApproval/knowledgeBase.js
@@ -0,0 +1,55 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鐭ヨ瘑搴撳垪琛�
+export function listKnowledgeBase(query) {
+ return request({
+ url: "/knowledgeBase/getList",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏌ヨ鐭ヨ瘑搴撹缁�
+// export function getKnowledgeBase(knowledgeBaseId) {
+// return request({
+// url: "/collaborativeApproval/knowledgeBase/" + knowledgeBaseId,
+// method: "get",
+// });
+// }
+
+// 鏂板鐭ヨ瘑搴�
+export function addKnowledgeBase(data) {
+ return request({
+ url: "/knowledgeBase/add",
+ method: "post",
+ data: data,
+ });
+}
+
+// 淇敼鐭ヨ瘑搴�
+export function updateKnowledgeBase(data) {
+ return request({
+ url: "/knowledgeBase/update",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鍒犻櫎鐭ヨ瘑搴�
+export function delKnowledgeBase(query) {
+ return request({
+ url: "/knowledgeBase/delete",
+ method: "delete",
+ data: query,
+ });
+}
+
+// 鎵归噺鍒犻櫎鐭ヨ瘑搴�
+export function delKnowledgeBaseBatch(knowledgeBaseIds) {
+ return request({
+ url: "/knowledgeBase/batch",
+ method: "delete",
+ data: knowledgeBaseIds,
+ });
+}
+
diff --git a/src/api/collaborativeApproval/notificationManagement.js b/src/api/collaborativeApproval/notificationManagement.js
new file mode 100644
index 0000000..abaeaa4
--- /dev/null
+++ b/src/api/collaborativeApproval/notificationManagement.js
@@ -0,0 +1,63 @@
+import request from "@/utils/request";
+
+// 鏌ヨ閫氱煡鍒楄〃
+export function listNotification(query) {
+ return request({
+ url: "/notificationManagement/getList",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏂板閫氱煡
+export function addNotification(data) {
+ return request({
+ url: "/notificationManagement/add",
+ method: "post",
+ data: data,
+ });
+}
+//鏂板浼氳
+export function addOnlineMeeting(data) {
+ return request({
+ url: "/notificationManagement/addOnlineMeeting",
+ method: "post",
+ data: data,
+ });
+}
+//鏂板鏂囦欢鍏变韩
+export function addFileSharing(data) {
+ return request({
+ url: "/notificationManagement/addFileSharing",
+ method: "post",
+ data: data,
+ });
+}
+
+// 淇敼閫氱煡
+export function updateNotification(data) {
+ return request({
+ url: "/notificationManagement/update",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鎵归噺鍒犻櫎閫氱煡
+export function delNotification(query) {
+ return request({
+ url: "/notificationManagement/delete",
+ method: "delete",
+ data: query,
+ });
+}
+
+// // 鎵归噺鍒犻櫎鐭ヨ瘑搴�
+// export function delKnowledgeBaseBatch(knowledgeBaseIds) {
+// return request({
+// url: "/knowledgeBase/batch",
+// method: "delete",
+// data: knowledgeBaseIds,
+// });
+// }
+
diff --git a/src/api/collaborativeApproval/planTemplate.js b/src/api/collaborativeApproval/planTemplate.js
new file mode 100644
index 0000000..24a6ac4
--- /dev/null
+++ b/src/api/collaborativeApproval/planTemplate.js
@@ -0,0 +1,64 @@
+import request from "@/utils/request";
+
+// 鏌ヨ璁″垝鍒楄〃
+export function listDutyPlan(query) {
+ return request({
+ url: "/dutyPlan/getList",
+ method: "get",
+ params: query
+ });
+}
+//鏁版嵁
+export function NumDutyPlan(query) {
+ return request({
+ url: "/dutyPlan/getNum",
+ method: "get",
+ params: query
+ });
+}
+
+// 鏂板璁″垝
+export function addDutyPlan(data) {
+ return request({
+ url: "/dutyPlan/add",
+ method: "post",
+ data: data,
+ });
+}
+
+
+// 淇敼璁″垝
+export function updateDutyPlan(data) {
+ return request({
+ url: "/dutyPlan/update",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鍒犻櫎璁″垝
+export function delDutyPlan(query) {
+ return request({
+ url: "/dutyPlan/delete",
+ method: "delete",
+ data: query,
+ });
+}
+// 瀵煎嚭璁″垝
+export function exportDutyPlan(query) {
+ return request({
+ url: "/dutyPlan/export",
+ method: "post",
+ params: query,
+ });
+}
+
+// // 鎵归噺鍒犻櫎璁″垝
+// export function delDutyPlanBatch(dutyPlanIds) {
+// return request({
+// url: "/dutyPlan/batch",
+// method: "delete",
+// data: dutyPlanIds,
+// });
+// }
+
diff --git a/src/api/collaborativeApproval/rpaManagement.js b/src/api/collaborativeApproval/rpaManagement.js
index 6fc3368..273bf9f 100644
--- a/src/api/collaborativeApproval/rpaManagement.js
+++ b/src/api/collaborativeApproval/rpaManagement.js
@@ -3,7 +3,7 @@
// 鏌ヨRPA鍒楄〃
export function listRpa(query) {
return request({
- url: "/collaborativeApproval/rpa/list",
+ url: "/rpaProcessAutomation/getList",
method: "get",
params: query,
});
@@ -20,7 +20,7 @@
// 鏂板RPA
export function addRpa(data) {
return request({
- url: "/collaborativeApproval/rpa",
+ url: "/rpaProcessAutomation/add",
method: "post",
data: data,
});
@@ -29,17 +29,18 @@
// 淇敼RPA
export function updateRpa(data) {
return request({
- url: "/collaborativeApproval/rpa",
- method: "put",
+ url: "/rpaProcessAutomation/update",
+ method: "post",
data: data,
});
}
// 鍒犻櫎RPA
-export function delRpa(rpaId) {
+export function delRpa(query) {
return request({
- url: "/collaborativeApproval/rpa/" + rpaId,
+ url: "/rpaProcessAutomation/delete",
method: "delete",
+ data: query,
});
}
diff --git a/src/api/collaborativeApproval/sealManagement.js b/src/api/collaborativeApproval/sealManagement.js
new file mode 100644
index 0000000..cb990b3
--- /dev/null
+++ b/src/api/collaborativeApproval/sealManagement.js
@@ -0,0 +1,116 @@
+import request from "@/utils/request";
+
+// 鏌ヨ鍗扮珷鐢宠鍒楄〃
+export function listSealApplication(page,query) {
+ return request({
+ url: "/sealApplicationManagement/getList",
+ method: "get",
+ params: {
+ ...page,
+ ...query},
+ });
+}
+// 鏌ヨ瑙勭珷鍒跺害鍒楄〃
+export function listRuleManagement(page,query) {
+ return request({
+ url: "/rulesRegulationsManagement/getList",
+ method: "get",
+ params: {
+ ...page,
+ ...query},
+ });
+}
+// 鏌ヨ闃呰鐘舵�佸垪琛�
+export function getReadingStatusList(page,query) {
+ return request({
+ url: "/rulesRegulationsManagement/getReadingStatusList",
+ method: "get",
+ params: {
+ ...page,
+ ...query},
+ });
+}
+// 鏍规嵁瑙勫垯id鏌ヨ闃呰鐘舵�佸垪琛�
+export function getReadingStatusByRuleId(id) {
+ return request({
+ url: "/rulesRegulationsManagement/getReadingStatusByRuleId/"+id,
+ method: "get"
+ });
+}
+
+// 鏂板鍗扮珷鐢宠
+export function addSealApplication(data) {
+ return request({
+ url: "/sealApplicationManagement/add",
+ method: "post",
+ data: data,
+ });
+}
+// 鏂板瑙勭珷鍒跺害
+export function addRuleManagement(data) {
+ return request({
+ url: "/rulesRegulationsManagement/add",
+ method: "post",
+ data: data,
+ });
+}
+// 鏂板闃呰鐘舵��
+export function addReadingStatus(data) {
+ return request({
+ url: "/rulesRegulationsManagement/addReadingStatus",
+ method: "post",
+ data: data,
+ });
+}
+
+// 淇敼鍗扮珷鐢宠
+export function updateSealApplication(data) {
+ return request({
+ url: "/sealApplicationManagement/update",
+ method: "post",
+ data: data,
+ });
+}
+// 淇敼瑙勭珷鍒跺害
+export function updateRuleManagement(data) {
+ return request({
+ url: "/rulesRegulationsManagement/update",
+ method: "post",
+ data: data,
+ });
+}
+// 淇敼闃呰鐘舵��
+export function updateReadingStatus(data) {
+ return request({
+ url: "/rulesRegulationsManagement/updateReadingStatus",
+ method: "post",
+ data: data,
+ });
+}
+
+// 鍒犻櫎鍗扮珷鐢宠
+export function delSealApplication(query) {
+ return request({
+ url: "/sealApplicationManagement/delete",
+ method: "delete",
+ data: query,
+ });
+}
+// 鍒犻櫎瑙勭珷鍒跺害
+export function delRuleManagement(query) {
+ return request({
+ url: "/rulesRegulationsManagement/delete",
+ method: "delete",
+ data: query,
+ });
+}
+
+// 鎵归噺鍒犻櫎鐭ヨ瘑搴�
+export function delKnowledgeBaseBatch(knowledgeBaseIds) {
+ return request({
+ url: "/knowledgeBase/batch",
+ method: "delete",
+ data: knowledgeBaseIds,
+ });
+}
+
diff --git a/src/api/inventoryManagement/stockWarning.js b/src/api/inventoryManagement/stockWarning.js
index 092fb80..65e641a 100644
--- a/src/api/inventoryManagement/stockWarning.js
+++ b/src/api/inventoryManagement/stockWarning.js
@@ -1,11 +1,14 @@
import request from "@/utils/request";
// 鏌ヨ鍌ㄦ皵缃愰璀﹀垪琛�
-export const getStockWarningPage = (params) => {
+export const getStockWarningPage = (page, params) => {
return request({
url: "/gasTankWarning/listPage",
method: "get",
- params,
+ params: {
+ ...page,
+ ...params
+ },
});
};
@@ -14,7 +17,7 @@
return request({
url: "/gasTankWarning/add",
method: "post",
- data,
+ data: data,
});
};
@@ -22,8 +25,8 @@
export const updateStockWarning = (data) => {
return request({
url: "/gasTankWarning/update",
- method: "put",
- data,
+ method: "post",
+ data: data,
});
};
@@ -32,7 +35,7 @@
return request({
url: "/gasTankWarning/delete",
method: "delete",
- data: { ids },
+ data: ids,
});
};
diff --git a/src/api/personnelManagement/scheduling.js b/src/api/personnelManagement/scheduling.js
new file mode 100644
index 0000000..8e4b058
--- /dev/null
+++ b/src/api/personnelManagement/scheduling.js
@@ -0,0 +1,32 @@
+// 鎺掔彮绠$悊
+import request from "@/utils/request";
+
+export function save(data) {
+ return request({
+ url: "/staff/staffScheduling/save",
+ method: "post",
+ data: data,
+ });
+}
+
+export function del(id) {
+ return request({
+ url: "/staff/staffScheduling/del/"+id,
+ method: "delete",
+ });
+}
+
+export function delByIds(data) {
+ return request({
+ url: "/staff/staffScheduling/save",
+ method: "post",
+ data: data,
+ });
+}
+export function listPage(data){
+ return request({
+ url: "/staff/staffScheduling/listPage",
+ method: "post",
+ data: data
+ })
+}
diff --git a/src/api/personnelManagement/selfService.js b/src/api/personnelManagement/selfService.js
new file mode 100644
index 0000000..c95436a
--- /dev/null
+++ b/src/api/personnelManagement/selfService.js
@@ -0,0 +1,71 @@
+// 钖叕绠$悊
+import request from "@/utils/request";
+
+// 鏌ヨ鑰冨嫟鍒楄〃
+export function personalAttendanceRecordsListPage(query) {
+ return request({
+ url: "/staff/personalAttendanceRecords/listPage",
+ method: "get",
+ params: query,
+ });
+}
+// 鏌ヨ鍋囨湡鐢宠鍒楄〃
+export function holidayApplicationListPage(query) {
+ return request({
+ url: "/staff/holidayApplication/listPage",
+ method: "get",
+ params: query,
+ });
+}
+// 鏂板
+export function personalAttendanceRecordsAdd(query) {
+ return request({
+ url: "/staff/personalAttendanceRecords/add",
+ method: "post",
+ data: query,
+ });
+}
+// 鏂板鍋囨湡鐢宠
+export function holidayApplicationAdd(query) {
+ return request({
+ url: "/staff/holidayApplication/add",
+ method: "post",
+ data: query,
+ });
+}
+// 淇敼
+export function personalAttendanceRecordsUpdate(query) {
+ return request({
+ url: "/staff/personalAttendanceRecords/update",
+ method: "put",
+ data: query,
+ });
+}
+// 淇敼鍋囨湡鐢宠
+export function holidayApplicationUpdate(query) {
+ return request({
+ url: "/staff/holidayApplication/update",
+ method: "post",
+ data: query,
+ });
+}
+// 鍒犻櫎
+export function personalAttendanceRecordsDelete(id) {
+ return request({
+ url: "/staff/personalAttendanceRecords/delete/"+id,
+ method: "delete",
+ });
+}
+// 鍒犻櫎鍋囨湡鐢宠
+export function holidayApplicationDelete(id) {
+ return request({
+ url: "/staff/holidayApplication/delete/"+id,
+ method: "delete",
+ });
+}
+// export function del(id) {
+// return request({
+// url: "/staff/staffScheduling/del/"+id,
+// method: "delete",
+// });
+// }
\ No newline at end of file
diff --git a/src/assets/indexViews/DHDCLogo.png b/src/assets/indexViews/DHDCLogo.png
new file mode 100644
index 0000000..139bdd1
--- /dev/null
+++ b/src/assets/indexViews/DHDCLogo.png
Binary files differ
diff --git a/src/assets/indexViews/DHDCView.png b/src/assets/indexViews/DHDCView.png
new file mode 100644
index 0000000..7d3e8af
--- /dev/null
+++ b/src/assets/indexViews/DHDCView.png
Binary files differ
diff --git "a/src/assets/logo/\346\225\246\347\205\214\351\274\216\350\257\232.png" "b/src/assets/logo/\346\225\246\347\205\214\351\274\216\350\257\232.png"
new file mode 100644
index 0000000..139bdd1
--- /dev/null
+++ "b/src/assets/logo/\346\225\246\347\205\214\351\274\216\350\257\232.png"
Binary files differ
diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue
index 5198aa8..c6aa445 100644
--- a/src/layout/components/Sidebar/Logo.vue
+++ b/src/layout/components/Sidebar/Logo.vue
@@ -16,7 +16,7 @@
<script setup>
import { ref, computed, onMounted, watch } from 'vue'
import useUserStore from '@/store/modules/user'
-import defaultLogo from '@/assets/indexViews/LCLogo.png' // 瀵煎叆榛樿logo
+import defaultLogo from '@/assets/indexViews/ZQHXLogo.png' // 瀵煎叆榛樿logo
defineProps({
collapse: {
@@ -126,4 +126,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/collaborativeApproval/attendanceManagement/index.vue b/src/views/collaborativeApproval/attendanceManagement/index.vue
index 7fedb46..ce6709d 100644
--- a/src/views/collaborativeApproval/attendanceManagement/index.vue
+++ b/src/views/collaborativeApproval/attendanceManagement/index.vue
@@ -5,7 +5,7 @@
<el-tab-pane label="鍋囨湡璁剧疆" name="holiday">
<div class="tab-content">
<el-button type="primary" @click="openDialog('holiday', 'add')">鏂板鍋囨湡</el-button>
-
+
<el-table :data="holidayData" border style="width: 100%; margin-top: 20px;">
<el-table-column prop="name" label="鍋囨湡鍚嶇О" />
<el-table-column prop="type" label="鍋囨湡绫诲瀷">
@@ -25,8 +25,8 @@
</el-table-column>
<el-table-column label="鎿嶄綔" fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="openDialog('holiday', 'edit', scope.row)">缂栬緫</el-button>
- <el-button type="danger" link @click="deleteItem('holiday', scope.row)">鍒犻櫎</el-button>
+ <el-button type="primary" size="small" @click="openDialog('holiday', 'edit', scope.row)">缂栬緫</el-button>
+ <el-button type="danger" size="small" @click="deleteItem('holiday', scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -37,9 +37,13 @@
<el-tab-pane label="骞村亣璁剧疆" name="annual">
<div class="tab-content">
<el-button type="primary" @click="openDialog('annual', 'add')">鏂板骞村亣瑙勫垯</el-button>
-
+
<el-table :data="annualData" border style="width: 100%; margin-top: 20px;">
- <el-table-column prop="employeeType" label="鍛樺伐绫诲瀷"/>
+ <el-table-column prop="employeeType" label="鍛樺伐绫诲瀷">
+ <template #default="scope">
+ <el-tag :type="getTagType(scope.row.employeeType)">{{ getTypeLabel(scope.row.employeeType) }}</el-tag>
+ </template>
+ </el-table-column>
<el-table-column prop="workYears" label="宸ヤ綔骞撮檺" />
<el-table-column prop="annualDays" label="骞村亣澶╂暟" align="center" />
<el-table-column prop="maxCarryOver" label="鏈�澶х粨杞ぉ鏁�" align="center" />
@@ -52,8 +56,8 @@
</el-table-column>
<el-table-column label="鎿嶄綔" fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="openDialog('annual', 'edit', scope.row)">缂栬緫</el-button>
- <el-button type="danger" link @click="deleteItem('annual', scope.row)">鍒犻櫎</el-button>
+ <el-button type="primary" size="small" @click="openDialog('annual', 'edit', scope.row)">缂栬緫</el-button>
+ <el-button type="danger" size="small" @click="deleteItem('annual', scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -64,7 +68,7 @@
<el-tab-pane label="鍔犵彮璁剧疆" name="overtime">
<div class="tab-content">
<el-button type="primary" @click="openDialog('overtime', 'add')">鏂板鍔犵彮瑙勫垯</el-button>
-
+
<el-table :data="overtimeData" border style="width: 100%; margin-top: 20px;">
<el-table-column prop="name" label="瑙勫垯鍚嶇О" />
<el-table-column prop="type" label="鍔犵彮绫诲瀷" >
@@ -84,8 +88,8 @@
</el-table-column>
<el-table-column label="鎿嶄綔" fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="openDialog('overtime', 'edit', scope.row)">缂栬緫</el-button>
- <el-button type="danger" link @click="deleteItem('overtime', scope.row)">鍒犻櫎</el-button>
+ <el-button type="primary" size="small" @click="openDialog('overtime', 'edit', scope.row)">缂栬緫</el-button>
+ <el-button type="danger" size="small" @click="deleteItem('overtime', scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -96,15 +100,15 @@
<el-tab-pane label="涓婄彮鏃堕棿璁剧疆" name="worktime">
<div class="tab-content">
<el-button type="primary" @click="openDialog('worktime', 'add')">鏂板鏃堕棿娈�</el-button>
-
+
<el-table :data="worktimeData" border style="width: 100%; margin-top: 20px;">
<el-table-column prop="name" label="鏃堕棿娈靛悕绉�" />
<el-table-column prop="startTime" label="涓婄彮鏃堕棿"/>
<el-table-column prop="endTime" label="涓嬬彮鏃堕棿" />
<el-table-column prop="flexibleStart" label="寮规�т笂鐝�">
<template #default="scope">
- <el-tag :type="scope.row.flexibleStart ? 'success' : 'info'">
- {{ scope.row.flexibleStart ? '鏄�' : '鍚�' }}
+ <el-tag :type="scope.row.flexibleStart === 'true' ? 'success' : 'info'">
+ {{ scope.row.flexibleStart === 'true' ? '鏄�' : '鍚�' }}
</el-tag>
</template>
</el-table-column>
@@ -118,8 +122,8 @@
</el-table-column>
<el-table-column label="鎿嶄綔" fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="openDialog('worktime', 'edit', scope.row)">缂栬緫</el-button>
- <el-button type="danger" link @click="deleteItem('worktime', scope.row)">鍒犻櫎</el-button>
+ <el-button type="primary" size="small" @click="openDialog('worktime', 'edit', scope.row)">缂栬緫</el-button>
+ <el-button type="danger" size="small" @click="deleteItem('worktime', scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -133,23 +137,29 @@
<el-form-item label="鍚嶇О" prop="name" v-if="currentType !== 'annual'">
<el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" />
</el-form-item>
-
+
<el-form-item label="绫诲瀷" prop="type" v-if="currentType === 'holiday' || currentType === 'overtime'">
<el-select v-model="form.type" placeholder="璇烽�夋嫨绫诲瀷" style="width: 100%">
- <el-option
- v-for="option in getTypeOptions()"
- :key="option.value"
- :label="option.label"
- :value="option.value"
+ <el-option
+ v-for="option in getTypeOptions()"
+ :key="option.value"
+ :label="option.label"
+ :value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="鍛樺伐绫诲瀷" prop="employeeType" v-if="currentType === 'annual'">
<el-select v-model="form.employeeType" placeholder="璇烽�夋嫨鍛樺伐绫诲瀷" style="width: 100%">
- <el-option label="姝e紡鍛樺伐" value="regular" />
+ <!-- <el-option label="姝e紡鍛樺伐" value="regular" />
<el-option label="璇曠敤鏈熷憳宸�" value="probation" />
- <el-option label="瀹炰範鐢�" value="intern" />
+ <el-option label="瀹炰範鐢�" value="intern" /> -->
+ <el-option
+ v-for="option in getTypeOptions()"
+ :key="option.value"
+ :label="option.label"
+ :value="option.value"
+ />
</el-select>
</el-form-item>
@@ -191,7 +201,7 @@
@change="validateTimeField('startTime')"
/>
</el-form-item>
-
+
<el-form-item label="缁撴潫鏃堕棿" prop="endTime" v-if="currentType === 'overtime'">
<el-time-picker
v-model="form.endTime"
@@ -237,14 +247,14 @@
<el-input-number v-model="form.flexibleMinutes" :min="0" :max="120" style="width: 100%" />
</el-form-item>
- <el-form-item label="鐘舵��" prop="status">
+ <el-form-item label="鐘舵��" prop="status">
<el-radio-group v-model="form.status">
<el-radio value="active">鍚敤</el-radio>
<el-radio value="inactive">鍋滅敤</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
-
+
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">鍙栨秷</el-button>
@@ -258,6 +268,7 @@
<script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+import { listHolidaySettings, addHolidaySettings, updateHolidaySettings, delHolidaySettings, listAnnualLeaveSettingList, addAnnualLeaveSetting, updateAnnualLeaveSetting, delAnnualLeaveSetting, listOvertimeSettingList, addOvertimeSetting, updateOvertimeSetting, delOvertimeSetting, listWorkingHoursSettingList, addWorkingHoursSetting, updateWorkingHoursSetting, delWorkingHoursSetting } from '@/api/collaborativeApproval/attendanceManagement.js'
// 褰撳墠婵�娲荤殑鏍囩椤�
const activeTab = ref('holiday')
@@ -269,12 +280,23 @@
const currentAction = ref('')
const currentEditId = ref('')
const formRef = ref()
+const page = {
+ current: 1,
+ size: 20,
+ total: 0,
+ }
+const holidayData = ref([])
+const annualData = ref([])
+const overtimeData = ref([])
+const worktimeData = ref([])
// 琛ㄥ崟鏁版嵁
const form = reactive({
name: '',
type: '',
dateRange: [],
+ startDate: '',
+ endDate: '',
days: 0,
employeeType: '',
workYears: '',
@@ -300,9 +322,9 @@
workYears: [{ required: true, message: '璇疯緭鍏ュ伐浣滃勾闄�', trigger: 'blur' }],
annualDays: [{ required: true, message: '璇疯緭鍏ュ勾鍋囧ぉ鏁�', trigger: 'blur' }],
maxCarryOver: [{ required: true, message: '璇疯緭鍏ユ渶澶х粨杞ぉ鏁�', trigger: 'blur' }],
- startTime: [{
- required: true,
- message: '璇烽�夋嫨寮�濮嬫椂闂�',
+ startTime: [{
+ required: true,
+ message: '璇烽�夋嫨寮�濮嬫椂闂�',
trigger: 'change',
validator: (rule, value, callback) => {
if (!value) {
@@ -312,9 +334,9 @@
}
}
}],
- endTime: [{
- required: true,
- message: '璇烽�夋嫨缁撴潫鏃堕棿',
+ endTime: [{
+ required: true,
+ message: '璇烽�夋嫨缁撴潫鏃堕棿',
trigger: 'change',
validator: (rule, value, callback) => {
if (!value) {
@@ -324,9 +346,9 @@
}
}
}],
- workStartTime: [{
- required: true,
- message: '璇烽�夋嫨涓婄彮鏃堕棿',
+ workStartTime: [{
+ required: true,
+ message: '璇烽�夋嫨涓婄彮鏃堕棿',
trigger: 'change',
validator: (rule, value, callback) => {
if (!value) {
@@ -336,9 +358,9 @@
}
}
}],
- workEndTime: [{
- required: true,
- message: '璇烽�夋嫨涓嬬彮鏃堕棿',
+ workEndTime: [{
+ required: true,
+ message: '璇烽�夋嫨涓嬬彮鏃堕棿',
trigger: 'change',
validator: (rule, value, callback) => {
if (!value) {
@@ -350,37 +372,12 @@
}],
rate: [{ required: true, message: '璇疯緭鍏ュ�嶇巼', trigger: 'blur' }]
}
-
-// 妯℃嫙鏁版嵁
-const holidayData = ref([
- { id: '1', name: '鏄ヨ妭', type: 'legal', startDate: '2025-02-10', endDate: '2025-02-17', days: 8, status: 'active' },
- { id: '2', name: '娓呮槑鑺�', type: 'legal', startDate: '2025-04-05', endDate: '2025-04-05', days: 1, status: 'active' },
- { id: '3', name: '鍔冲姩鑺�', type: 'legal', startDate: '2025-05-01', endDate: '2025-05-05', days: 5, status: 'active' }
-])
-
-const annualData = ref([
- { id: '1', employeeType: 'regular', workYears: '1-3骞�', annualDays: 5, maxCarryOver: 2, status: 'active' },
- { id: '2', employeeType: 'regular', workYears: '3-5骞�', annualDays: 10, maxCarryOver: 5, status: 'active' },
- { id: '3', employeeType: 'regular', workYears: '5骞翠互涓�', annualDays: 15, maxCarryOver: 10, status: 'active' }
-])
-
-const overtimeData = ref([
- { id: '1', name: '宸ヤ綔鏃ュ姞鐝�', type: 'weekday', startTime: '18:00', endTime: '22:00', rate: 1.5, status: 'active' },
- { id: '2', name: '鍛ㄦ湯鍔犵彮', type: 'weekend', startTime: '09:00', endTime: '18:00', rate: 2.0, status: 'active' },
- { id: '3', name: '娣卞鍔犵彮', type: 'night', startTime: '22:00', endTime: '06:00', rate: 2.5, status: 'active' }
-])
-
-const worktimeData = ref([
- { id: '1', name: '鏍囧噯宸ヤ綔鏃堕棿', startTime: '09:00', endTime: '18:00', flexibleStart: true, flexibleMinutes: 30, status: 'active' },
- { id: '2', name: '鏃╃彮鏃堕棿', startTime: '08:00', endTime: '17:00', flexibleStart: false, flexibleMinutes: 0, status: 'active' },
- { id: '3', name: '鏅氱彮鏃堕棿', startTime: '14:00', endTime: '23:00', flexibleStart: false, flexibleMinutes: 0, status: 'active' }
-])
-
// 宸ュ叿鍑芥暟
const getTagType = (type) => {
const tagMap = {
legal: 'success', adjustment: 'warning', special: 'info', company: 'primary',
- weekday: 'primary', weekend: 'warning', holiday: 'danger', night: 'info'
+ weekday: 'primary', weekend: 'warning', holiday: 'danger', night: 'info',
+ regular: 'success', probation: 'info', intern: 'danger'
}
return tagMap[type] || 'info'
}
@@ -388,7 +385,8 @@
const getTypeLabel = (type) => {
const labelMap = {
legal: '娉曞畾鑺傚亣鏃�', adjustment: '璋冧紤鏃�', special: '鐗规畩鍋囨湡', company: '鍏徃鍋囨湡',
- weekday: '宸ヤ綔鏃ュ姞鐝�', weekend: '鍛ㄦ湯鍔犵彮', holiday: '鑺傚亣鏃ュ姞鐝�', night: '娣卞鍔犵彮'
+ weekday: '宸ヤ綔鏃ュ姞鐝�', weekend: '鍛ㄦ湯鍔犵彮', holiday: '鑺傚亣鏃ュ姞鐝�', night: '娣卞鍔犵彮',
+ regular: '姝e紡鍛樺伐', probation: '璇曠敤鏈熷憳宸�', intern: '瀹炰範鐢�'
}
return labelMap[type] || type
}
@@ -408,6 +406,12 @@
{ label: '鑺傚亣鏃ュ姞鐝�', value: 'holiday' },
{ label: '娣卞鍔犵彮', value: 'night' }
]
+ } else if (currentType.value === 'annual') {
+ return [
+ { label: '姝e紡鍛樺伐', value: 'regular' },
+ { label: '璇曠敤鏈熷憳宸�', value: 'probation' },
+ { label: '瀹炰範鐢�', value: 'intern' }
+ ]
}
return []
}
@@ -418,12 +422,14 @@
if (form.dateRange && form.dateRange.length === 2 && form.dateRange[0] && form.dateRange[1]) {
const start = new Date(form.dateRange[0])
const end = new Date(form.dateRange[1])
-
+ form.startDate = start.toISOString().split('T')[0]
+ form.endDate = end.toISOString().split('T')[0]
+
if (isNaN(start.getTime()) || isNaN(end.getTime())) {
console.warn('鏃犳晥鐨勬棩鏈熸牸寮�')
return
}
-
+
const diffTime = Math.abs(end - start)
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1
form.days = diffDays
@@ -434,14 +440,14 @@
}
// 楠岃瘉鏃堕棿鏍煎紡
-const validateTime = (time) => {
- if (!time) return ''
- if (typeof time === 'string') return time
- if (time instanceof Date) {
- return time.toTimeString().slice(0, 5)
- }
- return ''
-}
+// const validateTime = (time) => {
+// if (!time) return ''
+// if (typeof time === 'string') return time
+// if (time instanceof Date) {
+// return time.toTimeString().slice(0, 5)
+// }
+// return ''
+// }
// 楠岃瘉鏃堕棿瀛楁
const validateTimeField = (fieldName) => {
@@ -464,7 +470,7 @@
try {
currentType.value = type
currentAction.value = action
-
+
if (action === 'add') {
dialogTitle.value = `鏂板${getTypeName(type)}`
currentEditId.value = ''
@@ -474,7 +480,7 @@
currentEditId.value = row.id
fillForm(row)
}
-
+
dialogVisible.value = true
} catch (error) {
console.error('鎵撳紑寮圭獥澶辫触:', error)
@@ -497,6 +503,8 @@
name: '',
type: '',
dateRange: [],
+ startDate: '',
+ endDate: '',
days: 0,
employeeType: '',
workYears: '',
@@ -519,6 +527,8 @@
name: row.name,
type: row.type,
dateRange: [new Date(row.startDate), new Date(row.endDate)],
+ startDate: row.startDate,
+ endDate: row.endDate,
days: row.days,
status: row.status
})
@@ -558,15 +568,15 @@
ElMessage.error('琛ㄥ崟寮曠敤涓嶅瓨鍦�')
return
}
-
+
await formRef.value.validate()
-
+
if (currentAction.value === 'add') {
addItem()
} else if (currentAction.value === 'edit') {
editItem()
}
-
+
dialogVisible.value = false
ElMessage.success('鎿嶄綔鎴愬姛')
} catch (error) {
@@ -576,84 +586,190 @@
}
const addItem = () => {
- const newItem = { ...form, id: Date.now().toString() }
-
+
if (currentType.value === 'holiday') {
- newItem.startDate = form.dateRange[0].toISOString().split('T')[0]
- newItem.endDate = form.dateRange[1].toISOString().split('T')[0]
- holidayData.value.push(newItem)
+ const params = {
+ name: form.name,
+ type: form.type,
+ startDate: form.startDate,
+ endDate: form.endDate,
+ days: form.days,
+ status: form.status
+ }
+ addHolidaySettings(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ // dialogVisible.value = false;
+ getHolidaySettingsList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else if (currentType.value === 'annual') {
- annualData.value.push(newItem)
+ // annualData.value.push(newItem)
+ const params = {
+ employeeType: form.employeeType,
+ workYears: form.workYears,
+ annualDays: form.annualDays,
+ maxCarryOver: form.maxCarryOver,
+ status: form.status
+ }
+ addAnnualLeaveSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ // dialogVisible.value = false;
+ getAnnualLeaveSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else if (currentType.value === 'overtime') {
- newItem.startTime = form.startTime || ''
- newItem.endTime = form.endTime || ''
- overtimeData.value.push(newItem)
+ const params = {
+ name: form.name,
+ type: form.type,
+ startTime: form.startTime || '',
+ endTime: form.endTime || '',
+ rate: form.rate,
+ status: form.status
+ }
+ addOvertimeSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ // dialogVisible.value = false;
+ getOvertimeSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // newItem.startTime = form.startTime || ''
+ // newItem.endTime = form.endTime || ''
+ // overtimeData.value.push(newItem)
} else if (currentType.value === 'worktime') {
- newItem.startTime = form.workStartTime || ''
- newItem.endTime = form.workEndTime || ''
- worktimeData.value.push(newItem)
+ const params = {
+ name: form.name,
+ startTime: form.workStartTime || '',
+ endTime: form.workEndTime || '',
+ flexibleStart: form.flexibleStart,
+ flexibleMinutes: form.flexibleMinutes,
+ status: form.status
+ }
+ addWorkingHoursSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ getWorkingHoursSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // newItem.startTime = form.workStartTime || ''
+ // newItem.endTime = form.workEndTime || ''
+ // worktimeData.value.push(newItem)
}
}
const editItem = () => {
let dataArray
let index
-
+
if (currentType.value === 'holiday') {
- dataArray = holidayData.value
- index = dataArray.findIndex(item => item.id === currentEditId.value)
- if (index > -1) {
- dataArray[index] = {
- ...dataArray[index],
- name: form.name,
- type: form.type,
- startDate: form.dateRange[0].toISOString().split('T')[0],
- endDate: form.dateRange[1].toISOString().split('T')[0],
- days: form.days,
- status: form.status
- }
+ const params = {
+ id: currentEditId.value,
+ name: form.name,
+ type: form.type,
+ startDate: form.dateRange[0].toISOString().split('T')[0],
+ endDate: form.dateRange[1].toISOString().split('T')[0],
+ days: form.days,
+ status: form.status
}
+ updateHolidaySettings(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ // dialogVisible.value = false;
+ getHolidaySettingsList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else if (currentType.value === 'annual') {
- dataArray = annualData.value
- index = dataArray.findIndex(item => item.id === currentEditId.value)
- if (index > -1) {
- dataArray[index] = {
- ...dataArray[index],
- employeeType: form.employeeType,
- workYears: form.workYears,
- annualDays: form.annualDays,
- maxCarryOver: form.maxCarryOver,
- status: form.status
- }
+ const params = {
+ id: currentEditId.value,
+ employeeType: form.employeeType,
+ workYears: form.workYears,
+ annualDays: form.annualDays,
+ maxCarryOver: form.maxCarryOver,
+ status: form.status
}
+ updateAnnualLeaveSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ getAnnualLeaveSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else if (currentType.value === 'overtime') {
- dataArray = overtimeData.value
- index = dataArray.findIndex(item => item.id === currentEditId.value)
- if (index > -1) {
- dataArray[index] = {
- ...dataArray[index],
- name: form.name,
- type: form.type,
- startTime: form.startTime || '',
- endTime: form.endTime || '',
- rate: form.rate,
- status: form.status
- }
+ const params = {
+ id: currentEditId.value,
+ name: form.name,
+ type: form.type,
+ startTime: form.startTime || '',
+ endTime: form.endTime || '',
+ rate: form.rate,
+ status: form.status
}
+ updateOvertimeSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ getOvertimeSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+
+ // dataArray = overtimeData.value
+ // index = dataArray.findIndex(item => item.id === currentEditId.value)
+ // if (index > -1) {
+ // dataArray[index] = {
+ // ...dataArray[index],
+ // name: form.name,
+ // type: form.type,
+ // startTime: form.startTime || '',
+ // endTime: form.endTime || '',
+ // rate: form.rate,
+ // status: form.status
+ // }
+ // }
} else if (currentType.value === 'worktime') {
- dataArray = worktimeData.value
- index = dataArray.findIndex(item => item.id === currentEditId.value)
- if (index > -1) {
- dataArray[index] = {
- ...dataArray[index],
- name: form.name,
- startTime: form.workStartTime || '',
- endTime: form.workEndTime || '',
- flexibleStart: form.flexibleStart,
- flexibleMinutes: form.flexibleMinutes,
- status: form.status
- }
+ const params = {
+ id: currentEditId.value,
+ name: form.name,
+ startTime: form.workStartTime || '',
+ endTime: form.workEndTime || '',
+ flexibleStart: form.flexibleStart,
+ flexibleMinutes: form.flexibleMinutes,
+ status: form.status
}
+ updateWorkingHoursSetting(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ getWorkingHoursSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // dataArray = worktimeData.value
+ // index = dataArray.findIndex(item => item.id === currentEditId.value)
+ // if (index > -1) {
+ // dataArray[index] = {
+ // ...dataArray[index],
+ // name: form.name,
+ // startTime: form.workStartTime || '',
+ // endTime: form.workEndTime || '',
+ // flexibleStart: form.flexibleStart,
+ // flexibleMinutes: form.flexibleMinutes,
+ // status: form.status
+ // }
+ // }
}
}
@@ -664,21 +780,114 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
+ let ids = [];
let dataArray
- if (type === 'holiday') dataArray = holidayData.value
- else if (type === 'annual') dataArray = annualData.value
- else if (type === 'overtime') dataArray = overtimeData.value
- else if (type === 'worktime') dataArray = worktimeData.value
-
- const index = dataArray.findIndex(item => item.id === row.id)
- if (index > -1) {
- dataArray.splice(index, 1)
- ElMessage.success('鍒犻櫎鎴愬姛')
+ if (type === 'holiday') {
+ ids.push(row.id)
+ delHolidaySettings(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ ids = []
+ getHolidaySettingsList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
}
+ else if (type === 'annual') {
+ ids.push(row.id)
+ delAnnualLeaveSetting(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ ids = []
+ getAnnualLeaveSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ }
+ else if (type === 'overtime') {
+ ids.push(row.id)
+ delOvertimeSetting(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ ids = []
+ getOvertimeSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ }
+ else if (type === 'worktime') {
+ ids.push(row.id)
+ delWorkingHoursSetting(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ ids = []
+ getWorkingHoursSettingList()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ }
+
+ // const index = dataArray.findIndex(item => item.id === row.id)
+ // if (index > -1) {
+ // dataArray.splice(index, 1)
+ // ElMessage.success('鍒犻櫎鎴愬姛')
+ // }
})
}
+// 鑾峰彇鍋囨湡璁剧疆鍒楄〃
+const getHolidaySettingsList = () => {
+ // tableLoading.value = true;
+ listHolidaySettings({...page.value})
+ .then(res => {
+ // tableLoading.value = false;
+ holidayData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ // tableLoading.value = false;
+ })
+};
+// 鑾峰彇骞村亣瑙勫垯鍒楄〃
+const getAnnualLeaveSettingList = () => {
+ listAnnualLeaveSettingList({...page.value})
+ .then(res => {
+ // console.log(res.data)
+ annualData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ })
+};
+// 鑾峰彇鍔犵彮瑙勫垯鍒楄〃
+const getOvertimeSettingList = () => {
+
+ listOvertimeSettingList({...page.value})
+ .then(res => {
+ // console.log(res.data)
+ overtimeData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ })
+};
+// 鑾峰彇宸ヤ綔鏃堕棿瑙勫垯鍒楄〃
+const getWorkingHoursSettingList = () => {
+
+ listWorkingHoursSettingList({...page.value})
+ .then(res => {
+ // console.log(res.data)
+ worktimeData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ })
+};
onMounted(() => {
+ getHolidaySettingsList()
+ getAnnualLeaveSettingList()
+ getOvertimeSettingList()
+ getWorkingHoursSettingList()
console.log('鑰冨嫟绠$悊椤甸潰鍔犺浇瀹屾垚')
})
diff --git a/src/views/collaborativeApproval/knowledgeBase/index.vue b/src/views/collaborativeApproval/knowledgeBase/index.vue
index 279738e..0839c16 100644
--- a/src/views/collaborativeApproval/knowledgeBase/index.vue
+++ b/src/views/collaborativeApproval/knowledgeBase/index.vue
@@ -28,7 +28,7 @@
<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
-
+
<div class="table_list">
<PIMTable
rowKey="id"
@@ -221,7 +221,7 @@
<span class="dialog-footer">
<el-button @click="viewDialogVisible = false">鍏抽棴</el-button>
<el-button type="primary" @click="copyKnowledge">澶嶅埗鐭ヨ瘑</el-button>
- <el-button type="success" @click="markAsFavorite">鏀惰棌</el-button>
+ <!-- <el-button type="success" @click="markAsFavorite">鏀惰棌@</el-button> -->
</span>
</template>
</el-dialog>
@@ -233,6 +233,7 @@
import { onMounted, ref, reactive, toRefs } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
+import { listKnowledgeBase, delKnowledgeBaseBatch,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js";
// 琛ㄥ崟楠岃瘉瑙勫垯
const rules = {
@@ -259,7 +260,7 @@
tableLoading: false,
page: {
current: 1,
- size: 100,
+ size: 20,
total: 0,
},
tableData: [],
@@ -268,7 +269,7 @@
title: "",
type: "",
scenario: "",
- efficiency: "medium",
+ efficiency: "",
problem: "",
solution: "",
keyPoints: "",
@@ -282,11 +283,11 @@
currentKnowledge: {}
});
-const {
- searchForm,
- tableLoading,
- page,
- tableData,
+const {
+ searchForm,
+ tableLoading,
+ page,
+ tableData,
selectedIds,
form,
dialogVisible,
@@ -400,47 +401,47 @@
]);
// 妯℃嫙鏁版嵁
-let mockData = [
- {
- id: "1",
- title: "鐗规畩鍚堝悓瀹℃壒娴佺▼浼樺寲鏂规",
- type: "contract",
- scenario: "澶ч鍚堝悓蹇�熷鎵�",
- efficiency: "high",
- problem: "澶ч鍚堝悓瀹℃壒娴佺▼澶嶆潅锛屽鎵规椂闂撮暱锛屽奖鍝嶄笟鍔¤繘灞�",
- solution: "寤虹珛缁胯壊閫氶亾锛屽绗﹀悎鏉′欢鐨勫悎鍚岄噰鐢ㄧ畝鍖栧鎵规祦绋嬶紝鐢遍儴闂ㄨ礋璐d汉鐩存帴瀹℃壒锛屽钩鍧囧鎵规椂闂翠粠3澶╃缉鐭嚦1澶�",
- keyPoints: "缁胯壊閫氶亾鏉′欢,绠�鍖栨祦绋�,瀹℃壒鏉冮檺,鏃堕棿鎺у埗",
- creator: "闄堝織寮�",
- usageCount: 15,
- createTime: "2025-01-15 10:30:00"
- },
- {
- id: "2",
- title: "璺ㄩ儴闂ㄥ崗浣滃鎵圭粡楠屾�荤粨",
- type: "experience",
- scenario: "澶氶儴闂ㄥ崗浣滈」鐩�",
- efficiency: "medium",
- problem: "璺ㄩ儴闂ㄩ」鐩鎵规椂锛屽悇閮ㄩ棬鎰忚涓嶇粺涓�锛屽鎵硅繘搴︾紦鎱�",
- solution: "寤虹珛椤圭洰鍗忚皟鏈哄埗锛屾寚瀹氶」鐩礋璐d汉锛屽畾鏈熷彫寮�鍗忚皟浼氳锛岀粺涓�鍚勬柟鎰忚鍚庡啀杩涜瀹℃壒",
- keyPoints: "椤圭洰鍗忚皟,瀹氭湡浼氳,缁熶竴鎰忚,璐熻矗浜哄埗搴�",
- creator: "鏉庝富绠�",
- usageCount: 8,
- createTime: "2025-01-14 15:20:00"
- },
- {
- id: "3",
- title: "绱ф�ラ噰璐鎵规搷浣滄寚鍗�",
- type: "guide",
- scenario: "绱ф�ラ噰璐渶姹�",
- efficiency: "high",
- problem: "绱ф�ラ噰璐椂瀹℃壒娴佺▼澶嶆潅锛屾棤娉曟弧瓒崇揣鎬ラ渶姹�",
- solution: "鍒跺畾绱ф�ラ噰璐鎵规爣鍑嗭紝鏄庣‘绱ф�ョ▼搴﹀垎绾э紝涓嶅悓绾у埆閲囩敤涓嶅悓瀹℃壒娴佺▼锛岀‘淇濈揣鎬ラ渶姹傚緱鍒板強鏃跺鐞�",
- keyPoints: "绱ф�ュ垎绾�,鏍囧噯鍒跺畾,娴佺▼绠�鍖�,鍙婃椂澶勭悊",
- creator: "鐜嬩笓鍛�",
- usageCount: 12,
- createTime: "2025-01-13 09:15:00"
- }
-];
+// let mockData = [
+// {
+// id: "1",
+// title: "鐗规畩鍚堝悓瀹℃壒娴佺▼浼樺寲鏂规",
+// type: "contract",
+// scenario: "澶ч鍚堝悓蹇�熷鎵�",
+// efficiency: "high",
+// problem: "澶ч鍚堝悓瀹℃壒娴佺▼澶嶆潅锛屽鎵规椂闂撮暱锛屽奖鍝嶄笟鍔¤繘灞�",
+// solution: "寤虹珛缁胯壊閫氶亾锛屽绗﹀悎鏉′欢鐨勫悎鍚岄噰鐢ㄧ畝鍖栧鎵规祦绋嬶紝鐢遍儴闂ㄨ礋璐d汉鐩存帴瀹℃壒锛屽钩鍧囧鎵规椂闂翠粠3澶╃缉鐭嚦1澶�",
+// keyPoints: "缁胯壊閫氶亾鏉′欢,绠�鍖栨祦绋�,瀹℃壒鏉冮檺,鏃堕棿鎺у埗",
+// creator: "寮犵粡鐞�",
+// usageCount: 15,
+// createTime: "2024-01-15 10:30:00"
+// },
+// {
+// id: "2",
+// title: "璺ㄩ儴闂ㄥ崗浣滃鎵圭粡楠屾�荤粨",
+// type: "experience",
+// scenario: "澶氶儴闂ㄥ崗浣滈」鐩�",
+// efficiency: "medium",
+// problem: "璺ㄩ儴闂ㄩ」鐩鎵规椂锛屽悇閮ㄩ棬鎰忚涓嶇粺涓�锛屽鎵硅繘搴︾紦鎱�",
+// solution: "寤虹珛椤圭洰鍗忚皟鏈哄埗锛屾寚瀹氶」鐩礋璐d汉锛屽畾鏈熷彫寮�鍗忚皟浼氳锛岀粺涓�鍚勬柟鎰忚鍚庡啀杩涜瀹℃壒",
+// keyPoints: "椤圭洰鍗忚皟,瀹氭湡浼氳,缁熶竴鎰忚,璐熻矗浜哄埗搴�",
+// creator: "鏉庝富绠�",
+// usageCount: 8,
+// createTime: "2024-01-14 15:20:00"
+// },
+// {
+// id: "3",
+// title: "绱ф�ラ噰璐鎵规搷浣滄寚鍗�",
+// type: "guide",
+// scenario: "绱ф�ラ噰璐渶姹�",
+// efficiency: "high",
+// problem: "绱ф�ラ噰璐椂瀹℃壒娴佺▼澶嶆潅锛屾棤娉曟弧瓒崇揣鎬ラ渶姹�",
+// solution: "鍒跺畾绱ф�ラ噰璐鎵规爣鍑嗭紝鏄庣‘绱ф�ョ▼搴﹀垎绾э紝涓嶅悓绾у埆閲囩敤涓嶅悓瀹℃壒娴佺▼锛岀‘淇濈揣鎬ラ渶姹傚緱鍒板強鏃跺鐞�",
+// keyPoints: "绱ф�ュ垎绾�,鏍囧噯鍒跺畾,娴佺▼绠�鍖�,鍙婃椂澶勭悊",
+// creator: "鐜嬩笓鍛�",
+// usageCount: 12,
+// createTime: "2024-01-13 09:15:00"
+// }
+// ];
// 鐭ヨ瘑鏍囬妯℃澘
const titleTemplates = [
@@ -472,13 +473,13 @@
const now = new Date();
const randomType = knowledgeTypes[Math.floor(Math.random() * knowledgeTypes.length)];
const randomScenario = scenarios[Math.floor(Math.random() * scenarios.length)];
-
+
// 鐢熸垚闅忔満鏍囬
let title = titleTemplates[Math.floor(Math.random() * titleTemplates.length)];
title = title
.replace('{type}', randomType.label)
.replace('{scenario}', randomScenario);
-
+
const newKnowledge = {
id: newId,
title: title,
@@ -488,19 +489,19 @@
problem: `鍦�${randomScenario}杩囩▼涓亣鍒扮殑闂鎻忚堪...`,
solution: `閽堝${randomScenario}鐨勮В鍐虫柟妗堝拰鎿嶄綔姝ラ...`,
keyPoints: "鍏抽敭瑕佺偣1,鍏抽敭瑕佺偣2,鍏抽敭瑕佺偣3,鍏抽敭瑕佺偣4",
- creator: ["闄堝織寮�", "鍒橀泤濠�", "鐜嬪缓鍥�", "璧典附鍗�"][Math.floor(Math.random() * 4)],
+ creator: ["寮犵粡鐞�", "鏉庝富绠�", "鐜嬩笓鍛�", "鍒樻�荤洃"][Math.floor(Math.random() * 4)],
usageCount: Math.floor(Math.random() * 20) + 1,
createTime: now.toLocaleString()
};
-
+
// 娣诲姞鍒版暟鎹紑澶�
mockData.unshift(newKnowledge);
-
+
// 淇濇寔鏁版嵁閲忓湪鍚堢悊鑼冨洿鍐咃紙鏈�澶氫繚鐣�30鏉★級
if (mockData.length > 30) {
mockData = mockData.slice(0, 30);
}
-
+
console.log(`[${new Date().toLocaleString()}] 鑷姩鐢熸垚鏂扮煡璇�: ${title}`);
};
@@ -526,24 +527,14 @@
const getList = () => {
tableLoading.value = true;
-
- setTimeout(() => {
- let filteredData = [...mockData];
-
- if (searchForm.value.title) {
- filteredData = filteredData.filter(item =>
- item.title.toLowerCase().includes(searchForm.value.title.toLowerCase())
- );
- }
-
- if (searchForm.value.type) {
- filteredData = filteredData.filter(item => item.type === searchForm.value.type);
- }
-
- tableData.value = filteredData;
- page.value.total = filteredData.length;
+ listKnowledgeBase({...page.value, ...searchForm.value})
+ .then(res => {
tableLoading.value = false;
- }, 500);
+ tableData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ tableLoading.value = false;
+ })
};
// 鍒嗛〉澶勭悊
@@ -568,7 +559,7 @@
title: "",
type: "",
scenario: "",
- efficiency: "medium",
+ efficiency: "",
problem: "",
solution: "",
keyPoints: "",
@@ -578,6 +569,7 @@
} else if (type === "edit" && row) {
dialogTitle.value = "缂栬緫鐭ヨ瘑";
Object.assign(form.value, {
+ id: row.id,
title: row.title,
type: row.type,
scenario: row.scenario,
@@ -665,15 +657,15 @@
// 澶嶅埗鐭ヨ瘑
const copyKnowledge = () => {
const knowledgeText = `
-鐭ヨ瘑鏍囬锛�${currentKnowledge.value.title}
-鐭ヨ瘑绫诲瀷锛�${getTypeLabel(currentKnowledge.value.type)}
-閫傜敤鍦烘櫙锛�${currentKnowledge.value.scenario}
-闂鎻忚堪锛�${currentKnowledge.value.problem}
-瑙e喅鏂规锛�${currentKnowledge.value.solution}
-鍏抽敭瑕佺偣锛�${currentKnowledge.value.keyPoints}
-鍒涘缓浜猴細${currentKnowledge.value.creator}
+ 鐭ヨ瘑鏍囬锛�${currentKnowledge.value.title}
+ 鐭ヨ瘑绫诲瀷锛�${getTypeLabel(currentKnowledge.value.type)}
+ 閫傜敤鍦烘櫙锛�${currentKnowledge.value.scenario}
+ 闂鎻忚堪锛�${currentKnowledge.value.problem}
+ 瑙e喅鏂规锛�${currentKnowledge.value.solution}
+ 鍏抽敭瑕佺偣锛�${currentKnowledge.value.keyPoints}
+ 鍒涘缓浜猴細${currentKnowledge.value.creator}
`.trim();
-
+
// 澶嶅埗鍒板壀璐存澘
navigator.clipboard.writeText(knowledgeText).then(() => {
ElMessage.success("鐭ヨ瘑鍐呭宸插鍒跺埌鍓创鏉�");
@@ -690,7 +682,7 @@
mockData[index].usageCount += 1;
currentKnowledge.value.usageCount += 1;
}
-
+
ElMessage.success("宸叉敹钘忥紝浣跨敤娆℃暟+1");
};
@@ -698,46 +690,28 @@
const submitForm = async () => {
try {
await formRef.value.validate();
-
if (dialogType.value === "add") {
// 鏂板鐭ヨ瘑
- const newKnowledge = {
- id: (mockData.length + 1).toString(),
- title: form.value.title,
- type: form.value.type,
- scenario: form.value.scenario,
- efficiency: form.value.efficiency,
- problem: form.value.problem,
- solution: form.value.solution,
- keyPoints: form.value.keyPoints,
- creator: form.value.creator,
- usageCount: form.value.usageCount,
- createTime: new Date().toLocaleString()
- };
-
- mockData.unshift(newKnowledge);
- ElMessage.success("鐭ヨ瘑鍒涘缓鎴愬姛");
+ addKnowledgeBase({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else {
- // 缂栬緫鐭ヨ瘑
- const index = mockData.findIndex(item => item.id === selectedIds.value[0]);
- if (index !== -1) {
- Object.assign(mockData[index], {
- title: form.value.title,
- type: form.value.type,
- scenario: form.value.scenario,
- efficiency: form.value.efficiency,
- problem: form.value.problem,
- solution: form.value.solution,
- keyPoints: form.value.keyPoints,
- creator: form.value.creator,
- usageCount: form.value.usageCount
- });
- ElMessage.success("鐭ヨ瘑鏇存柊鎴愬姛");
- }
+ updateKnowledgeBase({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
}
-
- dialogVisible.value = false;
- getList();
} catch (error) {
console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
}
@@ -749,7 +723,7 @@
ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鐭ヨ瘑");
return;
}
-
+
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
@@ -762,7 +736,7 @@
mockData.splice(index, 1);
}
});
-
+
ElMessage.success("鍒犻櫎鎴愬姛");
selectedIds.value = [];
getList();
diff --git a/src/views/collaborativeApproval/notificationManagement/index.vue b/src/views/collaborativeApproval/notificationManagement/index.vue
index e75103f..8e1b792 100644
--- a/src/views/collaborativeApproval/notificationManagement/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/index.vue
@@ -87,6 +87,8 @@
v-model="form.expireDate"
type="date"
placeholder="璇烽�夋嫨鏈夋晥鏈�"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
@@ -152,6 +154,8 @@
<el-date-picker
v-model="meetingForm.startTime"
type="datetime"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ format="YYYY-MM-DD HH:mm:ss"
placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
style="width: 100%"
/>
@@ -319,6 +323,8 @@
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import { userListNoPageByTenantId } from "@/api/system/user.js";
import { staffOnJobListPage } from "@/api/personnelManagement/employeeRecord.js";
+import { listNotification, addNotification, updateNotification, delNotification,addOnlineMeeting,addFileSharing } from "@/api/collaborativeApproval/notificationManagement.js";
+import { id } from "element-plus/es/locales.mjs";
// 琛ㄥ崟楠岃瘉瑙勫垯
const rules = {
@@ -364,7 +370,7 @@
tableLoading: false,
page: {
current: 1,
- size: 100,
+ size: 20,
total: 0,
},
tableData: [],
@@ -373,7 +379,7 @@
form: {
title: "",
type: "",
- priority: "medium",
+ priority: "",
content: "",
departments: [],
expireDate: "",
@@ -403,11 +409,11 @@
fileList: []
});
-const {
- searchForm,
- tableLoading,
- page,
- tableData,
+const {
+ searchForm,
+ tableLoading,
+ page,
+ tableData,
selectedIds,
form,
dialogVisible,
@@ -556,47 +562,6 @@
]
}
]);
-
-// 妯℃嫙鏁版嵁
-let mockData = [
- {
- id: "1",
- title: "2024骞存槬鑺傛斁鍋囬�氱煡",
- type: "holiday",
- priority: "high",
- status: "published",
- content: "鏍规嵁鍥藉瑙勫畾锛岀粨鍚堝叕鍙稿疄闄呮儏鍐碉紝鐜板皢2024骞存槬鑺傛斁鍋囧畨鎺掗�氱煡濡備笅...",
- departments: ["鎶�鏈儴", "閿�鍞儴", "浜轰簨閮�", "璐㈠姟閮�", "杩愯惀閮�", "甯傚満閮�", "瀹㈡湇閮�"],
- expireDate: "2025-02-15",
- syncMethods: ["wechat", "dingtalk", "email"],
- createTime: "2025-01-15 10:30:00"
- },
- {
- id: "2",
- title: "鎶�鏈儴鍛ㄤ緥浼氶�氱煡",
- type: "meeting",
- priority: "medium",
- status: "published",
- content: "鎶�鏈儴瀹氫簬姣忓懆浜斾笅鍗�2鐐瑰彫寮�鍛ㄤ緥浼氾紝璇峰悇浣嶅悓浜嬪噯鏃跺弬鍔�...",
- departments: ["鎶�鏈儴"],
- expireDate: "2025-01-20",
- syncMethods: ["wechat", "dingtalk"],
- createTime: "2025-01-14 15:20:00"
- },
- {
- id: "3",
- title: "鍛樺伐琛屼负瑙勮寖澶勭綒閫氱煡",
- type: "penalty",
- priority: "high",
- status: "draft",
- content: "涓虹淮鎶ゅ叕鍙告甯哥З搴忥紝瑙勮寖鍛樺伐琛屼负锛岀幇瀵硅繚鍙嶅叕鍙歌瀹氱殑琛屼负杩涜澶勭綒...",
- departments: ["浜轰簨閮�", "鎶�鏈儴", "閿�鍞儴"],
- expireDate: "2025-02-13",
- syncMethods: ["wechat", "email"],
- createTime: "2025-01-13 09:15:00"
- }
-];
-
// 閫氱煡鏍囬妯℃澘
const titleTemplates = [
"鍏充簬{year}骞磠holiday}鏀惧亣瀹夋帓鐨勯�氱煡",
@@ -631,7 +596,7 @@
employeesLoading.value = true;
// 浼樺厛浣跨敤绯荤粺鐢ㄦ埛鎺ュ彛锛堟寜绉熸埛鑾峰彇锛�
const userResponse = await userListNoPageByTenantId();
-
+
if (userResponse.data) {
employees.value = userResponse.data.map(user => ({
label: user.nickName || user.userName || '鏈煡濮撳悕',
@@ -643,12 +608,12 @@
})).filter(user => user.status === '0'); // 鍙樉绀烘甯哥姸鎬佺殑鐢ㄦ埛
} else {
// 濡傛灉绯荤粺鐢ㄦ埛鎺ュ彛澶辫触锛屼娇鐢ㄥ憳宸ュ彴璐︽帴鍙�
- const response = await staffOnJobListPage({
- pageNum: 1,
- pageSize: 1000,
+ const response = await staffOnJobListPage({
+ pageNum: 1,
+ pageSize: 1000,
staffState: 1 // 鍦ㄨ亴鐘舵��
});
-
+
if (response.data && response.data.records) {
employees.value = response.data.records.map(employee => ({
label: employee.staffName || employee.name || '鏈煡濮撳悕',
@@ -664,9 +629,9 @@
console.error('鑾峰彇鍛樺伐鍒楄〃澶辫触:', error);
// 濡傛灉鎺ュ彛閮藉け璐ワ紝浣跨敤榛樿鏁版嵁
employees.value = [
- { label: "闄堝織寮�", value: "001", dept: "鎶�鏈儴", phone: "13800138001", email: "chenzhiqiang@company.com", status: "0" },
- { label: "鍒橀泤濠�", value: "002", dept: "閿�鍞儴", phone: "13800138002", email: "liuyating@company.com", status: "0" },
- { label: "鐜嬪缓鍥�", value: "003", dept: "浜轰簨閮�", phone: "13800138003", email: "wangjianguo@company.com", status: "0" }
+ { label: "寮犱笁", value: "001", dept: "鎶�鏈儴", phone: "13800138001", email: "zhangsan@company.com", status: "0" },
+ { label: "鏉庡洓", value: "002", dept: "閿�鍞儴", phone: "13800138002", email: "lisi@company.com", status: "0" },
+ { label: "鐜嬩簲", value: "003", dept: "浜轰簨閮�", phone: "13800138003", email: "wangwu@company.com", status: "0" }
];
} finally {
employeesLoading.value = false;
@@ -683,7 +648,7 @@
}
groups[dept].push(employee);
});
-
+
// 鎸夐儴闂ㄥ悕绉版帓搴忥紝纭繚鏄剧ず椤哄簭涓�鑷�
return Object.keys(groups)
.sort()
@@ -697,7 +662,7 @@
const filterEmployees = (query) => {
if (query !== '') {
const lowerQuery = query.toLowerCase();
- return employees.value.filter(employee =>
+ return employees.value.filter(employee =>
employee.label.toLowerCase().includes(lowerQuery) ||
employee.dept.toLowerCase().includes(lowerQuery) ||
(employee.phone && employee.phone.includes(query)) ||
@@ -712,18 +677,18 @@
const refreshEmployees = async () => {
ElMessage.info("姝e湪鍒锋柊鍛樺伐鍒楄〃...");
await getEmployeesList();
-
+
// 缁熻鍚勯儴闂ㄤ汉鏁�
const deptStats = {};
employees.value.forEach(emp => {
const dept = emp.dept || '鍏朵粬閮ㄩ棬';
deptStats[dept] = (deptStats[dept] || 0) + 1;
});
-
+
const deptInfo = Object.entries(deptStats)
.map(([dept, count]) => `${dept}: ${count}浜篳)
.join(', ');
-
+
ElMessage.success(`鍛樺伐鍒楄〃鍒锋柊瀹屾垚锛屽叡 ${employees.value.length} 浜� (${deptInfo})`);
};
@@ -737,7 +702,7 @@
const getEmployeeInfo = (employeeId) => {
const employee = employees.value.find(emp => emp.value === employeeId);
if (!employee) return null;
-
+
return {
name: employee.label,
dept: employee.dept,
@@ -776,7 +741,7 @@
const now = new Date();
const randomType = notificationTypes[Math.floor(Math.random() * notificationTypes.length)];
const randomDept = departments[Math.floor(Math.random() * departments.length)];
-
+
// 鐢熸垚闅忔満鏍囬
let title = titleTemplates[Math.floor(Math.random() * titleTemplates.length)];
title = title
@@ -788,15 +753,15 @@
.replace('{company}', ['鍏徃', '闆嗗洟', '鎬婚儴'][Math.floor(Math.random() * 4)])
.replace('{project}', ['鏁板瓧鍖栬浆鍨�', '浜у搧鍗囩骇', '甯傚満鎷撳睍', '浜烘墠鍩瑰吇'][Math.floor(Math.random() * 4)])
.replace('{policy}', ['鑰冨嫟', '钖叕', '绂忓埄', '鏅嬪崌'][Math.floor(Math.random() * 4)]);
-
+
// 闅忔満鐘舵��
const statuses = ['draft', 'published'];
const randomStatus = statuses[Math.floor(Math.random() * statuses.length)];
-
+
// 闅忔満浼樺厛绾�
const priorities = ['low', 'medium', 'high'];
const randomPriority = priorities[Math.floor(Math.random() * priorities.length)];
-
+
const newNotification = {
id: newId,
title: title,
@@ -809,15 +774,15 @@
syncMethods: ["wechat", "dingtalk"],
createTime: now.toLocaleString()
};
-
+
// 娣诲姞鍒版暟鎹紑澶�
mockData.unshift(newNotification);
-
+
// 淇濇寔鏁版嵁閲忓湪鍚堢悊鑼冨洿鍐咃紙鏈�澶氫繚鐣�20鏉★級
if (mockData.length > 20) {
mockData = mockData.slice(0, 20);
}
-
+
console.log(`[${new Date().toLocaleString()}] 鑷姩鐢熸垚鏂伴�氱煡: ${title}`);
};
@@ -844,24 +809,14 @@
const getList = () => {
tableLoading.value = true;
-
- setTimeout(() => {
- let filteredData = [...mockData];
-
- if (searchForm.value.title) {
- filteredData = filteredData.filter(item =>
- item.title.toLowerCase().includes(searchForm.value.title.toLowerCase())
- );
- }
-
- if (searchForm.value.type) {
- filteredData = filteredData.filter(item => item.type === searchForm.value.type);
- }
-
- tableData.value = filteredData;
- page.value.total = filteredData.length;
+ listNotification({...page.value, ...searchForm.value})
+ .then(res => {
tableLoading.value = false;
- }, 500);
+ tableData.value = res.data.records
+ page.value.total = res.data.total;
+ }).catch(err => {
+ tableLoading.value = false;
+ })
};
// 鍒嗛〉澶勭悊
@@ -883,23 +838,27 @@
dialogTitle.value = "鏂板閫氱煡";
// 閲嶇疆琛ㄥ崟
Object.assign(form.value, {
+ id: "",
title: "",
type: "",
- priority: "medium",
+ priority: "",
content: "",
departments: [],
expireDate: "",
+ status: "draft",
syncMethods: []
});
} else if (type === "edit" && row) {
dialogTitle.value = "缂栬緫閫氱煡";
Object.assign(form.value, {
+ id: row.id,
title: row.title,
type: row.type,
priority: row.priority,
content: row.content || "",
departments: row.departments || [],
expireDate: row.expireDate || "",
+ status: row.status,
syncMethods: row.syncMethods || []
});
}
@@ -944,43 +903,30 @@
const submitForm = async () => {
try {
await formRef.value.validate();
-
+
if (dialogType.value === "add") {
// 鏂板閫氱煡
- const newNotification = {
- id: (mockData.length + 1).toString(),
- title: form.value.title,
- type: form.value.type,
- priority: form.value.priority,
- status: "draft",
- content: form.value.content,
- departments: form.value.departments,
- expireDate: form.value.expireDate,
- syncMethods: form.value.syncMethods,
- createTime: new Date().toLocaleString()
- };
-
- mockData.unshift(newNotification);
- ElMessage.success("閫氱煡鍒涘缓鎴愬姛");
+ addNotification({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else {
// 缂栬緫閫氱煡
- const index = mockData.findIndex(item => item.id === selectedIds.value[0]);
- if (index !== -1) {
- Object.assign(mockData[index], {
- title: form.value.title,
- type: form.value.type,
- priority: form.value.priority,
- content: form.value.content,
- departments: form.value.departments,
- expireDate: form.value.expireDate,
- syncMethods: form.value.syncMethods
- });
- ElMessage.success("閫氱煡鏇存柊鎴愬姛");
- }
+ updateNotification({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
}
-
- dialogVisible.value = false;
- getList();
} catch (error) {
console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
}
@@ -990,7 +936,7 @@
const createMeeting = async () => {
try {
await meetingFormRef.value.validate();
-
+
// 妯℃嫙鍒涘缓浼氳
const meetingInfo = {
title: meetingForm.value.title,
@@ -998,22 +944,28 @@
duration: meetingForm.value.duration,
participants: meetingForm.value.participants,
description: meetingForm.value.description,
- platform: meetingForm.value.platform,
- meetingId: `MTG${Date.now()}`
+ platform: meetingForm.value.platform
};
-
+ // 鏂板浼氳
+ addOnlineMeeting({...meetingInfo}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("浼氳娣诲姞鎴愬姛");
+ meetingDialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
// 妯℃嫙鍙戦�佸埌浼佷笟寰俊/閽夐拤
- const platformName = meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "鏈煡骞冲彴";
-
- ElMessage.success(`浼氳鍒涘缓鎴愬姛锛佷細璁甀D: ${meetingInfo.meetingId}锛屽皢閫氳繃${platformName}鍙戦�侀�氱煡`);
- meetingDialogVisible.value = false;
-
- // 鑾峰彇鍙備細浜哄憳淇℃伅
+ // const platformName = meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "鏈煡骞冲彴";
+ // ElMessage.success(`浼氳鍒涘缓鎴愬姛锛佷細璁甀D: ${meetingInfo.meetingId}锛屽皢閫氳繃${platformName}鍙戦�侀�氱煡`);
+
+ // 鑾峰彇鍙備細浜哄憳淇℃伅
const participantNames = meetingForm.value.participants.map(participantId => {
const employee = employees.value.find(emp => emp.value === participantId);
return employee ? employee.label : '鏈煡浜哄憳';
}).join('銆�');
-
+
// 鑾峰彇鍙備細浜哄憳璇︾粏淇℃伅
const participantDetails = meetingForm.value.participants.map(participantId => {
const employee = employees.value.find(emp => emp.value === participantId);
@@ -1024,23 +976,29 @@
email: employee.email
} : null;
}).filter(Boolean);
-
+
// 灏嗕細璁俊鎭坊鍔犲埌閫氱煡鍒楄〃
const meetingNotification = {
- id: (mockData.length + 1).toString(),
title: `[浼氳閫氱煡] ${meetingInfo.title}`,
type: "meeting",
priority: "high",
status: "published",
- content: `浼氳鏃堕棿: ${meetingInfo.startTime}锛屾椂闀�: ${meetingInfo.duration}鍒嗛挓锛屽钩鍙�: ${meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "鏈煡骞冲彴"}锛屽弬浼氫汉鍛�: ${participantNames}锛屽叡${participantDetails.length}浜篳,
+ content: `浼氳鏃堕棿: ${meetingInfo.startTime}锛屾椂闀�: ${meetingInfo.duration}鍒嗛挓锛屽钩鍙�: ${meetingPlatforms.find(p => p.value === meetingForm.value.platform)?.label || "鏈煡骞冲彴"}锛屽弬浼氫汉鍛�: ${participantNames}锛屽叡${participantDetails.length}浜篳,
departments: [],
expireDate: "",
- syncMethods: [meetingForm.value.platform],
- createTime: new Date().toLocaleString()
+ syncMethods: [meetingForm.value.platform]
};
-
- mockData.unshift(meetingNotification);
- getList();
+ addNotification({...meetingNotification}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ // dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // mockData.unshift(meetingNotification);
+ // getList();
} catch (error) {
console.error("浼氳琛ㄥ崟楠岃瘉澶辫触:", error);
}
@@ -1053,16 +1011,16 @@
ElMessage.error("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
return false;
}
-
+
const fileInfo = {
name: file.name,
size: file.size,
type: file.type,
uid: file.uid
};
-
+
fileList.value.push(fileInfo);
- fileShareForm.value.files.push(fileInfo);
+ fileShareForm.value.files.push(fileInfo.name);
return false; // 闃绘鑷姩涓婁紶
};
@@ -1082,27 +1040,34 @@
const shareFiles = async () => {
try {
await fileShareFormRef.value.validate();
-
+
if (fileShareForm.value.files.length === 0) {
ElMessage.warning("璇疯嚦灏戦�夋嫨涓�涓枃浠�");
return;
}
-
+
// 妯℃嫙鏂囦欢鍏变韩
const shareInfo = {
title: fileShareForm.value.title,
description: fileShareForm.value.description,
departments: fileShareForm.value.departments,
files: fileShareForm.value.files,
- shareId: `FILE${Date.now()}`
};
-
- ElMessage.success(`鏂囦欢鍏变韩鎴愬姛锛佸叡浜獻D: ${shareInfo.shareId}锛屽凡閫氱煡鐩稿叧閮ㄩ棬`);
- fileShareDialogVisible.value = false;
-
+ addFileSharing({...shareInfo}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏂囦欢鍏变韩鎴愬姛");
+ fileShareDialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+
+ // ElMessage.success(`鏂囦欢鍏变韩鎴愬姛锛佸叡浜獻D: ${shareInfo.shareId}锛屽凡閫氱煡鐩稿叧閮ㄩ棬`);
+
+
// 灏嗘枃浠跺叡浜俊鎭坊鍔犲埌閫氱煡鍒楄〃
const fileShareNotification = {
- id: (mockData.length + 1).toString(),
title: `[鏂囦欢鍏变韩] ${shareInfo.title}`,
type: "temporary",
priority: "medium",
@@ -1111,11 +1076,19 @@
departments: shareInfo.departments,
expireDate: "",
syncMethods: ["wechat", "dingtalk"],
- createTime: new Date().toLocaleString()
};
-
- mockData.unshift(fileShareNotification);
- getList();
+ addNotification({...fileShareNotification}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ // dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+
+ // mockData.unshift(fileShareNotification);
+ // getList();
} catch (error) {
console.error("鏂囦欢鍏变韩琛ㄥ崟楠岃瘉澶辫触:", error);
}
@@ -1123,33 +1096,75 @@
// 鍙戝竷閫氱煡
const publishNotification = (row) => {
- row.status = "published";
- ElMessage.success("閫氱煡鍙戝竷鎴愬姛");
- getList();
+ Object.assign(form.value, {
+ id: row.id,
+ title: row.title,
+ type: row.type,
+ priority: row.priority,
+ content: row.content || "",
+ departments: row.departments || [],
+ expireDate: row.expireDate || "",
+ status: row.status,
+ syncMethods: row.syncMethods || []
+ });
+ form.value.status = "published";
+ updateNotification({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("閫氱煡鍙戝竷鎴愬姛");
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
};
// 鎾ゅ洖閫氱煡
const revokeNotification = (row) => {
- row.status = "draft";
- ElMessage.success("閫氱煡宸叉挙鍥�");
- getList();
+ Object.assign(form.value, {
+ id: row.id,
+ title: row.title,
+ type: row.type,
+ priority: row.priority,
+ content: row.content || "",
+ departments: row.departments || [],
+ expireDate: row.expireDate || "",
+ status: row.status,
+ syncMethods: row.syncMethods || []
+ });
+ form.value.status = "draft";
+ updateNotification({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("閫氱煡宸叉挙鍥�");
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
};
// 鍒犻櫎閫氱煡
const handleDelete = () => {
- if (selectedIds.value.length === 0) {
+ let ids = [];
+ if (selectedIds.value.length > 0) {
+ ids = selectedIds.value;
+ }else{
ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑閫氱煡");
return;
}
-
ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
confirmButtonText: "纭",
cancelButtonText: "鍙栨秷",
type: "warning",
}).then(() => {
- ElMessage.success("鍒犻櫎鎴愬姛");
- selectedIds.value = [];
- getList();
+ delNotification(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ selectedIds.value = [];
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
}).catch(() => {
// 鐢ㄦ埛鍙栨秷
});
diff --git a/src/views/collaborativeApproval/planTemplate/index.vue b/src/views/collaborativeApproval/planTemplate/index.vue
index f46a203..0af6d8b 100644
--- a/src/views/collaborativeApproval/planTemplate/index.vue
+++ b/src/views/collaborativeApproval/planTemplate/index.vue
@@ -18,6 +18,8 @@
v-model="currentDate"
:type="datePickerType"
placeholder="閫夋嫨鏃ユ湡"
+ format="YYYY-MM-DD"
+ value-format="YYYY-MM-DD"
style="width: 180px; margin-left: 10px"
@change="handleDateChange"
/>
@@ -25,7 +27,7 @@
<div class="right-actions">
<el-button type="primary" @click="handleAddPlan">鏂板璁″垝</el-button>
<el-button @click="handleExport">瀵煎嚭璁″垝</el-button>
- <el-button @click="handleShare">鍏变韩璁″垝</el-button>
+ <!-- <el-button @click="handleShare">鍏变韩璁″垝@</el-button> -->
</div>
</div>
@@ -107,7 +109,7 @@
<span>{{ getCurrentLevelText() }} - {{ getCurrentPeriodText() }}</span>
<div>
<el-button size="small" @click="handleRefresh">鍒锋柊</el-button>
- <el-button size="small" @click="handleFilter">绛涢��</el-button>
+ <!-- <el-button size="small" @click="handleFilter">绛涢�堾</el-button> -->
</div>
</div>
</template>
@@ -122,13 +124,13 @@
<div class="plan-actions">
<el-button size="small" @click="handleEditPlan(plan)">缂栬緫</el-button>
<el-button size="small" @click="handleViewDetail(plan)">璇︽儏</el-button>
- <el-dropdown @command="handleMoreAction">
+ <el-dropdown @command="(command) => handleMoreAction(plan, command)">
<el-button size="small">
鏇村<el-icon class="el-icon--right"><ArrowDown /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
- <el-dropdown-item command="share">鍏变韩</el-dropdown-item>
+ <!-- <el-dropdown-item command="share">鍏变韩@</el-dropdown-item> -->
<el-dropdown-item command="copy">澶嶅埗</el-dropdown-item>
<el-dropdown-item command="delete" divided>鍒犻櫎</el-dropdown-item>
</el-dropdown-menu>
@@ -180,7 +182,7 @@
<!-- 鏂板/缂栬緫璁″垝瀵硅瘽妗� -->
<el-dialog
v-model="planDialogVisible"
- :title="dialogTitle"
+ :title="operationType === 'add' ? '鍙戝竷璁″垝' : '缂栬緫璁″垝'"
width="600px"
@close="handleDialogClose"
>
@@ -215,6 +217,8 @@
<el-date-picker
v-model="planForm.startDate"
type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
placeholder="閫夋嫨寮�濮嬫椂闂�"
style="width: 100%"
/>
@@ -223,6 +227,8 @@
<el-date-picker
v-model="planForm.endDate"
type="date"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
placeholder="閫夋嫨缁撴潫鏃堕棿"
style="width: 100%"
/>
@@ -237,8 +243,48 @@
<el-option label="浣�" value="low" />
</el-select>
</el-form-item>
- <el-form-item label="鏍囩">
+ <!-- <el-form-item label="鏍囩">
<el-input v-model="planForm.tags" placeholder="璇疯緭鍏ユ爣绛撅紝鐢ㄩ�楀彿鍒嗛殧" />
+ </el-form-item> -->
+ <el-form-item label="鏍囩" prop="tags">
+ <!-- <el-checkbox-group v-model="planForm.tags">
+ <el-checkbox label="all"></el-checkbox>
+ <el-checkbox label="manager">绠$悊灞�</el-checkbox>
+ <el-checkbox label="hr">浜轰簨閮ㄩ棬</el-checkbox>
+ <el-checkbox label="finance">璐㈠姟閮ㄩ棬</el-checkbox>
+ <el-checkbox label="tech">鎶�鏈儴闂�</el-checkbox>
+ </el-checkbox-group> -->
+ <el-select
+ v-model="planForm.tags"
+ multiple
+ placeholder="璇烽�夋嫨鏍囩"
+ style="width: 100%"
+ >
+ <el-option
+ v-for="dept in departments"
+ :key="dept"
+ :label="dept"
+ :value="dept"
+ />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鐘舵��" prop="status">
+ <el-select v-model="planForm.status" placeholder="閫夋嫨鐘舵��" style="width: 100%">
+ <el-option label="鏈紑濮�" value="not_started" />
+ <el-option label="杩涜涓�" value="in_progress" />
+ <el-option label="宸插畬鎴�" value="completed" />
+ <el-option label="宸叉殏鍋�" value="paused" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="杩涘害" prop="progress">
+ <el-input-number
+ v-model="planForm.progress"
+ min="0"
+ max="100"
+ step="1"
+ placeholder="璇疯緭鍏ヨ繘搴�"
+ style="width: 100%"
+ />
</el-form-item>
</el-form>
<template #footer>
@@ -248,12 +294,31 @@
</span>
</template>
</el-dialog>
+ <!-- 璁″垝璇︽儏瀵硅瘽妗� -->
+ <el-dialog v-model="showPlanDetailDialog" title="璁″垝璇︽儏" width="700px">
+ <div v-if="currentPlanDetail" class="mb10">
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="璁″垝鏍囬">{{ currentPlanDetail.title }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝鎻忚堪">{{ currentPlanDetail.description }}</el-descriptions-item>
+ <el-descriptions-item label="璁″垝绾у埆">{{ getCurrentLevelText(currentPlanDetail.level) }}</el-descriptions-item>
+ <el-descriptions-item label="鏃堕棿鍛ㄦ湡">{{ getCurrentPeriodText(currentPlanDetail.period) }}</el-descriptions-item>
+ <el-descriptions-item label="寮�濮嬫椂闂�">{{ currentPlanDetail.startDate }}</el-descriptions-item>
+ <el-descriptions-item label="缁撴潫鏃堕棿">{{ currentPlanDetail.endDate }}</el-descriptions-item>
+ <el-descriptions-item label="璐熻矗浜�">{{ currentPlanDetail.assignee }}</el-descriptions-item>
+ <el-descriptions-item label="浼樺厛绾�">{{ getPriorityText(currentPlanDetail.priority) }}</el-descriptions-item>
+ <el-descriptions-item label="鏍囩">{{ currentPlanDetail.tags.join(', ') }}</el-descriptions-item>
+ <el-descriptions-item label="鐘舵��">{{ getStatusText(currentPlanDetail.status) }}</el-descriptions-item>
+ <el-descriptions-item label="杩涘害">{{ currentPlanDetail.progress }}%</el-descriptions-item>
+ </el-descriptions>
+ </div>
+ </el-dialog>
</div>
</template>
<script setup>
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
+const { proxy } = getCurrentInstance();
import {
User,
UserFilled,
@@ -264,17 +329,22 @@
Flag,
ArrowDown
} from '@element-plus/icons-vue'
+import { listDutyPlan, addDutyPlan, updateDutyPlan, delDutyPlan,NumDutyPlan,exportDutyPlan } from '@/api/collaborativeApproval/planTemplate.js'
// 鍝嶅簲寮忔暟鎹�
+const operationType = ref('add')
const currentLevel = ref('personal')
const currentPeriod = ref('week')
const currentDate = ref(new Date())
const planDialogVisible = ref(false)
const dialogTitle = ref('鏂板璁″垝')
const planFormRef = ref()
+const showPlanDetailDialog = ref(false)
+const currentPlanDetail = ref(null)
// 琛ㄥ崟鏁版嵁
const planForm = reactive({
+ id: '',
title: '',
description: '',
level: 'personal',
@@ -283,7 +353,9 @@
endDate: '',
assignee: '',
priority: 'medium',
- tags: ''
+ tags: [],
+ status: '',
+ progress: 0
})
// 琛ㄥ崟楠岃瘉瑙勫垯
@@ -297,74 +369,17 @@
assignee: [{ required: true, message: '璇疯緭鍏ヨ礋璐d汉', trigger: 'blur' }],
priority: [{ required: true, message: '璇烽�夋嫨浼樺厛绾�', trigger: 'change' }]
}
-
+const departments = ["浜у搧", "鍒嗘瀽", "璋冪爺",'鎶�鏈�', '鏋舵瀯', '璁捐','甯傚満', '鎺ㄥ箍', '钀ラ攢'];
// 姒傝鏁版嵁
const overviewData = reactive({
- personal: { total: 12, completion: 75 },
- group: { total: 8, completion: 60 },
- department: { total: 15, completion: 45 },
- company: { total: 6, completion: 30 }
+ personal: { total: 0, completion: 0 },
+ group: { total: 0, completion: 0 },
+ department: { total: 0, completion: 0 },
+ company: { total: 0, completion: 0 }
})
// 璁″垝鍒楄〃鏁版嵁
-const planList = ref([
- {
- id: 1,
- title: '浜у搧闇�姹傚垎鏋�',
- description: '瀵规柊浜у搧杩涜璇︾粏鐨勯渶姹傚垎鏋愬拰甯傚満璋冪爺锛屽埗瀹氫骇鍝佽鍒掓柟妗�',
- level: 'personal',
- period: 'week',
- startDate: '2025-01-15',
- endDate: '2025-01-21',
- assignee: '闄堝織寮�',
- priority: 'high',
- status: 'in_progress',
- progress: 80,
- tags: ['浜у搧', '鍒嗘瀽', '璋冪爺']
- },
- {
- id: 2,
- title: '鎶�鏈灦鏋勮璁�',
- description: '璁捐绯荤粺鎶�鏈灦鏋勶紝鍖呮嫭鏁版嵁搴撹璁°�佹帴鍙h璁$瓑',
- level: 'group',
- period: 'month',
- startDate: '2025-01-01',
- endDate: '2025-01-31',
- assignee: '鍒橀泤濠�',
- priority: 'high',
- status: 'completed',
- progress: 100,
- tags: ['鎶�鏈�', '鏋舵瀯', '璁捐']
- },
- {
- id: 3,
- title: '甯傚満鎺ㄥ箍璁″垝',
- description: '鍒跺畾骞村害甯傚満鎺ㄥ箍绛栫暐鍜岃惀閿�璁″垝',
- level: 'department',
- period: 'year',
- startDate: '2025-01-01',
- endDate: '2025-12-31',
- assignee: '鐜嬪缓鍥�',
- priority: 'medium',
- status: 'not_started',
- progress: 0,
- tags: ['甯傚満', '鎺ㄥ箍', '钀ラ攢']
- },
- {
- id: 4,
- title: '鍥㈤槦寤鸿娲诲姩',
- description: '缁勭粐鍥㈤槦寤鸿娲诲姩锛屾彁鍗囧洟闃熷嚌鑱氬姏鍜屽崗浣滄晥鐜�',
- level: 'company',
- period: 'month',
- startDate: '2025-01-15',
- endDate: '2025-02-15',
- assignee: '璧典附鍗�',
- priority: 'low',
- status: 'in_progress',
- progress: 30,
- tags: ['鍥㈤槦', '寤鸿', '娲诲姩']
- }
-])
+const planList = ref([])
// 璁$畻灞炴��
const datePickerType = computed(() => {
@@ -383,20 +398,24 @@
// 鏂规硶
const handleLevelChange = (value) => {
console.log('璁″垝绾у埆鍙樻洿:', value)
+ getPlanList()
// 杩欓噷鍙互鏍规嵁绾у埆绛涢�夋暟鎹�
}
const handlePeriodChange = (value) => {
console.log('鏃堕棿鍛ㄦ湡鍙樻洿:', value)
+ getPlanList()
// 杩欓噷鍙互鏍规嵁鍛ㄦ湡绛涢�夋暟鎹�
}
const handleDateChange = (value) => {
console.log('鏃ユ湡鍙樻洿:', value)
+ getPlanList()
// 杩欓噷鍙互鏍规嵁鏃ユ湡绛涢�夋暟鎹�
}
const handleAddPlan = () => {
+ operationType.value = 'add'
dialogTitle.value = '鏂板璁″垝'
planDialogVisible.value = true
// 閲嶇疆琛ㄥ崟
@@ -406,32 +425,61 @@
planForm.level = 'personal'
planForm.period = 'week'
planForm.priority = 'medium'
+ planForm.status = 'not_started'
+ planForm.progress = 0
}
const handleEditPlan = (plan) => {
+ operationType.value = 'edit'
dialogTitle.value = '缂栬緫璁″垝'
planDialogVisible.value = true
- // 濉厖琛ㄥ崟鏁版嵁
- Object.keys(planForm).forEach(key => {
- if (key === 'tags') {
- planForm[key] = plan[key].join(', ')
- } else {
- planForm[key] = plan[key]
- }
- })
+ Object.assign(planForm, plan)
+ // // 濉厖琛ㄥ崟鏁版嵁
+ // Object.keys(planForm).forEach(key => {
+ // if (key === 'tags') {
+ // planForm[key] = plan[key].join(', ')
+ // } else {
+ // planForm[key] = plan[key]
+ // }
+ // })
}
const handleViewDetail = (plan) => {
- ElMessage.info(`鏌ョ湅璁″垝璇︽儏: ${plan.title}`)
+ currentPlanDetail.value = plan
+ showPlanDetailDialog.value = true
+ // ElMessage.info(`鏌ョ湅璁″垝璇︽儏: ${plan.title}`)
}
-const handleMoreAction = (command) => {
+const handleMoreAction = async(plan,command) => {
+ let ids = [];
+ ids.push(plan.id);
+ console.log("ids",ids)
switch (command) {
case 'share':
ElMessage.success('璁″垝宸插叡浜�')
break
case 'copy':
- ElMessage.success('璁″垝宸插鍒�')
+ const knowledgeText = `
+ 璁″垝鏍囬锛�${plan.title}
+ 璁″垝鎻忚堪锛�${plan.description}
+ 璁″垝绾у埆锛�${getCurrentLevelText(plan.level)}
+ 鏃堕棿鍛ㄦ湡锛�${getCurrentPeriodText(plan.period)}
+ 寮�濮嬫椂闂达細${plan.startDate}
+ 缁撴潫鏃堕棿锛�${plan.endDate}
+ 璐熻矗浜猴細${plan.assignee}
+ 浼樺厛绾э細${getPriorityText(plan.priority)}
+ 鏍囩锛�${plan.tags.join(', ')}
+ 鐘舵�侊細${getStatusText(plan.status)}
+ 杩涘害锛�${plan.progress}%
+ `.trim();
+
+ // 澶嶅埗鍒板壀璐存澘
+ navigator.clipboard.writeText(knowledgeText).then(() => {
+ ElMessage.success("鐭ヨ瘑鍐呭宸插鍒跺埌鍓创鏉�");
+ }).catch(() => {
+ ElMessage.error("澶嶅埗澶辫触锛岃鎵嬪姩澶嶅埗");
+ });
+ // ElMessage.success('璁″垝宸插鍒�')
break
case 'delete':
ElMessageBox.confirm('纭畾瑕佸垹闄よ繖涓鍒掑悧锛�', '鎻愮ず', {
@@ -439,17 +487,40 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- ElMessage.success('璁″垝宸插垹闄�')
+
+ delDutyPlan(ids).then(res => {
+ if (res.code === 200) {
+ ElMessage.success('璁″垝宸插垹闄�')
+ ids.value = [];
+ getPlanList()
+ }
+ })
})
break
}
}
-
+//
const handleSavePlan = async () => {
try {
await planFormRef.value.validate()
- ElMessage.success('璁″垝淇濆瓨鎴愬姛')
- planDialogVisible.value = false
+ if (operationType.value === 'add') {
+ addDutyPlan(planForm).then(res => {
+ if (res.code === 200) {
+ ElMessage.success('璁″垝淇濆瓨鎴愬姛')
+ planDialogVisible.value = false
+ }
+ getPlanList()
+ })
+ } else {
+
+ updateDutyPlan(planForm).then(res => {
+ if (res.code === 200) {
+ ElMessage.success('璁″垝淇濆瓨鎴愬姛')
+ planDialogVisible.value = false
+ }
+ getPlanList()
+ })
+ }
} catch (error) {
console.log('琛ㄥ崟楠岃瘉澶辫触:', error)
}
@@ -460,7 +531,8 @@
}
const handleRefresh = () => {
- ElMessage.success('鏁版嵁宸插埛鏂�')
+ getPlanList()
+ // ElMessage.success('鏁版嵁宸插埛鏂�')
}
const handleFilter = () => {
@@ -468,9 +540,21 @@
}
const handleExport = () => {
- ElMessage.success('璁″垝宸插鍑�')
-}
-
+ ElMessageBox.confirm("鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // exportDutyPlan().then(res => {
+
+ // })
+ proxy.download("/dutyPlan/export", {}, "璁″垝绠$悊.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+};
const handleShare = () => {
ElMessage.success('璁″垝宸插叡浜�')
}
@@ -527,8 +611,41 @@
if (progress >= 50) return '#E6A23C'
return '#F56C6C'
}
+//鑾峰彇鏁版嵁鍒楄〃
+const getPlanList = async () => {
+ const params = {
+ level: currentLevel.value,
+ period: currentPeriod.value,
+ queryDate:currentDate.value
+ }
+ listDutyPlan(params).then(res => {
+ if (res.code === 200) {
+ planList.value = res.data.records
+ }
+ }).catch(err => {
+ console.log(err)
+ })
+}
+//鑾峰彇鏁版嵁
+const getPlanNum = async () => {
+ NumDutyPlan().then(res => {
+ if (res.code === 200) {
+ // console.log(res.data)
+ //璁茬粨鏋滈噷闈㈢殑鏁版嵁鏍规嵁level 璧嬪�肩粰overviewData
+ res.data.forEach(item => {
+ overviewData[item.level].total = item.num
+ overviewData[item.level].completion = item.completion
+ })
+
+ }
+ }).catch(err => {
+ console.log(err)
+ })
+}
onMounted(() => {
+ getPlanList()
+ getPlanNum()
console.log('澶氱骇璁″垝妯℃澘椤甸潰宸插姞杞�')
})
</script>
diff --git a/src/views/collaborativeApproval/rpaManagement/index.vue b/src/views/collaborativeApproval/rpaManagement/index.vue
index 63b9bd0..e08104b 100644
--- a/src/views/collaborativeApproval/rpaManagement/index.vue
+++ b/src/views/collaborativeApproval/rpaManagement/index.vue
@@ -92,7 +92,7 @@
import { onMounted, ref, reactive, toRefs } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
-
+import {listRpa, addRpa, updateRpa, delRpa, delRpaBatch} from "@/api/collaborativeApproval/rpaManagement.js";
// 鍝嶅簲寮忔暟鎹�
const data = reactive({
searchForm: {
@@ -100,20 +100,17 @@
status: "",
},
form: {
- id: "",
programName: "",
- status: "stopped",
- description: "",
- createTime: "",
+ status: "",
+ description: ""
},
dialogVisible: false,
dialogTitle: "",
dialogType: "add",
- selectedIds: [],
tableLoading: false,
page: {
current: 1,
- size: 100,
+ size: 20,
total: 0,
},
tableData: [],
@@ -123,6 +120,8 @@
// 琛ㄥ崟寮曠敤
const formRef = ref();
+// 閫夋嫨鐨勮鏁版嵁
+const selectedRows = ref([]);
// 琛ㄥ崟楠岃瘉瑙勫垯
const rules = {
@@ -179,7 +178,7 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 230,
+ width: 150,
operation: [
{
name: "缂栬緫",
@@ -188,50 +187,26 @@
openForm("edit", row);
}
},
- {
- name: "寮�濮�",
- type: "text",
- clickFun: (row) => {
- handleStart(row);
- },
- disabled: (row) => row.status !== 'stopped'
- },
- {
- name: "鍋滄",
- type: "text",
- clickFun: (row) => {
- handleStop(row);
- },
- disabled: (row) => row.status === 'stopped'
- }
+ // {
+ // name: "寮�濮�",
+ // type: "text",
+ // clickFun: (row) => {
+ // handleStart(row);
+ // },
+ // disabled: (row) => row.status !== 'stopped'
+ // },
+ // {
+ // name: "鍋滄",
+ // type: "text",
+ // clickFun: (row) => {
+ // handleStop(row);
+ // },
+ // disabled: (row) => row.status === 'stopped'
+ // }
]
}
]);
-// 妯℃嫙鏁版嵁
-const mockData = [
- {
- id: "1",
- programName: "璁㈠崟澶勭悊RPA",
- status: "running",
- description: "鑷姩澶勭悊瀹㈡埛璁㈠崟锛屽寘鎷獙璇併�佸垎閰嶅拰纭",
- createTime: "2025-01-15 10:30:00"
- },
- {
- id: "2",
- programName: "搴撳瓨鍚屾RPA",
- status: "stopped",
- description: "鍚屾澶氫釜浠撳簱鐨勫簱瀛樻暟鎹紝纭繚鏁版嵁涓�鑷存��",
- createTime: "2025-01-14 15:20:00"
- },
- {
- id: "3",
- programName: "鎶ヨ〃鐢熸垚RPA",
- status: "error",
- description: "鑷姩鐢熸垚姣忔棩閿�鍞姤琛ㄥ拰搴撳瓨鎶ヨ〃",
- createTime: "2025-01-13 09:15:00"
- }
-];
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
@@ -240,32 +215,20 @@
// 鏌ヨ鏁版嵁
const handleQuery = () => {
- page.value.current = 1;
+ // page.value.current = 1;
getList();
};
const getList = () => {
tableLoading.value = true;
-
- // 妯℃嫙API璋冪敤寤惰繜
- setTimeout(() => {
- let filteredData = [...mockData];
-
- // 鏍规嵁鎼滅储鏉′欢杩囨护鏁版嵁
- if (searchForm.value.programName) {
- filteredData = filteredData.filter(item =>
- item.programName.toLowerCase().includes(searchForm.value.programName.toLowerCase())
- );
- }
-
- if (searchForm.value.status) {
- filteredData = filteredData.filter(item => item.status === searchForm.value.status);
- }
-
- tableData.value = filteredData;
- page.value.total = filteredData.length;
+ listRpa({...page.value, ...searchForm.value})
+ .then(res => {
tableLoading.value = false;
- }, 500);
+ tableData.value = res.data.records
+ page.total = res.data.total;
+ }).catch(err => {
+ tableLoading.value = false;
+ })
};
// 鍒嗛〉澶勭悊
@@ -277,23 +240,16 @@
// 閫夋嫨鍙樺寲澶勭悊
const handleSelectionChange = (selection) => {
- selectedIds.value = selection.map(item => item.id);
+ selectedRows.value = selection;
};
// 鎵撳紑琛ㄥ崟
const openForm = (type, row) => {
dialogType.value = type;
dialogVisible.value = true;
-
+
if (type === "add") {
dialogTitle.value = "娣诲姞RPA";
- form.value = {
- id: "",
- programName: "",
- status: "stopped",
- description: "",
- createTime: "",
- };
} else {
dialogTitle.value = "缂栬緫RPA";
form.value = { ...row };
@@ -303,33 +259,38 @@
// 鎻愪氦琛ㄥ崟
const submitForm = async () => {
if (!formRef.value) return;
-
+
try {
await formRef.value.validate();
-
+
if (dialogType.value === "add") {
// 娣诲姞鏂癛PA
- const newRPA = {
- id: Date.now().toString(),
- programName: form.value.programName,
- status: form.value.status,
- description: form.value.description,
- createTime: new Date().toLocaleString(),
- };
-
- mockData.unshift(newRPA);
- ElMessage.success("RPA娣诲姞鎴愬姛");
+ addRpa({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ form.value = {
+ programName: "",
+ status: "",
+ description: ""
+ },
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} else {
// 缂栬緫RPA
- const index = mockData.findIndex(item => item.id === form.value.id);
- if (index !== -1) {
- mockData[index] = { ...form.value };
- ElMessage.success("RPA鏇存柊鎴愬姛");
- }
+ updateRpa({...form.value}).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
}
-
- dialogVisible.value = false;
- getList();
} catch (error) {
console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
}
@@ -368,32 +329,30 @@
// 鍒犻櫎RPA
const handleDelete = () => {
let ids = [];
- if (selectedIds.value.length > 0) {
- ids = selectedIds.value.map((item) => item.id);
- } else {
- ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑RPA");
- return;
- }
-
- ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- // 浠庢ā鎷熸暟鎹腑鍒犻櫎閫変腑鐨勯」
- ids.forEach(id => {
- const index = mockData.findIndex(item => item.id === id);
- if (index !== -1) {
- mockData.splice(index, 1);
- }
- });
-
- ElMessage.success("鍒犻櫎鎴愬姛");
- selectedIds.value = [];
- getList();
- }).catch(() => {
- // 鐢ㄦ埛鍙栨秷
- });
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map((item) => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delRpa(ids).then((res) => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
};
</script>
diff --git a/src/views/collaborativeApproval/sealManagement/index.vue b/src/views/collaborativeApproval/sealManagement/index.vue
index 2d3e62f..4cf5a14 100644
--- a/src/views/collaborativeApproval/sealManagement/index.vue
+++ b/src/views/collaborativeApproval/sealManagement/index.vue
@@ -17,7 +17,7 @@
<div class="tab-content">
<el-row :gutter="20" class="mb-20">
<el-col :span="6">
- <el-input v-model="sealSearchForm.keyword" placeholder="璇疯緭鍏ョ敵璇锋爣棰樻垨鐢宠浜�" clearable />
+ <el-input v-model="sealSearchForm.title" placeholder="璇疯緭鍏ョ敵璇锋爣棰�" clearable />
</el-col>
<el-col :span="4">
<el-select v-model="sealSearchForm.status" placeholder="瀹℃壒鐘舵��" clearable>
@@ -32,13 +32,17 @@
</el-col>
</el-row>
- <el-table :data="sealApplications" style="width: 100%">
- <el-table-column prop="id" label="鐢宠缂栧彿" width="120" />
+ <el-table :data="sealApplications" border v-loading="tableLoading" style="width: 100%">
+ <el-table-column prop="applicationNum" label="鐢宠缂栧彿" width="120" />
<el-table-column prop="title" label="鐢宠鏍囬" min-width="200" />
- <el-table-column prop="applicant" label="鐢宠浜�" width="120" />
+ <el-table-column prop="createUserName" label="鐢宠浜�" width="120" />
<el-table-column prop="department" label="鎵�灞為儴闂�" width="150" />
- <el-table-column prop="sealType" label="鐢ㄥ嵃绫诲瀷" width="120" />
- <el-table-column prop="applyTime" label="鐢宠鏃堕棿" width="180" />
+ <el-table-column prop="sealType" label="鐢ㄥ嵃绫诲瀷" width="120">
+ <template #default="scope">
+ {{ getSealTypeText(scope.row.sealType) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="createTime" label="鐢宠鏃堕棿" width="180" />
<el-table-column prop="status" label="鐘舵��" width="100">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.status)">
@@ -76,7 +80,7 @@
<div class="tab-content">
<el-row :gutter="20" class="mb-20">
<el-col :span="6">
- <el-input v-model="regulationSearchForm.keyword" placeholder="璇疯緭鍏ュ埗搴︽爣棰樻垨鍙戝竷浜�" clearable />
+ <el-input v-model="regulationSearchForm.title" placeholder="璇疯緭鍏ュ埗搴︽爣棰�" clearable />
</el-col>
<el-col :span="4">
<el-select v-model="regulationSearchForm.category" placeholder="鍒跺害鍒嗙被" clearable>
@@ -89,14 +93,14 @@
<el-col :span="8">
<el-button type="primary" @click="searchRegulations">鎼滅储</el-button>
<el-button @click="resetRegulationSearch">閲嶇疆</el-button>
- <el-button type="success" @click="showRegulationDialog = true">
+ <el-button type="success" @click="handleAdd">
鍙戝竷鍒跺害
</el-button>
</el-col>
</el-row>
- <el-table :data="regulations" style="width: 100%">
- <el-table-column prop="id" label="鍒跺害缂栧彿" width="120" />
+ <el-table :data="regulations" border v-loading="tableLoading" style="width: 100%">
+ <el-table-column prop="regulationNum" label="鍒跺害缂栧彿" width="120" />
<el-table-column prop="title" label="鍒跺害鏍囬" min-width="200" />
<el-table-column prop="category" label="鍒嗙被" width="120">
<template #default="scope">
@@ -104,8 +108,8 @@
</template>
</el-table-column>
<el-table-column prop="version" label="鐗堟湰" width="80" />
- <el-table-column prop="publisher" label="鍙戝竷浜�" width="120" />
- <el-table-column prop="publishTime" label="鍙戝竷鏃堕棿" width="180" />
+ <el-table-column prop="createUserName" label="鍙戝竷浜�" width="120" />
+ <el-table-column prop="createTime" label="鍙戝竷鏃堕棿" width="180" />
<el-table-column prop="status" label="鐘舵��" width="100">
<template #default="scope">
<el-tag :type="scope.row.status === 'active' ? 'success' : 'info'">
@@ -117,12 +121,22 @@
<el-table-column label="鎿嶄綔" width="250" fixed="right">
<template #default="scope">
<el-button link @click="viewRegulation(scope.row)">鏌ョ湅</el-button>
- <el-button link type="primary" @click="editRegulation(scope.row)">缂栬緫</el-button>
+ <el-button link type="primary" @click="handleEdit(scope.row)">缂栬緫</el-button>
+ <el-button link type="danger" @click="repealEdit(scope.row)">搴熷純</el-button>
<el-button link type="success" @click="viewVersionHistory(scope.row)">鐗堟湰鍘嗗彶</el-button>
<el-button link type="warning" @click="viewReadStatus(scope.row)">闃呰鐘舵��</el-button>
</template>
</el-table-column>
</el-table>
+ <!-- 鍒嗛〉
+ <pagination
+ v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
+ /> -->
</div>
</el-tab-pane>
</el-tabs>
@@ -131,6 +145,9 @@
<!-- 鐢ㄥ嵃鐢宠瀵硅瘽妗� -->
<el-dialog v-model="showSealApplyDialog" title="鐢宠鐢ㄥ嵃" width="600px">
<el-form :model="sealForm" :rules="sealRules" ref="sealFormRef" label-width="100px">
+ <el-form-item label="鐢宠缂栧彿" prop="applicationNum">
+ <el-input v-model="sealForm.applicationNum" placeholder="璇疯緭鍏ョ敵璇风紪鍙�" />
+ </el-form-item>
<el-form-item label="鐢宠鏍囬" prop="title">
<el-input v-model="sealForm.title" placeholder="璇疯緭鍏ョ敵璇锋爣棰�" />
</el-form-item>
@@ -162,8 +179,11 @@
</el-dialog>
<!-- 瑙勭珷鍒跺害鍙戝竷瀵硅瘽妗� -->
- <el-dialog v-model="showRegulationDialog" title="鍙戝竷瑙勭珷鍒跺害" width="800px">
+ <el-dialog v-model="showRegulationDialog" :title="operationType === 'add' ? '鍙戝竷鍒跺害' : '缂栬緫鍒跺害'" width="800px">
<el-form :model="regulationForm" :rules="regulationRules" ref="regulationFormRef" label-width="100px">
+ <el-form-item label="鍒跺害缂栧彿" prop="regulationNum">
+ <el-input v-model="regulationForm.regulationNum" placeholder="璇疯緭鍏ュ埗搴︾紪鍙�" />
+ </el-form-item>
<el-form-item label="鍒跺害鏍囬" prop="title">
<el-input v-model="regulationForm.title" placeholder="璇疯緭鍏ュ埗搴︽爣棰�" />
</el-form-item>
@@ -178,8 +198,12 @@
<el-form-item label="鍒跺害鍐呭" prop="content">
<el-input v-model="regulationForm.content" type="textarea" :rows="10" placeholder="璇疯緭鍏ュ埗搴﹁缁嗗唴瀹�" />
</el-form-item>
+ <el-form-item label="鍒跺害鐗堟湰" prop="version">
+ <el-input v-model="regulationForm.version" placeholder="璇疯緭鍏ュ埗搴︾増鏈�" />
+ </el-form-item>
<el-form-item label="鐢熸晥鏃堕棿" prop="effectiveTime">
- <el-date-picker v-model="regulationForm.effectiveTime" type="datetime" placeholder="閫夋嫨鐢熸晥鏃堕棿" style="width: 100%" />
+ <el-date-picker v-model="regulationForm.effectiveTime" type="datetime" format="YYYY-MM-DD HH:mm:ss"
+ value-format="YYYY-MM-DD HH:mm:ss" placeholder="閫夋嫨鐢熸晥鏃堕棿" style="width: 100%" />
</el-form-item>
<el-form-item label="閫傜敤鑼冨洿" prop="scope">
<el-checkbox-group v-model="regulationForm.scope">
@@ -209,10 +233,10 @@
<el-descriptions :column="2" border>
<el-descriptions-item label="鐢宠缂栧彿">{{ currentSealDetail.id }}</el-descriptions-item>
<el-descriptions-item label="鐢宠鏍囬">{{ currentSealDetail.title }}</el-descriptions-item>
- <el-descriptions-item label="鐢宠浜�">{{ currentSealDetail.applicant }}</el-descriptions-item>
+ <el-descriptions-item label="鐢宠浜�">{{ currentSealDetail.createUserName }}</el-descriptions-item>
<el-descriptions-item label="鎵�灞為儴闂�">{{ currentSealDetail.department }}</el-descriptions-item>
- <el-descriptions-item label="鐢ㄥ嵃绫诲瀷">{{ currentSealDetail.sealType }}</el-descriptions-item>
- <el-descriptions-item label="鐢宠鏃堕棿">{{ currentSealDetail.applyTime }}</el-descriptions-item>
+ <el-descriptions-item label="鐢ㄥ嵃绫诲瀷">{{ getSealTypeText(currentSealDetail.sealType) }}</el-descriptions-item>
+ <el-descriptions-item label="鐢宠鏃堕棿">{{ currentSealDetail.createTime }}</el-descriptions-item>
<el-descriptions-item label="鐘舵��">
<el-tag :type="getStatusType(currentSealDetail.status)">
{{ getStatusText(currentSealDetail.status) }}
@@ -231,12 +255,16 @@
<el-descriptions-item label="鍒跺害鏍囬">{{ currentRegulationDetail.title }}</el-descriptions-item>
<el-descriptions-item label="鍒嗙被">{{ getCategoryText(currentRegulationDetail.category) }}</el-descriptions-item>
<el-descriptions-item label="鐗堟湰">{{ currentRegulationDetail.version }}</el-descriptions-item>
- <el-descriptions-item label="鍙戝竷浜�">{{ currentRegulationDetail.publisher }}</el-descriptions-item>
- <el-descriptions-item label="鍙戝竷鏃堕棿">{{ currentRegulationDetail.publishTime }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戝竷浜�">{{ currentRegulationDetail.createUserName }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戝竷鏃堕棿">{{ currentRegulationDetail.createTime }}</el-descriptions-item>
</el-descriptions>
<div class="mt-20">
<h4>鍒跺害鍐呭</h4>
<div class="regulation-content">{{ currentRegulationDetail.content }}</div>
+ </div>
+ <!-- 濡傛灉tableData>0 鏄剧ず -->
+ <div style="margin: 10px 0;" v-if="tableData && tableData.length > 0" >
+ <el-button type="success" @click="resetForm(currentRegulationDetail)">纭鏌ョ湅</el-button>
</div>
</div>
</el-dialog>
@@ -246,8 +274,14 @@
<el-table :data="versionHistory" style="width: 100%;margin-bottom: 10px">
<el-table-column prop="version" label="鐗堟湰鍙�" width="100" />
<el-table-column prop="updateTime" label="鏇存柊鏃堕棿" width="180" />
- <el-table-column prop="updater" label="鏇存柊浜�" width="120" />
- <el-table-column prop="changeLog" label="鍙樻洿璇存槑" />
+ <el-table-column prop="createUserName" label="鏇存柊浜�" width="120" />
+ <el-table-column prop="changeLog" label="鍙樻洿璇存槑">
+ <template #default="scope">
+ <el-tag :type="scope.row.status === 'active' ? 'success' : 'info'">
+ {{ scope.row.status === 'active' ? '鐢熸晥涓�' : '宸插簾姝�' }}
+ </el-tag>
+ </template>
+ </el-table-column>
</el-table>
</el-dialog>
@@ -256,7 +290,7 @@
<el-table :data="readStatusList" style="width: 100%;margin-bottom: 10px">
<el-table-column prop="employee" label="鍛樺伐濮撳悕" width="120" />
<el-table-column prop="department" label="鎵�灞為儴闂�" width="150" />
- <el-table-column prop="readTime" label="闃呰鏃堕棿" width="180" />
+ <el-table-column prop="createTime" label="闃呰鏃堕棿" width="180" />
<el-table-column prop="confirmTime" label="纭鏃堕棿" width="180" />
<el-table-column prop="status" label="鐘舵��" width="100">
<template #default="scope">
@@ -274,33 +308,48 @@
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'
+import { listSealApplication, addSealApplication, updateSealApplication,listRuleManagement,addRuleManagement,updateRuleManagement,delRuleManagement,getReadingStatusByRuleId,getReadingStatusList,addReadingStatus,updateReadingStatus } from '@/api/collaborativeApproval/sealManagement.js'
+import { el } from 'element-plus/es/locales.mjs'
+import { getUserProfile } from '@/api/system/user.js'
+import {staffJoinDel, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
// 鍝嶅簲寮忔暟鎹�
+const currentUser = ref(null)
const activeTab = ref('seal')
-
+const operationType = ref('add')
+const tableData = ref([])
// 鐢ㄥ嵃鐢宠鐩稿叧
const showSealApplyDialog = ref(false)
+const tableLoading = ref(false)
const showSealDetailDialog = ref(false)
const currentSealDetail = ref(null)
const sealFormRef = ref()
const sealForm = reactive({
+ applicationNum: '',
title: '',
sealType: '',
reason: '',
- urgency: 'normal'
+ urgency: 'normal',
+ status: 'pending'
})
const sealRules = {
+ applicationNum: [{ required: true, message: '璇疯緭鍏ョ敵璇风紪鍙�', trigger: 'blur' }],
title: [{ required: true, message: '璇疯緭鍏ョ敵璇锋爣棰�', trigger: 'blur' }],
sealType: [{ required: true, message: '璇烽�夋嫨鐢ㄥ嵃绫诲瀷', trigger: 'change' }],
reason: [{ required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�', trigger: 'blur' }]
}
const sealSearchForm = reactive({
- keyword: '',
+ title: '',
status: ''
})
-
+// 鍒嗛〉鍙傛暟
+const page = reactive({
+ current: 1,
+ size: 10,
+ total: 0
+})
// 瑙勭珷鍒跺害鐩稿叧
const showRegulationDialog = ref(false)
const showRegulationDetailDialog = ref(false)
@@ -309,12 +358,27 @@
const currentRegulationDetail = ref(null)
const regulationFormRef = ref()
const regulationForm = reactive({
+ id: '',
+ regulationNum: '',
title: '',
category: '',
content: '',
+ version: '',
+ status: 'active',
+ readCount: 0,
effectiveTime: '',
scope: [],
- requireConfirm: true
+ requireConfirm: false
+})
+
+const readStatus = ref({
+ id: '',
+ ruleId: '',
+ employee: '',
+ department: '',
+ createTime: '',
+ confirmTime: '',
+ status: 'unconfirmed'
})
const regulationRules = {
@@ -326,93 +390,23 @@
}
const regulationSearchForm = reactive({
- keyword: '',
+ title: '',
category: ''
})
// 鍋囨暟鎹�
-const sealApplications = ref([
- {
- id: 'SEAL001',
- title: '鍚堝悓鐢ㄥ嵃鐢宠',
- applicant: '闄堝織寮�',
- department: '閿�鍞儴',
- sealType: '鍚堝悓涓撶敤绔�',
- applyTime: '2025-01-15 10:30:00',
- status: 'pending',
- reason: '瀹㈡埛鍚堝悓闇�瑕佺洊绔�'
- },
- {
- id: 'SEAL002',
- title: '璐㈠姟鎶ュ憡鐢ㄥ嵃',
- applicant: '鐜嬪缓鍥�',
- department: '璐㈠姟閮�',
- sealType: '璐㈠姟涓撶敤绔�',
- applyTime: '2025-01-14 14:20:00',
- status: 'approved',
- reason: '瀛e害璐㈠姟鎶ュ憡闇�瑕佺洊绔�'
- },
- {
- id: 'SEAL003',
- title: '鍏徃绔犵▼鐢ㄥ嵃',
- applicant: '瀛欐槑鍗�',
- department: '娉曞姟閮�',
- sealType: '鍏珷',
- applyTime: '2025-01-13 09:15:00',
- status: 'rejected',
- reason: '鍏徃绔犵▼淇敼闇�瑕佺洊绔�'
- }
-])
+const sealApplications = ref([])
-const regulations = ref([
- {
- id: 'REG001',
- title: '鍛樺伐鑰冨嫟绠$悊鍒跺害',
- category: 'hr',
- version: 'v2.1',
- publisher: '浜轰簨閮�',
- publishTime: '2025-01-10 09:00:00',
- status: 'active',
- readCount: 45,
- content: '涓鸿鑼冨憳宸ヨ�冨嫟绠$悊锛屾彁楂樺伐浣滄晥鐜囷紝鐗瑰埗瀹氭湰鍒跺害...'
- },
- {
- id: 'REG002',
- title: '璐㈠姟鎶ラ攢鍒跺害',
- category: 'finance',
- version: 'v1.5',
- publisher: '璐㈠姟閮�',
- publishTime: '2025-01-08 14:30:00',
- status: 'active',
- readCount: 38,
- content: '涓鸿鑼冭储鍔℃姤閿�娴佺▼锛屽姞寮鸿储鍔$鐞嗭紝鐗瑰埗瀹氭湰鍒跺害...'
- },
- {
- id: 'REG003',
- title: '瀹夊叏鐢熶骇绠$悊鍒跺害',
- category: 'safety',
- version: 'v3.0',
- publisher: '瀹夊叏閮�',
- publishTime: '2025-01-05 16:00:00',
- status: 'active',
- readCount: 52,
- content: '涓虹‘淇濆憳宸ヤ汉韬畨鍏紝棰勯槻瀹夊叏浜嬫晠鍙戠敓锛岀壒鍒跺畾鏈埗搴�...'
- }
-])
+const regulations = ref([])
-const versionHistory = ref([
- { version: 'v2.1', updateTime: '2025-01-10 09:00:00', updater: '浜轰簨閮�', changeLog: '鏇存柊鑰冨嫟鏃堕棿瑙勫畾' },
- { version: 'v2.0', updateTime: '2023-12-15 10:30:00', updater: '浜轰簨閮�', changeLog: '鏂板鍔犵彮绠$悊瑙勫畾' },
- { version: 'v1.0', updateTime: '2023-11-01 14:00:00', updater: '浜轰簨閮�', changeLog: '棣栨鍙戝竷' }
-])
+const versionHistory = ref([])
-const readStatusList = ref([
- { employee: '闄堝織寮�', department: '閿�鍞儴', readTime: '2025-01-11 10:30:00', confirmTime: '2025-01-11 10:35:00', status: 'confirmed' },
- { employee: '鍒橀泤濠�', department: '鎶�鏈儴', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' },
- { employee: '鐜嬪缓鍥�', department: '璐㈠姟閮�', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' }
-])
+const readStatusList = ref([])
+ // { employee: '闄堝織寮�', department: '閿�鍞儴', readTime: '2025-01-11 10:30:00', confirmTime: '2025-01-11 10:35:00', status: 'confirmed' },
+ // { employee: '鍒橀泤濠�', department: '鎶�鏈儴', readTime: '2025-01-11 14:20:00', confirmTime: '', status: 'unconfirmed' },
+ // { employee: '鐜嬪缓鍥�', department: '璐㈠姟閮�', readTime: '2025-01-12 09:15:00', confirmTime: '2025-01-12 09:20:00', status: 'confirmed' }
-// 鏂规硶
+// 鐢ㄥ嵃鐢宠鐘舵��
const getStatusType = (status) => {
const statusMap = {
pending: 'warning',
@@ -421,7 +415,7 @@
}
return statusMap[status] || 'info'
}
-
+// 鍒跺害鐘舵��
const getStatusText = (status) => {
const statusMap = {
pending: '寰呭鎵�',
@@ -430,7 +424,17 @@
}
return statusMap[status] || '鏈煡'
}
-
+// 鐢ㄥ嵃绫诲瀷
+const getSealTypeText = (sealType) => {
+ const sealTypeMap = {
+ official: '鍏珷',
+ contract: '鍚堝悓涓撶敤绔�',
+ finance: '璐㈠姟涓撶敤绔�',
+ tegal: '鎶�鏈笓鐢ㄧ珷'
+ }
+ return sealTypeMap[sealType] || '鏈煡'
+}
+// 鍒跺害鍒嗙被
const getCategoryText = (category) => {
const categoryMap = {
hr: '浜轰簨鍒跺害',
@@ -440,77 +444,159 @@
}
return categoryMap[category] || '鏈煡'
}
-
+// 鎼滅储鍗扮珷鐢宠
const searchSealApplications = () => {
- ElMessage.success('鎼滅储瀹屾垚')
-}
+ page.current=1
+ getSealApplicationList()
+ // ElMessage.success('鎼滅储瀹屾垚')
+}
+// 閲嶇疆鍗扮珷鐢宠鎼滅储
const resetSealSearch = () => {
- sealSearchForm.keyword = ''
+ sealSearchForm.title = ''
sealSearchForm.status = ''
searchSealApplications()
}
-
+// 鎼滅储鍒跺害
const searchRegulations = () => {
- ElMessage.success('鎼滅储瀹屾垚')
+ page.current=1
+ getRegulationList()
}
-
+// 閲嶇疆鍒跺害鎼滅储
const resetRegulationSearch = () => {
- regulationSearchForm.keyword = ''
+ regulationSearchForm.title = ''
regulationSearchForm.category = ''
searchRegulations()
}
-
+// 鎻愪氦鐢ㄥ嵃鐢宠
const submitSealApplication = async () => {
try {
await sealFormRef.value.validate()
- ElMessage.success('鐢宠鎻愪氦鎴愬姛')
- showSealApplyDialog.value = false
- Object.assign(sealForm, {
- title: '',
- sealType: '',
- reason: '',
- urgency: 'normal'
+ addSealApplication(sealForm).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鐢宠鎻愪氦鎴愬姛')
+ showSealApplyDialog.value = false
+ getSealApplicationList()
+ Object.assign(sealForm, {
+ applicationNum: '',
+ title: '',
+ sealType: '',
+ reason: '',
+ urgency: 'normal',
+ status: 'pending'
+ })
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg)
})
+
} catch (error) {
ElMessage.error('璇峰畬鍠勭敵璇蜂俊鎭�')
}
}
+// 鏂板
+const handleAdd = () => {
+ operationType.value = 'add'
+ resetRegulationForm()
+ showRegulationDialog.value = true
+}
+// 缂栬緫
+const handleEdit = (row) => {
+ operationType.value = 'edit'
+ Object.assign(regulationForm, row)
+ showRegulationDialog.value = true
+}
+// 搴熷純
+const repealEdit = (row) => {
+ operationType.value = 'edit'
+ Object.assign(regulationForm, row)
+ regulationForm.status = 'repealed'
+ ElMessageBox.confirm('纭搴熷純璇ュ埗搴︼紵', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ updateRuleManagement(regulationForm).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害搴熷純鎴愬姛')
+ // showRegulationDialog.value = false
+ getRegulationList()
+ resetRegulationForm()
+ }
+ })
+ }).catch(() => {
+ ElMessage({
+ type: 'info',
+ message: '宸插彇娑堝簾寮�'
+ })
+ })
+}
+// 鍙戝竷鍒跺害
const submitRegulation = async () => {
try {
await regulationFormRef.value.validate()
- ElMessage.success('鍒跺害鍙戝竷鎴愬姛')
- showRegulationDialog.value = false
- Object.assign(regulationForm, {
- title: '',
- category: '',
- content: '',
- effectiveTime: '',
- scope: [],
- requireConfirm: true
- })
- } catch (error) {
- ElMessage.error('璇峰畬鍠勫埗搴︿俊鎭�')
+ if(operationType.value == 'add'){
+ addRuleManagement(regulationForm).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害鍙戝竷鎴愬姛')
+ showRegulationDialog.value = false
+ getRegulationList()
+ resetRegulationForm()
+ }
+ })
+ }else{
+ updateRuleManagement(regulationForm).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害缂栬緫鎴愬姛')
+ showRegulationDialog.value = false
+ resetRegulationForm()
+ getRegulationList()
+ }})}
+ }catch(err){
+ ElMessage.error(err.msg)
}
+}
+//閲嶇疆鍒跺害琛ㄥ崟
+const resetRegulationForm = () => {
+ Object.assign(regulationForm, {
+ id: '',
+ regulationNum: '',
+ title: '',
+ category: '',
+ content: '',
+ version: '',
+ status: 'active',
+ readCount: 0,
+ effectiveTime: '',
+ scope: [],
+ requireConfirm: false
+})
}
+
+// 鏌ョ湅鐢ㄥ嵃鐢宠璇︽儏
const viewSealDetail = (row) => {
currentSealDetail.value = row
showSealDetailDialog.value = true
}
-
+// 瀹℃壒鐢ㄥ嵃鐢宠
const approveSeal = (row) => {
+ console.log(row)
ElMessageBox.confirm('纭閫氳繃璇ョ敤鍗扮敵璇凤紵', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
row.status = 'approved'
- ElMessage.success('瀹℃壒閫氳繃')
+ updateSealApplication(row).then(res => {
+ if(res.code == 200){
+ ElMessage.success('瀹℃壒閫氳繃')
+ }
+ })
})
}
-
+// 鎷掔粷鐢ㄥ嵃鐢宠
const rejectSeal = (row) => {
ElMessageBox.prompt('璇疯緭鍏ユ嫆缁濆師鍥�', '鎻愮ず', {
confirmButtonText: '纭畾',
@@ -519,29 +605,165 @@
inputErrorMessage: '鎷掔粷鍘熷洜涓嶈兘涓虹┖'
}).then(({ value }) => {
row.status = 'rejected'
+ updateSealApplication(row).then(res => {
+ if(res.code == 200){
+ ElMessage.success('瀹℃壒鎷掔粷')
+ }
+ })
ElMessage.success('宸叉嫆缁濈敵璇�')
})
}
+// 鑾峰彇鍦ㄨ亴鍛樺伐鍒楄〃
+const getList = () => {
+ tableLoading.value = true;
+ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛淇℃伅
+ getUserProfile().then(res => {
+ if(res.code == 200){
+ console.log(res.data.userName)
+ currentUser.value = res.data.userName
+ }
+ })
+ staffJoinListPage({staffState: 1}).then(res => {
+ tableLoading.value = false;
+ // tableData.value = res.data.records
+ // //绛涢�夊嚭鍜宑urrentUser鍚屽悕鐨勪汉鍛�
+ tableData.value = res.data.records.filter(item => item.staffName === currentUser.value)
+ console.log("tableData",tableData.value)
+ page.total = res.data.total;
+
+ if(tableData.value.length == 0){
+ ElMessage.error('褰撳墠鐢ㄦ埛鏈姞鍏ヤ换浣曢儴闂�')
+ }
+ }).catch(err => {
+ tableLoading.value = false;
+ })
-const viewRegulation = (row) => {
- currentRegulationDetail.value = row
- showRegulationDetailDialog.value = true
-}
-const editRegulation = (row) => {
- ElMessage.info('缂栬緫鍔熻兘寮�鍙戜腑...')
-}
+};
+// 鏌ョ湅鍒跺害鐗堟湰鍘嗗彶
const viewVersionHistory = (row) => {
showVersionHistoryDialog.value = true
-}
+ const params = {
+ category: row.category
+ }
+ listRuleManagement(page,params).then(res => {
+ if(res.code == 200){
+ versionHistory.value = res.data.records
+ }
+ })
+}
+// 鏌ョ湅鍒跺害璇︽儏
+const viewRegulation = (row) => {
+ getList()
+ currentRegulationDetail.value = row
+ showRegulationDetailDialog.value = true
+ getReadingStatusByRuleId(row.id).then(res => {
+ if(res.code == 200){
+ readStatusList.value = res.data
+ if(readStatusList.value.length==0 && tableData.value.length>0){
+ const params = {
+ ruleId: row.id,
+ employee: tableData.value[0].staffName,
+ department: tableData.value[0].postJob,
+ status: 'unconfirmed'
+ }
+ addReadingStatus(params).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害闃呰鎴愬姛')
+ }
+ })
+ }
+ }
+ })
+
+}
+// 鏌ョ湅鍒跺害闃呰鐘舵��
const viewReadStatus = (row) => {
showReadStatusDialog.value = true
+ //鏌ョ湅闃呰鐘舵�佸垪琛�
+ getReadingStatusByRuleId(row.id).then(res => {
+ if(res.code == 200){
+ readStatusList.value = res.data
+ }
+ })
+}
+
+//纭鏌ョ湅
+const resetForm = (row) => {
+ console.log("row",row)
+ row.readCount = row.readCount + 1
+
+ updateRuleManagement(row).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鏌ョ湅鏁伴噺淇敼鎴愬姛')
+ //淇敼闃呰鐘舵��
+ //鏍规嵁鍒跺害id鍜屽綋鍓嶇櫥褰曠殑鍛樺伐寰楀埌闃呰鐘舵��
+ // let item = readStatusList.value.filter(item => item.employee == tableData.value[0].staffName )
+ // if(item.length>0){
+ // item[0].status = 'confirmed',
+ // item[0].confirmTime = new Date().toISOString().replace('T', ' ').split('.')[0];
+ // }
+ // 绛涢�夊綋鍓嶅憳宸ュ搴旇鍒跺害鐨勯槄璇荤姸鎬佽褰�
+ let statusItem = readStatusList.value.find(item => item.employee === tableData.value[0].staffName && item.ruleId === row.id);
+
+ if (statusItem) {
+ // 濡傛灉鎵惧埌璁板綍锛屾洿鏂扮姸鎬佸拰纭鏃堕棿
+ statusItem.status = 'confirmed';
+ // 鏍煎紡鍖栨椂闂翠负"YYYY-MM-DD HH:mm:ss"鏍煎紡
+ const now = new Date();
+ statusItem.confirmTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
+ // statusItem.confirmTime = new Date().toISOString().replace('T', ' ').split('.')[0];
+
+ updateReadingStatus(statusItem).then(res => {
+ if(res.code == 200){
+ ElMessage.success('鍒跺害闃呰鐘舵�佷慨鏀规垚鍔�')
+ }
+ })
+ }
+
+ }
+ })
+}
+
+
+
+// 鑾峰彇鍗扮珷鐢宠鍒楄〃鏁版嵁
+const getSealApplicationList = async () => {
+ tableLoading.value = true
+ listSealApplication(page,sealSearchForm)
+ .then(res => {
+
+ sealApplications.value = res.data.records
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+
+ }).catch(err => {
+ tableLoading.value = false;
+ })
+}
+// 鑾峰彇瑙勭珷鍒跺害鍒楄〃鏁版嵁
+const getRegulationList = async () => {
+ tableLoading.value = true
+ listRuleManagement(page,regulationSearchForm)
+ .then(res => {
+
+ regulations.value = res.data.records
+ // 杩囨护鎺夊凡搴熷純鐨勫埗搴�
+ // regulations.value = res.data.records.filter(item => item.status !== 'repealed')
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+
+ }).catch(err => {
+ tableLoading.value = false;
+ })
}
onMounted(() => {
// 鍒濆鍖�
+ getSealApplicationList()
+ getRegulationList()
})
</script>
@@ -578,6 +800,7 @@
border-radius: 4px;
line-height: 1.6;
white-space: pre-wrap;
+ height: 200px;
}
.dialog-footer {
diff --git a/src/views/inventoryManagement/stockWarning/index.vue b/src/views/inventoryManagement/stockWarning/index.vue
index bd0ccaf..89d396e 100644
--- a/src/views/inventoryManagement/stockWarning/index.vue
+++ b/src/views/inventoryManagement/stockWarning/index.vue
@@ -41,27 +41,27 @@
<!-- 鎿嶄綔鎸夐挳 -->
<div class="table-operations">
<el-button type="primary" @click="handleAdd">鏂板棰勮瑙勫垯</el-button>
- <el-button type="success" @click="handleBatchProcess">鎵归噺澶勭悊</el-button>
+ <!-- <el-button type="success" @click="handleBatchProcess">鎵归噺澶勭悊@</el-button> -->
<el-button @click="handleExport">瀵煎嚭</el-button>
</div>
- <el-table
- :data="tableData"
- border
- v-loading="tableLoading"
+ <el-table
+ :data="tableData"
+ border
+ v-loading="tableLoading"
@selection-change="handleSelectionChange"
style="width: 100%"
height="calc(100vh - 280px)"
>
<el-table-column align="center" type="selection" width="55" />
<el-table-column align="center" label="搴忓彿" type="index" width="60" />
-
+
<!-- 鍩虹淇℃伅瀛楁 -->
<el-table-column label="鍌ㄦ皵缃愮紪鐮�" prop="tankCode" width="120" show-overflow-tooltip />
<el-table-column label="鍌ㄦ皵缃愬悕绉�" prop="tankName" width="200" show-overflow-tooltip />
<el-table-column label="鍌ㄦ皵缃愮被鍨�" prop="tankType" width="120" show-overflow-tooltip />
<el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="150" show-overflow-tooltip />
<el-table-column label="瀹圭Н(m鲁)" prop="volume" width="100" show-overflow-tooltip />
-
+
<!-- 搴撳瓨鐩稿叧瀛楁 -->
<el-table-column label="褰撳墠姘斾綋閲�" prop="currentGasLevel" width="120" show-overflow-tooltip>
<template #default="scope">
@@ -72,7 +72,7 @@
<el-table-column label="鏈�浣庢皵浣撻噺" prop="minGasLevel" width="120" show-overflow-tooltip />
<el-table-column label="鏈�楂樻皵浣撻噺" prop="maxGasLevel" width="120" show-overflow-tooltip />
<el-table-column label="褰撳墠鍘嬪姏(MPa)" prop="currentPressure" width="140" show-overflow-tooltip />
-
+
<!-- 棰勮瑙勫垯瀛楁 -->
<el-table-column label="棰勮绫诲瀷" prop="warningType" width="100" show-overflow-tooltip>
<template #default="scope">
@@ -94,7 +94,7 @@
<el-switch v-model="scope.row.isEnabled" @change="handleEnableChange(scope.row)" />
</template>
</el-table-column>
-
+
<!-- 鏃堕棿鐩稿叧瀛楁 -->
<el-table-column label="棰勮鏃堕棿" prop="warningTime" width="150" show-overflow-tooltip />
<el-table-column label="棰勮鎸佺画澶╂暟" prop="warningDuration" width="120" show-overflow-tooltip />
@@ -115,32 +115,32 @@
<span v-else>-</span>
</template>
</el-table-column>
-
+
<!-- 鎿嶄綔鍒� -->
<el-table-column fixed="right" label="鎿嶄綔" width="200" align="center">
<template #default="scope">
<el-button link type="primary" size="small" @click="handleEdit(scope.row)">缂栬緫</el-button>
- <el-button link type="success" size="small" @click="handleProcess(scope.row)">澶勭悊</el-button>
+ <el-button link type="success" size="small" @click="handleProcess(scope.row)">澶勭悊@</el-button>
<el-button link type="danger" size="small" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
-
+
<!-- 鍒嗛〉 -->
- <pagination
- v-show="total > 0"
- :total="total"
+ <pagination
+ v-show="total > 0"
+ :total="total"
layout="total, sizes, prev, pager, next, jumper"
- :page="page.current"
- :limit="page.size"
- @pagination="paginationChange"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange"
/>
</div>
<!-- 鏂板/缂栬緫棰勮瑙勫垯寮圭獥 -->
- <el-dialog
- v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板棰勮瑙勫垯' : '缂栬緫棰勮瑙勫垯'"
+ <el-dialog
+ v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板棰勮瑙勫垯' : '缂栬緫棰勮瑙勫垯'"
width="50%"
@close="closeDialog"
>
@@ -158,7 +158,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="鍌ㄦ皵缃愮被鍨嬶細" prop="tankType">
@@ -176,7 +176,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="瀹圭Н(m鲁)锛�" prop="volume">
@@ -189,7 +189,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<!-- 搴撳瓨鐩稿叧 -->
<el-row :gutter="20">
<el-col :span="12">
@@ -203,7 +203,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="鏈�楂樻皵浣撻噺(%)锛�" prop="maxGasLevel">
@@ -216,7 +216,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<!-- 棰勮瑙勫垯 -->
<el-row :gutter="20">
<el-col :span="12">
@@ -239,7 +239,7 @@
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="棰勮闃堝�硷細" prop="warningThreshold">
@@ -252,15 +252,15 @@
</el-form-item>
</el-col>
</el-row>
-
+
<!-- 鏃堕棿鐩稿叧 -->
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="棰勮鏃堕棿锛�" prop="warningTime">
- <el-date-picker
- v-model="form.warningTime"
- type="datetime"
- placeholder="璇烽�夋嫨棰勮鏃堕棿"
+ <el-date-picker
+ v-model="form.warningTime"
+ type="datetime"
+ placeholder="璇烽�夋嫨棰勮鏃堕棿"
style="width: 100%"
value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -268,24 +268,24 @@
</el-col>
<el-col :span="12">
<el-form-item label="棰勮鍏呰鏃堕棿锛�" prop="expectedRefillTime">
- <el-date-picker
- v-model="form.expectedRefillTime"
- type="datetime"
- placeholder="璇烽�夋嫨棰勮鍏呰鏃堕棿"
+ <el-date-picker
+ v-model="form.expectedRefillTime"
+ type="datetime"
+ placeholder="璇烽�夋嫨棰勮鍏呰鏃堕棿"
style="width: 100%"
value-format="YYYY-MM-DD HH:mm:ss"
/>
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="棰勮缂烘皵鏃堕棿锛�" prop="expectedShortageTime">
- <el-date-picker
- v-model="form.expectedShortageTime"
- type="datetime"
- placeholder="璇烽�夋嫨棰勮缂烘皵鏃堕棿"
+ <el-date-picker
+ v-model="form.expectedShortageTime"
+ type="datetime"
+ placeholder="璇烽�夋嫨棰勮缂烘皵鏃堕棿"
style="width: 100%"
value-format="YYYY-MM-DD HH:mm:ss"
/>
@@ -293,17 +293,17 @@
</el-col>
<el-col :span="12">
<el-form-item label="棰勮瑙勫垯鎻忚堪锛�" prop="warningRule">
- <el-input
- v-model="form.warningRule"
- type="textarea"
- :rows="3"
+ <el-input
+ v-model="form.warningRule"
+ type="textarea"
+ :rows="3"
placeholder="璇疯緭鍏ラ璀﹁鍒欐弿杩�"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
-
+
<template #footer>
<div class="dialog-footer">
<el-button @click="closeDialog">鍙栨秷</el-button>
@@ -382,15 +382,15 @@
import { WarningFilled } from '@element-plus/icons-vue'
import pagination from '@/components/PIMTable/Pagination.vue'
// 娉ㄩ噴鎺堿PI瀵煎叆锛屼娇鐢ㄥ亣鏁版嵁
-// import {
-// getStockWarningPage,
-// addStockWarning,
-// updateStockWarning,
-// deleteStockWarning,
-// batchProcessStockWarning,
-// exportStockWarning,
-// toggleStockWarningStatus
-// } from '@/api/inventoryManagement/stockWarning.js'
+import {
+ getStockWarningPage,
+ addStockWarning,
+ updateStockWarning,
+ deleteStockWarning,
+ batchProcessStockWarning,
+ exportStockWarning,
+ toggleStockWarningStatus
+} from '@/api/inventoryManagement/stockWarning.js'
const { proxy } = getCurrentInstance()
@@ -410,7 +410,8 @@
// 鍒嗛〉鍙傛暟
const page = reactive({
current: 1,
- size: 10
+ size: 10,
+ total: 0
})
// 鎼滅储琛ㄥ崟
@@ -459,19 +460,19 @@
// 鑾峰彇鍊掕鏃朵俊鎭�
const getCountdown = (expectedTime) => {
if (!expectedTime) return { text: '-', isExpired: false }
-
+
const now = new Date().getTime()
const expected = new Date(expectedTime).getTime()
const diff = expected - now
-
+
if (diff <= 0) {
return { text: '宸茬己姘�', isExpired: true }
}
-
+
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60))
-
+
if (days > 0) {
return { text: `${days}澶�${hours}灏忔椂`, isExpired: false }
} else if (hours > 0) {
@@ -484,11 +485,11 @@
// 鑾峰彇鍊掕鏃舵牱寮忕被
const getCountdownClass = (expectedTime) => {
if (!expectedTime) return ''
-
+
const now = new Date().getTime()
const expected = new Date(expectedTime).getTime()
const diff = expected - now
-
+
if (diff <= 0) {
return 'countdown-expired'
} else if (diff <= 24 * 60 * 60 * 1000) { // 24灏忔椂鍐�
@@ -518,7 +519,7 @@
const showShortageWarning = (tank) => {
currentWarningTank.value = tank
shortageWarningVisible.value = true
-
+
// 鎾斁鎻愮ず闊筹紙鍙�夛級
// const audio = new Audio('/path/to/warning-sound.mp3')
// audio.play()
@@ -537,236 +538,20 @@
// 杩欓噷鍙互璋冪敤澶勭悊API
}
-
-
-// 鐢熸垚鍋囨暟鎹�
-const generateMockData = () => {
- const mockData = [
- {
- id: 1,
- tankCode: 'TANK001',
- tankName: '娑插寲姘斿偍缃怉',
- tankType: '娑插寲姘斿偍缃�',
- specificationModel: 'LPG-5000L',
- volume: 5000,
- currentGasLevel: 15,
- safetyGasLevel: 30,
- minGasLevel: 10,
- maxGasLevel: 95,
- currentPressure: 2.5,
- warningType: '姘斾綋涓嶈冻',
- warningLevel: '绱ф��',
- warningThreshold: 20,
- isEnabled: true,
- warningTime: '2025-01-15 08:30:00',
- warningDuration: 3,
- lastUpdateTime: '2025-01-15 10:00:00',
- expectedRefillTime: '2025-01-16 14:00:00',
- expectedShortageTime: '2025-01-15 18:30:00', // 浠婂ぉ涓嬪崍6:30缂烘皵
- warningRule: '褰撴皵浣撻噺浣庝簬20%鏃惰Е鍙戦璀�'
- },
- {
- id: 2,
- tankCode: 'TANK002',
- tankName: '鍘嬬缉姘斿偍缃怋',
- tankType: '鍘嬬缉姘斿偍缃�',
- specificationModel: 'COMP-3000L',
- volume: 3000,
- currentGasLevel: 45,
- safetyGasLevel: 25,
- minGasLevel: 15,
- maxGasLevel: 90,
- currentPressure: 8.2,
- warningType: '鍘嬪姏寮傚父',
- warningLevel: '閲嶈',
- warningThreshold: 10,
- isEnabled: true,
- warningTime: '2025-01-14 16:20:00',
- warningDuration: 2,
- lastUpdateTime: '2025-01-15 09:15:00',
- expectedRefillTime: '2025-01-17 09:00:00',
- expectedShortageTime: '2025-01-18 12:00:00', // 3澶╁悗缂烘皵
- warningRule: '褰撳帇鍔涜秴杩�8MPa鏃惰Е鍙戦璀�'
- },
- {
- id: 3,
- tankCode: 'TANK003',
- tankName: '澶╃劧姘斿偍缃怌',
- tankType: '澶╃劧姘斿偍缃�',
- specificationModel: 'NG-8000L',
- volume: 8000,
- currentGasLevel: 75,
- safetyGasLevel: 20,
- minGasLevel: 10,
- maxGasLevel: 95,
- currentPressure: 4.8,
- warningType: '娓╁害寮傚父',
- warningLevel: '涓�鑸�',
- warningThreshold: 5,
- isEnabled: true,
- warningTime: '2025-01-13 11:45:00',
- warningDuration: 1,
- lastUpdateTime: '2025-01-15 08:45:00',
- expectedRefillTime: '2025-01-20 10:00:00',
- expectedShortageTime: '2025-01-22 15:30:00', // 7澶╁悗缂烘皵
- warningRule: '褰撴俯搴﹁秴杩�60掳C鏃惰Е鍙戦璀�'
- },
- {
- id: 4,
- tankCode: 'TANK004',
- tankName: '姘ф皵鍌ㄧ綈D',
- tankType: '姘ф皵鍌ㄧ綈',
- specificationModel: 'O2-2000L',
- volume: 2000,
- currentGasLevel: 8,
- safetyGasLevel: 25,
- minGasLevel: 5,
- maxGasLevel: 90,
- currentPressure: 6.5,
- warningType: '娉勬紡棰勮',
- warningLevel: '绱ф��',
- warningThreshold: 15,
- isEnabled: true,
- warningTime: '2025-01-15 07:15:00',
- warningDuration: 4,
- lastUpdateTime: '2025-01-15 11:30:00',
- expectedRefillTime: '2025-01-15 16:00:00',
- expectedShortageTime: '2025-01-15 14:00:00', // 浠婂ぉ涓嬪崍2鐐圭己姘�
- warningRule: '褰撴娴嬪埌姘斾綋娉勬紡鏃惰Е鍙戦璀�'
- },
- {
- id: 5,
- tankCode: 'TANK005',
- tankName: '娑插寲姘斿偍缃怑',
- tankType: '娑插寲姘斿偍缃�',
- specificationModel: 'LPG-6000L',
- volume: 6000,
- currentGasLevel: 35,
- safetyGasLevel: 30,
- minGasLevel: 15,
- maxGasLevel: 95,
- currentPressure: 3.2,
- warningType: '姘斾綋涓嶈冻',
- warningLevel: '閲嶈',
- warningThreshold: 20,
- isEnabled: false,
- warningTime: '2025-01-14 14:30:00',
- warningDuration: 2,
- lastUpdateTime: '2025-01-15 09:00:00',
- expectedRefillTime: '2025-01-19 08:00:00',
- expectedShortageTime: '2025-01-21 10:00:00', // 6澶╁悗缂烘皵
- warningRule: '褰撴皵浣撻噺浣庝簬20%鏃惰Е鍙戦璀�'
- },
- {
- id: 6,
- tankCode: 'TANK006',
- tankName: '鍘嬬缉姘斿偍缃怓',
- tankType: '鍘嬬缉姘斿偍缃�',
- specificationModel: 'COMP-4000L',
- volume: 4000,
- currentGasLevel: 85,
- safetyGasLevel: 20,
- minGasLevel: 10,
- maxGasLevel: 90,
- currentPressure: 7.8,
- warningType: '鍘嬪姏寮傚父',
- warningLevel: '涓�鑸�',
- warningThreshold: 8,
- isEnabled: true,
- warningTime: '2025-01-12 09:20:00',
- warningDuration: 1,
- lastUpdateTime: '2025-01-15 08:30:00',
- expectedRefillTime: '2025-01-25 14:00:00',
- expectedShortageTime: '2025-01-28 16:00:00', // 13澶╁悗缂烘皵
- warningRule: '褰撳帇鍔涜秴杩�8MPa鏃惰Е鍙戦璀�'
- },
- {
- id: 7,
- tankCode: 'TANK007',
- tankName: '澶╃劧姘斿偍缃怗',
- tankType: '澶╃劧姘斿偍缃�',
- specificationModel: 'NG-10000L',
- volume: 10000,
- currentGasLevel: 92,
- safetyGasLevel: 15,
- minGasLevel: 8,
- maxGasLevel: 95,
- currentPressure: 5.2,
- warningType: '娓╁害寮傚父',
- warningLevel: '閲嶈',
- warningThreshold: 6,
- isEnabled: true,
- warningTime: '2025-01-11 16:45:00',
- warningDuration: 1,
- lastUpdateTime: '2025-01-15 07:45:00',
- expectedRefillTime: '2025-01-30 09:00:00',
- expectedShortageTime: '2025-02-05 12:00:00', // 21澶╁悗缂烘皵
- warningRule: '褰撴俯搴﹁秴杩�60掳C鏃惰Е鍙戦璀�'
- },
- {
- id: 8,
- tankCode: 'TANK008',
- tankName: '姘ф皵鍌ㄧ綈H',
- tankType: '姘ф皵鍌ㄧ綈',
- specificationModel: 'O2-1500L',
- volume: 1500,
- currentGasLevel: 12,
- safetyGasLevel: 30,
- minGasLevel: 8,
- maxGasLevel: 90,
- currentPressure: 4.5,
- warningType: '娉勬紡棰勮',
- warningLevel: '绱ф��',
- warningThreshold: 12,
- isEnabled: true,
- warningTime: '2025-01-15 06:30:00',
- warningDuration: 5,
- lastUpdateTime: '2025-01-15 12:15:00',
- expectedRefillTime: '2025-01-15 20:00:00',
- expectedShortageTime: '2025-01-15 17:30:00', // 浠婂ぉ涓嬪崍5:30缂烘皵
- warningRule: '褰撴娴嬪埌姘斾綋娉勬紡鏃惰Е鍙戦璀�'
- }
- ]
-
- // 鏍规嵁鎼滅储鏉′欢杩囨护鏁版嵁
- let filteredData = mockData.filter(item => {
- if (searchForm.tankName && !item.tankName.includes(searchForm.tankName)) return false
- if (searchForm.tankType && item.tankType !== searchForm.tankType) return false
- if (searchForm.warningType && item.warningType !== searchForm.warningType) return false
- if (searchForm.warningLevel && item.warningLevel !== searchForm.warningLevel) return false
- return true
- })
-
- // 鍒嗛〉澶勭悊
- const start = (page.current - 1) * page.size
- const end = start + page.size
- const paginatedData = filteredData.slice(start, end)
-
- return {
- records: paginatedData,
- total: filteredData.length
- }
-}
-
// 鑾峰彇鍒楄〃鏁版嵁
const getList = async () => {
tableLoading.value = true
- try {
- // 妯℃嫙缃戠粶寤惰繜
- await new Promise(resolve => setTimeout(resolve, 500))
-
- const result = generateMockData()
- tableData.value = result.records
- total.value = result.total
-
- // 妫�鏌ョ己姘旈璀�
+ getStockWarningPage(page, searchForm)
+ .then(res => {
+
+ tableData.value = res.data.records
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+ // 妫�鏌ョ己姘旈璀�
checkShortageWarnings()
- } catch (error) {
- console.error('鑾峰彇鍒楄〃澶辫触:', error)
- ElMessage.error('鑾峰彇鍒楄〃澶辫触')
- } finally {
- tableLoading.value = false
- }
+ }).catch(err => {
+ tableLoading.value = false;
+ })
}
// 鎼滅储
@@ -798,7 +583,7 @@
// 鏂板
const handleAdd = () => {
operationType.value = 'add'
- resetForm()
+ // resetForm()
dialogFormVisible.value = true
}
@@ -815,7 +600,7 @@
// 妯℃嫙API璋冪敤寤惰繜
await new Promise(resolve => setTimeout(resolve, 300))
ElMessage.success(`姝e湪澶勭悊棰勮锛�${row.tankName}`)
- getList()
+ // getList()
} catch (error) {
ElMessage.error('澶勭悊棰勮澶辫触')
}
@@ -829,11 +614,21 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
})
-
- // 妯℃嫙API璋冪敤寤惰繜
- await new Promise(resolve => setTimeout(resolve, 300))
- ElMessage.success('鍒犻櫎鎴愬姛')
- getList()
+ let ids = [];
+ ids.push(row.id);
+ deleteStockWarning(ids).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ ids.value = [];
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // // 妯℃嫙API璋冪敤寤惰繜
+ // await new Promise(resolve => setTimeout(resolve, 300))
+ // ElMessage.success('鍒犻櫎鎴愬姛')
+ // getList()
} catch (error) {
if (error !== 'cancel') {
ElMessage.error('鍒犻櫎澶辫触')
@@ -847,7 +642,7 @@
ElMessage.warning('璇烽�夋嫨瑕佸鐞嗙殑棰勮')
return
}
-
+
try {
// 妯℃嫙API璋冪敤寤惰繜
await new Promise(resolve => setTimeout(resolve, 500))
@@ -860,75 +655,65 @@
// 瀵煎嚭
const handleExport = async () => {
- try {
- // 妯℃嫙API璋冪敤寤惰繜
- await new Promise(resolve => setTimeout(resolve, 800))
-
- // 鐢熸垚瀵煎嚭鏁版嵁
- const exportData = generateMockData().records
- const csvContent = generateCSV(exportData)
-
- // 鍒涘缓涓嬭浇閾炬帴
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })
- const url = window.URL.createObjectURL(blob)
- const link = document.createElement('a')
- link.href = url
- link.download = `鍌ㄦ皵缃愰璀︽暟鎹甠${new Date().getTime()}.csv`
- link.click()
- window.URL.revokeObjectURL(url)
-
- ElMessage.success('瀵煎嚭鎴愬姛')
- } catch (error) {
- ElMessage.error('瀵煎嚭澶辫触')
- }
+ // if (selectedRows.value.length === 0) {
+ // exportStockWarning().then(res => {
+ // // // 鍒涘缓涓嬭浇閾炬帴
+ // // const blob = new Blob([res.data], { type: 'text/csv;charset=utf-8;' })
+ // // const url = window.URL.createObjectURL(blob)
+ // // const link = document.createElement('a')
+ // // link.href = url
+ // // link.download = `鍌ㄦ皵缃愰璀︽暟鎹甠${new Date().getTime()}.csv`
+ // // link.click()
+ // // window.URL.revokeObjectURL(url)
+ // }).catch(err => {
+ // ElMessage.error(err.msg);
+ // })
+ // }else{
+ // let ids = [];
+ // selectedRows.value.forEach(item => {
+ // ids.push(item.id);
+ // })
+ // exportStockWarning(ids).then(res => {
+ // // // 鍒涘缓涓嬭浇閾炬帴
+ // // const blob = new Blob([res.data], { type: 'text/csv;charset=utf-8;' })
+ // // const url = window.URL.createObjectURL(blob)
+ // // const link = document.createElement('a')
+ // // link.href = url
+ // // link.download = `鍌ㄦ皵缃愰璀︽暟鎹甠${new Date().getTime()}.csv`
+ // // link.click()
+ // // window.URL.revokeObjectURL(url)
+ // }).catch(err => {
+ // ElMessage.error(err.msg);
+ // })
+ // }
+
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ proxy.download("/gasTankWarning/export", {ids: selectedRows.value.map(item => item.id)}, "鍌ㄦ皵缃愰璀�.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
}
-// 鐢熸垚CSV鍐呭
-const generateCSV = (data) => {
- const headers = [
- '鍌ㄦ皵缃愮紪鐮�', '鍌ㄦ皵缃愬悕绉�', '鍌ㄦ皵缃愮被鍨�', '瑙勬牸鍨嬪彿', '瀹圭Н(m鲁)',
- '褰撳墠姘斾綋閲�(%)', '瀹夊叏姘斾綋閲�(%)', '鏈�浣庢皵浣撻噺(%)', '鏈�楂樻皵浣撻噺(%)',
- '褰撳墠鍘嬪姏(MPa)', '棰勮绫诲瀷', '棰勮绾у埆', '棰勮闃堝��', '鏄惁鍚敤',
- '棰勮鏃堕棿', '棰勮鎸佺画澶╂暟', '鏈�鍚庢洿鏂版椂闂�', '棰勮鍏呰鏃堕棿', '棰勮缂烘皵鏃堕棿', '棰勮瑙勫垯鎻忚堪'
- ]
-
- const csvRows = [headers.join(',')]
-
- data.forEach(item => {
- const row = [
- item.tankCode,
- item.tankName,
- item.tankType,
- item.specificationModel,
- item.volume,
- item.currentGasLevel,
- item.safetyGasLevel,
- item.minGasLevel,
- item.maxGasLevel,
- item.currentPressure,
- item.warningType,
- item.warningLevel,
- item.warningThreshold,
- item.isEnabled ? '鏄�' : '鍚�',
- item.warningTime,
- item.warningDuration,
- item.lastUpdateTime,
- item.expectedRefillTime,
- item.expectedShortageTime,
- item.warningRule
- ]
- csvRows.push(row.join(','))
- })
-
- return csvRows.join('\n')
-}
-// 鍚敤鐘舵�佸彉鍖�
+
+// // 鍚敤鐘舵�佸彉鍖�
const handleEnableChange = async (row) => {
+
try {
- // 妯℃嫙API璋冪敤寤惰繜
- await new Promise(resolve => setTimeout(resolve, 200))
- ElMessage.success(`${row.tankName} 鐨勫惎鐢ㄧ姸鎬佸凡鏇存柊`)
+ updateStockWarning(row).then(res => {
+ if(res.code == 200){
+ ElMessage.success(`${row.tankName} 鐨勫惎鐢ㄧ姸鎬佸凡鏇存柊`);
+ getList();
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
} catch (error) {
ElMessage.error('鐘舵�佹洿鏂板け璐�')
// 鎭㈠鍘熺姸鎬�
@@ -940,18 +725,39 @@
const submitForm = async () => {
try {
await proxy.$refs.formRef.validate()
-
+
// 妯℃嫙API璋冪敤寤惰繜
- await new Promise(resolve => setTimeout(resolve, 500))
-
+ // await new Promise(resolve => setTimeout(resolve, 500))
+
if (operationType.value === 'add') {
- ElMessage.success('鏂板鎴愬姛')
+ addStockWarning(form).then(res => {
+ if(res.code == 200){
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogFormVisible.value = false
+ getList()
+ resetForm()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+
+ // ElMessage.success('鏂板鎴愬姛')
} else {
- ElMessage.success('缂栬緫鎴愬姛')
+ updateStockWarning(form).then(res => {
+ if(res.code == 200){
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogFormVisible.value = false
+ getList()
+ resetForm()
+ }
+ }).catch(err => {
+ ElMessage.error(err.msg);
+ })
+ // ElMessage.success('缂栬緫鎴愬姛')
}
-
- closeDialog()
- getList()
+
+ // closeDialog()
+ // getList()
} catch (error) {
if (!error.errors) {
ElMessage.error(operationType.value === 'add' ? '鏂板澶辫触' : '缂栬緫澶辫触')
@@ -962,7 +768,7 @@
// 鍏抽棴寮圭獥
const closeDialog = () => {
dialogFormVisible.value = false
- resetForm()
+ // resetForm()
}
// 閲嶇疆琛ㄥ崟
@@ -1040,89 +846,89 @@
<style scoped lang="scss">
.app-container {
padding: 20px;
-
+
.table-operations {
text-align: right;
margin-bottom: 20px;
-
+
.el-button {
margin-right: 10px;
}
}
-
+
.table_list {
background: #fff;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
-
+
.text-danger {
color: #f56c6c;
font-weight: bold;
}
-
+
.text-warning {
color: #e6a23c;
font-weight: bold;
}
-
+
.text-success {
color: #67c23a;
font-weight: bold;
}
-
+
.dialog-footer {
text-align: right;
}
-
+
// 鍊掕鏃舵牱寮�
.countdown-timer {
font-weight: bold;
}
-
+
.countdown-normal {
color: #67c23a;
}
-
+
.countdown-warning {
color: #e6a23c;
}
-
+
.countdown-urgent {
color: #f56c6c;
animation: blink 1s infinite;
}
-
+
.countdown-expired {
color: #f56c6c;
font-weight: bold;
}
-
+
@keyframes blink {
0%, 50% { opacity: 1; }
51%, 100% { opacity: 0.5; }
}
-
+
// 缂烘皵棰勮寮规鏍峰紡
.shortage-warning-content {
text-align: center;
padding: 20px 0;
-
+
.warning-icon {
margin-bottom: 20px;
}
-
+
.warning-message {
h3 {
color: #f56c6c;
margin-bottom: 10px;
}
-
+
p {
margin-bottom: 10px;
color: #606266;
}
-
+
.warning-details {
background: #f5f7fa;
padding: 15px;
diff --git a/src/views/login.vue b/src/views/login.vue
index f8470f9..960f097 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -181,7 +181,7 @@
<style lang='scss' scoped>
.login {
height: 100%;
- background-image: url("../assets/indexViews/XYHBView.png");
+ background-image: url("../assets/indexViews/JZYJView.png");
background-size: cover;
position: relative;
}
diff --git a/src/views/personnelManagement/scheduling/index.vue b/src/views/personnelManagement/scheduling/index.vue
index 8a7174d..2818055 100644
--- a/src/views/personnelManagement/scheduling/index.vue
+++ b/src/views/personnelManagement/scheduling/index.vue
@@ -5,43 +5,40 @@
<el-form :inline="true" :model="filterForm" class="filter-form">
<el-form-item label="鍛樺伐濮撳悕锛�">
<el-input
- v-model="filterForm.employeeName"
- placeholder="璇疯緭鍏ュ憳宸ュ鍚�"
- clearable
- style="width: 150px"
+ v-model="filterForm.staffName"
+ placeholder="璇疯緭鍏ュ憳宸ュ鍚�"
+ clearable
+ style="width: 150px"
/>
</el-form-item>
<el-form-item label="鐝绫诲瀷锛�">
<el-select v-model="filterForm.shiftType" placeholder="璇烽�夋嫨鐝" clearable style="width: 120px">
- <el-option label="鏃╃彮" value="鏃╃彮" />
- <el-option label="涓彮" value="涓彮" />
- <el-option label="鏅氱彮" value="鏅氱彮" />
- <el-option label="澶滅彮" value="澶滅彮" />
+ <el-option v-for="item in shift_type" :label="item.label" :value="item.value" :key="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="鏃ユ湡鑼冨洿锛�">
<el-date-picker
- v-model="filterForm.dateRange"
- type="daterange"
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
- style="width: 250px"
+ v-model="filterForm.dateRange"
+ type="daterange"
+ range-separator="鑷�"
+ start-placeholder="寮�濮嬫棩鏈�"
+ end-placeholder="缁撴潫鏃ユ湡"
+ format="YYYY-MM-DD"
+ value-format="YYYY-MM-DD"
+ style="width: 250px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleFilter">
- <el-icon><Search /></el-icon>
+ <el-icon><Search/></el-icon>
绛涢��
</el-button>
<el-button @click="resetFilter">
- <el-icon><Refresh /></el-icon>
+ <el-icon><Refresh/></el-icon>
閲嶇疆
</el-button>
<el-button type="primary" @click="openScheduleDialog('add')">
- <el-icon><Plus /></el-icon>
+ <el-icon><Plus/></el-icon>
鏂板鎺掔彮
</el-button>
</el-form-item>
@@ -51,27 +48,32 @@
<!-- 鎺掔彮琛ㄦ牸 -->
<div class="table-section">
<el-table
- :data="filteredScheduleList"
- border
- stripe
- style="width: 100%"
- height="calc(100vh - 18.5em)"
- @selection-change="handleSelectionChange"
+ :data="scheduleList"
+ border
+ :loading="tableLoading"
+ stripe
+ style="width: 100%"
+ height="calc(100vh - 18.5em)"
+ @selection-change="handleSelectionChange"
>
- <el-table-column type="selection" width="55" />
- <el-table-column prop="employeeName" label="鍛樺伐濮撳悕" width="120" />
- <el-table-column prop="employeeId" label="鍛樺伐宸ュ彿" width="100" />
- <el-table-column prop="department" label="閮ㄩ棬" width="120" />
+ <el-table-column type="selection" width="55"/>
+ <el-table-column prop="staffName" label="鍛樺伐濮撳悕" width="120"/>
+ <el-table-column prop="staffNo" label="鍛樺伐宸ュ彿" width="100"/>
+ <el-table-column prop="department" label="閮ㄩ棬" width="120">
+ <template #default="scope">
+ {{ (department_type.find(i => i.value === String(scope.row.department)) || {}).label }}
+ </template>
+ </el-table-column>
<el-table-column prop="shiftType" label="鐝绫诲瀷" width="100">
<template #default="scope">
<el-tag :type="getShiftTagType(scope.row.shiftType)">
- {{ scope.row.shiftType }}
+ {{ (shift_type.find(i => i.value === String(scope.row.shiftType)) || {}).label }}
</el-tag>
</template>
</el-table-column>
- <el-table-column prop="workDate" label="宸ヤ綔鏃ユ湡" width="120" />
- <el-table-column prop="startTime" label="寮�濮嬫椂闂�" width="100" />
- <el-table-column prop="endTime" label="缁撴潫鏃堕棿" width="100" />
+ <el-table-column prop="workDate" label="宸ヤ綔鏃ユ湡" width="120"/>
+ <el-table-column prop="startTime" label="寮�濮嬫椂闂�" width="100"/>
+ <el-table-column prop="endTime" label="缁撴潫鏃堕棿" width="100"/>
<el-table-column prop="workHours" label="宸ヤ綔鏃堕暱" width="100">
<template #default="scope">
{{ scope.row.workHours }}灏忔椂
@@ -80,38 +82,45 @@
<el-table-column prop="status" label="鐘舵��" width="100">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">
- {{ scope.row.status }}
+ {{ (schedule_status.find(i => i.value === String(scope.row.status)) || {}).label }}
</el-tag>
</template>
</el-table-column>
- <el-table-column prop="remark" label="澶囨敞" min-width="150" />
+ <el-table-column prop="remark" label="澶囨敞" min-width="150"/>
<el-table-column label="鎿嶄綔" width="200" fixed="right">
<template #default="scope">
<el-button
- type="primary"
- size="small"
- @click="openScheduleDialog('edit', scope.row)"
+ type="primary"
+ size="small"
+ @click="openScheduleDialog('edit', scope.row)"
>
缂栬緫
</el-button>
<el-button
- type="danger"
- size="small"
- @click="handleDelete(scope.row)"
+ type="danger"
+ size="small"
+ @click="handleDelete(scope.row)"
>
鍒犻櫎
</el-button>
</template>
</el-table-column>
</el-table>
+ <pagination
+ v-if="tableCount > 0"
+ :total="tableCount"
+ :page="filterForm.current"
+ :limit="filterForm.size"
+ @pagination="paginationChange"
+ />
</div>
<!-- 鎵归噺鎿嶄綔 -->
<div class="batch-actions" v-if="selectedRows.length > 0">
<el-button
- type="danger"
- @click="handleBatchDelete"
- :disabled="selectedRows.length === 0"
+ type="danger"
+ @click="handleBatchDelete"
+ :disabled="selectedRows.length === 0"
>
鎵归噺鍒犻櫎 ({{ selectedRows.length }})
</el-button>
@@ -119,118 +128,111 @@
<!-- 鎺掔彮鏂板/缂栬緫瀵硅瘽妗� -->
<el-dialog
- v-model="scheduleDialog"
- :title="dialogType === 'add' ? '鏂板鎺掔彮' : '缂栬緫鎺掔彮'"
- width="700px"
- @close="closeScheduleDialog"
+ v-model="scheduleDialog"
+ :title="dialogType === 'add' ? '鏂板鎺掔彮' : '缂栬緫鎺掔彮'"
+ width="700px"
+ @close="closeScheduleDialog"
>
<el-form
- :model="scheduleForm"
- :rules="scheduleRules"
- ref="scheduleFormRef"
- label-width="120px"
+ :model="scheduleForm"
+ :rules="scheduleRules"
+ ref="scheduleFormRef"
+ label-width="120px"
>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="鍛樺伐濮撳悕锛�" prop="employeeName">
- <el-input v-model="scheduleForm.employeeName" placeholder="璇疯緭鍏ュ憳宸ュ鍚�" />
+ <el-form-item label="鍛樺伐濮撳悕锛�" prop="staffId">
+ <el-select v-model="scheduleForm.staffId" placeholder="璇疯緭鍏ュ憳宸ュ鍚�" style="width: 100%"
+ @change="handleSelectStaff">
+ <el-option v-for="item in personList" :label="item.staffName" :value="item.id" :key="item.id"/>
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍛樺伐宸ュ彿锛�" prop="employeeId">
- <el-input v-model="scheduleForm.employeeId" placeholder="璇疯緭鍏ュ憳宸ュ伐鍙�" />
+ <el-form-item label="鍛樺伐宸ュ彿锛�" prop="staffNo">
+ <el-input :disabled="true" v-model="scheduleForm.staffNo" placeholder=""/>
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="閮ㄩ棬锛�" prop="department">
<el-select v-model="scheduleForm.department" placeholder="璇烽�夋嫨閮ㄩ棬" style="width: 100%">
- <el-option label="鎶�鏈儴" value="鎶�鏈儴" />
- <el-option label="閿�鍞儴" value="閿�鍞儴" />
- <el-option label="浜轰簨閮�" value="浜轰簨閮�" />
- <el-option label="璐㈠姟閮�" value="璐㈠姟閮�" />
- <el-option label="鐢熶骇閮�" value="鐢熶骇閮�" />
+ <el-option v-for="item in department_type" :label="item.label" :value="item.value" :key="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鐝绫诲瀷锛�" prop="shiftType">
<el-select v-model="scheduleForm.shiftType" placeholder="璇烽�夋嫨鐝" style="width: 100%">
- <el-option label="鏃╃彮" value="鏃╃彮" />
- <el-option label="涓彮" value="涓彮" />
- <el-option label="鏅氱彮" value="鏅氱彮" />
- <el-option label="澶滅彮" value="澶滅彮" />
+ <el-option v-for="item in shift_type" :label="item.label" :value="item.value" :key="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="宸ヤ綔鏃ユ湡锛�" prop="workDate">
<el-date-picker
- v-model="scheduleForm.workDate"
- type="date"
- placeholder="閫夋嫨宸ヤ綔鏃ユ湡"
- style="width: 100%"
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
+ v-model="scheduleForm.workDate"
+ type="date"
+ placeholder="閫夋嫨宸ヤ綔鏃ユ湡"
+ style="width: 100%"
+ format="YYYY-MM-DD"
+ value-format="YYYY-MM-DD"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鐘舵�侊細" prop="status">
<el-select v-model="scheduleForm.status" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%">
- <el-option label="宸插畨鎺�" value="宸插畨鎺�" />
- <el-option label="宸茬‘璁�" value="宸茬‘璁�" />
- <el-option label="宸插畬鎴�" value="宸插畬鎴�" />
- <el-option label="宸插彇娑�" value="宸插彇娑�" />
+ <el-option v-for="item in schedule_status" :label="item.label" :value="item.value" :key="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="寮�濮嬫椂闂达細" prop="startTime">
<el-time-picker
- v-model="scheduleForm.startTime"
- placeholder="閫夋嫨寮�濮嬫椂闂�"
- style="width: 100%"
- format="HH:mm"
- value-format="HH:mm"
+ v-model="scheduleForm.startTime"
+ placeholder="閫夋嫨寮�濮嬫椂闂�"
+ style="width: 100%"
+ format="HH:mm"
+ value-format="HH:mm"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="缁撴潫鏃堕棿锛�" prop="endTime">
<el-time-picker
- v-model="scheduleForm.endTime"
- placeholder="閫夋嫨缁撴潫鏃堕棿"
- style="width: 100%"
- format="HH:mm"
- value-format="HH:mm"
+ v-model="scheduleForm.endTime"
+ placeholder="閫夋嫨缁撴潫鏃堕棿"
+ style="width: 100%"
+ format="HH:mm"
+ value-format="HH:mm"
/>
</el-form-item>
</el-col>
</el-row>
-
+
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="澶囨敞锛�" prop="remark">
<el-input
- v-model="scheduleForm.remark"
- type="textarea"
- :rows="3"
- placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
+ v-model="scheduleForm.remark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ娉ㄤ俊鎭�"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
-
+
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitScheduleForm">纭</el-button>
@@ -242,10 +244,16 @@
</template>
<script setup>
-import { ref, reactive, computed, onMounted } from 'vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import { Plus, Download, Search, Refresh } from '@element-plus/icons-vue'
+import {ref, reactive, computed, onMounted} from 'vue'
+import {ElMessage, ElMessageBox} from 'element-plus'
+import {useDict} from "@/utils/dict.js"
+import {Plus, Download, Search, Refresh} from '@element-plus/icons-vue'
+import {save, del, delByIds, listPage} from "@/api/personnelManagement/scheduling.js"
+import {getStaffOnJob} from "@/api/personnelManagement/onboarding.js";
+import dayjs from "dayjs";
+import pagination from "@/components/PIMTable/Pagination.vue";
+const tableCount = ref(0)
// 鍝嶅簲寮忔暟鎹�
const scheduleDialog = ref(false)
const dialogType = ref('add')
@@ -254,137 +262,109 @@
// 绛涢�夎〃鍗�
const filterForm = reactive({
- employeeName: '',
+ staffName: '',
shiftType: '',
- dateRange: []
+ dateRange: [],
+ current:1,
+ size: 10
})
// 鎺掔彮琛ㄥ崟
const scheduleForm = reactive({
id: '',
- employeeName: '',
- employeeId: '',
+ staffId: '',
+ staffNo: '',
department: '',
shiftType: '',
workDate: '',
startTime: '',
endTime: '',
+ workStartTime: '',
+ workEndTime: '',
workHours: 0,
- status: '宸插畨鎺�',
+ status: '',
remark: ''
})
// 琛ㄥ崟楠岃瘉瑙勫垯
const scheduleRules = reactive({
- employeeName: [{ required: true, message: '璇疯緭鍏ュ憳宸ュ鍚�', trigger: 'blur' }],
- employeeId: [{ required: true, message: '璇疯緭鍏ュ憳宸ュ伐鍙�', trigger: 'blur' }],
- department: [{ required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change' }],
- shiftType: [{ required: true, message: '璇烽�夋嫨鐝绫诲瀷', trigger: 'change' }],
- workDate: [{ required: true, message: '璇烽�夋嫨宸ヤ綔鏃ユ湡', trigger: 'change' }],
- startTime: [{ required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change' }],
- endTime: [{ required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', trigger: 'change' }],
- status: [{ required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change' }]
+ staffId: [{required: true, message: '璇烽�夋嫨鍛樺伐', trigger: 'change'}],
+ department: [{required: true, message: '璇烽�夋嫨閮ㄩ棬', trigger: 'change'}],
+ shiftType: [{required: true, message: '璇烽�夋嫨鐝绫诲瀷', trigger: 'change'}],
+ workDate: [{required: true, message: '璇烽�夋嫨宸ヤ綔鏃ユ湡', trigger: 'change'}],
+ startTime: [{required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change'}],
+ endTime: [{required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', trigger: 'change'}],
+ status: [{required: true, message: '璇烽�夋嫨鐘舵��', trigger: 'change'}]
})
+const tableLoading = ref(false)
+
+//瀛楀吀
+const {department_type, schedule_status, shift_type} = useDict("department_type", "schedule_status", "shift_type")
+// 浜哄憳鍒楄〃
+const personList = ref([]);
// 妯℃嫙鎺掔彮鏁版嵁
-const scheduleList = ref([
- {
- id: 1,
- employeeName: '寮犳捣娲�',
- employeeId: 'EMP001',
- department: '鎶�鏈儴',
- shiftType: '鏃╃彮',
- workDate: '2024-01-15',
- startTime: '08:00',
- endTime: '17:00',
- workHours: 9,
- status: '宸插畨鎺�',
- remark: '姝e父鎺掔彮'
- },
- {
- id: 2,
- employeeName: '鏉庤秴',
- employeeId: 'EMP002',
- department: '閿�鍞儴',
- shiftType: '涓彮',
- workDate: '2024-01-15',
- startTime: '14:00',
- endTime: '22:00',
- workHours: 8,
- status: '宸茬‘璁�',
- remark: '瀹㈡埛浼氳'
- },
- {
- id: 3,
- employeeName: '鐜嬫澃',
- employeeId: 'EMP003',
- department: '鐢熶骇閮�',
- shiftType: '鏅氱彮',
- workDate: '2024-01-15',
- startTime: '22:00',
- endTime: '06:00',
- workHours: 8,
- status: '宸插畨鎺�',
- remark: '澶滅彮鐢熶骇'
- }
-])
+const scheduleList = ref([])
-// 璁$畻灞炴�э細绛涢�夊悗鐨勬帓鐝垪琛�
-const filteredScheduleList = computed(() => {
- let result = scheduleList.value
- if (filterForm.employeeName) {
- result = result.filter(item =>
- item.employeeName.includes(filterForm.employeeName)
- )
- }
+/**
+ * 鑾峰彇褰撳墠鍦ㄨ亴浜哄憳鍒楄〃
+ */
+const getPersonList = () => {
+ getStaffOnJob().then(res => {
+ personList.value = res.data
+ })
+};
+const paginationChange = (obj) => {
+ filterForm.current = obj.page;
+ filterForm.size = obj.limit;
+ handleFilter();
+};
- if (filterForm.shiftType) {
- result = result.filter(item => item.shiftType === filterForm.shiftType)
- }
+const handleSelectStaff = (val) => {
+ let obj = personList.value.find(item => item.id === val)
+ scheduleForm.staffNo = obj.staffNo
- if (filterForm.dateRange && filterForm.dateRange.length === 2) {
- result = result.filter(item => {
- const workDate = new Date(item.workDate)
- const startDate = new Date(filterForm.dateRange[0])
- const endDate = new Date(filterForm.dateRange[1])
- return workDate >= startDate && workDate <= endDate
- })
- }
-
- return result
-})
+}
// 鑾峰彇鐝鏍囩绫诲瀷
const getShiftTagType = (shiftType) => {
- const typeMap = {
- '鏃╃彮': 'success',
- '涓彮': 'warning',
- '鏅氱彮': 'info',
- '澶滅彮': 'danger'
- }
+ const typeMap = Object.fromEntries(shift_type.value.map(i => [i.value, i.elTagType]))
return typeMap[shiftType] || 'info'
}
// 鑾峰彇鐘舵�佹爣绛剧被鍨�
const getStatusTagType = (status) => {
- const typeMap = {
- '宸插畨鎺�': 'info',
- '宸茬‘璁�': 'warning',
- '宸插畬鎴�': 'success',
- '宸插彇娑�': 'danger'
- }
+ const typeMap = Object.fromEntries(schedule_status.value.map(i => [i.value, i.elTagType]))
return typeMap[status] || 'info'
}
// 绛涢��
-const handleFilter = () => {
- // 绛涢�夐�昏緫宸插湪璁$畻灞炴�т腑瀹炵幇
+const handleFilter = async () => {
+ tableLoading.value = true
+ let searchForm = {
+ ...filterForm,
+ ...(filterForm.dateRange.length > 0 && {
+ startDate: filterForm.dateRange[0],
+ endDate: filterForm.dateRange[1],
+ })
+ }
+ let resp = await listPage(searchForm)
+ tableCount.value = resp.data.total
+ scheduleList.value = resp.data.records.map(it => {
+ return {
+ ...it,
+ 'startTime': dayjs(it.workStartTime).format('HH:mm'),
+ 'endTime': dayjs(it.workEndTime).format('HH:mm'),
+ }
+ })
+ tableLoading.value = false
+
}
// 閲嶇疆绛涢��
const resetFilter = () => {
- filterForm.employeeName = ''
+ filterForm.staffName = ''
filterForm.shiftType = ''
filterForm.dateRange = []
}
@@ -393,16 +373,16 @@
const openScheduleDialog = (type, data) => {
dialogType.value = type
scheduleDialog.value = true
-
+ getPersonList()
if (type === 'edit' && data) {
// 缂栬緫妯″紡锛屽鍒舵暟鎹�
- Object.assign(scheduleForm, { ...data })
+ Object.assign(scheduleForm, {...data})
} else {
// 鏂板妯″紡锛岄噸缃〃鍗�
Object.keys(scheduleForm).forEach(key => {
scheduleForm[key] = ''
})
- scheduleForm.status = '宸插畨鎺�'
+ // scheduleForm.status = '宸插畨鎺�'
scheduleForm.workDate = new Date().toISOString().split('T')[0]
}
}
@@ -415,66 +395,59 @@
// 璁$畻宸ヤ綔鏃堕暱
const calculateWorkHours = () => {
- if (scheduleForm.startTime && scheduleForm.endTime) {
- const start = new Date(`2000-01-01 ${scheduleForm.startTime}`)
- const end = new Date(`2000-01-01 ${scheduleForm.endTime}`)
-
- if (end < start) {
- // 璺ㄥぉ鐨勬儏鍐�
- end.setDate(end.getDate() + 1)
+ if (scheduleForm.workDate && scheduleForm.startTime && scheduleForm.endTime) {
+ // 浣跨敤 workDate 涓� startTime 鍜� endTime 缁勫悎
+ const startDateTime = new Date(`${scheduleForm.workDate} ${scheduleForm.startTime}`)
+ const endDateTime = new Date(`${scheduleForm.workDate} ${scheduleForm.endTime}`)
+
+ // 澶勭悊璺ㄥぉ鎯呭喌锛堢粨鏉熸椂闂存棭浜庡紑濮嬫椂闂达級
+ if (endDateTime < startDateTime) {
+ // 璺ㄥぉ锛屽皢缁撴潫鏃ユ湡鍔犱竴澶�
+ endDateTime.setDate(endDateTime.getDate() + 1)
}
-
- const diffMs = end - start
+ // 璁$畻宸ヤ綔鏃堕暱锛堝皬鏃讹級
+ const diffMs = endDateTime - startDateTime
const diffHours = diffMs / (1000 * 60 * 60)
scheduleForm.workHours = Math.round(diffHours * 100) / 100
+ scheduleForm.workStartTime = dayjs(startDateTime).format("YYYY-MM-DD HH:mm:ss")
+ scheduleForm.workEndTime = dayjs(endDateTime).format("YYYY-MM-DD HH:mm:ss")
+
}
}
// 鎻愪氦鎺掔彮琛ㄥ崟
-const submitScheduleForm = () => {
- scheduleFormRef.value.validate((valid) => {
- if (valid) {
- // 璁$畻宸ヤ綔鏃堕暱
- calculateWorkHours()
-
- if (dialogType.value === 'add') {
- // 鏂板
- const newSchedule = {
- ...scheduleForm,
- id: Date.now() // 浣跨敤鏃堕棿鎴充綔涓轰复鏃禝D
- }
- scheduleList.value.push(newSchedule)
- ElMessage.success('鏂板鎺掔彮鎴愬姛')
- } else {
- // 缂栬緫
- const index = scheduleList.value.findIndex(item => item.id === scheduleForm.id)
- if (index !== -1) {
- scheduleList.value[index] = { ...scheduleForm }
- ElMessage.success('缂栬緫鎺掔彮鎴愬姛')
- }
- }
-
- closeScheduleDialog()
- }
- })
+const submitScheduleForm = async () => {
+ const valid = await scheduleFormRef.value.validate()
+ if (!valid) return
+
+ calculateWorkHours()
+ const newSchedule = {...scheduleForm}
+
+ try {
+ await save(newSchedule)
+ ElMessage.success('淇濆瓨鎺掔彮鎴愬姛')
+
+ handleFilter()
+ closeScheduleDialog()
+ } catch (err) {
+ ElMessage.error('淇濆瓨澶辫触')
+ }
}
// 鍒犻櫎鎺掔彮
const handleDelete = (row) => {
ElMessageBox.confirm(
- `纭畾瑕佸垹闄� ${row.employeeName} 鐨勬帓鐝褰曞悧锛焋,
- '鍒犻櫎鎻愮ず',
- {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }
+ `纭畾瑕佸垹闄� ${row.staffName} 鐨勬帓鐝褰曞悧锛焋,
+ '鍒犻櫎鎻愮ず',
+ {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }
).then(() => {
- const index = scheduleList.value.findIndex(item => item.id === row.id)
- if (index !== -1) {
- scheduleList.value.splice(index, 1)
- ElMessage.success('鍒犻櫎鎴愬姛')
- }
+ del(row.id)
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ handleFilter()
}).catch(() => {
ElMessage.info('宸插彇娑堝垹闄�')
})
@@ -486,19 +459,18 @@
ElMessage.warning('璇烽�夋嫨瑕佸垹闄ょ殑璁板綍')
return
}
-
+
ElMessageBox.confirm(
- `纭畾瑕佸垹闄ら�変腑鐨� ${selectedRows.value.length} 鏉℃帓鐝褰曞悧锛焋,
- '鎵归噺鍒犻櫎鎻愮ず',
- {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }
+ `纭畾瑕佸垹闄ら�変腑鐨� ${selectedRows.value.length} 鏉℃帓鐝褰曞悧锛焋,
+ '鎵归噺鍒犻櫎鎻愮ず',
+ {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }
).then(() => {
- const selectedIds = selectedRows.value.map(row => row.id)
- scheduleList.value = scheduleList.value.filter(item => !selectedIds.includes(item.id))
- selectedRows.value = []
+ delByIds(selectedRows.value.map(item => item.id))
+ handleFilter()
ElMessage.success('鎵归噺鍒犻櫎鎴愬姛')
}).catch(() => {
ElMessage.info('宸插彇娑堝垹闄�')
@@ -510,16 +482,11 @@
selectedRows.value = selection
}
-// 鐩戝惉鏃堕棿鍙樺寲锛岃嚜鍔ㄨ绠楀伐浣滄椂闀�
-const watchTimeChange = () => {
- if (scheduleForm.startTime && scheduleForm.endTime) {
- calculateWorkHours()
- }
-}
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
// 椤甸潰鍒濆鍖�
+ handleFilter()
})
</script>
@@ -611,15 +578,15 @@
.scheduling-container {
padding: 10px;
}
-
+
.page-header {
padding: 15px;
}
-
+
.page-header h2 {
font-size: 24px;
}
-
+
.header-controls {
flex-direction: column;
gap: 10px;
diff --git a/src/views/personnelManagement/selfService/index.vue b/src/views/personnelManagement/selfService/index.vue
index 1f4fbea..926229a 100644
--- a/src/views/personnelManagement/selfService/index.vue
+++ b/src/views/personnelManagement/selfService/index.vue
@@ -26,7 +26,7 @@
<el-button type="primary" @click="addAttendanceRecord">鏂板璁板綍</el-button>
</div>
</template>
- <el-table :data="attendanceData" style="width: 100%">
+ <el-table :data="attendanceData" style="width: 100%" :loading="tableLoading">
<el-table-column prop="date" label="鏃ユ湡" />
<el-table-column prop="checkIn" label="绛惧埌鏃堕棿" />
<el-table-column prop="checkOut" label="绛鹃��鏃堕棿" />
@@ -41,7 +41,7 @@
<el-table-column label="鎿嶄綔" width="150">
<template #default="scope">
<el-button size="small" @click="editAttendanceRecord(scope.row)">缂栬緫</el-button>
- <el-button size="small" type="danger" @click="deleteAttendanceRecord(scope.$index)">鍒犻櫎</el-button>
+ <el-button size="small" type="danger" @click="deleteAttendanceRecord(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -52,15 +52,15 @@
<template #header>
<div class="card-header">
<span>钖祫鍗曟煡璇�</span>
- <el-date-picker v-model="salaryMonth" type="month" placeholder="閫夋嫨鏈堜唤" />
+ <el-date-picker v-model="payDateStr" type="month" placeholder="閫夋嫨鏈堜唤" value-format="YYYY-MM" format="YYYY-MM" @change="changMonth"/>
</div>
</template>
<el-table :data="salaryData" style="width: 100%">
- <el-table-column prop="month" label="鏈堜唤" />
+ <el-table-column prop="payDate" label="鏈堜唤" />
<el-table-column prop="basicSalary" label="鍩烘湰宸ヨ祫" />
<el-table-column prop="bonus" label="濂栭噾" />
<el-table-column prop="deduction" label="鎵f" />
- <el-table-column prop="total" label="瀹炲彂宸ヨ祫" />
+ <el-table-column prop="actualWages" label="瀹炲彂宸ヨ祫" />
<el-table-column prop="status" label="鐘舵��" >
<template #default="scope">
<el-tag :type="scope.row.status === '宸插彂鏀�' ? 'success' : 'warning'">
@@ -76,7 +76,7 @@
<template #header>
<div class="card-header">
<span>鍋囨湡鐢宠绠$悊</span>
- <el-button type="primary" @click="showLeaveDialog = true">鐢宠鍋囨湡</el-button>
+ <el-button type="primary" @click="openLeaveForm">鐢宠鍋囨湡</el-button>
</div>
</template>
<el-table :data="leaveData" style="width: 100%">
@@ -95,7 +95,7 @@
<el-table-column label="鎿嶄綔" width="150">
<template #default="scope">
<el-button size="small" @click="editLeaveRecord(scope.row)">缂栬緫</el-button>
- <el-button size="small" type="danger" @click="deleteLeaveRecord(scope.$index)">鍒犻櫎</el-button>
+ <el-button size="small" type="danger" @click="deleteLeaveRecord(scope.row)">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -106,7 +106,7 @@
<template #header>
<div class="card-header">
<span>涓汉淇℃伅缁存姢</span>
- <el-button type="primary" @click="editProfile = true">缂栬緫淇℃伅</el-button>
+ <el-button type="primary" @click="editProfileForm">缂栬緫淇℃伅</el-button>
</div>
</template>
<el-descriptions :column="2" border>
@@ -117,13 +117,13 @@
<el-descriptions-item label="鍏ヨ亴鏃ユ湡">{{ profile.hireDate }}</el-descriptions-item>
<el-descriptions-item label="鑱旂郴鐢佃瘽">{{ profile.phone }}</el-descriptions-item>
<el-descriptions-item label="閭">{{ profile.email }}</el-descriptions-item>
- <el-descriptions-item label="鍦板潃">{{ profile.address }}</el-descriptions-item>
+ <el-descriptions-item label="鍦板潃">{{ profile.adress }}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
<!-- 鍋囨湡鐢宠寮圭獥 -->
- <el-dialog v-model="showLeaveDialog" title="鐢宠鍋囨湡" width="500px">
+ <el-dialog v-model="showLeaveDialog" :title="leaveOperationType === 'add' ? '鐢宠鍋囨湡' : '缂栬緫鍋囨湡'" width="500px">
<el-form :model="leaveForm" label-width="100px">
<el-form-item label="鍋囨湡绫诲瀷">
<el-select v-model="leaveForm.type" placeholder="璇烽�夋嫨鍋囨湡绫诲瀷">
@@ -142,6 +142,13 @@
<el-form-item label="鐢宠鍘熷洜">
<el-input v-model="leaveForm.reason" type="textarea" rows="3" />
</el-form-item>
+ <!-- <el-form-item label="瀹℃壒鐘舵��">
+ <el-select v-model="leaveForm.status" placeholder="璇烽�夋嫨瀹℃壒鐘舵��">
+ <el-option label="瀹℃壒涓�" value="瀹℃壒涓�" />
+ <el-option label="宸查�氳繃" value="宸查�氳繃" />
+ <el-option label="宸叉嫆缁�" value="宸叉嫆缁�" />
+ </el-select>
+ </el-form-item> -->
</el-form>
<template #footer>
<el-button @click="showLeaveDialog = false">鍙栨秷</el-button>
@@ -149,11 +156,11 @@
</template>
</el-dialog>
- <!-- 鏂板鑰冨嫟璁板綍寮圭獥 -->
- <el-dialog v-model="showAttendanceDialog" title="鏂板鑰冨嫟璁板綍" width="500px">
+ <!-- 鏂板-缂栬緫鑰冨嫟璁板綍寮圭獥 -->
+ <el-dialog v-model="showAttendanceDialog" :title="operationType === 'add' ? '鏂板鑰冨嫟璁板綍' : '缂栬緫鑰冨嫟璁板綍'" width="500px">
<el-form :model="attendanceForm" :rules="attendanceRules" ref="attendanceFormRef" label-width="100px">
<el-form-item label="鏃ユ湡" prop="date">
- <el-date-picker v-model="attendanceForm.date" type="date" placeholder="閫夋嫨鏃ユ湡" />
+ <el-date-picker v-model="attendanceForm.date" type="date" value-format="YYYY-MM-DD" format="YYYY-MM-DD" placeholder="閫夋嫨鏃ユ湡" />
</el-form-item>
<el-form-item label="绛惧埌鏃堕棿" prop="checkIn">
<el-time-picker v-model="attendanceForm.checkIn" placeholder="閫夋嫨绛惧埌鏃堕棿" format="HH:mm" value-format="HH:mm" />
@@ -189,7 +196,7 @@
<el-input v-model="profileForm.email" />
</el-form-item>
<el-form-item label="鍦板潃">
- <el-input v-model="profileForm.address" type="textarea" rows="2" />
+ <el-input v-model="profileForm.adress" type="textarea" rows="2" />
</el-form-item>
</el-form>
<template #footer>
@@ -201,14 +208,29 @@
</template>
<script setup>
-import { ref, reactive, watch } from 'vue'
-import { ElMessage } from 'element-plus'
+import { ref, reactive, watch, onMounted } from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
import {
Calendar,
Money,
Clock,
User
} from '@element-plus/icons-vue'
+import { personalAttendanceRecordsListPage, personalAttendanceRecordsAdd, personalAttendanceRecordsUpdate, personalAttendanceRecordsDelete, holidayApplicationListPage, holidayApplicationAdd, holidayApplicationUpdate, holidayApplicationDelete } from '@/api/personnelManagement/selfService'
+import { compensationListPage, compensationAdd, compensationUpdate, compensationDelete } from '@/api/personnelManagement/payrollManagement'
+
+const { proxy } = getCurrentInstance()
+import { getUserProfile } from '@/api/system/user.js'
+import {staffJoinUpdate, staffJoinListPage} from "@/api/personnelManagement/onboarding.js";
+import { fa, id } from 'element-plus/es/locales.mjs'
+
+const tableLoading = ref(false)
+// 鍒嗛〉鍙傛暟
+const page = reactive({
+ current: 1,
+ size: 10,
+ total: 0
+})
// 褰撳墠瑙嗗浘
const currentView = ref('attendance')
@@ -222,63 +244,84 @@
]
// 鑰冨嫟鏁版嵁
-const attendanceData = ref([
- { date: '2024-01-15', checkIn: '09:00', checkOut: '18:00', workHours: '9灏忔椂', status: '姝e父' },
- { date: '2024-01-16', checkIn: '08:55', checkOut: '18:05', workHours: '9灏忔椂10鍒�', status: '姝e父' },
- { date: '2024-01-17', checkIn: '09:15', checkOut: '18:00', workHours: '8灏忔椂45鍒�', status: '杩熷埌' }
-])
+const attendanceData = ref([])
// 钖祫鏁版嵁
-const salaryData = ref([
- { month: '2024-01', basicSalary: 8000, bonus: 1000, deduction: 200, total: 8800, status: '宸插彂鏀�' },
- { month: '2023-12', basicSalary: 8000, bonus: 800, deduction: 150, total: 8650, status: '宸插彂鏀�' }
-])
+const salaryData = ref([])
+
// 鍋囨湡鏁版嵁
-const leaveData = ref([
- { type: '骞村亣', startDate: '2024-02-01', endDate: '2024-02-03', days: 3, reason: '鏄ヨ妭鍥炲', status: '宸查�氳繃' },
- { type: '鐥呭亣', startDate: '2024-01-20', endDate: '2024-01-21', days: 2, reason: '鎰熷啋鍙戠儳', status: '瀹℃壒涓�' }
-])
-
+const leaveData = ref([])
+
+const currentUser = ref()
+const user= ref()
// 涓汉淇℃伅
const profile = ref({
- name: '寮犳捣娲�',
- employeeId: 'EMP001',
- department: '鎶�鏈儴',
- position: '杞欢宸ョ▼甯�',
- hireDate: '2023-03-01',
- phone: '13800138000',
- email: 'zhangsan@company.com',
- address: '鍖椾含甯傛湞闃冲尯xxx琛楅亾xxx鍙�'
-})
+ id: '',
+ name: '',
+ employeeId: '',
+ department: '',
+ position: '',
+ hireDate: '',
+ phone: '',
+ email: '',
+ adress: ''
+ })
// 寮圭獥鎺у埗
const showLeaveDialog = ref(false)
const editProfile = ref(false)
-const salaryMonth = ref('')
+const payDateStr = ref('')
// 琛ㄥ崟鏁版嵁
const leaveForm = reactive({
+ id: '',
type: '',
startDate: '',
endDate: '',
- reason: ''
+ days: 0,
+ reason: '',
+ status: ''
})
-
const profileForm = reactive({
- name: '',
- phone: '',
- email: '',
- address: ''
+ name: "",
+ email: "",
+ adress: "",
+ phone: "",
+})
+const joinForm = reactive({
+ id: "",
+ staffNo: "",
+ staffName: "",
+ email: "",
+ adress: "",
+ sex: "",
+ nativePlace: "",
+ postJob: "",
+ firstStudy: "",
+ profession: "",
+ identityCard: "",
+ age: 0,
+ phone: "",
+ emergencyContact: "",
+ emergencyContactPhone: "",
+ contractTerm: 0,
+ contractStartTime: "",
+ contractEndTime: "",
+ staffState: 1,
})
// 鏂板鑰冨嫟璁板綍锛氬脊绐椾笌琛ㄥ崟
+const operationType = ref('add')
+const leaveOperationType = ref('add')
const showAttendanceDialog = ref(false)
const attendanceFormRef = ref(null)
const attendanceForm = reactive({
+ id: '',
date: '',
checkIn: '',
checkOut: '',
+ workHours: '',
status: '姝e父'
})
const attendanceRules = {
@@ -305,6 +348,7 @@
// 鏂板鑰冨嫟璁板綍锛堟墦寮�寮圭獥骞堕濉粯璁ゅ�硷級
const addAttendanceRecord = () => {
+ operationType.value = 'add'
attendanceForm.date = new Date().toISOString().split('T')[0]
attendanceForm.checkIn = '09:00'
attendanceForm.checkOut = '18:00'
@@ -324,11 +368,15 @@
return m === 0 ? `${h}灏忔椂` : `${h}灏忔椂${m}鍒哷
}
-// 鎻愪氦鏂板鑰冨嫟璁板綍
+// 缂栬緫鑰冨嫟璁板綍
+const editAttendanceRecord = (row) => {
+ operationType.value = 'edit'
+ Object.assign(attendanceForm, row)
+ showAttendanceDialog.value = true
+}
+// 鎻愪氦鏂板-缂栬緫鑰冨嫟璁板綍
const submitAttendance = () => {
- if (!attendanceFormRef.value) return
- attendanceFormRef.value.validate((valid) => {
- if (!valid) return
+ // if (!attendanceFormRef.value) return
const workHours = computeWorkHours(attendanceForm.checkIn, attendanceForm.checkOut)
const newRecord = {
date: attendanceForm.date,
@@ -337,88 +385,320 @@
workHours,
status: attendanceForm.status
}
- attendanceData.value.unshift(newRecord)
- showAttendanceDialog.value = false
- // 閲嶇疆琛ㄥ崟
- attendanceForm.date = ''
- attendanceForm.checkIn = ''
- attendanceForm.checkOut = ''
- attendanceForm.status = '姝e父'
- ElMessage.success('鑰冨嫟璁板綍娣诲姞鎴愬姛')
+ if (operationType.value === 'add') {
+ personalAttendanceRecordsAdd(newRecord)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鑰冨嫟璁板綍娣诲姞鎴愬姛')
+ getPersonalAttendanceRecordsList()
+ showAttendanceDialog.value = false
+ // 閲嶇疆琛ㄥ崟
+ attendanceForm.date = ''
+ attendanceForm.checkIn = ''
+ attendanceForm.checkOut = ''
+ attendanceForm.status = '姝e父'
+ }
+ }).catch(err => {
+ ElMessage.error('鑰冨嫟璁板綍娣诲姞澶辫触')
+ })
+ }else{
+ attendanceForm.workHours = computeWorkHours(attendanceForm.checkIn, attendanceForm.checkOut)
+ personalAttendanceRecordsUpdate(attendanceForm)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鑰冨嫟璁板綍鏇存柊鎴愬姛')
+ getPersonalAttendanceRecordsList()
+ showAttendanceDialog.value = false
+ // 閲嶇疆琛ㄥ崟
+ attendanceForm.date = ''
+ attendanceForm.checkIn = ''
+ attendanceForm.checkOut = ''
+ attendanceForm.status = '姝e父'
+ }
+ }).catch(err => {
+ ElMessage.error('鑰冨嫟璁板綍鏇存柊澶辫触')
+ })
+ }
+ // attendanceFormRef.value.validate((valid) => {
+ // if (!valid) return
+
+
+ // })
+}
+// 鍒犻櫎鑰冨嫟璁板綍
+const deleteAttendanceRecord = (row) => {
+
+ ElMessageBox.confirm('纭畾鍒犻櫎璇ヨ�冨嫟璁板綍鍚楋紵', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ personalAttendanceRecordsDelete(row.id)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鑰冨嫟璁板綍鍒犻櫎鎴愬姛')
+ getPersonalAttendanceRecordsList()
+ }
+ }).catch(err => {
+ ElMessage.error('鑰冨嫟璁板綍鍒犻櫎澶辫触')
+ })
+ }).catch(() => {
+ ElMessage({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ })
})
}
-
-// 缂栬緫鑰冨嫟璁板綍
-const editAttendanceRecord = (row) => {
- ElMessage.info('缂栬緫鍔熻兘寮�鍙戜腑...')
+// 鐢宠鍋囨湡
+const openLeaveForm = () => {
+ leaveOperationType.value = 'add'
+ showLeaveDialog.value = true
+ // leaveForm.type = ''
+ // leaveForm.startDate = ''
+ // leaveForm.endDate = ''
+ // leaveForm.days = 0
+ // leaveForm.reason = ''
+ // leaveForm.status = 'warning'
}
-
-// 鍒犻櫎鑰冨嫟璁板綍
-const deleteAttendanceRecord = (index) => {
- attendanceData.value.splice(index, 1)
- ElMessage.success('鑰冨嫟璁板綍鍒犻櫎鎴愬姛')
-}
-
// 缂栬緫鍋囨湡璁板綍
const editLeaveRecord = (row) => {
- ElMessage.info('缂栬緫鍔熻兘寮�鍙戜腑...')
+ leaveOperationType.value = 'edit'
+ showLeaveDialog.value = true
+ Object.assign(leaveForm, row)
+ // ElMessage.info('缂栬緫鍔熻兘寮�鍙戜腑...')
}
// 鍒犻櫎鍋囨湡璁板綍
-const deleteLeaveRecord = (index) => {
- leaveData.value.splice(index, 1)
- ElMessage.success('鍋囨湡璁板綍鍒犻櫎鎴愬姛')
+const deleteLeaveRecord = (row) => {
+ ElMessageBox.confirm('纭畾鍒犻櫎璇ュ亣鏈熻褰曞悧锛�', '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ holidayApplicationDelete(row.id)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鍋囨湡璁板綍鍒犻櫎鎴愬姛')
+ getHolidayApplicationList()
+ }
+ }).catch(err => {
+ ElMessage.error('鍋囨湡璁板綍鍒犻櫎澶辫触')
+ })
+ }).catch(() => {
+ ElMessage({
+ type: 'info',
+ message: '宸插彇娑堝垹闄�'
+ })
+ })
+}
+
+//璁$畻鍋囨湡澶╂暟
+const calculateDays = () => {
+ try {
+ if (leaveForm.startDate && leaveForm.endDate) {
+ const start = new Date(leaveForm.startDate)
+ const end = new Date(leaveForm.endDate)
+ leaveForm.startDate = start.toISOString().split('T')[0]
+ leaveForm.endDate = end.toISOString().split('T')[0]
+
+ if (isNaN(start.getTime()) || isNaN(end.getTime())) {
+ console.warn('鏃犳晥鐨勬棩鏈熸牸寮�')
+ return
+ }
+
+ const diffTime = Math.abs(end - start)
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1
+ leaveForm.days = diffDays
+ }
+ } catch (error) {
+ console.error('璁$畻澶╂暟澶辫触:', error)
+ }
}
// 鎻愪氦鍋囨湡鐢宠
const submitLeaveApplication = () => {
- if (!leaveForm.type || !leaveForm.startDate || !leaveForm.endDate || !leaveForm.reason) {
- ElMessage.warning('璇峰~鍐欏畬鏁翠俊鎭�')
- return
- }
-
- const newLeave = {
+ if (leaveOperationType.value === 'add') {
+ if (!leaveForm.type || !leaveForm.startDate || !leaveForm.endDate || !leaveForm.reason) {
+ ElMessage.warning('璇峰~鍐欏畬鏁翠俊鎭�')
+ return
+ }
+ calculateDays()
+ const newLeave = {
type: leaveForm.type,
startDate: leaveForm.startDate,
endDate: leaveForm.endDate,
- days: 3, // 绠�鍗曡绠�
+ days: leaveForm.days, // 绠�鍗曡绠�
reason: leaveForm.reason,
status: '瀹℃壒涓�'
+ }
+
+ holidayApplicationAdd(newLeave)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鍋囨湡鐢宠鎻愪氦鎴愬姛')
+ getHolidayApplicationList()
+ showLeaveDialog.value = false
+ // 閲嶇疆琛ㄥ崟
+ Object.keys(leaveForm).forEach(key => {
+ leaveForm[key] = ''
+ })
+ }
+ }).catch(err => {
+ ElMessage.error('鍋囨湡鐢宠鎻愪氦澶辫触')
+ })
+ }else{
+ calculateDays()
+ holidayApplicationUpdate(leaveForm)
+ .then(res => {
+ if (res.code === 200) {
+ ElMessage.success('鍋囨湡鐢宠鏇存柊鎴愬姛')
+ getHolidayApplicationList()
+ showLeaveDialog.value = false
+ // 閲嶇疆琛ㄥ崟
+ Object.keys(leaveForm).forEach(key => {
+ leaveForm[key] = ''
+ })
+ }
+ }).catch(err => {
+ ElMessage.error('鍋囨湡鐢宠鏇存柊澶辫触')
+ })
}
-
- leaveData.value.unshift(newLeave)
- showLeaveDialog.value = false
-
- // 閲嶇疆琛ㄥ崟
- Object.keys(leaveForm).forEach(key => {
- leaveForm[key] = ''
+}
+
+// 鑾峰彇涓汉淇℃伅
+const getProfile = () => {
+ tableLoading.value = true;
+ getUserProfile().then(res => {
+ if (res.code === 200) {
+ currentUser.value = res.data
+ // console.log("----",currentUser.value)
+ //寰楀埌浜哄憳鍒楄〃
+ staffJoinListPage({staffState: 1}).then(res => {
+ //绛涢�夊嚭鍜宑urrentUser鍚屽悕鐨勪汉鍛�
+ // let tableData = res.data.records
+ user.value = res.data.records.find(item => item.staffName === currentUser.value.userName)
+ // console.log("++++",user.value)
+ if(user.value){
+ profile.value.id=user.value.id
+ profile.value.name=user.value.staffName
+ profile.value.employeeId=user.value.staffNo
+ profile.value.phone=user.value.phone
+ profile.value.email=currentUser.value.email
+ profile.value.adress=user.value.adress
+ profile.value.position=user.value.postJob
+ profile.value.hireDate=user.value.createTime
+ profile.value.department=currentUser.value.deptNames
+ }
+ // console.log(profile.value)
+ // tableLoading.value = false;
+ }).catch(err => {})
+ }
+ }).catch(err => {
+ tableLoading.value = false;
+ ElMessage.error('鑾峰彇涓汉淇℃伅澶辫触')
})
-
- ElMessage.success('鍋囨湡鐢宠鎻愪氦鎴愬姛')
}
-
// 淇濆瓨涓汉淇℃伅
-const saveProfile = () => {
- Object.assign(profile.value, profileForm)
- editProfile.value = false
- ElMessage.success('涓汉淇℃伅淇濆瓨鎴愬姛')
-}
+const saveProfile = async () => {
+ tableLoading.value = true;
+ try {
+ const userRes = await getUserProfile();
+ if (userRes.code === 200) {
+ currentUser.value = userRes.data;
+ const staffListRes = await staffJoinListPage({ staffState: 1 });
+ user.value = staffListRes.data.records.find(item => item.staffName === currentUser.value.userName);
+ // console.log("++++", user.value);
-// 鍒濆鍖栦釜浜轰俊鎭〃鍗�
-const initProfileForm = () => {
+ Object.assign(joinForm, user.value);
+ joinForm.staffName = profileForm.name;
+ joinForm.phone = profileForm.phone;
+ joinForm.email = profileForm.email;
+ joinForm.adress = profileForm.adress;
+ console.log(joinForm)
+ // 璋冪敤鏇存柊涓汉淇℃伅鐨勬帴鍙�
+ staffJoinUpdate(joinForm).then(res => {
+ if (res.code === 200) {
+ ElMessage.success('涓汉淇℃伅淇濆瓨鎴愬姛');
+ getProfile();
+ editProfile.value = false;
+ }
+ }).catch(err => {
+ ElMessage.error('涓汉淇℃伅淇濆瓨澶辫触');
+ })
+ }
+ } catch (err) {
+ ElMessage.error('鑾峰彇涓汉淇℃伅澶辫触');
+ } finally {
+ tableLoading.value = false;
+ }
+};
+
+// 缂栬緫涓汉淇℃伅
+const editProfileForm = () => {
+ editProfile.value = true;
Object.assign(profileForm, {
name: profile.value.name,
phone: profile.value.phone,
email: profile.value.email,
- address: profile.value.address
+ adress: profile.value.adress,
+ });
+};
+
+//鏈堜唤鏀瑰彉
+const changMonth = () => {
+ getCompensationList()
+}
+//鑾峰彇鑰冨嫟璁板綍鍒楄〃
+const getPersonalAttendanceRecordsList = async () => {
+ tableLoading.value = true
+ personalAttendanceRecordsListPage(page)
+ .then(res => {
+
+ attendanceData.value = res.data.records
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+
+ }).catch(err => {
+ tableLoading.value = false;
})
}
+//钖祫鍗曟煡璇�
+const getCompensationList = async () => {
+ tableLoading.value = true
+ compensationListPage({...page,payDateStr:payDateStr.value})
+ .then(res => {
+ salaryData.value = res.data.records
+ //杩囨护鍑哄綋鍓嶆湀浠界殑鎵f鍚堣
+ salaryData.value.forEach(item => {
+ item.deduction =0 + item.deductionAbsenteeism+item.sickLeaveDeductions+item.deductionPersonalLeave+item.forgetClockDeduct,
+ item.bonus=0,
+ item.status='宸插彂鏀�'
+ })
-// 鐩戝惉缂栬緫涓汉淇℃伅寮圭獥
-watch(editProfile, (val) => {
- if (val) {
- initProfileForm()
- }
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+ }).catch(err => {
+ tableLoading.value = false;
+ })
+}
+//鑾峰彇鍋囨湡鐢宠鍒楄〃
+const getHolidayApplicationList = async () => {
+ tableLoading.value = true
+ holidayApplicationListPage(page)
+ .then(res => {
+ leaveData.value = res.data.records
+ page.value.total = res.data.total;
+ tableLoading.value = false;
+ }).catch(err => {
+ tableLoading.value = false;
+ })
+}
+onMounted(() => {
+ // 鍒濆鍖�
+ getPersonalAttendanceRecordsList()
+ getCompensationList()
+ getHolidayApplicationList()
+ getProfile()
})
</script>
--
Gitblit v1.9.3