...
|
...
|
@@ -10,7 +10,7 @@ |
|
|
</el-input>
|
|
|
</el-col>
|
|
|
<el-col :span="6" align="center" style="margin-left: 10px">
|
|
|
<el-input placeholder="请输入内容" v-model="queryInfo.name" size="medium">
|
|
|
<el-input placeholder="请输入内容" v-model="queryInfo.des" size="medium">
|
|
|
<template slot="prepend"><i class="el-icon-notebook-2"></i>描述</template>
|
|
|
</el-input>
|
|
|
</el-col>
|
...
|
...
|
@@ -30,9 +30,10 @@ |
|
|
border size="small" row-key="id" default-expand-all
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
: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;"
|
|
|
@selection-change="selsChange" >
|
|
|
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
|
|
<el-table-column type="index" align="center"></el-table-column>
|
|
|
<el-table-column type="index" prop="id" label="ID" align="center"></el-table-column>
|
|
|
<el-table-column label="消息标签" prop="name" align="center" width="220"></el-table-column>
|
|
|
<el-table-column label="消息类型" prop="type" :formatter="formatType" align="center" width="220"></el-table-column>
|
|
|
<el-table-column label="相关描述" prop="des" align="center" width="220"></el-table-column>
|
...
|
...
|
@@ -51,7 +52,7 @@ |
|
|
</el-tooltip>
|
|
|
<!-- 删除按钮-->
|
|
|
<el-tooltip effect="dark" content="删除" placement="top-start" :enterable="false">
|
|
|
<el-button type="danger" icon="el-icon-delete" size="mini"@click="">删除
|
|
|
<el-button type="danger" icon="el-icon-delete" size="mini"@click="handleDel(scope.$index, scope.row)">删除
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
</template>
|
...
|
...
|
@@ -60,7 +61,7 @@ |
|
|
</el-row>
|
|
|
<el-row style="margin-top: 10px">
|
|
|
<el-col :span="5">
|
|
|
<el-button type="danger" icon="el-icon-delete" :disabled="this.page.selectList.length===0"
|
|
|
<el-button type="danger" icon="el-icon-delete" :disabled="this.selectList.length === 0" @click="batchRemove"
|
|
|
>批量删除
|
|
|
</el-button>
|
|
|
</el-col>
|
...
|
...
|
@@ -90,13 +91,16 @@ |
|
|
<el-input placeholder="请输入内容" v-model="addForm.name" size="medium">
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="消息分类" prop="type">
|
|
|
<el-select v-model="addForm.type" placeholder="请选择消息分类" name='test' id='test'>
|
|
|
<el-form-item label="消息分类" prop="type" >
|
|
|
<el-select v-model="addForm.type" placeholder="请选择消息分类" :disabled="selectDisabled" name='test' id='test'>
|
|
|
<el-option
|
|
|
v-for="item in options"
|
|
|
:key="item.value"
|
|
|
:disabled="item.value == 1"
|
|
|
:label="item.label"
|
|
|
:value="item.value">
|
|
|
<span style="float: left">{{ item.label }}</span>
|
|
|
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
...
|
...
|
@@ -108,7 +112,7 @@ |
|
|
<div slot="footer" class="dialog-footer" align="center">
|
|
|
<el-button type="info" @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="addList">提 交</el-button>
|
|
|
<el-button type="primary" size="medium" style="width: 100px" @click="dialogStatus==='create'?addList():editList()">提 交</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</el-row>
|
...
|
...
|
@@ -119,8 +123,7 @@ |
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {getTypesPage, addType} from "../../api/message_bus";
|
|
|
import {add} from "../../api/role_api";
|
|
|
import {getTypesPage, addType,updateMessage,deleteMessage,batchDelete} from "../../api/message_bus";
|
|
|
import util from "../../common/js/util";
|
|
|
|
|
|
export default {
|
...
|
...
|
@@ -139,8 +142,9 @@ |
|
|
page: {
|
|
|
total: 0,
|
|
|
tableData: [],
|
|
|
selectList: [],
|
|
|
},
|
|
|
//选中的行
|
|
|
selectList: [],
|
|
|
dialogFormVisible: false,
|
|
|
addForm: {
|
|
|
name: '',
|
...
|
...
|
@@ -148,22 +152,22 @@ |
|
|
type:'',
|
|
|
parentId:''
|
|
|
},
|
|
|
selectDisabled: false,
|
|
|
dialogMap: {
|
|
|
update: '编辑',
|
|
|
create: '新增',
|
|
|
},
|
|
|
dialogStatus: 'create',
|
|
|
demoName: false,
|
|
|
|
|
|
options: [{
|
|
|
label: "消息分类",
|
|
|
value: "1"
|
|
|
value: 1
|
|
|
},{
|
|
|
label: "消息大类",
|
|
|
value: "2"
|
|
|
value: 2
|
|
|
},{
|
|
|
label: "消息子类",
|
|
|
value: "3"
|
|
|
value: 3
|
|
|
}],
|
|
|
addFormRules: {
|
|
|
name: [
|
...
|
...
|
@@ -176,6 +180,10 @@ |
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 类型转换
|
|
|
formatType: function (row, column) {
|
|
|
return row.type == 1 ? '消息分类' : row.type == 2 ? '消息大类' : '消息子类';
|
|
|
},
|
|
|
handleSizeChange(newSize) {
|
|
|
this.queryInfo.pageSize = newSize;
|
|
|
this.getList();
|
...
|
...
|
@@ -211,6 +219,10 @@ |
|
|
handleAdd: function (index,row) {
|
|
|
this.dialogFormVisible = true;
|
|
|
this.dialogStatus= 'create';
|
|
|
this.addForm.type = 1;
|
|
|
//消息分类禁选
|
|
|
this.selectDisabled = true;
|
|
|
//上级标签隐藏
|
|
|
if (this.$refs.addForm != undefined){
|
|
|
|
|
|
if (row != undefined){
|
...
|
...
|
@@ -226,7 +238,11 @@ |
|
|
let parentId = Object.assign({}, row);
|
|
|
this.addForm.parentId = parentId.id;
|
|
|
this.addForm.parentName = parentId.name;
|
|
|
|
|
|
this.selectDisabled = false;
|
|
|
this.addForm.type = 2;
|
|
|
if(this.$refs.parent[type] = 2){
|
|
|
this.addForm.child[type] = 3;
|
|
|
}
|
|
|
}
|
|
|
//数据初始化
|
|
|
// this.addForm = {
|
...
|
...
|
@@ -254,10 +270,89 @@ |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 类型转换
|
|
|
formatType: function (row, column) {
|
|
|
return row.type == 1 ? '消息分类' : row.type == 2 ? '消息大类' : '消息子类';
|
|
|
//删除
|
|
|
handleDel: function (index, row) {
|
|
|
this.$confirm('确认删除该记录吗?', '提示', {
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
//let para = { id: row.id };
|
|
|
//console.log(row);
|
|
|
deleteMessage(row).then((res) => {
|
|
|
this.$message({
|
|
|
message: '删除成功',
|
|
|
type: 'success'
|
|
|
});
|
|
|
this.getList();
|
|
|
}).catch((error) => {
|
|
|
alert(error);
|
|
|
});
|
|
|
}).catch();
|
|
|
},
|
|
|
//批量选中
|
|
|
selsChange: function (selected) {
|
|
|
let _this= this;
|
|
|
selected.forEach(
|
|
|
function (row,index) {
|
|
|
_this.selectList.push(row.id);
|
|
|
}
|
|
|
);
|
|
|
|
|
|
},
|
|
|
//批量删除
|
|
|
batchRemove: function () {
|
|
|
//取 选中 多条信息 的id 赋给ids
|
|
|
this.$confirm('确认删除选中记录吗?', '提示', {
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
batchDelete(this.selectList).then((res) => {
|
|
|
this.$message({
|
|
|
message: '删除成功',
|
|
|
type: 'success'
|
|
|
});
|
|
|
this.getList();
|
|
|
});
|
|
|
}).catch(() => {
|
|
|
|
|
|
});
|
|
|
},
|
|
|
//显示编辑界面
|
|
|
handleEdit: function (index, row) {
|
|
|
this.dialogFormVisible = true;
|
|
|
this.demoName = false;
|
|
|
this.dialogStatus= 'update',
|
|
|
this.addForm = Object.assign({}, row);
|
|
|
//消息分类禁选
|
|
|
this.selectDisabled = true;
|
|
|
if (this.$refs.addForm != undefined){
|
|
|
|
|
|
if (row != undefined){
|
|
|
this.demoName = true;
|
|
|
}else {
|
|
|
this.demoName = false;
|
|
|
}
|
|
|
this.$refs.addForm.resetFields();
|
|
|
}
|
|
|
},
|
|
|
//编辑
|
|
|
editList: function () {
|
|
|
this.$refs.addForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.$confirm('确认提交吗?', '提示', {}).then(() => {
|
|
|
let para = Object.assign({}, this.addForm);
|
|
|
updateMessage(para).then((res) => {
|
|
|
this.$message({
|
|
|
message: '提交成功',
|
|
|
type: 'success'
|
|
|
});
|
|
|
this.$refs['addForm'].resetFields();
|
|
|
this.dialogFormVisible = false;
|
|
|
this.getList();
|
|
|
}).catch(error => alert(error));
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
|
|
|
}
|
|
|
}
|
|
|
</script>
|
...
|
...
|
|