Browse Source

no message

devlop
xpz2018 3 years ago
parent
commit
e19aa142d0
10 changed files with 705 additions and 6 deletions
  1. 6
      apis/commonApi.js
  2. 22
      apis/enterpriseInfoApi.js
  3. 8
      apis/loginApi.js
  4. 16
      pages.json
  5. 1
      pages/digital-workshops/index.vue
  6. 291
      pages/employee-detail/index.vue
  7. 354
      pages/employee-manage/index.vue
  8. 8
      pages/mine/index.vue
  9. BIN
      static/imgs/mine/icon-employe.png
  10. 5
      utils/http/index.js

6
apis/commonApi.js

@ -36,13 +36,17 @@ function syncStore(res) {
fddEnterpriseStatus: company.fddEnterpriseStatus,
enterpriseType: company.enterpriseType
})
res.name = company.employeeName
res.avatar = null
let userInfo = {
name: company.employeeName, // 没有企业就没有name,
userId: res.userId,
mobile: res.mobile,
avatar: null
}
store.commit('setUserInfo', userInfo)
uni.setStorageSync('factoryId', company.factoryList[0].id)
uni.setStorageSync('organizationId', company.organizationId)
store.commit('setUserInfo', res)
// 根据企业类型切换tabbar
} else {
let userInfo = {

22
apis/enterpriseInfoApi.js

@ -47,3 +47,25 @@ export function getCompanyLocationList(data) {
data
})
}
export const getMemberList = (data) => {
return http.get({
url: '/uec/user/get/organization-member-list',
data
})
}
export const getApplicationList = (data) => {
return http.get({
url: '/uec/user/get/joining-organization-application-list',
data
})
}
export const auditMember = (data) => {
return http.post({
url: '/uec/user/audit/organization/joining-application',
data
})
}

8
apis/loginApi.js

@ -40,3 +40,11 @@ export const getQnToken = (data) => {
data
})
}
export const createQrcode = (data) => {
return http.post({
url: '/uec/create/qrcode-record',
data
})
}

16
pages.json

@ -179,6 +179,22 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/employee-manage/index",
"style": {
"navigationBarTitleText": "员工管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/employee-detail/index",
"style": {
"navigationBarTitleText": "员工详情",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/add-address-manage/index",
"style": {

1
pages/digital-workshops/index.vue

@ -182,6 +182,7 @@ export default {
},
watch: {
factoryId(val, oldVal) {
uni.setStorageSync('factoryId', this.factoryId)
this.getCameraList()
this.getList()
this.downCallback()

291
pages/employee-detail/index.vue

@ -0,0 +1,291 @@
<template>
<view class="wrapper">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="员工详情"></uni-nav-bar>
<view class="flex--justify" style="background-color: #ffa50033;padding: 24rpx 32rpx;font-size: 28rpx;">
点击可以修改员工信息
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">员工姓名</text></view>
<view class="value">
<qn-easyinput
:maxlength="20"
@blur="showCompany"
v-model="form.receiver"
:inputBorder="false"
text="left"
placeholder="请填写员工姓名"
></qn-easyinput>
</view>
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">手机号码</text></view>
<view class="value">
<qn-easyinput
:maxlength="11"
type="number"
v-model="form.receiverMobile"
:inputBorder="false"
text="left"
placeholder="请填写手机号码"
></qn-easyinput>
</view>
</view>
<view style="background-color: white;padding: 12rpx 32rpx;border-bottom: 2rpx solid #f3f3f3;">
<view class="flex-row-center-space" style="font-size: 28rpx;">
<view class="label__text" style="flex: 1;">设备权限</view>
<view>
<uni-data-checkbox mode="tag" multiple v-model="flag" :localdata="[{text: '全部',value: 1}]" @change="onChange()"></uni-data-checkbox>
</view>
</view>
<uni-data-checkbox mode="button" multiple v-model="checkIds" :localdata="hobby" @change="onChange2()"></uni-data-checkbox>
</view>
<view class="default-address">
<view class="title">状态</view>
<uni-data-checkbox v-model="radio" :localdata="[{text: '启用',value: 1}, {text: '停用',value: 0}]"></uni-data-checkbox>
</view>
<view class="button-area" style="margin-top: 64rpx;">
<view class="button button__submit" style="background-color: #ee0a24;" @click="delTap"><text class="text" style="color: white">删除</text></view>
</view>
<view class="button-area" style="margin-top: 36rpx;">
<view class="button button__submit" @click="addTap"><text class="text" style="color: white">保存</text></view>
</view>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="popup-box">
<view class="tip-title">确定要删除该员工吗</view>
<view class="operation-row">
<view class="cancel-text" @tap="cancelTap">取消</view>
<view class="line"></view>
<view class="confirm-text" @tap="confirmTap">确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { getMachinList } from '@/apis/factoryApi'
import { back } from '@/utils/hook.js'
import { createAddress, getAddressDetail } from '@/apis/addressManageApi.js'
export default {
data() {
return {
form: {
},
id: null,
hobby: [],
checkIds: [],
flag: [],
radio: []
}
},
mounted() {
var factoryId = uni.getStorageSync('factoryId')
getMachinList({ factoryId, pageSize: 1000 }).then((res) => {
var list = []
for (let i = 0; i < res.records.length; i++) {
list.push({text: res.records[i].name, value: res.records[i].id})
}
this.hobby = list
}).catch(err => {
console.log(err)
})
},
onLoad(option) {
if (option.id) {
this.id = option.id
this.getAddressDetail()
}
},
methods: {
back,
// id
getAddressDetail() {
getAddressDetail({ id: this.id }).then((res) => {
// console.log('', res)
if (res) {
this.form = Object.assign({}, res)
}
})
},
onChange(){
if(this.flag.length){
var checks = []
for (let i = 0; i < this.hobby.length; i++) {
checks.push(this.hobby[i].value)
}
this.checkIds = checks
} else {
this.checkIds = []
}
},
onChange2(){
if(this.checkIds.length == this.hobby.length){
this.flag = [1]
} else {
this.flag = []
}
},
//
addTap() {
console.log(this.checkIds)
},
delTap(){
this.$refs.popup.open('center')
},
cancelTap() {
this.$refs.popup.close()
},
confirmTap(){
uni.$emit('employee',{msg:'页面更新'})
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
.wrapper-title {
width: 100%;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.qn-form-item {
width: 750rpx;
padding: 0rpx 32rpx;
background-color: #fff;
display: flex;
flex-direction: row;
align-items: center;
// justify-content: space-between;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
min-height: 88rpx;
.label {
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
margin-right: 20rpx;
.label__text {
font-size: 28rpx;
color: #000000;
}
}
.value {
flex-grow: 1;
flex-shrink: 1;
text-align: right;
}
}
.default-address {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 100rpx;
background: #ffffff;
.title {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
.tip {
padding-top: 10rpx;
font-size: 24rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
}
}
.button-area {
width: 750rpx;
padding: 0 32rpx;
display: flex;
flex-direction: row;
align-items: center;
// justify-content: space-between;
.button {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
.text {
font-size: 30rpx;
font-weight: 500;
text-align: center;
}
}
.button__cancel {
width: 270rpx;
height: 88rpx;
border: 2rpx solid #979797;
}
.button__submit {
width: 100%;
height: 88rpx;
background: #007aff;
}
}
}
.popup-box {
width: 540rpx;
height: 226rpx;
background: #ffffff;
border-radius: 14rpx;
.tip-title {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 126rpx;
font-size: 32rpx;
color: #333333;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.operation-row {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 100rpx;
background: #ffffff;
border-top: 2rpx solid rgba(221, 221, 221, 0.5);
.cancel-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.line {
flex-grow: 0;
flex-shrink: 0;
width: 2rpx;
height: 100rpx;
border-left: 2rpx solid #dcdee3;
}
.confirm-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #108ee9;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
}
}
</style>

354
pages/employee-manage/index.vue

@ -0,0 +1,354 @@
<template>
<view class="wrapper">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="员工管理"></uni-nav-bar>
<view v-if="applyList && applyList.length">
<view style="padding: 16rpx 24rpx;">待审核{{applyList.length}}</view>
<view class="content" v-for="(item, index) in applyList" :key="index">
<image class="avatar" src="/static/imgs/mine/default-avatar.png"></image>
<view class="info-box">
<view class="name">{{ item.applicantName }}</view>
<view class="address">{{ item.mobile }}</view>
</view>
<view style="background-color: #ee0a24;line-height: 72rpx;text-align: center;width: 120rpx;color: white;" @click="handItem(item, 2)">拒绝</view>
<view style="background-color: #007AFF;margin-left: 24rpx;line-height: 72rpx;text-align: center;width: 120rpx;color: white;" @click="handItem(item, 1)">同意</view>
</view>
</view>
<view v-if="list && list.length">
<view style="padding: 16rpx 24rpx;">所有员工{{list.length}}</view>
<view class="content" v-for="(item, index) in list" :key="index" @click="lookItem(item)">
<image class="avatar" src="/static/imgs/mine/default-avatar.png"></image>
<view class="info-box">
<view class="name">{{ item.realName }}</view>
<view class="address">{{ item.phone }}</view>
</view>
<uni-icons type="forward" color="#999" size="24"></uni-icons>
</view>
</view>
<view class="flex-col items-center" v-else>
<view class="flex-col items-center image-wrapper" style="padding-top: 240rpx;">
<image src="/static/imgs/digital-workshops/empty-list.png" style="width: 280rpx;height: 366rpx;" />
</view>
<text class="text_10">暂无数据</text>
</view>
<view class="van-fab" style="bottom:120rpx" @click="shareminiProgram">
<view class="flex-row-center-center" style="background-color: #007AFF;width: 100rpx;height: 100rpx;border-radius: 50rpx;">
<uni-icons type="plusempty" size="36" color="white"></uni-icons>
</view>
</view>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="popup-box">
<view class="tip-title">确定要删除改地址吗</view>
<view class="operation-row">
<view class="cancel-text" @tap="cancelTap">取消</view>
<view class="line"></view>
<view class="confirm-text" @tap="confirmTap">确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { go2, back, setCache } from '@/utils/hook.js'
import { getMemberList, auditMember, getApplicationList } from '@/apis/enterpriseInfoApi.js'
import { createQrcode } from '@/apis/loginApi.js'
export default {
data() {
return {
/**
* 页面操作类型 none: 无操作, select: 选择
*/
operation: 'none',
applyList: null,
list: [],
id: null,
qrcode: null
}
},
onLoad(option) {
if (option) {
this.operation = option.operation
}
var factoryId = uni.getStorageSync('factoryId')
this.organization = this.findOrgByFactoryId(factoryId)
createQrcode({id: 16, metaData: {organizationId: this.organization.organizationId, name: this.organization.organizationName}}).then((res) => {
this.qrcode = res.id
})
this.queryData()
uni.$on('employee', this.onEvent)
},
onUnload() {
uni.$off('employee', this.onEvent)
},
methods: {
go2,
back,
onEvent(e) {
},
queryData() {
getMemberList({id: this.organization.organizationId}).then((res) => {
if (res) {
this.list = res.records
}
})
getApplicationList({id: this.organization.organizationId}).then((res) => {
if (res) {
this.applyList = res
} else {
this.applyList = []
}
})
},
findOrgByFactoryId(factoryId){
var enterpriseList = this.$store.state.userInfo.enterpriseList
for (var i = 0; i < enterpriseList.length; i++) {
for (var k = 0; i < enterpriseList[i].factoryList.length; k++) {
if(enterpriseList[i].factoryList[k].id == factoryId){
return enterpriseList[i]
}
}
}
},
//
radioTap(item) {
setDefaultAddress({ id: item.id }).then((res) => {
if (res) {
this.queryData()
}
})
},
//
selectAddress(item) {
if (this.operation === 'select') {
setCache('address', item)
back()
}
},
handItem(item, status) {
auditMember({ id: item.id, status }).then((res) => {
if (res) {
this.queryData()
}
})
},
lookItem(item) {
go2('employee-detail', { id: item.id })
},
//
addTap() {
go2('add-address-manage', { type: '新增地址' })
},
//
delTap(item, index) {
this.id = item.id
this.$refs.popup.open('center')
// this.$refs.popup.close()
},
//
editTap(item, index) {
go2('add-address-manage', { id: item.id, type: '编辑地址' })
},
confirmTap() {
delAddress({ id: this.id }).then((res) => {
this.$refs.popup.close()
if (res) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
this.queryData()
}
})
},
cancelTap() {
this.$refs.popup.close()
},
shareminiProgram(){
uni.share({
provider: 'weixin',
scene: "WXSceneSession",
type: 5,
imageUrl: 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/common/45309546072860651.webp',
title: '欢迎加入普瑞特',
miniProgram: {
id: 'gh_ddfcf0fe593d',
path: `pages/login/index?from=app&qrcode=${this.qrcode}`,
type: 0,
webUrl: 'https://www.pgyer.com/ClU9'
}
})
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
.content {
background: #ffffff;
display: flex;
align-items: center;
padding-right: 24rpx;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
.info-box {
max-height: 197rpx;
padding: 24rpx 16rpx;
flex: 1;
.name {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
.address {
padding-top: 16rpx;
font-size: 28rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
}
.other {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 80rpx;
background: #ffffff;
.radioText {
font-size: 28rpx;
color: #007aff;
letter-spacing: 0;
font-weight: 400;
}
.not-radioText {
font-size: 28rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
}
.left {
font-size: 28rpx;
color: #007aff;
letter-spacing: 0;
font-weight: 400;
}
.right {
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 28rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
.edit {
padding-left: 32rpx;
}
}
}
}
.button-area {
width: 750rpx;
padding: 0 32rpx;
display: flex;
flex-direction: row;
align-items: center;
.button {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
.text {
font-size: 30rpx;
font-weight: 500;
text-align: center;
}
}
.button__cancel {
width: 270rpx;
height: 88rpx;
border: 2rpx solid #979797;
}
.button__submit {
width: 100%;
height: 88rpx;
background: #007aff;
}
}
.popup-box {
width: 540rpx;
height: 226rpx;
background: #ffffff;
border-radius: 14rpx;
.tip-title {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 126rpx;
font-size: 32rpx;
color: #333333;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.operation-row {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 100rpx;
background: #ffffff;
border-top: 2rpx solid rgba(221, 221, 221, 0.5);
.cancel-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.line {
flex-grow: 0;
flex-shrink: 0;
width: 2rpx;
height: 100rpx;
border-left: 2rpx solid #dcdee3;
}
.confirm-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #108ee9;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
}
}
}
.avatar {
width: 90rpx;
height: 90rpx;
border-radius: 50%;
flex-grow: 0;
flex-shrink: 0;
overflow: hidden;
margin-left: 16rpx;
}
.van-fab{
border-radius: 50rpx;
position: fixed;
bottom: 160rpx;
right: 36rpx;
box-shadow: 0 0 8rpx rgba(0,0,0,.14),0 8rpx 16rpx rgba(0,0,0,.28);
z-index: 12;
}
</style>

8
pages/mine/index.vue

@ -93,10 +93,10 @@
<image class="icon" src="/static/imgs/mine/apply-manage-icon.png"></image>
<text class="label">验厂申请</text>
</view>
<!-- <view class="icon-item" @click="loginGo2('address-manage')">
<image class="icon" src="/static/imgs/mine/enterprise-icon.png"></image>
<text class="label">我的企业</text>
</view> -->
<view class="icon-item" @click="loginGo2('employee-manage')">
<image class="icon" src="/static/imgs/mine/icon-employe.png"></image>
<text class="label">员工管理</text>
</view>
<view class="icon-item" @click="loginGo2('address-manage')">
<image class="icon" src="/static/imgs/mine/enterprise-icon.png"></image>
<text class="label">地址管理</text>

BIN
static/imgs/mine/icon-employe.png

Before After
Width: 68  |  Height: 68  |  Size: 3.7 KiB

5
utils/http/index.js

@ -41,6 +41,7 @@ const reqInterceptor = (config, options) => {
// 添加token
let token = ''
let factoryId = ''
let organizationId = ''
try {
if (url.startsWith('uec')) {
token = uni.getStorageSync('uecToken')
@ -48,6 +49,7 @@ const reqInterceptor = (config, options) => {
token = uni.getStorageSync('qnToken')
}
factoryId = uni.getStorageSync('factoryId')
organizationId = uni.getStorageSync('organizationId')
} catch (e) {
console.error('获取缓存失败:', e)
}
@ -55,7 +57,8 @@ const reqInterceptor = (config, options) => {
...config.header,
Authorization: token || '',
'X-APP-ID': XAPPID,
'X-FACTORY-ID': factoryId
'X-FACTORY-ID': factoryId,
'X-ORGANIZATION-ID': organizationId
}
// 改变url
let newUrl = ''

Loading…
Cancel
Save