Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
<el-input
|
<el-input
|
||||||
v-model="filterText"
|
v-model="filterText"
|
||||||
placeholder="请输入姓名"
|
placeholder="请输入姓名"
|
||||||
|
@input="changeInput"
|
||||||
></el-input>
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -25,7 +26,6 @@
|
|||||||
node-key="id"
|
node-key="id"
|
||||||
style="height: 100%; overflow: auto;"
|
style="height: 100%; overflow: auto;"
|
||||||
class="filter-tree tree-line"
|
class="filter-tree tree-line"
|
||||||
:class="treeClass"
|
|
||||||
@check-change="checkChange"
|
@check-change="checkChange"
|
||||||
:data="treeData"
|
:data="treeData"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
class="filter-tree tree-line"
|
class="filter-tree tree-line"
|
||||||
:data="treeData1"
|
:data="treeData1"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
|
@check-change="checkChange2"
|
||||||
:default-checked-keys="nodeList"
|
:default-checked-keys="nodeList"
|
||||||
highlight-current
|
highlight-current
|
||||||
check-strictly
|
check-strictly
|
||||||
@@ -74,6 +75,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function debounce(func, wait = 500){
|
||||||
|
let timeout;
|
||||||
|
return function(event){
|
||||||
|
clearTimeout(timeout)
|
||||||
|
timeout = setTimeout(()=>{
|
||||||
|
func.call(this, event)
|
||||||
|
},wait)
|
||||||
|
}
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
name: "roleTree",
|
name: "roleTree",
|
||||||
props: {
|
props: {
|
||||||
@@ -117,54 +127,73 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkChange (row, type, c) {
|
changeInput:debounce(function (val) {
|
||||||
if (!type) {
|
if (val.length) {
|
||||||
if (this.nodeList.length > 0) {
|
this.open1 = false
|
||||||
for (let a = 0; a < this.nodeList.length; a ++) {
|
this.treeLoading = true
|
||||||
if (row.id === this.nodeList[a]) {
|
this.$http.get('SarInstitution/institution/institutionAndUser', {
|
||||||
this.nodeList.splice(a, 1)
|
userName: val
|
||||||
}
|
}, {}, res => {
|
||||||
|
this.treeData1 = res.data
|
||||||
|
this.treeLoading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.open1 = true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
checkChange2 (row, type, c) {
|
||||||
|
if (type) {
|
||||||
|
this.nodeList.push(row.id)
|
||||||
|
} else {
|
||||||
|
for (let a = 0; a < this.nodeList.length; a ++) {
|
||||||
|
if (row.id === this.nodeList[a]) {
|
||||||
|
this.nodeList.splice(a, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
treeClass () {
|
checkChange (row, type, c) {
|
||||||
|
if (type) {
|
||||||
|
this.nodeList.push(row.id)
|
||||||
|
} else {
|
||||||
|
for (let a = 0; a < this.nodeList.length; a ++) {
|
||||||
|
if (row.id === this.nodeList[a]) {
|
||||||
|
this.nodeList.splice(a, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
handleTreeDrawerCancel () {
|
handleTreeDrawerCancel () {
|
||||||
this.filterText = ''
|
this.filterText = ''
|
||||||
this.isVisible2 = false
|
this.isVisible2 = false
|
||||||
},
|
},
|
||||||
saveUserInfo () {
|
saveUserInfo () {
|
||||||
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
|
if (this.checkBox) {
|
||||||
let ids = ''
|
|
||||||
this.nodeList.forEach(item => {
|
|
||||||
if (ids.length > 0) {
|
|
||||||
ids += ','
|
|
||||||
ids += item
|
|
||||||
} else {
|
|
||||||
ids = item
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$http.get('SarInstitution/institution/getNextById', {
|
|
||||||
ids: ids
|
|
||||||
}, {
|
|
||||||
_this: this
|
|
||||||
}, res => {
|
|
||||||
let oldList2 = res.concat(this.roleList)
|
|
||||||
let result = []
|
|
||||||
let obj = {}
|
|
||||||
for(let i = 0; i < oldList2.length; i++){
|
|
||||||
if(!obj[oldList2[i].id]){
|
|
||||||
result.push(oldList2[i]);
|
|
||||||
obj[oldList2[i].id] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.isVisible2 = false
|
|
||||||
this.$emit('checkedRole', result)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.isVisible2 = false
|
this.isVisible2 = false
|
||||||
this.$emit('checkedRole', this.roleList)
|
this.$emit('checkedRole', this.roleList)
|
||||||
|
} else {
|
||||||
|
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
|
||||||
|
let ids = ''
|
||||||
|
this.nodeList.forEach(item => {
|
||||||
|
if (ids.length > 0) {
|
||||||
|
ids += ','
|
||||||
|
ids += item
|
||||||
|
} else {
|
||||||
|
ids = item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$http.get('SarInstitution/institution/getNextById', {
|
||||||
|
ids: ids
|
||||||
|
}, {
|
||||||
|
_this: this
|
||||||
|
}, res => {
|
||||||
|
this.isVisible2 = false
|
||||||
|
this.$emit('checkedRole', res)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.isVisible2 = false
|
||||||
|
this.$emit('checkedRole', this.roleList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
drawerCheck (data) {
|
drawerCheck (data) {
|
||||||
@@ -173,7 +202,7 @@
|
|||||||
var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
|
var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
|
||||||
if(getlist.length == 1) {
|
if(getlist.length == 1) {
|
||||||
this.roleRow = getlist[0]
|
this.roleRow = getlist[0]
|
||||||
}else {
|
} else {
|
||||||
this.$refs.tree.setCheckedKeys([data.id]);
|
this.$refs.tree.setCheckedKeys([data.id]);
|
||||||
this.roleRow = this.$refs.tree.getCheckedNodes()[0]
|
this.roleRow = this.$refs.tree.getCheckedNodes()[0]
|
||||||
}
|
}
|
||||||
@@ -211,20 +240,6 @@
|
|||||||
isVisible2 (val) {
|
isVisible2 (val) {
|
||||||
this.$emit('update:isVisible', val)
|
this.$emit('update:isVisible', val)
|
||||||
},
|
},
|
||||||
filterText (val) {
|
|
||||||
if (val.length) {
|
|
||||||
this.open1 = false
|
|
||||||
this.treeLoading = true
|
|
||||||
this.$http.get('SarInstitution/institution/institutionAndUser', {
|
|
||||||
userName: val
|
|
||||||
}, {}, res => {
|
|
||||||
this.treeData1 = res.data
|
|
||||||
this.treeLoading = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.open1 = true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.getTree()
|
this.getTree()
|
||||||
|
|||||||
Reference in New Issue
Block a user