选择部门组件优化
This commit is contained in:
@@ -50,9 +50,11 @@ export default {
|
||||
...mapState(['user']),
|
||||
isSingle: v => !!v.$route.query.single,
|
||||
nodeKey: v => v.$route.query.nodeKey || "idNumber",
|
||||
isRequire: v => v.$route.query.isRequire || 1
|
||||
isRequire: v => v.$route.query.isRequire || 1,
|
||||
isAuth: v => !!v.$route.query.isAuth, //是否只能选择自己当前部门及以下
|
||||
},
|
||||
onLoad(query) {
|
||||
console.log(query)
|
||||
if (query.selected) {
|
||||
this.selected = query.selected?.split(",").map(e => Number(e)) || []
|
||||
}
|
||||
@@ -60,7 +62,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.$http.post(`/app/wxcp/wxdepartment/listAll?name=${this.name}`).then(res => {
|
||||
var url = this.isAuth ? `/app/wxcp/wxdepartment/listByUser?name=${this.name}` : `/app/wxcp/wxdepartment/listAll?name=${this.name}`
|
||||
this.$http.post(url).then(res => {
|
||||
if (res?.data) {
|
||||
res.data.forEach(e => e.isCheck = this.selected.includes(e[this.nodeKey]))
|
||||
this.depts = new this.$tree(res.data, {parent: 'parentid'})
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="select-dept">
|
||||
<AiPagePicker type="dept" :selected.sync="deptList" single nodeKey="id" @select="getListInit" isRequire="1">
|
||||
<AiPagePicker type="dept" :selected.sync="deptList" single nodeKey="id" @select="getListInit" isRequire="1" isAuth>
|
||||
<span class="label">{{deptList[0].name}}</span>
|
||||
<u-icon name="arrow-down" color="#999" size="28" style="margin-left:4px;"/>
|
||||
</AiPagePicker>
|
||||
|
||||
Reference in New Issue
Block a user