或然中台小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

91 lines
1.8 KiB

<template>
<view>
<uni-section title="组织架构" type="line">
<view class="page">
<view class="org-picker">
<uni-data-picker class="picker-input" placeholder="请选择组织" popup-title="请选择组织" preload :localdata="orgs" :map="{text: 'partnerClassificationName', value: 'id'}" v-model="org" @nodeclick="orgClick" @popupclosed="orgClose"></uni-data-picker>
</view>
<button type="primary" @click="submit">确定</button>
</view>
</uni-section>
</view>
</template>
<script>
import { treeList, updatePartner } from '@/apis/modules/parner.js'
export default {
data() {
return {
id: '',
areaId: '',
orgs: [],
org: '',
orgTemp: '',
extraIcon: {
color: '#007eff',
size: '22',
type: 'icon-qrcode'
}
}
},
onShow() {
const pages = getCurrentPages()
const { options } = pages[pages.length - 1]
this.id = options.id
this.org = +options.areaId || ''
this.getOrg()
},
methods: {
// 获取组织
getOrg() {
treeList().then(({ treeList }) => {
this.orgs = treeList
}).catch(e => {})
},
// 组织点击回调
orgClick(e) {
this.orgTemp = e.id
},
// 组织关闭回调
orgClose(e) {
this.org = this.orgTemp
},
// 提交
submit() {
if(!this.org) return this.$util.errMsg('请选择区域')
updatePartner({
id: this.id,
isTeam: 1,
parentId: this.org
}).then(res => {
this.$util.sucMsg('修改成功!')
setTimeout(() => {
uni.navigateBack()
}, 1000)
}).catch(e => {})
}
}
}
</script>
<style scoped lang="scss">
.page {
padding: 0 20px 20px;
.org-picker {
margin-bottom: 20px;
}
}
.slot-box {
display: flex;
flex-direction: row;
align-items: center;
}
.icon {
width: 25px;
height: 25px;
margin-right: 10px;
}
.text {
font-size: 14px;
}
</style>