tableConfig.js 5.25 KB
const state = {
  1: "新增",
  2: "修改",
  3: "删除",
};
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",
      },
      {
        type: "primary",
        icon: "el-icon-upload",
        btnName: "上传",
        size: "mini",
        round: false,
        loading: false,
        event: "upload",
      },
      {
        type: "primary",
        icon: "el-icon-download",
        btnName: "导出",
        size: "mini",
        round: false,
        loading: false,
        event: "download",
      },
    ],
  },
};
export const columnHeader = (editRow, deleteRow, viewRow) => [
  {
    type: "selection",
    align: "center",
    prop: "selection",
    width: "50",
  },
  {
    type: "index",
    label: "序号",
    prop: "id",
    align: "center",
    width: "50",
  },
  {
    label: "顺位航班",
    prop: "flightRand",
    align: "center",
    minWidth: 100,
  },
  {
    label: "状态",
    prop: "status",
    align: "center",
    minWidth: 100,
    render: (h, params) => {
      const { row } = params;
      return h("div", `${state[row.status]}`);
    },
  },
  {
    label: "创建时间",
    prop: "createTime",
    align: "center",
    minWidth: 100,
    sortable: true,
    "sort-method": (a, b) => b.createTime - a.createTime,
  },
  {
    label: "修改时间",
    prop: "updateTime",
    align: "center",
    minWidth: 100,
  },
  {
    label: "创建人",
    prop: "createUserName",
    align: "center",
    minWidth: 100,
  },
  {
    label: "修改人",
    prop: "updateUserName",
    align: "center",
    minWidth: 100,
  },
  {
    label: "操作",
    prop: "operate",
    align: "center",
    minWidth: 120,
    fixed: "right",
    render: (h, params) => {
      return h("div", [
        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);
              },
            },
          },
          "删除"
        ),
        h(
          "el-button",
          {
            props: {
              type: "text",
              size: "mini",
              icon: "el-icon-view",
            },
            on: {
              click() {
                viewRow(params);
              },
            },
          },
          "查看"
        ),
      ]);
    },
  },
];

export const tableData = [
  {
    id: "1",
    flightRand: "LZ003;LZ00",
    status: "1",
    createTime: "2023-08-11",
    updateTime: "2023-08-11",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "2",
    flightRand: "LP001;LP004+1",
    status: "3",
    createTime: "2023-08-11",
    updateTime: "2023-08-11",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "3",
    flightRand: "LZ002;LZ003;LZ001",
    status: "1",
    createTime: "2023-08-10",
    updateTime: "2023-08-10",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "4",
    flightRand: "LZ001;LZ002;LZ004",
    status: "2",
    createTime: "2023-08-11",
    updateTime: "2023-08-11",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "5",
    flightRand: "PS001;PS003",
    status: "1",
    createTime: "2023-08-11",
    updateTime: "2023-08-11",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "6",
    flightRand: "PS002;PS003",
    status: "3",
    createTime: "2023-08-11",
    updateTime: "2023-08-11",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "7",
    flightRand: "FX0092;FX0095;FX0094;FX0090",
    status: "1",
    createTime: "2023-08-10",
    updateTime: "2023-08-10",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "8",
    flightRand: "AB060;AC005;AC204",
    status: "2",
    createTime: "2023-08-10",
    updateTime: "2023-08-10",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
  {
    id: "9",
    flightRand: "FX0090;FX0092",
    status: "1",
    createTime: "2023-08-10",
    updateTime: "2023-08-10",
    createUserName: "wjh",
    updateUserName: "wjh",
  },
];