|
@@ -3,23 +3,10 @@
|
|
|
<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 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">
|
|
|
+ <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>
|
|
@@ -30,17 +17,25 @@
|
|
|
<!-- <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-form ref="screenForm" :model="screenForm" label-width="70px" size="mini" label-position="left">
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col :xs="24" :sm="12" :lg="12">
|
|
|
+ <el-col :xs="24" :sm="12" :lg="6">
|
|
|
<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="6">
|
|
|
+ <el-form-item label="账号名称" prop="name">
|
|
|
+ <el-select class="selectStyle" v-model="screenForm.roleId" placeholder="请选择" filterable>
|
|
|
+ <el-option v-for="(v, i) in roleList" :key="i" :label="v.name" :value="v.adminRoleId">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </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-button size="mini" @click="resetScreenForm">清空</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="submitScreenForm">搜索</el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -48,24 +43,19 @@
|
|
|
</div>
|
|
|
<div class="btn-group clearfix" style="margin-top: 20px">
|
|
|
<div class="fl">
|
|
|
- <el-button size="small" type="primary" @click="openAccountForm('add')">添加账号</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="openAccountForm('add')">添加账号</el-button>
|
|
|
|
|
|
</div>
|
|
|
<div class="fr">
|
|
|
- <el-button size="small" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button>
|
|
|
-
|
|
|
- <el-upload
|
|
|
- class="import-btn"
|
|
|
- v-if="checkBtnRole('import')"
|
|
|
- action=""
|
|
|
- :http-request="handleImport"
|
|
|
- :file-list="importFileList"
|
|
|
- :show-file-list="false"
|
|
|
- >
|
|
|
- <!-- v-if="checkBtnRole('import')" -->
|
|
|
- <el-button size="small" type="primary" :loading="importLoading">{{ importLoading ? '导入中...' : '导入' }}</el-button>
|
|
|
+ <el-button size="mini" @click="handleDownload" v-if="checkBtnRole('download')">下载导入模板</el-button>
|
|
|
+ <ExportButton class="import-btn" :exUrl="'/admin/user/user/listExport'" :exParams="exParams" />
|
|
|
+
|
|
|
+ <el-upload class="import-btn" v-if="checkBtnRole('import')" action="" :http-request="handleImport" :file-list="importFileList" :show-file-list="false">
|
|
|
+ <!-- v-if="checkBtnRole('import')" -->
|
|
|
+ <el-button size="mini" 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>
|
|
@@ -76,23 +66,23 @@
|
|
|
<div class="table">
|
|
|
<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>
|
|
|
- <el-table-column align="center" label="创建时间" prop="createTime" min-width="160"></el-table-column>
|
|
|
- <el-table-column align="center" label="最后登录时间" prop="lastLoginTime" min-width="160"></el-table-column>
|
|
|
- <el-table-column align="center" label="状态" class-name="status-col">
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="账号" prop="userName" min-width="120"></el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="用户名" prop="nickName" min-width="160"></el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="角色" prop="roleName" min-width="100"></el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="创建时间" prop="createTime" min-width="160"></el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="最后登录时间" prop="lastLoginTime" min-width="160"></el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip align="center" label="状态" class-name="status-col">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag :type="scope.row.status ? 'success':'danger'">{{ scope.row.status ? '正常':'冻结' }}</el-tag>
|
|
|
+ <el-tag size="mini" :type="scope.row.status ? 'success':'danger'">{{ scope.row.status ? '正常':'冻结' }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="操作" min-width="160">
|
|
|
<template slot-scope="scope">
|
|
|
<template v-if="checkBtnRole('status')">
|
|
|
- <el-popconfirm v-if="scope.row.status" style="margin-right: 10px;" title="确定冻结吗?" @onConfirm="changeStatus(scope.row.adminUserId, 0)" >
|
|
|
+ <el-popconfirm v-if="scope.row.status" style="margin-right: 10px;" title="确定冻结吗?" @onConfirm="changeStatus(scope.row.adminUserId, 0)">
|
|
|
<el-button slot="reference" type="text">冻结</el-button>
|
|
|
</el-popconfirm>
|
|
|
- <el-popconfirm v-else style="margin-right: 10px;" title="确定恢复吗?" @onConfirm="changeStatus(scope.row.adminUserId, 1)" >
|
|
|
+ <el-popconfirm v-else style="margin-right: 10px;" title="确定恢复吗?" @onConfirm="changeStatus(scope.row.adminUserId, 1)">
|
|
|
<el-button slot="reference" type="text">恢复</el-button>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
@@ -111,14 +101,7 @@
|
|
|
|
|
|
<div class="pagination clearfix">
|
|
|
<div class="fr">
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="currentPage"
|
|
|
- :page-sizes="[10, 20, 30, 50]"
|
|
|
- :page-size="10"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="listTotal">
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 50]" :page-size="10" layout="total, sizes, prev, pager, next, jumper" :total="listTotal">
|
|
|
</el-pagination>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -133,21 +116,14 @@
|
|
|
<el-form-item label="用户名" prop="nickName">
|
|
|
<el-input v-model="AccountForm.nickName" autocomplete="off" placeholder="请输入用户名"></el-input>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
+
|
|
|
<el-form-item label="角色组" prop="role">
|
|
|
<el-select v-model="AccountForm.role" placeholder="请选择角色组" style="width: 100%;" filterable>
|
|
|
<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="roleObj.type === 0">
|
|
|
- <el-tree
|
|
|
- :data="departmentList"
|
|
|
- show-checkbox
|
|
|
- :check-strictly="true"
|
|
|
- node-key="adminWebsitId"
|
|
|
- ref="tree"
|
|
|
- highlight-current
|
|
|
- :props="props">
|
|
|
+ <el-tree :data="departmentList" show-checkbox :check-strictly="true" node-key="adminWebsitId" ref="tree" highlight-current :props="props">
|
|
|
</el-tree>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="经销商" prop="dealer" v-show="roleObj.type === 0 && roleObj.name === '经销商'">
|
|
@@ -177,7 +153,6 @@
|
|
|
<el-radio :label="false">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
<el-form-item label="密码" prop="newPassword" v-if="AccountFormType == 'add'">
|
|
|
<el-input v-model="AccountForm.newPassword" ref="password1" autocomplete="off" placeholder="请输入密码" :type="passwordType1"></el-input>
|
|
|
<span class="show-pwd" @click="showPwd(1)">
|
|
@@ -190,11 +165,11 @@
|
|
|
<svg-icon :icon-class="passwordType2 === 'password' ? 'eye' : 'eye-open'" />
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="可用仓库" prop="correspondIds">
|
|
|
- <el-select multiple v-model="AccountForm.correspondIds" placeholder="请选择可用仓库" style="width: 100%;" filterable>
|
|
|
+ <el-form-item label="可用仓库" prop="correspondIds">
|
|
|
+ <el-select multiple v-model="AccountForm.correspondIds" placeholder="请选择可用仓库" style="width: 100%;" filterable>
|
|
|
<el-option :label="item.name" :value="item.id" v-for="(item, index) in stockList" :key="index"></el-option>
|
|
|
</el-select>
|
|
|
-
|
|
|
+
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
@@ -230,63 +205,76 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getStockListStock, getDepartmentList, getAccountList, addAccount, editAccount, deleteAccount, getAccountDetail, getRoleList, getMerchantList, changeAccountStatus, resetPassword } from '@/api/setting'
|
|
|
-import { getDealerList } from '@/api/common'
|
|
|
-import { findElem, downloadFiles, handleImportTwo } from '@/utils/util'
|
|
|
-
|
|
|
+import {
|
|
|
+ getStockListStock,
|
|
|
+ getDepartmentList,
|
|
|
+ getAccountList,
|
|
|
+ addAccount,
|
|
|
+ editAccount,
|
|
|
+ deleteAccount,
|
|
|
+ getAccountDetail,
|
|
|
+ getRoleList,
|
|
|
+ getMerchantList,
|
|
|
+ changeAccountStatus,
|
|
|
+ resetPassword,
|
|
|
+} from "@/api/setting";
|
|
|
+import { getDealerList } from "@/api/common";
|
|
|
+import { findElem, downloadFiles, handleImportTwo } from "@/utils/util";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
var validatePass = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请输入新密码'));
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("请输入新密码"));
|
|
|
} else if (value && value.length < 6) {
|
|
|
- callback(new Error('密码长度至少6位'));
|
|
|
+ callback(new Error("密码长度至少6位"));
|
|
|
} else {
|
|
|
- if (this.resetForm.confirmPassword !== '') {
|
|
|
- this.$refs.resetForm.validateField('confirmPassword');
|
|
|
+ if (this.resetForm.confirmPassword !== "") {
|
|
|
+ this.$refs.resetForm.validateField("confirmPassword");
|
|
|
}
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
var validatePass2 = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请再次输入密码'));
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("请再次输入密码"));
|
|
|
} else if (value !== this.resetForm.newPassword) {
|
|
|
- callback(new Error('两次输入密码不一致'));
|
|
|
+ callback(new Error("两次输入密码不一致"));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
var validatePass3 = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请输入新密码'));
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("请输入新密码"));
|
|
|
} else if (value && value.length < 6) {
|
|
|
- callback(new Error('密码长度至少6位'));
|
|
|
+ callback(new Error("密码长度至少6位"));
|
|
|
} else {
|
|
|
- if (this.AccountForm.confirmPassword !== '') {
|
|
|
- this.$refs.AccountForm.validateField('confirmPassword');
|
|
|
+ if (this.AccountForm.confirmPassword !== "") {
|
|
|
+ this.$refs.AccountForm.validateField("confirmPassword");
|
|
|
}
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
var validatePass4 = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请再次输入密码'));
|
|
|
+ if (value === "") {
|
|
|
+ callback(new Error("请再次输入密码"));
|
|
|
} else if (value !== this.AccountForm.newPassword) {
|
|
|
- callback(new Error('两次输入密码不一致'));
|
|
|
+ callback(new Error("两次输入密码不一致"));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
};
|
|
|
return {
|
|
|
- stockList:[],//仓库列表
|
|
|
+ stockList: [], //仓库列表
|
|
|
baseURL: process.env.VUE_APP_BASE_API,
|
|
|
dataList: null, // 列表数据
|
|
|
moduleList: null, // 模块列表
|
|
|
listLoading: true, // 列表加载loading
|
|
|
- screenForm: { // 筛选表单数据
|
|
|
- name: '', // 名称
|
|
|
+ screenForm: {
|
|
|
+ // 筛选表单数据
|
|
|
+ name: "", // 名称
|
|
|
+ roleId: "",
|
|
|
},
|
|
|
currentPage: 1, // 当前页码
|
|
|
pageSize: 10, // 每页数量
|
|
@@ -294,54 +282,50 @@ export default {
|
|
|
|
|
|
selectDepartment: null, // 选中的部门
|
|
|
|
|
|
- AccountFormType: 'add',
|
|
|
+ AccountFormType: "add",
|
|
|
AccountFormVisible: false,
|
|
|
AccountForm: {
|
|
|
- account: '', // 账号
|
|
|
- nickName: '', // 用户名
|
|
|
- merchant: '', // 商户
|
|
|
- dealer: '', //经销商
|
|
|
- role: '', // 角色组
|
|
|
- correspondIds:[],//仓库
|
|
|
+ account: "", // 账号
|
|
|
+ nickName: "", // 用户名
|
|
|
+ merchant: "", // 商户
|
|
|
+ dealer: "", //经销商
|
|
|
+ role: "", // 角色组
|
|
|
+ correspondIds: [], //仓库
|
|
|
isGroup: false,
|
|
|
- company: '',
|
|
|
+ company: "",
|
|
|
isDiscount: true,
|
|
|
- newPassword: '', // 新密码
|
|
|
- confirmPassword: '', // 确认密码
|
|
|
+ newPassword: "", // 新密码
|
|
|
+ confirmPassword: "", // 确认密码
|
|
|
},
|
|
|
AccountFormRules: {
|
|
|
- account: [
|
|
|
- { required: true, message: '请输入账号', trigger: 'blur' }
|
|
|
- ],
|
|
|
+ account: [{ required: true, message: "请输入账号", trigger: "blur" }],
|
|
|
nickName: [
|
|
|
- { required: true, message: '请输入用户名', trigger: 'blur' }
|
|
|
- ],
|
|
|
- role: [
|
|
|
- { required: true, message: '请选择角色组', trigger: 'change' }
|
|
|
+ { required: true, message: "请输入用户名", trigger: "blur" },
|
|
|
],
|
|
|
+ role: [{ required: true, message: "请选择角色组", trigger: "change" }],
|
|
|
correspondIds: [
|
|
|
- { required: true, message: '请选择可用仓库', trigger: 'change' }
|
|
|
+ { required: true, message: "请选择可用仓库", trigger: "change" },
|
|
|
],
|
|
|
newPassword: [
|
|
|
- { required: true, validator: validatePass3, trigger: 'blur' }
|
|
|
+ { required: true, validator: validatePass3, trigger: "blur" },
|
|
|
],
|
|
|
confirmPassword: [
|
|
|
- { required: true, validator: validatePass4, trigger: 'blur' }
|
|
|
+ { required: true, validator: validatePass4, trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
editAccountId: null,
|
|
|
|
|
|
- filterText: '',
|
|
|
+ filterText: "",
|
|
|
departmentList: [],
|
|
|
defaultProps: {
|
|
|
- children: 'children',
|
|
|
- label: 'name'
|
|
|
+ children: "children",
|
|
|
+ label: "name",
|
|
|
},
|
|
|
props: {
|
|
|
multiple: true,
|
|
|
- value: 'adminWebsitId',
|
|
|
- label: 'name',
|
|
|
- children: 'children',
|
|
|
+ value: "adminWebsitId",
|
|
|
+ label: "name",
|
|
|
+ children: "children",
|
|
|
},
|
|
|
|
|
|
tableSelection: [],
|
|
@@ -349,18 +333,18 @@ export default {
|
|
|
importLoading: false, // 导入加载loading
|
|
|
importFileList: [], // 导入列表
|
|
|
|
|
|
- resetId: null,
|
|
|
+ resetId: null,
|
|
|
resetFormVisible: false,
|
|
|
resetForm: {
|
|
|
- newPassword: '', // 新密码
|
|
|
- confirmPassword: '', // 确认密码
|
|
|
+ newPassword: "", // 新密码
|
|
|
+ confirmPassword: "", // 确认密码
|
|
|
},
|
|
|
resetFormRules: {
|
|
|
newPassword: [
|
|
|
- { required: true, validator: validatePass, trigger: 'blur' }
|
|
|
+ { required: true, validator: validatePass, trigger: "blur" },
|
|
|
],
|
|
|
confirmPassword: [
|
|
|
- { required: true, validator: validatePass2, trigger: 'blur' }
|
|
|
+ { required: true, validator: validatePass2, trigger: "blur" },
|
|
|
],
|
|
|
},
|
|
|
|
|
@@ -369,32 +353,43 @@ export default {
|
|
|
merchantList: [],
|
|
|
dealerList: [],
|
|
|
|
|
|
- passwordType1: 'password',
|
|
|
- passwordType2: 'password',
|
|
|
- }
|
|
|
+ passwordType1: "password",
|
|
|
+ passwordType2: "password",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ exParams() {
|
|
|
+ return {
|
|
|
+ userName: this.screenForm.name,
|
|
|
+ };
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
filterText(val) {
|
|
|
this.$refs.listTree.filter(val);
|
|
|
},
|
|
|
- 'AccountForm.role'() {
|
|
|
- if(this.AccountForm.role) {
|
|
|
- let index = findElem(this.roleList, 'adminRoleId', this.AccountForm.role);
|
|
|
+ "AccountForm.role"() {
|
|
|
+ if (this.AccountForm.role) {
|
|
|
+ let index = findElem(
|
|
|
+ this.roleList,
|
|
|
+ "adminRoleId",
|
|
|
+ this.AccountForm.role
|
|
|
+ );
|
|
|
this.roleObj = this.roleList[index];
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
async created() {
|
|
|
this.getTree();
|
|
|
this.getList();
|
|
|
- this.getStockList()
|
|
|
+ this.getStockList();
|
|
|
+ await this.getRoleList();
|
|
|
},
|
|
|
methods: {
|
|
|
//获取仓库仓位对应关系列表
|
|
|
- async getStockList(){
|
|
|
- let res = await getStockListStock({pageSize:-1,pageNum:1})
|
|
|
- this.stockList = res.data.records
|
|
|
-
|
|
|
+ async getStockList() {
|
|
|
+ let res = await getStockListStock({ pageSize: -1, pageNum: 1 });
|
|
|
+ this.stockList = res.data.records;
|
|
|
},
|
|
|
// 查询按钮权限
|
|
|
checkBtnRole(value) {
|
|
@@ -408,13 +403,15 @@ export default {
|
|
|
// 获取角色列表
|
|
|
async getRoleList() {
|
|
|
const result = await new Promise((resolve, reject) => {
|
|
|
- getRoleList({pageNum: 1, pageSize: -1}).then(res => {
|
|
|
- this.roleList = res.data.records;
|
|
|
- resolve(res.data);
|
|
|
- }).catch(res => {
|
|
|
- resolve([]);
|
|
|
- })
|
|
|
- })
|
|
|
+ getRoleList({ pageNum: 1, pageSize: -1 })
|
|
|
+ .then((res) => {
|
|
|
+ this.roleList = res.data.records;
|
|
|
+ resolve(res.data);
|
|
|
+ })
|
|
|
+ .catch((res) => {
|
|
|
+ resolve([]);
|
|
|
+ });
|
|
|
+ });
|
|
|
return result;
|
|
|
},
|
|
|
|
|
@@ -423,14 +420,16 @@ export default {
|
|
|
const result = await new Promise((resolve, reject) => {
|
|
|
getMerchantList({
|
|
|
pageNum: 1,
|
|
|
- pageSize: -1
|
|
|
- }).then(res => {
|
|
|
- this.merchantList = res.data.records;
|
|
|
- resolve(res.data.records);
|
|
|
- }).catch(res => {
|
|
|
- resolve([]);
|
|
|
+ pageSize: -1,
|
|
|
})
|
|
|
- })
|
|
|
+ .then((res) => {
|
|
|
+ this.merchantList = res.data.records;
|
|
|
+ resolve(res.data.records);
|
|
|
+ })
|
|
|
+ .catch((res) => {
|
|
|
+ resolve([]);
|
|
|
+ });
|
|
|
+ });
|
|
|
return result;
|
|
|
},
|
|
|
|
|
@@ -440,22 +439,24 @@ export default {
|
|
|
getDealerList({
|
|
|
pageNum: 1,
|
|
|
pageSize: -1,
|
|
|
- bindUser: false
|
|
|
- }).then(res => {
|
|
|
- this.dealerList = res.data.records;
|
|
|
- resolve(res.data.records);
|
|
|
- }).catch(res => {
|
|
|
- resolve([]);
|
|
|
+ bindUser: false,
|
|
|
})
|
|
|
- })
|
|
|
+ .then((res) => {
|
|
|
+ this.dealerList = res.data.records;
|
|
|
+ resolve(res.data.records);
|
|
|
+ })
|
|
|
+ .catch((res) => {
|
|
|
+ resolve([]);
|
|
|
+ });
|
|
|
+ });
|
|
|
return result;
|
|
|
},
|
|
|
|
|
|
// 获取部门列表
|
|
|
getTree() {
|
|
|
- getDepartmentList().then(res => {
|
|
|
+ getDepartmentList().then((res) => {
|
|
|
this.departmentList = res.data;
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 获取账号列表
|
|
@@ -465,15 +466,18 @@ export default {
|
|
|
let params = {
|
|
|
pageNum: this.currentPage,
|
|
|
pageSize: this.pageSize,
|
|
|
- adminWebsitId: this.selectDepartment ? this.selectDepartment.adminWebsitId : '',
|
|
|
- userName: this.screenForm.name
|
|
|
+ adminWebsitId: this.selectDepartment
|
|
|
+ ? this.selectDepartment.adminWebsitId
|
|
|
+ : "",
|
|
|
+ userName: this.screenForm.name,
|
|
|
+ roleId: this.screenForm.roleId,
|
|
|
};
|
|
|
|
|
|
- getAccountList(params).then(res => {
|
|
|
+ getAccountList(params).then((res) => {
|
|
|
this.dataList = res.data.records;
|
|
|
this.listTotal = res.data.total;
|
|
|
this.listLoading = false;
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 更改每页数量
|
|
@@ -511,10 +515,13 @@ export default {
|
|
|
// 选择部门
|
|
|
handleNodeClick(data) {
|
|
|
console.log(data);
|
|
|
- if(this.selectDepartment && data.adminWebsitId === this.selectDepartment.adminWebsitId) {
|
|
|
+ if (
|
|
|
+ this.selectDepartment &&
|
|
|
+ data.adminWebsitId === this.selectDepartment.adminWebsitId
|
|
|
+ ) {
|
|
|
this.$refs.listTree.setCurrentKey(null);
|
|
|
this.selectDepartment = null;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
this.selectDepartment = data;
|
|
|
}
|
|
|
this.getList();
|
|
@@ -530,22 +537,21 @@ export default {
|
|
|
|
|
|
// 打开 新增编辑 账号表单
|
|
|
async openAccountForm(type, id) {
|
|
|
-
|
|
|
this.AccountFormType = type;
|
|
|
this.AccountFormVisible = true;
|
|
|
await this.getMerchantList();
|
|
|
await this.getDealerList();
|
|
|
await this.getRoleList();
|
|
|
- if(type == 'add') {
|
|
|
- if(this.selectDepartment) {
|
|
|
+ if (type == "add") {
|
|
|
+ if (this.selectDepartment) {
|
|
|
this.$refs.tree.setCheckedKeys([this.selectDepartment.adminWebsitId]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(type == 'edit') {
|
|
|
+ if (type == "edit") {
|
|
|
this.editAccountId = id;
|
|
|
- getAccountDetail({adminUserId: id}).then(res => {
|
|
|
- console.log(res,78787);
|
|
|
+ getAccountDetail({ adminUserId: id }).then((res) => {
|
|
|
+ console.log(res, 78787);
|
|
|
this.AccountForm.account = res.data.userName;
|
|
|
this.AccountForm.role = res.data.roleId;
|
|
|
this.AccountForm.nickName = res.data.nickName;
|
|
@@ -556,16 +562,16 @@ export default {
|
|
|
this.AccountForm.isDiscount = res.data.isZr;
|
|
|
this.AccountForm.correspondIds = res.data.stockCorrespondList;
|
|
|
this.$refs.tree.setCheckedKeys(res.data.adminWebsitIds || []);
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 取消 新增编辑 账号表单
|
|
|
- cancelAccountForm(){
|
|
|
+ cancelAccountForm() {
|
|
|
this.AccountFormVisible = false;
|
|
|
this.$refs.AccountForm.resetFields();
|
|
|
- this.passwordType1 = 'password';
|
|
|
- this.passwordType2 = 'password';
|
|
|
+ this.passwordType1 = "password";
|
|
|
+ this.passwordType2 = "password";
|
|
|
},
|
|
|
|
|
|
// 提交 账号表单
|
|
@@ -579,34 +585,34 @@ export default {
|
|
|
roleId: this.AccountForm.role,
|
|
|
password: this.AccountForm.newPassword,
|
|
|
correspondIds: this.AccountForm.correspondIds,
|
|
|
- }
|
|
|
- if(this.roleObj.type === 0) {
|
|
|
+ };
|
|
|
+ if (this.roleObj.type === 0) {
|
|
|
params.adminWebsitIds = this.$refs.tree.getCheckedKeys();
|
|
|
- if(this.roleObj.name === '经销商') {
|
|
|
+ if (this.roleObj.name === "经销商") {
|
|
|
params.customerId = this.AccountForm.dealer;
|
|
|
params.isGroupCompany = this.AccountForm.isGroup;
|
|
|
params.parentCustomerId = this.AccountForm.company;
|
|
|
params.isZr = this.AccountForm.isDiscount;
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
params.adminCompanyId = this.AccountForm.merchant;
|
|
|
}
|
|
|
- if(this.AccountFormType == 'edit') {
|
|
|
+ if (this.AccountFormType == "edit") {
|
|
|
params.adminUserId = this.editAccountId;
|
|
|
- editAccount(params).then(res => {
|
|
|
+ editAccount(params).then((res) => {
|
|
|
this.cancelAccountForm();
|
|
|
this.getList();
|
|
|
- this.$successMsg('编辑成功');
|
|
|
- })
|
|
|
- }else {
|
|
|
- addAccount(params).then(res => {
|
|
|
+ this.$successMsg("编辑成功");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addAccount(params).then((res) => {
|
|
|
this.cancelAccountForm();
|
|
|
this.getList();
|
|
|
- this.$successMsg('添加成功');
|
|
|
- })
|
|
|
+ this.$successMsg("添加成功");
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 表格选择列
|
|
@@ -616,65 +622,67 @@ export default {
|
|
|
|
|
|
// 批量删除账号
|
|
|
batchDeleteAccount() {
|
|
|
- if(this.tableSelection.length < 1) {
|
|
|
- return this.$errorMsg('至少选择一名账号');
|
|
|
+ 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();
|
|
|
+ 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(() => {});
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
|
|
|
// 删除账号
|
|
|
deleteAccount(id) {
|
|
|
- deleteAccount({id: id}).then(res => {
|
|
|
+ deleteAccount({ id: id }).then((res) => {
|
|
|
this.$successMsg();
|
|
|
this.getTree();
|
|
|
this.getList();
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// 操作 - 更改状态(type: 禁用0,启用1)
|
|
|
changeStatus(id, type) {
|
|
|
- type = type ? true : false
|
|
|
- changeAccountStatus({adminUserId: id, status: type}).then(res => {
|
|
|
+ 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 = ''
|
|
|
+ if (num == 1) {
|
|
|
+ if (this.passwordType1 === "password") {
|
|
|
+ this.passwordType1 = "";
|
|
|
} else {
|
|
|
- this.passwordType1 = 'password'
|
|
|
+ this.passwordType1 = "password";
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.password1.focus()
|
|
|
- })
|
|
|
+ this.$refs.password1.focus();
|
|
|
+ });
|
|
|
}
|
|
|
- if(num == 2) {
|
|
|
- if (this.passwordType2 === 'password') {
|
|
|
- this.passwordType2 = ''
|
|
|
+ if (num == 2) {
|
|
|
+ if (this.passwordType2 === "password") {
|
|
|
+ this.passwordType2 = "";
|
|
|
} else {
|
|
|
- this.passwordType2 = 'password'
|
|
|
+ this.passwordType2 = "password";
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.password2.focus()
|
|
|
- })
|
|
|
+ this.$refs.password2.focus();
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -685,10 +693,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 取消重置密码
|
|
|
- cancelResetForm(){
|
|
|
+ cancelResetForm() {
|
|
|
this.resetFormVisible = false;
|
|
|
- this.passwordType1 = 'password';
|
|
|
- this.passwordType2 = 'password';
|
|
|
+ this.passwordType1 = "password";
|
|
|
+ this.passwordType2 = "password";
|
|
|
this.$refs.resetForm.resetFields();
|
|
|
},
|
|
|
|
|
@@ -698,37 +706,38 @@ export default {
|
|
|
if (valid) {
|
|
|
let params = {
|
|
|
password: this.resetForm.newPassword,
|
|
|
- adminUserId: this.resetId
|
|
|
- }
|
|
|
- resetPassword(params).then(res => {
|
|
|
+ adminUserId: this.resetId,
|
|
|
+ };
|
|
|
+ resetPassword(params).then((res) => {
|
|
|
this.cancelResetForm();
|
|
|
this.getList();
|
|
|
this.$successMsg();
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 导出
|
|
|
handleExport() {
|
|
|
let screenData = {
|
|
|
- adminWebsitId: this.selectDepartment ? this.selectDepartment.websitId : '',
|
|
|
- keyword: this.screenForm.name
|
|
|
+ adminWebsitId: this.selectDepartment
|
|
|
+ ? this.selectDepartment.websitId
|
|
|
+ : "",
|
|
|
+ keyword: this.screenForm.name,
|
|
|
};
|
|
|
- downloadFiles('wechat/enterprise/export', screenData);
|
|
|
+ downloadFiles("wechat/enterprise/export", screenData);
|
|
|
},
|
|
|
|
|
|
// 下载导入模版
|
|
|
handleDownload() {
|
|
|
- downloadFiles('/admin/user/download');
|
|
|
+ downloadFiles("/admin/user/download");
|
|
|
},
|
|
|
|
|
|
clickImport() {
|
|
|
- if(!this.selectDepartment) {
|
|
|
- return this.$errorMsg('请选择部门');
|
|
|
- }else {
|
|
|
- document.querySelector('.import-btn input').click();
|
|
|
+ if (!this.selectDepartment) {
|
|
|
+ return this.$errorMsg("请选择部门");
|
|
|
+ } else {
|
|
|
+ document.querySelector(".import-btn input").click();
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -740,31 +749,32 @@ export default {
|
|
|
const formData = new FormData();
|
|
|
formData.append("file", file);
|
|
|
|
|
|
- let result = await handleImportTwo('/admin/user/importUser', formData);
|
|
|
+ let result = await handleImportTwo("/admin/user/importUser", formData);
|
|
|
this.importLoading = false;
|
|
|
this.importFileList = [];
|
|
|
// console.log(result,999);
|
|
|
-
|
|
|
- if(result) {
|
|
|
- this.$alert(result.message, '导入成功', {
|
|
|
- confirmButtonText: '确定'
|
|
|
+
|
|
|
+ if (result) {
|
|
|
+ this.$alert(result.message, "导入成功", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ });
|
|
|
+ let blob = new Blob([result], {
|
|
|
+ type: "application/vnd.ms-excel,charset=utf-8",
|
|
|
});
|
|
|
- let blob = new Blob([result],{type: 'application/vnd.ms-excel,charset=utf-8'})
|
|
|
- let urll = window.URL.createObjectURL(blob)
|
|
|
- let link = document.createElement('a')
|
|
|
- link.download = '导入失败数据.xlsx'
|
|
|
- link.href = urll
|
|
|
- link.click()
|
|
|
+ let urll = window.URL.createObjectURL(blob);
|
|
|
+ let link = document.createElement("a");
|
|
|
+ link.download = "导入失败数据.xlsx";
|
|
|
+ link.href = urll;
|
|
|
+ link.click();
|
|
|
this.getList();
|
|
|
- }else {
|
|
|
- this.$alert(result.message, '导入失败', {
|
|
|
- confirmButtonText: '确定'
|
|
|
+ } else {
|
|
|
+ this.$alert(result.message, "导入失败", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
@@ -772,76 +782,75 @@ export default {
|
|
|
display: inline-block;
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
- .app-container {
|
|
|
+.app-container {
|
|
|
+ display: flex;
|
|
|
+ .tree-container {
|
|
|
+ width: 18%;
|
|
|
+ height: calc(100vh - 110px);
|
|
|
+ flex-shrink: 0;
|
|
|
+ background: #f5f5f5;
|
|
|
+ margin-right: 2%;
|
|
|
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;
|
|
|
- }
|
|
|
+ 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 {
|
|
|
- font-size: 14px;
|
|
|
- color: #999;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
span {
|
|
|
- font-size: 14px;
|
|
|
- margin-left: 6px;
|
|
|
- color: #666;
|
|
|
+ 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 {
|
|
|
- position: absolute;
|
|
|
- right: 15px;
|
|
|
- top: 0;
|
|
|
- font-size: 16px;
|
|
|
- cursor: pointer;
|
|
|
- user-select: none;
|
|
|
+ .mymain-container {
|
|
|
+ width: 80%;
|
|
|
+ margin-top: 0;
|
|
|
}
|
|
|
-
|
|
|
+}
|
|
|
+::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>
|