liunan #10

Merged
liunan merged 47 commits from liunan into master 2024-09-13 14:43:34 +08:00
4 changed files with 48 additions and 23 deletions
Showing only changes of commit b74f0ca3fc - Show all commits

View File

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

View File

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

View File

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

View File

@ -52,11 +52,15 @@
}, },
methods: { methods: {
handleSizeChange(e){ handleSizeChange(e){
if(this.$listeners.onSizeChange){
this.$emit('onSizeChange',e); this.$emit('onSizeChange',e);
}
}, },
handleCurrentChange(e){ handleCurrentChange(e){
if(this.$listeners.onCurrentChange){
this.$emit('onCurrentChange',e); this.$emit('onCurrentChange',e);
} }
}
}, },
}; };
</script> </script>