Commit 7a5bd0bd by LJM

Merge branch 'feature/ljm/20230807-子账号'

parents 130dd1c6 0cef9d78
<template>
<div id="app">
<keep-alive exclude="InquireDetail,ListDetail,orderTrackGoodsDetail,orderTrackPurAdd,enter,list,inquire,quote,orderTrackInvoice">
<keep-alive exclude="InquireDetail,ListDetail,orderTrackGoodsDetail,orderTrackPurAdd,enter,list,inquire,quote,orderTrackInvoice,subAccount,subAccountAdd,subAccountEdit">
<router-view class="router-view"></router-view>
</keep-alive>
</div>
......
.messagexk {
.message-box {
background: #fff;
padding: 20px;
height: calc(100vh - 136px);
.h3 {
font-size: 16px;
color: #333;
font-weight: bold;
position: relative;
&::before {
content: "";
width: 3px;
height: 100%;
background: #1969F9;
position: absolute;
left: -20px;
top: 0;
}
}
.up-box {
position: relative;
.avatar-uploader {
width: 98px;
height: 34px;
border-radius: 2px;
border: 1px solid #BEC9DF;
overflow: hidden;
line-height: 34px;
font-size: 14px;
color: #646B78;
.iconfont {
font-size: 18px;
position: relative;
top: -1px;
margin-left: 10px;
.message-box {
background: #fff;
padding: 20px;
height: calc(100vh - 136px);
.h3 {
font-size: 16px;
color: #333;
font-weight: bold;
position: relative;
&::before {
content: "";
width: 3px;
height: 100%;
background: #1969F9;
position: absolute;
left: -20px;
top: 0;
}
}
.up-box {
position: relative;
.avatar-uploader {
width: 98px;
height: 34px;
border-radius: 2px;
border: 1px solid #BEC9DF;
overflow: hidden;
line-height: 34px;
font-size: 14px;
color: #646B78;
.iconfont {
font-size: 18px;
position: relative;
top: -1px;
margin-left: 10px;
}
&:hover, .el-upload--picture-card:hover, .el-upload:focus {
color: #1969F9 !important;
border-color: #1969F9 !important;
}
}
.imspre {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 50px;
margin-bottom: 16px;
}
}
&:hover, .el-upload--picture-card:hover, .el-upload:focus {
color: #1969F9 !important;
border-color: #1969F9 !important;
}
.role-auth {
background: #FFFFFF;
margin-bottom: 10px;
ul {
li {
padding: 0 10px;
border-right: 1px dashed #DCDFE6;
margin-bottom: 10px;
&:last-child {
border-right: none;
}
}
}
}
.imspre {
width: 100px;
height: 100px;
object-fit: cover;
border-radius: 50px;
margin-bottom: 16px;
}
}
}
}
\ No newline at end of file
......@@ -50,4 +50,16 @@
border-radius: 50px;
margin-bottom: 16px;
}
.messagexk .role-auth {
background: #FFFFFF;
margin-bottom: 10px;
}
.messagexk .role-auth ul li {
padding: 0 10px;
border-right: 1px dashed #DCDFE6;
margin-bottom: 10px;
}
.messagexk .role-auth ul li:last-child {
border-right: none;
}
/*# sourceMappingURL=message.min.css.map */
\ No newline at end of file
{"version":3,"sources":["message.less"],"names":[],"mappings":"AAAA,UAEE;EACE,gBAAA;EACA,aAAA;EACA,QAAQ,mBAAR;;AALJ,UAEE,aAKE;EACE,eAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;;AAEA,UAXJ,aAKE,IAMG;EACC,SAAS,EAAT;EACA,UAAA;EACA,YAAA;EACA,mBAAA;EACA,kBAAA;EACA,WAAA;EACA,MAAA;;AApBR,UAEE,aAuBE;EACE,kBAAA;;AA1BN,UAEE,aAuBE,QAGE;EACE,WAAA;EACA,YAAA;EACA,kBAAA;EACA,yBAAA;EACA,gBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;;AApCR,UAEE,aAuBE,QAGE,iBAUE;EACE,eAAA;EACA,kBAAA;EACA,SAAA;EACA,iBAAA;;AAGF,UA3CN,aAuBE,QAGE,iBAiBG;AA7CT,UAEE,aAuBE,QAGE,iBAiBW,yBAAwB;AA7CzC,UAEE,aAuBE,QAGE,iBAiB2C,WAAU;EACjD,cAAA;EACA,qBAAA;;AA/CV,UAEE,aAuBE,QA0BE;EACE,YAAA;EACA,aAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA","file":"message.min.css"}
\ No newline at end of file
{"version":3,"sources":["message.less"],"names":[],"mappings":"AAAA,UAEI;EACI,gBAAA;EACA,aAAA;EACA,QAAQ,mBAAR;;AALR,UAEI,aAKI;EACI,eAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;;AAEA,UAXR,aAKI,IAMK;EACG,SAAS,EAAT;EACA,UAAA;EACA,YAAA;EACA,mBAAA;EACA,kBAAA;EACA,WAAA;EACA,MAAA;;AApBhB,UAEI,aAuBI;EACI,kBAAA;;AA1BZ,UAEI,aAuBI,QAGI;EACI,WAAA;EACA,YAAA;EACA,kBAAA;EACA,yBAAA;EACA,gBAAA;EACA,iBAAA;EACA,eAAA;EACA,cAAA;;AApChB,UAEI,aAuBI,QAGI,iBAUI;EACI,eAAA;EACA,kBAAA;EACA,SAAA;EACA,iBAAA;;AAGJ,UA3CZ,aAuBI,QAGI,iBAiBK;AA7CjB,UAEI,aAuBI,QAGI,iBAiBa,yBAAwB;AA7CjD,UAEI,aAuBI,QAGI,iBAiB6C,WAAU;EAC/C,cAAA;EACA,qBAAA;;AA/CpB,UAEI,aAuBI,QA0BI;EACI,YAAA;EACA,aAAA;EACA,iBAAA;EACA,mBAAA;EACA,mBAAA;;AAxDhB,UA6DI;EACI,mBAAA;EACA,mBAAA;;AA/DR,UA6DI,WAGI,GACI;EACI,eAAA;EACA,gCAAA;EACA,mBAAA;;AAEA,UATZ,WAGI,GACI,GAKK;EACG,kBAAA","file":"message.min.css"}
\ No newline at end of file
.subAccount {
.role-auth {
ul {
li {
padding: 0 10px;
border-right: 1px dashed #DCDFE6;
margin-bottom: 10px;
&:last-child {
border-right: none;
}
}
}
}
.el-checkbox-group-box {
margin-left: 27px;
margin-top: 5px;
.el-checkbox-group {
.el-checkbox {
display: block;
}
}
}
.tip {
padding: 8px 16px;
background-color: #ecf8ff;
border-radius: 4px;
border-left: 5px solid #50bfff;
margin-bottom: 10px;
}
}
\ No newline at end of file
.subAccount .role-auth ul li {
padding: 0 10px;
border-right: 1px dashed #DCDFE6;
margin-bottom: 10px;
}
.subAccount .role-auth ul li:last-child {
border-right: none;
}
.subAccount .el-checkbox-group-box {
margin-left: 27px;
margin-top: 5px;
}
.subAccount .el-checkbox-group-box .el-checkbox-group .el-checkbox {
display: block;
}
.subAccount .tip {
padding: 8px 16px;
background-color: #ecf8ff;
border-radius: 4px;
border-left: 5px solid #50bfff;
margin-bottom: 10px;
}
/*# sourceMappingURL=subAccount.min.css.map */
\ No newline at end of file
{"version":3,"sources":["subAccount.less"],"names":[],"mappings":"AAAA,WACI,WACI,GACI;EACI,eAAA;EACA,gCAAA;EACA,mBAAA;;AAEA,WAPZ,WACI,GACI,GAKK;EACG,kBAAA;;AATpB,WAeI;EACI,iBAAA;EACA,eAAA;;AAjBR,WAeI,uBAII,mBACI;EACI,cAAA;;AArBhB,WA0BI;EACI,iBAAA;EACA,yBAAA;EACA,kBAAA;EACA,8BAAA;EACA,mBAAA","file":"subAccount.min.css"}
\ No newline at end of file
......@@ -49,84 +49,26 @@
<span class="icon iconfont fr" @click="zk"></span>
</div>
<!--菜单栏-->
<el-menu class="el-menu-vertical-demo" @open="handleOpen" active-text-color="#1969F9" router :default-active="$route.path" :router="true" :unique-opened="true" @close="handleClose" @select="handleSelect">
<el-menu-item :index="'/'" :class="{'indextab':isIndexTab}">
<template slot="title">
<span class="icon iconfont iconsy"></span>
<span>概况</span>
</template>
</el-menu-item>
<el-submenu index="2">
<template slot="title">
<span class="icon iconfont iconbj"></span>
<span slot="title">询报价管理</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/inquire'">询价管理</el-menu-item>
<el-menu-item :index="'/quote'">报价管理</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="3">
<template slot="title">
<span class="icon iconfont iconzhibiaozhuizong"></span>
<span slot="title">订单追踪</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/orderTrackGoods'">已采购订单</el-menu-item>
<el-menu-item :index="'/orderTrackInvoice'">发货单</el-menu-item>
<el-menu-item :index="'/returnGoods'">退货单</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="4">
<template slot="title">
<span class="icon iconfont iconstore"></span>
<span slot="title">库存管理</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/list'">现货库存</el-menu-item>
<el-menu-item :index="'/enter'">库存导入</el-menu-item>
<el-menu-item :index="'/goodslist'">优势物料</el-menu-item>
<el-menu-item :index="'/listDetail'" style="display:none">导入详情</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="5">
<template slot="title">
<span class="icon iconfont icongoods"></span>
<span slot="title">商品管理</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/goods'">商品列表</el-menu-item>
<el-menu-item :index="'/brand'">品牌列表</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="6">
<template slot="title">
<span class="icon iconfont iconshujutongji"></span>
<span slot="title">数据统计</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/inquireTransform'">询价转化统计</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="7">
<template slot="title">
<span class="icon iconfont iconxiaoxiguanli1"></span>
<span slot="title">消息管理</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/news'">消息列表</el-menu-item>
<el-menu-item :index="'/notice'">系统公告</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-submenu index="8">
<template slot="title">
<span class="icon iconfont iconuser"></span>
<span slot="title">用户中心</span>
</template>
<el-menu-item-group>
<el-menu-item :index="'/message'">基本信息</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-menu class="el-menu-vertical-demo" active-text-color="#1969F9" router :default-active="$route.path" :router="true" :unique-opened="true" @open="handleOpen" @close="handleClose" @select="handleSelect">
<template v-if="Object.keys(index_home).length !== 0">
<el-menu-item :index="'/'" :class="{'indextab':isIndexTab}">
<template slot="title">
<span class="icon iconfont iconsy"></span>
<span>概况</span>
</template>
</el-menu-item>
</template>
<template v-if="menuData.length > 0">
<el-submenu :index="(index+2).toString()" v-for="(item,index) in menuData" :key="index">
<template slot="title">
<span :class="['icon', 'iconfont', item.iconfont]"></span>
<span slot="title">{{ item.name }}</span>
</template>
<el-menu-item-group>
<el-menu-item :index="v.path" v-for="(v,i) in item.children" :key="i">{{ v.name }}</el-menu-item>
</el-menu-item-group>
</el-submenu>
</template>
</el-menu>
</div>
</div>
......@@ -135,30 +77,16 @@
<div class="zankai">
<span class="icon iconfont fr" @click="zk"></span>
</div>
<div class="item" :class="{'act':tabSure==1}">
<span class="icon iconfont iconsy"></span>
</div>
<div class="item" :class="{'act':tabSure==2}">
<span class="icon iconfont iconbj"></span>
</div>
<div class="item" :class="{'act':tabSure==3}">
<span class="icon iconfont iconzhibiaozhuizong"></span>
</div>
<div class="item" :class="{'act':tabSure==4}">
<span class="icon iconfont iconstore"></span>
</div>
<div class="item" :class="{'act':tabSure==5}">
<span class="icon iconfont icongoods"></span>
</div>
<div class="item" :class="{'act':tabSure==6}">
<span class="icon iconfont iconshujutongji"></span>
</div>
<div class="item" :class="{'act':tabSure==7}">
<span class="icon iconfont iconxiaoxiguanli1"></span>
</div>
<div class="item" :class="{'act':tabSure==8}">
<span class="icon iconfont iconuser"></span>
</div>
<template v-if="Object.keys(index_home).length !== 0">
<div class="item" :class="{'act':tabSure==1}">
<span class="icon iconfont iconsy"></span>
</div>
</template>
<template v-if="menuData.length > 0">
<div class="item" :class="{'act':tabSure==(index+1)}" v-for="(item,index) in menuData" :key="index">
<span :class="['icon', 'iconfont', item.iconfont]"></span>
</div>
</template>
</div>
<!--修改密码弹窗-->
<el-dialog title="修改密码" :visible.sync="dialogVisible" width="500px" class="demo-ruleForm">
......@@ -308,9 +236,9 @@ import Util from "../tool";
import axios from 'axios';
import {NODE_ENVS_MSG} from "../ajax";
import {Badge, Button, Checkbox, Dialog, Form, FormItem, Input, Menu, MenuItem, MenuItemGroup, Message, MessageBox, Notification, Pagination, Submenu, TabPane, Tabs, Tooltip} from 'element-ui'
Vue.prototype.$message = Message;
Vue.prototype.$notify = Notification;
Vue.use(Menu).use(MenuItem).use(MenuItemGroup).use(Submenu).use(Form).use(FormItem).use(Dialog).use(Button).use(Tooltip).use(Input).use(Tabs).use(TabPane).use(Badge).use(Pagination).use(Checkbox);
export default {
......@@ -353,6 +281,8 @@ export default {
total: 0,
limit: 10,
page: 1,
menuData: [],//菜单数据集合
index_home: {},//概况
color_arr: [{
name: '询价',
value: '#409EFF'
......@@ -413,7 +343,7 @@ export default {
var self = this
this.getData();//获取个人信息
this.tabUi();
this.getMenu();
this.getWelcome();
window.onresize = function () {
self.tabUi()
......@@ -424,6 +354,30 @@ export default {
},
methods: {
/**
* 获取当前用户的权限菜单
*/
getMenu() {
this.$http('GET', "/api/subAccount/getMenu", {}).then(res => {
if (res.code === 0) {
const overviewItem = res.data.data.find(item => item.name === "概况");
const menuData = res.data.data.filter(item => item.name !== "概况");
this.index_home = overviewItem;
const filteredData = menuData.filter(item => item.checked || (item.children && item.children.some(child => child.checked))).map(item => {
if (item.children && item.children.length > 0) {
item.children = item.children.filter(child => child.checked);
}
return item;
});
this.menuData = filteredData;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 欢迎
*/
getWelcome() {
......
......@@ -8,12 +8,19 @@ import axios from 'axios'
import {hideLoading, showLoading} from './ajax/loading';
import Util from "./tool";
import { Message} from 'element-ui'
import {Alert, Message, MessageBox} from 'element-ui'
//加载全局样式
import '@/assets/css/public/common.min.css'
import '@/assets/css/font/iconfont.css'
Vue.use(Alert);
const msgbox = MessageBox
const {alert, confirm} = msgbox
Vue.prototype.$msgbox = msgbox
Vue.prototype.$alert = alert
Vue.prototype.$confirm = confirm
Vue.prototype.$message = Message
......
......@@ -25,6 +25,9 @@ const ReturnGoods = resolve => require(['@/views/OrderTrack/returnGoods.vue'], r
const OrderTrackPurAdd = resolve => require(['@/views/OrderTrack/purAdd.vue'], resolve);
const News = resolve => require(['@/views/News/index.vue'], resolve);
const Notice = resolve => require(['@/views/News/notice.vue'], resolve);
const SubAccount = resolve => require(['@/views/Info/subAccount.vue'], resolve);
const SubAccountAdd = resolve => require(['@/views/Info/subAccountAdd.vue'], resolve);
const SubAccountEdit = resolve => require(['@/views/Info/subAccountEdit.vue'], resolve);
const InquireTransform = resolve => require(['@/views/InquireTransform/index.vue'], resolve);
......@@ -207,6 +210,30 @@ const routes = [
component: Notice
},
{
path: '/subAccount',
name: 'subAccount',
meta: {
title: '子账号管理'
},
component: SubAccount
},
{
path: '/subAccountadd',
name: 'subAccountadd',
meta: {
title: '创建子账号'
},
component: SubAccountAdd
},
{
path: '/subAccountEdit',
name: 'subAccountEdit',
meta: {
title: '编辑子账号'
},
component: SubAccountEdit
},
{
path: '/inquireTransform',
name: 'inquireTransform',
meta: {
......
......@@ -4,7 +4,7 @@
<div class="tip">基本信息</div>
<div class="row verCenter">
<div class="up-box">
<img :src="userinfo.avatar" class="imspre"/>
<img :src="userinfo.avatar || 'https://www.ichunt.com/v3/dist/res/home/images/headimg/boy1.png'" class="imspre"/>
<el-upload class="avatar-uploader" :data="fileData" :action="upUrl" :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
<span class="icon iconfont fl"></span>
<div class="fl">更换头像</div>
......@@ -28,34 +28,43 @@
<div class="tip" style="margin-top: 20px">猎芯联系渠道</div>
<el-form :inline="true" :model="userinfo" label-width="124px">
<el-form-item label="猎芯专属采购经理">
<el-input v-model="userinfo.sku_user_info.name" placeholder="" :readonly="true"></el-input>
<el-input v-model="userinfo.sku_user_info.name" placeholder="" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="userinfo.sku_user_info.mobile" :readonly="true"></el-input>
<el-input v-model="userinfo.sku_user_info.mobile" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="userinfo.sku_user_info.email" :readonly="true"></el-input>
<el-input v-model="userinfo.sku_user_info.email" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
<br>
<el-form-item label="猎芯渠道经理">
<el-input v-model="userinfo.channel_user_info.name" :readonly="true"></el-input>
<el-input v-model="userinfo.channel_user_info.name" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="userinfo.channel_user_info.mobile" :readonly="true"></el-input>
<el-input v-model="userinfo.channel_user_info.mobile" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="userinfo.channel_user_info.email" :readonly="true"></el-input>
<el-input v-model="userinfo.channel_user_info.email" :readonly="true" disabled v-if="userinfo.sku_user_info"></el-input>
</el-form-item>
</el-form>
<div class="tip" style="margin-top: 20px">意见反馈渠道</div>
<div class="tip">意见反馈渠道</div>
<el-form :inline="true" :model="userinfo" label-width="124px">
<el-form-item label="运营总监">
<el-input value="Sophie(符静女士)" placeholder=""></el-input>
<el-input value="Sophie(符静女士)" placeholder="" disabled></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-input value="sophie@ichunt.com"></el-input>
<el-input value="sophie@ichunt.com" disabled></el-input>
</el-form-item>
</el-form>
<div class="tip">消息推送配置</div>
<!--子账号消息推送配置-->
<section class="role-auth">
<ul class="row">
<li v-for="(item,index) in messageMenu" :key="item.id">
<el-tree :data="item" show-checkbox :props="defaultProps" :default-checked-keys="filteredMessageIds" default-expand-all node-key="id" @check-change="handleCheckMsgChange"></el-tree>
</li>
</ul>
</section>
<el-row>
<el-button type="primary" @click="submituser">编辑</el-button>
</el-row>
......@@ -68,48 +77,97 @@ import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {NODE_ENVS} from "../../ajax";
import Tool from '../../tool'
import {Form, FormItem, Input, Message, Row, Upload} from 'element-ui'
import {Form, FormItem, Input, Message, Row, Tree, Upload} from 'element-ui'
Vue.prototype.$message = Message;
Vue.use(Form).use(FormItem).use(Input).use(Upload).use(Row);
Vue.use(Form).use(FormItem).use(Input).use(Upload).use(Row).use(Tree);
export default {
name: "message",
data() {
return {
defaultProps: {
children: 'children',
label: 'name'
},
filteredMessageIds: [],
upUrl: NODE_ENVS + '/api/user/setavatar',
fileData: {token: Tool.getCookie('token')},
userinfo: {
company_name: '',
contacts_name: '',
mobile: '',
email: '',
avatar: 'https://www.ichunt.com/v3/dist/res/home/images/headimg/boy1.png'
}
messageMenu: [],//消息权限菜单
user_message_rule: [],
userinfo: {}
};
},
created() {
this.getUseInfo()
this.getUseInfo();
this.getMessageMenu();
},
computed: {},
methods: {
/**
* 获取当前用户的消息权限菜单
*/
getMessageMenu() {
this.$http('GET', "/api/subAccount/getMessageMenu", {}).then(res => {
if (res.code === 0) {
let newMenuData = res.data.data.map(item => [item]);
this.messageMenu = newMenuData;
const filteredIds = [];
res.data.data.forEach(item => {
if (item.children) {
const childrenWithChecked = item.children.filter(child => child.checked);
const ids = childrenWithChecked.map(child => child.id);
filteredIds.push(...ids);
} else {
if (item.checked) {
filteredIds.push(item.id);
}
}
});
this.filteredMessageIds = filteredIds;
//筛选出rule-message
const result = [];
for (let obj of res.data.data) {
if (obj.checked) {
result.push(obj.name);
}
if (obj.children) {
for (let child of obj.children) {
if (child.checked) {
result.push(child.name);
}
}
}
}
this.user_message_rule = result;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
getUseInfo() {
if (window.userInfo) {
this.userinfo = window.userInfo;
} else {
this.$http('get', "/api/user/getuserinfo").then(res => {
this.$http('GET', "/api/user/getuserinfo").then(res => {
if (res.code === 0) {
this.userinfo = res.data;
window.userInfo = res.data
})
}
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
submituser() {
this.$http('post', "/api/user/setuserinfo", {
email: this.userinfo.email,
contacts_name: this.userinfo.contacts_name
contacts_name: this.userinfo.contacts_name,
user_message_rule: JSON.stringify(this.user_message_rule)
}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
message: '更新成功',
type: 'success'
});
sessionStorage.removeItem('userInfox')
......@@ -152,6 +210,28 @@ export default {
});
}
return isJPG && isLt2M;
},
/**
* 筛选子账号勾选的消息推送配置
* @param data
* @param checked
*/
handleCheckMsgChange(data, checked) {
if (checked) {
if (!this.user_message_rule.includes(data.name)) {
this.user_message_rule.push(data.name);
}
} else {
const index = this.user_message_rule.indexOf(data.name);
if (index !== -1) {
this.user_message_rule.splice(index, 1);
}
if (data.children) {
if (!this.user_message_rule.includes(data.name)) {
this.user_message_rule.push(data.name);
}
}
}
}
},
components: {
......
<template>
<section class="subAccount pagex">
<div class="subAccount-con">
<!--搜索区-->
<el-form :inline="true" :model="formParam" class="demo-form-inline" ref="formParam" label-width="80px">
<el-form-item label="子账号" prop="mobile">
<el-input v-model="formParam.mobile" placeholder="请输入子账号" @keyup.enter.native="submit" clearable maxlength="30"></el-input>
</el-form-item>
<el-form-item label="联系人" prop="name">
<el-input v-model="formParam.name" placeholder="请输入联系人" @keyup.enter.native="submit" clearable max="30"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="formParam.status" placeholder="请选择" clearable>
<el-option label="全部" value=""></el-option>
<el-option label="启动" value="1"></el-option>
<el-option label="禁用" value="2"></el-option>
<el-option label="删除" value="0"></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建渠道" prop="create_type">
<el-select v-model="formParam.create_type" placeholder="请选择" clearable>
<el-option label="全部" value=""></el-option>
<el-option label="芯链系统" value="1"></el-option>
<el-option label="猎芯后台" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker :unlink-panels=true style="width:193px" prefix-icon="prefix-icon-time-style" v-model="create_time_val" value-format="yyyy-MM-dd" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item label="更新时间">
<el-date-picker :unlink-panels=true style="width:193px" prefix-icon="prefix-icon-time-style" v-model="update_time_val" value-format="yyyy-MM-dd" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">搜索</el-button>
<el-button @click="resetForm('formParam')">重置</el-button>
</el-form-item>
</el-form>
<!--操作区-->
<div class="operation-area row verCenter bothSide">
<div class="operation-button row verCenter">
<el-button type="primary" @click="$router.push('/subAccountadd')">创建子账号</el-button>
</div>
</div>
<!--列表区-->
<div class="data-box">
<el-table key="listTable" :data="tableData" border max-height="600" highlight-current-row>
<el-table-column prop="mobile" label="子账号" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="name" label="联系人" align="center"></el-table-column>
<el-table-column prop="status_cn" label="状态" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_type_cn" label="创建渠道" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time_cn" label="创建时间" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="update_time_cn" label="修改时间" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column label="操作" width="250" align="center">
<template slot-scope="scope">
<el-button size="mini" @click="goToSubAccountEdit(scope.row.sbat_id,scope.row.ynat_id)">编辑</el-button>
<template v-if="scope.row.status == 1">
<el-button size="mini" type="warning" @click="confirmEnable(scope.row,2)">禁用</el-button>
</template>
<template v-else>
<el-button size="mini" type="success" @click="confirmEnable(scope.row,1)">启用</el-button>
</template>
<el-button size="mini" type="danger" @click="confirmDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div>
</div>
<Menu/>
</section>
</template>
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Option, Pagination, Popover, Radio, RadioButton, RadioGroup, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
Vue.use(Button).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Autocomplete).use(Radio).use(RadioGroup).use(RadioButton);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Popover).use(Tag).use(Tooltip);
export default {
name: "subAccount",
data() {
return {
total: 0,
limit: 10,
page: 1,
tableData: [],
create_time_val: '',
update_time_val: '',
formParam: {
mobile: '',
name: '',
status: '',
create_type: '',
create_time: '',
update_time: ''
}
};
},
created() {
this.getData();
},
methods: {
getData() {
//格式化时间
if (this.create_time_val) {
this.formParam.create_time = this.create_time_val[0] + '~' + this.create_time_val[1];
} else {
this.formParam.update_time = '';
}
if (this.update_time_val) {
this.formParam.update_time = this.update_time_val[0] + '~' + this.update_time_val[1];
} else {
this.formParam.update_time = '';
}
var params = Object.assign({}, {page: this.page, limit: this.limit}, this.formParam);
this.$http('GET', "/api/subAccount/list", params).then(res => {
if (res.code === 0) {
this.tableData = res.data.list || [];
this.total = res.data.total;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 1启用,2禁用
* @param row
*/
confirmEnable(row, type) {
if (type == 1) {
var html = `确定<span style="color: #00BFBF">启用</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:启用后,该子账号可登录芯链系统,操作对应权限页面</p>`;
} else {
var html = `确定<span style="color: #E6A23C">禁用</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:禁用后,该子账号无法再登录芯链系统</p>`;
}
this.$confirm(html, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: type,
dangerouslyUseHTMLString: true
}).then(() => {
this.$http('POST', "/api/subAccount/changeStatus", {sbat_id: row.sbat_id, status: type}).then(res => {
if (res.code === 0) {
this.getData();
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
}).catch(() => {
});
},
/**
* 删除
*/
confirmDelete(row) {
var html = `确定<span style="color: red;">删除</span>当前子账号吗?<p style="font-size: 13px;color: #999;">PS:删除后,该子账号从系统清除,无法再登录芯链系统!</p>`;
this.$confirm(html, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
dangerouslyUseHTMLString: true
}).then(() => {
this.$http('POST', "/api/subAccount/changeStatus", {sbat_id: row.sbat_id, status: 0}).then(res => {
if (res.code === 0) {
this.getData();
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
}).catch(() => {
});
},
goToSubAccountEdit(sbat_id, ynat_id) {
this.$router.push(`/subAccountEdit?sbat_id=${sbat_id}&ynat_id=${ynat_id}`);
},
/**
* 分页条数切换
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getData();
},
/**
* 分页点击切换
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getData();
},
/**
* 重置
* @param formName
*/
resetForm(formName) {
this.create_time_val = '';
this.deadline_time_val = '';
this.$refs[formName].resetFields();
},
/**
* 搜索提交
*/
onSubmit() {
this.page = 1;
this.getData();
}
},
components: {
Menu
}
};
</script>
<style scoped>
@import "../../assets/css/info/subAccount.min.css";
</style>
\ No newline at end of file
<template>
<section class="subAccount pagex">
<el-form :inline="true" :model="formParam" :rules="rules" ref="ruleForm" label-width="90px">
<div class="tip row verCenter">
<span>子账号信息</span>
</div>
<el-form-item label="账号" prop="mobile">
<el-input v-model="formParam.mobile" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password_raw">
<el-input placeholder="请输入登录密码" v-model="formParam.password_raw" show-password></el-input>
</el-form-item>
<el-form-item label="联系人" prop="name">
<el-input v-model="formParam.name" placeholder="请输入联系人" maxlength="10"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="formParam.email" placeholder="请输入邮箱"></el-input>
</el-form-item>
<div class="tip row">
<span>子账号权限配置</span>
<div class="text-tip row verCenter">
<i class="el-icon-warning"></i>
<span>勾选以下页面后,子账号可以看到对应的页面内容并进行操作;没有勾选的页面,子账号则无权查看</span>
</div>
</div>
<!--子账号权限配置-->
<section class="role-auth">
<ul class="row">
<li v-for="(item,index) in menuData" :key="item.id">
<el-tree ref="tree" :data="item" show-checkbox node-key="id" :props="defaultProps" default-expand-all @check-change="handleCheckChange"></el-tree>
</li>
</ul>
</section>
<div class="tip">子账号消息推送配置</div>
<!--子账号消息推送配置-->
<section class="role-auth">
<ul class="row">
<li v-for="(item,index) in messageMenu" :key="item.id">
<el-tree ref="treeMsg" :data="item" show-checkbox node-key="id" :props="defaultProps" default-expand-all @check-change="handleCheckMsgChange"></el-tree>
</li>
</ul>
</section>
<el-row>
<el-button @click="canel()">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">确 定</el-button>
</el-row>
</el-form>
<Menu/>
</section>
</template>
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, Checkbox, CheckboxButton, CheckboxGroup, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Message, Option, Pagination, Popover, Radio, RadioButton, RadioGroup, Row, Select, Table, TableColumn, Tag, Tooltip, Tree} from 'element-ui'
Vue.prototype.$message = Message;
Vue.use(Button).use(Form).use(Select).use(Tree).use(Option).use(Input).use(FormItem).use(Dialog).use(Autocomplete).use(Radio).use(RadioGroup).use(RadioButton).use(Checkbox).use(CheckboxButton).use(CheckboxGroup);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Popover).use(Tag).use(Tooltip).use(Row);
export default {
name: "subAccountAdd",
data() {
return {
defaultProps: {
children: 'children',
label: 'name'
},
rules: {
mobile: [
{required: true, message: '请输入手机号', trigger: 'blur'},
{pattern: /^1\d{10}$/, message: '请输入有效的手机号', trigger: 'blur'}
],
name: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}],
password_raw: [{
required: true,
message: '请输入密码',
trigger: 'blur'
}],
email: [
{required: true, message: '请输入邮箱', trigger: 'blur'},
{type: 'email', message: '请输入有效的邮箱地址', trigger: ['blur', 'change']}
]
},
menuData: [],//权限菜单
messageMenu: [],//消息权限菜单
formParam: {
mobile: '',
name: '',
password_raw: '123456',
email: '',
user_rule: [],
user_message_rule: []
}
};
},
created() {
this.getMenu();
this.getMessageMenu();
},
methods: {
/**
* 全选 反选
*/
checkAll(type) {
if (type == 1) {
var data = this.$refs.tree;
if (data.length > 0) {
if (this.checked) {
data.forEach((element, index) => {
if (this.menuData[index][0].name != '概况') {
data[index].setCheckedKeys([this.menuData[index][0].id]);
}
});
} else {
data.forEach((element, index) => {
data[index].setCheckedKeys([]);
});
}
}
} else {
var data = this.$refs.treeMsg;
if (data.length > 0) {
if (this.checked_msg) {
data.forEach((element, index) => {
data[index].setCheckedKeys([this.messageMenu[index][0].id]);
});
} else {
data.forEach((element, index) => {
data[index].setCheckedKeys([]);
});
}
}
}
},
/**
* 取消
*/
canel() {
this.closetab('/subAccountadd')
},
/**
* 关闭当前页面
* @param path
*/
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({
path: "/"
})
} else {
if (tab_arr[i - 1].query) {
this.$router.push({
path: tab_arr[i - 1].path,
query: tab_arr[i - 1].query
})
} else {
this.$router.push({
path: tab_arr[i - 1].path,
})
}
}
}
break;
}
}
this.$router.push('/subAccount');
},
/**
* 获取当前用户的权限菜单
*/
getMenu() {
this.$http('GET', "/api/subAccount/getMenu", {method: 'add'}).then(res => {
if (res.code === 0) {
let newMenuData = res.data.data.map(item => [item]);
this.menuData = newMenuData;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 获取当前用户的消息权限菜单
*/
getMessageMenu() {
this.$http('GET', "/api/subAccount/getMessageMenu", {}).then(res => {
if (res.code === 0) {
let newMenuData = res.data.data.map(item => [item]);
this.messageMenu = newMenuData;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 筛选子账号勾选的权限配置
* @param data
* @param checked
*/
handleCheckChange(data, checked) {
if (checked) {
if (!this.formParam.user_rule.includes(data.name)) {
this.formParam.user_rule.push(data.name);
}
} else {
const index = this.formParam.user_rule.indexOf(data.name);
if (index !== -1) {
this.formParam.user_rule.splice(index, 1);
}
if (data.children) {
if (!this.formParam.user_rule.includes(data.name)) {
this.formParam.user_rule.push(data.name);
}
}
}
},
/**
* 筛选子账号勾选的消息推送配置
* @param data
* @param checked
*/
handleCheckMsgChange(data, checked) {
if (checked) {
if (!this.formParam.user_message_rule.includes(data.name)) {
this.formParam.user_message_rule.push(data.name);
}
} else {
const index = this.formParam.user_message_rule.indexOf(data.name);
if (index !== -1) {
this.formParam.user_message_rule.splice(index, 1);
}
if (data.children) {
if (!this.formParam.user_message_rule.includes(data.name)) {
this.formParam.user_message_rule.push(data.name);
}
}
}
},
/**
* 表单提交
* @param formName
*/
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.formParam.user_rule = JSON.stringify(this.formParam.user_rule);
this.formParam.user_message_rule = JSON.stringify(this.formParam.user_message_rule);
this.$http('POST', "/api/subAccount/create", this.formParam).then(res => {
if (res.code === 0) {
this.$message({
message: '创建成功',
type: 'success'
});
setTimeout(() => {
this.closetab('/subAccountadd')
}, 2000)
} else {
this.formParam.user_rule = JSON.parse(this.formParam.user_rule);
this.formParam.user_message_rule = JSON.parse(this.formParam.user_message_rule);
this.$message({
message: res.msg,
type: 'error',
onClose: () => {
}
});
}
})
} else {
return false;
}
});
}
}
,
components: {
Menu
}
}
;
</script>
<style scoped>
@import "../../assets/css/info/subAccount.min.css";
</style>
\ No newline at end of file
......@@ -154,14 +154,14 @@ export default {
},
created() {
this.purchase_id = this.$route.query.purchase_id || '';
this.stock_in_sn = this.$route.query.stock_in_sn || '';
this.formInline.stock_in_sn = this.$route.query.stock_in_sn || '';
this.getData();
},
watch: {
$route(to, from) {
if (to.path == '/orderTrackInvoice') {
this.purchase_id = this.$route.query.purchase_id || '';
this.stock_in_sn = this.$route.query.stock_in_sn || '';
this.formInline.stock_in_sn = this.$route.query.stock_in_sn || '';
this.getData();
}
}
......@@ -179,7 +179,7 @@ export default {
} else {
this.formInline.qc_time = '';
}
var params = Object.assign({}, {page: this.page}, {limit: this.limit}, this.formInline, {purchase_id: this.purchase_id}, {stock_in_sn: this.stock_in_sn});
var params = Object.assign({}, {page: this.page}, {limit: this.limit}, this.formInline, {purchase_id: this.purchase_id});
this.$http('post', "/api/purchase/getDeliveryList", params).then(res => {
if (res.code === 0) {
this.tableData = res.data.list || [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment