tableConfig.js 3.09 KB
const state = {
  1: "有效",
  0: "无效",
};
export const tableAttr = {
  border: true,
  loadingTable: false,
  isDragSort: false, // 拖拽tableData数据一定要加id字段
  maxHeight: 300,
  btnCofig: {
    isBtn: true,
    btnGroup: [
      {
        type: "primary", // text、primary、danger
        icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
        btnName: "搜索",
        size: "mini", // medium / small / mini
        round: false,
        loading: false,
        event: "search",
      },
      // {
      //   type: "info",
      //   icon: "",
      //   btnName: "重置",
      //   size: "mini",
      //   round: false,
      //   loading: false,
      //   event: "restForm",
      // },
      {
        type: "primary",
        icon: "el-icon-plus",
        btnName: "添加",
        size: "mini",
        round: false,
        loading: false,
        event: "add",
      },
    ],
  },
};
export const columnHeader = (viewRow, editRow, deleteRow) => [
  {
    type: "index",
    label: "序号",
    prop: "id",
    align: "center",
    width: "50",
  },
  {
    label: "原航班",
    prop: "originOfFlightNo",
    align: "center",
    minWidth: 80,
  },
  {
    label: "配载航班",
    prop: "rankFltNoStr",
    align: "center",
    minWidth: 100,
  },
  {
    label: "航线",
    prop: "rankFltRouteStr",
    align: "center",
    minWidth: 100,
  },
  {
    label: "状态",
    prop: "status",
    align: "center",
    minWidth: 80,
    render: (h, params) => {
      const { row } = params;
      return h("div", `${state[row.status]}`);
    },
  },
  {
    label: "修改时间",
    prop: "updateTime",
    align: "center",
    minWidth: 120,
    // "sort-method": (a, b) => b.createTime - a.createTime,
  },
  {
    label: "修改人",
    prop: "updateUserName",
    align: "center",
    minWidth: 80,
  },
  {
    label: "操作",
    prop: "operate",
    align: "center",
    minWidth: 125,
    fixed: "right",
    render: (h, params) => {
      return h("div", [
        h(
          "el-button",
          {
            props: {
              type: "text",
              size: "mini",
              icon: "el-icon-view",
            },
            on: {
              click() {
                viewRow(params);
              },
            },
          },
          "查看"
        ),
        h(
          "el-button",
          {
            props: {
              type: "text",
              size: "mini",
              icon: "el-icon-edit",
            },
            on: {
              click() {
                editRow(params);
              },
            },
          },
          "修改"
        ),
        h(
          "el-button",
          {
            style: {
              color: "#ff4949",
            },
            props: {
              type: "text",
              size: "mini",
              icon: "el-icon-delete",
            },
            on: {
              click() {
                deleteRow(params);
              },
            },
          },
          "删除"
        ),
      ]);
    },
  },
];