UNPKG

ttk-app-core

Version:
301 lines (298 loc) 12.9 kB
import React from 'react' /** * * @param {number} type 展示类型 */ const isTotalData = (record) => { // return record.summary == '本月合计' || record.summary == '本年累计' ? 'total_data_weight' : '' return '' } export default function renderColumns (type, openMoreContent) { let columns switch (type){ case 1: columns = [{ title: '期间', className: 'accountDate', dataIndex: 'accountDate', key: 'accountDate', width: 71, render: (text, record) => <a onClick={openMoreContent(text)} className={isTotalData(record)}>{text}</a> }, { title: '摘要', dataIndex: 'summary', className: 'summary', key: 'summary', width: 198, render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '借方', dataIndex: 'amountDr', className:'amountColumnStyle', key: 'amountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '贷方', dataIndex: 'amountCr', className:'amountColumnStyle', key: 'amountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '方向', dataIndex: 'balanceDirection', className: 'table_center', width: 70, key: 'balanceDirection', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '余额', dataIndex: 'balanceAmount', className:'amountColumnStyle', key: 'balanceAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] break; case 2: columns = [{ title: '期间', dataIndex: 'accountDate', key: 'accountDate', width: 71, render: (text, record) => <a onClick={openMoreContent(text)} className={isTotalData(record)}>{text}</a> }, { title: '摘要', dataIndex: 'summary', key: 'summary', width: 198, render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '借方', children:[{ title: '原币金额', dataIndex: 'origAmountDr', className:'amountColumnStyle', key: 'origAmountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '本币金额', dataIndex: 'amountDr', className:'amountColumnStyle', key: 'amountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] }, { title: '贷方', children: [{ title: '原币金额', dataIndex: 'origAmountCr', className:'amountColumnStyle', key: 'origAmountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '本币金额', dataIndex: 'amountCr', className:'amountColumnStyle', key: 'amountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] }, { title: '余额', name: 'balance', children: [{ title: '方向', dataIndex: 'balanceDirection', className: 'table_center', key: 'balanceDirection', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '原币金额', dataIndex: 'balanceOrigAmount', className:'amountColumnStyle', key: 'balanceOrigAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }, { title: '本币金额', dataIndex: 'balanceAmount', className:'amountColumnStyle', key: 'balanceAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] }] break; case 3: columns = [{ title: '期间', dataIndex: 'accountDate', key: 'accountDate', width:71, render: (text, record) => <a onClick={openMoreContent(text)} className={isTotalData(record)}>{text}</a> },{ title: '摘要', dataIndex: 'summary', key: 'summary', width: 198, render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '借方', name: 'debit', children: [{ title: '数量', dataIndex: 'quantityDr', className:'amountColumnStyle', key: 'quantityDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '金额', dataIndex: 'amountDr', className:'amountColumnStyle', key: 'amountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] },{ title: '贷方', name: 'credit', children: [{ title: '数量', dataIndex: 'quantityCr', className:'amountColumnStyle', key: 'quantityCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '金额', dataIndex: 'amountCr', className:'amountColumnStyle', key: 'amountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] },{ title: '余额', name: 'balance', key: 'balance', children:[{ title: '方向', key: 'balanceDirection', dataIndex: 'balanceDirection', className: 'table_center', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '数量', key: 'balanceQuantity', className:'amountColumnStyle', dataIndex: 'balanceQuantity', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '单价', key: 'price', className:'amountColumnStyle', dataIndex: 'price', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '金额', key: 'balanceAmount', className:'amountColumnStyle', dataIndex: 'balanceAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] }] break; case 4: columns = [{ title: '期间', dataIndex: 'accountDate', key: 'accountDate', width:71, render: (text, record) => <a onClick={openMoreContent(text)} className={isTotalData(record)}>{text}</a> },{ title: '摘要', dataIndex: 'summary', key: 'summary', width: 198, render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '借方', name: 'debit', key: 'debit', children: [{ title: '数量', dataIndex: 'quantityDr', className:'amountColumnStyle', key: 'quantityDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '原币金额', dataIndex: 'origAmountDr', className:'amountColumnStyle', key: 'origAmountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '本币金额', dataIndex: 'amountDr', className:'amountColumnStyle', key: 'amountDr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] },{ title: '贷方', name: 'credit', key: 'credit', children: [{ title: '数量', dataIndex: 'quantityCr', className:'amountColumnStyle', key: 'quantityCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '原币金额', dataIndex: 'origAmountCr', className:'amountColumnStyle', key: 'origAmountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '本币金额', dataIndex: 'amountCr', className:'amountColumnStyle', key: 'amountCr', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] },{ title: '余额', name: 'balance', key: 'balance', children: [{ title: '方向', dataIndex: 'balanceDirection', key: 'balanceDirection', className: 'table_center', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '数量', key: 'balanceQuantity', className:'amountColumnStyle', dataIndex: 'balanceQuantity', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '单价', dataIndex: 'price', className:'amountColumnStyle', key: 'price', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '原币金额', dataIndex: 'balanceOrigAmount', className:'amountColumnStyle', key: 'balanceOrigAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> },{ title: '本币金额', dataIndex: 'balanceAmount', className:'amountColumnStyle', key: 'balanceAmount', render: (text, record) => <span className={isTotalData(record)}>{text}</span> }] }] break; default: break } return columns }