|
|
@@ -19,7 +19,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="top-card">
|
|
|
- <div class="top-card-line">
|
|
|
+ <div class="top-card-line" style="display: inline-flex;">
|
|
|
<van-image
|
|
|
round
|
|
|
width="1.3rem"
|
|
|
@@ -27,18 +27,42 @@
|
|
|
style="float: left"
|
|
|
:src="require('@/assets/img/my/header.png')"
|
|
|
/>
|
|
|
- <p class="user-name">{{ userName }}</p>
|
|
|
+ <div class="user-name">
|
|
|
+ {{ getShowUserName() }}
|
|
|
+ </div>
|
|
|
+ <!-- <div style="line-height: 11vw;" v-if="subUserActions && subUserActions.length>0">
|
|
|
+ <van-popover v-model="showPopover" placement="left-end" trigger="click"
|
|
|
+ :actions="subUserActions"
|
|
|
+ @select="onSelect">
|
|
|
+ <template #reference>
|
|
|
+ <van-button size="mini" icon="exchange" round type="info">切换机构</van-button>
|
|
|
+ </template>
|
|
|
+ </van-popover>
|
|
|
+ </div> -->
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
- <div class="top-card-line">
|
|
|
+ <div class="top-card-line" style="display: flex;">
|
|
|
+ <div style="-webkit-box-flex: 1;-webkit-flex: 1;flex: 1;">
|
|
|
<van-image
|
|
|
width="0.7rem"
|
|
|
height="0.6rem"
|
|
|
style="float: left"
|
|
|
:src="require('@/assets/img/my/org.png')"
|
|
|
/>
|
|
|
- <p style="line-height: 28px;">
|
|
|
+ <p style="line-height: 28px; padding-right:10px;">
|
|
|
<span class="top_text_content">{{ orgName }}</span>
|
|
|
</p>
|
|
|
+ </div>
|
|
|
+ <div v-if="subUserActions && subUserActions.length>0">
|
|
|
+ <van-popover v-model="showPopover" placement="left-end" trigger="click" class="xxxx"
|
|
|
+ :actions="subUserActions"
|
|
|
+ @select="onSelect">
|
|
|
+ <template #reference>
|
|
|
+ <van-button size="mini" round icon="exchange" type="default">切换机构</van-button>
|
|
|
+ </template>
|
|
|
+ </van-popover>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="top-card-line">
|
|
|
<van-image
|
|
|
@@ -54,31 +78,144 @@
|
|
|
<div style="height: 2vw;"></div>
|
|
|
</div>
|
|
|
<div class="card-footer"></div>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters } from 'vuex'
|
|
|
- import { logout } from '@/api/public'
|
|
|
+ import { logout,switchUser,userUnDoList } from '@/api/public'
|
|
|
export default {
|
|
|
data() {
|
|
|
- return {}
|
|
|
+ return {
|
|
|
+ showPopover:false,
|
|
|
+ subUserActions: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created(){
|
|
|
+ },
|
|
|
+ mounted(){
|
|
|
+
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ subUserList:{
|
|
|
+ handler(val,val2){
|
|
|
+ console.log("subUserList",val,val2);
|
|
|
+ if(val){
|
|
|
+ this.initSubUserActions();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate:true,
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(['userName', 'orgName','roleList', 'orgId']),
|
|
|
+ ...mapGetters(['userName', 'orgName','roleList', 'orgId','subUserList','masterUserName','masterUserId']),
|
|
|
},
|
|
|
methods: {
|
|
|
+ getShowUserName()
|
|
|
+ {
|
|
|
+ // console.log("getShowUserName",this.masterUserName ,this.masterUserId)
|
|
|
+ if(this.masterUserName && this.masterUserId)
|
|
|
+ {
|
|
|
+ return this.masterUserName;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return this.userName;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initSubUserActions(){
|
|
|
+ console.log("initSubUserActions",this.subUserList)
|
|
|
+ if(this.subUserList && this.subUserList.length>0)
|
|
|
+ {
|
|
|
+ this.getSubUserUnDoTaskList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clickSwitchUser(subUserId)
|
|
|
+ {
|
|
|
+ switchUser(subUserId).then(res => {
|
|
|
+ // console.log(res, 'res')
|
|
|
+ sessionStorage.clear();
|
|
|
+ sessionStorage.setItem('access_token', res.data.access_token)
|
|
|
+ this.$router.replace({
|
|
|
+ name:'home',
|
|
|
+ path:'/home',
|
|
|
+ params:{event:'SwitchUser'},
|
|
|
+ query:{event:'SwitchUser'},
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSelect(action)
|
|
|
+ {
|
|
|
+ // console.log("onSelect",action,action.text);
|
|
|
+ this.clickSwitchUser(action.subUserId);
|
|
|
+ },
|
|
|
+ getSubUserUnDoTaskList()
|
|
|
+ {
|
|
|
+ if(this.subUserList && this.subUserList.length>0)
|
|
|
+ {
|
|
|
+ let users= this.subUserList.map((i) =>{
|
|
|
+ return {userId:i.subUserId,orgId:i.subUserOrgId};
|
|
|
+ } );
|
|
|
+ userUnDoList(users).then(res => {
|
|
|
+
|
|
|
+ // console.log("initSubUserActions2",this.subUserList)
|
|
|
+ this.subUserActions=[];
|
|
|
+ this.subUserList.forEach(sUser => {
|
|
|
+ let haveUnDoTask=false;
|
|
|
+ if(res.data){
|
|
|
+ let index= res.data.findIndex(x=>x.userId == sUser.subUserId && x.haveUnDoTask===true)
|
|
|
+ if(index>-1)
|
|
|
+ {
|
|
|
+ haveUnDoTask=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // let tempText= `${sUser.subUserOrgName}`;
|
|
|
+ let tempAction={ text: sUser.subUserOrgName,subUserId:sUser.subUserId};
|
|
|
+ if(haveUnDoTask)
|
|
|
+ {
|
|
|
+ tempAction={className:"haveUnDoTask",...tempAction};
|
|
|
+ }
|
|
|
+ this.subUserActions.push(tempAction)
|
|
|
+
|
|
|
+ });
|
|
|
+ // console.log("xxx",this.subUserActions)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
clickOutLogin() {
|
|
|
logout().then(res => {
|
|
|
sessionStorage.clear();
|
|
|
this.$router.replace('/login');
|
|
|
this.$toast('退出登录');
|
|
|
})
|
|
|
- },
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
+<style lang="scss">
|
|
|
+ .van-popover__action{
|
|
|
+ width: 60vw !important;
|
|
|
+ .van-popover__action-text{
|
|
|
+ flex:none !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .haveUnDoTask
|
|
|
+ {
|
|
|
+ .van-popover__action-text::before{
|
|
|
+ content: "";
|
|
|
+ width:10px;
|
|
|
+ height:10px;
|
|
|
+ background-color: red;
|
|
|
+ position: absolute;
|
|
|
+ left: -15px;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|
|
|
+<style scoped lang="scss">
|
|
|
+
|
|
|
+
|
|
|
.card-footer{
|
|
|
height: 3vw;
|
|
|
}
|
|
|
@@ -92,15 +229,16 @@
|
|
|
min-height: 37vw;
|
|
|
background-color: #FFFFFF;
|
|
|
margin-top: -23vw;
|
|
|
- margin-left: 6%;
|
|
|
- margin-right: 6%;
|
|
|
+ margin-left: 5%;
|
|
|
+ margin-right: 5%;
|
|
|
border-radius: 10px;
|
|
|
.top-card-line{
|
|
|
- padding: 20px 40px 0 40px;
|
|
|
+ padding: 20px 10px 0 40px;
|
|
|
}
|
|
|
}
|
|
|
.user-name{
|
|
|
- padding-left: 15vw;
|
|
|
+ padding-left: 5vw;
|
|
|
+ padding-right: 20vw;
|
|
|
font-size: 6.333333vw;
|
|
|
line-height: 14vw;
|
|
|
}
|