luohairen
2024-11-25 2d0dd4f12d0f58c45e8c1de919b689bd97b88b08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
    <div>
        <div class="search-bar">
            <div>
                <label>流程名称</label>
                <el-input type="text" v-model="searchParams.name" size="small"/>
            </div>
            <div>
                <!-- <el-button type="success" @click="search">搜索</el-button>
                <el-button type="warning" @click="reset">重置</el-button> -->
                <el-button type="primary" @click="search" size="mini" icon="el-icon-search">搜索</el-button>
                <el-button type="default" @click="reset" size="mini" icon="el-icon-refresh">重置</el-button>
            </div>
        </div>
        <table-template :data="tableData" row-key="executionId" no-page>
            <template #columns>
                <el-table-column
                    prop="executionId"
                    label="执行实例编号">
                </el-table-column>
                <el-table-column
                    prop="name"
                    label="流程名称">
                </el-table-column>
                <el-table-column
                    prop="currentTask"
                    label="当前节点">
                </el-table-column>
                <el-table-column
                    prop="active"
                    label="是否激活">
                </el-table-column>
                <el-table-column
                    prop="suspended"
                    label="是否挂起">
                </el-table-column>
                <el-table-column
                    prop="startTime"
                    label="开始时间">
                </el-table-column>
                <el-table-column
                    prop="startUserId"
                    label="发起人">
                </el-table-column>
            </template>
        </table-template>
    </div>
</template>
 
<script>
import TableTemplate from "@/components/TableTemplate";
import {getListExecutions} from "./api";
import commonUtil from "@/utils/common"
 
export default {
    name: "RunInstance",
    components: {
        TableTemplate
    },
    data() {
        return {
            tableData: [],
            searchParams: {
                name: ""
            }
        };
    },
    mounted() {
       this.getListExecutionsByParamsAndRender(this.searchParams);
    },
    methods: {
        search() {
            this.getListExecutionsByParamsAndRender(this.searchParams);
        },
        reset() {
            this.searchParams.name = "";
            this.getListExecutionsByParamsAndRender(this.searchParams);
        },
        getListExecutionsByParamsAndRender(params) {
            const {
                name = "",
            } = params;
            let requestParams;
            if (name) {
                requestParams = {name};
            }
            getListExecutions(requestParams).then(res => {
                res = res.map(item => {
                    return {
                        ...item,
                        active: item.active ? "是" : "否",
                        suspended: item.suspended ? "是" : "否"
                    };
                });
                const tree = commonUtil.listToTree(res);
                this.tableData = tree;
            });
        }
    }
};
</script>
 
<style scoped>
.search-bar {
    display: flex;
    margin-top: 8px;
    margin-left: 8px;
}
.search-bar > *{
    margin-right: 8px;
}
.search-bar .el-input {
    display: inline-block;
    width: 300px;
    margin-right: 10px;
}
.search-bar label {
    font-size: 14px;
    color: #606266;
    margin-right: 8px;
}
</style>