From 6d8e930f8a93d1d15b9e9a6e30536902f1aeeb86 Mon Sep 17 00:00:00 2001 From: yaowanxin <3588231647@qq.com> Date: 星期四, 04 九月 2025 10:06:41 +0800 Subject: [PATCH] 行政管理的通知、会议、文件共享 --- src/views/collaborativeApproval/notificationManagement/index.vue | 269 ++++++++++--------- src/api/collaborativeApproval/knowledgeBase.js | 55 ++++ src/api/collaborativeApproval/rpaManagement.js | 13 src/views/collaborativeApproval/knowledgeBase/index.vue | 170 +++++------- src/views/collaborativeApproval/rpaManagement/index.vue | 195 +++++--------- src/api/collaborativeApproval/notificationManagement.js | 63 ++++ 6 files changed, 414 insertions(+), 351 deletions(-) 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/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/views/collaborativeApproval/knowledgeBase/index.vue b/src/views/collaborativeApproval/knowledgeBase/index.vue index f944859..f199321 100644 --- a/src/views/collaborativeApproval/knowledgeBase/index.vue +++ b/src/views/collaborativeApproval/knowledgeBase/index.vue @@ -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: "", @@ -400,47 +401,47 @@ ]); // 妯℃嫙鏁版嵁 -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" - } -]; +// 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 = [ @@ -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, @@ -697,47 +689,29 @@ // 鎻愪氦鐭ヨ瘑琛ㄥ崟 const submitForm = async () => { try { - await formRef.value.validate(); - + 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); } diff --git a/src/views/collaborativeApproval/notificationManagement/index.vue b/src/views/collaborativeApproval/notificationManagement/index.vue index 288acf1..9667d94 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: "", @@ -556,47 +562,6 @@ ] } ]); - -// 妯℃嫙鏁版嵁 -let mockData = [ - { - id: "1", - title: "2024骞存槬鑺傛斁鍋囬�氱煡", - type: "holiday", - priority: "high", - status: "published", - content: "鏍规嵁鍥藉瑙勫畾锛岀粨鍚堝叕鍙稿疄闄呮儏鍐碉紝鐜板皢2024骞存槬鑺傛斁鍋囧畨鎺掗�氱煡濡備笅...", - departments: ["鎶�鏈儴", "閿�鍞儴", "浜轰簨閮�", "璐㈠姟閮�", "杩愯惀閮�", "甯傚満閮�", "瀹㈡湇閮�"], - expireDate: "2024-02-15", - syncMethods: ["wechat", "dingtalk", "email"], - createTime: "2024-01-15 10:30:00" - }, - { - id: "2", - title: "鎶�鏈儴鍛ㄤ緥浼氶�氱煡", - type: "meeting", - priority: "medium", - status: "published", - content: "鎶�鏈儴瀹氫簬姣忓懆浜斾笅鍗�2鐐瑰彫寮�鍛ㄤ緥浼氾紝璇峰悇浣嶅悓浜嬪噯鏃跺弬鍔�...", - departments: ["鎶�鏈儴"], - expireDate: "2024-01-20", - syncMethods: ["wechat", "dingtalk"], - createTime: "2024-01-14 15:20:00" - }, - { - id: "3", - title: "鍛樺伐琛屼负瑙勮寖澶勭綒閫氱煡", - type: "penalty", - priority: "high", - status: "draft", - content: "涓虹淮鎶ゅ叕鍙告甯哥З搴忥紝瑙勮寖鍛樺伐琛屼负锛岀幇瀵硅繚鍙嶅叕鍙歌瀹氱殑琛屼负杩涜澶勭綒...", - departments: ["浜轰簨閮�", "鎶�鏈儴", "閿�鍞儴"], - expireDate: "2024-02-13", - syncMethods: ["wechat", "email"], - createTime: "2024-01-13 09:15:00" - } -]; - // 閫氱煡鏍囬妯℃澘 const titleTemplates = [ "鍏充簬{year}骞磠holiday}鏀惧亣瀹夋帓鐨勯�氱煡", @@ -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 || [] }); } @@ -947,40 +906,27 @@ 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); } @@ -998,17 +944,23 @@ 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 : '鏈煡浜哄憳'; @@ -1027,20 +979,26 @@ // 灏嗕細璁俊鎭坊鍔犲埌閫氱煡鍒楄〃 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); } @@ -1062,7 +1020,7 @@ }; fileList.value.push(fileInfo); - fileShareForm.value.files.push(fileInfo); + fileShareForm.value.files.push(fileInfo.name); return false; // 闃绘鑷姩涓婁紶 }; @@ -1094,15 +1052,22 @@ description: fileShareForm.value.description, departments: fileShareForm.value.departments, files: fileShareForm.value.files, - shareId: `FILE${Date.now()}` }; + 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}锛屽凡閫氱煡鐩稿叧閮ㄩ棬`); - fileShareDialogVisible.value = false; + // 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() }; + addNotification({...fileShareNotification}).then(res => { + if(res.code == 200){ + ElMessage.success("娣诲姞鎴愬姛"); + // dialogVisible.value = false; + getList(); + } + }).catch(err => { + ElMessage.error(err.msg); + }) - mockData.unshift(fileShareNotification); - getList(); + // 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/rpaManagement/index.vue b/src/views/collaborativeApproval/rpaManagement/index.vue index 51cef73..81cde62 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: "2024-01-15 10:30:00" - }, - { - id: "2", - programName: "搴撳瓨鍚屾RPA", - status: "stopped", - description: "鍚屾澶氫釜浠撳簱鐨勫簱瀛樻暟鎹紝纭繚鏁版嵁涓�鑷存��", - createTime: "2024-01-14 15:20:00" - }, - { - id: "3", - programName: "鎶ヨ〃鐢熸垚RPA", - status: "error", - description: "鑷姩鐢熸垚姣忔棩閿�鍞姤琛ㄥ拰搴撳瓨鎶ヨ〃", - createTime: "2024-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,7 +240,7 @@ // 閫夋嫨鍙樺寲澶勭悊 const handleSelectionChange = (selection) => { - selectedIds.value = selection.map(item => item.id); + selectedRows.value = selection; }; // 鎵撳紑琛ㄥ崟 @@ -287,13 +250,6 @@ if (type === "add") { dialogTitle.value = "娣诲姞RPA"; - form.value = { - id: "", - programName: "", - status: "stopped", - description: "", - createTime: "", - }; } else { dialogTitle.value = "缂栬緫RPA"; form.value = { ...row }; @@ -309,27 +265,32 @@ 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,26 @@ // 鍒犻櫎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) => { + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + getList(); + }) + }) + .catch(() => { + proxy.$modal.msg("宸插彇娑�"); + }); }; </script> -- Gitblit v1.9.3