<template>
    <div class="page">
        <LayoutTable :data='tableData' :config='tableConfig' />
    </div>
</template>

<script>
import table from "@/assets/mixins/table";

export default {
    mixins: [table],
    data() {
        return {
            config: {
                search: [
                  {
                    name: "tableCode",
                    type: "text",
                    label: "关联主表表名",
                    fuzzy: true,
                  },
                  {
                    name: "fieldCode",
                    type: "text",
                    label: "字段编码",
                    fuzzy: true,
                  },
                  {
                    name: "fieldName",
                    type: "text",
                    label: "字段名称",
                    fuzzy: true,
                  },
                ],
                columns: [
                    { type: "selection", width: 60 },
                    { label: "ID", prop: "id", formatter: this.formatterString },
                    { label: "关联主表表名", prop: "tableCode" },
                    { label: "字段编码", prop: "fieldCode" },
                    { label: "字段名称", prop: "fieldName" },
                    { label: "数据类型", prop: "fieldType" },
                    {
                        label: "数据长度",
                        prop: "fieldLen",
                        formatter: this.formatterString,
                    },
                    {
                        label: "允许为空",
                        prop: "fieldNull",
                        formatter: this.formatterString,
                    },
                    {
                        label: "排序号",
                        prop: "fieldOrderNo",
                        formatter: this.formatterString,
                    },
                    { label: "备注", prop: "remark" },
                    { label: "是否启用", prop: "enabled" },
                    {
                        label: "操作",
                        width: 180,
                        formatter: (row) => {
                            return (
                                <table-buttons
                                    row={row}
                                    onEdit={this.toEdit}
                                    noDel
                                />
                            );
                        },
                    },
                ],
            },
        };
    },
};
</script>