|
@@ -1,32 +1,79 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
- <div class="setting_title">账户管理</div>
|
|
|
|
- <el-divider></el-divider>
|
|
|
|
-
|
|
|
|
|
|
+ <div class="tree-container">
|
|
|
|
+ <div style="padding: 10px; display: flex;">
|
|
|
|
+ <el-button icon="el-icon-refresh-right" size="small" @click="refreshDepartment()" style="padding: 9px 10px; margin-right: 6px"></el-button>
|
|
|
|
+ <el-input
|
|
|
|
+ placeholder="输入关键字进行过滤"
|
|
|
|
+ size="small"
|
|
|
|
+ clearable
|
|
|
|
+ v-model="filterText">
|
|
|
|
+ </el-input>
|
|
|
|
+ </div>
|
|
|
|
+ <el-tree
|
|
|
|
+ :data="departmentList"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ default-expand-all
|
|
|
|
+ highlight-current
|
|
|
|
+ :expand-on-click-node="false"
|
|
|
|
+ :filter-node-method="filterNode"
|
|
|
|
+ @node-click="handleNodeClick"
|
|
|
|
+ node-key="id"
|
|
|
|
+ ref="listTree">
|
|
|
|
+ <div class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
|
+ <i :class="data.children && data.children.length > 0 ? 'el-icon-folder-opened':'el-icon-document-remove'"></i><span>{{ node.label }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-tree>
|
|
|
|
+ </div>
|
|
<div class="mymain-container">
|
|
<div class="mymain-container">
|
|
- <div class="btn-group clearfix">
|
|
|
|
|
|
+ <div class="screen-container">
|
|
|
|
+ <!-- <div class="top clearfix">
|
|
|
|
+ <div class="title fl">条件筛选</div>
|
|
|
|
+ </div> -->
|
|
|
|
+ <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
|
|
|
|
+ <el-row :gutter="20">
|
|
|
|
+ <el-col :xs="24" :sm="12" :lg="12">
|
|
|
|
+ <el-form-item label="账号名称" prop="name">
|
|
|
|
+ <el-input v-model="screenForm.name" placeholder="请输入账号名称"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :xs="24" :sm="12" :lg="12" class="tr">
|
|
|
|
+ <el-form-item label="">
|
|
|
|
+ <el-button size="small" @click="resetScreenForm">清空</el-button>
|
|
|
|
+ <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="btn-group clearfix" style="margin-top: 20px">
|
|
<div class="fl">
|
|
<div class="fl">
|
|
- <el-button size="small" type="primary" icon="el-icon-plus" @click="addOrEdit('add')" v-if="checkBtnRole('add')">新增账户</el-button>
|
|
|
|
|
|
+ <el-button size="small" type="primary" @click="openAccountForm('add')">添加账号</el-button>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
<div class="fr">
|
|
<div class="fr">
|
|
- <el-select v-model="screenForm.role" placeholder="全部" size="small" style="width: 120px; margin-right: 10px;" @change="getListByScreen">
|
|
|
|
- <el-option label="全部角色" value=""></el-option>
|
|
|
|
- <el-option :label="item.name" :value="item.adminRoleId" v-for="(item, index) in roleList" :key="index"></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- <el-select v-model="screenForm.status" placeholder="全部" size="small" style="width: 120px; margin-right: 10px;" @change="getListByScreen">
|
|
|
|
- <el-option label="全部状态" value=""></el-option>
|
|
|
|
- <el-option :label="item.label" :value="item.value" v-for="(item, index) in select_status" :key="index"></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- <el-input placeholder="请输入内容" v-model="screenForm.keyword" size="small" style="width: 180px;">
|
|
|
|
- <el-button slot="append" icon="el-icon-search" size="small" @click="getListByScreen"></el-button>
|
|
|
|
- </el-input>
|
|
|
|
|
|
+ <!-- <el-upload
|
|
|
|
+ class="import-btn"
|
|
|
|
+ style="height: 0; width: 0; overflow: hidden;"
|
|
|
|
+ :action="baseURL + 'student/import'"
|
|
|
|
+ :http-request="handleImport"
|
|
|
|
+ :file-list="importFileList"
|
|
|
|
+ v-if="checkBtnRole('import')"
|
|
|
|
+ >
|
|
|
|
+ <el-button size="small" type="primary" :loading="importLoading">{{ importLoading ? '导入中...' : '导入' }}</el-button>
|
|
|
|
+ </el-upload>
|
|
|
|
+
|
|
|
|
+ <el-button size="small" type="primary" @click="handleExport">导出</el-button>
|
|
|
|
+
|
|
|
|
+ <el-button size="small" type="primary" :loading="importLoading" @click="clickImport">{{ importLoading ? '导入中...' : '导入' }}</el-button>
|
|
|
|
+
|
|
|
|
+ <el-button size="small" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="table">
|
|
<div class="table">
|
|
<el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
|
|
<el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
|
|
-
|
|
|
|
- <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
|
|
|
|
|
|
+ <!-- <el-table-column align="center" type="selection" width="55" fixed></el-table-column> -->
|
|
<el-table-column align="center" label="账号" prop="userName" min-width="120"></el-table-column>
|
|
<el-table-column align="center" label="账号" prop="userName" min-width="120"></el-table-column>
|
|
<el-table-column align="center" label="用户名" prop="nickName" min-width="120"></el-table-column>
|
|
<el-table-column align="center" label="用户名" prop="nickName" min-width="120"></el-table-column>
|
|
<el-table-column align="center" label="角色" prop="roleName" min-width="100"></el-table-column>
|
|
<el-table-column align="center" label="角色" prop="roleName" min-width="100"></el-table-column>
|
|
@@ -48,13 +95,18 @@
|
|
</el-popconfirm>
|
|
</el-popconfirm>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
- <el-button type="text" @click="addOrEdit('edit', scope.row.adminUserId)" v-if="checkBtnRole('edit')">编辑</el-button>
|
|
|
|
|
|
+ <el-button type="text" @click="openAccountForm('edit', scope.row.adminUserId)" v-if="checkBtnRole('edit')">编辑</el-button>
|
|
<el-button type="text" @click="handleReset(scope.row.adminUserId)" v-if="checkBtnRole('reset')">重置密码</el-button>
|
|
<el-button type="text" @click="handleReset(scope.row.adminUserId)" v-if="checkBtnRole('reset')">重置密码</el-button>
|
|
|
|
+
|
|
|
|
+ <!-- <el-popconfirm style="margin-left: 10px;" title="确定删除吗?" @onConfirm="deleteAccount(scope.row.id)" v-if="checkBtnRole('del')">
|
|
|
|
+ <el-button slot="reference" type="text">删除</el-button>
|
|
|
|
+ </el-popconfirm> -->
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
+
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
|
|
+
|
|
<div class="pagination clearfix">
|
|
<div class="pagination clearfix">
|
|
<div class="fr">
|
|
<div class="fr">
|
|
<el-pagination
|
|
<el-pagination
|
|
@@ -69,40 +121,18 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
- <!-- 重置密码 -->
|
|
|
|
- <el-dialog title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
|
- <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
|
|
|
|
- <el-form-item label="输入新密码" prop="newPassword">
|
|
|
|
- <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入新密码" :type="passwordType1"></el-input>
|
|
|
|
- <span class="show-pwd" @click="showPwd(1)">
|
|
|
|
- <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
|
|
|
|
- </span>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="确认密码" prop="confirmPassword">
|
|
|
|
- <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入新密码" :type="passwordType2"></el-input>
|
|
|
|
- <span class="show-pwd" @click="showPwd(2)">
|
|
|
|
- <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
|
|
|
|
- </span>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="cancelResetForm">取 消</el-button>
|
|
|
|
- <el-button type="primary" @click="submitResetForm">确 定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
-
|
|
|
|
- <!-- 新增编辑账户 -->
|
|
|
|
- <el-dialog :title="addFormType == 'add' ? '新增账户':'编辑账户'" :visible.sync="addFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
|
- <el-form ref="addForm" :model="addForm" :rules="addFormRules" label-position="left" label-width="80px">
|
|
|
|
|
|
+
|
|
|
|
+ <!-- 添加编辑账号 -->
|
|
|
|
+ <el-dialog :title="AccountFormType == 'add' ? '添加账号':'编辑账号'" :visible.sync="AccountFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
|
+ <el-form ref="AccountForm" :model="AccountForm" :rules="AccountFormRules" label-position="left" label-width="80px">
|
|
<el-form-item label="账号" prop="account">
|
|
<el-form-item label="账号" prop="account">
|
|
- <el-input v-model="addForm.account" autocomplete="off" placeholder="请输入账号"></el-input>
|
|
|
|
|
|
+ <el-input v-model="AccountForm.account" autocomplete="off" placeholder="请输入账号"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="用户名" prop="nickName">
|
|
<el-form-item label="用户名" prop="nickName">
|
|
- <el-input v-model="addForm.nickName" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
|
|
|
|
+ <el-input v-model="AccountForm.nickName" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="角色组" prop="role">
|
|
<el-form-item label="角色组" prop="role">
|
|
- <el-select v-model="addForm.role" placeholder="请选择角色组" style="width: 100%;">
|
|
|
|
|
|
+ <el-select v-model="AccountForm.role" placeholder="请选择角色组" style="width: 100%;">
|
|
<el-option :label="item.name" :value="item.adminRoleId" v-for="(item, index) in roleList" :key="index"></el-option>
|
|
<el-option :label="item.name" :value="item.adminRoleId" v-for="(item, index) in roleList" :key="index"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -110,25 +140,25 @@
|
|
<el-tree
|
|
<el-tree
|
|
:data="departmentList"
|
|
:data="departmentList"
|
|
show-checkbox
|
|
show-checkbox
|
|
- node-key="id"
|
|
|
|
|
|
+ node-key="adminWebsitId"
|
|
ref="tree"
|
|
ref="tree"
|
|
highlight-current
|
|
highlight-current
|
|
:props="props">
|
|
:props="props">
|
|
</el-tree>
|
|
</el-tree>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="商户" prop="merchant" v-show="accountType === 1 || accountType === 2">
|
|
<el-form-item label="商户" prop="merchant" v-show="accountType === 1 || accountType === 2">
|
|
- <el-select v-model="addForm.merchant" placeholder="请选择商户" style="width: 100%;">
|
|
|
|
|
|
+ <el-select v-model="AccountForm.merchant" placeholder="请选择商户" style="width: 100%;">
|
|
<el-option :label="item.adminCompanyName" :value="item.adminCompanyId" v-for="(item, index) in merchantList" :key="index"></el-option>
|
|
<el-option :label="item.adminCompanyName" :value="item.adminCompanyId" v-for="(item, index) in merchantList" :key="index"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="密码" prop="newPassword">
|
|
<el-form-item label="密码" prop="newPassword">
|
|
- <el-input v-model="addForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入密码" :type="passwordType1"></el-input>
|
|
|
|
|
|
+ <el-input v-model="AccountForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入密码" :type="passwordType1"></el-input>
|
|
<span class="show-pwd" @click="showPwd(1)">
|
|
<span class="show-pwd" @click="showPwd(1)">
|
|
<svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
|
|
<svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
|
|
</span>
|
|
</span>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="确认密码" prop="confirmPassword">
|
|
<el-form-item label="确认密码" prop="confirmPassword">
|
|
- <el-input v-model="addForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入密码" :type="passwordType2"></el-input>
|
|
|
|
|
|
+ <el-input v-model="AccountForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入密码" :type="passwordType2"></el-input>
|
|
<span class="show-pwd" @click="showPwd(2)">
|
|
<span class="show-pwd" @click="showPwd(2)">
|
|
<svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
|
|
<svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
|
|
</span>
|
|
</span>
|
|
@@ -136,8 +166,30 @@
|
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
- <el-button @click="cancelAddForm">取 消</el-button>
|
|
|
|
- <el-button type="primary" @click="submitAddForm">确 定</el-button>
|
|
|
|
|
|
+ <el-button @click="cancelAccountForm">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitAccountForm">确 定</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 重置密码 -->
|
|
|
|
+ <el-dialog title="重置密码" :visible.sync="resetFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
|
+ <el-form ref="resetForm" :model="resetForm" :rules="resetFormRules" label-position="left" label-width="100px">
|
|
|
|
+ <el-form-item label="输入新密码" prop="newPassword">
|
|
|
|
+ <el-input v-model="resetForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入新密码" :type="passwordType1"></el-input>
|
|
|
|
+ <span class="show-pwd" @click="showPwd(1)">
|
|
|
|
+ <svg-icon :icon-class="passwordType1 === 'password' ? 'eye' : 'eye-open'" />
|
|
|
|
+ </span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="确认密码" prop="confirmPassword">
|
|
|
|
+ <el-input v-model="resetForm.confirmPassword" ref="password2" autocomplete="off" placeholder="请再次输入新密码" :type="passwordType2"></el-input>
|
|
|
|
+ <span class="show-pwd" @click="showPwd(2)">
|
|
|
|
+ <svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
|
|
|
|
+ </span>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="cancelResetForm">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitResetForm">确 定</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
@@ -145,8 +197,8 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { getAccountList, getRoleList, changeAccountStatus, resetPassword, addAccount, editAccount, getUserInfo, getDepartmentList, getMerchantList } from '@/api/setting'
|
|
|
|
-import { findElem } from '@/utils/util'
|
|
|
|
|
|
+import { getDepartmentList, getAccountList, addAccount, editAccount, deleteAccount, getAccountDetail, getRoleList, getMerchantList, changeAccountStatus, resetPassword } from '@/api/setting'
|
|
|
|
+import { findElem, downloadFiles, handleImport } from '@/utils/util'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
@@ -177,8 +229,8 @@ export default {
|
|
} else if (value && value.length < 6) {
|
|
} else if (value && value.length < 6) {
|
|
callback(new Error('密码长度至少6位'));
|
|
callback(new Error('密码长度至少6位'));
|
|
} else {
|
|
} else {
|
|
- if (this.addForm.confirmPassword !== '') {
|
|
|
|
- this.$refs.addForm.validateField('confirmPassword');
|
|
|
|
|
|
+ if (this.AccountForm.confirmPassword !== '') {
|
|
|
|
+ this.$refs.AccountForm.validateField('confirmPassword');
|
|
}
|
|
}
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
@@ -186,57 +238,29 @@ export default {
|
|
var validatePass4 = (rule, value, callback) => {
|
|
var validatePass4 = (rule, value, callback) => {
|
|
if (value === '') {
|
|
if (value === '') {
|
|
callback(new Error('请再次输入密码'));
|
|
callback(new Error('请再次输入密码'));
|
|
- } else if (value !== this.addForm.newPassword) {
|
|
|
|
|
|
+ } else if (value !== this.AccountForm.newPassword) {
|
|
callback(new Error('两次输入密码不一致'));
|
|
callback(new Error('两次输入密码不一致'));
|
|
} else {
|
|
} else {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return {
|
|
return {
|
|
|
|
+ baseURL: process.env.VUE_APP_BASE_API,
|
|
dataList: null, // 列表数据
|
|
dataList: null, // 列表数据
|
|
|
|
+ moduleList: null, // 模块列表
|
|
listLoading: true, // 列表加载loading
|
|
listLoading: true, // 列表加载loading
|
|
screenForm: { // 筛选表单数据
|
|
screenForm: { // 筛选表单数据
|
|
- role: '', // 角色
|
|
|
|
- status: '', // 状态
|
|
|
|
- keyword: '', // 关键词
|
|
|
|
|
|
+ name: '', // 名称
|
|
},
|
|
},
|
|
- select_status: [ // 筛选字段 - 状态
|
|
|
|
- { label: '正常', value: true },
|
|
|
|
- { label: '冻结', value: false }
|
|
|
|
- ],
|
|
|
|
currentPage: 1, // 当前页码
|
|
currentPage: 1, // 当前页码
|
|
pageSize: 10, // 每页数量
|
|
pageSize: 10, // 每页数量
|
|
listTotal: 0, // 列表总数
|
|
listTotal: 0, // 列表总数
|
|
- roleList: [], // 角色列表
|
|
|
|
- departmentList: [], // 部门列表
|
|
|
|
- props: {
|
|
|
|
- multiple: true,
|
|
|
|
- value: 'id',
|
|
|
|
- label: 'name',
|
|
|
|
- children: 'children',
|
|
|
|
- },
|
|
|
|
- merchantList: [], // 商户列表
|
|
|
|
|
|
|
|
- resetId: null,
|
|
|
|
- resetFormVisible: false,
|
|
|
|
- resetForm: {
|
|
|
|
- newPassword: '', // 新密码
|
|
|
|
- confirmPassword: '', // 确认密码
|
|
|
|
- },
|
|
|
|
- resetFormRules: {
|
|
|
|
- newPassword: [
|
|
|
|
- { required: true, validator: validatePass, trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- confirmPassword: [
|
|
|
|
- { required: true, validator: validatePass2, trigger: 'blur' }
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
|
|
+ selectDepartment: null, // 选中的部门
|
|
|
|
|
|
- editId: null,
|
|
|
|
- accountType: '',
|
|
|
|
- addFormType: 'add',
|
|
|
|
- addFormVisible: false,
|
|
|
|
- addForm: {
|
|
|
|
|
|
+ AccountFormType: 'add',
|
|
|
|
+ AccountFormVisible: false,
|
|
|
|
+ AccountForm: {
|
|
account: '', // 账号
|
|
account: '', // 账号
|
|
nickName: '', // 用户名
|
|
nickName: '', // 用户名
|
|
merchant: '', // 商户
|
|
merchant: '', // 商户
|
|
@@ -244,7 +268,7 @@ export default {
|
|
newPassword: '', // 新密码
|
|
newPassword: '', // 新密码
|
|
confirmPassword: '', // 确认密码
|
|
confirmPassword: '', // 确认密码
|
|
},
|
|
},
|
|
- addFormRules: {
|
|
|
|
|
|
+ AccountFormRules: {
|
|
account: [
|
|
account: [
|
|
{ required: true, message: '请输入账号', trigger: 'blur' }
|
|
{ required: true, message: '请输入账号', trigger: 'blur' }
|
|
],
|
|
],
|
|
@@ -261,30 +285,64 @@ export default {
|
|
{ required: true, validator: validatePass4, trigger: 'blur' }
|
|
{ required: true, validator: validatePass4, trigger: 'blur' }
|
|
],
|
|
],
|
|
},
|
|
},
|
|
|
|
+ editAccountId: null,
|
|
|
|
+
|
|
|
|
+ filterText: '',
|
|
|
|
+ departmentList: [],
|
|
|
|
+ defaultProps: {
|
|
|
|
+ children: 'children',
|
|
|
|
+ label: 'name'
|
|
|
|
+ },
|
|
|
|
+ props: {
|
|
|
|
+ multiple: true,
|
|
|
|
+ value: 'adminWebsitId',
|
|
|
|
+ label: 'name',
|
|
|
|
+ children: 'children',
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ tableSelection: [],
|
|
|
|
+
|
|
|
|
+ importLoading: false, // 导入加载loading
|
|
|
|
+ importFileList: [], // 导入列表
|
|
|
|
+
|
|
|
|
+ resetId: null,
|
|
|
|
+ resetFormVisible: false,
|
|
|
|
+ resetForm: {
|
|
|
|
+ newPassword: '', // 新密码
|
|
|
|
+ confirmPassword: '', // 确认密码
|
|
|
|
+ },
|
|
|
|
+ resetFormRules: {
|
|
|
|
+ newPassword: [
|
|
|
|
+ { required: true, validator: validatePass, trigger: 'blur' }
|
|
|
|
+ ],
|
|
|
|
+ confirmPassword: [
|
|
|
|
+ { required: true, validator: validatePass2, trigger: 'blur' }
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ accountType: '',
|
|
|
|
+ roleList: [], // 角色列表
|
|
|
|
+ merchantList: [],
|
|
|
|
|
|
passwordType1: 'password',
|
|
passwordType1: 'password',
|
|
passwordType2: 'password',
|
|
passwordType2: 'password',
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async created() {
|
|
|
|
- await this.getRoleList();
|
|
|
|
- if(this.$route.query.type) {
|
|
|
|
- let index = findElem(this.roleList, 'name', '企业负责人');
|
|
|
|
- this.screenForm.role = this.roleList[index].adminRoleId;
|
|
|
|
- }
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
watch: {
|
|
watch: {
|
|
- 'addForm.role'() {
|
|
|
|
- console.log('change role');
|
|
|
|
- if(this.addForm.role) {
|
|
|
|
- let index = findElem(this.roleList, 'adminRoleId', this.addForm.role);
|
|
|
|
- this.accountType = this.roleList[index].type - 1;
|
|
|
|
|
|
+ filterText(val) {
|
|
|
|
+ this.$refs.listTree.filter(val);
|
|
|
|
+ },
|
|
|
|
+ 'AccountForm.role'() {
|
|
|
|
+ if(this.AccountForm.role) {
|
|
|
|
+ let index = findElem(this.roleList, 'adminRoleId', this.AccountForm.role);
|
|
|
|
+ this.accountType = this.roleList[index].type;
|
|
}
|
|
}
|
|
- // this.$refs.tree.setCheckedKeys([]);
|
|
|
|
- // this.addForm.merchant = '';
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ async created() {
|
|
|
|
+ this.getTree();
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
// 查询按钮权限
|
|
// 查询按钮权限
|
|
checkBtnRole(value) {
|
|
checkBtnRole(value) {
|
|
@@ -295,30 +353,6 @@ export default {
|
|
return true;
|
|
return true;
|
|
},
|
|
},
|
|
|
|
|
|
- getList() {
|
|
|
|
- this.listLoading = true;
|
|
|
|
-
|
|
|
|
- let params = {
|
|
|
|
- roleId: this.screenForm.role,
|
|
|
|
- status: this.screenForm.status,
|
|
|
|
- userName: this.screenForm.keyword,
|
|
|
|
- pageNum: this.currentPage,
|
|
|
|
- pageSize: this.pageSize
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- getAccountList(params).then(res => {
|
|
|
|
- this.dataList = res.data.records;
|
|
|
|
- this.listTotal = res.data.total;
|
|
|
|
- this.listLoading = false;
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- // 筛选后重新获取列表
|
|
|
|
- getListByScreen() {
|
|
|
|
- this.currentPage = 1;
|
|
|
|
- this.getList();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
// 获取角色列表
|
|
// 获取角色列表
|
|
async getRoleList() {
|
|
async getRoleList() {
|
|
const result = await new Promise((resolve, reject) => {
|
|
const result = await new Promise((resolve, reject) => {
|
|
@@ -332,18 +366,6 @@ export default {
|
|
return result;
|
|
return result;
|
|
},
|
|
},
|
|
|
|
|
|
- // 获取部门列表
|
|
|
|
- async getDepartmentList() {
|
|
|
|
- const result = await new Promise((resolve, reject) => {
|
|
|
|
- getDepartmentList().then(res => {
|
|
|
|
- resolve(res.data);
|
|
|
|
- }).catch(res => {
|
|
|
|
- resolve([]);
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- return result;
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
// 获取商户列表
|
|
// 获取商户列表
|
|
async getMerchantList() {
|
|
async getMerchantList() {
|
|
const result = await new Promise((resolve, reject) => {
|
|
const result = await new Promise((resolve, reject) => {
|
|
@@ -351,7 +373,7 @@ export default {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 1000
|
|
pageSize: 1000
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- console.log('--------------',res.data.records)
|
|
|
|
|
|
+ this.merchantList = res.data.records;
|
|
resolve(res.data.records);
|
|
resolve(res.data.records);
|
|
}).catch(res => {
|
|
}).catch(res => {
|
|
resolve([]);
|
|
resolve([]);
|
|
@@ -360,6 +382,31 @@ export default {
|
|
return result;
|
|
return result;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 获取部门列表
|
|
|
|
+ getTree() {
|
|
|
|
+ getDepartmentList().then(res => {
|
|
|
|
+ this.departmentList = res.data;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 获取账号列表
|
|
|
|
+ getList() {
|
|
|
|
+ this.listLoading = true;
|
|
|
|
+
|
|
|
|
+ let params = {
|
|
|
|
+ pageNum: this.currentPage,
|
|
|
|
+ pageSize: this.pageSize,
|
|
|
|
+ adminWebsitId: this.selectDepartment ? this.selectDepartment.adminWebsitId : '',
|
|
|
|
+ keyword: this.screenForm.name
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ getAccountList(params).then(res => {
|
|
|
|
+ this.dataList = res.data.records;
|
|
|
|
+ this.listTotal = res.data.total;
|
|
|
|
+ this.listLoading = false;
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
// 更改每页数量
|
|
// 更改每页数量
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
this.pageSize = val;
|
|
this.pageSize = val;
|
|
@@ -373,6 +420,147 @@ export default {
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ // 提交筛选表单
|
|
|
|
+ submitScreenForm() {
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 重置筛选表单
|
|
|
|
+ resetScreenForm() {
|
|
|
|
+ this.$refs.screenForm.resetFields();
|
|
|
|
+ this.currentPage = 1;
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 筛选部门
|
|
|
|
+ filterNode(value, data) {
|
|
|
|
+ if (!value) return true;
|
|
|
|
+ return data.name.indexOf(value) !== -1;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 选择部门
|
|
|
|
+ handleNodeClick(data) {
|
|
|
|
+ console.log(data);
|
|
|
|
+ if(this.selectDepartment && data.adminWebsitId === this.selectDepartment.adminWebsitId) {
|
|
|
|
+ this.$refs.listTree.setCurrentKey(null);
|
|
|
|
+ this.selectDepartment = null;
|
|
|
|
+ }else {
|
|
|
|
+ this.selectDepartment = data;
|
|
|
|
+ }
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 刷新部门
|
|
|
|
+ refreshDepartment() {
|
|
|
|
+ this.$refs.listTree.setCurrentKey(null);
|
|
|
|
+ this.selectDepartment = null;
|
|
|
|
+ this.getTree();
|
|
|
|
+ this.getList();
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 打开 新增编辑 账号表单
|
|
|
|
+ async openAccountForm(type, id) {
|
|
|
|
+
|
|
|
|
+ this.AccountFormType = type;
|
|
|
|
+ this.AccountFormVisible = true;
|
|
|
|
+ await this.getMerchantList();
|
|
|
|
+ await this.getRoleList();
|
|
|
|
+ if(type == 'add') {
|
|
|
|
+ if(this.selectDepartment) {
|
|
|
|
+ this.$refs.tree.setCheckedKeys([this.selectDepartment.adminWebsitId]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(type == 'edit') {
|
|
|
|
+ this.editAccountId = id;
|
|
|
|
+ getAccountDetail({adminUserId: id}).then(res => {
|
|
|
|
+ this.AccountForm.account = res.data.userName;
|
|
|
|
+ this.AccountForm.role = res.data.roleId;
|
|
|
|
+ this.AccountForm.nickName = res.data.nickName;
|
|
|
|
+ this.AccountForm.merchant = res.data.companyWechatId;
|
|
|
|
+ this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 取消 新增编辑 账号表单
|
|
|
|
+ cancelAccountForm(){
|
|
|
|
+ this.AccountFormVisible = false;
|
|
|
|
+ this.$refs.AccountForm.resetFields();
|
|
|
|
+ this.passwordType1 = 'password';
|
|
|
|
+ this.passwordType2 = 'password';
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 提交 账号表单
|
|
|
|
+ submitAccountForm() {
|
|
|
|
+ this.$refs.AccountForm.validate((valid) => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ let params = {
|
|
|
|
+ userName: this.AccountForm.account,
|
|
|
|
+ nickName: this.AccountForm.nickName,
|
|
|
|
+ roleId: this.AccountForm.role,
|
|
|
|
+ password: this.AccountForm.newPassword,
|
|
|
|
+ }
|
|
|
|
+ if(this.accountType === 0) {
|
|
|
|
+ params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
|
|
|
|
+ }else {
|
|
|
|
+ params.adminCompanyId = this.AccountForm.merchant;
|
|
|
|
+ }
|
|
|
|
+ if(this.AccountFormType == 'edit') {
|
|
|
|
+ params.adminUserId = this.editAccountId;
|
|
|
|
+ editAccount(params).then(res => {
|
|
|
|
+ this.cancelAccountForm();
|
|
|
|
+ this.getList();
|
|
|
|
+ this.$successMsg('编辑成功');
|
|
|
|
+ })
|
|
|
|
+ }else {
|
|
|
|
+ addAccount(params).then(res => {
|
|
|
|
+ this.cancelAccountForm();
|
|
|
|
+ this.getList();
|
|
|
|
+ this.$successMsg('添加成功');
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 表格选择列
|
|
|
|
+ handleTableSelection(val) {
|
|
|
|
+ this.tableSelection = val;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 批量删除账号
|
|
|
|
+ batchDeleteAccount() {
|
|
|
|
+ if(this.tableSelection.length < 1) {
|
|
|
|
+ return this.$errorMsg('至少选择一名账号');
|
|
|
|
+ }
|
|
|
|
+ this.$confirm(`确定删除选中的账号吗?`, '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ let AccountIds = [];
|
|
|
|
+ this.tableSelection.forEach(item => {
|
|
|
|
+ AccountIds.push(item.id);
|
|
|
|
+ });
|
|
|
|
+ deleteAccount({id: AccountIds.join(',')}).then(res => {
|
|
|
|
+ this.$successMsg();
|
|
|
|
+ this.getTree();
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ }).catch(() => {});
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 删除账号
|
|
|
|
+ deleteAccount(id) {
|
|
|
|
+ deleteAccount({id: id}).then(res => {
|
|
|
|
+ this.$successMsg();
|
|
|
|
+ this.getTree();
|
|
|
|
+ this.getList();
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
// 操作 - 更改状态(type: 禁用0,启用1)
|
|
// 操作 - 更改状态(type: 禁用0,启用1)
|
|
changeStatus(id, type) {
|
|
changeStatus(id, type) {
|
|
type = type ? true : false
|
|
type = type ? true : false
|
|
@@ -437,72 +625,49 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- // 新增编辑 账户
|
|
|
|
- async addOrEdit(type, id) {
|
|
|
|
- this.addFormType = type;
|
|
|
|
- this.addFormVisible = true;
|
|
|
|
- this.departmentList = await this.getDepartmentList();
|
|
|
|
- this.merchantList = await this.getMerchantList();
|
|
|
|
|
|
|
|
- if(type == 'edit') {
|
|
|
|
- this.editId = id;
|
|
|
|
- getUserInfo({adminUserId: id}).then(res => {
|
|
|
|
- this.addForm = {
|
|
|
|
- account: res.data.userName,
|
|
|
|
- role: res.data.roleId,
|
|
|
|
- nickName: res.data.nickName,
|
|
|
|
- merchant: res.data.companyWechatId
|
|
|
|
- }
|
|
|
|
- this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
+ // 导出
|
|
|
|
+ handleExport() {
|
|
|
|
+ let screenData = {
|
|
|
|
+ adminWebsitId: this.selectDepartment ? this.selectDepartment.websitId : '',
|
|
|
|
+ keyword: this.screenForm.name
|
|
|
|
+ };
|
|
|
|
+ downloadFiles('wechat/enterprise/export', screenData);
|
|
},
|
|
},
|
|
|
|
|
|
- // 取消 新增编辑账户
|
|
|
|
- cancelAddForm(){
|
|
|
|
- this.addFormVisible = false;
|
|
|
|
- this.passwordType1 = 'password';
|
|
|
|
- this.passwordType2 = 'password';
|
|
|
|
- this.$refs.addForm.resetFields();
|
|
|
|
|
|
+ // 下载导入模版
|
|
|
|
+ handleDownload() {
|
|
|
|
+ downloadFiles('wechat/enterprise/download');
|
|
},
|
|
},
|
|
|
|
|
|
- // 提交 新增编辑账户
|
|
|
|
- submitAddForm() {
|
|
|
|
- this.$refs.addForm.validate((valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- let params = {
|
|
|
|
- userName: this.addForm.account,
|
|
|
|
- nickName: this.addForm.nickName,
|
|
|
|
- roleId: this.addForm.role,
|
|
|
|
- password: this.addForm.newPassword,
|
|
|
|
- type: this.accountType
|
|
|
|
- }
|
|
|
|
- if(this.accountType === 0) {
|
|
|
|
- params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
|
|
|
|
- }else {
|
|
|
|
- let index = findElem(this.merchantList, 'adminCompanyId', this.addForm.merchant);
|
|
|
|
- params.adminCompanyId = this.addForm.merchant;
|
|
|
|
- params.linkName = this.merchantList[index].linkName || '';
|
|
|
|
- params.linkPhone = this.merchantList[index].linkPhone || '';
|
|
|
|
- params.email = this.merchantList[index].email || '';
|
|
|
|
- params.address = this.merchantList[index].address || '';
|
|
|
|
- }
|
|
|
|
- if(this.addFormType == 'edit') {
|
|
|
|
- params.adminUserId = this.editId;
|
|
|
|
- editAccount(params).then(res => {
|
|
|
|
- this.cancelAddForm();
|
|
|
|
- this.getList();
|
|
|
|
- this.$successMsg('编辑成功');
|
|
|
|
- })
|
|
|
|
- }else {
|
|
|
|
- addAccount(params).then(res => {
|
|
|
|
- this.cancelAddForm();
|
|
|
|
- this.getList();
|
|
|
|
- this.$successMsg('新增成功');
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ clickImport() {
|
|
|
|
+ if(!this.selectDepartment) {
|
|
|
|
+ return this.$errorMsg('请选择部门');
|
|
|
|
+ }else {
|
|
|
|
+ document.querySelector('.import-btn input').click();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 导入
|
|
|
|
+ async handleImport(param) {
|
|
|
|
+ this.importLoading = true;
|
|
|
|
+ const file = param.file;
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ formData.append("file", file);
|
|
|
|
+ formData.append("mainDepartmentId", this.selectDepartment.websitId);
|
|
|
|
+ let result = await handleImport('wechat/enterprise/import', formData);
|
|
|
|
+ this.importLoading = false;
|
|
|
|
+ this.importFileList = [];
|
|
|
|
+ if(result.code == 200) {
|
|
|
|
+ this.$alert(result.message, '导入成功', {
|
|
|
|
+ confirmButtonText: '确定'
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
|
|
+ }else {
|
|
|
|
+ this.$alert(result.message, '导入失败', {
|
|
|
|
+ confirmButtonText: '确定'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
}
|
|
}
|
|
@@ -510,6 +675,69 @@ export default {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
+ .app-container {
|
|
|
|
+ display: flex;
|
|
|
|
+ .tree-container {
|
|
|
|
+ width: 18%;
|
|
|
|
+ height: calc(100vh - 110px);
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
+ background: #f5f5f5;
|
|
|
|
+ margin-right: 2%;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ overflow-y: hidden;
|
|
|
|
+ .el-tree {
|
|
|
|
+ height: 100%;
|
|
|
|
+ background: none;
|
|
|
|
+ width: 100%;
|
|
|
|
+ overflow: scroll;
|
|
|
|
+ // ::v-deep .el-tree-node:focus > .el-tree-node__content {
|
|
|
|
+ // color: #ffffff;
|
|
|
|
+ // background-color: #409EFF;
|
|
|
|
+ // }
|
|
|
|
+ ::v-deep >.el-tree-node {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ min-width: 100%;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node>.el-tree-node__content {
|
|
|
|
+ padding-right: 10px;
|
|
|
|
+ align-self: baseline;
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node.is-current>.el-tree-node__content {
|
|
|
|
+ background-color: #409EFF;
|
|
|
|
+ .custom-tree-node {
|
|
|
|
+ i {
|
|
|
|
+ color: #fff;
|
|
|
|
+ }
|
|
|
|
+ span {
|
|
|
|
+ color: #fff;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-tree-node>.el-tree-node__children {
|
|
|
|
+ overflow: unset;
|
|
|
|
+ }
|
|
|
|
+ .custom-tree-node {
|
|
|
|
+ i {
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ color: #999;
|
|
|
|
+ }
|
|
|
|
+ span {
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ margin-left: 6px;
|
|
|
|
+ color: #666;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .mymain-container {
|
|
|
|
+ width: 80%;
|
|
|
|
+ margin-top: 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ::v-deep .el-divider--vertical {
|
|
|
|
+ margin: 0 15px;
|
|
|
|
+ }
|
|
.show-pwd {
|
|
.show-pwd {
|
|
position: absolute;
|
|
position: absolute;
|
|
right: 15px;
|
|
right: 15px;
|
|
@@ -518,4 +746,4 @@ export default {
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
user-select: none;
|
|
}
|
|
}
|
|
-</style>
|
|
|
|
|
|
+</style>
|