Authored by weiqingting

时间控件

@@ -101,6 +101,7 @@ @@ -101,6 +101,7 @@
101 return 101 return
102 } 102 }
103 this.dateTime.date=value.day 103 this.dateTime.date=value.day
  104 + this.dateTime._hasdefault=true
104 this.mo='' 105 this.mo=''
105 }, 106 },
106 tomonth(){ 107 tomonth(){
@@ -47,6 +47,7 @@ export default { @@ -47,6 +47,7 @@ export default {
47 selectMonth(value){ 47 selectMonth(value){
48 this.dateTime.month=+value-1 48 this.dateTime.month=+value-1
49 this.mo='' 49 this.mo=''
  50 + this.dateTime._hasdefault=true
50 } 51 }
51 }, 52 },
52 ready() { 53 ready() {
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 } 21 }
22 </style> 22 </style>
23 <template> 23 <template>
24 - <input type="text" class="form-control" @click="showCalendar" :value="date"> 24 + <input type="text" class="form-control" @click="showCalendar" :value="date" :placeholder="placeholder">
25 <div class="datepicker datepicker-dropdown dropdown-menu vue-show" :style="{'left':x+'px','top':y+'px'}" v-show="isshow"> 25 <div class="datepicker datepicker-dropdown dropdown-menu vue-show" :style="{'left':x+'px','top':y+'px'}" v-show="isshow">
26 <date-days :date-time.sync="dateTime" :mo.sync="mo" :state="state" v-show="mo==='day'"></date-days> 26 <date-days :date-time.sync="dateTime" :mo.sync="mo" :state="state" v-show="mo==='day'"></date-days>
27 <date-months :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='month'"></date-months> 27 <date-months :date-time.sync="dateTime" :mo.sync="mo" v-show="mo==='month'"></date-months>
@@ -33,7 +33,8 @@ import dateMonths from "./dateMonths.vue" @@ -33,7 +33,8 @@ import dateMonths from "./dateMonths.vue"
33 export default { 33 export default {
34 props:{ 34 props:{
35 value:{ 35 value:{
36 - type:String 36 + type:String,
  37 + default:''
37 }, 38 },
38 state:{ 39 state:{
39 type:String, 40 type:String,
@@ -42,6 +43,10 @@ import dateMonths from "./dateMonths.vue" @@ -42,6 +43,10 @@ import dateMonths from "./dateMonths.vue"
42 format:{ 43 format:{
43 type:String, 44 type:String,
44 default:"yyyy-MM-dd" 45 default:"yyyy-MM-dd"
  46 + },
  47 + placeholder:{
  48 + type:String,
  49 + default:'选择时间'
45 } 50 }
46 }, 51 },
47 components:{ 52 components:{
@@ -69,10 +74,10 @@ import dateMonths from "./dateMonths.vue" @@ -69,10 +74,10 @@ import dateMonths from "./dateMonths.vue"
69 }, 74 },
70 computed:{ 75 computed:{
71 date(){ 76 date(){
72 - if(this.dateTime.year){ 77 + if(this.dateTime.year&&this.dateTime._hasdefault){
73 this.value=this.showDate(this.dateTime,this.format); 78 this.value=this.showDate(this.dateTime,this.format);
74 } 79 }
75 - return this.showDate(this.dateTime,this.format); 80 + return this.value;
76 }, 81 },
77 isshow(){ 82 isshow(){
78 return this.mo?true:false; 83 return this.mo?true:false;
@@ -116,9 +121,13 @@ import dateMonths from "./dateMonths.vue" @@ -116,9 +121,13 @@ import dateMonths from "./dateMonths.vue"
116 date:dateTime.getDate(), 121 date:dateTime.getDate(),
117 hour:dateTime.getHours(), 122 hour:dateTime.getHours(),
118 minute:dateTime.getMinutes(), 123 minute:dateTime.getMinutes(),
119 - second:dateTime.getSeconds() 124 + second:dateTime.getSeconds(),
  125 + _hasdefault:this.value?true:false
120 } 126 }
  127 + if(this.value){
121 this.value=this.showDate(this.dateTime,this.format); 128 this.value=this.showDate(this.dateTime,this.format);
122 } 129 }
  130 +
  131 + }
123 } 132 }
124 </script> 133 </script>
@@ -77,13 +77,18 @@ @@ -77,13 +77,18 @@
77 required: true 77 required: true
78 } 78 }
79 }, 79 },
  80 + data(){
  81 + return {
  82 + params:{}
  83 + }
  84 + },
80 methods: { 85 methods: {
81 getParam:function(param){ 86 getParam:function(param){
82 var me=this; 87 var me=this;
83 - param=param||{};  
84 - param.page=me.page||1;  
85 - param.size=me.pageSize;  
86 - return param; 88 + me.params=param||me.params;
  89 + me.params.page=me.page||1;
  90 + me.params.size=me.pageSize;
  91 + return me.params;
87 }, 92 },
88 resquest:function(param){ 93 resquest:function(param){
89 var me=this; 94 var me=this;