fiber.modal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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.svg" />
  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. const list = JSON.parse(item.readData.fibreTemperature)
  219. if(list.length > 0) posList.value = list
  220. posMonitor.value = item.readData
  221. }
  222. })
  223. })
  224. return { register, model: modelRef, currentTime, handleVisibleChange, selectDevice, handleOk, handleCancel, deviceList, activeDeviceID, posMonitor, echatsOption, posList, chartsColumns, columns, warningConfig };
  225. },
  226. });
  227. </script>
  228. <style lang="less" scoped>
  229. .fiber-modal{
  230. width: 100%;
  231. height: 650px;
  232. display: flex;
  233. flex-direction: row;
  234. justify-content: space-between;
  235. .modal-left{
  236. width: 200px;
  237. height: 100%;
  238. overflow-y: auto;
  239. background: #ffffff11;
  240. padding: 5px;
  241. border-radius: 5px;
  242. .active-device-title {
  243. color: aqua;
  244. }
  245. .link-item{
  246. position: relative;
  247. cursor: pointer;
  248. line-height: 30px;
  249. padding-left: 30px;
  250. span:hover{
  251. color: #89ffff;
  252. }
  253. &::after{
  254. content: '';
  255. position: absolute;
  256. display: block;
  257. width: 8px;
  258. height: 8px;
  259. top: 12px;
  260. left: 10px;
  261. transform: rotateZ(45deg) skew(10deg, 10deg);
  262. background: #45d3fd;
  263. }
  264. }
  265. }
  266. .modal-right{
  267. width: calc(100% - 220px);
  268. .base-title{
  269. line-height: 32px;
  270. position: relative;
  271. padding-left: 20px;
  272. &::after{
  273. content: '';
  274. position: absolute;
  275. display: block;
  276. width: 4px;
  277. height: 12px;
  278. top: 4px;
  279. left: 10px;
  280. background: #45d3fd;
  281. border-radius: 4px;
  282. }
  283. }
  284. .right-top{
  285. display: flex;
  286. flex-direction: row;
  287. justify-content: space-between;
  288. margin-bottom: 10px;
  289. .top-item{
  290. width: 200px;
  291. height: 80px;
  292. display: flex;
  293. flex-direction: row;
  294. justify-content: center;
  295. border: 1px solid rgba(25,237,255,.4);
  296. box-shadow: inset 0 0 10px rgba(0,197,255,.6);
  297. background: rgba(0,0,0,.06666666666666667);
  298. padding-top: 16px;
  299. .icon{
  300. margin-right: 10px;
  301. margin-top: 5px;
  302. color: #FDB146;
  303. }
  304. .item-container{
  305. width: 100px;
  306. display: flex;
  307. flex-direction: column;
  308. justify-content: center;
  309. div{
  310. text-align: center;
  311. }
  312. .title{
  313. font-size: 18px;
  314. }
  315. .value{
  316. text-shadow: 0 0 25px #00fbfe;
  317. background: linear-gradient( 0deg,#45d3fd, #45d3fd, #61ddb1,#61ddb1);
  318. font-style: normal;
  319. background-size: cover;
  320. font-family: electronicFont;
  321. font-size: 30px;
  322. -webkit-background-clip: text;
  323. background-clip: text;
  324. -webkit-text-fill-color: transparent;
  325. position: relative;
  326. top: -8px;
  327. span{
  328. font-family: Arial, Helvetica, sans-serif;
  329. font-size: 18px;
  330. color: aliceblue;
  331. }
  332. }
  333. }
  334. }
  335. .warning-box{
  336. padding-top: 0px;
  337. .icon{
  338. margin-top: 20px;
  339. .icon-style{
  340. color: #FDB146;
  341. }
  342. }
  343. .warning-value{
  344. font-size: 18px;
  345. color: #61ddb1;
  346. }
  347. }
  348. }
  349. .right-center{
  350. margin-top: 20px;
  351. display: flex;
  352. flex-direction: row;
  353. justify-content: space-between;
  354. .table-box{
  355. position: relative;
  356. width: 500px;
  357. height: 250px;
  358. }
  359. .warning-box{
  360. width: calc(100% - 520px);
  361. .warning-container{
  362. width: 100%;
  363. height: convert;
  364. background: #009acd00;
  365. :deep(.dv-scroll-board){
  366. .row-item{
  367. height: 40px !important;
  368. line-height: 40px !important;
  369. }
  370. .header-item{
  371. border-top: 1px solid #91e9fe !important;
  372. border-bottom: 1px solid #91e9fe !important;
  373. }
  374. }
  375. }
  376. }
  377. }
  378. .right-bottom{
  379. margin-top: 20px;
  380. .echarts-box{
  381. width: 100%;
  382. height: 230px;
  383. }
  384. }
  385. }
  386. }
  387. :deep(.zxm-table-body){
  388. border: 1px solid rgba(57, 232, 255, 0.2) !important;
  389. .zxm-table-tbody > tr > td{
  390. border: none !important;
  391. }
  392. }
  393. :deep(.zxm-table-cell){
  394. border-right: none !important;
  395. }
  396. </style>