var layer = layui.layer, form = layui.form, table = layui.table; var $ = layui.$; /*select gysmc,zyzw ,xm ,sjhm ,bgshm ,emilyx , zgsrgzwsj ,zggsgl ,cast(gysxxid as int) as gysxxid, pc, gysryxxMdataID as ID,sjbs from gysryxxMdata*/ var tableInit = table.render({ elem: ‘#tbgysplay‘ , method: ‘post‘ , data: jsonData , height: "auto" , id: "tbgysplay" , text: {none: ‘暂无相关数据‘} , toolbar: "#toolbarplan" , cols: [[ {type: "checkbox", fixed: "left", width: 50} , { field: "number", title: "序号", width: ‘5%‘, align: "left", templet: function (data) { return data.LAY_INDEX } } , {field: "ID", title: "ID", align: "left", hide: true} , {field: "action", title: "action", align: "left", hide: true} , {field: "sjbs", title: "sjbs", align: "left", hide: true} , {field: "供应商名称", title: "供应商名称", width: ‘20%‘, align: "left"} , {field: "主要产品类型", title: "主要产品类型", width: ‘20%‘, align: ‘left‘} , {field: "所在省份", title: "所在省份", width: ‘15%‘, align: ‘left‘} , { field: "PSA计划时间", title: "PSA计划时间", width: ‘20%‘, align: ‘left‘, edit: ‘select‘, templet: function (d) { return ‘<input type="text" name="rzrq" verify lay-verify="verify" value="‘ + (d.rzrq || ‘‘) + ‘" placeholder="请选择时间" readonly="readonly" class="layui-input layui-input-date" style="text-align: center"/>‘; } } , {field: "PSA计划负责人", title: "PSA计划负责人", width: ‘20%‘, align: ‘left‘, edit: ‘text‘} ]] , done: function () {//当数据渲染完后,执行的回调 //日期控件 $(".layui-input-date").each(function (i) { layui.laydate.render({ elem: this, format: "yyyy-MM-dd", done: function (value, date) { if (res && res.data[i]) { $.extend(res.data[i], {‘rzrq‘: value}) } } }); }); layer.closeAll(); } }); //双击编辑行 table.on(‘edit(tbgysplay)‘, function (obj) { //检验格式 电话 办公室电话 邮箱 });
原文地址:https://www.cnblogs.com/luo1240465012/p/11423207.html
时间: 2024-11-01 17:38:17