whyczyk
2021-11-05 d291d4b450aab57b6c98cd0637f8b43f55bc370b
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<template>
    <div class="nodeManageWarp">
        <flex-layout class="list-contain">
            <div class="scroll">
                <el-table :data="tableData" stripe border style="width: 100%">
                    <el-table-column prop="linkName" label="节点名称">
                    </el-table-column>
                    <el-table-column prop="linkLevel" label="节点层级">
                    </el-table-column>
                    <el-table-column prop="roleListName" label="节点所含角色">
                    </el-table-column>
                    <el-table-column prop="typeName" label="所属工单类型">
                    </el-table-column>
                    <el-table-column fixed="right" label="操作">
                        <template slot-scope="scope">
                            <el-button type="text" style="margin-right:8px;" @click="toAddPage(scope.row)">编辑</el-button>
                            <el-popconfirm title="确定删除该节点吗?" @confirm="remove(scope.row)">
                                <el-button slot="reference" type="text">删除</el-button>
                            </el-popconfirm>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <!-- 分页 -->
            <div class="pagination" slot="footer">
                <!-- <el-button type="primary" size="mini" icon="el-icon-arrow-left">上一页</el-button>
                <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page.currentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="page.total">
                </el-pagination>
                <el-button type="primary" size="mini" icon="el-icon-arrow-right">下一页</el-button> -->
                <el-button type="primary" size="mini" icon="el-icon-circle-plus-outline" @click="toAddPage">新增节点</el-button>
            </div>
        </flex-layout>
    </div>
</template>
 
<script>
import {
    getPropertyList,
    delWorkflowProperty
} from '../js/api';
import {
    workType,
    linkLevel
} from '@/assets/js/constants';
export default {
    data() {
        return {
            tableData: [],
            page: {
                currentPage: 1,
                pageSizes: [1, 5, 10, 20],
                pageSize: 5,
                total: 0
            }
        }
    },
    mounted() {
        this.loadList()
    },
    methods: {
        loadList() {
            getPropertyList().then((res) => {
                if (res.data.code == 1) {
                    let resData = res.data.data;
                    let arr = [];
                    resData.map(item => {
                        let roleListName = '';
                        item.roleList.map(jtem => {
                            roleListName += jtem.name + ','
                        })
                        let obj = {
                            linkName: item.linkName,
                            linkType: item.linkType,
                            linkLevel: linkLevel[item.linkType],
                            roleList: item.roleList,
                            roleListName: roleListName,
                            typeName: workType[item.type],
                            type: item.type,
                        }
                        arr.push(obj)
                    })
                    this.tableData = arr
                }
            }).catch((err) => {
                console.log(err)
            });
        },
        remove(rowData) {
            let postData = {
                linkType: rowData.linkType,
                type: rowData.type,
            }
            delWorkflowProperty(postData).then((res) => {
                if (res.data.code == 1) {
                    this.loadList()
                    this.$message({
                        message: '删除成功!',
                        type: 'success'
                    });
                }
            }).catch((err) => {
                console.log(err)
            });
        },
        toAddPage(data) {
            if (data) {
                this.$router.push({
                    path: '/manage/addNode',
                    query: { data: JSON.stringify(data) }
                })
            } else {
                this.$router.push({
                    path: '/manage/addNode',
                })
            }
        }
    }
}
</script>
 
<style scoped>
.nodeManageWarp {
    padding: 16px 0 0 16px;
    width: 100%;
    height: 100%;
}
.list-contain {
    background: #fff;
    border: 1px #c4c4c4 solid;
    padding: 30px 0 10px 30px;
}
.scroll {
    overflow-y: auto;
    padding-right: 30px;
}
 
.pagination {
    display: flex;
    padding-top: 10px;
    justify-content: center;
}
>>> .el-pagination {
    display: flex;
    padding: 0 1em;
}
>>> .el-pagination .el-input__inner {
    background: #343345;
    color: #fff;
}
>>> .el-input {
    width: 30em;
}
>>> .el-textarea {
    width: 40em;
}
>>> .el-select .el-input {
    width: 16em;
}
>>> .el-pagination .el-input {
    width: auto;
}
</style>