export default {
    data() {
        return {};
    },
    computed: {},
    methods: {
        // 获取表格宽度
        getGrid(column) {
            switch (column.columnWidth) {
                case 'Column12':
                    return this.grid24;
                case 'Column9':
                    return this.grid18;
                case 'Column8':
                    return this.grid16;
                case 'Column6':
                    return this.grid12;
                case 'Column4':
                    return this.grid8;
                case 'Column3':
                    return this.grid6;
                case 'Column2':
                    return this.grid4;
            }
        },
        // 获取参数
        getParam(data, column) {
            let param = {};

            if (column.param != null && column.param.trim() !== '') {
                // 有参数
                param = JSON.parse(column.param);

                // 填充参数
                for (let key in param) {
                    // 常量
                    let index = param[key].search(/^\[.*?\]$/);
                    if (index === 0) {
                        param[key] = param[key].substring(1, param[key].length - 1);
                        continue;
                    }

                    // 变量
                    let paramData = this.parseData(data, param[key]);

                    if (paramData != null) {
                        param[key] = paramData;
                        continue;
                    }

                    // 参数不完整
                    return null;
                }
            }

            return param;
        }
    }
};
