2019-12-03 11:19:45 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
|
.account {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
}
|
2019-12-06 17:36:33 +08:00
|
|
|
|
|
2019-12-10 17:00:28 +08:00
|
|
|
|
.content-right-option {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
margin-right: 6px;
|
|
|
|
|
|
}
|
2019-12-10 17:00:28 +08:00
|
|
|
|
.content-right-option .el-icon-delete {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
color: #F98D9A;
|
|
|
|
|
|
}
|
2019-12-10 17:00:28 +08:00
|
|
|
|
.content-right-option .el-icon-delete:hover {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
color: #D96D7A;
|
|
|
|
|
|
}
|
2019-12-10 17:00:28 +08:00
|
|
|
|
.content-right-option .el-icon-view {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
color: #60BEFF;
|
|
|
|
|
|
}
|
2019-12-10 17:00:28 +08:00
|
|
|
|
.content-right-option .el-icon-view:hover {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
color: #409EFF;
|
|
|
|
|
|
}
|
2019-12-03 11:19:45 +08:00
|
|
|
|
|
|
|
|
|
|
/* begin--右弹框滑入滑出动画*/
|
|
|
|
|
|
@keyframes slide-in-from-right {
|
|
|
|
|
|
from {right: -800px}
|
|
|
|
|
|
to {right: 0}
|
|
|
|
|
|
}
|
|
|
|
|
|
@keyframes slide-out-to-right {
|
|
|
|
|
|
from {right: 0}
|
|
|
|
|
|
to {right: -800px}
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-box-enter-active {
|
|
|
|
|
|
animation: slide-in-from-right 0.4s;
|
|
|
|
|
|
}
|
|
|
|
|
|
.right-box-leave-active {
|
|
|
|
|
|
animation: slide-out-to-right 0.4s;
|
|
|
|
|
|
}
|
|
|
|
|
|
/* end--右弹框滑入滑出动画*/
|
|
|
|
|
|
</style>
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div class="account">
|
2019-12-06 17:36:33 +08:00
|
|
|
|
<div class="content-left">
|
2019-12-10 17:00:28 +08:00
|
|
|
|
<div class="sidebar-title">Config</div>
|
|
|
|
|
|
<div class="sidebar-info">
|
|
|
|
|
|
<div class="sidebar-info-item sidebar-info-top sidebar-info-item-active">Account List</div>
|
|
|
|
|
|
<div class="sidebar-info-item" @click="jumpTo('promServer')">Prometheus Server</div>
|
2019-12-06 17:36:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
<div class="content-right">
|
|
|
|
|
|
<div class="top-tools">
|
2019-12-25 17:15:09 +08:00
|
|
|
|
<button @click="toAdd" class="nz-btn nz-btn-size-normal nz-btn-style-normal float-right">
|
|
|
|
|
|
<span class="top-tool-btn-txt">{{$t('overall.add')}}</span>
|
|
|
|
|
|
</button>
|
2019-12-25 20:33:58 +08:00
|
|
|
|
<div class="top-tool-search float-right"><search-input :searchMsg="searchMsg" @search="search"></search-input></div>
|
2019-12-10 17:00:28 +08:00
|
|
|
|
</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-table
|
|
|
|
|
|
:data="tableData"
|
|
|
|
|
|
border
|
2019-12-05 15:46:40 +08:00
|
|
|
|
height="calc(100% - 65px)"
|
|
|
|
|
|
style="width: 100%;">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-table-column
|
2019-12-26 16:31:53 +08:00
|
|
|
|
:resizable="false"
|
2019-12-03 11:19:45 +08:00
|
|
|
|
v-for="(item, index) in tableTitle"
|
|
|
|
|
|
v-if="item.show"
|
|
|
|
|
|
:width="item.width"
|
2019-12-05 15:46:40 +08:00
|
|
|
|
:key="`col-${index}`"
|
2019-12-03 11:19:45 +08:00
|
|
|
|
:label="item.label"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template slot-scope="scope" :column="item">
|
2019-12-10 17:00:28 +08:00
|
|
|
|
<div v-if="item.prop == 'option'" class="content-right-options">
|
|
|
|
|
|
<span @click="del(scope.row)" class="content-right-option"><i class="el-icon-delete"></i></span>
|
|
|
|
|
|
<span @click="detail(scope.row)" class="content-right-option"><i class="el-icon-view"></i></span>
|
|
|
|
|
|
<span @click="edit(scope.row)" class="content-right-option"><i class="el-icon-edit-outline"></i></span>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<span v-else-if="item.prop == 'lang'">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
{{scope.row[item.prop] == 'en' ? 'English' : ''}}
|
|
|
|
|
|
{{scope.row[item.prop] == 'zh' ? '中文' : ''}}
|
|
|
|
|
|
{{scope.row[item.prop] == 'ru' ? 'русский' : ''}}
|
|
|
|
|
|
</span>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<span v-else-if="item.prop == 'receiver'">
|
|
|
|
|
|
<template v-for="rec in scope.row[item.prop]">{{rec.name}} </template>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
<span v-else-if="item.prop == 'status'">
|
|
|
|
|
|
<el-switch
|
2019-12-09 19:23:20 +08:00
|
|
|
|
v-model="scope.row.status"
|
2019-12-05 15:46:40 +08:00
|
|
|
|
active-value="1"
|
2019-12-19 17:22:18 +08:00
|
|
|
|
inactive-value="0"
|
|
|
|
|
|
@change="(val)=>{statusChange(scope.row)}">
|
2019-12-05 15:46:40 +08:00
|
|
|
|
</el-switch>
|
|
|
|
|
|
</span>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<span v-else>{{scope.row[item.prop]}}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
</el-table>
|
2019-12-06 17:36:33 +08:00
|
|
|
|
<Pagination :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
2019-12-06 17:36:33 +08:00
|
|
|
|
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<transition name="right-box">
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box right-box-account" v-if="rightBox.show">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<!-- begin--顶部按钮-->
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-top-btns">
|
2019-12-05 18:07:58 +08:00
|
|
|
|
<div class="right-box-top-btn right-box-top-btn-full" @click="esc()">
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-btn-icon">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<i class="el-icon-close"></i>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<span>{{$t('overall.esc')}}</span>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-top-btn right-box-top-btn-full" @click="saveOrToEdit">
|
|
|
|
|
|
<div class="right-box-btn-icon">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<i class="el-icon-edit-outline"></i>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<span v-if="rightBox.isEdit">{{$t('overall.save')}}</span>
|
|
|
|
|
|
<span v-else>{{$t('overall.edit')}}</span>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
2019-12-19 17:22:18 +08:00
|
|
|
|
<div class="right-box-top-btn" v-if="rightBox.isEdit && user.userId != ''" @click="del(user)">
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-btn-icon">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<i class="el-icon-delete"></i>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<span>{{$t('overall.delete')}}</span>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--顶部按钮-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--标题-->
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-title">{{rightBox.title}}</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<!-- end--标题-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--表单-->
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form">
|
|
|
|
|
|
<div class="right-box-form-row">
|
|
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.account')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
v-if="rightBox.isEdit"
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder=""
|
|
|
|
|
|
v-model="user.username"
|
|
|
|
|
|
maxlength="64"
|
|
|
|
|
|
show-word-limit
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
></el-input>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{user.username}}</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-24 17:31:51 +08:00
|
|
|
|
<div class="right-box-form-row" v-if="rightBox.isEdit && !user.userId">
|
|
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.password')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
placeholder=""
|
|
|
|
|
|
v-model="user.password"
|
|
|
|
|
|
maxlength="16"
|
|
|
|
|
|
show-word-limit
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
></el-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-row">
|
|
|
|
|
|
<div class="right-box-form-label">E-mail</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
v-if="rightBox.isEdit"
|
|
|
|
|
|
placeholder=""
|
|
|
|
|
|
v-model="user.email"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
></el-input>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div v-if="!rightBox.isEdit" class="right-box-form-content-txt">{{user.email}}</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-25 17:15:09 +08:00
|
|
|
|
<!--<div class="right-box-form-row">
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.receiver')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
2019-12-11 17:15:23 +08:00
|
|
|
|
<el-select class="right-box-row-with-btn" value-key="id" popper-class="config-dropdown" multiple v-model="user.receiver" placeholder="" v-if="rightBox.isEdit" size="small">
|
2019-12-04 15:15:10 +08:00
|
|
|
|
<el-option
|
|
|
|
|
|
@click.native="blurEditReceiver()"
|
|
|
|
|
|
v-for="item in receiverData"
|
|
|
|
|
|
:key="item.id"
|
|
|
|
|
|
:label="item.name"
|
2019-12-05 15:46:40 +08:00
|
|
|
|
:value="item">
|
2019-12-05 18:07:58 +08:00
|
|
|
|
<span class="config-dropdown-label-txt" v-if="!item.isEdit">{{item.name}}</span>
|
2019-12-13 17:08:35 +08:00
|
|
|
|
<span class="config-dropdown-label-input" v-if="item.isEdit" @click.stop>
|
2019-12-04 15:15:10 +08:00
|
|
|
|
<el-input
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
v-model="item.name"
|
|
|
|
|
|
size="mini"
|
|
|
|
|
|
></el-input>
|
|
|
|
|
|
</span>
|
2019-12-05 18:07:58 +08:00
|
|
|
|
<span class="config-dropdown-error-message">{{item.errorMessage}}</span>
|
|
|
|
|
|
<span class="config-dropdown-btn" @click.stop="toEditReceiver(item)">
|
2019-12-04 15:15:10 +08:00
|
|
|
|
<i class="el-icon-edit-outline" v-if="!item.isEdit"></i>
|
|
|
|
|
|
<i class="el-icon-check" v-if="item.isEdit"></i>
|
|
|
|
|
|
</span>
|
2019-12-05 18:07:58 +08:00
|
|
|
|
<span class="config-dropdown-btn config-dropdown-btn-delete" @click.stop="toDelReceiver(item)"><i class="el-icon-delete"></i></span>
|
2019-12-04 15:15:10 +08:00
|
|
|
|
</el-option>
|
|
|
|
|
|
</el-select>
|
2019-12-11 17:15:23 +08:00
|
|
|
|
<div class="right-box-row-btn" v-if="rightBox.isEdit">
|
2019-12-04 15:15:10 +08:00
|
|
|
|
<span class="el-icon-plus"></span>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-content-txt" v-if="!rightBox.isEdit">
|
|
|
|
|
|
<template v-for="rec in user.receiver">{{rec.name}}</template>
|
|
|
|
|
|
</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
2019-12-25 17:15:09 +08:00
|
|
|
|
</div>-->
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-row">
|
|
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.language')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-radio v-model="user.lang" label="en" :disabled="!rightBox.isEdit && user.lang != 'en'">English</el-radio>
|
|
|
|
|
|
<el-radio v-model="user.lang" label="zh" :disabled="!rightBox.isEdit && user.lang != 'zh'">中文</el-radio>
|
2019-12-25 17:15:09 +08:00
|
|
|
|
<!--<el-radio v-model="user.lang" label="ru" disabled>русский({{$t('config.account.notCurrentlySupport')}})</el-radio>-->
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-row">
|
|
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.enable')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
2019-12-03 11:19:45 +08:00
|
|
|
|
<el-switch
|
|
|
|
|
|
v-model="user.status"
|
2019-12-04 15:15:10 +08:00
|
|
|
|
:disabled="!rightBox.isEdit"
|
2019-12-03 11:19:45 +08:00
|
|
|
|
active-value="1"
|
|
|
|
|
|
inactive-value="0">
|
|
|
|
|
|
</el-switch>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-form-row" v-if="!rightBox.isEdit">
|
|
|
|
|
|
<div class="right-box-form-label">{{$t('config.account.createTime')}}</div>
|
|
|
|
|
|
<div class="right-box-form-content">
|
|
|
|
|
|
<div class="right-box-form-content-txt">{{user.createTime}}</div>
|
2019-12-04 15:15:10 +08:00
|
|
|
|
</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--表单-->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- begin--底部按钮-->
|
2019-12-05 15:46:40 +08:00
|
|
|
|
<div class="right-box-bottom-btns">
|
2019-12-13 17:08:35 +08:00
|
|
|
|
<div @click="esc()" :class="{'right-box-bottom-btn-50': rightBox.isEdit}" class="right-box-bottom-btn right-box-bottom-btn-cancel">{{$t('overall.cancel')}}</div><div @click="save" v-if="rightBox.isEdit" class="right-box-bottom-btn right-box-bottom-btn-50">{{user.userId == '' ? $t('overall.create') : $t('overall.save')}}</div>
|
2019-12-03 11:19:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<!-- end--底部按钮-->
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</transition>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "account",
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
rightBox: { //弹出框相关
|
|
|
|
|
|
show: false,
|
|
|
|
|
|
isEdit: false, //false查看,true编辑
|
|
|
|
|
|
title: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
user: {
|
|
|
|
|
|
userId: '',
|
|
|
|
|
|
username: '',
|
|
|
|
|
|
email: '',
|
|
|
|
|
|
status: '1',
|
|
|
|
|
|
createTime: '',
|
2019-12-04 15:15:10 +08:00
|
|
|
|
receiver: [],
|
2019-12-03 11:19:45 +08:00
|
|
|
|
lang: ''
|
|
|
|
|
|
},
|
2019-12-05 15:46:40 +08:00
|
|
|
|
pageObj: {
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
pageSize: 20,
|
2019-12-09 19:23:20 +08:00
|
|
|
|
total:0
|
2019-12-05 15:46:40 +08:00
|
|
|
|
},
|
2019-12-03 11:19:45 +08:00
|
|
|
|
tableTitle: [
|
|
|
|
|
|
{
|
|
|
|
|
|
label: 'ID',
|
2019-12-09 19:23:20 +08:00
|
|
|
|
prop: 'userId',
|
2019-12-03 11:19:45 +08:00
|
|
|
|
show: true,
|
|
|
|
|
|
width: 80
|
|
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t("config.account.account"),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'username',
|
|
|
|
|
|
show: true,
|
2019-12-05 15:46:40 +08:00
|
|
|
|
width: 240
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}, {
|
|
|
|
|
|
label: 'E-mail',
|
|
|
|
|
|
prop: 'email',
|
|
|
|
|
|
show: true,
|
2019-12-05 15:46:40 +08:00
|
|
|
|
width: 240
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t("config.account.language"),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'lang',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 200
|
|
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t('config.account.receiver'),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'receiver',
|
2019-12-25 17:15:09 +08:00
|
|
|
|
show: false,
|
2019-12-05 15:46:40 +08:00
|
|
|
|
width: 240
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t('config.account.createTime'),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'createTime',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t('config.account.enable'),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'status',
|
|
|
|
|
|
show: true,
|
|
|
|
|
|
width: 100
|
|
|
|
|
|
}, {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
label: this.$t('config.account.option'),
|
2019-12-03 11:19:45 +08:00
|
|
|
|
prop: 'option',
|
|
|
|
|
|
show: true,
|
2019-12-11 17:15:23 +08:00
|
|
|
|
width: 100
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
],
|
2019-12-09 19:23:20 +08:00
|
|
|
|
tableData: [],
|
2019-12-04 15:15:10 +08:00
|
|
|
|
receiverData: [{
|
|
|
|
|
|
id: '1',
|
2019-12-05 15:46:40 +08:00
|
|
|
|
name: 'group1',
|
2019-12-04 15:15:10 +08:00
|
|
|
|
description: '小组1desc'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: '2',
|
2019-12-05 15:46:40 +08:00
|
|
|
|
name: 'group2',
|
2019-12-04 15:15:10 +08:00
|
|
|
|
description: '小组2desc'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: '3',
|
|
|
|
|
|
name: '小组3',
|
|
|
|
|
|
description: '小组3desc'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: '4',
|
|
|
|
|
|
name: '小组4',
|
|
|
|
|
|
description: '小组4desc'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: '5',
|
|
|
|
|
|
name: '小组啊小组5',
|
|
|
|
|
|
description: '小组5desc'
|
|
|
|
|
|
}, {
|
|
|
|
|
|
id: '6',
|
|
|
|
|
|
name: '小组6',
|
|
|
|
|
|
description: '小组6desc'
|
2019-12-18 17:00:44 +08:00
|
|
|
|
}],
|
|
|
|
|
|
searchMsg: { //给搜索框子组件传递的信息
|
|
|
|
|
|
zheze_none: true,
|
2019-12-20 17:18:30 +08:00
|
|
|
|
searchLabelList: [{
|
2019-12-18 17:00:44 +08:00
|
|
|
|
id: 10,
|
|
|
|
|
|
name: this.$t('config.account.account'),
|
|
|
|
|
|
type: 'input',
|
|
|
|
|
|
label: 'username',
|
|
|
|
|
|
disabled: false
|
2019-12-20 17:18:30 +08:00
|
|
|
|
}],
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
2019-12-20 17:18:30 +08:00
|
|
|
|
searchLabel: {}, //搜索参数
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2019-12-04 15:15:10 +08:00
|
|
|
|
edit: function(u) {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
this.user = Object.assign({}, u);
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.rightBox.isEdit = true;
|
2019-12-05 18:07:58 +08:00
|
|
|
|
this.rightBox.title = this.$t("config.account.editAccount") + " ID:" + u.userId;
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.rightBox.show = true;
|
|
|
|
|
|
},
|
2019-12-04 15:15:10 +08:00
|
|
|
|
del: function(u) {
|
2019-12-19 17:22:18 +08:00
|
|
|
|
this.$confirm(this.$t("tip.confirmDelete"), {
|
|
|
|
|
|
confirmButtonText: this.$t("tip.yes"),
|
|
|
|
|
|
cancelButtonText: this.$t("tip.no"),
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
this.$delete("sys/user/delete?userIds=" + u.userId).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.deleteSuccess")});
|
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2019-12-03 11:19:45 +08:00
|
|
|
|
},
|
2019-12-04 15:15:10 +08:00
|
|
|
|
detail: function(u) {
|
2019-12-05 15:46:40 +08:00
|
|
|
|
this.user = Object.assign({}, u);
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.rightBox.isEdit = false;
|
2019-12-05 18:07:58 +08:00
|
|
|
|
this.rightBox.title = this.$t("config.account.account") + " ID:" + u.userId;
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.rightBox.show = true;
|
|
|
|
|
|
},
|
2019-12-09 19:23:20 +08:00
|
|
|
|
getTableData: function() {
|
2019-12-18 17:00:44 +08:00
|
|
|
|
this.$set(this.searchLabel, "pageNo", this.pageObj.pageNo);
|
|
|
|
|
|
this.$set(this.searchLabel, "pageSize", this.pageObj.pageSize);
|
|
|
|
|
|
this.$get('sys/user/list', this.searchLabel).then(response => {
|
2019-12-09 19:23:20 +08:00
|
|
|
|
if (response.code === 200) {
|
2019-12-26 16:31:53 +08:00
|
|
|
|
for (let i = 0; i < response.data.list.length; i++) {
|
2019-12-09 19:23:20 +08:00
|
|
|
|
response.data.list[i].status = response.data.list[i].status + "";
|
|
|
|
|
|
}
|
|
|
|
|
|
this.tableData = response.data.list;
|
|
|
|
|
|
this.pageObj.total = response.data.total
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2019-12-10 17:00:28 +08:00
|
|
|
|
toAdd: function() {
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.cleanUser();
|
|
|
|
|
|
this.rightBox.isEdit = true;
|
2019-12-05 15:46:40 +08:00
|
|
|
|
this.rightBox.title = this.$t("config.account.createAccount");
|
2019-12-03 11:19:45 +08:00
|
|
|
|
this.rightBox.show = true;
|
|
|
|
|
|
},
|
2019-12-13 17:08:35 +08:00
|
|
|
|
save: function() {
|
2019-12-19 17:22:18 +08:00
|
|
|
|
if (this.user.userId) {
|
|
|
|
|
|
this.$put('sys/user/update', this.user).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
});
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$post('sys/user/save', this.user).then(response => {
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
|
this.rightBox.show = false;
|
|
|
|
|
|
this.$message({duration: 1000, type: 'success', message: this.$t("tip.saveSuccess")});
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.$message.error(response.msg);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2019-12-13 17:08:35 +08:00
|
|
|
|
},
|
2019-12-04 15:15:10 +08:00
|
|
|
|
saveOrToEdit: function() {
|
|
|
|
|
|
if (!this.rightBox.isEdit) {
|
|
|
|
|
|
this.rightBox.isEdit = true;
|
2019-12-05 18:07:58 +08:00
|
|
|
|
this.rightBox.title = this.$t("config.account.editAccount") + " ID:" + this.user.userId;
|
2019-12-09 19:23:20 +08:00
|
|
|
|
} else {
|
2019-12-13 17:08:35 +08:00
|
|
|
|
this.save();
|
2019-12-04 15:15:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-19 17:22:18 +08:00
|
|
|
|
statusChange: function(user) {
|
|
|
|
|
|
this.user = user;
|
|
|
|
|
|
this.save();
|
|
|
|
|
|
},
|
2019-12-10 17:00:28 +08:00
|
|
|
|
jumpTo(data,id) {
|
2019-12-13 17:08:35 +08:00
|
|
|
|
this.$store.state.assetData.moduleData = data;
|
|
|
|
|
|
this.$store.state.assetData.selectedData = id;
|
2019-12-10 17:00:28 +08:00
|
|
|
|
this.$router.push({
|
|
|
|
|
|
path: "/" + data,
|
|
|
|
|
|
query: {
|
|
|
|
|
|
t: +new Date()
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2019-12-04 15:15:10 +08:00
|
|
|
|
toEditReceiver: function(item) {
|
|
|
|
|
|
if (!item.isEdit) {
|
|
|
|
|
|
//如果不在编辑状态,那么其他项如果有改动,则还原改动,最后开始编辑
|
|
|
|
|
|
this.blurEditReceiver();
|
|
|
|
|
|
item.isEdit = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//如果已在编辑状态,判断name是否有变更,有变更则发请求
|
|
|
|
|
|
if (item.name != item.oldName) {
|
|
|
|
|
|
if (this.updateReceiverName(item) == 200) {
|
|
|
|
|
|
item.isEdit = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
item.errorMessage = '';
|
|
|
|
|
|
item.isEdit = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
blurEditReceiver: function() {
|
2019-12-26 16:31:53 +08:00
|
|
|
|
for (let i = 0; i < this.receiverData.length; i++) {
|
2019-12-04 15:15:10 +08:00
|
|
|
|
if (this.receiverData[i].isEdit) {
|
|
|
|
|
|
this.receiverData[i].name = this.receiverData[i].oldName;
|
|
|
|
|
|
this.receiverData[i].isEdit = false;
|
|
|
|
|
|
this.receiverData[i].errorMessage = '';
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
toDelReceiver: function(item) {
|
|
|
|
|
|
this.blurEditReceiver();
|
2019-12-09 19:23:20 +08:00
|
|
|
|
//TODO 请求后台,删除用户组
|
2019-12-04 15:15:10 +08:00
|
|
|
|
},
|
2019-12-05 18:07:58 +08:00
|
|
|
|
initReceiverData: function() {
|
2019-12-26 16:31:53 +08:00
|
|
|
|
for (let i = 0; i < this.receiverData.length; i++) {
|
2019-12-04 15:15:10 +08:00
|
|
|
|
this.$set(this.receiverData[i], 'oldName', this.receiverData[i].name);
|
2019-12-05 18:07:58 +08:00
|
|
|
|
this.$set(this.receiverData[i], 'isEdit', false);
|
2019-12-04 15:15:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2019-12-03 11:19:45 +08:00
|
|
|
|
esc: function() {
|
|
|
|
|
|
this.rightBox.show = false;
|
2019-12-04 15:15:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
updateReceiverName: function(item) {
|
|
|
|
|
|
//TODO 请求接口改名
|
2019-12-26 16:31:53 +08:00
|
|
|
|
let code = 200;
|
2019-12-04 15:15:10 +08:00
|
|
|
|
//this.$set(item, 'errorMessage', 'err');
|
|
|
|
|
|
item.errorMessage = '';
|
|
|
|
|
|
item.oldName = item.name;
|
|
|
|
|
|
return code;
|
|
|
|
|
|
},
|
2019-12-03 11:19:45 +08:00
|
|
|
|
cleanUser: function() {
|
|
|
|
|
|
this.user = {
|
|
|
|
|
|
userId: '',
|
|
|
|
|
|
username: '',
|
|
|
|
|
|
email: '',
|
|
|
|
|
|
status: '1',
|
|
|
|
|
|
createTime: '',
|
2019-12-05 15:46:40 +08:00
|
|
|
|
receiver: [],
|
2019-12-03 11:19:45 +08:00
|
|
|
|
lang: 'en'
|
|
|
|
|
|
}
|
2019-12-09 19:23:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
pageNo(val) {
|
|
|
|
|
|
this.pageObj.pageNo = val;
|
|
|
|
|
|
this.getTableData();
|
|
|
|
|
|
},
|
|
|
|
|
|
pageSize(val) {
|
|
|
|
|
|
this.pageObj.pageSize = val;
|
|
|
|
|
|
this.getTableData();
|
2019-12-18 17:00:44 +08:00
|
|
|
|
},
|
|
|
|
|
|
search: function(searchObj) {
|
|
|
|
|
|
this.searchLabel = {};
|
|
|
|
|
|
for (let item in searchObj) {
|
|
|
|
|
|
if (searchObj[item]) {
|
|
|
|
|
|
this.$set(this.searchLabel, item, searchObj[item]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.getTableData();
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}
|
2019-12-04 15:15:10 +08:00
|
|
|
|
},
|
|
|
|
|
|
mounted() {
|
2019-12-09 19:23:20 +08:00
|
|
|
|
this.getTableData();
|
2019-12-05 18:07:58 +08:00
|
|
|
|
this.initReceiverData();
|
2019-12-03 11:19:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|