作者 朱兆平

多式联运电子运单es消息管理更新,对接多式联运用户列表

1 <template> 1 <template>
2 - <div style="width: 100%"> 2 + <div style="width: 100%;overflow-y:scroll;">
3 3
4 <Assembly></Assembly> 4 <Assembly></Assembly>
5 5
@@ -103,21 +103,21 @@ @@ -103,21 +103,21 @@
103 element-loading-text="获取消息收发记录,拼命加载中" 103 element-loading-text="获取消息收发记录,拼命加载中"
104 :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" 104 :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}"
105 style="border-radius: 10px 10px 0px 0px;line-height: 25px;"> 105 style="border-radius: 10px 10px 0px 0px;line-height: 25px;">
106 - <el-table-column label="消息ID" prop="msgid" align="center" width="120"></el-table-column>  
107 - <el-table-column label="消息序号" prop="seqn" align="center" width="130"></el-table-column>  
108 - <el-table-column label="发送者" prop="sndr" align="center" width="100"></el-table-column> 106 + <el-table-column label="消息ID" prop="admin.msgid" align="center" width="120"></el-table-column>
  107 + <el-table-column label="消息序号" prop="msg.header.seqno" align="center" width="130"></el-table-column>
  108 + <el-table-column label="发送者" prop="msg.header.sndr" align="center" width="100"></el-table-column>
109 <!-- <el-table-column label="发送内容" prop="msg" align="center" width="220"></el-table-column>--> 109 <!-- <el-table-column label="发送内容" prop="msg" align="center" width="220"></el-table-column>-->
110 - <el-table-column label="消息大类" prop="btype" align="center" width="80"></el-table-column>  
111 - <el-table-column label="消息子类" prop="stype" align="center" width="80"></el-table-column>  
112 - <el-table-column label="消息发送时间" prop="ddtm" align="center" width="150"></el-table-column>  
113 - <el-table-column label="路由接收者" prop="rcvrs" align="center" width="120"> 110 + <el-table-column label="消息大类" prop="msg.header.type" align="center" width="80"></el-table-column>
  111 + <el-table-column label="消息子类" prop="msg.header.stype" align="center" width="80"></el-table-column>
  112 + <el-table-column label="消息发送时间" prop="msg.header.ddtm" align="center" width="150"></el-table-column>
  113 + <el-table-column label="路由接收者" prop="admin.rcvrs" align="center" width="120">
114 <template slot-scope="scope"> 114 <template slot-scope="scope">
115 - <div v-for="reciver in scope.row.rcvrs">{{reciver.username}}</div> 115 + <div v-for="reciver in scope.row.admin.rcvrs">{{reciver.user}}</div>
116 </template> 116 </template>
117 </el-table-column> 117 </el-table-column>
118 - <el-table-column label="消息接收者" prop="rcvlog" align="center" width="300"> 118 + <el-table-column label="消息接收者" prop="admin.rcvlog" align="center" width="300">
119 <template slot-scope="scope"> 119 <template slot-scope="scope">
120 - <div v-for="logitem in scope.row.rcvlog">{{logitem.username}} [{{logitem.rvtm}}]</div> 120 + <div v-for="logitem in scope.row.admin.rcvlog">{{logitem.user}} [{{logitem.rvtm}}]</div>
121 </template> 121 </template>
122 </el-table-column> 122 </el-table-column>
123 <!-- <el-table-column label="相关描述" prop="description" align="center" width="220"></el-table-column>--> 123 <!-- <el-table-column label="相关描述" prop="description" align="center" width="220"></el-table-column>-->
@@ -463,7 +463,7 @@ @@ -463,7 +463,7 @@
463 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -10px" align="center" 463 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -10px" align="center"
464 :model="messageNote_viewContentForm" :rules="messageNote_viewContentFormRules" ref="messageNote_viewContentFormRef"> 464 :model="messageNote_viewContentForm" :rules="messageNote_viewContentFormRules" ref="messageNote_viewContentFormRef">
465 <el-form-item label="消息内容:" prop="alias_sendContent"> 465 <el-form-item label="消息内容:" prop="alias_sendContent">
466 - <el-input v-model="messageNote_viewContentForm.alias_sendContent" 466 + <el-input v-model="messageNote_viewContentForm.msg.body"
467 v-if="isViewContent === false" 467 v-if="isViewContent === false"
468 style="width:800px" size="small" placeholder="消息内容" 468 style="width:800px" size="small" placeholder="消息内容"
469 clearable type="textarea" :rows="20"> 469 clearable type="textarea" :rows="20">
@@ -656,7 +656,12 @@ @@ -656,7 +656,12 @@
656 /** 656 /**
657 * 发送内容,表单 657 * 发送内容,表单
658 */ 658 */
659 - messageNote_viewContentForm: {}, 659 + messageNote_viewContentForm: {
  660 + msg:{
  661 + body:""
  662 + },
  663 + admin:{}
  664 + },
660 665
661 /** 666 /**
662 * 发送内容,格式化之后 667 * 发送内容,格式化之后
@@ -22,41 +22,41 @@ @@ -22,41 +22,41 @@
22 <el-row> 22 <el-row>
23 <el-col :span="7"> 23 <el-col :span="7">
24 <span>消息id:</span> 24 <span>消息id:</span>
25 - <el-tag>{{item.msgid}}</el-tag> 25 + <el-tag>{{item.admin.msgid}}</el-tag>
26 </el-col> 26 </el-col>
27 <el-col :span="8"> 27 <el-col :span="8">
28 <span>发送时间:</span> 28 <span>发送时间:</span>
29 - <el-tag>{{item.ddtm}}</el-tag> 29 + <el-tag>{{item.msg.header.ddtm}}</el-tag>
30 </el-col> 30 </el-col>
31 31
32 </el-row> 32 </el-row>
33 <el-row> 33 <el-row>
34 <el-col :span="7"> 34 <el-col :span="7">
35 <span>发送人:</span> 35 <span>发送人:</span>
36 - <el-tag>{{item.sndr}}</el-tag> 36 + <el-tag>{{item.msg.header.sndr}}</el-tag>
37 </el-col> 37 </el-col>
38 <el-col :span="3"> 38 <el-col :span="3">
39 <span>消息大类:</span> 39 <span>消息大类:</span>
40 - <el-tag type="success">{{item.btype}}</el-tag> 40 + <el-tag type="success">{{item.msg.header.type}}</el-tag>
41 </el-col> 41 </el-col>
42 <el-col :span="3"> 42 <el-col :span="3">
43 <span>消息子类:</span> 43 <span>消息子类:</span>
44 - <el-tag type="success">{{item.stype}}</el-tag> 44 + <el-tag type="success">{{item.msg.header.stype}}</el-tag>
45 </el-col> 45 </el-col>
46 <el-col :span="4"> 46 <el-col :span="4">
47 <div> 47 <div>
48 <span>路由接收者:</span> 48 <span>路由接收者:</span>
49 </div> 49 </div>
50 - <template v-for="reciver in item.rcvrs">  
51 - <el-tag type="danger">{{reciver.username}}</el-tag> 50 + <template v-for="reciver in item.admin.rcvrs">
  51 + <el-tag type="danger">{{reciver.user}}</el-tag>
52 </template> 52 </template>
53 </el-col> 53 </el-col>
54 <el-col :span="4"> 54 <el-col :span="4">
55 <div> 55 <div>
56 <span >消息接收者:</span> 56 <span >消息接收者:</span>
57 </div> 57 </div>
58 - <template v-for="logitem in item.rcvlog">  
59 - <el-tag type="warning">{{logitem.username}} [{{logitem.rvtm}}]</el-tag> 58 + <template v-for="logitem in item.admin.rcvlog">
  59 + <el-tag type="warning">{{logitem.user}} [{{logitem.rvtm}}]</el-tag>
60 </template> 60 </template>
61 </el-col> 61 </el-col>
62 </el-row> 62 </el-row>
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
68 </el-button> 68 </el-button>
69 </el-col> 69 </el-col>
70 <el-col style="width: 45%;margin-left: -10px" :span="14"> 70 <el-col style="width: 45%;margin-left: -10px" :span="14">
71 - <el-input v-model="item.msg" readonly type="textarea" :rows="3"></el-input> 71 + <el-input v-model="item.msg.body" readonly type="textarea" :rows="3"></el-input>
72 </el-col> 72 </el-col>
73 </el-row> 73 </el-row>
74 <el-row> 74 <el-row>
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -10px" align="center" 106 <el-form :inline="true" label-width="120px" status-icon style="margin-top: -10px" align="center"
107 :model="messageNote_viewContentForm" ref="messageNote_viewContentFormRef"> 107 :model="messageNote_viewContentForm" ref="messageNote_viewContentFormRef">
108 <el-form-item label="消息内容:" prop="alias_sendContent"> 108 <el-form-item label="消息内容:" prop="alias_sendContent">
109 - <el-input v-model="messageNote_viewContentForm.msg" v-if="isViewContent === false" 109 + <el-input v-model="messageNote_viewContentForm.msg.body" v-if="isViewContent === false"
110 style="width:1000px" type="textarea" :rows="8"> 110 style="width:1000px" type="textarea" :rows="8">
111 </el-input> 111 </el-input>
112 <el-input v-model="xml_content" v-if="isViewContent === true" 112 <el-input v-model="xml_content" v-if="isViewContent === true"
@@ -116,7 +116,7 @@ @@ -116,7 +116,7 @@
116 </el-form> 116 </el-form>
117 <div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px"> 117 <div slot="footer" class="dialog-footer" style="text-align: center;margin-top: -20px">
118 118
119 - <el-button type="success" @click="xml_format(messageNote_viewContentForm.msg)" size="medium" 119 + <el-button type="success" @click="xml_format(messageNote_viewContentForm.msg.body)" size="medium"
120 style="width: 100px">xml格式化 120 style="width: 100px">xml格式化
121 </el-button> 121 </el-button>
122 122
@@ -185,7 +185,12 @@ @@ -185,7 +185,12 @@
185 /** 185 /**
186 * 发送内容,表单 186 * 发送内容,表单
187 */ 187 */
188 - messageNote_viewContentForm: {}, 188 + messageNote_viewContentForm: {
  189 + msg:{
  190 + body:""
  191 + },
  192 + admin:{}
  193 + },
189 } 194 }
190 }, 195 },
191 methods: { 196 methods: {
@@ -192,7 +192,7 @@ @@ -192,7 +192,7 @@
192 getServerAndHostList, getUserInfoList, 192 getServerAndHostList, getUserInfoList,
193 } from "../../api/message_bus"; 193 } from "../../api/message_bus";
194 194
195 - import User from "@/views/nav1/user"; 195 + import User from "@/views/bus/dsly/user";
196 196
197 export default { 197 export default {
198 name: "Queue", 198 name: "Queue",
  1 +import http from './http.js'
  2 +let baseUrl = '/zz-system/user'
  3 +export const getUserList = params => { return http.get(`${baseUrl}/list`, params); };
  4 +
  5 +export const getUserListPage = params => { return http.get(`/user/list`,params) };
  6 +
  7 +export const removeUser = params => { return http.del(`${baseUrl}/del`,params)};
  8 +
  9 +export const batchRemoveUser = params => { return http.del(`${baseUrl}/batchremove`, { params: params }); };
  10 +
  11 +export const editPass = params => { return http.put(`${baseUrl}/password`,params)};
  12 +
  13 +export const editUser = params => { return http.put(`${baseUrl}/edit`,params)};
  14 +
  15 +export const addUser = params => { return http.post(`${baseUrl}/add`,params)};
  16 +
  17 +export const setUserRole = params => { return http.put(`${baseUrl}/roleset`,params)};
  18 +
  19 +export const resetToken = params => { return http.put(`${baseUrl}/resetToken`,params)};
  1 +<template>
  2 + <section>
  3 + <!--工具条-->
  4 + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5 + <el-form :inline="true" :model="filters">
  6 + <el-form-item>
  7 + <el-input v-model="filters.account" placeholder="姓名"></el-input>
  8 + </el-form-item>
  9 + <el-form-item>
  10 + <el-input v-model="filters.name" placeholder="账号"></el-input>
  11 + </el-form-item>
  12 + <el-form-item>
  13 + <el-button type="primary" v-on:click="getUsers">查询</el-button>
  14 + </el-form-item>
  15 + </el-form>
  16 + </el-col>
  17 +
  18 + <!--列表-->
  19 + <el-table :data="users" highlight-current-row border v-loading="listLoading" @selection-change="selsChange"
  20 + style="width: 100%;">
  21 + <el-table-column type="selection" width="55" align="center">
  22 + </el-table-column>
  23 + <!--<el-table-column type="index" width="60">-->
  24 + <!--</el-table-column>-->
  25 + <el-table-column prop="id" label="ID" width="100" align="center" sortable>
  26 + </el-table-column>
  27 + <el-table-column prop="account" label="账号" width="120" align="center" sortable>
  28 + </el-table-column>
  29 + <el-table-column prop="name" label="姓名" width="120" align="center" sortable>
  30 + </el-table-column>
  31 + <el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" align="center" sortable>
  32 + </el-table-column>
  33 + <el-table-column prop="phone" label="电话" width="130" align="center">
  34 + </el-table-column>
  35 + <el-table-column prop="createTime" label="创建时间" width="175" align="center" sortable>
  36 + </el-table-column>
  37 + <el-table-column prop="status" label="启用" width="100" :formatter="formatState" align="center" sortable>
  38 + </el-table-column>
  39 + </el-table>
  40 +
  41 + <!--工具条-->
  42 + <el-col :span="24" class="toolbar">
  43 + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10"
  44 + :total="total" style="float:right;">
  45 + </el-pagination>
  46 + </el-col>
  47 + </section>
  48 +</template>
  49 +
  50 +<script>
  51 + import util from '../../common/js/util'
  52 + import NProgress from 'nprogress'
  53 + import {getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole} from 'api/user';
  54 + import {getList} from '../../api/role_api';
  55 + import moment from 'moment'
  56 + import {getServerAndHostList, insertUserInfo} from "../../api/message_bus";
  57 +
  58 + export default {
  59 + name:"UserList",
  60 + data() {
  61 + return {
  62 + user_config: {
  63 + server_hostList: [],
  64 + defaultParams: {
  65 + label: 'aliasName',
  66 + children: 'aliasList'
  67 + }
  68 + },
  69 + filters: {
  70 + account: '',
  71 + name: ''
  72 + },
  73 + treeDefaultProps: {
  74 + children: 'children',
  75 + label: 'roleName',
  76 + },
  77 + users: [],
  78 + total: 0,
  79 + pageNum: 1,
  80 + pageSize: 10,
  81 + faceImageUrl: '',
  82 + listLoading: false,
  83 + sels: [],//列表选中列
  84 + //编辑界面是否显示
  85 + editFormVisible: false,
  86 + editLoading: false,
  87 + editFormRules: {
  88 + name: [
  89 + {required: true, message: '请输入姓名', trigger: 'blur'}
  90 + ],
  91 + mobilephone: [
  92 + {required: true, message: '请输入手机号码', trigger: ['blur', 'change']}
  93 + ]
  94 + },
  95 + //编辑界面数据
  96 + editForm: {
  97 + userId: 1,
  98 + username: '',
  99 + password: '',
  100 + sex: '1',
  101 + creattime: undefined,
  102 + address: '',
  103 + realname: '',
  104 + email: '',
  105 + mobilephone: '',
  106 + state: true
  107 + },
  108 +
  109 + addFormVisible: false,//新增界面是否显示
  110 + addLoading: false,
  111 + addFormRules: {
  112 + username: [
  113 + {required: true, message: '请输入姓名,用户名长度在5-11位,支持英文和数字', trigger: 'blur'},
  114 + ],
  115 + password: [
  116 + {required: true, message: '请输入密码,用户名长度在6-18位,支持英文和数字和非空字符', trigger: 'blur'}
  117 + ],
  118 + mobilephone: [
  119 + {required: true, message: '请输入手机号码', trigger: ['blur', 'change']},
  120 + ],
  121 + virtualHostId: [
  122 + {required: true, message: '请选择虚拟主机', trigger: ['blur', 'change']},
  123 + ],
  124 + serverId: [
  125 + {required: true, message: '请选择服务器', trigger: ['blur', 'change']},
  126 + ],
  127 + },
  128 + //用户角色配置
  129 + roleFormVisible: false,
  130 + //新增界面数据
  131 + addForm: {
  132 + username: '',
  133 + password: '',
  134 + sex: 1,
  135 + address: '',
  136 + realname: '',
  137 + email: '',
  138 + mobilephone: '',
  139 + age: 1,
  140 + virtualHostId: '',
  141 + serverId: '',
  142 + },
  143 + roleEditForm: {
  144 + userId: 1,
  145 + username: "",
  146 + roles: []
  147 + },
  148 + roles: [],
  149 + roleIds: []
  150 +
  151 + }
  152 + },
  153 + methods: {
  154 + // 性别显示转换
  155 + formatSex: function (row, column) {
  156 + return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
  157 + },
  158 + formatState: function (row, column) {
  159 + return row.state == true ? '是' : row.state == false ? '否' : '未知';
  160 + },
  161 + handleCurrentChange(val) {
  162 + this.pageNum = val;
  163 + this.getUsers();
  164 + },
  165 + // 获取用户列表
  166 + getUsers: function () {
  167 + let para = {
  168 + pageNo: this.pageNum,
  169 + pageSize: this.pageSize,
  170 + account: this.filters.account,
  171 + name: this.filters.name
  172 + };
  173 + this.listLoading = true;
  174 + getUserList(para).then((res) => {
  175 + let response = res.data;
  176 + this.total = response.totalCount;
  177 + this.users = response.data;
  178 + this.listLoading = false;
  179 + //NProgress.done();
  180 + }).catch((error) => {
  181 + this.listLoading = false;
  182 + this.$message.error(error.toString());
  183 + });
  184 +
  185 + },
  186 + //删除
  187 + handleDel: function (index, row) {
  188 + this.$confirm('确认删除该记录吗?', '提示', {
  189 + type: 'warning'
  190 + }).then(() => {
  191 + this.listLoading = true;
  192 + //NProgress.start();
  193 + let para = {userId: row.userId};
  194 + removeUser(para).then((res) => {
  195 + this.listLoading = false;
  196 + //NProgress.done();
  197 + this.$message({
  198 + message: '删除成功',
  199 + type: 'success'
  200 + });
  201 + this.getUsers();
  202 + }).catch((error) => {
  203 + this.listLoading = false;
  204 + alert(error);
  205 + });
  206 + }).catch();
  207 + },
  208 + /**
  209 + * 显示编辑界面
  210 + * @param index
  211 + * @param row 为这行的数据对象
  212 + */
  213 + handleEdit: function (index, row) {
  214 + this.editFormVisible = true;
  215 + this.editForm = Object.assign({}, row);
  216 + },
  217 + roleEdit: function (index, row) {
  218 + this.roleFormVisible = true;
  219 + this.getRoles();
  220 + var _this = this;
  221 + _this.roleIds = [];
  222 + this.roleEditForm = Object.assign({}, row);
  223 + let roles = this.roleEditForm.roles;
  224 +
  225 + if (util.checkNull(roles)) {
  226 + roles.forEach(function (role, v_index, v_arr) {
  227 + if (util.checkNull(role)) {
  228 + _this.roleIds[v_index] = role.roleId;
  229 + }
  230 + });
  231 + }
  232 + this.$nextTick(() => {
  233 + //反向适配
  234 + this.$refs.tree.setCheckedKeys(this.roleIds);
  235 + });
  236 + },
  237 + getRoles() {
  238 + let para = {
  239 + pageNum: 1,
  240 + pageSize: 100
  241 + };
  242 + NProgress.start();
  243 + getList(para).then((res) => {
  244 + this.roles = res.data.list;
  245 + NProgress.done();
  246 + }).catch((error) => {
  247 + if (null != error.response && error.response !== undefined) {
  248 + let status = error.response.status;
  249 + let msg = error.response.statusText;
  250 + alert(status + msg);
  251 + } else {
  252 + alert(error);
  253 + }
  254 + });
  255 +
  256 +
  257 + },
  258 + //显示新增界面,每次点开初始化数据
  259 + handleAdd: function () {
  260 + this.addFormVisible = true;
  261 + this.addForm = {
  262 + username: '',
  263 + password: '',
  264 + sex: 1,
  265 + address: '',
  266 + realname: '',
  267 + email: '',
  268 + mobilephone: '',
  269 + age: 1,
  270 + virtualHostId: '',
  271 + serverId: '',
  272 + };
  273 + },
  274 + //编辑
  275 + editSubmit: function () {
  276 + this.$refs.editForm.validate((valid) => {
  277 + if (valid) {
  278 + this.$confirm('确认提交吗?', '提示', {}).then(() => {
  279 + this.editLoading = true;
  280 + //NProgress.start();
  281 + // let para = Object.assign({}, this.editForm);
  282 + //不需要提交的 去掉,后端不好接收
  283 + this.editForm.authorities = null;
  284 + this.editForm.permissions = null;
  285 + this.editForm.roles = null;
  286 +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
  287 + /*
  288 + 查询之后格式this.filters.column.create_start_date中日期发生变化;
  289 + Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z";
  290 + 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格
  291 + 式;
  292 + */
  293 + /*moment 安装 npm install moment --save*/
  294 +// para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');
  295 + this.editLoading = false;
  296 + editUser(this.editForm).then((res) => {
  297 +
  298 + //NProgress.done();
  299 + this.$message({
  300 + message: '提交成功',
  301 + type: 'success'
  302 + });
  303 + this.$refs['editForm'].resetFields();
  304 + this.editFormVisible = false;
  305 + this.getUsers();
  306 + }).catch(error => alert(error));
  307 + });
  308 + }
  309 + });
  310 + },
  311 + //新增
  312 + addSubmit: function () {
  313 + this.$refs.addForm.validate((valid) => {
  314 + if (valid) {
  315 + this.$confirm('确认提交吗?', '提示', {}).then(() => {
  316 + this.addLoading = true;
  317 + let para = Object.assign({}, this.addForm);
  318 +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
  319 +
  320 + // 添加MQ用户信息
  321 + this.addForm.virtualHostId = this.$refs.tree.getCheckedKeys().join();
  322 + const params = {
  323 + username: this.addForm.username,
  324 + password: this.addForm.password,
  325 + realName: this.addForm.realname,
  326 + virtualHostId: this.addForm.virtualHostId,
  327 + }
  328 + insertUserInfo(params).then((response) => {
  329 + let res = response.data;
  330 + // 添加失败
  331 + if (res.code !== '200') {
  332 + return this.$message.error("MQ:" + res.msg);
  333 + }
  334 + // 添加,成功
  335 + this.$message.success('添加MQ用戶信息,成功');
  336 + }).catch(error => {
  337 + this.$message.error(error.toString());
  338 + });
  339 +
  340 + addUser(para).then((res) => {
  341 + this.addLoading = false;
  342 + //NProgress.done();
  343 + this.$message({
  344 + message: '提交成功',
  345 + type: 'success'
  346 + });
  347 + this.$refs['addForm'].resetFields();
  348 + this.addFormVisible = false;
  349 + this.getUsers();
  350 + }).catch(error => {
  351 + this.addLoading = false;
  352 + this.$message({
  353 + message: error.message,
  354 + type: 'error'
  355 + });
  356 + });
  357 +
  358 + });
  359 + }
  360 + });
  361 + },
  362 + selsChange: function (sels) {
  363 + //传递给父组件
  364 + this.$emit("getUserMessageEvent",sels);
  365 + this.sels = sels;
  366 + },
  367 + //批量删除
  368 + batchRemove: function () {
  369 + var ids = this.sels.map(item => item.userId).toString();
  370 + this.$confirm('确认删除选中记录吗?', '提示', {
  371 + type: 'warning'
  372 + }).then(() => {
  373 + this.listLoading = true;
  374 + //NProgress.start();
  375 + let para = {ids: ids};
  376 + batchRemoveUser(para).then((res) => {
  377 + this.listLoading = false;
  378 + //NProgress.done();
  379 + this.$message({
  380 + message: '删除成功',
  381 + type: 'success'
  382 + });
  383 + this.getUsers();
  384 + });
  385 + }).catch(() => {
  386 +
  387 + });
  388 + },
  389 + roleEditSubmit: function () {
  390 + this.$confirm('确认提交吗?', '提示', {}).then(() => {
  391 +// this.editLoading = true;
  392 + let userId = this.roleEditForm.userId;
  393 + let roleIds = this.$refs.tree.getCheckedKeys();
  394 + let para = {userId, roleIds};
  395 + setUserRole(para).then((res) => {
  396 + if (res.status === 200) {
  397 + this.$message({
  398 + message: '岗位设置成功',
  399 + type: 'success'
  400 + });
  401 + }
  402 + this.getUsers();
  403 + this.roleFormVisible = false;
  404 + }).catch(err => {
  405 + alert(err);
  406 + });
  407 + console.log(para);
  408 + });
  409 + },
  410 + handleAvatarSuccess: function (response) {
  411 + this.faceImageUrl = 'http://127.0.0.1:7003/' + response.data;
  412 + },
  413 + beforeAvatarUpload: function () {
  414 +
  415 + },
  416 + treeHandleCheckChange: function (data, checked, indeterminate) {
  417 + if (checked) {
  418 + this.roleIds.push(data.roleId);
  419 + } else {
  420 + this.roleIds.splice(this.roleIds.contains(data.roleId), 1);
  421 + }
  422 +// console.log(data, checked, indeterminate);
  423 + console.log(this.roleIds);
  424 + },
  425 +
  426 + /**
  427 + * 选择用户关系
  428 + * MQ服务器与虚拟主机(1:n)的列表
  429 + */
  430 + selectUserRelation() {
  431 + getServerAndHostList().then((response) => {
  432 + let res = response.data;
  433 + if (res.code !== '200') {
  434 + return this.$message.error('获取服务器与虚拟主机信息,失败!');
  435 + }
  436 + // 获取列表数据
  437 + this.user_config.server_hostList = res.data;
  438 + }).catch(error => {
  439 + this.$message.error(error.toString());
  440 + });
  441 + },
  442 +
  443 + },
  444 + mounted() {
  445 + this.getUsers();
  446 + this.selectUserRelation();
  447 + },
  448 + computed: {
  449 + hideShow() {//当图片多于一张的时候,就隐藏上传框
  450 + return this.file === '' ? false : true
  451 + }
  452 + },
  453 + }
  454 +
  455 +</script>
  456 +
  457 +<style scoped>
  458 +
  459 +</style>