/**
 * 台账相关js
 *
 * @author Mai
 * @date 2018/02/05
 * @version
 */
$(document).ready(function() {
    const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
    const ledgerTree = createNewPathTree({
        id: 'ledger_id',
        pid: 'ledger_pid',
        order: 'order',
        level: 'level',
        rootId: -1
    });
    ledgerTree.loadDatas(ledger);
    SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), {
        cols: [
            {title: '项目节编号', field: 'code', width: 150, cellType: 'tree'},
            {title: '清单编号', field: 'b_code', width: 80},
            {title: '名称', field: 'name', width: 230},
            {title: '单位', field: 'unit', width: 50},
            {title: '单价', field: 'price', width: 60},
            {title: '数量', field: 'quantity', width: 60},
            {title: '金额', field: 'totalPrice', width: 60},
            {title: '施工图原设计', field: 'design', width: 60},
            {title: '图（册）号', field: 'drawingCode', width: 80},
            {title: '备注', field: 'memo', width: 100}
        ],
        treeCol: 0,
        emptyRows: 3
    });
    SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), 'tree', ledgerTree);
});