星油云站
This commit is contained in:
160
packageStaff/pages/staff/List/List.vue
Normal file
160
packageStaff/pages/staff/List/List.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">员工管理</block>
|
||||
</cu-custom>
|
||||
<view class="cu-bar search">
|
||||
<view class="search-form radius bg-white">
|
||||
<text class="cuIcon-search"></text>
|
||||
<input class="" v-model="value" @confirm="onSearch" @focus="InputFocus" @blur="InputBlur" :adjust-position="false"
|
||||
type="text" placeholder="搜索员工姓名或手机号" confirm-type="search"></input>
|
||||
</view>
|
||||
<view class="action">
|
||||
<button class="cu-btn bg-white shadow-blur" @tap="toAddUser">添加员工</button>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<staff-item class="cu-list menu-avatar" v-for="item in staffList" :key="item.cUserId" :staff="item" :admin="item.isAdmin==1" />
|
||||
</view>
|
||||
<view v-if="staffList.length<1">
|
||||
<Empty />
|
||||
</view>
|
||||
<view v-show="isLoadMore">
|
||||
<uni-load-more :status="loadStatus"></uni-load-more>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
|
||||
import staffApi from '@/packageStaff/api/staff.js'
|
||||
import StaffItem from '@/packageStaff/components/staff-item.vue'
|
||||
import oliSiteApi from '@/api/oli-site.js'
|
||||
export default {
|
||||
components: {
|
||||
StaffItem,
|
||||
UniLoadMore
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchCondition: '',
|
||||
staff: {
|
||||
data: 'lalall'
|
||||
},
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
oilSite: uni.getStorageSync('oilSite'),
|
||||
staffList: [],
|
||||
value: '',
|
||||
isLoadMore: false,
|
||||
loadStatus: 'loading',
|
||||
channelId:uni.getStorageSync('channelId')
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.staffList = []
|
||||
this.currentPage = 1
|
||||
this.getList()
|
||||
},
|
||||
// onPullDownRefresh() {
|
||||
// this.staffList = []
|
||||
// this.currentPage = 1
|
||||
// this.getList()
|
||||
// },
|
||||
// onReachBottom() {
|
||||
// if (!this.isLoadMore) {
|
||||
// this.getList()
|
||||
// }
|
||||
// },
|
||||
methods: {
|
||||
toAddUser() {
|
||||
uni.setStorageSync('tempUid', {
|
||||
id: '',
|
||||
type: 'add'
|
||||
})
|
||||
uni.navigateTo({
|
||||
url: '/packageStaff/pages/staff/editStaff/addUser'
|
||||
})
|
||||
},
|
||||
InputBlur() {
|
||||
console.log(this.searchCondition)
|
||||
},
|
||||
InputFocus() {
|
||||
console.log(this.searchCondition)
|
||||
// uni.getClipboardData({
|
||||
// success: (res)=> {
|
||||
// console.log(res.data)
|
||||
// }
|
||||
// })
|
||||
},
|
||||
onSearch() {
|
||||
this.staffList = []
|
||||
this.currentPage = 1
|
||||
this.getList()
|
||||
},
|
||||
getList() {
|
||||
|
||||
// const data3 = {
|
||||
// pageSize: this.pageSize,
|
||||
// currentPage: this.currentPage,
|
||||
// sorted: { // 排序方式
|
||||
// createTime: 'desc'
|
||||
// },
|
||||
// params: {
|
||||
// netPoint: this.oilSite.oilSiteCode, // 油站编号
|
||||
// siteType: '1',
|
||||
// value: this.value
|
||||
// },
|
||||
// columns: {
|
||||
|
||||
// }
|
||||
// }
|
||||
const data = {
|
||||
searchStr: this.value,
|
||||
channelId: this.channelId
|
||||
}
|
||||
oliSiteApi.getAllStaffList(data).then((res)=>{
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.code === 20000) {
|
||||
this.staffList = this.staffList.concat(res.data)
|
||||
console.log(this.staffList)
|
||||
|
||||
if (res.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
this.isLoadMore = true
|
||||
this.loadStatus = 'nomore'
|
||||
} else {
|
||||
this.currentPage++
|
||||
this.isLoadMore = false
|
||||
}
|
||||
}
|
||||
console.log(this.isLoadMore, this.loadStatus, this.currentPage)
|
||||
})
|
||||
// staffApi.getByPage(data3).then(res => {
|
||||
// uni.stopPullDownRefresh();
|
||||
// if (res.code === 20000) {
|
||||
// this.staffList = this.staffList.concat(res.data.list)
|
||||
// if (res.data.list.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
|
||||
// this.isLoadMore = true
|
||||
// this.loadStatus = 'nomore'
|
||||
// } else {
|
||||
// this.currentPage++
|
||||
// this.isLoadMore = false
|
||||
// }
|
||||
// console.log(this.isLoadMore, this.loadStatus, this.currentPage)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-content {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.cu-bar .search-form {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
254
packageStaff/pages/staff/editStaff/addUser.vue
Normal file
254
packageStaff/pages/staff/editStaff/addUser.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">员工管理</block>
|
||||
</cu-custom>
|
||||
<view class="margin radius">
|
||||
<form>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">姓名</view>
|
||||
<input
|
||||
:maxlength="8"
|
||||
@input="getChinese"
|
||||
:value="userInfo.cUserName"
|
||||
@blur="showChinese"
|
||||
placeholder="请输入姓名"
|
||||
name="input"
|
||||
/>
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">手机号</view>
|
||||
<input
|
||||
type="number"
|
||||
:maxlength="11"
|
||||
v-model="userInfo.phone"
|
||||
placeholder="请输入手机号"
|
||||
name="input"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="cu-form-group text-right">
|
||||
<view class="title">权限设置</view>
|
||||
<view class>请选择以下权限</view>
|
||||
</view>
|
||||
<view class="padding bg-white">
|
||||
<checkbox-group @change="checkboxChange" class="flex flex-wrap justify-between">
|
||||
<view class="basis-sm margin-bottom-sm" v-for="(item,index) in checkbox" :key="index">
|
||||
<checkbox
|
||||
@tap="item.checked =! item.checked"
|
||||
class="round red"
|
||||
:class="item.checked?'checked':''"
|
||||
:checked="item.checked?true:false"
|
||||
:value="item.id"
|
||||
></checkbox>
|
||||
<text class="padding-left-xs">{{item.roleName}}</text>
|
||||
</view>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</form>
|
||||
<view class="padding-top">
|
||||
<view class="text-lg">添加说明</view>
|
||||
<view class="padding-top-sm text-sm text-grey">
|
||||
<view class="margin-bottom-xs">1、员工添加成功后,系统会向该员工发送一条短信,短信中包含了云站的识别码。</view>
|
||||
<view
|
||||
class="margin-bottom-xs"
|
||||
>2、用户在收到短信后,需要关注“星油云站公众号”,进入小程序,输入云站编码后,根据页面要求输入对应的手机号,姓名,身份证信息,与管理员添加的信息一致方可绑定成功。</view>
|
||||
<view class>3、绑定成功后无需再次登录操作。</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="margin-left margin-right padding-lg bottom-bg">
|
||||
<button class="bg-main-oil round" @tap="saveInfo">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import staffApi from '@/packageStaff/api/staff.js'
|
||||
import oliSiteApi from '@/api/oli-site.js'
|
||||
import oliUserApi from '@/api/oli-user.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
siteId:uni.getStorageSync('oilSiteId'),
|
||||
tempUid: uni.getStorageSync('tempUid'),
|
||||
checkbox: [],
|
||||
userInfo: {},
|
||||
mainURL: this.global.mainURL,
|
||||
authList: [],
|
||||
lastAuthList: [],
|
||||
menuList:'',
|
||||
oilItem:uni.getStorageSync('siteOli')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getAllMenu()
|
||||
if (this.tempUid.type === 'edit') {
|
||||
setTimeout(() => {
|
||||
this.getUserInfo()
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showChinese() {
|
||||
const reg = /[\u4e00-\u9fa5]/g
|
||||
var names = this.userInfo.cUserName.match(reg);
|
||||
this.userInfo.cUserName = names.join("")
|
||||
if (names) {
|
||||
this.$set(this.userInfo, 'cUserName', names.join(""))
|
||||
}
|
||||
},
|
||||
// 中文提取
|
||||
getChinese(e) {
|
||||
var value = e.target.value
|
||||
console.log('e-target-value', value)
|
||||
if (value !== null && value !== '') {
|
||||
const reg = /[\u4e00-\u9fa5]/g
|
||||
var names = value.match(reg);
|
||||
// console.log(names)
|
||||
// this.$set(this.userInfo, 'cUserName', names.join(""))
|
||||
if (names) {
|
||||
this.$set(this.userInfo, 'cUserName', names.join(""))
|
||||
}
|
||||
|
||||
console.log('v-model-name', this.userInfo.cUserName)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
calcMenuList() {
|
||||
this.checkbox.forEach(item => {
|
||||
console.log(item.checked)
|
||||
if (item.checked) {
|
||||
this.lastAuthList.push(item.value)
|
||||
}
|
||||
})
|
||||
console.log('计算出来的', this.lastAuthList)
|
||||
},
|
||||
checkboxChange(e) {
|
||||
console.log(e)
|
||||
var items = this.checkbox,
|
||||
values = e.detail.value;
|
||||
this.menuList = values
|
||||
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
||||
const item = items[i]
|
||||
if (values.includes(item.value)) {
|
||||
this.$set(item, 'checked', true)
|
||||
} else {
|
||||
this.$set(item, 'checked', false)
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUser(data4) {
|
||||
staffApi.updateUser(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 2500);
|
||||
}
|
||||
})
|
||||
},
|
||||
addUser(data4) {
|
||||
oliUserApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 2500);
|
||||
}
|
||||
})
|
||||
},
|
||||
saveInfo() {
|
||||
if (!this.userInfo.cUserName) {
|
||||
uni.showToast({
|
||||
title: '请输入员工姓名',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (!this.userInfo.phone) {
|
||||
uni.showToast({
|
||||
title: '请输入员工手机号',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
} else if (!/^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1})|(16[0-9]{1}))+\d{8})$/.test(this.userInfo.phone)) {
|
||||
uni.showToast({
|
||||
title: '手机号码不正确',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.calcMenuList()
|
||||
const data4 = {
|
||||
siteId:this.siteId,
|
||||
id: this.userInfo.cUserId,
|
||||
userName: this.userInfo.cUserName,
|
||||
phone: this.userInfo.phone,
|
||||
roleIds: this.menuList.toString(),
|
||||
pushState: 1,
|
||||
channelId:uni.getStorageSync('channelId'),
|
||||
pushProcedureState: 1
|
||||
}
|
||||
|
||||
this.addUser(data4)
|
||||
|
||||
},
|
||||
getAllMenu() {
|
||||
// 获取权限列表
|
||||
oliSiteApi.getRoleList().then( (res)=>{
|
||||
console.log(res)
|
||||
for(let i = 0 ; i <res.data.length ; i++){
|
||||
if (res.data[i].roleName != 'ROOT' ) {
|
||||
this.checkbox.push(res.data[i])
|
||||
}
|
||||
}
|
||||
} )
|
||||
// staffApi.getOilSiteAllMenu(this.tempUid.id).then(res => {
|
||||
// if (res.code === 20000) {
|
||||
// var auths = []
|
||||
// var temp = res.data
|
||||
// temp.forEach(item => {
|
||||
// auths.push({
|
||||
// value: item.menuId,
|
||||
// checked: false,
|
||||
// name: item.menuName
|
||||
// })
|
||||
// })
|
||||
// this.checkbox = auths
|
||||
// }
|
||||
// })
|
||||
|
||||
},
|
||||
getUserInfo() {
|
||||
staffApi.findUserAuthById(this.tempUid.id).then(res => {
|
||||
if (res.code === 20000) {
|
||||
this.userInfo = res.data
|
||||
this.authList = res.data.authList
|
||||
if (this.authList && this.authList.length > 0) {
|
||||
console.log('已有权限', this.authList)
|
||||
this.authList.forEach((auth, index) => {
|
||||
this.checkbox.forEach(item => {
|
||||
if (auth.menuId === item.value) {
|
||||
this.$set(item, 'checked', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
308
packageStaff/pages/staff/editStaff/editStaff.vue
Normal file
308
packageStaff/pages/staff/editStaff/editStaff.vue
Normal file
@@ -0,0 +1,308 @@
|
||||
<template>
|
||||
<view class="page-content my-bg">
|
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
|
||||
<block slot="backText">返回</block>
|
||||
<block slot="content">员工管理</block>
|
||||
</cu-custom>
|
||||
<view class="margin radius">
|
||||
<view class="bg-img margin-bottom user-info-container radius flex align-center" :style="'background-image: url('+mainURL+'login-bg.png)'">
|
||||
<view class="placeholder">
|
||||
<view class="cu-list no-border menu-avatar ">
|
||||
<view class="cu-item ">
|
||||
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
|
||||
<view class="content">
|
||||
<view class="text-white">{{userInfo.userName}}</view>
|
||||
<view class="text-white flex" @tap="callStaff(userInfo.phone)">
|
||||
<view class="text-cut text-df">
|
||||
<text class="cuIcon-phone text-white margin-right-xs"></text>
|
||||
<text>{{userInfo.phone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="user-info">
|
||||
<view class="cu-list no-border menu-avatar ">
|
||||
<view class="cu-item no-border">
|
||||
<view class="cu-avatar round lg" :style="'background-image: url('+mainURL+'default-avator.png)'"></view>
|
||||
<view class="content">
|
||||
<view class="text-white">{{userInfo.userName}}</view>
|
||||
<view class="text-white flex" @tap="callStaff(userInfo.phone)">
|
||||
<view class="text-cut text-df">
|
||||
<text class="cuIcon-phone text-white margin-right-xs"></text>
|
||||
<text>{{userInfo.phone}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<form class="margin-top-lg ">
|
||||
<view class="cu-form-group radius text-right">
|
||||
<view class="title">权限设置</view>
|
||||
<view class>请选择以下权限</view>
|
||||
</view>
|
||||
<view class=" padding bg-white ">
|
||||
<checkbox-group @change="checkboxChange" class="flex flex-wrap justify-between">
|
||||
<view class="basis-sm margin-bottom-sm" v-for="(item,index) in checkbox" :key="index">
|
||||
<checkbox @tap="item.checked=!item.checked" class="round red" :class="item.checked?'checked':''" :checked="item.checked? true:false"
|
||||
:value="item.value"></checkbox>
|
||||
<text class="padding-left-xs">{{item.name}}</text>
|
||||
</view>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</form>
|
||||
|
||||
</view>
|
||||
<view class="margin-left margin-right padding-lg bottom-bg">
|
||||
<button class="bg-main-oil round margin-bottom" @tap="saveInfo">保存</button>
|
||||
<button class="oil-main-btn-color text-white round" @tap="deleteUser">删除该员工</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import StaffItem from '@/packageStaff/components/staff-item.vue'
|
||||
import staffApi from '@/packageStaff/api/staff.js'
|
||||
import oliSiteApi from '@/api/oli-site.js'
|
||||
import oliUserApi from '@/api/oli-user.js'
|
||||
export default {
|
||||
components: {
|
||||
StaffItem,
|
||||
},
|
||||
onLoad(option) {
|
||||
// console.log(JSON.parse(option.staff))
|
||||
this.userInfo = JSON.parse(option.staff)
|
||||
console.log('这里是onload',this.userInfo )
|
||||
this.getAllMenu()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
itmeInfo:{},
|
||||
tempUid: uni.getStorageSync('tempUid'),
|
||||
checkbox: [],
|
||||
userInfo: {},
|
||||
mainURL: this.global.mainURL,
|
||||
authList: [],
|
||||
lastAuthList: [],
|
||||
channelId:uni.getStorageSync('channelId'),
|
||||
tempUser:uni.getStorageSync('tempUser')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.tempUid.type === 'edit') {
|
||||
setTimeout(() => {
|
||||
this.getUserInfo()
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
callStaff(phone) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phone
|
||||
})
|
||||
},
|
||||
calcMenuList() {
|
||||
this.checkbox.forEach(item => {
|
||||
// console.log(item.checked)
|
||||
if (item.checked) {
|
||||
this.lastAuthList.push(item.value)
|
||||
}
|
||||
})
|
||||
console.log('计算出来的', this.lastAuthList)
|
||||
},
|
||||
checkboxChange(e) {
|
||||
var items = this.checkbox,
|
||||
values = e.detail.value;
|
||||
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
||||
const item = items[i]
|
||||
if (values.includes(item.value)) {
|
||||
this.$set(item, 'checked', true)
|
||||
} else {
|
||||
this.$set(item, 'checked', false)
|
||||
}
|
||||
}
|
||||
},
|
||||
updateUser(data4) {
|
||||
console.log(data4)
|
||||
oliUserApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteUser() {
|
||||
console.log( this.tempUser.id)
|
||||
oliUserApi.removeStaff({
|
||||
id: this.tempUser.id,
|
||||
channelId:this.channelId
|
||||
}).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
},
|
||||
addUser(data4) {
|
||||
staffApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
duration: 3000
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500);
|
||||
}
|
||||
})
|
||||
},
|
||||
saveInfo() {
|
||||
if (!this.userInfo.userName) {
|
||||
uni.showToast({
|
||||
title: '请输入员工姓名',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
if (!this.userInfo.phone) {
|
||||
uni.showToast({
|
||||
title: '请输入员工手机号',
|
||||
icon: 'none'
|
||||
})
|
||||
return false
|
||||
}
|
||||
this.calcMenuList()
|
||||
const data4 = {
|
||||
id: this.userInfo.id,
|
||||
userName: this.userInfo.userName,
|
||||
phone: this.userInfo.phone,
|
||||
roleIds: this.lastAuthList.toString(),
|
||||
pushState: 1,
|
||||
pushProcedureState: 1
|
||||
}
|
||||
console.log('未进入判断')
|
||||
if (this.tempUid.type === 'add') {
|
||||
this.addUser(data4)
|
||||
console.log('这里是添加')
|
||||
} else if (this.tempUid.type === 'edit') {
|
||||
this.updateUser(data4)
|
||||
console.log('这里是更新')
|
||||
}
|
||||
},
|
||||
getAllMenu() {
|
||||
// staffApi.getOilSiteAllMenu(this.tempUid.id).then(res => {
|
||||
// if (res.code === 20000) {
|
||||
// var auths = []
|
||||
// var temp = res.data
|
||||
// temp.forEach(item => {
|
||||
// auths.push({
|
||||
// value: item.menuId,
|
||||
// checked: false,
|
||||
// name: item.menuName
|
||||
// })
|
||||
// })
|
||||
// this.checkbox = auths
|
||||
// }
|
||||
// })
|
||||
// console.log(this.userInfo.roleIds)
|
||||
// let roleList = this.userInfo.roleIds.split(',')
|
||||
// console.log(roleList)
|
||||
oliSiteApi.getRoleList().then( (res)=>{
|
||||
if (res.code === 20000) {
|
||||
let _that = this
|
||||
var auths = []
|
||||
var temp = res.data
|
||||
temp.forEach(item => {
|
||||
auths.push({
|
||||
value: item.id,
|
||||
checked: false,
|
||||
name: item.roleName
|
||||
})
|
||||
})
|
||||
_that.checkbox = auths
|
||||
_that.getUserInfo()
|
||||
console.log('这里是chekcbox',_that.checkbox)
|
||||
}
|
||||
})
|
||||
},
|
||||
getUserInfo() {
|
||||
console.log('这里是用户信息',this.userInfo)
|
||||
let userMenu = this.userInfo.roleIds.split(','),
|
||||
checkLisrt = this.checkbox
|
||||
userMenu.forEach(item=>{
|
||||
console.log(item)
|
||||
checkLisrt.forEach(items=>{
|
||||
if(item == items.value){
|
||||
this.$set(items, 'checked', true)
|
||||
}
|
||||
|
||||
// console.log('二级',items)
|
||||
})
|
||||
|
||||
})
|
||||
console.log( this.checkbox)
|
||||
// console.log(userMenu)
|
||||
// staffApi.findUserAuthById(this.tempUid.id).then(res => {
|
||||
// console.log('这里是获取信息',res.data)
|
||||
// if (res.code === 20000) {
|
||||
// this.userInfo = res.data
|
||||
// this.authList = res.data.authList
|
||||
// if (this.authList && this.authList.length > 0) {
|
||||
// console.log('已有权限', this.authList)
|
||||
// this.authList.forEach((auth, index) => {
|
||||
// this.checkbox.forEach(item => {
|
||||
// if (auth.menuId === item.value) {
|
||||
// this.$set(item, 'checked', true)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.placeholder {
|
||||
min-height: 160rpx;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.user-info-container {
|
||||
position: relative;
|
||||
min-width: 100%;
|
||||
color: #fff;
|
||||
|
||||
.cu-item {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
min-width: 100%;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.cu-list.menu-avatar>.cu-item::after {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user