crud.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import * as api from './api'
  2. import { dict, UserPageQuery, compute, CreateCrudOptionsProps, CreateCrudOptionsRet } from '@fast-crud/fast-crud'
  3. import { inject } from 'vue'
  4. import { BaseColumn } from '/@/views/adManage/utils/commonTabColumn.js'
  5. import { dynBidStrategyEnum } from '/@/views/adManage/utils/enum.js'
  6. export const createCrudOptions = function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
  7. const pageRequest = async (query: UserPageQuery) => {
  8. query['profile'] = context['profileId']
  9. return await api.GetList(query)
  10. }
  11. //权限判定
  12. const hasPermissions = inject('$hasPermissions')
  13. return {
  14. crudOptions: {
  15. table: {
  16. height: 800,
  17. },
  18. container: {
  19. fixedHeight: false,
  20. },
  21. actionbar: {
  22. show: false
  23. },
  24. search: {
  25. show: false,
  26. },
  27. toolbar: {
  28. buttons: {
  29. search: {
  30. show: true,
  31. },
  32. compact: {
  33. show: false,
  34. },
  35. },
  36. },
  37. request: {
  38. pageRequest,
  39. },
  40. rowHandle: {
  41. show: false,
  42. },
  43. columns: {
  44. id: {
  45. title: 'ID',
  46. column: {
  47. show: false,
  48. },
  49. form: {
  50. show: false,
  51. },
  52. },
  53. campaignName: {
  54. title: '广告活动',
  55. column: {
  56. width: '200px',
  57. fixed: 'left',
  58. },
  59. search: {
  60. show: true,
  61. component: {
  62. props: {
  63. clearable: true,
  64. },
  65. },
  66. },
  67. },
  68. placement: {
  69. title: '广告位',
  70. },
  71. dynBidStrategy: {
  72. title: '竞价策略',
  73. form: {
  74. show: false,
  75. },
  76. column: {
  77. width: '160px',
  78. },
  79. type: 'dict-select',
  80. dict: dict({
  81. data: dynBidStrategyEnum,
  82. }),
  83. },
  84. ...BaseColumn,
  85. },
  86. },
  87. }
  88. }