增加记录的时间问题

image.png设置的是now,但是第一行会变成当前时间,可以避免吗

FineReport yzmi4wK81733224 发布于 2023-2-6 17:15
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
1
Z4u3z1Lv6专家互助
发布于2023-2-6 17:18(编辑于 2023-2-6 17:23)

插入行的点击事件:

Date.prototype.Format = function (fmt) { // author: meizz

  var o = {

    "M+": this.getMonth() + 1, // 月份

    "d+": this.getDate(), // 日

    "h+": this.getHours(), // 小时

    "m+": this.getMinutes(), // 分

    "s+": this.getSeconds(), // 秒

    "q+": Math.floor((this.getMonth() + 3) / 3), // 季度

    "S": this.getMilliseconds() // 毫秒

  };

  if (/(y+)/.test(fmt))

    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));

  for (var k in o)

    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));

      return fmt;

}

var a = this.getValue();

var location = this.options.location; //获取当前控件的位置

var cr = FR.cellStr2ColumnRow(location);

var col = cr.col; //列号

var ro = cr.row; //行号

//if (a == '1') {

//var myDate = new Date();

var b=new Date().Format("yyyy-MM-dd hh:mm:ss");

   // 获取日期与时间

contentPane.setCellValue(0, col+1, ro, b);

//}

----------

用这个JS

image.png

不好意思 上面多了判断 ,已删除更新

最佳回答
0
就TM你叫夏洛啊Lv6中级互助
发布于2023-2-6 17:22

这个应该是公式直接导致的,这个单元格你直接放字段值,然后在填报的时候判断单元格的值来去当前值还是之前有的值,公式:if(len(单元格位置)=0,now(),单元格位置),就样就不会影响已录入数据的时间问题了

  • 2关注人数
  • 204浏览人数
  • 最后回答于:2023-2-6 17:23
    请选择关闭问题的原因
    确定 取消
    返回顶部