columns.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import { ref } from "vue";
  2. import dayjs from "dayjs";
  3. import { statusList, inv_type_list } from "./status";
  4. export function useColumns() {
  5. const columns = ref([
  6. {
  7. type: "selection",
  8. width: 55,
  9. hide: ({ checkList }) => !checkList.includes("勾选列")
  10. },
  11. {
  12. label: "序号",
  13. type: "index",
  14. width: 70,
  15. hide: ({ checkList }) => !checkList.includes("序号列")
  16. },
  17. {
  18. label: "发票申请编号",
  19. prop: "invNo",
  20. width: 160
  21. },
  22. {
  23. label: "企业客户",
  24. prop: "customerName",
  25. width: 160
  26. },
  27. {
  28. label: "企业客户编码",
  29. prop: "inv_in",
  30. width: 160
  31. },
  32. {
  33. label: "业务企业编号",
  34. prop: "inv_out"
  35. },
  36. {
  37. label: "发票额度",
  38. prop: "inv_value",
  39. width: 110
  40. },
  41. {
  42. label: "状态",
  43. prop: "status",
  44. minWidth: 80,
  45. cellRenderer: ({ row, props }) => (
  46. <el-tag
  47. size={props.size}
  48. type={
  49. (statusList.find(item => item.value == row.status + "") || {})
  50. .type || "info"
  51. }
  52. effect="plain"
  53. >
  54. {(statusList.find(item => item.value == row.status + "") || {})
  55. .label || "--"}
  56. </el-tag>
  57. )
  58. },
  59. {
  60. label: "发票类型",
  61. prop: "inv_type",
  62. minWidth: 80,
  63. cellRenderer: ({ row, props }) => (
  64. <el-tag
  65. size={props.size}
  66. type={
  67. (inv_type_list.find(item => item.value == row.inv_type + "") || {})
  68. .type || "info"
  69. }
  70. effect="plain"
  71. >
  72. {(inv_type_list.find(item => item.value == row.inv_type + "") || {})
  73. .label || "--"}
  74. </el-tag>
  75. )
  76. },
  77. {
  78. label: "申请人",
  79. prop: "apply_name",
  80. width: 80
  81. },
  82. {
  83. label: "创建时间",
  84. width: 145,
  85. prop: "addtime",
  86. formatter: ({ addtime }) =>
  87. addtime ? dayjs(addtime).format("YYYY-MM-DD HH:mm:ss") : ""
  88. },
  89. {
  90. label: "操作",
  91. fixed: "right",
  92. width: 55,
  93. slot: "operation"
  94. }
  95. ]);
  96. return {
  97. columns
  98. };
  99. }