this.initagdata = [{UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "000000-32767",OperatorName: "超级管理员",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T11:16:27",Qrt: 1,MinAccountTime: "2019-07-16T11:16:12",MaxAccountTime: "2019-07-16T11:16:12",CashPay: 45.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "000000-32767",OperatorName: "超级管理员",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T09:47:20",Qrt: 1,MinAccountTime: "2019-07-16T09:47:08",MaxAccountTime: "2019-07-16T09:47:08",CashPay: 54.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "000000-32767",OperatorName: "超级管理员",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T09:37:33",Qrt: 1,MinAccountTime: "2019-07-16T09:37:19",MaxAccountTime: "2019-07-16T09:37:19",CashPay: 92.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "000000-32767",OperatorName: "超级管理员",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T09:45:41",Qrt: 1,MinAccountTime: "2016-07-16T09:45:27",MaxAccountTime: "2019-11-16T09:45:27",CashPay: 45.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "000000-32767",OperatorName: "超级管理员",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T11:11:49",Qrt: 1,MinAccountTime: "2019-07-16T11:09:23",MaxAccountTime: "2019-07-16T11:09:23",CashPay: 46.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "001001-8003",OperatorName: "程博平",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T11:55:40",Qrt: 1,MinAccountTime: "2019-07-16T11:55:26",MaxAccountTime: "2019-07-16T11:55:26",CashPay: 45.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "001001-8002",OperatorName: "崔勇",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T11:02:04",Qrt: 1,MinAccountTime: "2019-07-16T10:37:40",MaxAccountTime: "2019-07-16T10:38:26",CashPay: 92.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "001001-8002",OperatorName: "崔勇",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T11:38:26",Qrt: 1,MinAccountTime: "2019-07-16T11:33:49",MaxAccountTime: "2019-07-16T11:33:49",CashPay: 45.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "001001-8001",OperatorName: "徐文龙",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-10T17:17:31",Qrt: 1,MinAccountTime: "2019-07-10T16:49:37",MaxAccountTime: "2019-07-10T17:16:07",CashPay: 95.0}, {UnitId: "001001",UnitName: "修水县第一人民医院",TeamchkOperatorId: null,TeamchkOperator: null,FdchkOperatorId: null,FdchkOperator: null,TeamchkDt: "0001-01-01T00:00:00",FdchkDt: "0001-01-01T00:00:00",Operator: "001001-8001",OperatorName: "徐文龙",Summary: null,DaylyId: null,Checked: 0,DaylyTime: "2019-07-16T09:28:51",Qrt: 1,MinAccountTime: "2019-07-16T09:25:37",MaxAccountTime: "2019-07-16T09:25:37",CashPay: 9.0}]var temp = {};for (var i in this.initagdata) {var key = this.initagdata[i].Operator;if (temp[key]) {temp[key].CashPay += Number(this.initagdata[i].CashPay);temp[key].Operator = this.initagdata[i].Operator;temp[key].UnitId = this.initagdata[i].UnitId;temp[key].UnitName = this.initagdata[i].UnitName;// temp[key].TeamchkOperatorId = this.initagdata[i].TeamchkOperatorId; //班组核销人id// temp[key].TeamchkOperator = this.initagdata[i].TeamchkOperator;   //班组核销人// temp[key].FdchkOperatorId = this.initagdata[i].FdchkOperatorId; //财务核销人id// temp[key].FdchkOperator = this.initagdata[i].FdchkOperator;  //财务核销人// temp[key].TeamchkDt = this.initagdata[i].TeamchkDt; //班组核销时间// temp[key].FdchkDt = this.initagdata[i].FdchkDt; //财务核销时间temp[key].OperatorName = this.initagdata[i].OperatorName; //收费员姓名// temp[key].Summary = this.initagdata[i].Summary;  //摘要// temp[key].DaylyId = this.initagdata[i].DaylyId;  //日报号temp[key].Checked = this.initagdata[i].Checked;  //选择// temp[key].DaylyTime = this.initagdata[i].DaylyTime; //日报时间temp[key].Qrt += Number(this.initagdata[i].Qrt);  //日报笔数temp[key].MinAccountTime = new Date(temp[key].MinAccountTime).getTime() < new Date(this.initagdata[i].MinAccountTime).getTime() ? temp[key].MinAccountTime : this.initagdata[i].MinAccountTime; //第一笔业务时间temp[key].MaxAccountTime = new Date(temp[key].MaxAccountTime).getTime() > new Date(this.initagdata[i].MaxAccountTime).getTime() ? temp[key].MaxAccountTime : this.initagdata[i].MaxAccountTime; //最后一笔业务时间} else {temp[key] = {};temp[key].CashPay = Number(this.initagdata[i].CashPay);temp[key].Operator = this.initagdata[i].Operator;temp[key].UnitId = this.initagdata[i].UnitId;temp[key].UnitName = this.initagdata[i].UnitName;// temp[key].TeamchkOperatorId = this.initagdata[i].TeamchkOperatorId;// temp[key].TeamchkOperator = this.initagdata[i].TeamchkOperator;// temp[key].FdchkOperatorId = this.initagdata[i].FdchkOperatorId;// temp[key].FdchkOperator = this.initagdata[i].FdchkOperator;// temp[key].TeamchkDt = this.initagdata[i].TeamchkDt;// temp[key].FdchkDt = this.initagdata[i].FdchkDt;temp[key].OperatorName = this.initagdata[i].OperatorName;// temp[key].Summary = this.initagdata[i].Summary;// temp[key].DaylyId = this.initagdata[i].DaylyId;temp[key].Checked = this.initagdata[i].Checked;// temp[key].DaylyTime = this.initagdata[i].DaylyTime;temp[key].Qrt = Number(this.initagdata[i].Qrt);temp[key].MinAccountTime = this.initagdata[i].MinAccountTime;temp[key].MaxAccountTime = this.initagdata[i].MaxAccountTime;}}var newArry = [];for (var k in temp) {newArry.push(temp[k])}console.log(newArry)

  

转载于:https://www.cnblogs.com/LFxanla/p/11358077.html

对象数组中根据某个属性名的值相同,求某一项的和。相关推荐

  1. js 加总数组中某一列_js根据对象数组中某一属性值,合并相同项,并对某一属性累加处理...

    js根据对象数组中某一属性值,合并相同项,并对某一属性累加处理 Example: 根据code合并数组,并将sl值累加,如下两种方法: let data = [{ code: 1001, name: ...

  2. JS对象数组中依据某个属性的值分组

    问题:需要在对象数组中根据某个属性值进行归类或者分组 const dataList = [{name: 'Apple',type: 'Fruit',price: '¥1.5'},{name: 'Ban ...

  3. JavaScript - 根据对象数组中某一属性删除该项(根据数组对象属性删除里面的对象)

    前言 有时候,我们需要根据 某一属性与属性值 找到数组对象中对应的该项. 例如,现有如下结构数组对象: 解决方案 由于使用了 splice() 方法,顾会改变原始数组. 以下函数做了封装,只需要传入相 ...

  4. js对象数组中的某属性值 拼接成字符串

    var arr=[{id: "600", pId: null, name: "图形的变化"},{id: "630", pId: " ...

  5. 【关于js数组对象一道题】将数组对象中的英文属性名替换为中文属性名

    将数组对象中的英文属性名替换为中文属性名 const arr = [{name: '张三', age: 18, address: '湖北'}, {name: '李四', age: 18, addres ...

  6. 通过属性值从对象数组中获取JavaScript对象[重复]

    本文翻译自:Get JavaScript object from array of objects by value of property [duplicate] This question alr ...

  7. js计算对象数组中某个属性合计

    js 计算对象数组中某个属性合计 countTotal调用示例: let arr = [{id: 0, price: 199.88},{id: 1, price: 299.88},{id: 2, pr ...

  8. 查找对象数组中某属性的最大最小值

    查找对象数组中某属性的最大最小值的快捷方法 例如要查找array数组中对象的value属性的最大值,这里记为maxVal var array=[{"index_id": 119,& ...

  9. es6 数组找最大值_在对象数组中查找属性的最大值

    我正在寻找一种非常快速,干净且有效的方法来获取以下JSON切片中的最大" y"值: [ { "x": "8/11/2009", " ...

  10. 通过ID在JavaScript对象数组中查找对象

    本文翻译自:Find object by id in an array of JavaScript objects I've got an array: 我有一个数组: myArray = [{'id ...

最新文章

  1. 关于学习Python的一点学习总结(10->设置字符串格式)
  2. 时间序列的自回归理论和实现
  3. sql优化ppt_Spark优化 | Spark 3.0 中七个必须知道的 SQL 性能优化
  4. QQ采用什么传输协议?
  5. Python Numpy学习手册(翻译自斯坦福大学 CS231n: Convolutional Neural Networks for Visual Recognition)
  6. 编程之美-构造数独方法整理
  7. python中反向切片用法_使用Python中的切片[:0:-1]反转列表
  8. 三种Fibonacci数列第n项计算方法及其优劣分析
  9. 字符、字符集和字符编码详解(一文扫清疑惑)
  10. 搭建自己的博客(二十):优化博客评论功能
  11. TTPlayer越来越靓了
  12. 【2019南京网络赛:F】Greedy Sequence(set/线段树 + 思维)
  13. Ubuntu安装rz sz
  14. qiankun 出现[import-html-entry]: error occurs while executing normal script
  15. Microbiome | 水科院南海所姜敬哲团队揭示滤食性牡蛎体内巨大的病毒多样性
  16. Aveva.Bocad.v2.1-ISO 1DVD(钢结构详图设计软件)
  17. linux waitpid 用法,linux的fork(),waitpid()及wait()的用法
  18. linux网卡驱动离线安装_手动安装linux网卡驱动方法
  19. 机器学习算法-KMeans聚类算法解析及伪代码实现。
  20. linux系统常用性能参数命令

热门文章

  1. 【cocos】Sprite九宫格拉伸SLICED
  2. Unityt涂抹擦除功能
  3. 网易公开课付费视频没有加密,可以随意下载到本地
  4. 学前端,学线下班还是丁鹿学堂或者慕课网?
  5. tpshop index.php,第三讲、TPshop linux安装
  6. HDU 6438 Buy and Resell (优先队列 or 贪心)
  7. proteus虚拟串口实现
  8. 利用Oh-My-Zsh打造你的超级终端
  9. 国内外CRM系统软件功能对比
  10. 基于51单片机的gps定位系统