审查视图

src/views/nav1/user.vue 22.5 KB
朱兆平 authored
1 2 3 4 5 6
<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
小范 authored
7
					<el-input v-model="filters.realName" placeholder="真实姓名" style="width: 200px">
8 9
						<template slot="prepend">姓名</template>
					</el-input>
朱兆平 authored
10 11
				</el-form-item>
				<el-form-item>
小范 authored
12
					<el-input v-model="filters.userName" placeholder="登录账号" style="width: 200px">
13 14
						<template slot="prepend">账号</template>
					</el-input>
15 16
				</el-form-item>
				<el-form-item>
朱兆平 authored
17 18 19
					<div class="my-text-area">
						<div class="el-input-group__prepend prepand">状态</div>
						<el-select v-model="filters.userStatus"
小范 authored
20
								   clearable placeholder="请选择"   style="width: 125px">
朱兆平 authored
21 22 23 24 25 26 27 28 29
							<el-option
									v-for="item in userStatusOption"
									:key="item.code"
									:label="item.label"
									:value="item.code"
							>
							</el-option>
						</el-select>
					</div>
朱兆平 authored
30 31
				</el-form-item>
				<el-form-item>
32
					<el-button type="primary" v-on:click="getUsers" icon="el-icon-search">查询</el-button>
33 34
				</el-form-item>
				<el-form-item>
35
					<el-button type="success" @click="handleAdd" icon="el-icon-document">新增</el-button>
朱兆平 authored
36 37 38 39 40
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
41 42
		<el-table :data="users" highlight-current-row border v-loading="listLoading"
				  @selection-change="selsChange"
小范 authored
43
				  tooltip-effect="dark" size="small"
44
				  style="border-radius: 10px 10px 0px 0px;line-height: 25px;"
45
				  :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" >
46 47
			<el-table-column type="selection" width="55">
			</el-table-column>
朱兆平 authored
48 49
			<!--<el-table-column type="index" width="60">-->
			<!--</el-table-column>-->
小范 authored
50
			<el-table-column prop="userId" label="ID" width="80" sortable>
51 52 53 54 55
			</el-table-column>
			<el-table-column prop="username" label="账号" width="120" sortable>
			</el-table-column>
			<el-table-column prop="realname" label="姓名" width="120" sortable>
			</el-table-column>
朱兆平 authored
56 57 58 59
<!--			<el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" sortable>-->
<!--			</el-table-column>-->
<!--			<el-table-column prop="mobilephone" label="电话" width="150">-->
<!--			</el-table-column>-->
60 61 62 63
<!--			<el-table-column prop="address" label="地址" min-width="180">-->
<!--			</el-table-column>-->
<!--			<el-table-column prop="email" label="Email" min-width="180">-->
<!--			</el-table-column>-->
64
			<el-table-column prop="state" label="启用" width="100" :formatter="formatState" sortable>
朱兆平 authored
65 66 67
				<template slot-scope="scope">
					<el-tag type="success" v-if="scope.row.state">启用</el-tag>
					<el-tag type="danger" v-else>禁用</el-tag>
朱兆平 authored
68 69 70

					<el-button type="text"  @click="lockUser(scope.$index, scope.row, false)" v-if="scope.row.state">禁用</el-button>
					<el-button type="text"  @click="lockUser(scope.$index, scope.row, true)" v-else>启用</el-button>
朱兆平 authored
71 72 73 74 75 76 77 78 79 80 81 82 83 84
				</template>
			</el-table-column>
			<el-table-column prop="userStatus" label="状态" width="100">
				<template slot-scope="scope">
					<el-tag type="danger" v-if="scope.row.userStatus ===0">锁定</el-tag>
					<el-tag type="success" v-else-if="scope.row.userStatus ===1">在线</el-tag>
					<el-tag type="info" v-else-if="scope.row.userStatus ===2">离线</el-tag>
					<el-tag type="warning" v-else-if="scope.row.userStatus ===3">过期</el-tag>
					<el-tag type="warning" v-else>未知</el-tag>
				</template>
			</el-table-column>
			<el-table-column prop="creattime" label="创建时间" width="220" sortable>
			</el-table-column>
			<el-table-column prop="updatetime" label="更新时间" width="220" sortable>
85
			</el-table-column>
小范 authored
86
			<el-table-column label="操作" align="center" width="250" fixed="right">
87
				<template slot-scope="scope">
小范 authored
88 89
					<el-button type="success" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
					<el-button type="warning" @click="roleEdit(scope.$index, scope.row)">角色配置</el-button>
90
					<el-button type="danger"  @click="handleDel(scope.$index, scope.row)">删除</el-button>
91 92 93 94 95 96 97
				</template>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>
shenhailong authored
98
			<el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;">
99 100
			</el-pagination>
		</el-col>
朱兆平 authored
101
102
		<!--新增界面-->
朱兆平 authored
103
		<el-dialog :title="dialogMap[dialogStatus]" :visible.sync="addFormVisible" :close-on-click-modal="false" width="70%">
104 105 106 107 108 109 110 111 112 113 114
			<el-form :model="addForm" label-width="80px" ref="addForm" class="user-form">
<!--				<el-form-item label="所属公司" prop="companyId">-->
<!--					<el-select v-model="addForm.companyId" filterable placeholder="请选择">-->
<!--						<el-option-->
<!--								v-for="item in options"-->
<!--								:key="item.roleId"-->
<!--								:label="item.roleName"-->
<!--								:value="item.roleId">-->
<!--						</el-option>-->
<!--					</el-select>-->
<!--				</el-form-item>-->
115
				<el-form-item label="ID">
116
					<span>{{addForm.userId}}</span>
117
				</el-form-item>
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
				<el-row>
					<el-col :span="12">
						<el-form-item label=" " prop="username" :rules="addFormRules.username">
							<el-input v-model="addForm.username" aria-placeholder="用户名长度在5-11位,支持英文和数字">
								<template slot="prepend">账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label=" " prop="realname">
							<el-input v-model="addForm.realname">
								<template slot="prepend">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名</template>
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="12">
						<el-form-item label=" " prop="password" :rules="dialogStatus==='update'?[{ required: false}]:addFormRules.password">
							<el-input v-model="addForm.password" type="password" show-password :disabled="dialogStatus==='update'">
								<template slot="prepend">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label=" " prop="checkPass" :rules="dialogStatus==='update'?[{ required: false}]:addFormRules.checkPass">
							<el-input v-model="addForm.checkPass" type="password" show-password :disabled="dialogStatus==='update'">
								<template slot="prepend">确认密码</template>
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="12">
						<el-form-item label=" " prop="email">
							<el-input v-model="addForm.email">
								<template slot="prepend">Email&nbsp;&nbsp;&nbsp;&nbsp;</template>
							</el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label=" " prop="address">
							<el-input v-model="addForm.address">
								<template slot="prepend">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</template>
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="12">
						<el-form-item label=" " prop="mobilephone">
							<el-input v-model="addForm.mobilephone">
								<template slot="prepend">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话</template>
							</el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-divider></el-divider>
				<el-row>
					<el-col :span="12">
						<el-form-item label="性别" prop="sex">
							<el-radio-group v-model="addForm.sex">
								<el-radio class="radio" :label="1">男</el-radio>
								<el-radio class="radio" :label="0">女</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="启用" prop="state">
							<el-radio-group v-model="addForm.state">
								<el-radio class="radio" :label="true" >是</el-radio>
								<el-radio class="radio" :label="false" >否</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-form-item label="年龄" prop="age">
							<el-input-number v-model="addForm.age" :min="0" :max="200"></el-input-number>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-form-item lable="头像" prop="userface">
							<el-upload
									class="avatar-uploader"
									action="http://127.0.0.1:7003/upload"
									:show-file-list="true"
									accept="image/jpeg,image/jpg,image/png"
									:on-success="handleAvatarSuccess"
									:before-upload="beforeAvatarUpload"
朱兆平 authored
211
							>
212 213 214 215 216 217
								<img v-if="faceImageUrl" :src="faceImageUrl" class="avatar">
								<i v-else class="el-icon-plus avatar-uploader-icon"></i>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
218 219 220
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click.native="addFormVisible = false">取消</el-button>
221
				<el-button type="primary" @click.native="dialogStatus==='create'?addSubmit():editSubmit()" :loading="addLoading">提交</el-button>
222 223
			</div>
		</el-dialog>
朱兆平 authored
224 225

		<!--权限设置-->
小范 authored
226
		<el-dialog title="权限设置" :visible.sync="roleFormVisible" :close-on-click-modal="false" class="roleDialog" width="65%">
朱兆平 authored
227 228 229 230 231 232 233
			<el-form :model="roleEditForm" label-width="80px"  ref="roleEditForm" >
				<el-form-item label="ID">
					<span>{{roleEditForm.userId}}</span>
				</el-form-item>
				<el-form-item label="账号">
					<span>{{roleEditForm.username}}</span>
				</el-form-item>
朱兆平 authored
234
				<el-tree :data="roles" :props="treeDefaultProps" default-expand-all show-checkbox highlight-current check-strictly node-key="roleId"  ref="tree" @check-change="treeHandleCheckChange">
235
				</el-tree>
朱兆平 authored
236
			</el-form>
237
朱兆平 authored
238 239 240 241 242
			<div slot="footer" class="dialog-footer">
				<el-button @click.native="roleFormVisible = false">取消</el-button>
				<el-button type="primary" @click.native="roleEditSubmit" :loading="addLoading">提交</el-button>
			</div>
		</el-dialog>
朱兆平 authored
243 244
	</section>
</template>
245
朱兆平 authored
246
<script>
247
	import util from '../../common/js/util'
朱兆平 authored
248
	import NProgress from 'nprogress'
朱兆平 authored
249
	import { getUserList, removeUser, batchRemoveUser, editUser, addUser, setUserRole,userLock } from '../../api/user';
朱兆平 authored
250
    import { getList} from '../../api/role_api';
251
	import { getList as getRoleList} from '../../api/role_api';
252
    import moment from 'moment'
朱兆平 authored
253
	export default {
254
    	name:'User',
朱兆平 authored
255
		data() {
256 257 258 259 260 261 262 263 264 265
			var validatePass = (rule, value, callback) => {
				if (value === '') {
					callback(new Error('请输入密码'));
				} else {
					if (this.checkPass !== '') {
						this.$refs.addForm.validateField('checkPass');
					}
					callback();
				}
			};
朱兆平 authored
266 267
			return {
				filters: {
shenhailong authored
268
                    userName: '',
朱兆平 authored
269
					realName: '',
朱兆平 authored
270
					userStatus: undefined
朱兆平 authored
271
				},
272 273 274 275
				treeDefaultProps: {
                    children: 'children',
                    label: 'roleName',
                },
276 277 278 279 280
				dialogMap: {
					update: '编辑',
					create: '新增',
				},
				dialogStatus: 'create',
281 282 283
				users: [],
				total: 0,
                pageNum: 1,
朱兆平 authored
284
                pageSize: 10,
朱兆平 authored
285
                faceImageUrl: '',
286 287 288 289 290 291 292
				listLoading: false,
				sels: [],//列表选中列
				//编辑界面是否显示
				addFormVisible: false,//新增界面是否显示
				addLoading: false,
				addFormRules: {
                    username: [
朱兆平 authored
293 294 295 296
						{ required: true, message: '请输入姓名,用户名长度在5-11位,支持英文和数字', trigger: 'blur' },
					],
					password: [
						{ required: true, message: '请输入密码,用户名长度在6-18位,支持英文和数字和非空字符', trigger: 'blur'}
297
					],
298 299
					checkPass: [
						{ required: true, message: '请输入密码,用户名长度在6-18位,支持英文和数字和非空字符', trigger: 'blur'}
300 301
					]
				},
朱兆平 authored
302 303
				//用户角色配置
                roleFormVisible: false,
304
				//新增界面数据
305
306
				addForm: {
307 308
					checkPass:'',
					userId: 0,
309 310 311 312 313 314 315
                    username: '',
                    password: '',
                    sex: 1,
                    address: '',
                    realname: '',
                    email:	'',
                    mobilephone: '',
316
					age: 1,
317
					state: true
朱兆平 authored
318 319 320 321 322 323 324
				},
                roleEditForm: {
                    userId: 1,
					username: "",
					roles: []
				},
				roles: [],
325
                roleIds: [],
326
				options: [],
朱兆平 authored
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
				userStatusOption: [
					{
						label:"锁定",
						code: 0
					},
					{
						label:"在线",
						code: 1
					},
					{
						label:"离线",
						code: 2
					},
					{
						label:"过期",
						code: 3
					},
				]
朱兆平 authored
345 346 347 348 349 350 351
			}
		},
		methods: {
			//性别显示转换
			formatSex: function (row, column) {
				return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
			},
352 353 354 355 356 357 358
            formatState: function (row, column) {
                return row.state == true ? '是' : row.state == false ? '否' : '未知';
            },
			handleCurrentChange(val) {
				this.pageNum = val;
				this.getUsers();
			},
朱兆平 authored
359
			//获取用户列表
360
			getUsers:function() {
朱兆平 authored
361
				let para = {
362 363
                    pageNum: this.pageNum,
                    pageSize: this.pageSize,
shenhailong authored
364
                    userName: this.filters.userName,
朱兆平 authored
365 366
                    realName: this.filters.realName,
					userStatus: this.filters.userStatus
朱兆平 authored
367
				};
368
				this.listLoading = true;
朱兆平 authored
369
                getUserList(para).then((res) => {
朱兆平 authored
370 371 372
                    let response = res.data.data;
					this.total = response.total;
					this.users = response.list;
373
					this.listLoading = false;
朱兆平 authored
374
					//NProgress.done();
375 376
				}).catch((error) => {
                    this.listLoading = false;
朱兆平 authored
377
                    this.$message.error(error.toString());
378 379 380
				});

			},
朱兆平 authored
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
			// 禁用与启用用户
			lockUser: function(index, row, stateCode){
				this.listLoading = true;
				let para = {
					userId: row.userId,
					username:row.username,
					state: stateCode
				};
				userLock(para).then((res) => {
					this.$message({
						message: '操作成功',
						type: 'success'
					});
					this.getUsers();
				}).catch((e) => {
					this.$message({
						message: '操作失败',
						type: 'error'
					});
				}).finally(()=>{
					this.listLoading = false;
				});
			},
404 405 406
			// 获取公司列表
			getCompanyNmae(){
				let para = {
shenhailong authored
407
					type: "公司"
408 409 410 411 412
				};
				getRoleList(para).then((res) => {
					this.options = res.data.list;
				}).catch(() => {
朱兆平 authored
413 414
				}).finally(()=>{
					this.listLoading = false;
415 416
				});
			},
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
			//删除
			handleDel: function (index, row) {
				this.$confirm('确认删除该记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
					let para = { userId: row.userId };
					removeUser(para).then((res) => {
						this.listLoading = false;
						//NProgress.done();
						this.$message({
							message: '删除成功',
							type: 'success'
						});
						this.getUsers();
					}).catch((error) => {
                        this.listLoading = false;
                        alert(error);
					});
				}).catch();
			},
            /**
			 * 显示编辑界面
             * @param index
             * @param row 为这行的数据对象
             */
			handleEdit: function (index, row) {
445 446 447
				this.addFormVisible = true;
				this.dialogStatus= 'update',
				this.addForm = Object.assign({}, row);
448
			},
朱兆平 authored
449
            roleEdit: function (index, row) {
450 451
                this.roleFormVisible = true;
                this.getRoles();
朱兆平 authored
452 453 454
                var _this = this;
                _this.roleIds = [];
                this.roleEditForm = Object.assign({}, row);
455 456 457 458 459 460 461
                let roles = this.roleEditForm.roles;

                if (util.checkNull(roles)){
                    roles.forEach(function (role,v_index,v_arr) {
                        if (util.checkNull(role)) {
                            _this.roleIds[v_index] = role.roleId;
                        }
朱兆平 authored
462 463
                    });
				}
464 465 466 467
                this.$nextTick(() => {
                    //反向适配
                    this.$refs.tree.setCheckedKeys(this.roleIds);
                });
朱兆平 authored
468 469 470 471 472 473
            },
            getRoles() {
                let para = {
                    pageNum: 1,
                    pageSize: 100
                };
朱兆平 authored
474 475 476 477 478 479 480 481 482 483
				let ld = this.$loading({
					text:"加载中...",
					target:".roleDialog"
				})
				// 解决bug loading显示在弹窗下面!!!!
				setTimeout(() => {
					this.$nextTick(() => {
						document.querySelector(".el-loading-mask").style.zIndex = "999999";
					});
				});
朱兆平 authored
484 485 486 487 488 489 490 491 492 493
                getList(para).then((res) => {
                    this.roles = res.data.list;
                }).catch((error) => {
                    if(null!= error.response && error.response!==undefined){
                        let status= error.response.status;
                        let msg = error.response.statusText;
                        alert(status+msg);
                    }else {
                        alert(error);
                    }
朱兆平 authored
494 495 496
                }).finally(() =>{
					ld.close()
				});
朱兆平 authored
497
498
朱兆平 authored
499
            },
500 501 502
			//显示新增界面,每次点开初始化数据
			handleAdd: function () {
				this.addFormVisible = true;
503
				this.dialogStatus= 'create',
504 505 506
				this.addForm = {
                    username: '',
                    password: '',
507
					checkPass: '',
508 509 510 511 512
                    sex: 1,
                    address: '',
                    realname: '',
                    email:	'',
                    mobilephone: '',
513
                    age: 1,
514
					state: true
515 516 517 518
				};
			},
			//编辑
			editSubmit: function () {
519
				this.$refs.addForm.validate((valid) => {
520 521 522 523
					if (valid) {
						this.$confirm('确认提交吗?', '提示', {}).then(() => {
							this.editLoading = true;
							//NProgress.start();
524
							let para = Object.assign({}, this.addForm);
525 526 527 528
							//不需要提交的 去掉,后端不好接收
							para.authorities = null;
							para.permissions = null;
							para.roles = null;
529
							this.$delete(para,'checkPass')
530 531 532 533 534 535 536 537
//							para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
                            /*
        					查询之后格式this.filters.column.create_start_date中日期发生变化;
        					Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z";
        					所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格
        					式;
    						*/
							/*moment 安装 npm install moment --save*/
朱兆平 authored
538
//                            para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss');
539 540 541 542 543 544 545 546
                            this.editLoading = false;
							editUser(para).then((res) => {

								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
547 548
								this.$refs['addForm'].resetFields();
								this.addFormVisible = false;
549 550 551 552 553 554 555 556 557 558 559 560 561
								this.getUsers();
							}).catch(error => alert(error));
						});
					}
				});
			},
			//新增
			addSubmit: function () {
				this.$refs.addForm.validate((valid) => {
					if (valid) {
						this.$confirm('确认提交吗?', '提示', {}).then(() => {
							this.addLoading = true;
							let para = Object.assign({}, this.addForm);
562
							this.$delete(para,'checkPass')
shenhailong authored
563
//							para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd');
564 565 566 567 568 569 570 571 572 573
							addUser(para).then((res) => {
								this.addLoading = false;
								//NProgress.done();
								this.$message({
									message: '提交成功',
									type: 'success'
								});
								this.$refs['addForm'].resetFields();
								this.addFormVisible = false;
								this.getUsers();
朱兆平 authored
574 575
							}).catch(error => {
                                this.addLoading = false;
朱兆平 authored
576 577 578 579
								this.$message({
									message: error.message,
									type: 'error'
								});
朱兆平 authored
580
							});
581 582 583 584
						});
					}
				});
			},
585
586 587 588 589 590
			selsChange: function (sels) {
				this.sels = sels;
			},
			//批量删除
			batchRemove: function () {
591
				var ids = this.sels.map(item => item.userId).toString();
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
				this.$confirm('确认删除选中记录吗?', '提示', {
					type: 'warning'
				}).then(() => {
					this.listLoading = true;
					//NProgress.start();
					let para = { ids: ids };
					batchRemoveUser(para).then((res) => {
						this.listLoading = false;
						//NProgress.done();
						this.$message({
							message: '删除成功',
							type: 'success'
						});
						this.getUsers();
					});
				}).catch(() => {
朱兆平 authored
609
				});
朱兆平 authored
610 611 612 613 614
			},
            roleEditSubmit: function () {
                this.$confirm('确认提交吗?', '提示', {}).then(() => {
//                    this.editLoading = true;
                    let userId = this.roleEditForm.userId;
朱兆平 authored
615
                    let roleIds = this.$refs.tree.getCheckedKeys();
朱兆平 authored
616 617 618
                    let para = {userId,roleIds};
                    setUserRole(para).then((res) => {
                        if (res.status ===200) {
619 620 621 622
                            this.$message({
                                message: '岗位设置成功',
                                type: 'success'
                            });
朱兆平 authored
623 624 625 626 627 628 629 630
						}
						this.getUsers();
                        this.roleFormVisible = false;
                    }).catch(err => {
                        alert(err);
					});
                    console.log(para);
				});
朱兆平 authored
631 632 633 634 635
            },
            handleAvatarSuccess: function(response){
                this.faceImageUrl = 'http://127.0.0.1:7003/'+response.data;
			},
            beforeAvatarUpload: function () {
朱兆平 authored
636
637 638 639 640 641 642 643 644 645
            },
            treeHandleCheckChange: function (data, checked, indeterminate) {
                if(checked) {
                    this.roleIds.push(data.roleId);
				}else {
                    this.roleIds.splice(this.roleIds.contains(data.roleId),1);
				}
//                console.log(data, checked, indeterminate);
                console.log(this.roleIds);
朱兆平 authored
646
            }
朱兆平 authored
647 648
		},
		mounted() {
649
			this.getUsers();
650
			// this.getCompanyNmae();
朱兆平 authored
651 652 653 654 655 656
		},
		computed: {
            hideShow() {//当图片多于一张的时候,就隐藏上传框
                return this.file === '' ? false : true
            }
        },
657
	}
朱兆平 authored
658 659 660

</script>
661 662 663 664 665 666 667 668 669 670 671 672
<style lang="scss">
	.user-form{
		.el-form-item__label{
			font-size: 12px;
		}
		.el-form-item__content{
			width: 260px;
			.el-textarea{
				width:100%;
			}
		}
	}
朱兆平 authored
673
674
</style>
朱兆平 authored
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700
<style scoped>
	.toolbar{
		height: 60px;
		background-color: white;
		/*line-height: 60px;*/
		vertical-align: middle;
		border-radius: 5px 5px 5px 5px;
		padding: 15px 0 0 20px;
		box-shadow: 0px 5px 5px #e5e8eb;
	}
	.my-text-area .prepand{
		float: left;
		width:89px;
		height: 28px;
		font-size: 12px;
		line-height: 28px;
	}
</style>
<style>
	.my-text-area .el-textarea__inner{
		min-height: 28px;
		height: 28px;
		border-bottom-left-radius: 0;
		border-top-left-radius: 0;
	}
</style>