fiber.modal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <BasicModal v-bind="$attrs" @register="register" :title="`光纤测温详情 ${currentTime}`" width="1200px" @ok="handleOk" @cancel="handleCancel" >
  3. <div class="fiber-modal">
  4. <div class="modal-left">
  5. <div v-for="device in deviceList" class="link-item" :class="{'active-device-title': device.deviceID === activeDeviceID }" :key="device.deviceID">
  6. <span class="" @click="selectDevice(device.deviceID)">{{ device.stationname }}</span>
  7. </div>
  8. </div>
  9. <div class="modal-right">
  10. <div class="right-top">
  11. <div class="top-item">
  12. <div class="icon">
  13. <SvgIcon class="icon-style max-temperature" size="38" name="max-temperature" />
  14. </div>
  15. <div class="item-container">
  16. <div class="title">最高温度</div>
  17. <div class="value">{{ posMonitor.fmax }} <span>℃</span> </div>
  18. </div>
  19. </div>
  20. <div class="top-item">
  21. <div class="icon">
  22. <SvgIcon class="icon-style min-temperature" size="38" name="min-temperature" />
  23. </div>
  24. <div class="item-container">
  25. <div class="title">最低温度</div>
  26. <div class="value">{{ posMonitor.fmin }} <span>℃</span></div>
  27. </div>
  28. </div>
  29. <div class="top-item">
  30. <div class="icon">
  31. <SvgIcon class="icon-style aveg-temperature" size="38" name="aveg-temperature" />
  32. </div>
  33. <div class="item-container">
  34. <div class="title">平均温度</div>
  35. <div class="value">{{ posMonitor.favg }} <span>℃</span></div>
  36. </div>
  37. </div>
  38. <div class="top-item warning-box">
  39. <div class="icon">
  40. <SvgIcon class="icon-style" size="38" name="risk-level" />
  41. </div>
  42. <div class="item-container">
  43. <div class="title">风险等级</div>
  44. <div class="warning-value">低风险</div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="right-center">
  49. <div class="table-box">
  50. <span class="base-title">测点监测详情</span>
  51. <a-table
  52. size="small"
  53. :columns="columns"
  54. :data-source="posList"
  55. :pagination="false"
  56. :scroll="{ y: 200 }"
  57. />
  58. </div>
  59. <div class="warning-box">
  60. <span class="base-title">预警历史详情</span>
  61. <div class="warning-container">
  62. <dv-scroll-board ref="scrollBoard" :config="warningConfig" style="width: 100%; height: 240px; overflow-y: auto; border: 1px solid #39e8ff33;" />
  63. </div>
  64. </div>
  65. </div>
  66. <div class="right-bottom">
  67. <span class="base-title">测点监测曲线</span>
  68. <div class="echarts-box">
  69. <BarAndLine
  70. xAxisPropType="pos"
  71. :dataSource="posList"
  72. height="100%"
  73. :chartsColumns="chartsColumns"
  74. :option="echatsOption"
  75. chartsType="listMonitor" />
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </BasicModal>
  81. </template>
  82. <script lang="ts">
  83. import { defineComponent, ref, watch, shallowRef, reactive } from 'vue';
  84. import { BasicModal, useModalInner } from '/@/components/Modal';
  85. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  86. import { SvgIcon } from '/@/components/Icon';
  87. import { Decoration7 as DvDecoration7, ScrollBoard as DvScrollBoard } from '@kjgl77/datav-vue3';
  88. import dayjs from 'dayjs'
  89. export default defineComponent({
  90. components: { BasicModal, BarAndLine, SvgIcon, DvScrollBoard, DvDecoration7 },
  91. props: {
  92. dataSource: {type: Array},
  93. activeID: {type: String}
  94. },
  95. setup(props) {
  96. const currentTime = ref(dayjs().format('YYYY-MM-DD HH:mm:ss'))
  97. const modelRef = ref({});
  98. const loading = ref(true);
  99. const activeDeviceID = ref('');
  100. const deviceList = ref<any[]>([])
  101. const posList = ref<any[]>([])
  102. const posMonitor = shallowRef({})
  103. const echatsOption = {
  104. grid: {
  105. top: '20%',
  106. left: '2px',
  107. right: '10px',
  108. bottom: '3%',
  109. containLabel: true
  110. },
  111. toolbox: {
  112. feature: {}
  113. }
  114. }
  115. const chartsColumns = [
  116. {
  117. legend: '测点温度',
  118. seriesName: '(℃)',
  119. ymax: 200,
  120. yname: '℃',
  121. linetype: 'line',
  122. yaxispos: 'left',
  123. color: '#FDB146',
  124. sort: 1,
  125. xRotate: 0,
  126. dataIndex: 'value',
  127. },
  128. ]
  129. const columns = [
  130. {
  131. title: '安装位置',
  132. dataIndex: 'position',
  133. width: 60,
  134. align: 'center',
  135. customRender: ({ index }) => {
  136. return `测点${index}`
  137. }
  138. },
  139. {
  140. title: '安装距离(m)',
  141. dataIndex: 'pos',
  142. align: 'center',
  143. width: 60,
  144. },
  145. {
  146. title: '测点温度',
  147. dataIndex: 'value',
  148. align: 'center',
  149. width: 50,
  150. },
  151. {
  152. title: '测点状态',
  153. dataIndex: 'state',
  154. align: 'center',
  155. width: 50,
  156. customRender: () => {
  157. return `正常`
  158. }
  159. },
  160. ];
  161. const warningConfig = reactive({
  162. header: ['测点', '温度', '预警信息'],
  163. data: [
  164. ['测点6', '318℃', '严重报警'],
  165. ['测点43', '142℃', '一般预警'],
  166. ['测点23', '167℃', '一版预警'],
  167. ['测点6', '198℃', '超高预警'],
  168. ['测点65', '197℃', '超高预警'],
  169. ['测点78', '154℃', '一般预警'],
  170. ['测点61', '104℃', '一般预警'],
  171. ['测点87', '150℃', '一般信息'],
  172. ],
  173. index: false,
  174. columnWidth: [150],
  175. headerHeight: 38,
  176. headerBGC: '#3d9dd45d',
  177. oddRowBGC: '#009acd10',
  178. evenRowBGC: '#009acd05',
  179. align: ['center', 'center', 'center'],
  180. });
  181. const [register, { setModalProps, closeModal }] = useModalInner();
  182. function handleVisibleChange(visible) {
  183. if (visible) {
  184. loading.value = true;
  185. setModalProps({ loading: true, confirmLoading: true });
  186. setTimeout(() => {
  187. loading.value = false;
  188. setModalProps({ loading: false, confirmLoading: false });
  189. }, 1000);
  190. }
  191. }
  192. // 选择监测
  193. function selectDevice (id){
  194. loading.value = true;
  195. setModalProps({ loading: true, confirmLoading: true });
  196. setTimeout(() => {
  197. loading.value = false;
  198. activeDeviceID.value = id
  199. setModalProps({ loading: false, confirmLoading: false });
  200. }, 300);
  201. }
  202. function handleOk(e) {
  203. e.preventDefault()
  204. closeModal()
  205. }
  206. function handleCancel(e) {
  207. e.preventDefault()
  208. closeModal()
  209. }
  210. watch([() => props.dataSource, () => props.activeID], ([newDataSource, newActiveID], [oldDataSource, oldActiveID]) => {
  211. deviceList.value = newDataSource as any[]
  212. if(newActiveID != oldActiveID){
  213. activeDeviceID.value = newActiveID as string
  214. }
  215. newDataSource?.forEach((item:any, index) => {
  216. if((!activeDeviceID.value && index == 0) || item.deviceID === activeDeviceID.value){
  217. activeDeviceID.value = item.deviceID
  218. if(item.readData.fibreTemperature){
  219. const list = JSON.parse(item.readData.fibreTemperature)
  220. if (list.length > 0) posList.value = list
  221. }
  222. posMonitor.value = item.readData
  223. }
  224. })
  225. })
  226. return { register, model: modelRef, currentTime, handleVisibleChange, selectDevice, handleOk, handleCancel, deviceList, activeDeviceID, posMonitor, echatsOption, posList, chartsColumns, columns, warningConfig };
  227. },
  228. });
  229. </script>
  230. <style lang="less" scoped>
  231. .fiber-modal{
  232. width: 100%;
  233. height: 650px;
  234. display: flex;
  235. flex-direction: row;
  236. justify-content: space-between;
  237. .modal-left{
  238. width: 200px;
  239. height: 100%;
  240. overflow-y: auto;
  241. background: #ffffff11;
  242. padding: 5px;
  243. border-radius: 5px;
  244. .active-device-title {
  245. color: aqua;
  246. }
  247. .link-item{
  248. position: relative;
  249. cursor: pointer;
  250. line-height: 30px;
  251. padding-left: 30px;
  252. span:hover{
  253. color: #89ffff;
  254. }
  255. &::after{
  256. content: '';
  257. position: absolute;
  258. display: block;
  259. width: 8px;
  260. height: 8px;
  261. top: 12px;
  262. left: 10px;
  263. transform: rotateZ(45deg) skew(10deg, 10deg);
  264. background: #45d3fd;
  265. }
  266. }
  267. }
  268. .modal-right{
  269. width: calc(100% - 220px);
  270. .base-title{
  271. line-height: 32px;
  272. position: relative;
  273. padding-left: 20px;
  274. &::after{
  275. content: '';
  276. position: absolute;
  277. display: block;
  278. width: 4px;
  279. height: 12px;
  280. top: 4px;
  281. left: 10px;
  282. background: #45d3fd;
  283. border-radius: 4px;
  284. }
  285. }
  286. .right-top{
  287. display: flex;
  288. flex-direction: row;
  289. justify-content: space-between;
  290. margin-bottom: 10px;
  291. .top-item{
  292. width: 200px;
  293. height: 80px;
  294. display: flex;
  295. flex-direction: row;
  296. justify-content: center;
  297. border: 1px solid rgba(25,237,255,.4);
  298. box-shadow: inset 0 0 10px rgba(0,197,255,.6);
  299. background: rgba(0,0,0,.06666666666666667);
  300. padding-top: 16px;
  301. .icon{
  302. margin-right: 10px;
  303. margin-top: 5px;
  304. color: #FDB146;
  305. }
  306. .item-container{
  307. width: 100px;
  308. display: flex;
  309. flex-direction: column;
  310. justify-content: center;
  311. div{
  312. text-align: center;
  313. }
  314. .title{
  315. font-size: 18px;
  316. }
  317. .value{
  318. text-shadow: 0 0 25px #00fbfe;
  319. background: linear-gradient( 0deg,#45d3fd, #45d3fd, #61ddb1,#61ddb1);
  320. font-style: normal;
  321. background-size: cover;
  322. font-family: electronicFont;
  323. font-size: 30px;
  324. -webkit-background-clip: text;
  325. background-clip: text;
  326. -webkit-text-fill-color: transparent;
  327. position: relative;
  328. top: -8px;
  329. span{
  330. font-family: Arial, Helvetica, sans-serif;
  331. font-size: 18px;
  332. color: aliceblue;
  333. }
  334. }
  335. }
  336. }
  337. .warning-box{
  338. padding-top: 0px;
  339. .icon{
  340. margin-top: 20px;
  341. .icon-style{
  342. color: #FDB146;
  343. }
  344. }
  345. .warning-value{
  346. font-size: 18px;
  347. color: #61ddb1;
  348. }
  349. }
  350. }
  351. .right-center{
  352. margin-top: 20px;
  353. display: flex;
  354. flex-direction: row;
  355. justify-content: space-between;
  356. .table-box{
  357. position: relative;
  358. width: 500px;
  359. height: 250px;
  360. }
  361. .warning-box{
  362. width: calc(100% - 520px);
  363. .warning-container{
  364. width: 100%;
  365. height: convert;
  366. background: #009acd00;
  367. :deep(.dv-scroll-board){
  368. .row-item{
  369. height: 40px !important;
  370. line-height: 40px !important;
  371. }
  372. .header-item{
  373. border-top: 1px solid #91e9fe !important;
  374. border-bottom: 1px solid #91e9fe !important;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. .right-bottom{
  381. margin-top: 20px;
  382. .echarts-box{
  383. width: 100%;
  384. height: 230px;
  385. }
  386. }
  387. }
  388. }
  389. :deep(.zxm-table-body){
  390. border: 1px solid rgba(57, 232, 255, 0.2) !important;
  391. .zxm-table-tbody > tr > td{
  392. border: none !important;
  393. }
  394. }
  395. :deep(.zxm-table-cell){
  396. border-right: none !important;
  397. }
  398. </style>