ui-grid从后端获取数据后更改数据显示的格式

从后端获取的数据时是这样的:

{
  "TotalCount":14,"Items":
  [
    {
      "ProfileId":14,
      "Name":"网站分析-测试3",
      "LastModifyTime":"2017-07-26T10:59:45.5433333",
      "PlanId":3733310,"BatchId":53,
        }
    ]
}            

想改变“时间的显示格式”和“为数字加上千位符号”,代码如下:

              self.$scope.gridOptions.data = [];
              self.analyzeService.getAnalyzeProfile(self.$scope.gridDataOption, self.$scope.onlyMine).then(function (res) {
                  let datas = res.Items;
                  self.$scope.gridOptions.data = _.map(datas, item => {
                      item.CrawlCountShow = item.CrawlCount.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' +  ',')
                      item.LastModifyTime = self.formatDate(new Date(item.LastModifyTime));
                      return item;
                  });
             });

 

posted @ 2017-07-26 11:17  ฅ˙-˙ฅ  阅读(1181)  评论(0编辑  收藏  举报