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

<script>
import table from "@/assets/mixins/table";
export default {
  components: {},
  mixins: [table],
  created() {},
  methods: {
    test() {
      this.$router.push("/demo");
    },

    /** 代码构建按钮操作 */
    handleGenCode(row) {
      const appId = row.id;
      this.$router.push({
        path: "/gentable/list",
        query: { "query.appId": appId },
      });
    },
  },
  data() {
    return {
      config: {
        search: [
          {
            name: "name",
            type: "text",
            label: "应用名称",
            fuzzy: true,
          },
          {
            name: "createUserId",
            type: "text",
            label: "创建用户",
            fuzzy: true,
          },
          {
            name: "createUserName",
            type: "text",
            label: "创建用户名称",
            fuzzy: true,
          },
        ],
        columns: [
          { type: "selection", width: 60 },
          { label: "应用名称", prop: "name" },
          { label: "应用标识", prop: "code" },
          { label: "应用访问路径", prop: "path" },
          { label: "备注", prop: "remark" },
          { label: "创建用户名称", prop: "createUserName" },
          {
            label: "操作",
            width: 280,
            formatter: (row) => {
              return (
                <div>
                  <el-button
                    type="primary"
                    icon="el-icon-s-order"
                    size="mini"
                    onClick={() => {
                      this.handleGenCode(row);
                    }}
                  >
                    代码构建
                  </el-button>
                </div>
              );
            },
          },
        ],
      },
    };
  },
};
</script>