From c8b65690b946b28b179796fbe2f020e732043c58 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 08 一月 2026 18:10:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_天津军泰伟业' into dev_天津军泰伟业
---
src/views/collaborativeApproval/rpaManagement/index.vue | 714 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 357 insertions(+), 357 deletions(-)
diff --git a/src/views/collaborativeApproval/rpaManagement/index.vue b/src/views/collaborativeApproval/rpaManagement/index.vue
index 63b9bd0..8e1a148 100644
--- a/src/views/collaborativeApproval/rpaManagement/index.vue
+++ b/src/views/collaborativeApproval/rpaManagement/index.vue
@@ -3,84 +3,93 @@
<div class="search_form">
<div>
<span class="search_title">绋嬪簭鍚嶏細</span>
- <el-input
- v-model="searchForm.programName"
- style="width: 240px"
- placeholder="璇疯緭鍏ョ▼搴忓悕鎼滅储"
- @change="handleQuery"
- clearable
- :prefix-icon="Search"
- />
+ <el-input v-model="searchForm.programName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ョ▼搴忓悕鎼滅储"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
<span class="search_title ml10">鎵ц鐘舵�侊細</span>
- <el-select v-model="searchForm.status" clearable @change="handleQuery" style="width: 240px">
- <el-option label="杩愯涓�" :value="'running'" />
- <el-option label="宸插仠姝�" :value="'stopped'" />
- <el-option label="寮傚父" :value="'error'" />
+ <el-select v-model="searchForm.status"
+ clearable
+ @change="handleQuery"
+ style="width: 240px">
+ <el-option label="杩愯涓�"
+ :value="'running'" />
+ <el-option label="宸插仠姝�"
+ :value="'stopped'" />
+ <el-option label="寮傚父"
+ :value="'error'" />
</el-select>
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">
鎼滅储
</el-button>
</div>
<div>
- <el-button type="primary" @click="openForm('add')">鏂板</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
+ <el-button @click="handleExport"
+ style="margin-right: 10px">瀵煎嚭</el-button>
+ <el-button type="primary"
+ @click="openForm('add')">鏂板</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
<div class="table_list">
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :page="page"
- :isSelection="true"
- @selection-change="handleSelectionChange"
- :tableLoading="tableLoading"
- @pagination="pagination"
- :total="page.total"
- ></PIMTable>
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total"></PIMTable>
</div>
-
<!-- RPA琛ㄥ崟寮圭獥 -->
- <el-dialog
- v-model="dialogVisible"
- :title="dialogTitle"
- width="500px"
- :close-on-click-modal="false"
- >
- <el-form
- ref="formRef"
- :model="form"
- :rules="rules"
- label-width="100px"
- >
- <el-form-item label="绋嬪簭鍚�" prop="programName">
- <el-input
- v-model="form.programName"
- placeholder="璇疯緭鍏ョ▼搴忓悕"
- clearable
- />
+ <el-dialog v-model="dialogVisible"
+ :title="dialogTitle"
+ width="500px"
+ :close-on-click-modal="false">
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="100px">
+ <el-form-item label="绋嬪簭鍚�"
+ prop="programName">
+ <el-input v-model="form.programName"
+ placeholder="璇疯緭鍏ョ▼搴忓悕"
+ clearable />
</el-form-item>
- <el-form-item label="鎵ц鐘舵��" prop="status">
- <el-select v-model="form.status" placeholder="璇烽�夋嫨鎵ц鐘舵��" style="width: 100%">
- <el-option label="杩愯涓�" value="running" />
- <el-option label="宸插仠姝�" value="stopped" />
- <el-option label="寮傚父" value="error" />
+ <el-form-item label="鎵ц鐘舵��"
+ prop="status">
+ <el-select v-model="form.status"
+ placeholder="璇烽�夋嫨鎵ц鐘舵��"
+ style="width: 100%">
+ <el-option label="杩愯涓�"
+ value="running" />
+ <el-option label="宸插仠姝�"
+ value="stopped" />
+ <el-option label="寮傚父"
+ value="error" />
</el-select>
</el-form-item>
- <el-form-item label="鎻忚堪" prop="description">
- <el-input
- v-model="form.description"
- type="textarea"
- :rows="3"
- placeholder="璇疯緭鍏PA绋嬪簭鎻忚堪"
- clearable
- />
+ <el-form-item label="鎻忚堪"
+ prop="description">
+ <el-input v-model="form.description"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏PA绋嬪簭鎻忚堪"
+ clearable />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
+ <el-button type="primary"
+ @click="submitForm">纭畾</el-button>
<el-button @click="dialogVisible = false">鍙栨秷</el-button>
- <el-button type="primary" @click="submitForm">纭畾</el-button>
</span>
</template>
</el-dialog>
@@ -88,313 +97,304 @@
</template>
<script setup>
-import { Search } from "@element-plus/icons-vue";
-import { onMounted, ref, reactive, toRefs } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
-import PIMTable from "@/components/PIMTable/PIMTable.vue";
-
-// 鍝嶅簲寮忔暟鎹�
-const data = reactive({
- searchForm: {
- programName: "",
- status: "",
- },
- form: {
- id: "",
- programName: "",
- status: "stopped",
- description: "",
- createTime: "",
- },
- dialogVisible: false,
- dialogTitle: "",
- dialogType: "add",
- selectedIds: [],
- tableLoading: false,
- page: {
- current: 1,
- size: 100,
- total: 0,
- },
- tableData: [],
-});
-
-const { searchForm, form, dialogVisible, dialogTitle, dialogType, selectedIds, tableLoading, page, tableData } = toRefs(data);
-
-// 琛ㄥ崟寮曠敤
-const formRef = ref();
-
-// 琛ㄥ崟楠岃瘉瑙勫垯
-const rules = {
- programName: [
- { required: true, message: "璇疯緭鍏ョ▼搴忓悕", trigger: "blur" }
- ],
- status: [
- { required: true, message: "璇烽�夋嫨鎵ц鐘舵��", trigger: "change" }
- ]
-};
-
-// 琛ㄦ牸鍒楅厤缃�
-const tableColumn = ref([
- {
- label: "绋嬪簭鍚�",
- prop: "programName",
- // width: 200,
- },
- {
- label: "鎵ц鐘舵��",
- prop: "status",
- dataType: "tag",
- // width: 120,
- formatData: (params) => {
- const statusMap = {
- running: "杩愯涓�",
- stopped: "宸插仠姝�",
- error: "寮傚父"
- };
- return statusMap[params] || params;
- },
- formatType: (params) => {
- const typeMap = {
- running: "success",
- stopped: "info",
- error: "danger"
- };
- return typeMap[params] || "info";
- }
- },
- {
- label: "鎻忚堪",
- prop: "description",
- // width: 300,
- showOverflowTooltip: true,
- },
- {
- label: "鍒涘缓鏃堕棿",
- prop: "createTime",
- // width: 180,
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 230,
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- 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'
- }
- ]
- }
-]);
-
-// 妯℃嫙鏁版嵁
-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(() => {
- getList();
-});
-
-// 鏌ヨ鏁版嵁
-const handleQuery = () => {
- 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;
- tableLoading.value = false;
- }, 500);
-};
-
-// 鍒嗛〉澶勭悊
-const pagination = (obj) => {
- page.value.current = obj.page;
- page.value.size = obj.limit;
- handleQuery();
-};
-
-// 閫夋嫨鍙樺寲澶勭悊
-const handleSelectionChange = (selection) => {
- selectedIds.value = selection.map(item => item.id);
-};
-
-// 鎵撳紑琛ㄥ崟
-const openForm = (type, row) => {
- dialogType.value = type;
- dialogVisible.value = true;
-
- if (type === "add") {
- dialogTitle.value = "娣诲姞RPA";
- form.value = {
- id: "",
+ import { Search } from "@element-plus/icons-vue";
+ import { onMounted, ref, reactive, toRefs, getCurrentInstance } 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: {
programName: "",
- status: "stopped",
+ status: "",
+ },
+ form: {
+ programName: "",
+ status: "",
description: "",
- createTime: "",
- };
- } else {
- dialogTitle.value = "缂栬緫RPA";
- form.value = { ...row };
- }
-};
+ },
+ dialogVisible: false,
+ dialogTitle: "",
+ dialogType: "add",
+ tableLoading: false,
+ page: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ tableData: [],
+ });
-// 鎻愪氦琛ㄥ崟
-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娣诲姞鎴愬姛");
+ const {
+ searchForm,
+ form,
+ dialogVisible,
+ dialogTitle,
+ dialogType,
+ selectedIds,
+ tableLoading,
+ page,
+ tableData,
+ } = toRefs(data);
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref();
+ // 閫夋嫨鐨勮鏁版嵁
+ const selectedRows = ref([]);
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ programName: [{ required: true, message: "璇疯緭鍏ョ▼搴忓悕", trigger: "blur" }],
+ status: [{ required: true, message: "璇烽�夋嫨鎵ц鐘舵��", trigger: "change" }],
+ };
+
+ // 琛ㄦ牸鍒楅厤缃�
+ const tableColumn = ref([
+ {
+ label: "绋嬪簭鍚�",
+ prop: "programName",
+ // width: 200,
+ },
+ {
+ label: "鎵ц鐘舵��",
+ prop: "status",
+ dataType: "tag",
+ // width: 120,
+ formatData: params => {
+ const statusMap = {
+ running: "杩愯涓�",
+ stopped: "宸插仠姝�",
+ error: "寮傚父",
+ };
+ return statusMap[params] || params;
+ },
+ formatType: params => {
+ const typeMap = {
+ running: "success",
+ stopped: "info",
+ error: "danger",
+ };
+ return typeMap[params] || "info";
+ },
+ },
+ {
+ label: "鎻忚堪",
+ prop: "description",
+ // width: 300,
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍒涘缓鏃堕棿",
+ prop: "createTime",
+ // width: 180,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 150,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ 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'
+ // }
+ ],
+ },
+ ]);
+
+ // 鐢熷懡鍛ㄦ湡
+ onMounted(() => {
+ getList();
+ });
+
+ // 鏌ヨ鏁版嵁
+ const handleQuery = () => {
+ // page.value.current = 1;
+ getList();
+ };
+
+ const getList = () => {
+ tableLoading.value = true;
+ listRpa({ ...page.value, ...searchForm.value })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+
+ // 鍒嗛〉澶勭悊
+ const pagination = obj => {
+ page.value.current = obj.page;
+ page.value.size = obj.limit;
+ handleQuery();
+ };
+
+ // 閫夋嫨鍙樺寲澶勭悊
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+
+ // 鎵撳紑琛ㄥ崟
+ const openForm = (type, row) => {
+ dialogType.value = type;
+ dialogVisible.value = true;
+
+ if (type === "add") {
+ dialogTitle.value = "娣诲姞RPA";
} else {
- // 缂栬緫RPA
- const index = mockData.findIndex(item => item.id === form.value.id);
- if (index !== -1) {
- mockData[index] = { ...form.value };
- ElMessage.success("RPA鏇存柊鎴愬姛");
- }
+ dialogTitle.value = "缂栬緫RPA";
+ form.value = { ...row };
}
-
- dialogVisible.value = false;
- getList();
- } catch (error) {
- console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
- }
-};
+ };
-// 寮�濮婻PA
-const handleStart = (row) => {
- ElMessageBox.confirm(`纭畾瑕佸惎鍔≧PA绋嬪簭"${row.programName}"鍚楋紵`, "鎻愮ず", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- row.status = "running";
- ElMessage.success("RPA鍚姩鎴愬姛");
- getList();
- }).catch(() => {
- // 鐢ㄦ埛鍙栨秷
- });
-};
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = async () => {
+ if (!formRef.value) return;
-// 鍋滄RPA
-const handleStop = (row) => {
- ElMessageBox.confirm(`纭畾瑕佸仠姝PA绋嬪簭"${row.programName}"鍚楋紵`, "鎻愮ず", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- }).then(() => {
- row.status = "stopped";
- ElMessage.success("RPA鍋滄鎴愬姛");
- getList();
- }).catch(() => {
- // 鐢ㄦ埛鍙栨秷
- });
-};
+ try {
+ await formRef.value.validate();
-// 鍒犻櫎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);
+ if (dialogType.value === "add") {
+ // 娣诲姞鏂癛PA
+ 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
+ updateRpa({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
}
- });
-
- ElMessage.success("鍒犻櫎鎴愬姛");
- selectedIds.value = [];
- getList();
- }).catch(() => {
- // 鐢ㄦ埛鍙栨秷
- });
-};
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ }
+ };
+
+ // 寮�濮婻PA
+ const handleStart = row => {
+ ElMessageBox.confirm(`纭畾瑕佸惎鍔≧PA绋嬪簭"${row.programName}"鍚楋紵`, "鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ row.status = "running";
+ ElMessage.success("RPA鍚姩鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷
+ });
+ };
+
+ // 鍋滄RPA
+ const handleStop = row => {
+ ElMessageBox.confirm(`纭畾瑕佸仠姝PA绋嬪簭"${row.programName}"鍚楋紵`, "鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ row.status = "stopped";
+ ElMessage.success("RPA鍋滄鎴愬姛");
+ getList();
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷
+ });
+ };
+
+ // 鍒犻櫎RPA
+ const handleDelete = () => {
+ let ids = [];
+ 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("宸插彇娑�");
+ });
+ };
+
+ // 瀵煎嚭鍔熻兘
+ const { proxy } = getCurrentInstance();
+ const handleExport = () => {
+ proxy.download(
+ "/rpaProcessAutomation/export",
+ { ...searchForm.value },
+ "RPA绠$悊.xlsx"
+ );
+ };
</script>
<style scoped></style>
--
Gitblit v1.9.3