<!--
|
* @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;" @click="debugerBtn">调试</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.configEntity != null">
|
<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 ,2)"><el-icon><EditPen /></el-icon>编辑</span>
|
<span @click="table_del(item,index)"><el-icon><Delete /></el-icon>删除</span>
|
</div>
|
</div>
|
<div class="conBottom" v-if="item.configEntity == null">
|
<el-button type="primary" plain style="margin-left: 20px;" @click="table_edit(item, index ,1)">新增配置</el-button>
|
</div>
|
</div>
|
</div>
|
<save-dialog v-if="dialog.save" ref="saveDialog" @success="addconfigSuccess" @closed="dialog.save=false"></save-dialog>
|
<save-debug v-if="dialog.debugging" ref="saveDebugging" @success="adddebugSuccess" @closed="dialog.debugging=false"></save-debug>
|
</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'
|
import saveDebug from './sendDebug'
|
export default {
|
name: "configuration",
|
data(){
|
return {
|
dialog: {
|
save: false,
|
debugging: false
|
},
|
tableData: []
|
}
|
},
|
created(){
|
|
},
|
mounted(){
|
this.getConfiguration();
|
},
|
components: {
|
...ElementPlusIconsVue,saveDialog,saveDebug
|
},
|
methods: {
|
table_del(item,index) {
|
this.$confirm(`确定将选择数据删除?`, '', {
|
type: 'warning'
|
}).then(() => {
|
this.$HTTP.delete(`/api/blade-notify/notifier/config/${item.configEntity.id}`).then(res=> {
|
if(res.code == 200) {
|
this.getConfiguration();
|
}else {
|
this.$message.error(res.msg);
|
}
|
})
|
}).catch(() => {
|
|
})
|
},
|
table_edit(row,index,type){
|
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/config/sms/aliyunSms/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);
|
if(type == 1) {
|
this.$refs.saveDialog.open('add',obj);
|
}else if(type == 2) { //编辑
|
this.$refs.saveDialog.open('edit',{}).setData(obj);
|
}
|
})
|
}
|
})
|
},
|
debugerBtn() {
|
this.dialog.debugging = true;
|
this.$nextTick(() => {
|
this.$refs.saveDebugging.open(this.tableData);
|
})
|
},
|
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.getConfiguration();
|
},
|
adddebugSuccess() {
|
|
}
|
}
|
}
|
</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>
|