bundleMonitorTable.vue 5.4 KB

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