vue dateinfo绑定

            <el-row>
                <el-col :span="8">
                    <el-form-item label="抽奖时间:" required>
                        <el-form-item prop="DrawTimeInfo">
                            <el-date-picker type="daterange" v-model="DrawTimeInfo" value-format="yyyy-MM-dd"
                                            align="right"
                                            unlink-panels
                                            range-separator="至"
                                            start-placeholder="开始日期"
                                            end-placeholder="结束日期" style="width:100%">
                            </el-date-picker>
                        </el-form-item>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-row>
                <el-col :span="8">
                    <el-form-item label="领取截止时间:" required>
                        <el-form-item prop="ReceiveUpTime">
                            <el-date-picker v-model="model.ReceiveUpTime" type="date" placeholder="选择日期" :picker-options="checkTime(model.EndTime,model.ReceiveUpTime)" value-format="yyyy-MM-dd" style="width:100%"></el-date-picker>
                        </el-form-item>
                    </el-form-item>
                </el-col>
            </el-row>






  data: {
               DrawTimeInfo: [],//时间     
            },


methods: {
               checkTime: function (Starttime, Validtime) {
                   if (this.DrawTimeInfo !== null && this.DrawTimeInfo.length > 0) {
                       if (this.DrawTimeInfo[0].constructor == String) {
                           this.model.StartTime = this.DrawTimeInfo[0];
                           this.model.EndTime = this.DrawTimeInfo[1];
                       } else {
                           this.model.StartTime = this.DrawTimeInfo[0].format("yyyy-MM-dd");
                           this.model.EndTime = this.DrawTimeInfo[1].format("yyyy-MM-dd");
                       }
                   }
                   if (Starttime == null) {
                       Starttime = this.model.EndTime;
                   }
                   if (Starttime && Validtime) {
                       if (Starttime > Validtime) {
                           this.$message.warning("领取截止时间不能小于结束日期");
                       }
                   }
               },

                //编辑 获取实例
                GetModel: function () {
                    var self = this;
                    sa.ajax('/Activity/GetModel/@ViewBag.id', {}, function (res) {
                        if (res != null) {
                            self.model = res;
                            self.DrawTimeInfo = [res.StartTime, res.EndTime];
                           
                        }// 数据
                    }.bind(this), { type: "get" });
               },
                 //确定
               ok: function () {
                   let self = this;
                    this.model.StartTime = null;
                    this.model.EndTime = null;
                    if (this.DrawTimeInfo !== null && this.DrawTimeInfo.length > 0) {
                        this.model.StartTime = this.DrawTimeInfo[0];
                        this.model.EndTime = this.DrawTimeInfo[1];
                    }
                    this.$refs['model'].validate((flgs,object) => {
                        if (!flgs) {
                             return false;
                        }
                        sa.ajax('/Activity/Edit', { model: self.model  }, function (res) {
                            if (res.Status) {
                                sa.alert(res.Message, res.Status, function () {
                                    parent.app.f5();
                                    sa.closeCurrIframe();
                                });
                            } else {
                                sa.error(res.Message, res.Status, function () {
                                });
                            }
                        }.bind(this));
                    });
                },

        }

 

上一篇:Angular+golang+postgres+docker实现web聊天+用户管理之Angular


下一篇:recon-ng