组件-日期-PlgForm.laydate
每次用都是忘,存一下
//表单配置 var formcfg = { renderer: "body-view", items: [ { type: "settings", labelWidth: 100, position: "label-left", labelAlign: "right" }, { className: "layui-col-md4", type: "laydate", name: "data02", label: "双日期:", placeholder: '请输入双日期', dateFormat: "yyyy-MM-dd", dateType:"date", range: '~', // 连接符用range定义 value: '' // 默认值 } ] }; var form1 = new PlgForm(formcfg); // 赋值 form1.setFormData({data02: '2017-09-11 ~ 2017-10-01'}) form1.setItemValue("data02",'2017-09-11 - 2017-10-10') //查询时过滤 if (typeof p.billdate != "object") p.billdate = p.billdate.split(" - "); if (!p.billdate.length) { p.billdate = dt.split(" - "); } p.begindate = p.billdate && p.billdate.length ? Prolog.formatDate(p.billdate[0]) + " 00:00:00" : ""; p.enddate = p.billdate && p.billdate.length ? Prolog.formatDate(p.billdate[1]) + " 23:59:59" : ""; delete p.billdate; grid.setParams(JSON.stringify(p)); grid.reload();