星油云站更新
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<staff-item class="cu-list menu-avatar" v-for="item in staffList" :key="item.cUserId" :staff="item" :admin="item.cType==1" />
|
||||
<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 />
|
||||
@@ -30,9 +30,9 @@
|
||||
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
|
||||
},
|
||||
@@ -49,6 +49,7 @@
|
||||
value: '',
|
||||
isLoadMore: false,
|
||||
loadStatus: 'loading',
|
||||
channelId:uni.getStorageSync('channelId')
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
@@ -56,16 +57,16 @@
|
||||
this.currentPage = 1
|
||||
this.getList()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.staffList = []
|
||||
this.currentPage = 1
|
||||
this.getList()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (!this.isLoadMore) {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
// onPullDownRefresh() {
|
||||
// this.staffList = []
|
||||
// this.currentPage = 1
|
||||
// this.getList()
|
||||
// },
|
||||
// onReachBottom() {
|
||||
// if (!this.isLoadMore) {
|
||||
// this.getList()
|
||||
// }
|
||||
// },
|
||||
methods: {
|
||||
toAddUser() {
|
||||
uni.setStorageSync('tempUid', {
|
||||
@@ -93,35 +94,56 @@
|
||||
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 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
|
||||
}
|
||||
staffApi.getByPage(data3).then(res => {
|
||||
oliSiteApi.getAllStaffList(data).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
|
||||
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)
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@
|
||||
<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"
|
||||
@tap="item.checked =! item.checked"
|
||||
class="round red"
|
||||
:class="item.checked?'checked':''"
|
||||
:checked="item.checked?true:false"
|
||||
:value="item.value"
|
||||
:value="item.id"
|
||||
></checkbox>
|
||||
<text class="padding-left-xs">{{item.name}}</text>
|
||||
<text class="padding-left-xs">{{item.roleName}}</text>
|
||||
</view>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
@@ -66,15 +66,20 @@
|
||||
|
||||
<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: []
|
||||
lastAuthList: [],
|
||||
menuList:'',
|
||||
oilItem:uni.getStorageSync('siteOli')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -86,7 +91,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
showChinese() {
|
||||
const reg = /[\u4e00-\u9fa5]/g
|
||||
var names = this.userInfo.cUserName.match(reg);
|
||||
@@ -123,8 +127,10 @@ export default {
|
||||
console.log('计算出来的', this.lastAuthList)
|
||||
},
|
||||
checkboxChange(e) {
|
||||
console.log(e)
|
||||
var items = this.checkbox,
|
||||
values = e.detail.value;
|
||||
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)) {
|
||||
@@ -148,7 +154,7 @@ export default {
|
||||
})
|
||||
},
|
||||
addUser(data4) {
|
||||
staffApi.addOilUser(data4).then(res => {
|
||||
oliUserApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@@ -183,11 +189,13 @@ export default {
|
||||
}
|
||||
this.calcMenuList()
|
||||
const data4 = {
|
||||
cUserId: this.userInfo.cUserId,
|
||||
cUserName: this.userInfo.cUserName,
|
||||
siteId:this.siteId,
|
||||
id: this.userInfo.cUserId,
|
||||
userName: this.userInfo.cUserName,
|
||||
phone: this.userInfo.phone,
|
||||
menuIdLst: this.lastAuthList,
|
||||
roleIds: this.menuList.toString(),
|
||||
pushState: 1,
|
||||
channelId:uni.getStorageSync('channelId'),
|
||||
pushProcedureState: 1
|
||||
}
|
||||
|
||||
@@ -195,20 +203,30 @@ export default {
|
||||
|
||||
},
|
||||
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
|
||||
}
|
||||
})
|
||||
// 获取权限列表
|
||||
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 => {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<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.cUserName}}</view>
|
||||
<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>
|
||||
@@ -22,12 +22,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<!-- <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.cUserName}}</view>
|
||||
<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>
|
||||
@@ -37,7 +37,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<form class="margin-top-lg ">
|
||||
<view class="cu-form-group radius text-right">
|
||||
@@ -47,7 +47,7 @@
|
||||
<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"
|
||||
<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>
|
||||
@@ -65,24 +65,33 @@
|
||||
|
||||
<script>
|
||||
import StaffItem from '@/packageStaff/components/staff-item.vue'
|
||||
import staffApi from '@/packageStaff/api/staff.js'
|
||||
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() {
|
||||
this.getAllMenu()
|
||||
created() {
|
||||
if (this.tempUid.type === 'edit') {
|
||||
setTimeout(() => {
|
||||
this.getUserInfo()
|
||||
@@ -97,7 +106,7 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
},
|
||||
calcMenuList() {
|
||||
this.checkbox.forEach(item => {
|
||||
console.log(item.checked)
|
||||
// console.log(item.checked)
|
||||
if (item.checked) {
|
||||
this.lastAuthList.push(item.value)
|
||||
}
|
||||
@@ -117,7 +126,8 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
}
|
||||
},
|
||||
updateUser(data4) {
|
||||
staffApi.updateUser(data4).then(res => {
|
||||
console.log(data4)
|
||||
oliUserApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@@ -130,8 +140,10 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
})
|
||||
},
|
||||
deleteUser() {
|
||||
staffApi.unbindingUser({
|
||||
cUserId: this.tempUid.id
|
||||
console.log( this.tempUser.id)
|
||||
oliUserApi.removeStaff({
|
||||
id: this.tempUser.id,
|
||||
channelId:this.channelId
|
||||
}).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
@@ -145,7 +157,7 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
})
|
||||
},
|
||||
addUser(data4) {
|
||||
staffApi.addUser(data4).then(res => {
|
||||
staffApi.addNewStaff(data4).then(res => {
|
||||
if (res.code === 20000) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@@ -158,7 +170,7 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
})
|
||||
},
|
||||
saveInfo() {
|
||||
if (!this.userInfo.cUserName) {
|
||||
if (!this.userInfo.userName) {
|
||||
uni.showToast({
|
||||
title: '请输入员工姓名',
|
||||
icon: 'none'
|
||||
@@ -174,52 +186,92 @@ import staffApi from '@/packageStaff/api/staff.js'
|
||||
}
|
||||
this.calcMenuList()
|
||||
const data4 = {
|
||||
cUserId: this.userInfo.cUserId,
|
||||
cUserName: this.userInfo.cUserName,
|
||||
id: this.userInfo.id,
|
||||
userName: this.userInfo.userName,
|
||||
phone: this.userInfo.phone,
|
||||
menuIdLst: this.lastAuthList,
|
||||
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 => {
|
||||
// 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) {
|
||||
var auths = []
|
||||
var temp = res.data
|
||||
temp.forEach(item => {
|
||||
auths.push({
|
||||
value: item.menuId,
|
||||
checked: false,
|
||||
name: item.menuName
|
||||
let _that = this
|
||||
var auths = []
|
||||
var temp = res.data
|
||||
temp.forEach(item => {
|
||||
auths.push({
|
||||
value: item.id,
|
||||
checked: false,
|
||||
name: item.roleName
|
||||
})
|
||||
})
|
||||
})
|
||||
this.checkbox = auths
|
||||
}
|
||||
_that.checkbox = auths
|
||||
_that.getUserInfo()
|
||||
console.log('这里是chekcbox',_that.checkbox)
|
||||
}
|
||||
})
|
||||
},
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
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)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user