10 changed files with 705 additions and 6 deletions
Split View
Diff Options
-
6apis/commonApi.js
-
22apis/enterpriseInfoApi.js
-
8apis/loginApi.js
-
16pages.json
-
1pages/digital-workshops/index.vue
-
291pages/employee-detail/index.vue
-
354pages/employee-manage/index.vue
-
8pages/mine/index.vue
-
BINstatic/imgs/mine/icon-employe.png
-
5utils/http/index.js
@ -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> |
|||
@ -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> |
|||
Write
Preview
Loading…
Cancel
Save