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/rpaManagement/index.vue | 195 ++++++++++++++++++------------------------------ 1 files changed, 75 insertions(+), 120 deletions(-) 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