indexColumns.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. function columns(vm) {
  2. const cols = [
  3. {
  4. title: '序号',
  5. key: 'rowIndex',
  6. width: 60,
  7. align: 'center',
  8. customRender: (t, r, index) => {
  9. return parseInt(index) + 1
  10. }
  11. },
  12. // {
  13. // title: '车间',
  14. // align: 'center',
  15. // dataIndex: 'deptName',
  16. // key: 'deptName',
  17. // customRender: (value, row, index) => {
  18. // const obj = {
  19. // children: value,
  20. // attrs: {}
  21. // }
  22. // if (index % 5 === 0) {
  23. // obj.attrs.rowSpan = 5
  24. // } else {
  25. // obj.attrs.rowSpan = 0
  26. // }
  27. // return obj
  28. // }
  29. // },
  30. {
  31. title: '工区',
  32. align: 'center',
  33. dataIndex: 'teamName',
  34. key: 'teamName',
  35. customRender: (value, row, index) => {
  36. const obj = {
  37. children: value,
  38. attrs: {}
  39. }
  40. if (index % 5 === 0) {
  41. obj.attrs.rowSpan = 5
  42. } else {
  43. obj.attrs.rowSpan = 0
  44. }
  45. return obj
  46. }
  47. },
  48. {
  49. title: '设备',
  50. align: 'center',
  51. dataIndex: 'sbmc',
  52. key: 'sbmc'
  53. },
  54. {
  55. title: '总数',
  56. align: 'center',
  57. dataIndex: 'total',
  58. key: 'total'
  59. },
  60. {
  61. title: '月份',
  62. align: 'center',
  63. dataIndex: 'yf',
  64. key: 'yf',
  65. children: [
  66. {
  67. title: '计划',
  68. align: 'center',
  69. dataIndex: 'plan',
  70. key: 'plan'
  71. },
  72. {
  73. title: '完成',
  74. align: 'center',
  75. dataIndex: 'actual',
  76. key: 'actual'
  77. },
  78. {
  79. title: '兑现',
  80. align: 'center',
  81. dataIndex: 'dx',
  82. key: 'dx',
  83. scopedSlots: { customRender: 'dxs' }
  84. }
  85. ]
  86. }
  87. ]
  88. return cols
  89. }
  90. export default columns