DetailTable.js 814 Bytes
define(["utils"], function (_u) {
    'use strict';

    function DetailTable() { }

    DetailTable.prototype = {
        transferToVM: function (dm) {
            var fields = dm.field_datas || [];
            
            fields = fields.map(function (field) {
                return {
                    show: field.fieldmectype !== "FHidden",
                    text: field.fieldlabel,
                    width: _u.toPixel(field.fieldwidth || 100, "width")
                };
            });

            fields.length && fields.unshift({ show: true, text: "序号" });
            
            return {
                height: _u.toPixel(dm.height, dm.height ? "max-height" : "height"),
                btns: [],
                columns: fields
            };
        }
    };

    return DetailTable;
});