123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view>
- <view class="section" v-for="(item,index) in data" :key="index">
- <view class="box">
- <view class="item">
- <view class="left">
- <view class="icon" v-if="active == index" @click.stop="change_active(index,item)">
- <image src="./icon/close.png" mode=""></image>
- </view>
- <view class="icon" v-if="active != index" @click.stop="change_active(index,item)">
- <image src="./icon/open.png" mode=""></image>
- </view>
- <view class="text" v-if="item.children.length == 0">{{item.title}} ({{item.user_num}})</view>
- <view class="text" v-if="item.children != 0">{{item.title}}</view>
- </view>
- <view class="right" @click="go_record(item.page_id)">
- <uni-icons type="eye"></uni-icons>
- </view>
- </view>
- <view class="children" v-show="active == index">
- <view class="list" v-show="item.children == 0">
- <view class="item" v-for="(item_2,index_2) in user_list" :key="index_2"
- @click="go_user_info(item_2.staff_num)">
- <view class="left">
- <view class="icon">{{item_2.name.charAt(0)}}</view>
- <!-- #ifdef APP-PLUS -->
- <view class="text">{{item_2.name}} {{item_2.position_name}}</view>
- <!-- #endif -->
- <!-- #ifdef H5 -->
- <view class="text">{{item_2.name}} {{item_2.position_name}} {{item_2.mobile}}</view>
- <!-- #endif -->
- </view>
-
- <!-- #ifdef APP-PLUS -->
- <view class="right" @click.stop="phone(item_2.mobile)">
- <uni-icons type="phone"></uni-icons>
- </view>
- <!-- #endif -->
- </view>
- </view>
- </view>
- </view>
-
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "origanizationItem",
- props: [
- "mine_code"
- ],
- data() {
- return {
- // 当前展开部门
- active: 99999999,
- data: [],
- user_list: []
- };
- },
- mounted() {
- this.get_section_getGroupList()
- },
- methods: {
- // 获取部门列表
- get_section_getGroupList() {
- uni.showLoading({
- mask: true
- })
- this.$api.section_get_org_structure({
- }).then((res) => {
- uni.hideLoading()
- this.data = res.data.content.data[0].children
- console.log(res.data.content.data[0].children)
- })
- },
- // 获取当前部门人员
- get_user_list(id) {
- this.user_list = []
- uni.showLoading({
- mask: true
- })
- this.$api.user_get_org_users({
- section_id: id
- }).then((res) => {
- uni.hideLoading()
- this.user_list = res.data.content.data
- })
- },
- change_active(index, item) {
- if (this.active == index) {
- this.active = 99999999
- } else {
- this.active = index
- if (item.children.length == 0) {
- this.get_user_list(item.id)
- }
- }
- },
- go_record(page_id) {
- console.log(page_id)
- if (page_id == null) {
- uni.showToast({
- icon: "none",
- title: "该部门还未关联二维码"
- })
- } else {
- console.log(page_id)
- uni.navigateTo({
- url: "../../../index/record/record?pageId=" + page_id + "&mine_code=" + uni.getStorageSync(
- 'mine_code'),
- })
- }
- },
- phone(mobile) {
- console.log(mobile)
- if (mobile != null) {
- uni.makePhoneCall({
- phoneNumber: mobile
- });
- } else {
- uni.showToast({
- icon: "none",
- title: "未绑定手机号"
- })
- }
- },
- go_user_info(staff_num) {
- uni.navigateTo({
- url: "./personal_information/personal_information?staff_num=" + staff_num
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .section {
- box-sizing: border-box;
- // padding: 0 20rpx;
-
- .box {
-
- .item {
- min-height: 100rpx;
- padding: 10rpx 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
-
- margin-left: 20rpx;
- border-bottom: 1rpx solid #F3F8F7;
-
- .left {
- display: flex;
- align-items: center;
-
- .icon {
- width: 90rpx;
- text-align: center;
-
- image {
- width: 24rpx;
- height: 24rpx;
- }
- }
-
- .text {
- width: 470rpx;
- font-size: 32rpx;
- }
- }
-
- .right {
- width: 90rpx;
- text-align: center;
- }
- }
-
- .children {
- margin-left: 20rpx;
- }
-
- .list {
- .item {
- height: 110rpx;
-
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- margin-left: 108rpx;
- border-bottom: 1rpx solid #F3F8F7;
-
- .left {
- width: 500rpx;
-
- .icon {
- width: 35rpx;
- text-align: center;
- line-height: 35rpx;
- border-radius: 50%;
- border: 1rpx solid #00A1E9;
-
- font-size: 24rpx;
- color: #00A1E9;
- }
-
- .text {
- width: 350rpx;
- margin-left: 18rpx;
- font-size: 30rpx;
-
- }
- }
-
- .right {
- line-height: 110rpx;
- width: 90rpx;
- text-align: center;
- }
-
- }
- }
-
- }
-
- }
-
-
- </style>
|