我如何在导入之后留下更新时间

我导出ABC的数据填入D列的数据,如何在D列编辑后增加更新时间image.png

FineReport callie 发布于 2025-2-13 09:53
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
snrtuemcLv8专家互助
发布于2025-2-13 09:55

D列控件编辑后事件,写js如下

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; //行号

//var myDate = new Date();

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

   // 获取日期与时间

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

  • callie callie(提问者) 我在D列的编辑后增加了,确实手动编辑会在更新列留下时间,但是我通过导入EXCEL就不行
    2025-02-13 10:30 
  • snrtuemc snrtuemc 回复 callie(提问者) 导入是不会触发的,你要编辑后才会,导入的话,直接excel直接设置好时间把
    2025-02-13 10:31 
  • callie callie(提问者) 回复 snrtuemc 导入的话是不是我可以通过填报里面的时间弄
    2025-02-13 10:33 
  • snrtuemc snrtuemc 回复 callie(提问者) 也是可以的,直接单元格写公式=now(),
    2025-02-13 10:36 
  • callie callie(提问者) 回复 snrtuemc 但是我写了=NOW()之后 就会全部更新了,没办法点未修改不更新了
    2025-02-13 10:38 
  • 2关注人数
  • 19浏览人数
  • 最后回答于:2025-2-13 09:55
    请选择关闭问题的原因
    确定 取消
    返回顶部