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 ++++++++++++++++++++++++++++------------------------- 1 files changed, 142 insertions(+), 127 deletions(-) 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(() => { // 鐢ㄦ埛鍙栨秷 }); -- Gitblit v1.9.3