|
@@ -33,8 +33,8 @@
|
|
|
<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 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">
|
|
@@ -51,24 +51,11 @@
|
|
|
<el-button size="small" type="primary" @click="openDepartmentForm('add')">添加部门</el-button>
|
|
|
<el-button size="small" type="primary" @click="openDepartmentForm('edit')">编辑部门</el-button>
|
|
|
<el-divider direction="vertical"></el-divider>
|
|
|
- <el-button size="small" type="primary" @click="openMemberForm('add')">添加成员</el-button>
|
|
|
-
|
|
|
- <el-button size="small" type="danger" @click="batchDeleteMember()">删除成员</el-button>
|
|
|
-
|
|
|
- <el-button size="small" type="danger" @click="delHandleDownload" v-if="checkBtnRole('download')">下载导入删除模板</el-button>
|
|
|
- <el-upload
|
|
|
- class="import-btn2"
|
|
|
- style="display: inline-block; margin-left: 10px"
|
|
|
- :action="baseURL + 'student/import'"
|
|
|
- :http-request="handleImport2"
|
|
|
- :file-list="importFileList2"
|
|
|
- v-if="checkBtnRole('import')"
|
|
|
- >
|
|
|
- <el-button size="small" type="danger" :loading="importLoading2">{{ importLoading2 ? '导入中...' : '导入删除成员' }}</el-button>
|
|
|
- </el-upload>
|
|
|
+ <el-button size="small" type="primary" @click="openMemberForm('add')">添加账号</el-button>
|
|
|
+
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
- <el-upload
|
|
|
+ <!-- <el-upload
|
|
|
class="import-btn"
|
|
|
style="height: 0; width: 0; overflow: hidden;"
|
|
|
:action="baseURL + 'student/import'"
|
|
@@ -83,13 +70,13 @@
|
|
|
|
|
|
<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>
|
|
|
+ <el-button size="small" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="table">
|
|
|
- <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="handleTableSelection">
|
|
|
- <el-table-column align="center" type="selection" width="55" fixed></el-table-column>
|
|
|
+ <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
|
|
|
+ <!-- <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="nickName" min-width="120"></el-table-column>
|
|
|
<el-table-column align="center" label="角色" prop="roleName" min-width="100"></el-table-column>
|
|
@@ -111,7 +98,7 @@
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
|
|
|
|
- <el-button type="text" @click="addOrEdit('edit', scope.row.adminUserId)" v-if="checkBtnRole('edit')">编辑</el-button>
|
|
|
+ <el-button type="text" @click="openMemberForm('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-popconfirm style="margin-left: 10px;" title="确定删除吗?" @onConfirm="deleteMember(scope.row.id)" v-if="checkBtnRole('del')">
|
|
@@ -144,19 +131,6 @@
|
|
|
<el-form-item label="部门名称" prop="name">
|
|
|
<el-input placeholder="请输入部门名称" v-model="departmentForm.name"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="部门编号" prop="code">
|
|
|
- <el-input placeholder="请输入部门编号" v-model="departmentForm.code"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="选择区域" prop="area">
|
|
|
- <el-select v-model="departmentForm.area" placeholder="请选择区域" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="item in areaList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.zoneName"
|
|
|
- :value="item.id">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="cancelDepartmentForm">取 消</el-button>
|
|
@@ -164,49 +138,48 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <!-- 添加编辑成员 -->
|
|
|
- <el-dialog :title="memberFormType == 'add' ? '添加成员':'编辑成员'" :visible.sync="memberFormVisible" :show-close="false" width="60%" :close-on-click-modal="false">
|
|
|
- <el-form ref="memberForm" :model="memberForm" :rules="memberFormRules" label-position="left" label-width="50px" size="small">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="姓名" prop="name">
|
|
|
- <el-input placeholder="请输入姓名" v-model="memberForm.name"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12" style="height: 51px;">
|
|
|
- <el-form-item label="性别" prop="sex">
|
|
|
- <el-radio-group v-model="memberForm.sex">
|
|
|
- <el-radio :label="1">男</el-radio>
|
|
|
- <el-radio :label="2">女</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="账号" prop="account">
|
|
|
- <el-input placeholder="请输入账号" v-model="memberForm.account" :disabled="memberFormType === 'edit'"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="部门" prop="department">
|
|
|
- <el-input placeholder="请输入部门" v-model="memberForm.department" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="职务" prop="post">
|
|
|
- <el-input placeholder="请输入职务" v-model="memberForm.post"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="手机" prop="phone">
|
|
|
- <el-input placeholder="请输入手机" v-model="memberForm.phone"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
- <el-form-item label="邮箱" prop="email">
|
|
|
- <el-input placeholder="请输入邮箱" v-model="memberForm.email"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <!-- 添加编辑账号 -->
|
|
|
+ <el-dialog :title="memberFormType == 'add' ? '添加账号':'编辑账号'" :visible.sync="memberFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
|
|
|
+ <el-form ref="memberForm" :model="memberForm" :rules="memberFormRules" label-position="left" label-width="80px">
|
|
|
+ <el-form-item label="账号" prop="account">
|
|
|
+ <el-input v-model="memberForm.account" autocomplete="off" placeholder="请输入账号"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户名" prop="nickName">
|
|
|
+ <el-input v-model="memberForm.nickName" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="角色组" prop="role">
|
|
|
+ <el-select v-model="memberForm.role" placeholder="请选择角色组" style="width: 100%;">
|
|
|
+ <el-option :label="item.name" :value="item.adminRoleId" v-for="(item, index) in roleList" :key="index"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="部门" prop="department" v-show="accountType === 0">
|
|
|
+ <el-tree
|
|
|
+ :data="departmentList"
|
|
|
+ show-checkbox
|
|
|
+ node-key="adminWebsitId"
|
|
|
+ ref="tree"
|
|
|
+ highlight-current
|
|
|
+ :props="props">
|
|
|
+ </el-tree>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商户" prop="merchant" v-show="accountType === 1 || accountType === 2">
|
|
|
+ <el-select v-model="memberForm.merchant" placeholder="请选择商户" style="width: 100%;">
|
|
|
+ <el-option :label="item.adminCompanyName" :value="item.adminCompanyId" v-for="(item, index) in merchantList" :key="index"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="newPassword">
|
|
|
+ <el-input v-model="memberForm.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="memberForm.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="cancelMemberForm">取 消</el-button>
|
|
@@ -214,18 +187,82 @@
|
|
|
</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>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
getDepartmentList, addDepartment, editDepartment, deleteDepartment,
|
|
|
- getMemberList, addMember, editMember, deleteMember, getMemberDetail
|
|
|
+ getMemberList, addMember, editMember, deleteMember, getMemberDetail, getRoleList, getMerchantList, changeAccountStatus, resetPassword
|
|
|
} from '@/api/merchant'
|
|
|
import { findElem, downloadFiles, handleImport } from '@/utils/util'
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
+ var validatePass = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入新密码'));
|
|
|
+ } else if (value && value.length < 6) {
|
|
|
+ callback(new Error('密码长度至少6位'));
|
|
|
+ } else {
|
|
|
+ if (this.resetForm.confirmPassword !== '') {
|
|
|
+ this.$refs.resetForm.validateField('confirmPassword');
|
|
|
+ }
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var validatePass2 = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请再次输入密码'));
|
|
|
+ } else if (value !== this.resetForm.newPassword) {
|
|
|
+ callback(new Error('两次输入密码不一致'));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var validatePass3 = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入新密码'));
|
|
|
+ } else if (value && value.length < 6) {
|
|
|
+ callback(new Error('密码长度至少6位'));
|
|
|
+ } else {
|
|
|
+ if (this.memberForm.confirmPassword !== '') {
|
|
|
+ this.$refs.memberForm.validateField('confirmPassword');
|
|
|
+ }
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var validatePass4 = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请再次输入密码'));
|
|
|
+ } else if (value !== this.memberForm.newPassword) {
|
|
|
+ callback(new Error('两次输入密码不一致'));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
return {
|
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
|
|
dataList: null, // 列表数据
|
|
@@ -242,74 +279,39 @@ export default {
|
|
|
departmentFormVisible: false,
|
|
|
departmentForm: {
|
|
|
name: '',
|
|
|
- code: '',
|
|
|
- area: '',
|
|
|
},
|
|
|
departmentFormRules: {
|
|
|
name: [
|
|
|
{ required: true, message: '请填写部门名称', trigger: 'blur' },
|
|
|
],
|
|
|
- code: [
|
|
|
- { required: true, message: '请填写部门编号', trigger: 'blur' }
|
|
|
- ]
|
|
|
},
|
|
|
selectDepartment: null, // 选中的部门
|
|
|
|
|
|
memberFormType: 'add',
|
|
|
memberFormVisible: false,
|
|
|
memberForm: {
|
|
|
- name: '',
|
|
|
- sex: 1,
|
|
|
- account: '',
|
|
|
- department: '',
|
|
|
- departmentId: '',
|
|
|
- post: '',
|
|
|
- phone: '',
|
|
|
- email: '',
|
|
|
+ account: '', // 账号
|
|
|
+ nickName: '', // 用户名
|
|
|
+ merchant: '', // 商户
|
|
|
+ role: '', // 角色组
|
|
|
+ newPassword: '', // 新密码
|
|
|
+ confirmPassword: '', // 确认密码
|
|
|
},
|
|
|
memberFormRules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请填写姓名', trigger: 'blur' },
|
|
|
- ],
|
|
|
- sex: [
|
|
|
- { required: true, message: '请选择性别', trigger: 'change' }
|
|
|
- ],
|
|
|
account: [
|
|
|
- { required: true, validator: function(rule, value, callback) {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请填写账号'));
|
|
|
- } else if (value.length > 0 && value.match(/[\x01-\xFF]*/) == false) {
|
|
|
- callback(new Error('账号不能填写中文'));
|
|
|
- }else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- }, trigger: 'blur' },
|
|
|
+ { required: true, message: '请输入账号', trigger: 'blur' }
|
|
|
],
|
|
|
- department: [
|
|
|
- { required: true, message: '请填写部门', trigger: 'blur' },
|
|
|
+ nickName: [
|
|
|
+ { required: true, message: '请输入用户名', trigger: 'blur' }
|
|
|
],
|
|
|
- post: [
|
|
|
- { required: true, message: '请填写职务', trigger: 'blur' },
|
|
|
+ role: [
|
|
|
+ { required: true, message: '请选择角色组', trigger: 'change' }
|
|
|
],
|
|
|
- phone: [
|
|
|
- { required: true, validator: function(rule, value, callback) {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请填写手机号'));
|
|
|
- } else if (value.length > 0 && /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(value) == false) {
|
|
|
- callback(new Error('请填写正确的手机号'));
|
|
|
- }else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- }, trigger: 'blur' },
|
|
|
+ newPassword: [
|
|
|
+ { required: true, validator: validatePass3, trigger: 'blur' }
|
|
|
],
|
|
|
- email: [
|
|
|
- { validator: function(rule, value, callback) {
|
|
|
- if (value && value.length > 0 && /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(value) == false) {
|
|
|
- callback(new Error('请填写正确的邮箱'));
|
|
|
- }else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- }, trigger: 'blur' },
|
|
|
+ confirmPassword: [
|
|
|
+ { required: true, validator: validatePass4, trigger: 'blur' }
|
|
|
],
|
|
|
},
|
|
|
editMemberId: null,
|
|
@@ -320,30 +322,59 @@ export default {
|
|
|
children: 'children',
|
|
|
label: 'name'
|
|
|
},
|
|
|
+ props: {
|
|
|
+ multiple: true,
|
|
|
+ value: 'adminWebsitId',
|
|
|
+ label: 'name',
|
|
|
+ children: 'children',
|
|
|
+ },
|
|
|
|
|
|
- areaList: [],
|
|
|
tableSelection: [],
|
|
|
|
|
|
importLoading: false, // 导入加载loading
|
|
|
importFileList: [], // 导入列表
|
|
|
|
|
|
- importLoading2: false, // 导入加载loading
|
|
|
- importFileList2: [], // 导入列表
|
|
|
+ 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',
|
|
|
+ passwordType2: 'password',
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
filterText(val) {
|
|
|
this.$refs.listTree.filter(val);
|
|
|
+ },
|
|
|
+ 'memberForm.role'() {
|
|
|
+ if(this.memberForm.role) {
|
|
|
+ let index = findElem(this.roleList, 'adminRoleId', this.memberForm.role);
|
|
|
+ this.accountType = this.roleList[index].type;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
+ async created() {
|
|
|
this.getTree();
|
|
|
this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询按钮权限
|
|
|
checkBtnRole(value) {
|
|
|
- console.log(value)
|
|
|
// let btnRole = this.$route.meta.roles;
|
|
|
// if(!btnRole) {return true}
|
|
|
// let index = btnRole.indexOf(value);
|
|
@@ -351,6 +382,35 @@ export default {
|
|
|
return true;
|
|
|
},
|
|
|
|
|
|
+ // 获取角色列表
|
|
|
+ async getRoleList() {
|
|
|
+ const result = await new Promise((resolve, reject) => {
|
|
|
+ getRoleList({pageNum: 1, pageSize: 1000}).then(res => {
|
|
|
+ this.roleList = res.data.records;
|
|
|
+ resolve(res.data);
|
|
|
+ }).catch(res => {
|
|
|
+ resolve([]);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取商户列表
|
|
|
+ async getMerchantList() {
|
|
|
+ const result = await new Promise((resolve, reject) => {
|
|
|
+ getMerchantList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 1000
|
|
|
+ }).then(res => {
|
|
|
+ this.merchantList = res.data.records;
|
|
|
+ resolve(res.data.records);
|
|
|
+ }).catch(res => {
|
|
|
+ resolve([]);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+
|
|
|
// 获取部门列表
|
|
|
getTree() {
|
|
|
getDepartmentList().then(res => {
|
|
@@ -358,15 +418,14 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- // 获取成员列表
|
|
|
+ // 获取账号列表
|
|
|
getList() {
|
|
|
this.listLoading = true;
|
|
|
|
|
|
let params = {
|
|
|
pageNum: this.currentPage,
|
|
|
pageSize: this.pageSize,
|
|
|
- adminWebsitId: this.selectDepartment ? this.selectDepartment.id : '',
|
|
|
- websitId: this.selectDepartment ? this.selectDepartment.websitId : '',
|
|
|
+ adminWebsitId: this.selectDepartment ? this.selectDepartment.adminWebsitId : '',
|
|
|
keyword: this.screenForm.name
|
|
|
};
|
|
|
|
|
@@ -412,7 +471,7 @@ export default {
|
|
|
// 选择部门
|
|
|
handleNodeClick(data) {
|
|
|
console.log(data);
|
|
|
- if(this.selectDepartment && data.websitId === this.selectDepartment.websitId) {
|
|
|
+ if(this.selectDepartment && data.adminWebsitId === this.selectDepartment.adminWebsitId) {
|
|
|
this.$refs.listTree.setCurrentKey(null);
|
|
|
this.selectDepartment = null;
|
|
|
}else {
|
|
@@ -438,8 +497,6 @@ export default {
|
|
|
if(type == 'edit') {
|
|
|
this.departmentForm = {
|
|
|
name: this.selectDepartment.name,
|
|
|
- code: this.selectDepartment.websitNumber,
|
|
|
- area: this.selectDepartment.zoneId,
|
|
|
}
|
|
|
}
|
|
|
this.departmentFormVisible = true;
|
|
@@ -449,11 +506,7 @@ export default {
|
|
|
cancelDepartmentForm(){
|
|
|
this.departmentFormVisible = false;
|
|
|
this.$refs.departmentForm.resetFields();
|
|
|
- this.departmentForm = {
|
|
|
- name: '',
|
|
|
- code: '',
|
|
|
- area: '',
|
|
|
- }
|
|
|
+ this.departmentForm.name = '';
|
|
|
},
|
|
|
|
|
|
// 提交 部门表单
|
|
@@ -462,15 +515,10 @@ export default {
|
|
|
if (valid) {
|
|
|
let params = {
|
|
|
name: this.departmentForm.name,
|
|
|
- websitNumber: this.departmentForm.code,
|
|
|
- }
|
|
|
- if(this.departmentForm.area) {
|
|
|
- params.zoneId = this.departmentForm.area;
|
|
|
- params.areaName = this.areaList[findElem(this.areaList, 'id', this.departmentForm.area)].zoneName;
|
|
|
}
|
|
|
if(this.departmentFormType == 'edit') {
|
|
|
params.id = this.selectDepartment.id;
|
|
|
- params.websitId = this.selectDepartment.websitId;
|
|
|
+ params.adminWebsitId = this.selectDepartment.adminWebsitId;
|
|
|
params.parentId = this.selectDepartment.parentId;
|
|
|
editDepartment(params).then(res => {
|
|
|
this.cancelDepartmentForm();
|
|
@@ -479,7 +527,7 @@ export default {
|
|
|
this.$successMsg('编辑成功');
|
|
|
})
|
|
|
}else {
|
|
|
- params.parentId = this.selectDepartment ? this.selectDepartment.websitId : 0;
|
|
|
+ params.parentId = this.selectDepartment ? this.selectDepartment.adminWebsitId : 0;
|
|
|
addDepartment(params).then(res => {
|
|
|
this.cancelDepartmentForm();
|
|
|
this.getTree();
|
|
@@ -491,55 +539,56 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- // 打开 新增编辑 成员表单
|
|
|
- openMemberForm(type, id) {
|
|
|
+ // 打开 新增编辑 账号表单
|
|
|
+ async openMemberForm(type, id) {
|
|
|
+
|
|
|
+ this.memberFormType = type;
|
|
|
+ this.memberFormVisible = true;
|
|
|
+ await this.getMerchantList();
|
|
|
+ await this.getRoleList();
|
|
|
if(type == 'add') {
|
|
|
- if(!this.selectDepartment) {
|
|
|
- return this.$errorMsg('请选择部门');
|
|
|
+ if(this.selectDepartment) {
|
|
|
+ this.$refs.tree.setCheckedKeys([this.selectDepartment.adminWebsitId]);
|
|
|
}
|
|
|
- this.memberForm.department = this.selectDepartment.name;
|
|
|
- this.memberForm.departmentId = this.selectDepartment.websitId;
|
|
|
}
|
|
|
+
|
|
|
if(type == 'edit') {
|
|
|
this.editMemberId = id;
|
|
|
- getMemberDetail({id: id}).then(res => {
|
|
|
- this.memberForm = {
|
|
|
- name: res.data.name,
|
|
|
- sex: res.data.gender,
|
|
|
- account: res.data.wechatUserId,
|
|
|
- department: res.data.departmentName,
|
|
|
- departmentId: res.data.mainDepartment,
|
|
|
- post: res.data.position,
|
|
|
- phone: res.data.mobile,
|
|
|
- email: res.data.email,
|
|
|
- }
|
|
|
+ getMemberDetail({adminUserId: id}).then(res => {
|
|
|
+ this.memberForm.account = res.data.userName;
|
|
|
+ this.memberForm.role = res.data.roleId;
|
|
|
+ this.memberForm.nickName = res.data.nickName;
|
|
|
+ this.memberForm.merchant = res.data.companyWechatId;
|
|
|
+ this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
|
|
|
})
|
|
|
}
|
|
|
- this.memberFormType = type;
|
|
|
- this.memberFormVisible = true;
|
|
|
},
|
|
|
|
|
|
- // 取消 新增编辑 成员表单
|
|
|
+ // 取消 新增编辑 账号表单
|
|
|
cancelMemberForm(){
|
|
|
this.memberFormVisible = false;
|
|
|
this.$refs.memberForm.resetFields();
|
|
|
+ this.passwordType1 = 'password';
|
|
|
+ this.passwordType2 = 'password';
|
|
|
},
|
|
|
|
|
|
- // 提交 成员表单
|
|
|
+ // 提交 账号表单
|
|
|
submitMemberForm() {
|
|
|
this.$refs.memberForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
let params = {
|
|
|
- name: this.memberForm.name,
|
|
|
- gender: this.memberForm.sex,
|
|
|
- wechatUserId: this.memberForm.account,
|
|
|
- mainDepartmentId: this.memberForm.departmentId,
|
|
|
- position: this.memberForm.post,
|
|
|
- mobile: this.memberForm.phone,
|
|
|
- email: this.memberForm.email,
|
|
|
+ userName: this.memberForm.account,
|
|
|
+ nickName: this.memberForm.nickName,
|
|
|
+ roleId: this.memberForm.role,
|
|
|
+ password: this.memberForm.newPassword,
|
|
|
+ }
|
|
|
+ if(this.accountType === 0) {
|
|
|
+ params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
|
|
|
+ }else {
|
|
|
+ params.adminCompanyId = this.memberForm.merchant;
|
|
|
}
|
|
|
if(this.memberFormType == 'edit') {
|
|
|
- params.id = this.editMemberId;
|
|
|
+ params.adminUserId = this.editMemberId;
|
|
|
editMember(params).then(res => {
|
|
|
this.cancelMemberForm();
|
|
|
this.getList();
|
|
@@ -561,12 +610,12 @@ export default {
|
|
|
this.tableSelection = val;
|
|
|
},
|
|
|
|
|
|
- // 批量删除成员
|
|
|
+ // 批量删除账号
|
|
|
batchDeleteMember() {
|
|
|
if(this.tableSelection.length < 1) {
|
|
|
- return this.$errorMsg('至少选择一名成员');
|
|
|
+ return this.$errorMsg('至少选择一名账号');
|
|
|
}
|
|
|
- this.$confirm(`确定删除选中的成员吗?`, '提示', {
|
|
|
+ this.$confirm(`确定删除选中的账号吗?`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
@@ -583,7 +632,7 @@ export default {
|
|
|
}).catch(() => {});
|
|
|
},
|
|
|
|
|
|
- // 删除成员
|
|
|
+ // 删除账号
|
|
|
deleteMember(id) {
|
|
|
deleteMember({id: id}).then(res => {
|
|
|
this.$successMsg();
|
|
@@ -592,6 +641,71 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ // 操作 - 更改状态(type: 禁用0,启用1)
|
|
|
+ changeStatus(id, type) {
|
|
|
+ type = type ? true : false
|
|
|
+ changeAccountStatus({adminUserId: id, status: type}).then(res => {
|
|
|
+ this.getList();
|
|
|
+ this.$successMsg();
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 显示隐藏密码
|
|
|
+ showPwd(num) {
|
|
|
+ if(num == 1) {
|
|
|
+ if (this.passwordType1 === 'password') {
|
|
|
+ this.passwordType1 = ''
|
|
|
+ } else {
|
|
|
+ this.passwordType1 = 'password'
|
|
|
+ }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.password1.focus()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(num == 2) {
|
|
|
+ if (this.passwordType2 === 'password') {
|
|
|
+ this.passwordType2 = ''
|
|
|
+ } else {
|
|
|
+ this.passwordType2 = 'password'
|
|
|
+ }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.password2.focus()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 重置密码
|
|
|
+ handleReset(id) {
|
|
|
+ this.resetId = id;
|
|
|
+ this.resetFormVisible = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 取消重置密码
|
|
|
+ cancelResetForm(){
|
|
|
+ this.resetFormVisible = false;
|
|
|
+ this.passwordType1 = 'password';
|
|
|
+ this.passwordType2 = 'password';
|
|
|
+ this.$refs.resetForm.resetFields();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 提交重置密码
|
|
|
+ submitResetForm() {
|
|
|
+ this.$refs.resetForm.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let params = {
|
|
|
+ password: this.resetForm.newPassword,
|
|
|
+ adminUserId: this.resetId
|
|
|
+ }
|
|
|
+ resetPassword(params).then(res => {
|
|
|
+ this.cancelResetForm();
|
|
|
+ this.getList();
|
|
|
+ this.$successMsg();
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
// 导出
|
|
|
handleExport() {
|
|
|
let screenData = {
|
|
@@ -605,10 +719,6 @@ export default {
|
|
|
handleDownload() {
|
|
|
downloadFiles('wechat/enterprise/download');
|
|
|
},
|
|
|
- // 下载导入删除模板
|
|
|
- delHandleDownload() {
|
|
|
- downloadFiles('wechat/enterprise/downloadDeleteExcel');
|
|
|
- },
|
|
|
|
|
|
clickImport() {
|
|
|
if(!this.selectDepartment) {
|
|
@@ -640,27 +750,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- // 导入删除成员
|
|
|
- async handleImport2(param) {
|
|
|
- this.importLoading2 = true;
|
|
|
- const file = param.file;
|
|
|
- const formData = new FormData();
|
|
|
- formData.append("file", file);
|
|
|
- let result = await handleImport('wechat/enterprise/excelDelete', formData);
|
|
|
- this.importLoading2 = false;
|
|
|
- this.importFileList2 = [];
|
|
|
- if(result.code == 200) {
|
|
|
- this.$alert(result.message, '导入成功', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- });
|
|
|
- this.getList();
|
|
|
- }else {
|
|
|
- this.$alert(result.message, '导入失败', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -729,4 +818,12 @@ export default {
|
|
|
::v-deep .el-divider--vertical {
|
|
|
margin: 0 15px;
|
|
|
}
|
|
|
+ .show-pwd {
|
|
|
+ position: absolute;
|
|
|
+ right: 15px;
|
|
|
+ top: 0;
|
|
|
+ font-size: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ user-select: none;
|
|
|
+ }
|
|
|
</style>
|