history.data.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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: any[], deviceOptions: any[]) => FormSchema[] = (dictOptions: any[], 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: 'Select',
  64. required: Boolean(dictOptions.length),
  65. show: Boolean(dictOptions.length),
  66. defaultValue: dictOptions[0] ? dictOptions[0].value : '',
  67. componentProps: {
  68. options: dictOptions,
  69. // onChange: (e, option) => {
  70. // nextTick(async () => {
  71. // await getDataSource();
  72. // });
  73. // },
  74. },
  75. colProps: {
  76. span: 4,
  77. },
  78. },
  79. // {
  80. // label: '子设备',
  81. // field: 'deviceNum',
  82. // // component: 'JDictSelectTag',
  83. // // show: Boolean(dictCode),
  84. // componentProps: {
  85. // dictCode,
  86. // showChooseOption: false,
  87. // placeholder: '请选择',
  88. // },
  89. // colProps: {
  90. // span: 4,
  91. // },
  92. // },
  93. {
  94. label: '间隔时间',
  95. field: 'skip',
  96. component: 'Select',
  97. defaultValue: '8',
  98. componentProps: {
  99. options: [
  100. {
  101. label: '1秒',
  102. value: '1s',
  103. },
  104. {
  105. label: '5秒',
  106. value: '5s',
  107. },
  108. {
  109. label: '10秒',
  110. value: '10s',
  111. },
  112. {
  113. label: '30秒',
  114. value: '30s',
  115. },
  116. {
  117. label: '1分钟',
  118. value: '1m',
  119. },
  120. {
  121. label: '10分钟',
  122. value: '10m',
  123. },
  124. {
  125. label: '30分钟',
  126. value: '30m',
  127. },
  128. {
  129. label: '1小时',
  130. value: '1h',
  131. },
  132. ],
  133. },
  134. colProps: {
  135. span: 4,
  136. },
  137. },
  138. ];
  139. /** 默认的表格props,参考 BasicTable 组件 */
  140. export const defaultTableProps: BasicTableProps = {
  141. columns: [
  142. {
  143. align: 'center',
  144. dataIndex: 'strinstallpos',
  145. defaultHidden: false,
  146. title: '安装位置',
  147. width: 80,
  148. },
  149. ],
  150. bordered: false,
  151. size: 'small',
  152. showIndexColumn: true,
  153. showActionColumn: false,
  154. };
  155. /** 默认的查询表单props,参考 BasicForm 组件 */
  156. export const defaultFormProps: FormProps = {
  157. labelAlign: 'left',
  158. labelCol: { span: 8 },
  159. showAdvancedButton: false,
  160. showSubmitButton: false,
  161. showResetButton: true,
  162. };
  163. /** 默认的表格分页props,参考 BasicTable 组件 */
  164. export const defaultPaginationProps: PaginationProps = {
  165. current: 1,
  166. pageSize: 10,
  167. pageSizeOptions: ['10', '30', '50', '100'],
  168. showQuickJumper: false,
  169. };