index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. export const defaultProps = {
  2. children: 'children',
  3. label: 'avmatCategoriesName'
  4. }
  5. /**
  6. *
  7. * @param {*} _this 当前vue 的实例
  8. * @returns 返回一个表格配置数组
  9. */
  10. export const columns = (_this) => [
  11. {
  12. prop: 'avmatCatalogName',
  13. label: '航材名称',
  14. align: 'left'
  15. },
  16. {
  17. prop: 'avmatCatalogCode',
  18. label: '航材编码'
  19. },
  20. {
  21. prop: 'specification',
  22. label: '规格型号'
  23. },
  24. {
  25. prop: 'avmatCategoriesName',
  26. label: '所属分类'
  27. },
  28. {
  29. prop: 'repairPrice',
  30. label: '维修价格(万元)',
  31. edit: true,
  32. onChange: (scope, oldRow) => {
  33. const { row } = scope
  34. if (oldRow.repairPrice == row.repairPrice) return
  35. _this.updateRow(row)
  36. }
  37. },
  38. {
  39. prop: 'purchasePrice',
  40. label: '采购价格(万元)',
  41. edit: true,
  42. onChange: (scope, oldRow) => {
  43. const { row } = scope
  44. if (oldRow.purchasePrice == row.purchasePrice) return
  45. _this.updateRow(row)
  46. }
  47. }
  48. ]
  49. export const modalConfig = (_this) => ({
  50. formItems: [
  51. {
  52. key: 'sparePart',
  53. type: 'input',
  54. label: '航材名称',
  55. disabled: true,
  56. colLayout: { span: 24 }
  57. },
  58. { key: 'maintainPrice', type: 'input', label: '维修价格(元)', colLayout: { span: 24 } },
  59. { key: 'procurementPrice', type: 'input', label: '采购价格', colLayout: { span: 24 } }
  60. ],
  61. labelWidth: '100px',
  62. itemStyle: { padding: '10px' },
  63. width: '500px', // 弹框宽度
  64. rules: {}
  65. })
  66. export const tableData = [
  67. { id: '1', sparePart: '大灯', bookNumber: 'D001', classificationName: '灯泡', maintainPrice: '0', procurementPrice: '200' },
  68. { id: '2', sparePart: '雾灯', bookNumber: 'D002', classificationName: '灯泡', maintainPrice: '10', procurementPrice: '150' },
  69. { id: '3', sparePart: '煤油', bookNumber: 'R01', classificationName: '燃料', maintainPrice: '30', procurementPrice: '500' },
  70. { id: '4', sparePart: '飞机发动机', bookNumber: 'W01', classificationName: '发动机', maintainPrice: '50', procurementPrice: '10' }
  71. ]
  72. /**
  73. *
  74. * @returns 返回表格基础配置项
  75. */
  76. export const options = {
  77. rowKey: 'avmatPriceId',
  78. stripe: true, // 斑马纹
  79. mutiSelect: true, // 多选框
  80. index: false, // 显示序号, 多选则 mutiSelect
  81. loading: false, // 表格动画
  82. initTable: true, // 是否一挂载就加载数据
  83. border: true,
  84. height: 'calc(100vh - 300px)'
  85. }