history.data.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. import dayjs from 'dayjs';
  2. import { BasicTableProps, PaginationProps, FormProps, FormSchema } from '/@/components/Table';
  3. // import { getAutoScrollContainer } from '/@/utils/common/compUtils';
  4. /**
  5. * 默认的查询表单项props
  6. *
  7. * @param dictCode 字典编码,用于初始化子设备下拉框
  8. * @param deviceOptions 设备编码,用于初始化设备下拉框
  9. * @returns
  10. */
  11. export const getDefaultSchemas: (dictCode: string, deviceOptions: any[]) => FormSchema[] = (dictCode: string, deviceOptions: any[]) => [
  12. {
  13. field: 'ttime_begin',
  14. label: '开始时间',
  15. component: 'DatePicker',
  16. defaultValue: dayjs().startOf('date'),
  17. required: true,
  18. componentProps: {
  19. showTime: true,
  20. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  21. // getPopupContainer: getAutoScrollContainer,
  22. },
  23. colProps: {
  24. span: 4,
  25. },
  26. },
  27. {
  28. field: 'ttime_end',
  29. label: '结束时间',
  30. component: 'DatePicker',
  31. defaultValue: dayjs(),
  32. required: true,
  33. componentProps: {
  34. showTime: true,
  35. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  36. // getPopupContainer: getAutoScrollContainer,
  37. },
  38. colProps: {
  39. span: 4,
  40. },
  41. },
  42. {
  43. label: '查询设备',
  44. field: 'gdeviceid',
  45. component: 'Select',
  46. required: true,
  47. defaultValue: deviceOptions[0].value,
  48. componentProps: {
  49. options: deviceOptions,
  50. // onChange: (e, option) => {
  51. // nextTick(async () => {
  52. // await getDataSource();
  53. // });
  54. // },
  55. },
  56. colProps: {
  57. span: 4,
  58. },
  59. },
  60. {
  61. label: '子设备',
  62. field: 'deviceNum',
  63. component: 'JDictSelectTag',
  64. show: Boolean(dictCode),
  65. componentProps: {
  66. dictCode,
  67. placeholder: '请选择',
  68. },
  69. colProps: {
  70. span: 4,
  71. },
  72. },
  73. {
  74. label: '间隔时间',
  75. field: 'skip',
  76. component: 'Select',
  77. defaultValue: '8',
  78. componentProps: {
  79. options: [
  80. {
  81. label: '1秒',
  82. value: '1s',
  83. },
  84. {
  85. label: '5秒',
  86. value: '5s',
  87. },
  88. {
  89. label: '10秒',
  90. value: '10s',
  91. },
  92. {
  93. label: '30秒',
  94. value: '30s',
  95. },
  96. {
  97. label: '1分钟',
  98. value: '1m',
  99. },
  100. {
  101. label: '10分钟',
  102. value: '10m',
  103. },
  104. {
  105. label: '30分钟',
  106. value: '30m',
  107. },
  108. {
  109. label: '1小时',
  110. value: '1h',
  111. },
  112. ],
  113. },
  114. colProps: {
  115. span: 4,
  116. },
  117. },
  118. ];
  119. /** 默认的表格props,参考 BasicTable 组件 */
  120. export const defaultTableProps: BasicTableProps = {
  121. columns: [],
  122. bordered: false,
  123. size: 'small',
  124. showIndexColumn: true,
  125. showActionColumn: false,
  126. };
  127. /** 默认的查询表单props,参考 BasicForm 组件 */
  128. export const defaultFormProps: FormProps = {
  129. labelAlign: 'left',
  130. showAdvancedButton: false,
  131. showSubmitButton: false,
  132. showResetButton: true,
  133. };
  134. /** 默认的表格分页props,参考 BasicTable 组件 */
  135. export const defaultPaginationProps: PaginationProps = {
  136. current: 1,
  137. pageSize: 10,
  138. pageSizeOptions: ['10', '30', '50', '100'],
  139. showQuickJumper: false,
  140. };