156 lines
3.3 KiB
Vue
156 lines
3.3 KiB
Vue
<template>
|
|
<section class="p-10">
|
|
<el-select
|
|
filterable
|
|
clearable
|
|
default-first-option
|
|
v-el-select-loadmore="loadmore"
|
|
remote
|
|
:remote-method="remoteMethod"
|
|
:loading="loading"
|
|
:no-data-text="noDataText"
|
|
@change="onChange">
|
|
<!-- <div><i class="el-icon-arrow-down select-down" :class="'rotate180'"></i></div> -->
|
|
<div class="el-s-thead">
|
|
<div style="width:20%;">员工编号</div>
|
|
<div style="width:20%;">员工名称</div>
|
|
</div>
|
|
<el-option v-for="item in filterData" :key="item.userName" :label="item.nickName" :value="item.userName">
|
|
<div class="el-data">
|
|
<div style="width:20%;">{{ item.userName }}</div>
|
|
<div style="width:20%;">{{ item.nickName }}</div>
|
|
</div>
|
|
</el-option>
|
|
</el-select>
|
|
|
|
</section>
|
|
|
|
|
|
</template>
|
|
<script>
|
|
import { listUser } from "@/api/system/user";
|
|
|
|
export default {
|
|
name: "EmisUserPicker",
|
|
props: {
|
|
value: {
|
|
type: [String, Number],
|
|
required: false
|
|
},
|
|
sideCode: {
|
|
type: String,
|
|
required: false
|
|
},
|
|
isInitiated:{
|
|
type: [Boolean,String],
|
|
required: false,
|
|
default:false
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
optionItems: [],
|
|
svalue: this.value,
|
|
code:'',
|
|
// 原始数据
|
|
data: [],
|
|
// 搜索后的数据
|
|
filterData:[],
|
|
filterMap:new Map(),
|
|
// 选中的值
|
|
sel:'',
|
|
// 输入的值转为大写后
|
|
queryVal:'',
|
|
noDataText: '无数据',
|
|
loading: false,
|
|
queryParams:{
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
}
|
|
};
|
|
},
|
|
watch: {
|
|
value(newVal) {
|
|
this.svalue = newVal;
|
|
},
|
|
svalue(newVal, oldVal) {
|
|
this.$emit("input", this.svalue);
|
|
},
|
|
sideCode(newVal) {
|
|
this.queryData();
|
|
}
|
|
},
|
|
created() {
|
|
if(this.isInitiated || this.svalue!=null){
|
|
this.queryData();
|
|
}
|
|
},
|
|
methods: {
|
|
onChange(val) {
|
|
this.svalue = val;
|
|
let selData=this.filterMap[val];
|
|
console.log(selData);
|
|
this.$emit('onChange', selData)
|
|
},
|
|
remoteMethod(queryVal) {
|
|
this.queryParams.pageNum=1;
|
|
this.queryParams.nickName=queryVal;
|
|
this.queryData();
|
|
},
|
|
loadmore() {
|
|
this.queryParams.pageNum++;
|
|
this.queryData();
|
|
},
|
|
queryData() {
|
|
listUser(this.queryParams).then(response => {
|
|
console.log(response.rows);
|
|
this.filterData= response.rows
|
|
this.filterData.forEach(item => {
|
|
this.filterMap[item.userId]=item;
|
|
});
|
|
});
|
|
},
|
|
|
|
|
|
}
|
|
};
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.el-s-thead{
|
|
width: 100%;
|
|
color: rgb(177 47 41);
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
display: inline-flex;
|
|
padding: 10px;
|
|
border-bottom: 1px solid #e6e3e3;
|
|
min-width: 500px;
|
|
}
|
|
|
|
.el-data{
|
|
width: 100%;
|
|
color: #000;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
display: inline-flex;
|
|
padding: 5px;
|
|
border-bottom: 1px solid #e6e3e3;
|
|
}
|
|
|
|
.select-down {
|
|
position: absolute;
|
|
top: 50%;
|
|
right: 10px;
|
|
transform: translateY(-50%);
|
|
transition: all 0.5s;
|
|
&.rotate180 {
|
|
transform: translateY(-50%) rotate(180deg);
|
|
}
|
|
}
|
|
|
|
|
|
</style>
|