dischargeGas.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <BasicModal
  3. @register="register"
  4. title="智能排放瓦斯"
  5. :maskStyle="{ backgroundColor: '#000000aa', backdropFilter: 'blur(3px)' }"
  6. width="1600px"
  7. style="height: 60%"
  8. v-bind="$attrs"
  9. @ok="onSubmit"
  10. :canFullscreen="false"
  11. :destroyOnClose="true"
  12. :footer="null"
  13. :maskClosable="false"
  14. >
  15. <div class="modal-box">
  16. <div class="left-box" style="width: 900px; height: 400px"> </div>
  17. <div class="right-box">
  18. <!-- <div ref="ChartRef" class="line-chart" style="height: 400px; width: 100%"></div> -->
  19. <BarAndLine
  20. class="echarts-line"
  21. xAxisPropType="readTime"
  22. height="400px"
  23. :dataSource="echartsData"
  24. :chartsColumns="chartsColumnListGas"
  25. :option="echatsOption1"
  26. />
  27. </div>
  28. </div>
  29. <div class="setting-box">
  30. <div class="right-inputs">
  31. <div class="vent-flex-row">
  32. <div class="input-title">出风口风量(m³/min):</div>
  33. <span class="input-box" size="large">{{ data.ductOutletAirVolume_merge }}</span>
  34. <div class="input-title">局扇供风量(m³/min):</div>
  35. <span class="input-box" size="large">{{ data.inletAirVolume_merge }}</span>
  36. </div>
  37. </div>
  38. </div>
  39. </BasicModal>
  40. </template>
  41. <script lang="ts" setup>
  42. import { BasicModal, useModalInner } from '/@/components/Modal';
  43. import { ref, nextTick, onMounted, watch } from 'vue';
  44. import { option, chartsColumnListGas, echatsOption1 } from '../fanLocal.data';
  45. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  46. const props = defineProps({
  47. data: {
  48. type: Object,
  49. default: () => {},
  50. },
  51. gasMax: {
  52. type: Number,
  53. },
  54. });
  55. const emit = defineEmits(['close', 'register', 'openModal']);
  56. // 注册 modal
  57. const [register, { closeModal }] = useModalInner((data) => {
  58. nextTick(() => {
  59. if (option['xAxis']) option['xAxis']['data'] = xData;
  60. option['series'] = yDataList;
  61. initEcharts();
  62. });
  63. });
  64. const ChartRef = ref();
  65. const myChart = ref();
  66. const refresh = ref(true);
  67. const xData: any[] = [];
  68. const yDataList: [] = [];
  69. const echartsData = ref<Record<string, any>[]>([]);
  70. const monitorData = ref<Record<string, any>>({});
  71. watch(
  72. () => props.data,
  73. (newVal) => {
  74. // 创建新对象,合并 newVal 和 targetVolume
  75. const combinedData = {
  76. gasT1: newVal.gasT1,
  77. gasT2: newVal.gasT2,
  78. gasT3: newVal.gasT3,
  79. gasT4: newVal.gasT4,
  80. readTime: newVal.readTime || new Date().toISOString(), // 确保有时间字段
  81. };
  82. monitorData.value = combinedData;
  83. if (echartsData.value.length > 20) {
  84. echartsData.value.shift();
  85. }
  86. echartsData.value = [...echartsData.value, combinedData];
  87. console.log('echarts data:', echartsData.value);
  88. }
  89. );
  90. function initEcharts() {
  91. if (ChartRef.value) {
  92. myChart.value = echarts.init(ChartRef.value);
  93. option && myChart.value.setOption(option);
  94. refresh.value = false;
  95. nextTick(() => {
  96. setTimeout(() => {
  97. refresh.value = true;
  98. }, 0);
  99. });
  100. }
  101. }
  102. onMounted(() => {});
  103. function onSubmit() {
  104. emit('close');
  105. closeModal();
  106. }
  107. </script>
  108. <style scoped lang="less">
  109. .modal-box {
  110. display: flex;
  111. flex-direction: row;
  112. background-color: #ffffff05;
  113. padding: 10px 8px 0 8px;
  114. border: 1px solid #00d8ff22;
  115. position: relative;
  116. // min-height: 600px;
  117. .left-box {
  118. flex: 1; /* 占据 3/4 的空间 */
  119. background-image: url(../../../../../assets/images/dischargeGas.svg);
  120. background-repeat: no-repeat;
  121. background-size: contain; /* 确保背景图片完整显示 */
  122. background-position: center; /* 确保背景图片居中 */
  123. }
  124. .right-box {
  125. flex: 1; /* 占据 3/4 的空间 */
  126. height: 400px;
  127. width: 100%;
  128. }
  129. }
  130. .setting-box {
  131. width: 1570px;
  132. height: 70px;
  133. margin: 10px 0;
  134. background-color: #ffffff05;
  135. border: 1px solid #00d8ff22;
  136. display: flex;
  137. align-items: center;
  138. justify-content: space-between;
  139. .right-inputs {
  140. width: 100%;
  141. display: flex;
  142. height: 40px;
  143. margin: 0 10px;
  144. justify-content: space-between;
  145. }
  146. .left-buttons {
  147. display: flex;
  148. height: 40px;
  149. .btn {
  150. margin: 0 10px;
  151. }
  152. }
  153. .border-clip {
  154. width: 1px;
  155. height: 25px;
  156. border-right: 1px solid #8b8b8b77;
  157. }
  158. .input-title {
  159. max-width: 150px;
  160. }
  161. .input-box {
  162. width: 220px !important;
  163. background: transparent !important;
  164. border-color: #00d8ff44 !important;
  165. margin-right: 20px;
  166. color: #fff !important;
  167. }
  168. .btn {
  169. padding: 8px 20px;
  170. position: relative;
  171. border-radius: 2px;
  172. color: #fff;
  173. width: fit-content;
  174. cursor: pointer;
  175. &::before {
  176. position: absolute;
  177. display: block;
  178. content: '';
  179. width: calc(100% - 4px);
  180. height: calc(100% - 4px);
  181. top: 2px;
  182. left: 2px;
  183. border-radius: 2px;
  184. z-index: -1;
  185. }
  186. }
  187. .btn1 {
  188. border: 1px solid #5cfaff;
  189. &::before {
  190. background-image: linear-gradient(#2effee92, #0cb1d592);
  191. }
  192. &:hover {
  193. border: 1px solid #5cfaffaa;
  194. &::before {
  195. background-image: linear-gradient(#2effee72, #0cb1d572);
  196. }
  197. }
  198. }
  199. }
  200. @keyframes open {
  201. 0% {
  202. height: 0px;
  203. }
  204. 100% {
  205. height: fit-content;
  206. }
  207. }
  208. @keyframes close {
  209. 0% {
  210. height: fit-content;
  211. }
  212. 100% {
  213. height: 0px;
  214. }
  215. }
  216. :deep(.zxm-divider-inner-text) {
  217. color: #cacaca88 !important;
  218. }
  219. :deep(.zxm-form-item) {
  220. margin-bottom: 10px;
  221. }
  222. </style>