<template>
|
<win2 :title="title" @close="close">
|
<ztree ref="ztree" :nodes="nodes" />
|
<div slot="footer" align="center" class="dialog-footer">
|
<my-button-v2 name="取消" site="form" @click="close" />
|
<my-button-v2 name="保存" site="form" @click="save" />
|
</div>
|
</win2>
|
</template>
|
|
<script>
|
import win2 from '@/views/components/win2'
|
import myButtonV2 from '@/views/components/myButtonV2'
|
import ztree from '@/views/components/ztree'
|
import { getUserAuthZTree } from '@/api/common.js'
|
export default {
|
components: { win2, myButtonV2, ztree },
|
props: {
|
setting: {
|
type: Object,
|
default: function() {
|
return {}
|
}
|
}
|
},
|
data() {
|
return {
|
title: '选择用户',
|
nodes: []
|
}
|
},
|
created() {
|
this.getInfo()
|
},
|
methods: {
|
getInfo() {
|
if (this.setting.businessType && this.setting.businessId) {
|
getUserAuthZTree(this.setting).then(res => {
|
this.nodes = res.data
|
})
|
}
|
},
|
close() {
|
this.$emit('close')
|
},
|
save() {
|
const checkedNodes = this.$refs.ztree.getCheckedNodes()
|
// 如果是单选,需要判断选择的节点个数
|
if (this.setting.isRadio != undefined && this.setting.isRadio && checkedNodes.length > 1) {
|
this.$message.info('只能选择一个人员,请检查重试!')
|
return
|
}
|
this.$emit('saveUser', checkedNodes)
|
this.close()
|
}
|
}
|
}
|
</script>
|