提交 e46c7331 编写于 作者: ShineKOT's avatar ShineKOT

部门人员选择器BUG修复

上级 7b841b8b
<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 :multiple="multiple" :transfer="true" transfer-class-name="app-department-personnel-select" :value="selectsLabel" :disabled="disabled" :clearable="true" @on-open-change="onClick" @on-change="change">
<i-option v-for="(item, index) in items" :key="index" :value="item.id" :label="item.label">
{{item.label}}
</i-option>
......@@ -243,7 +243,7 @@ export default class AppDepartmentPersonnel extends Vue {
* @memberof AppDepartmentPersonnel
*/
@Watch('data',{immediate:true,deep:true})
onValueChange(newVal: any, oldVal: any) {
onValueChange(newVal: any, oldVal: any) {
this.selects = [];
this.selectsLabel = [];
if (newVal) {
......@@ -262,11 +262,11 @@ export default class AppDepartmentPersonnel extends Vue {
_item[key] = item[key][index] ? item[key][index] : null;
}
this.selects.push(_item);
let i = this.items.findIndex((item) => Object.is(item.label,_item.label));
let i = this.items.findIndex((select: any) => Object.is(select.id,_item.id));
if(i < 0){
this.items.push(_item);
}
this.selectsLabel.push(_item.label);
this.selectsLabel.push(_item.id);
})
}
if(item.label.length == 0 && item.id.length > 0){
......@@ -350,11 +350,11 @@ export default class AppDepartmentPersonnel extends Vue {
this.selectsLabel = [];
this.selects = [...result.datas];
this.selects.forEach((select: any)=>{
let index = this.items.findIndex((item) => Object.is(item.label, select.label));
let index = this.items.findIndex((item) => Object.is(item.id, select.id));
if(index < 0){
this.items.push(select);
}
this.selectsLabel.push(select.label);
this.selectsLabel.push(select.id);
});
}
this.setValue();
......@@ -371,14 +371,14 @@ export default class AppDepartmentPersonnel extends Vue {
if(this.multiple){
if($event.length > 0){
$event.forEach((select: any)=>{
let index = this.items.findIndex((item) => Object.is(item.label, select));
let index = this.items.findIndex((item) => Object.is(item.id, select));
if (index >= 0) {
this.selects.push(this.items[index]);
}
});
}
}else{
let index = this.items.findIndex((item) => Object.is(item.label, $event));
let index = this.items.findIndex((item) => Object.is(item.id, $event));
if (index >= 0) {
this.selects.push(this.items[index]);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册