123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <ComponentLoading class="outer" :loading="loading">
- <view class="top-img">
- <view class="tree-body">
- <!-- <view class="header">物建员</view> -->
- <TreeAddress :treeList="treeList" @node-click="treeClick"></TreeAddress>
- </view>
- </view>
- </ComponentLoading>
- </template>
- <script>
- import {
- getrequest,
- getLdListPt,
- login
- } from '@/api/wjxxy.js'
- import md5 from '@/utils/md5.js'
- import TreeAddress from '@/components/tree-address/index'
- import ComponentLoading from '@/components/component-loading/index'
- export default {
- components: {
- TreeAddress,
- ComponentLoading
- },
- data() {
- return {
- tenantId: '000000',
- username: 'sqmj1',
- password: '123456',
- treeList: [],
- loading: false,
- bj_blue: require('./img/bj_blue.svg'),
- }
- },
- onLoad(option) {
- this.login()
- },
- methods: {
- // 监听按钮点击事件
- onNavigationBarButtonTap(e) {
- plus.runtime.quit()
- },
- //下拉后触发的事件
- onPullDownRefresh() {},
- login() {
- this.loading = true
- getrequest('bladeTokenEndPoint', 'token3').then(res => {
- let userInfo = JSON.parse(res.data.dataList[0].fieldValues[0].value)
- this.$u.func.login(userInfo)
- this.getLdListPt()
- })
- // login(this.tenantId, this.username, md5(this.password)).then(res => {
- // this.$u.func.login(res)
- // this.getLdListPt()
- // })
- },
- getLdListPt() {
- getrequest('xxyController', 'getLdListPt').then(res => {
- let result = JSON.parse(res.data.dataList[0].fieldValues[0].value)
- let list = result.data.map(r1 => { // 五兴村
- let l1 = {}
- if (r1.data) { // 前兴屯
- l1.data = r1.data.map(r2 => {
- let l2 = r2
- l2.isClick = false
- return l2
- })
- }
- l1.ldph = r1.ldph
- l1.isClick = false
- return l1
- })
- this.treeList = list
- }).finally(() => {
- this.loading = false
- })
- // getLdListPt().then(res => {
- // let list = res.data.map(r1 => { // 五兴村
- // let l1 = {}
- // if (r1.data) { // 前兴屯
- // l1.data = r1.data.map(r2 => {
- // let l2 = r2
- // l2.isClick = false
- // return l2
- // })
- // }
- // l1.ldph = r1.ldph
- // l1.isClick = false
- // return l1
- // })
- // this.treeList = list
- // }).finally(() => {
- // this.loading = false
- // })
- },
- treeClick(item, parent, index) {
- const param = JSON.stringify(item)
- uni.navigateTo({
- url: `/pages/home/wjy?param=${param}`
- })
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .outer {
- background-color: rgba(248, 248, 248, 1);
- height: 100vh;
- overflow-y: scroll;
- font-family: PingFangSC, PingFang SC;
- .top-img {
- width: 100%;
- background-image: url(./img/bj_blue.svg);
- background-repeat: repeat-x;
- }
- }
- .tree-body {
- width: 100%;
- padding: 24rpx;
- }
- .header {
- color: rgba(17, 17, 17, 1);
- font-size: 36rpx;
- font-weight: 600;
- text-align: center;
- width: 100%;
- height: 100rpx;
- line-height: 100rpx;
- }
- </style>
|