1
lzhe
2024-05-11 a896f3781d29ef58564929cfceeb078a87d01d6a
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
163
164
165
<!--
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-11 11:31:56
 * @FilePath: /smart-web/src/views/master/person/main/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div class="aposcope-main">
        <div class="debugging">
            <el-button type="primary" plain style="width: 80px;">调试</el-button>
        </div>
        <div class="conList" v-for="item in tableData">
            <div class="conTop">
                <span class="titile">{{item.name}}</span>
            </div>
            <div class="conBottom" v-if="item.isBindBusiness">
                <div class="first">
                    <div>{{item.id == "internalMessage"?"站内信配置":"配置名称"}}</div>
                </div> 
                <div class="second">
                    <div>{{item.pname}}</div>
                </div>
                <div class="thrid" v-if="item.id != 'internalMessage'">
                    <span @click="table_edit(item, index)"><el-icon><EditPen /></el-icon>编辑</span>
                    <span><el-icon><Delete /></el-icon>删除</span>
                </div>
            </div>
            <div class="conBottom" v-if="!item.isBindBusiness">
                <el-button type="primary" plain style="margin-left: 20px;" @click="addallocation">新增配置</el-button>
            </div>
        </div>
    </div>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="addconfigSuccess" @closed="dialog.save=false"></save-dialog>
</template>
<script>
    import * as ElementPlusIconsVue from '@element-plus/icons-vue'
    let icons = []
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
        icons.push(key)
    }
    import saveDialog from './editconfiguration'
    export default {
        name: "configuration",
        data(){
            return {
                dialog: {
                    save: false
                },
                tableData: []
            }
        },
        created(){
            
        },
        mounted(){
            this.getConfiguration();
        },
        components: {
            ...ElementPlusIconsVue,saveDialog
        },
        methods: {
            addallocation() {
                ///api/blade-notify/notifier/config/sms/aliyunSms/metadata
            },
            table_edit(row){
                if(row.name == "钉钉") {
                    var url = `/api/blade-notify/notifier/config/dingTalk/dingTalkMessage/metadata`;
                }else if(row.name == "企业微信") {
                    var url = `/api/blade-notify/notifier/config/weiXinQY/qyTextMessage/metadata`;
                }else if(row.name == "站内信") {
                    //var url = `/api/blade-notify/notifier/template/internalMessage/systemDefault/config/metadata`;
                }else if(row.name == "邮件") {
                    var url = `/api/blade-notify/notifier/config/email/embedded/metadata`;
                }
                this.dialog.save = true
                this.$HTTP.get(url).then(res=> {
                    if(res.code == 200) {
                        this.dialog.save = true;
                        this.$nextTick(() => {
                            var obj = Object.assign(res.data,row);
                            this.$refs.saveDialog.open('edit').setData(obj);
                        })
                    }
                })
            },
            getConfiguration() {
                this.$HTTP.get(`/api/blade-notify/notifier/config/service-list`).then(res=> {
                    if(res.code == 200) {
                        res.data.forEach(item=> {
                            if(item.configEntity != null) {
                                item.pname = item.configEntity.name;
                            }else {
                                item.pname = "";
                            }
                        })
                        this.tableData = res.data;
                    }
                })
            },
            addconfigSuccess() {
                this.getbusiness();
            }
        }
    }
</script>
<style scoped>
.aposcope-main {
    min-height: 100%;
    margin: 8px;
    background-color: #fff;
    padding-top: 20px;
    padding-bottom: 20px;
}
.conList {
    margin: 0 16px 24px 16px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
    padding: 23px 0 15px 16px;
    box-sizing: border-box;
    height: 126px;
    width: 47%;
    position: relative;
    float: left;
}
.conTop {
    font-size: 18px;
}
.conBottom {
    display: flex;
    margin-top: 20px;
    position: absolute;
    width: 100%;
    bottom: 20px;
    left:0;
}
.conList .conBottom .first {
    width: 20%;
    padding-left: 30px;
}
.conList .conBottom div {
    font-weight: 400;
    font-size: 16px;
    text-align: left;
    color: #333;
}
.conList .conBottom .second {
    width: 60%;
    justify-content: flex-start;
}
.conList .conBottom .thrid {
    width: 20%;
    cursor: pointer;
}
.conList .conBottom .thrid span:nth-child(1) {
    margin-right: 16px;
}
.debugging {
    text-align: right;
    margin-bottom: 20px;
    margin-right: 30px;
}
</style>