md
This commit is contained in:
parent
330a5d86bb
commit
d124371006
146
src/views/emis/EmisBaseTools/AjustApplyTypePicker.vue
Normal file
146
src/views/emis/EmisBaseTools/AjustApplyTypePicker.vue
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<template>
|
||||||
|
<el-select
|
||||||
|
style="width:100%"
|
||||||
|
ref="selectRef"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
remote
|
||||||
|
:remote-method="queryData"
|
||||||
|
v-model="svalue"
|
||||||
|
:placeholder="placeholder"
|
||||||
|
auto-complete="false"
|
||||||
|
:disabled="disabled"
|
||||||
|
no-data-text=""
|
||||||
|
allow-create
|
||||||
|
@blur="onBlur"
|
||||||
|
@change="onChange"
|
||||||
|
@click.native="onClick"
|
||||||
|
@visible-change="reverseArrow"
|
||||||
|
>
|
||||||
|
<el-option v-for="(item,index) in optionItems" :key="index" :label="item.typeName" :value="item.typeCode" ></el-option>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import emitter from 'element-ui/src/mixins/emitter';
|
||||||
|
import { listEmisWaybillAjustType } from "@/api/emis/emisWaybillAjustType";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "AjustApplyTypePicker",
|
||||||
|
mixins: [emitter],
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
placeholder: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
disabled:{
|
||||||
|
type: [Boolean,String],
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading:false,
|
||||||
|
|
||||||
|
svalue: this.value,
|
||||||
|
optionItems: [],
|
||||||
|
// 缺省值
|
||||||
|
defaultItems: null,
|
||||||
|
itemMap:new Map(),
|
||||||
|
|
||||||
|
queryParams:{
|
||||||
|
pageNum:1,
|
||||||
|
pageSize:100,
|
||||||
|
settleType:null,
|
||||||
|
settleName:null
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(newVal,oldVal) {
|
||||||
|
this.svalue=this.value;
|
||||||
|
// this.queryData(null,this.svalue);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
let rulesDom = this.$refs["selectRef"].$el.querySelector(".el-input .el-input__suffix .el-input__suffix-inner .el-input__icon"); // 找到dom
|
||||||
|
rulesDom.classList.add("el-icon-arrow-up"); // 对dom新增class
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// if(this.svalue!=null){
|
||||||
|
// this.queryData(null,this.svalue);
|
||||||
|
// }
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onClick(){
|
||||||
|
// 第一次点击时需要初始化
|
||||||
|
if(!this.defaultItems){
|
||||||
|
this.queryData(null,null);
|
||||||
|
}else{
|
||||||
|
this.optionItems = [...this.defaultItems];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onChange() {
|
||||||
|
this.$emit("input", this.svalue);
|
||||||
|
let itemData = this.optionItems.find(item => item.siteCode == this.svalue);
|
||||||
|
this.$emit("onChange",itemData);
|
||||||
|
},
|
||||||
|
onClear(){
|
||||||
|
this.$emit("input", this.svalue);
|
||||||
|
this.$emit("onChange",null);
|
||||||
|
},
|
||||||
|
onBlur(val){
|
||||||
|
this.$emit("input", this.svalue);
|
||||||
|
this.dispatch('ElFormItem', 'el.form.blur');
|
||||||
|
},
|
||||||
|
queryData(val,key) {
|
||||||
|
this.optionItems=[];
|
||||||
|
this.queryParams.settleName=val;
|
||||||
|
|
||||||
|
listEmisWaybillAjustType(this.queryParams).then(response => {
|
||||||
|
this.optionItems=response.rows;
|
||||||
|
// 初始值存储
|
||||||
|
if(key==null && val==null){
|
||||||
|
this.defaultItems=[...this.optionItems]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
reverseArrow(flag) {
|
||||||
|
let rulesDom = this.$refs["selectRef"].$el.querySelector(
|
||||||
|
".el-input .el-input__suffix .el-input__suffix-inner .el-input__icon"
|
||||||
|
); // 找到dom
|
||||||
|
if (flag) {
|
||||||
|
rulesDom.classList.add("is-reverse"); // 对dom新增class
|
||||||
|
} else {
|
||||||
|
rulesDom.classList.remove("is-reverse"); // 对dom新增class
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
// right: 30px;
|
||||||
|
// cursor: pointer;
|
||||||
|
:deep .el-select.remote-select{
|
||||||
|
.el-select__caret::before{
|
||||||
|
content: '\e6e1';
|
||||||
|
}
|
||||||
|
.is-focus{
|
||||||
|
.el-select__caret{
|
||||||
|
transform: rotateZ(0deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user