作者 小范

路由配置新增功能--增加订阅者,删除订阅者,编辑

... ... @@ -150,4 +150,11 @@ export const api_getReceiverFileter = params =>{return http.get(`${baseUrl}/filt
export const api_putReceiverFileter = params =>{return http.put(`${baseUrl}/filter`, params);};
export const api_delReceiverFileter = params =>{return http.del(`${baseUrl}/filter`, params);};
//路由配置
//添加订阅者
export const addRcvrs = params =>{return http.post(`${baseUrl}/router/receiver`, params);};
//删除
export const delRcvr = params =>{return http.del(`${baseUrl}/router/receiver`, params);};
//编辑
export const ediRcvr = params =>{return http.put(`${baseUrl}/router/ediRouter`, params);};
... ...
... ... @@ -40,42 +40,44 @@
:data="umb_queryData.tableData"
border size="small"
:header-cell-style="{background:'#6F8294',color:'#FFFFFF'}"
style="border-radius: 10px 10px 0px 0px;line-height: 25px;">
style="border-radius: 10px 10px 0px 0px;line-height: 25px">
<el-table-column
prop="sndr"
label="帐户名称"
width="150"
width="80"
align="center"
>
</el-table-column>
<el-table-column
prop="btype"
label="消息大类"
width="120"
width="80"
align="center"
>
</el-table-column>
<el-table-column
prop="stype"
label="消息子类"
width="120"
width="80"
align="center"
>
</el-table-column>
<el-table-column
prop="rcvr_topic"
label="订阅者"
width="250"
width="300"
align="center"
>
<template slot-scope="scope">
<div v-for="reciver in scope.row.rcvrList" v-bind:key="reciver.id">
<template slot-scope="scope" style="text-align: right">
<div v-for="reciver in scope.row.rcvrList" v-bind:key="reciver.id" style="text-align: right;margin-right: 40px">
{{reciver.rcvrTopic}}
<el-button type="text" size="mini" @click="addReceiverFiletery(reciver.id)">[删除]</el-button><!--,{{reciver.filterList.filter}}-->
<el-button type="text" size="mini" @click="delReceiverFiletery(reciver.id)">[删除]</el-button><!--,{{reciver.filterList.filter}}-->
<el-button type="text" size="mini" @click="addReceiverFiletery(reciver.id)">[增加过滤]</el-button>
<!-- <div v-for="filters in reciver.filterList">{{filters.filter}}</div>-->
</div>
<el-button type="text" size="mini" @click="addReceiverFiletery()">[增加接收者]</el-button>
<div style="text-align: right;margin-right: 40px">
<el-button type="text" size="mini" @click="addRcvr(scope.$index,scope.row)">[增加订阅者]</el-button>
</div>
</template>
</el-table-column>
<el-table-column
... ... @@ -91,7 +93,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="250px" align="center" fixed="right">
<el-table-column label="操作" width="150px" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="editRouter(scope.$index,scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="delRouter(scope.$index,scope.row)">删除</el-button>
... ... @@ -113,6 +115,36 @@
</el-pagination>
</div>
</el-row>
<!-- 编辑-->
<el-row>
<el-dialog title="编辑" :visible.sync="dialogFormVisibles" width="70%" style="margin-top: -20px" text-align="center">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="145px"
class="demo-ruleForm" style="margin-top: -10px ;margin-left: -150px" align="center" >
<el-form-item label="" prop="sndr">
<el-input v-model="ruleForm.sndr" style="width:300px" size="small">
<template slot="prepend" >账户名称</template>
</el-input>
</el-form-item>
<el-form-item label="" prop="btype">
<el-input v-model="ruleForm.btype" style="width:300px" size="small">
<template slot="prepend" >消息大类</template>
</el-input>
</el-form-item>
<el-form-item label="" prop="stype">
<el-input v-model="ruleForm.stype" style="width:300px" size="small">
<template slot="prepend" >消息子类</template>
</el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" align="center">
<el-button @click="dialogFormVisibles = false" size="medium"
style="width: 100px;background-color: #6F8294;color: #ffffff">取 消</el-button>
<el-button type="primary" size="medium" style="width: 100px" @click="submitEdit('ruleForm')">确 定</el-button>
</div>
</el-dialog>
</el-row>
<!-- 添加/增加订阅者-->
<el-row>
<el-dialog :title="dialogMap[dialogStatus]" :visible.sync="dialogFormVisible" width="70%" style="margin-top: -20px" text-align="center">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="145px"
... ... @@ -137,9 +169,8 @@
<div slot="footer" class="dialog-footer" align="center">
<el-button @click="dialogFormVisible = false" size="medium"
style="width: 100px;background-color: #6F8294;color: #ffffff">取 消</el-button>
<el-button type="primary" size="medium" style="width: 100px" @click="ialogStatus==='create'?submitForm('ruleForm'):subEditForm()">确 定</el-button>
<el-button type="primary" size="medium" style="width: 100px" @click="dialogStatus==='create'?submitForm('ruleForm'):subRcvrForm()">确 定</el-button>
</div>
</el-dialog>
</el-row>
<el-row>
... ... @@ -209,16 +240,27 @@
</el-container>
</template>
<script>
import {queRouter, deleteRouter, addRouter,api_addReceiverFileter} from "../../api/message_bus";
import {
queRouter,
deleteRouter,
addRouter,
api_addReceiverFileter,
deleteMessage,
addRcvrs,
delRcvr,
ediRcvr,
updateMessage
} from "../../api/message_bus";
import Queue from "@/views/bus/Queue";
import RouterFilter from "@/views/bus/RouterReceiverFilter";
export default {
components: { Queue,RouterFilter },
data(){
return{
dialogFormVisibles:false,
dialogMap: {
update: '编辑',
create: '新增',
update: '增加订阅者',
},
dialogStatus: 'create',
/**
... ... @@ -353,11 +395,71 @@
});
},
editRouter:function(index,row){
// 打开新增订阅者
addRcvr:function(index,row){
this.dialogStatus= 'update';
this.dialogFormVisible = true;
this.ruleForm = Object.assign({}, row);
},
// 新增订阅者
subRcvrForm() {
this.$confirm('确认新增订阅者吗?', '提示', {
}).then(() => {
let para = Object.assign({}, this.ruleForm);
addRcvrs(para).then((res) => {
this.$message({
message: '提交成功',
type: 'success'
});
this.$refs['ruleForm'].resetFields();
this.dialogFormVisible = false;
this.queryRouterList();
}).catch(error => alert(error));
});
},
//删除
delReceiverFiletery: function (id) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
let para = { id: id };
//console.log(row);
delRcvr(para).then((res) => {
this.$message({
message: '删除成功',
type: 'success'
});
this.queryRouterList();
}).catch((error) => {
alert(error);
});
}).catch();
},
// 打开编辑
editRouter:function(index,row){
// this.dialogStatus= 'update';
this.dialogFormVisibles = true;
this.ruleForm = Object.assign({}, row);
},
//编辑
submitEdit: function () {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
let para = Object.assign({}, this.ruleForm);
ediRcvr(para).then((res) => {
this.$message({
message: '提交成功',
type: 'success'
});
this.$refs['ruleForm'].resetFields();
this.dialogFormVisibles = false;
this.queryRouterList();
}).catch(error => alert(error));
});
}
});
},
delRouter(index,row){
// 弹框询问是否删除?
this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
... ...