bundleMonitorTable.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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 { bundleColumns } 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. let selectList = ref<any[]>([]);
  49. let jcddArr = ref<any[]>([]);
  50. let createBy = ref<any[]>([]);
  51. let createTime = ref<any[]>([]);
  52. let formSearch = reactive({
  53. pageNum: 1,
  54. pageSize: 1000,
  55. fileId: '',
  56. fileName: '',
  57. });
  58. const latentCount = ref(0); // 缓慢氧化阶段(潜伏期)
  59. const selfHeatingCount = ref(0); // 加速氧化阶段(自热期)
  60. const combustionCount = ref(0); // 剧烈氧化阶段(燃烧期)
  61. const latentPercent = ref(0); // 缓慢氧化阶段(潜伏期)
  62. const selfHeatingPercent = ref(0); // 加速氧化阶段(自热期)
  63. const combustionPercent = ref(0); // 剧烈氧化阶段(燃烧期)
  64. let tableData = ref<any[]>([]);
  65. let selectedFileId = ref<string | null>(null);
  66. const columns = ref([]);
  67. watch(
  68. () => props.isShowAction,
  69. (value) => {
  70. if (value) {
  71. bundleColumns.push({
  72. title: '操作',
  73. dataIndex: 'operation',
  74. width: 100,
  75. align: 'center',
  76. });
  77. if (columns.value.length == 0) columns.value = bundleColumns;
  78. } else {
  79. if (columns.value.length == 0) columns.value = bundleColumns;
  80. }
  81. },
  82. { immediate: true }
  83. );
  84. function handlerLocation(record) {
  85. emit('locate', record);
  86. }
  87. //获取束管日报
  88. async function getTableList(params: any) {
  89. let res = await getInfoList({ type: 'bundle', ...params });
  90. const content = res.content;
  91. let contentArr = JSON.parse(content);
  92. createBy.value = res.createBy;
  93. createTime.value = res.createTime;
  94. latentCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '缓慢氧化阶段(潜伏期)').length;
  95. selfHeatingCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '加速氧化阶段(自热期)').length;
  96. combustionCount.value = contentArr.filter((item: any) => item.internalFireWarnLevel === '剧烈氧化阶段(燃烧期)').length;
  97. const total = contentArr.length;
  98. latentPercent.value = (latentCount.value / total) * 100;
  99. selfHeatingPercent.value = (selfHeatingCount.value / total) * 100;
  100. combustionPercent.value = (combustionCount.value / total) * 100;
  101. tableData.value = contentArr;
  102. }
  103. //获取所有文件列表
  104. async function getAllFile() {
  105. let res = await getAllFileList({ type: 'bundle' });
  106. selectList.value = res.records.map((item: any) => ({
  107. fileId: item.fileId,
  108. fileName: item.fileName,
  109. }));
  110. jcddArr.value = res.records.map((item: any) => ({
  111. fileId: item.jcdd,
  112. }));
  113. if (selectList.value.length > 0) {
  114. formSearch.fileId = selectList.value[0].fileId;
  115. getSearch();
  116. }
  117. }
  118. //查询
  119. function getSearch() {
  120. const selectedFile = selectList.value.find((item) => item.fileId === formSearch.fileId);
  121. const params = {
  122. fileId: formSearch.fileId,
  123. fileName: selectedFile ? selectedFile.fileName : '',
  124. };
  125. getTableList(params);
  126. }
  127. onMounted(() => {
  128. getTableList({ type: 'bundle' });
  129. getAllFile().then(() => {
  130. if (selectList.value.length > 0) {
  131. formSearch.fileId = selectList.value[0].fileId;
  132. selectedFileId.value = selectList.value[0].fileId;
  133. getSearch();
  134. }
  135. });
  136. });
  137. </script>
  138. <style lang="less" scoped>
  139. @ventSpace: zxm;
  140. .dustMonitor {
  141. .search-area {
  142. margin: 15px;
  143. .area-item {
  144. display: flex;
  145. align-items: center;
  146. .item-text {
  147. color: #fff;
  148. }
  149. }
  150. }
  151. .zxm-picker,
  152. .zxm-input {
  153. border: 1px solid #3ad8ff77;
  154. background-color: #ffffff00;
  155. color: #fff;
  156. }
  157. }
  158. :deep(.@{ventSpace}-table-body) {
  159. height: auto !important;
  160. tr > td {
  161. background: #ffffff00 !important;
  162. }
  163. tr.@{ventSpace}-table-row-selected {
  164. td {
  165. background: #007cc415 !important;
  166. }
  167. }
  168. }
  169. :deep(.jeecg-basic-table .@{ventSpace}-table-wrapper .@{ventSpace}-table-title) {
  170. min-height: 0;
  171. }
  172. :deep(.@{ventSpace}-pagination) {
  173. margin-right: 20px !important;
  174. }
  175. :deep(.zxm-table-thead > tr > th:last-child) {
  176. border-right: 1px solid #91e9fe55 !important;
  177. }
  178. </style>