提交 a8d2b01c 编写于 作者: Shine-zwj's avatar Shine-zwj

部门人员选择器---fix3

上级 f9ea8163
<template>
<div class="app-department-personnel">
<i-select :multiple="multiple" :transfer="true" transfer-class-name="app-department-personnel-select" v-model="selectsLabel" :disabled="disabled" :clearable="true" @on-open-change="onClick" @on-change="change">
<i-select v-if="!treeurl" :multiple="multiple" :transfer="true" transfer-class-name="app-department-personnel-select" v-model="selectsLabel" :disabled="disabled" :clearable="true" @on-open-change="onClick" @on-change="change">
<i-option v-for="(item, index) in items" :key="index" :value="item.label" :label="item.label">
{{item.label}}
</i-option>
</i-select>
<ibiz-select-tree v-if="treeurl" class="tree-department-personnel-select" :disabled="disabled" :NodesData="items" v-model="selectsLabel" :multiple="multiple"></ibiz-select-tree>
<template>
<i v-if="!disabled" class="el-icon-search" @click="openView"></i>
</template>
......@@ -34,7 +35,7 @@ export default class AppDepartmentPersonnel extends Vue {
* @type {*}
* @memberof AppDepartmentPersonnel
*/
@Prop() public treeurl?: boolean;
@Prop() public treeurl?: string;
/**
* 数据接口地址
......@@ -174,19 +175,24 @@ export default class AppDepartmentPersonnel extends Vue {
}
/**
* 展开下拉选择框
* 下拉加载数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public onClick($event:any){
if($event === true){
public onClick($event: any){
if($event == true){
const items: Array<any> = this.$store.getters.getDepartmentPersonnel();
if(items.length > 0){
this.items = items;
}else{
this.getDepertmentId();
let tempUrl = this.url.replace('{deptId}',this.filtervalue);
let tempUrl = "";
if(this.treeurl){
tempUrl = this.treeurl.replace('{deptId}',this.filtervalue);
}else{
tempUrl = this.url.replace('{deptId}',this.filtervalue);
}
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
if(response.status === 200) {
......@@ -204,7 +210,7 @@ export default class AppDepartmentPersonnel extends Vue {
* 值变化
*
* @type {*}
* @memberof AppGroupSelect
* @memberof AppDepartmentPersonnel
*/
@Watch('data',{immediate:true,deep:true})
onValueChange(newVal: any, oldVal: any) {
......@@ -226,13 +232,11 @@ export default class AppDepartmentPersonnel extends Vue {
_item[key] = item[key][index] ? item[key][index] : null;
}
this.selects.push(_item);
this.selects.forEach((select: any)=>{
let index = this.items.findIndex((item) => Object.is(item.label, select.label));
if(index < 0){
this.items.push(select);
let i = this.items.findIndex((item) => Object.is(item.label,_item.label));
if(i < 0){
this.items.push(_item);
}
this.selectsLabel.push(select.label);
});
this.selectsLabel.push(_item.label);
})
}
if(item.label.length == 0 && item.id.length > 0){
......@@ -356,7 +360,7 @@ export default class AppDepartmentPersonnel extends Vue {
* 设置值
*
* @type {*}
* @memberof AppGroupSelect
* @memberof AppDepartmentPersonnel
*/
public setValue() {
let item: any = {};
......@@ -402,6 +406,14 @@ export default class AppDepartmentPersonnel extends Vue {
<style lang="less">
.app-department-personnel{
position: relative;
.tree-department-personnel-select{
.el-input__inner{
height: 32px;
}
.el-input__suffix{
top: 5px;
}
}
.el-icon-search{
position: absolute;
top: 10px;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册