WorkFaceHandlerHistoryTable.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="handler-history-table">
  3. <BasicTable ref="handlerHistory" @register="registerTable" />
  4. </div>
  5. </template>
  6. <script lang="ts" name="system-user" setup>
  7. //ts语法
  8. import { watch, ref, defineExpose } from 'vue';
  9. import { BasicTable } from '/@/components/Table';
  10. import { useListPage } from '/@/hooks/system/useListPage';
  11. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  12. import { defHttp } from '/@/utils/http/axios';
  13. const list = (params) => defHttp.get({ url: '/safety/ventanalyDevicesetLog/list', params });
  14. const props = defineProps({
  15. columnsType: {
  16. type: String,
  17. required: true,
  18. },
  19. deviceType: {
  20. type: String,
  21. required: true,
  22. },
  23. deviceListApi: {
  24. type: Function,
  25. },
  26. designScope: {
  27. type: String,
  28. },
  29. sysId: {
  30. type: String,
  31. },
  32. scroll: {
  33. type: Object,
  34. default: () => {}
  35. }
  36. });
  37. const handlerHistory = ref()
  38. const columns = ref([])
  39. watch(
  40. () => {
  41. return props.columnsType;
  42. },
  43. (newVal) => {
  44. const column = getTableHeaderColumns(newVal)
  45. if (column && column.length < 1) {
  46. const arr = newVal.split('_')
  47. const columnKey = arr.reduce((prev, cur, index) => {
  48. if (index !== arr.length - 2) {
  49. return prev + '_' + cur
  50. } else {
  51. return prev
  52. }
  53. })
  54. columns.value = getTableHeaderColumns(arr[0] + '_history');
  55. } else {
  56. columns.value = column
  57. }
  58. if (handlerHistory.value) reload()
  59. },
  60. {
  61. immediate: true
  62. }
  63. );
  64. // 列表页面公共参数、方法
  65. const { tableContext } = useListPage({
  66. tableProps: {
  67. api: list,
  68. columns: columns,
  69. canResize: true,
  70. showTableSetting: false,
  71. showActionColumn: false,
  72. bordered: false,
  73. size: 'small',
  74. scroll: props.scroll,
  75. formConfig: {
  76. labelAlign: 'left',
  77. showAdvancedButton: false,
  78. baseColProps: {
  79. // offset: 0.5,
  80. xs: 24,
  81. sm: 24,
  82. md: 24,
  83. lg: 9,
  84. xl: 7,
  85. xxl: 4,
  86. },
  87. schemas: [
  88. {
  89. label: '时间范围',
  90. field: 'createTime',
  91. component: 'RangePicker',
  92. componentProps: {
  93. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  94. },
  95. },
  96. // {
  97. // label: '查询设备',
  98. // field: 'gdeviceid',
  99. // component: 'ApiSelect',
  100. // componentProps: {
  101. // api: props.deviceListApi,
  102. // resultField: 'records',
  103. // labelField: 'strname',
  104. // valueField: 'id',
  105. // },
  106. // },
  107. ],
  108. fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], '']],
  109. },
  110. fetchSetting: {
  111. listField: 'records',
  112. },
  113. pagination: {
  114. current: 1,
  115. pageSize: 10,
  116. pageSizeOptions: ['5', '10', '20'],
  117. },
  118. beforeFetch(params) {
  119. params.devicetype = props.deviceType + '*';
  120. if (props.sysId) {
  121. params.sysId = props.sysId;
  122. }
  123. },
  124. },
  125. });
  126. //注册table数据
  127. const [registerTable, { reload, setLoading }] = tableContext;
  128. defineExpose({ setLoading })
  129. </script>
  130. <style scoped lang="less">
  131. @ventSpace: zxm;
  132. // :deep(.@{ventSpace}-table-body) {
  133. // height: auto !important;
  134. // }
  135. :deep(.zxm-picker){
  136. height: 30px !important;
  137. }
  138. .handler-history-table {
  139. width: 100%;
  140. :deep(.jeecg-basic-table-form-container) {
  141. .@{ventSpace}-form {
  142. padding: 0 !important;
  143. border: none !important;
  144. margin-bottom: 0 !important;
  145. .@{ventSpace}-picker,
  146. .@{ventSpace}-select-selector {
  147. width: 100% !important;
  148. height: 100%;
  149. background: #00000017;
  150. border: 1px solid #b7b7b7;
  151. input,
  152. .@{ventSpace}-select-selection-item,
  153. .@{ventSpace}-picker-suffix {
  154. color: #fff;
  155. }
  156. .@{ventSpace}-select-selection-placeholder {
  157. color: #ffffffaa;
  158. }
  159. }
  160. }
  161. .@{ventSpace}-table-title {
  162. min-height: 0 !important;
  163. }
  164. }
  165. }
  166. </style>