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

部门人员选择器---fix3

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