This commit is contained in:
ln1778 2024-09-09 15:24:33 +08:00
parent 2f9ddc22c0
commit b74f0ca3fc
4 changed files with 48 additions and 23 deletions

View File

@ -184,19 +184,27 @@ export default {
if (this.range) {
if (!isEmpty(value) && value.length === 2 && value[0] && value[1]) {
if(this.showTime){
this.$emit("change", value);
if(this.$listeners.change){
this.$emit("change", value);
}
}else{
this.$emit("change", [
`${value[0]} 00:00:00`,
`${value[1]} 23:59:59`,
]);
if(this.$listeners.change){
this.$emit("change", [
`${value[0]} 00:00:00`,
`${value[1]} 23:59:59`,
]);
}
}
} else {
this.$emit("change", []);
if(this.$listeners.change){
this.$emit("change", []);
}
}
} else {
this.$emit("change", value);
if(this.$listeners.change){
this.$emit("change", value);
}
}
},
});
@ -221,8 +229,7 @@ export default {
},
watch: {
value: {
handler(newVal) {
console.log(newVal,'datevalue');
handler(newVal) {
if (Array.isArray(newVal)&&this.range){
this.dateArr = [newVal[0] || "", newVal[1] || ""];
} else {

View File

@ -152,10 +152,15 @@ export default {
},
methods: {
onSelect(value){
this.$emit("change", [value, this.value[1]||""]);
if(this.$listeners.change){
this.$emit("change", [value, this.value[1]||""]);
}
},
onInputChange(val){
this.$emit("change", [this.values[0] ||"",val]);
if(this.$listeners.change){
this.$emit("change", [this.values[0] ||"",val]);
}
},
getStringWidth(text) {
let font = "13px";
@ -186,7 +191,10 @@ export default {
},
search(){
this.imeipopover=false;
this.$emit("onSrarch", this.value);
if(this.$listeners.onSrarch){
this.$emit("onSrarch", this.value);
}
},
getAfterAgo(attr, prefix) {
const config = {};

View File

@ -59,7 +59,8 @@
model: {
prop: 'values', // prop 'value'
event: 'onSearch' // value
}, mounted(){
},
mounted(){
let newinput=this.inputs.map((g)=>g.label);
this.placeholder="请选择"+newinput.join("/");
},
@ -73,6 +74,10 @@
}
},
methods: {
onReset(){
this.values={};
this.$emit('onSearch',this.values);
},
onSelect(value,item,index){
item.value=value;
this.$set(this.inputs,index,item);
@ -84,24 +89,25 @@
g.options.find((f)=>f.value==g.value).label&&(newplaceholderValue.push(g.options.find((f)=>f.value==g.value).label));
}
});
this.$emit('change',newvalues);
if(this.$listeners.change){
this.$emit('change',newvalues);
}
this.values=newvalues;
this.placeholderValue=newplaceholderValue.join("/")
},
onCancel(){
this.popState=false;
this.$emit('cancel');
if(this.$listeners.onCancel){
this.$emit('onCancel');
}
},
onQuery(){
console.log(this.$refs.queryformref,'this.$refs.queryformref');
onQuery(){
if(this.$refs.queryformref){
this.$refs.queryformref.validate((valid) => {
console.log(valid,"valid");
this.$refs.queryformref.validate((valid) => {
if (valid) {
this.$emit('onSearch',this.values);
this.popState=false;
} else {
console.log('error submit!!');
} else {
return false;
}
});

View File

@ -52,10 +52,14 @@
},
methods: {
handleSizeChange(e){
this.$emit('onSizeChange',e);
if(this.$listeners.onSizeChange){
this.$emit('onSizeChange',e);
}
},
handleCurrentChange(e){
this.$emit('onCurrentChange',e);
if(this.$listeners.onCurrentChange){
this.$emit('onCurrentChange',e);
}
}
},
};