账户管理对接

master
Caps 6 years ago
parent 6f978b9dfa
commit 3a46e60e75

@ -3,31 +3,51 @@
<template>
<Row style="background-color: #F7F8FA;line-height: 80px;">
<span style="margin-left: 20px">账户名</span>
<i-input placeholder="搜索用户名/账户" style="width: 10%;margin-left: 10px;" v-model="searchContent" />
<i-input placeholder="搜索用户名/账户" style="width: 10%;margin-left: 10px;" v-model="searchContent"/>
<span style=";margin-left: 20px;">角色</span>
<Select filterable placeholder="请选择区域" v-model="roleId" class="left-15" style="width:190px;margin-left: 10px;">
<Select filterable placeholder="请选择角色" v-model="changeRoleId" class="left-15"
style="width:190px;margin-left: 10px;">
<Option v-for="item in roleList" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
<span style=";margin-left: 20px;">店铺</span>
<Select filterable placeholder="请选择店铺" v-model="shopId" class="left-15" style="width:190px;margin-left: 10px;">
<Option v-for="item in shopList" :value="item.shopId" :key="item.shopId">{{ item.shopName }}</Option>
<Select filterable placeholder="请选择店铺" v-model="changeShopId" class="left-15"
style="width:190px;margin-left: 10px;">
<Option v-for="item in shopList" :value="item.id" :key="item.name">{{ item.name }}</Option>
</Select>
<Button type="primary" style="margin-left: 30px">查询</Button>
<Button type="primary" style="margin-bottom: 20px;margin-right: 20px;float:right;margin-top: 25px" @click="addOneAccount()">+</Button>
<Button type="primary" ghost style="margin-bottom: 20px;margin-right: 20px;float:right;margin-top: 25px" @click="uploadAccount"></Button>
<Button type="primary" style="margin-left: 30px" @click="listAccountInfoFunction"></Button>
<Button type="primary" style="margin-bottom: 20px;margin-right: 20px;float:right;margin-top: 25px"
@click="addOneAccount()">+添加账户
</Button>
<Button type="primary" ghost style="margin-bottom: 20px;margin-right: 20px;float:right;margin-top: 25px"
@click="uploadAccount">批量导入账户
</Button>
</Row>
</template>
<Table :columns="columns1" :data="data1" style="margin-top: 30px"></Table>
<Page :total="totalSize" :current="pageNum" :page-size="pageSize" show-elevator show-total
placement="top" style="float: right;margin-top: 20px"></Page>
<Modal
v-model="modal13"
title="删除提示"
@on-ok="ok"
@on-cancel="cancel" align="center">
<p style="margin-top: 20px;margin-bottom: 20px">确定要删除此账户吗删除后不可恢复</p>
<div slot="footer" style="text-align: center;margin-bottom: 10px;margin-top: 10px">
<Button style="width: 100px;" @click="modal13 = false">取消删除</Button>
<Button type="error" style="width: 100px;margin-left: 20px" @click="modal13 = false">确认删除</Button>
</div>
</Modal>
</div>
</template>
<script>
import accountManagement from "../../services/account/AccountManagement";
export default {
data(){
data() {
return {
roleList:[
modal13: false,
roleList: [
{
id: '1',
name: '系统管理员',
@ -45,7 +65,7 @@
name: '导购',
},
],
shopList:[
shopList: [
{
shopId: '1',
shopName: '店铺1',
@ -65,27 +85,32 @@
{
title: '姓名',
key: 'userName',
width:'150px'
width: '150px'
},
{
title: '员工ID',
key: 'userCode',
width:'150px'
key: 'staffCode',
width: '150px',
render: (h, params) => {
let that = this;
return h('span', {}, that.data1[params.index].staffCode === null ? '--' : that.data1[params.index].staffCode)
}
},
{
title: '系统角色',
key: 'roleName',
width:'150px'
width: '150px'
},
{
title: '可见店铺',
key: 'shopName',
width:'200px'
width: '200px'
},
{
title: '操作',
key: 'operation',
render: (h, params) => {
let that = this;
return h('div', [
h('span', {
style: {
@ -97,6 +122,7 @@
},
on: {
click: () => {
that.addOneAccount();
}
}
}, '修改'),
@ -110,7 +136,9 @@
},
on: {
click: () => {
this.remove(params);
that.modal13 = true;
that.updateAccountId = that.data1[params.index].accountId;
that.updateUserId = that.data1[params.index].userId;
}
}
}, '删除')
@ -121,31 +149,175 @@
],
data1: [
{
userName:"何永东",
userCode:"7833",
roleName:"系统管理员",
shopName:"全部",
userName: "何永东",
userCode: "7833",
roleName: "系统管理员",
shopName: "全部",
}
],
roleId:1,
shopId:1,
roleId: '',
shopId: '',
//
totalSize: 0,
pageNum : 1,
pageSize : 10,
pageNum: 1,
pageSize: 20,
//
searchContent: null,
changeShopId: null,
changeRoleId: null,
updateAccountId: 0,
updateUserId: 0,
}
},
methods:{
mounted: function () {
this.listAccountInfoFunction();
this.listRoleInfo();
this.listOfShop();
},
methods: {
//
handlePage: function (value) {
this.pageNum = value;
this.listAccountInfoFunction();
},
//
addOneAccount(){
this.$router.push({path:'/account/management/add'});
addOneAccount() {
this.$router.push({path: '/account/management/add'});
},
//
uploadAccount(){
this.$router.push({path:'/account/management/upload'});
uploadAccount() {
this.$router.push({path: '/account/management/upload'});
},
//
listRoleInfo() {
let that = this;
that.roleList = [];
accountManagement.listRoleInfoApi({}, function (data) {
data = data.data;
if (data.code === '9999') {
that.$router.push('/login');
that.$Message.error("会话超时请重新登陆!");
}
if (data.code === '0001') {
that.$Message.error("查询角色失败!");
return;
}
if (data.code === '0000') {
data = data.results;
for (let i = 0; i < data.length; i++) {
let row = data[i];
that.roleList.push(row);
}
}
})
},
//
listOfShop() {
let that = this;
that.shopList = [];
let request = {
userId: JSON.parse(sessionStorage.getItem("loginInfo")).userId
};
accountManagement.listAllShopApi(request, function (data) {
data = data.data;
if (data.code === '9999') {
that.$router.push('/login');
that.$Message.error("会话超时请重新登陆!");
}
if (data.code === '0001') {
that.$Message.error("查询店铺失败!");
return;
}
if (data.code === '0000') {
data = data.results;
for (let i = 0; i < data.length; i++) {
let row = data[i];
that.shopList.push(row);
}
}
})
},
//
listAccountInfoFunction: function () {
let that = this;
that.data1 = [];
let request = {
searchContent: that.searchContent,
pageNum: that.pageNum,
pageSize: that.pageSize,
roleId: that.changeRoleId,
shopId: that.changeShopId
};
accountManagement.listAccountInfoApi(request, function (data) {
data = data.data;
if (data.code === '9999') {
that.$router.push('/login');
that.$Message.error("会话超时请重新登陆!");
}
if (data.code === '0001') {
that.$Message.error("系统繁忙!");
return
}
if (data.code === '0000') {
if (data) {
let row = data.results.records;
that.totalSize = data.results.total;
for (let i = 0; i < row.length; i++) {
let entity = row[i];
if (!entity.channel) {
entity.channel = '--';
}
if (!entity.account) {
entity.account = '--';
}
if (!entity.userName) {
entity.userName = '--';
}
if (!entity.roleName) {
entity.roleName = '--';
}
if (!entity.shopName) {
entity.shopName = '--';
}
that.data1.push(entity);
}
if (row === null || row.length === 0) {
that.totalSize = 0;
}
}
}
})
},
//
remove() {
let that = this;
let request = {
accountId: that.updateAccountId,
userId: that.updateUserId
};
accountManagement.removeAccountApi(request, function (data) {
if (data.code === '9999') {
that.$router.push('/login');
that.$Message.error("会话超时请重新登陆!");
}
if (data.data.code === '0001') {
that.$Message.info("删除失败");
return
}
if (data.data.code === '0000') {
that.$Message.info("删除成功");
that.pageNum = 1;
that.listAccountInfoFunction();
}
})
},
},
cancel() {
},
ok() {
this.remove();
}
}
</script>

@ -24,10 +24,31 @@ export function removeAccountApi(params, call) {
return http.post('account/remove', params).then(call);
}
/**
* 查询所有店铺
* @param params
* @param call
* @returns {Promise<any | never>}
*/
export function listAllShopApi(params, call) {
return http.get('/poi/store/all/list', params).then(call);
}
/**
* 查询所有角色
* @param params
* @param call
* @returns {Promise<any | never>}
*/
export function listRoleInfoApi(params, call) {
return http.get('/role/info/list', params).then(call);
}
export default {
listAccountInfoApi,
removeAccountApi,
listAllShopApi,
listRoleInfoApi
}

Loading…
Cancel
Save