bundleSpyMonitorTable.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div class="dustMonitor">
  3. <div class="search-area">
  4. <a-row>
  5. <a-col :span="12">
  6. <div class="area-item">
  7. <div class="item-text">录入时间:</div>
  8. <span style="width: 240px; color: #fff">{{ createTime }}</span>
  9. </div>
  10. </a-col>
  11. <a-col :span="12">
  12. <div class="area-item">
  13. <div class="item-text">录入人员:</div>
  14. <span style="width: 240px; color: #fff">{{ createBy }}</span>
  15. </div>
  16. </a-col>
  17. </a-row>
  18. </div>
  19. <div class="content-area">
  20. <a-table
  21. v-if="columns.length > 0"
  22. :columns="columns"
  23. :data-source="tableData"
  24. size="small"
  25. :pagination="false"
  26. class="tableW"
  27. :scroll="{ y: 620 }"
  28. >
  29. <template #bodyCell="{ column, record }">
  30. <a v-if="column.dataIndex === 'operation'" class="table-action-link" @click="handlerLocation(record)">定位</a>
  31. </template>
  32. </a-table>
  33. </div>
  34. </div>
  35. </template>
  36. <script setup lang="ts">
  37. import { ref, onMounted, reactive, watch } from 'vue';
  38. import { bundleSpycolumns } from './comment.data';
  39. import { getInfoList, getAllFileList } from './comment.api';
  40. // import 'ant-design-vue/dist/antd.css'; // 引入样式
  41. const emit = defineEmits(['locate']);
  42. const props = defineProps({
  43. isShowAction: {
  44. type: Boolean,
  45. default: false,
  46. },
  47. });
  48. const columns = ref([]);
  49. watch(
  50. () => props.isShowAction,
  51. (value) => {
  52. if (value) {
  53. bundleSpycolumns.push({
  54. title: '操作',
  55. dataIndex: 'operation',
  56. width: 100,
  57. align: 'center',
  58. });
  59. if (columns.value.length == 0) columns.value = bundleSpycolumns;
  60. } else {
  61. if (columns.value.length == 0) columns.value = bundleSpycolumns;
  62. }
  63. },
  64. { immediate: true }
  65. );
  66. let selectList = ref<any[]>([]);
  67. let formSearch = reactive({
  68. pageNum: 1,
  69. pageSize: 1000,
  70. fileId: '',
  71. fileName: '',
  72. });
  73. const latentCount = ref(0); // 缓慢氧化阶段(潜伏期)
  74. const selfHeatingCount = ref(0); // 加速氧化阶段(自热期)
  75. const combustionCount = ref(0); // 剧烈氧化阶段(燃烧期)
  76. const latentPercent = ref(0); // 缓慢氧化阶段(潜伏期)
  77. const selfHeatingPercent = ref(0); // 加速氧化阶段(自热期)
  78. const combustionPercent = ref(0); // 剧烈氧化阶段(燃烧期)
  79. let createBy = ref<any[]>([]);
  80. let createTime = ref<any[]>([]);
  81. let tableData = ref<any[]>([]);
  82. let selectedFileId = ref<string | null>(null);
  83. //获取色谱仪报表
  84. async function getTableList(params: any) {
  85. let res = await getInfoList({ type: 'bundleSpy', ...params });
  86. const content = res.content;
  87. let contentArr = JSON.parse(content);
  88. createBy.value = res.createBy;
  89. createTime.value = res.createTime;
  90. latentCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化阶段(潜伏期)').length;
  91. selfHeatingCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '加速氧化阶段(自热期)').length;
  92. combustionCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化阶段(燃烧期)').length;
  93. const total = contentArr.length;
  94. latentPercent.value = (latentCount.value / total) * 100;
  95. selfHeatingPercent.value = (selfHeatingCount.value / total) * 100;
  96. combustionPercent.value = (combustionCount.value / total) * 100;
  97. tableData.value = contentArr;
  98. }
  99. //获取所有文件列表
  100. async function getAllFile() {
  101. let res = await getAllFileList({ type: 'bundleSpy' });
  102. selectList.value = res.records.map((item: any) => ({
  103. fileId: item.fileId,
  104. fileName: item.fileName,
  105. }));
  106. if (selectList.value.length > 0) {
  107. formSearch.fileId = selectList.value[0].fileId;
  108. getSearch();
  109. }
  110. }
  111. //查询
  112. function getSearch() {
  113. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  114. const params = {
  115. fileId: formSearch.fileId,
  116. fileName: selectedFile ? selectedFile.fileName : '',
  117. };
  118. getTableList(params);
  119. }
  120. function handlerLocation(record) {
  121. emit('locate', record);
  122. }
  123. onMounted(() => {
  124. getTableList({ type: 'bundleSpy' });
  125. getAllFile().then(() => {
  126. if (selectList.value.length > 0) {
  127. formSearch.fileId = selectList.value[0].fileId;
  128. selectedFileId.value = selectList.value[0].fileId;
  129. getSearch();
  130. }
  131. });
  132. });
  133. </script>
  134. <style lang="less" scoped>
  135. @ventSpace: zxm;
  136. .dustMonitor {
  137. .search-area {
  138. margin: 15px;
  139. .area-item {
  140. display: flex;
  141. align-items: center;
  142. .item-text {
  143. color: #fff;
  144. }
  145. }
  146. }
  147. .zxm-picker,
  148. .zxm-input {
  149. border: 1px solid #3ad8ff77;
  150. background-color: #ffffff00;
  151. color: #fff;
  152. }
  153. }
  154. :deep(.@{ventSpace}-table-body) {
  155. height: auto !important;
  156. tr > td {
  157. background: #ffffff00 !important;
  158. }
  159. tr.@{ventSpace}-table-row-selected {
  160. td {
  161. background: #007cc415 !important;
  162. }
  163. }
  164. }
  165. :deep(.jeecg-basic-table .@{ventSpace}-table-wrapper .@{ventSpace}-table-title) {
  166. min-height: 0;
  167. }
  168. :deep(.@{ventSpace}-pagination) {
  169. margin-right: 20px !important;
  170. }
  171. :deep(.zxm-table-thead > tr > th:last-child) {
  172. border-right: 1px solid #91e9fe55 !important;
  173. }
  174. </style>