SOURCE

//我是表彰金额输入,替换 = 后面的就行
var biaozhangMoney = [{"id":1,"company":"两湖街道办","rewardmoney":5},{"id":2,"company":"朱曲镇","rewardmoney":1},{"id":3,"company":"蔡庄镇","rewardmoney":0.5},{"id":4,"company":"永兴镇","rewardmoney":0.5},{"id":5,"company":"张市镇","rewardmoney":2},{"id":6,"company":"十八里镇","rewardmoney":2},{"id":7,"company":"水坡镇","rewardmoney":1.5},{"id":8,"company":"邢庄乡","rewardmoney":1.5},{"id":9,"company":"庄头镇","rewardmoney":1},{"id":10,"company":"门楼任乡","rewardmoney":2},{"id":11,"company":"大桥乡","rewardmoney":1},{"id":12,"company":"小陈乡","rewardmoney":1.5},{"id":13,"company":"先进制造业开发区","rewardmoney":3},{"id":14,"company":"检察院","rewardmoney":0.3},{"id":15,"company":"宣传部","rewardmoney":1.3},{"id":16,"company":"政法委","rewardmoney":0.5},{"id":17,"company":"总工会","rewardmoney":0.6},{"id":18,"company":"政数局","rewardmoney":0.3},{"id":19,"company":"县志办","rewardmoney":0.3},{"id":20,"company":"农业农村局","rewardmoney":1},{"id":21,"company":"水利局","rewardmoney":0.6},{"id":22,"company":"农机中心","rewardmoney":0.5},{"id":23,"company":"科工信局","rewardmoney":0.5},{"id":24,"company":"公路局","rewardmoney":0.3},{"id":25,"company":"发改委","rewardmoney":1.1},{"id":26,"company":"重点项目办","rewardmoney":0.6},{"id":27,"company":"城管局","rewardmoney":0.3},{"id":28,"company":"税务局","rewardmoney":0.3},{"id":29,"company":"司法局","rewardmoney":0.3},{"id":30,"company":"教体局","rewardmoney":0.5},{"id":31,"company":"卫健委","rewardmoney":0.8999999999999999},{"id":32,"company":"医保局","rewardmoney":0.5},{"id":33,"company":"社保中心","rewardmoney":0.3},{"id":34,"company":"机关事务中心","rewardmoney":0.3},{"id":35,"company":"交通运输局","rewardmoney":0.3},{"id":36,"company":"生态环境局","rewardmoney":0.8},{"id":37,"company":"供电公司","rewardmoney":0.6},{"id":38,"company":"文广旅局","rewardmoney":0.3},{"id":39,"company":"人武部","rewardmoney":1},{"id":40,"company":"发改委","rewardmoney":0.5},{"id":41,"company":"市场监管局","rewardmoney":1.2}]


//我是领导表扬金额输入,替换 = 后面的就行
var leaderMoney =[{"id":1,"company":"张市镇","leaderreward":0.5,"leaderpiping":0},{"id":2,"company":"大桥乡","leaderreward":0.52,"leaderpiping":0},{"id":3,"company":"南曹乡","leaderreward":2,"leaderpiping":0},{"id":4,"company":"法院","leaderreward":0.5,"leaderpiping":0},{"id":5,"company":"农业农村局","leaderreward":0.3,"leaderpiping":0},{"id":6,"company":"乡村振兴局","leaderreward":0.3,"leaderpiping":0},{"id":7,"company":"金融工作局","leaderreward":0.6,"leaderpiping":0},{"id":9,"company":"农机中心","leaderreward":0.6,"leaderpiping":0}]



//我是督查局金额输入,替换 = 后面的就行
var duchaMoney = [{"id":1,"company":"两湖街道办","duchareward":0,"duchapiping":-0.5},{"id":2,"company":"朱曲镇","duchareward":0,"duchapiping":-0.5},{"id":3,"company":"蔡庄镇","duchareward":0,"duchapiping":-1},{"id":4,"company":"永兴镇","duchareward":0,"duchapiping":-0.5},{"id":5,"company":"张市镇","duchareward":0,"duchapiping":-0.5},{"id":6,"company":"十八里镇","duchareward":0,"duchapiping":-0.5},{"id":7,"company":"邢庄乡","duchareward":1,"duchapiping":-0.5},{"id":8,"company":"庄头镇","duchareward":1.5,"duchapiping":-0.5},{"id":9,"company":"大营镇","duchareward":0,"duchapiping":-0.5},{"id":10,"company":"岗李乡","duchareward":0,"duchapiping":-0.5},{"id":11,"company":"门楼任乡","duchareward":0.5,"duchapiping":0},{"id":12,"company":"大桥乡","duchareward":0,"duchapiping":-0.5},{"id":13,"company":"县委办","duchareward":0.4,"duchapiping":0},{"id":14,"company":"政府办","duchareward":0.6,"duchapiping":0},{"id":15,"company":"组织部","duchareward":0.2,"duchapiping":0},{"id":16,"company":"政法委","duchareward":0.2,"duchapiping":-0.2},{"id":17,"company":"总工会","duchareward":0.2,"duchapiping":0},{"id":18,"company":"信访局","duchareward":0.2,"duchapiping":0},{"id":19,"company":"科协","duchareward":0.2,"duchapiping":-0.2},{"id":20,"company":"乡村振兴局","duchareward":0.2,"duchapiping":0},{"id":21,"company":"应急管理局","duchareward":0,"duchapiping":-0.2},{"id":22,"company":"农业农村局","duchareward":0.2,"duchapiping":0},{"id":23,"company":"科工信局","duchareward":0.4,"duchapiping":-0.2},{"id":24,"company":"交通局","duchareward":0,"duchapiping":-0.2},{"id":25,"company":"商务局","duchareward":0.4,"duchapiping":0},{"id":26,"company":"发改委","duchareward":0.4,"duchapiping":0},{"id":27,"company":"重点项目办","duchareward":0.4,"duchapiping":0},{"id":28,"company":"住建局","duchareward":0.6,"duchapiping":-0.2},{"id":29,"company":"生态环境局","duchareward":0.2,"duchapiping":0},{"id":30,"company":"统计局","duchareward":0.6,"duchapiping":0},{"id":31,"company":"财政局","duchareward":0.4,"duchapiping":0},{"id":32,"company":"税务局","duchareward":0,"duchapiping":-0.2},{"id":33,"company":"人行","duchareward":0,"duchapiping":-0.2},{"id":34,"company":"公安局","duchareward":0.4,"duchapiping":0},{"id":35,"company":"民政局","duchareward":0.2,"duchapiping":-0.2},{"id":36,"company":"爱卫办","duchareward":0,"duchapiping":-0.2},{"id":37,"company":"红十字会","duchareward":0,"duchapiping":-0.2},{"id":38,"company":"长线局","duchareward":0,"duchapiping":-0.2},{"id":39,"company":"督查局","duchareward":0.2,"duchapiping":0},{"id":40,"company":"工商行","duchareward":0,"duchapiping":-0.2},{"id":41,"company":"合益村镇银行","duchareward":0,"duchapiping":-0.2},{"id":42,"company":"交通局等","duchareward":0,"duchapiping":-0.2},{"id":43,"company":"棉麻公司","duchareward":0,"duchapiping":-0.2},{"id":44,"company":"农发行","duchareward":0,"duchapiping":-0.2},{"id":45,"company":"人保公司","duchareward":0,"duchapiping":-0.2},{"id":46,"company":"石化公司","duchareward":0,"duchapiping":-0.2},{"id":47,"company":"卫建委","duchareward":0.2,"duchapiping":0},{"id":48,"company":"武警中队","duchareward":0,"duchapiping":-0.2},{"id":49,"company":"先进制造业开发区","duchareward":0.2,"duchapiping":0},{"id":50,"company":"县二院","duchareward":0,"duchapiping":-0.2},{"id":51,"company":"疫情指挥部(卫建委)","duchareward":0.6,"duchapiping":-0.8},{"id":52,"company":"邮政银行","duchareward":0,"duchapiping":-0.2},{"id":53,"company":"中华财险","duchareward":0,"duchapiping":-0.2},{"id":54,"company":"中行","duchareward":0,"duchapiping":-0.2},{"id":55,"company":"中原银行","duchareward":0,"duchapiping":-0.2},{"id":56,"company":"住房公积金","duchareward":0,"duchapiping":-0.2}]





ResultData = function (id, company, biaozhangMoney, leaderReward, leaderpiping, duchaReward, duchapiping) {
    this.id = id,
        this.company = company,
        this.biaozhangMoney = biaozhangMoney,
        this.leaderReward = leaderReward,
        this.leaderpiping = leaderpiping,
        this.duchaReward = duchaReward,
        this.duchapiping = duchapiping
}

var resultDatas = new Array;
var itemId = 0
/***************首先将表彰表内容加入结果表中************** */
var biaozhangData = biaozhangMoney
for (var i = 0; i < biaozhangData.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: biaozhangData[i].company,
        biaozhangMoney: biaozhangData[i].rewardmoney,
        leaderReward: 0,
        leaderpiping: 0,
        duchaReward: 0,
        duchapiping: 0
    };
    resultDatas.push(resultdata)
}

/**************然后,将领导奖罚表数据填充至结果表中***************** */
var leaderDatas = leaderMoney

for (var j = 0; j < resultDatas.length; j++) {
    var nowCompany = resultDatas[j].company
    for (var i = leaderDatas.length - 1; i >= 0; i--) {

        if (leaderDatas[i].company == nowCompany) {

            resultDatas[j].leaderReward = leaderDatas[i].leaderreward
            resultDatas[j].leaderpiping = leaderDatas[i].leaderpiping

            leaderDatas.splice(i, 1);
            break;
        }
    }
}

for (var i = 0; i < leaderDatas.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: leaderDatas[i].company,
        biaozhangMoney: 0,
        leaderReward: leaderDatas[i].leaderreward,
        leaderpiping: leaderDatas[i].leaderpiping,
        duchaReward: 0,
        duchapiping: 0
    }
    resultDatas.push(resultdata)
}

/*********************处理督查通报问题************************** */
var duchaDatas = duchaMoney
for (var j = 0; j < resultDatas.length; j++) {
    var nowCompany = resultDatas[j].company
    for (var i = duchaDatas.length - 1; i >= 0; i--) {

        if (duchaDatas[i].company == nowCompany) {

            resultDatas[j].duchaReward = duchaDatas[i].duchareward
            resultDatas[j].duchapiping = duchaDatas[i].duchapiping

            duchaDatas.splice(i, 1);
            break;
        }
    }
}
for (var i = 0; i < duchaDatas.length; i++) {
    itemId++
    var resultdata = {
        id: itemId,
        company: duchaDatas[i].company,
        biaozhangMoney: 0,
        leaderReward: 0,
        leaderpiping: 0,
        duchaReward: duchaDatas[i].duchareward,
        duchapiping: duchaDatas[i].duchapiping
    }
    resultDatas.push(resultdata)
}



document.write( JSON.stringify(resultDatas))
console 命令行工具 X clear

                    
>
console