tableConfig.js 5.83 KB
const state = {
  1: "有效",
  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",
      },
    ],
  },
};
export const columnHeader = (viewRow, editRow, deleteRow) => [
  {
    type: "selection",
    align: "center",
    prop: "selection",
    width: "50",
  },
  {
    type: "index",
    label: "序号",
    prop: "id",
    align: "center",
    width: "50",
  },
  {
    label: "原航班号",
    prop: "fltNo",
    align: "center",
    minWidth: 100,
  },
  {
    label: "顺位航班",
    prop: "flightRand",
    align: "center",
    minWidth: 100,
  },
  {
    label: "URSA包含",
    prop: "includeUrsa",
    align: "center",
    minWidth: 100,
  },
  {
    label: "URSA不包含",
    prop: "notIncludeUrsa",
    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: "createUserName",
    align: "center",
    minWidth: 100,
  },
  {
    label: "修改时间",
    prop: "updateTime",
    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-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);
              },
            },
          },
          "删除"
        ),
      ]);
    },
  },
];

export const tableData = [
  {
    id: "1",
    flightRand: "LZ003;LZ00",
    status: "1",
    fltNo: "FX0090",
    includeUrsa: "URSACODE191",
    notIncludeUrsa: "P_3",
    createTime: "2023-08-14",
    createUserName: "wjh",
    updateTime: "2023-08-14",
    updateUserName: "wjh",
  },
  {
    id: "2",
    flightRand: "LP001;LP004+1",
    status: "3",
    fltNo: "FX0090",
    includeUrsa: "P_;URSACODE105",
    notIncludeUrsa: "P_21",
    createTime: "2023-08-14",
    createUserName: "wjh",
    updateTime: "2023-08-14",
    updateUserName: "wjh",
  },
  {
    id: "3",
    flightRand: "CQ00;LZ003;CS0004",
    status: "1",
    fltNo: "CS0002",
    includeUrsa: "URSACODE12",
    notIncludeUrsa: "P_2",
    createTime: "2023-08-14",
    createUserName: "wjh",
    updateTime: "2023-08-14",
    updateUserName: "wjh",
  },
  {
    id: "4",
    flightRand: "LZ001;LZ002;LZ004",
    status: "1",
    fltNo: "FX0090",
    includeUrsa: "URSACODE192",
    notIncludeUrsa: "P_17",
    createTime: "2023-08-11",
    createUserName: "wjh",
    updateTime: "2023-08-11",
    updateUserName: "wjh",
  },
  {
    id: "5",
    flightRand: "PS001;PS003",
    status: "1",
    fltNo: "FX0091",
    includeUrsa: "URSACODE10",
    notIncludeUrsa: "P_28",
    createTime: "2023-08-11",
    createUserName: "wjh",
    updateTime: "2023-08-11",
    updateUserName: "wjh",
  },
  {
    id: "6",
    flightRand: "PS002;PS003",
    status: "3",
    fltNo: "XN007",
    includeUrsa: "URSACODE27",
    notIncludeUrsa: "P_4",
    createTime: "2023-08-11",
    createUserName: "wjh",
    updateTime: "2023-08-11",
    updateUserName: "wjh",
  },
  {
    id: "7",
    flightRand: "XN001;XN002;XN003;XN004",
    status: "1",
    fltNo: "XN001",
    includeUrsa: "URSACODE34",
    notIncludeUrsa: "P_7",
    createTime: "2023-08-10",
    createUserName: "wjh",
    updateTime: "2023-08-10",
    updateUserName: "wjh",
  },
  {
    id: "8",
    flightRand: "HA004",
    status: "3",
    fltNo: "LZ007",
    includeUrsa: "URSACODE71",
    notIncludeUrsa: "P_2",
    createTime: "2023-08-10",
    createUserName: "wjh",
    updateTime: "2023-08-10",
    updateUserName: "wjh",
  },
  {
    id: "9",
    flightRand: "AB0001;AB123",
    status: "1",
    fltNo: "AB0001",
    includeUrsa: "URSACODE87",
    notIncludeUrsa: "P_26",
    createTime: "2023-08-10",
    createUserName: "wjh",
    updateTime: "2023-08-10",
    updateUserName: "wjh",
  },
];