Browse Source

no message

devlop
xpz2018 3 years ago
parent
commit
993fe19e7d
7 changed files with 140 additions and 116 deletions
  1. 20
      apis/commonApi.js
  2. 21
      apis/enterpriseInfoApi.js
  3. 61
      pages/digital-workshops/index.vue
  4. 62
      pages/employee-detail/index.vue
  5. 70
      pages/employee-manage/index.vue
  6. 2
      pages/mine/index.vue
  7. 20
      store/index.js

20
apis/commonApi.js

@ -28,13 +28,19 @@ let baseInfo = null
// 处理store同步问题 // 处理store同步问题
function syncStore(res) { function syncStore(res) {
if (res.enterpriseList && res.enterpriseList.length > 0) {
let company = res.enterpriseList[0]
if (res.organizationList && res.organizationList.length > 0) {
let company = null
let organization = null
for (var i = 0; i < res.organizationList.length; i++) {
if(res.organizationList[i].factoryList && res.organizationList[i].factoryList.length){
company = res.organizationList[i].factoryList[0]
organization = res.organizationList[i]
break
}
}
store.commit('setCompanyInfo', { store.commit('setCompanyInfo', {
id: company.id, id: company.id,
name: company.name,
fddEnterpriseStatus: company.fddEnterpriseStatus,
enterpriseType: company.enterpriseType
name: company.name
}) })
res.name = company.employeeName res.name = company.employeeName
res.avatar = null res.avatar = null
@ -44,8 +50,8 @@ function syncStore(res) {
mobile: res.mobile, mobile: res.mobile,
avatar: null avatar: null
} }
uni.setStorageSync('factoryId', company.factoryList[0].id)
uni.setStorageSync('organizationId', company.organizationId)
uni.setStorageSync('factoryId', company.id)
uni.setStorageSync('organizationId', organization.organizationId)
store.commit('setUserInfo', res) store.commit('setUserInfo', res)
// 根据企业类型切换tabbar // 根据企业类型切换tabbar
} else { } else {

21
apis/enterpriseInfoApi.js

@ -69,3 +69,24 @@ export const auditMember = (data) => {
data data
}) })
} }
export const getMemberInfo = (data) => {
return http.get({
url: '/printing-packaging-factory-service/user/get/organization-member-detail',
data
})
}
export const deleteMember = (data) => {
return http.post({
url: '/printing-packaging-factory-service/user/delete/organization-member',
data
})
}
export const updateMember = (data) => {
return http.post({
url: '/printing-packaging-factory-service/user/update/organization-member',
data
})
}

61
pages/digital-workshops/index.vue

@ -174,19 +174,22 @@ export default {
} }
}, },
onLoad() { onLoad() {
this.factoryId = uni.getStorageSync('factoryId')
this.getFactoryList() this.getFactoryList()
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.getFactoryList()
// this.getFactoryList()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
watch: { watch: {
factoryId(val, oldVal) { factoryId(val, oldVal) {
uni.setStorageSync('factoryId', this.factoryId) uni.setStorageSync('factoryId', this.factoryId)
this.getCameraList()
this.getList()
this.downCallback()
this.isExample = this.factoryList.find((factory) => factory.value == val).isExample
if(this.factoryId){
this.getCameraList()
this.getList()
this.downCallback()
this.isExample = this.factoryList.find((factory) => factory.value == val).isExample
}
}, },
refresh(val) { refresh(val) {
console.log('refresh', val) console.log('refresh', val)
@ -299,9 +302,9 @@ export default {
}, },
// //
getCameraList() { getCameraList() {
// getCameraListApi({ factoryId: this.factoryId }).then((res) => {
// this.cameraList = res
// })
if(!this.factoryId){
this.factoryId = uni.getStorageSync('factoryId')
}
var url = `https://api-ops-yyt.qniao.cn/cloud-print-cloud-factory/user/get/factory/video-machine/list?factoryId=${this.factoryId}` var url = `https://api-ops-yyt.qniao.cn/cloud-print-cloud-factory/user/get/factory/video-machine/list?factoryId=${this.factoryId}`
http.get({ url }).then(res => { http.get({ url }).then(res => {
if(res){ if(res){
@ -311,20 +314,34 @@ export default {
}, },
// //
getFactoryList() { getFactoryList() {
getMyFactoryList().then((res) => {
this.factoryList = res.map((item) => {
return {
label: item.name,
value: item.id,
isExample: item.name == '演示样板工厂'
}
})
if (this.factoryId == this.factoryList[0].value) {
this.getCameraList()
this.getList()
}
this.factoryId = this.factoryList[0].value
})
let factoryList = []
var organizationList = this.$store.state.userInfo.organizationList
for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue
}
for (var k = 0; k < organizationList[i].factoryList.length; k++) {
factoryList.push({label: organizationList[i].factoryList[k].name, value: organizationList[i].factoryList[k].id})
}
}
factoryList.push({label: '演示样板工厂', id: '683736272371585025', isExample: true})
this.factoryList = factoryList
this.getCameraList()
this.getList()
// getMyFactoryList().then((res) => {
// this.factoryList = res.map((item) => {
// return {
// label: item.name,
// value: item.id,
// isExample: item.name == ''
// }
// })
// if (this.factoryId == this.factoryList[0].value) {
// this.getCameraList()
// this.getList()
// }
// this.factoryId = this.factoryList[0].value
// })
}, },
dateTimeFormat, dateTimeFormat,
fetchOrderList() { fetchOrderList() {

62
pages/employee-detail/index.vue

@ -10,7 +10,7 @@
<qn-easyinput <qn-easyinput
:maxlength="20" :maxlength="20"
@blur="showCompany" @blur="showCompany"
v-model="form.receiver"
v-model="form.name"
:inputBorder="false" :inputBorder="false"
text="left" text="left"
placeholder="请填写员工姓名" placeholder="请填写员工姓名"
@ -23,7 +23,7 @@
<qn-easyinput <qn-easyinput
:maxlength="11" :maxlength="11"
type="number" type="number"
v-model="form.receiverMobile"
v-model="form.mobile"
:inputBorder="false" :inputBorder="false"
text="left" text="left"
placeholder="请填写手机号码" placeholder="请填写手机号码"
@ -37,7 +37,7 @@
<uni-data-checkbox mode="tag" multiple v-model="flag" :localdata="[{text: '全部',value: 1}]" @change="onChange()"></uni-data-checkbox> <uni-data-checkbox mode="tag" multiple v-model="flag" :localdata="[{text: '全部',value: 1}]" @change="onChange()"></uni-data-checkbox>
</view> </view>
</view> </view>
<uni-data-checkbox mode="button" multiple v-model="checkIds" :localdata="hobby" @change="onChange2()"></uni-data-checkbox>
<uni-data-checkbox mode="button" multiple v-model="machineIds" :localdata="hobby" @change="onChange2()"></uni-data-checkbox>
</view> </view>
<view class="default-address"> <view class="default-address">
<view class="title">状态</view> <view class="title">状态</view>
@ -49,6 +49,7 @@
<view class="button-area" style="margin-top: 36rpx;"> <view class="button-area" style="margin-top: 36rpx;">
<view class="button button__submit" @click="addTap"><text class="text" style="color: white">保存</text></view> <view class="button button__submit" @click="addTap"><text class="text" style="color: white">保存</text></view>
</view> </view>
<view style="height: 48rpx;"></view>
<uni-popup ref="popup" type="center" :mask-click="false"> <uni-popup ref="popup" type="center" :mask-click="false">
<view class="popup-box"> <view class="popup-box">
<view class="tip-title">确定要删除该员工吗</view> <view class="tip-title">确定要删除该员工吗</view>
@ -65,18 +66,19 @@
<script> <script>
import { getMachinList } from '@/apis/factoryApi' import { getMachinList } from '@/apis/factoryApi'
import { back } from '@/utils/hook.js' import { back } from '@/utils/hook.js'
import { createAddress, getAddressDetail } from '@/apis/addressManageApi.js'
import { deleteMember, getMemberInfo, updateMember } from '@/apis/enterpriseInfoApi.js'
export default { export default {
data() { data() {
return { return {
form: { form: {
name: '',
mobile: ''
}, },
id: null, id: null,
hobby: [], hobby: [],
checkIds: [],
machineIds: [],
flag: [], flag: [],
radio: []
radio: 0
} }
}, },
mounted() { mounted() {
@ -94,17 +96,24 @@ export default {
onLoad(option) { onLoad(option) {
if (option.id) { if (option.id) {
this.id = option.id this.id = option.id
this.getAddressDetail()
this.getDetail()
} }
}, },
methods: { methods: {
back, back,
// id // id
getAddressDetail() {
getAddressDetail({ id: this.id }).then((res) => {
// console.log('', res)
getDetail() {
getMemberInfo({ orgMemberId: this.id }).then((res) => {
if (res) { if (res) {
this.form = Object.assign({}, res) this.form = Object.assign({}, res)
if (res.machineList && res.machineList.length) {
var checks = []
for (let i = 0; i < res.machineList.length; i++) {
checks.push(res.machineList[i].id)
}
this.machineIds = checks
}
this.radio = res.status ? 1 : 0
} }
}) })
}, },
@ -114,13 +123,14 @@ export default {
for (let i = 0; i < this.hobby.length; i++) { for (let i = 0; i < this.hobby.length; i++) {
checks.push(this.hobby[i].value) checks.push(this.hobby[i].value)
} }
this.checkIds = checks
this.machineIds = checks
} else { } else {
this.checkIds = []
this.machineIds = []
} }
}, },
onChange2(){ onChange2(){
if(this.checkIds.length == this.hobby.length){
if(this.machineIds.length == this.hobby.length){
this.flag = [1] this.flag = [1]
} else { } else {
this.flag = [] this.flag = []
@ -128,7 +138,19 @@ export default {
}, },
// //
addTap() { addTap() {
console.log(this.checkIds)
var params = {id : this.form.id}
params.realName = this.form.name
params.machineIds = this.machineIds
params.status = this.radio ? true : false
updateMember(params).then((res) => {
if (res) {
uni.$emit('employee',{msg:'页面更新'})
uni.showToast({ title: '保存成功', icon: 'success' })
setTimeout(() => {
back()
}, 500)
}
})
}, },
delTap(){ delTap(){
this.$refs.popup.open('center') this.$refs.popup.open('center')
@ -137,7 +159,15 @@ export default {
this.$refs.popup.close() this.$refs.popup.close()
}, },
confirmTap(){ confirmTap(){
uni.$emit('employee',{msg:'页面更新'})
deleteMember({idList: [this.form.id]}).then((res) => {
if (res) {
uni.$emit('employee',{msg:'页面更新'})
uni.showToast({ title: '删除成功', icon: 'success' })
setTimeout(() => {
back()
}, 500)
}
})
} }
} }
} }

70
pages/employee-manage/index.vue

@ -35,16 +35,6 @@
<uni-icons type="plusempty" size="36" color="white"></uni-icons> <uni-icons type="plusempty" size="36" color="white"></uni-icons>
</view> </view>
</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> </view>
</template> </template>
@ -84,7 +74,7 @@ export default {
go2, go2,
back, back,
onEvent(e) { onEvent(e) {
this.queryData()
}, },
queryData() { queryData() {
getMemberList({id: this.organization.organizationId}).then((res) => { getMemberList({id: this.organization.organizationId}).then((res) => {
@ -101,30 +91,19 @@ export default {
}) })
}, },
findOrgByFactoryId(factoryId){ 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]
var organizationList = this.$store.state.userInfo.organizationList
console.log(organizationList)
for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue
}
for (var k = 0; k < organizationList[i].factoryList.length; k++) {
if(organizationList[i].factoryList[k].id == factoryId){
return organizationList[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) { handItem(item, status) {
auditMember({ id: item.id, status }).then((res) => { auditMember({ id: item.id, status }).then((res) => {
if (res) { if (res) {
@ -134,35 +113,6 @@ export default {
}, },
lookItem(item) { lookItem(item) {
go2('employee-detail', { id: item.id }) 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(){ shareminiProgram(){
uni.share({ uni.share({

2
pages/mine/index.vue

@ -33,7 +33,7 @@
</view> --> </view> -->
</view> </view>
</view> </view>
<view class="card-area" v-if="hasCompany">
<view class="card-area">
<view class="header"> <view class="header">
<text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">我的设备</text> <text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">我的设备</text>
</view> </view>

20
store/index.js

@ -106,16 +106,16 @@ if (!store) {
} }
}, },
setUserInfo(state, userInfo) { setUserInfo(state, userInfo) {
if (!isObject(userInfo)) {
console.warn('userInfo必须是对象')
return
}
for (let param of userInfoParams) {
if (userInfo[param] === undefined) {
console.warn('userInfo必须包含' + param + '属性')
return
}
}
// if (!isObject(userInfo)) {
// console.warn('userInfo必须是对象')
// return
// }
// for (let param of userInfoParams) {
// if (userInfo[param] === undefined) {
// console.warn('userInfo必须包含' + param + '属性')
// return
// }
// }
try { try {
uni.setStorageSync('userInfo', JSON.stringify(userInfo)) uni.setStorageSync('userInfo', JSON.stringify(userInfo))
state.userInfo = userInfo state.userInfo = userInfo

Loading…
Cancel
Save