From 993fe19e7df842e93202cb324241e38dd2488a68 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Wed, 13 Jul 2022 13:42:53 +0800 Subject: [PATCH] no message --- apis/commonApi.js | 20 +++++---- apis/enterpriseInfoApi.js | 21 ++++++++++ pages/digital-workshops/index.vue | 61 +++++++++++++++++---------- pages/employee-detail/index.vue | 62 ++++++++++++++++++++------- pages/employee-manage/index.vue | 70 +++++-------------------------- pages/mine/index.vue | 2 +- store/index.js | 20 ++++----- 7 files changed, 140 insertions(+), 116 deletions(-) diff --git a/apis/commonApi.js b/apis/commonApi.js index ef0bd31..df55430 100644 --- a/apis/commonApi.js +++ b/apis/commonApi.js @@ -28,13 +28,19 @@ let baseInfo = null // 处理store同步问题 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', { id: company.id, - name: company.name, - fddEnterpriseStatus: company.fddEnterpriseStatus, - enterpriseType: company.enterpriseType + name: company.name }) res.name = company.employeeName res.avatar = null @@ -44,8 +50,8 @@ function syncStore(res) { mobile: res.mobile, 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) // 根据企业类型切换tabbar } else { diff --git a/apis/enterpriseInfoApi.js b/apis/enterpriseInfoApi.js index 620de7a..2d0221e 100644 --- a/apis/enterpriseInfoApi.js +++ b/apis/enterpriseInfoApi.js @@ -69,3 +69,24 @@ export const auditMember = (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 + }) +} \ No newline at end of file diff --git a/pages/digital-workshops/index.vue b/pages/digital-workshops/index.vue index 50e74bd..599ccc2 100644 --- a/pages/digital-workshops/index.vue +++ b/pages/digital-workshops/index.vue @@ -174,19 +174,22 @@ export default { } }, onLoad() { + this.factoryId = uni.getStorageSync('factoryId') this.getFactoryList() }, onPullDownRefresh() { - this.getFactoryList() + // this.getFactoryList() uni.stopPullDownRefresh() }, watch: { factoryId(val, oldVal) { 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) { console.log('refresh', val) @@ -299,9 +302,9 @@ export default { }, // 获取摄像头列表 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}` http.get({ url }).then(res => { if(res){ @@ -311,20 +314,34 @@ export default { }, // 获取工厂列表 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, fetchOrderList() { diff --git a/pages/employee-detail/index.vue b/pages/employee-detail/index.vue index 34e7a73..b086c07 100644 --- a/pages/employee-detail/index.vue +++ b/pages/employee-detail/index.vue @@ -10,7 +10,7 @@ - + 状态: @@ -49,6 +49,7 @@ 保存 + 确定要删除该员工吗? @@ -65,18 +66,19 @@