|  | @@ -0,0 +1,451 @@
 | 
	
		
			
				|  |  | +$(document).ready(() => {
 | 
	
		
			
				|  |  | +    autoFlashHeight();
 | 
	
		
			
				|  |  | +    $('#data-spread').height($('.sjs-height-0').height() - $('.nav-tabs').height() - 16);
 | 
	
		
			
				|  |  | +    const spreadSetting = {
 | 
	
		
			
				|  |  | +        jgcl: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '4', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '4', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '4', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '合计||到场|数量', colSpan: '4||2|1', rowSpan: '2||1|1', field: 'sum_arrive_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_arrive_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '||扣回|数量', colSpan: '||2|1', rowSpan: '||1|1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            baseCols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '4', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '4', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '4', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            extraCols: [
 | 
	
		
			
				|  |  | +                {title: '标段1|第一期|到场|数量', colSpan: '4|4|2|1', rowSpan: '1|1|1|1', field: 'sum_arrive_qty', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_arrive_qty_%d', formatTitle: '%s|%f|到场|数量'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_arrive_tp', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_arrive_tp_%d'},
 | 
	
		
			
				|  |  | +                {title: '||扣回|数量', colSpan: '||2|1', rowSpan: '||1|1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_deduct_tp_%d'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_deduct_tp_%d'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            endCols: [
 | 
	
		
			
				|  |  | +                {title: '合计||到场|数量', colSpan: '4||2|1', rowSpan: '2||1|1', field: 'sum_arrive_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_arrive_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '||扣回|数量', colSpan: '||2|1', rowSpan: '||1|1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '|||金额', colSpan: '|||1', rowSpan: '|||1', field: 'sum_deduct_qty', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 4,
 | 
	
		
			
				|  |  | +            headRowHeight: [32, 25, 25, 25],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        yjcl: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '3', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '3', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '3', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '合计||数量', colSpan: '2||1', rowSpan: '2||1', field: 'sum_qty', hAlign: 2, width: 80, type: 'Number' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '|1', rowSpan: '|1', field: 'sum_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            baseCols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '3', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '3', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '3', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            extraCols: [
 | 
	
		
			
				|  |  | +                {title: '标段1|第1期|数量', colSpan: '2|2|1', rowSpan: '1|1|1', field: 'gather_qty_1', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_qty_%d', formatTitle: '%s|%f|数量' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '||1', rowSpan: '||1', field: 'gather_tp_1', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_tp_%d'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            endCols: [
 | 
	
		
			
				|  |  | +                {title: '合计||数量', colSpan: '2||1', rowSpan: '2||1', field: 'sum_qty', hAlign: 2, width: 80, type: 'Number' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '||1', rowSpan: '||1', field: 'sum_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 3,
 | 
	
		
			
				|  |  | +            headRowHeight: [32, 25, 25],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        bonus: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 320, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '汇总', colSpan: '1', rowSpan: '1', field: 'filter', hAlign: 1, width: 100, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '类型', colSpan: '1', rowSpan: '1', field: 'b_type', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '金额', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '时间', colSpan: '1', rowSpan: '1', field: 'real_time', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 1,
 | 
	
		
			
				|  |  | +            headRowHeight: [32],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        safeProd: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '3', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '3', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '3', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '合计||数量', colSpan: '2||1', rowSpan: '2||1', field: 'sum_qty', hAlign: 2, width: 80, type: 'Number' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '||1', rowSpan: '||1', field: 'sum_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            baseCols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '3', field: 'name', hAlign: 0, width: 200, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '3', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '3', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            extraCols: [
 | 
	
		
			
				|  |  | +                {title: '标段1|第1期|数量', colSpan: '2|2|1', rowSpan: '1|1|1', field: 'gather_qty_1', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_qty_%d', formatTitle: '%s|%f|数量' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '||1', rowSpan: '||1', field: 'gather_tp_1', hAlign: 2, width: 80, type: 'Number', formatField: 'gather_tp_%d'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            endCols: [
 | 
	
		
			
				|  |  | +                {title: '合计||数量', colSpan: '2||1', rowSpan: '2||1', field: 'sum_qty', hAlign: 2, width: 80, type: 'Number' },
 | 
	
		
			
				|  |  | +                {title: '||金额', colSpan: '||1', rowSpan: '||1', field: 'sum_tp', hAlign: 2, width: 80, type: 'Number'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 3,
 | 
	
		
			
				|  |  | +            headRowHeight: [32, 25, 25],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        tempLand: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 320, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '汇总', colSpan: '1', rowSpan: '2', field: 'filter', hAlign: 1, width: 100, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
 | 
	
		
			
				|  |  | +                {title: '本期|数量', colSpan: '2|1', rowSpan: '1|1', field: 'qty', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '|数量', colSpan: '|1', rowSpan: '|1', field: 'tp', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '截止本期|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qty', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '|数量', colSpan: '|1', rowSpan: '|1', field: 'end_tp', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 2,
 | 
	
		
			
				|  |  | +            headRowHeight: [25, 25],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        other: {
 | 
	
		
			
				|  |  | +            cols: [
 | 
	
		
			
				|  |  | +                {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 320, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '汇总', colSpan: '1', rowSpan: '1', field: 'filter', hAlign: 1, width: 100, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '类型', colSpan: '1', rowSpan: '1', field: 'o_type', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '金额', colSpan: '1', rowSpan: '1', field: 'total_price', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '本期', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '截止本期', colSpan: '1', rowSpan: '1', field: 'end_tp', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +                {title: '时间', colSpan: '1', rowSpan: '1', field: 'real_time', hAlign: 1, width: 80, formatter: '@'},
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            emptyRows: 0,
 | 
	
		
			
				|  |  | +            headRows: 1,
 | 
	
		
			
				|  |  | +            headRowHeight: [32],
 | 
	
		
			
				|  |  | +            defaultRowHeight: 21,
 | 
	
		
			
				|  |  | +            headerFont: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            font: '12px 微软雅黑',
 | 
	
		
			
				|  |  | +            readOnly: true,
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const dataSpread = SpreadJsObj.createNewSpread($('#data-spread')[0]);
 | 
	
		
			
				|  |  | +    const dataSheet = dataSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +    const stageExtra = {
 | 
	
		
			
				|  |  | +        seType: 'jgcl',
 | 
	
		
			
				|  |  | +        seData: 'cur',
 | 
	
		
			
				|  |  | +        jgcl: [],
 | 
	
		
			
				|  |  | +        yjcl: [],
 | 
	
		
			
				|  |  | +        bonus: [],
 | 
	
		
			
				|  |  | +        other: [],
 | 
	
		
			
				|  |  | +        safeProd: [],
 | 
	
		
			
				|  |  | +        tempLand: [],
 | 
	
		
			
				|  |  | +        gatherJgcl(tenders) {
 | 
	
		
			
				|  |  | +            this.jgcl = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                const endfix = '_' + (i + 1);
 | 
	
		
			
				|  |  | +                for (const data of t.jgcl) {
 | 
	
		
			
				|  |  | +                    if (!data.unit) data.unit = '';
 | 
	
		
			
				|  |  | +                    if (!data.unit_price) data.unit_price = 0;
 | 
	
		
			
				|  |  | +                    let cl = this.jgcl.find(x => { return x.name === data.name && x.unit === data.unit && x.unit_price === data.unit_price; });
 | 
	
		
			
				|  |  | +                    if (!cl) {
 | 
	
		
			
				|  |  | +                        cl = { name: data.name || '', unit: data.unit || '', unit_price: data.unit_price || 0 };
 | 
	
		
			
				|  |  | +                        this.jgcl.push(cl);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    cl['arrive_qty' + endfix] = ZhCalc.add(cl['arrive_qty' + endfix], data.arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['arrive_tp' + endfix] = ZhCalc.add(cl['arrive_tp' + endfix], data.arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['deduct_qty' + endfix] = ZhCalc.add(cl['deduct_qty' + endfix], data.deduct_qty);
 | 
	
		
			
				|  |  | +                    cl['deduct_tp' + endfix] = ZhCalc.add(cl['deduct_tp' + endfix], data.deduct_tp);
 | 
	
		
			
				|  |  | +                    cl['end_arrive_qty' + endfix] = ZhCalc.add(cl['end_arrive_qty' + endfix], data.end_arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['end_arrive_tp' + endfix] = ZhCalc.add(cl['end_arrive_tp' + endfix], data.end_arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['end_deduct_qty' + endfix] = ZhCalc.add(cl['end_deduct_qty' + endfix], data.end_deduct_qty);
 | 
	
		
			
				|  |  | +                    cl['end_deduct_tp' + endfix] = ZhCalc.add(cl['end_deduct_tp' + endfix], data.end_deduct_tp);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    cl['sum_arrive_qty'] = ZhCalc.add(cl['sum_arrive_qty'], data.arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_arrive_tp'] = ZhCalc.add(cl['sum_arrive_tp'], data.arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['sum_deduct_qty'] = ZhCalc.add(cl['sum_deduct_qty'], data.deduct_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_deduct_tp'] = ZhCalc.add(cl['sum_deduct_tp'], data.deduct_tp);
 | 
	
		
			
				|  |  | +                    cl['sum_end_arrive_qty'] = ZhCalc.add(cl['sum_end_arrive_qty'], data.end_arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_end_arrive_tp'] = ZhCalc.add(cl['sum_end_arrive_tp'], data.end_arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['sum_end_deduct_qty'] = ZhCalc.add(cl['sum_end_deduct_qty'], data.end_deduct_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_end_deduct_tp'] = ZhCalc.add(cl['sum_end_deduct_tp'], data.end_deduct_tp);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherYjcl(tenders) {
 | 
	
		
			
				|  |  | +            this.yjcl = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                const endfix = '_' + (i + 1);
 | 
	
		
			
				|  |  | +                for (const data of t.yjcl) {
 | 
	
		
			
				|  |  | +                    if (!data.unit) data.unit = '';
 | 
	
		
			
				|  |  | +                    if (!data.spec) data.spec = '';
 | 
	
		
			
				|  |  | +                    if (!data.unit_price) data.unit_price = 0;
 | 
	
		
			
				|  |  | +                    let cl = this.yjcl.find(x => { return x.name === data.name && x.spec === data.spec && x.unit === data.unit && x.unit_price === data.unit_price; });
 | 
	
		
			
				|  |  | +                    if (!cl) {
 | 
	
		
			
				|  |  | +                        cl = { name: data.name || '', spec: data.spec, unit: data.unit || '', unit_price: data.unit_price || 0 };
 | 
	
		
			
				|  |  | +                        this.yjcl.push(cl);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    cl['arrive_qty' + endfix] = ZhCalc.add(cl['arrive_qty' + endfix], data.arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['arrive_tp' + endfix] = ZhCalc.add(cl['arrive_tp' + endfix], data.arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['qty' + endfix] = ZhCalc.add(cl['qty' + endfix], data.qty);
 | 
	
		
			
				|  |  | +                    cl['tp' + endfix] = ZhCalc.add(cl['tp' + endfix], data.tp);
 | 
	
		
			
				|  |  | +                    cl['end_qty' + endfix] = ZhCalc.add(cl['end_qty' + endfix], data.end_qty);
 | 
	
		
			
				|  |  | +                    cl['end_tp' + endfix] = ZhCalc.add(cl['end_tp' + endfix], data.end_tp);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    cl['sum_arrive_qty'] = ZhCalc.add(cl['sum_arrive_qty'], data.arrive_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_arrive_tp'] = ZhCalc.add(cl['sum_arrive_tp'], data.arrive_tp);
 | 
	
		
			
				|  |  | +                    cl['sum_qty'] = ZhCalc.add(cl['sum_qty'], data.qty);
 | 
	
		
			
				|  |  | +                    cl['sum_tp'] = ZhCalc.add(cl['sum_tp'], data.tp);
 | 
	
		
			
				|  |  | +                    cl['sum_end_qty'] = ZhCalc.add(cl['sum_end_qty'], data.end_qty);
 | 
	
		
			
				|  |  | +                    cl['sum_end_tp'] = ZhCalc.add(cl['sum_end_tp'], data.end_tp);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherBonus(tenders) {
 | 
	
		
			
				|  |  | +            this.bonus = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                this.bonus.push({ tid: t.id, name: t.name, filter: t.filter });
 | 
	
		
			
				|  |  | +                this.bonus.push(...t.bonus);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherOther(tenders) {
 | 
	
		
			
				|  |  | +            this.other = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                this.other.push({ tid: t.id, name: t.name, filter: t.filter });
 | 
	
		
			
				|  |  | +                this.other.push(...t.other);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherSafeProd(tenders) {
 | 
	
		
			
				|  |  | +            this.safeProd = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                const endfix = '_' + (i + 1);
 | 
	
		
			
				|  |  | +                for (const data of t.safeProd) {
 | 
	
		
			
				|  |  | +                    if (!data.unit) data.unit = '';
 | 
	
		
			
				|  |  | +                    if (!data.unit_price) data.unit_price = 0;
 | 
	
		
			
				|  |  | +                    let sp = this.safeProd.find(x => { return x.name === data.name && x.unit === data.unit && x.unit_price === data.unit_price; });
 | 
	
		
			
				|  |  | +                    if (!sp) {
 | 
	
		
			
				|  |  | +                        sp = { name: data.name || '', unit: data.unit || '', unit_price: data.unit_price || 0 };
 | 
	
		
			
				|  |  | +                        this.safeProd.push(sp);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    sp['quantity' + endfix] = ZhCalc.add(sp['quantity' + endfix], data.quantity);
 | 
	
		
			
				|  |  | +                    sp['total_price' + endfix] = ZhCalc.add(sp['total_price' + endfix], data.total_price);
 | 
	
		
			
				|  |  | +                    sp['qty' + endfix] = ZhCalc.add(sp['qty' + endfix], data.qty);
 | 
	
		
			
				|  |  | +                    sp['tp' + endfix] = ZhCalc.add(sp['tp' + endfix], data.tp);
 | 
	
		
			
				|  |  | +                    sp['end_qty' + endfix] = ZhCalc.add(sp['end_qty' + endfix], data.end_qty);
 | 
	
		
			
				|  |  | +                    sp['end_tp' + endfix] = ZhCalc.add(sp['end_tp' + endfix], data.end_tp);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    sp['sum_quantity'] = ZhCalc.add(sp['sum_quantity'], data.quantity);
 | 
	
		
			
				|  |  | +                    sp['sum_total_price'] = ZhCalc.add(sp['sum_total_price'], data.total_price);
 | 
	
		
			
				|  |  | +                    sp['sum_qty'] = ZhCalc.add(sp['sum_qty'], data.qty);
 | 
	
		
			
				|  |  | +                    sp['sum_tp'] = ZhCalc.add(sp['sum_tp'], data.tp);
 | 
	
		
			
				|  |  | +                    sp['sum_end_qty'] = ZhCalc.add(sp['sum_end_qty'], data.end_qty);
 | 
	
		
			
				|  |  | +                    sp['sum_end_tp'] = ZhCalc.add(sp['sum_end_tp'], data.end_tp);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherTempLand(tenders) {
 | 
	
		
			
				|  |  | +            this.tempLand = [];
 | 
	
		
			
				|  |  | +            for (const [i, t] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                this.tempLand.push({ tid: t.id, name: t.name, filter: t.filter });
 | 
	
		
			
				|  |  | +                this.tempLand.push(...t.tempLand);
 | 
	
		
			
				|  |  | +                // const endfix = '_' + (i + 1);
 | 
	
		
			
				|  |  | +                // for (const data of t.tempLand) {
 | 
	
		
			
				|  |  | +                //     if (!data.unit) data.unit = '';
 | 
	
		
			
				|  |  | +                //     if (!data.unit_price) data.unit_price = 0;
 | 
	
		
			
				|  |  | +                //     let tl = this.tempLand.find(x => { return x.name === data.name && x.unit === data.unit && x.unit_price === data.unit_price; });
 | 
	
		
			
				|  |  | +                //     if (!tl) {
 | 
	
		
			
				|  |  | +                //         tl = { name: data.name || '', unit: data.unit || '', unit_price: data.unit_price || 0 };
 | 
	
		
			
				|  |  | +                //         this.tempLand.push(tl);
 | 
	
		
			
				|  |  | +                //     }
 | 
	
		
			
				|  |  | +                //     tl['quantity' + endfix] = ZhCalc.add(tl['quantity' + endfix], data.quantity);
 | 
	
		
			
				|  |  | +                //     tl['total_price' + endfix] = ZhCalc.add(tl['total_price' + endfix], data.total_price);
 | 
	
		
			
				|  |  | +                //     tl['qty' + endfix] = ZhCalc.add(tl['qty' + endfix], data.qty);
 | 
	
		
			
				|  |  | +                //     tl['tp' + endfix] = ZhCalc.add(tl['tp' + endfix], data.tp);
 | 
	
		
			
				|  |  | +                //     tl['end_qty' + endfix] = ZhCalc.add(tl['end_qty' + endfix], data.end_qty);
 | 
	
		
			
				|  |  | +                //     tl['end_tp' + endfix] = ZhCalc.add(tl['end_tp' + endfix], data.end_tp);
 | 
	
		
			
				|  |  | +                //
 | 
	
		
			
				|  |  | +                //     tl['sum_quantity'] = ZhCalc.add(tl['sum_quantity'], data.quantity);
 | 
	
		
			
				|  |  | +                //     tl['sum_total_price'] = ZhCalc.add(tl['sum_total_price'], data.total_price);
 | 
	
		
			
				|  |  | +                //     tl['sum_qty'] = ZhCalc.add(tl['sum_qty'], data.qty);
 | 
	
		
			
				|  |  | +                //     tl['sum_tp'] = ZhCalc.add(tl['sum_tp'], data.tp);
 | 
	
		
			
				|  |  | +                //     tl['sum_end_qty'] = ZhCalc.add(tl['sum_end_qty'], data.end_qty);
 | 
	
		
			
				|  |  | +                //     tl['sum_end_tp'] = ZhCalc.add(tl['sum_end_tp'], data.end_tp);
 | 
	
		
			
				|  |  | +                // }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        gatherStageExtraData(tenders) {
 | 
	
		
			
				|  |  | +            this.tenderCount = tenders.length;
 | 
	
		
			
				|  |  | +            this.gatherJgcl(tenders);
 | 
	
		
			
				|  |  | +            this.gatherYjcl(tenders);
 | 
	
		
			
				|  |  | +            this.gatherBonus(tenders);
 | 
	
		
			
				|  |  | +            this.gatherOther(tenders);
 | 
	
		
			
				|  |  | +            this.gatherSafeProd(tenders);
 | 
	
		
			
				|  |  | +            this.gatherTempLand(tenders);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        rebuildSpreadSetting(tenders) {
 | 
	
		
			
				|  |  | +            spreadSetting.jgcl.cols = [...spreadSetting.jgcl.baseCols];
 | 
	
		
			
				|  |  | +            spreadSetting.yjcl.cols = [...spreadSetting.yjcl.baseCols];
 | 
	
		
			
				|  |  | +            spreadSetting.safeProd.cols = [...spreadSetting.safeProd.baseCols];
 | 
	
		
			
				|  |  | +            const pushExtraCols = function(spreadSetting) {
 | 
	
		
			
				|  |  | +                for (const [i, tender] of tenders.entries()) {
 | 
	
		
			
				|  |  | +                    for (const col of spreadSetting.extraCols) {
 | 
	
		
			
				|  |  | +                        const newCol = JSON.parse(JSON.stringify(col));
 | 
	
		
			
				|  |  | +                        if (newCol.formatTitle) newCol.title = newCol.formatTitle.replace('%s', tender.name).replace('%f', tender.filter);
 | 
	
		
			
				|  |  | +                        if (newCol.formatField) newCol.field = newCol.formatField.replace('%d', i + 1);
 | 
	
		
			
				|  |  | +                        spreadSetting.cols.push(newCol);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            pushExtraCols(spreadSetting.jgcl);
 | 
	
		
			
				|  |  | +            pushExtraCols(spreadSetting.yjcl);
 | 
	
		
			
				|  |  | +            pushExtraCols(spreadSetting.safeProd);
 | 
	
		
			
				|  |  | +            spreadSetting.jgcl.cols.push(...spreadSetting.jgcl.endCols);
 | 
	
		
			
				|  |  | +            spreadSetting.yjcl.cols.push(...spreadSetting.yjcl.endCols);
 | 
	
		
			
				|  |  | +            spreadSetting.safeProd.cols.push(...spreadSetting.safeProd.endCols);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        loadJgclShowData(field) {
 | 
	
		
			
				|  |  | +            const prefix = field === 'end' ? 'end_' : '';
 | 
	
		
			
				|  |  | +            for (const cl of this.jgcl) {
 | 
	
		
			
				|  |  | +                for (let i = 1; i<= this.tenderCount; i++) {
 | 
	
		
			
				|  |  | +                    cl['gather_arrive_qty_' + i] = cl[prefix + 'arrive_qty_' + i];
 | 
	
		
			
				|  |  | +                    cl['gather_arrive_tp_' + i] = cl[prefix + 'arrive_tp_' + i];
 | 
	
		
			
				|  |  | +                    cl['gather_deduct_qty_' + i] = cl[prefix + 'deduct_qty_' + i];
 | 
	
		
			
				|  |  | +                    cl['gather_deduct_tp_' + i] = cl[prefix + 'deduct_tp_' + i];
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                cl.sum_arrive_qty = cl['sum_' + prefix + 'arrive_qty'];
 | 
	
		
			
				|  |  | +                cl.sum_arrive_tp = cl['sum_' + prefix + 'arrive_tp'];
 | 
	
		
			
				|  |  | +                cl.sum_deduct_qty = cl['sum_' + prefix + 'deduct_qty'];
 | 
	
		
			
				|  |  | +                cl.sum_deduct_tp = cl['sum_' + prefix + 'deduct_tp'];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (this.seType === 'jgcl') SpreadJsObj.reloadColData(dataSheet, 3, 4*this.tenderCount);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        loadYjclShowData(field) {
 | 
	
		
			
				|  |  | +            const prefix = field === 'end' ? 'end_' : '';
 | 
	
		
			
				|  |  | +            for (const cl of this.yjcl) {
 | 
	
		
			
				|  |  | +                for (let i = 1; i<= this.tenderCount; i++) {
 | 
	
		
			
				|  |  | +                    cl['gather_qty_' + i] = cl[prefix + 'qty_' + i];
 | 
	
		
			
				|  |  | +                    cl['gather_tp_' + i] = cl[prefix + 'tp_' + i];
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                cl.sum_qty = cl['sum_' + prefix + 'qty'];
 | 
	
		
			
				|  |  | +                cl.sum_tp = cl['sum_' + prefix + 'tp'];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (this.seType === 'yjcl') SpreadJsObj.reloadColData(dataSheet, 3, 2*this.tenderCount);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        loadSafeProdShowData(field) {
 | 
	
		
			
				|  |  | +            const prefix = field === 'end' ? 'end_' : '';
 | 
	
		
			
				|  |  | +            for (const sp of this.safeProd) {
 | 
	
		
			
				|  |  | +                for (let i = 1; i<= this.tenderCount; i++) {
 | 
	
		
			
				|  |  | +                    sp['gather_qty_' + i] = sp[prefix + 'qty_' + i];
 | 
	
		
			
				|  |  | +                    sp['gather_tp_' + i] = sp[prefix + 'tp_' + i];
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                sp.sum_qty = sp['sum_' + prefix + 'qty'];
 | 
	
		
			
				|  |  | +                sp.sum_tp = sp['sum_' + prefix + 'tp'];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            if (this.seType === 'safeProd') SpreadJsObj.reloadColData(dataSheet, 3, 2*this.tenderCount);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        loadShowData() {
 | 
	
		
			
				|  |  | +            const field = $('[name=compare-data]:checked').val();
 | 
	
		
			
				|  |  | +            if (field === this.seData) return;
 | 
	
		
			
				|  |  | +            this.seData = field;
 | 
	
		
			
				|  |  | +            this.loadJgclShowData(field);
 | 
	
		
			
				|  |  | +            this.loadYjclShowData(field);
 | 
	
		
			
				|  |  | +            this.loadSafeProdShowData(field);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        refreshShowData() {
 | 
	
		
			
				|  |  | +            const field = $('[name=compare-data]:checked').val();
 | 
	
		
			
				|  |  | +            if (field === this.seData) return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            this.loadShowData();
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        loadSheetData() {
 | 
	
		
			
				|  |  | +            SpreadJsObj.initSheet(dataSheet, spreadSetting[this.seType]);
 | 
	
		
			
				|  |  | +            SpreadJsObj.loadSheetData(dataSheet, SpreadJsObj.DataType.Data, this[this.seType]);
 | 
	
		
			
				|  |  | +            SpreadJsObj.locateRow(dataSheet, 0);
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        refreshStageExtraData(type) {
 | 
	
		
			
				|  |  | +            if (type) {
 | 
	
		
			
				|  |  | +                if (this.seType === type) return;
 | 
	
		
			
				|  |  | +                this.seType = type;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            this.loadSheetData();
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +    stageExtra.loadSheetData();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const tenderSelect = TenderSelectMulti({
 | 
	
		
			
				|  |  | +        title: '汇总标段',
 | 
	
		
			
				|  |  | +        type: 'gather',
 | 
	
		
			
				|  |  | +        dataType: 'stage',
 | 
	
		
			
				|  |  | +        zoneValid: false,
 | 
	
		
			
				|  |  | +        afterSelect: function(select) {
 | 
	
		
			
				|  |  | +            const data = { filter: 'jgcl;yjcl;bonus;other;safeProd;tempLand', tender: select };
 | 
	
		
			
				|  |  | +            postData(`/sp/${spid}/spss/load`, data, function(result) {
 | 
	
		
			
				|  |  | +                stageExtra.rebuildSpreadSetting(result);
 | 
	
		
			
				|  |  | +                stageExtra.gatherStageExtraData(result);
 | 
	
		
			
				|  |  | +                SpreadJsObj.reLoadSheetHeader(dataSheet, true);
 | 
	
		
			
				|  |  | +                stageExtra.loadShowData();
 | 
	
		
			
				|  |  | +                stageExtra.loadSheetData();
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    $('#gather-select').click(tenderSelect.showSelect);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $('[name=compare-data]').click(function() {
 | 
	
		
			
				|  |  | +        stageExtra.refreshShowData();
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    $('.nav-item').click(function() {
 | 
	
		
			
				|  |  | +        const dataType = $(this).attr('data-type');
 | 
	
		
			
				|  |  | +        stageExtra.refreshStageExtraData(dataType);
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    $('#export-excel').click(function() {
 | 
	
		
			
				|  |  | +        const sheets = [];
 | 
	
		
			
				|  |  | +        sheets.push({ name: '甲供材料', setting: spreadSetting.jgcl, data: stageExtra.jgcl });
 | 
	
		
			
				|  |  | +        sheets.push({ name: '永久材料', setting: spreadSetting.yjcl, data: stageExtra.yjcl });
 | 
	
		
			
				|  |  | +        sheets.push({ name: '奖罚金', setting: spreadSetting.bonus, data: stageExtra.bonus });
 | 
	
		
			
				|  |  | +        sheets.push({ name: '安全生产', setting: spreadSetting.safeProd, data: stageExtra.safeProd });
 | 
	
		
			
				|  |  | +        sheets.push({ name: '临时占地', setting: spreadSetting.tempLand, data: stageExtra.tempLand });
 | 
	
		
			
				|  |  | +        sheets.push({ name: '其他', setting: spreadSetting.other, data: stageExtra.other });
 | 
	
		
			
				|  |  | +        SpreadExcelObj.exportSimpleXlsxSheets(sheets, "计量汇总-其他台账.xlsx");
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    $.subMenu({
 | 
	
		
			
				|  |  | +        menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
 | 
	
		
			
				|  |  | +        toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
 | 
	
		
			
				|  |  | +        key: 'menu.1.0.0',
 | 
	
		
			
				|  |  | +        miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
 | 
	
		
			
				|  |  | +        callback: function (info) {
 | 
	
		
			
				|  |  | +            if (info.mini) {
 | 
	
		
			
				|  |  | +                $('.panel-title').addClass('fluid');
 | 
	
		
			
				|  |  | +                $('#sub-menu').removeClass('panel-sidebar');
 | 
	
		
			
				|  |  | +                $('.c-body table thead').css('left', '56px');
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                $('.panel-title').removeClass('fluid');
 | 
	
		
			
				|  |  | +                $('#sub-menu').addClass('panel-sidebar');
 | 
	
		
			
				|  |  | +                $('.c-body table thead').css('left', '176px');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            autoFlashHeight();
 | 
	
		
			
				|  |  | +            dataSpread.refresh();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +});
 |