main.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div class="all-con" style="position: relative;">
  3. <el-icon style="position: absolute;left: -15px;top: 17px;">
  4. <component style="color:#fff;background-color: #3d3dff;height: 2.5em;border-radius:5px 0 0 5px;"
  5. :is="showicon ? CaretLeft : CaretRight" @click="onShowHide" />
  6. </el-icon>
  7. <el-card class="oilInfo-bottom one">
  8. <el-row :gutter="10" style="text-align: center;line-height: 2em;height: 2em">
  9. <el-col :span="1">
  10. <div :style="isDisplay == 1 ? 'border-bottom:1px solid blue' : 'border:none'" @click="display(1)">概览
  11. </div>
  12. </el-col>
  13. <el-col :span="2">
  14. <div :style="isDisplay == 2 ? 'border-bottom:1px solid blue' : 'border:none'" @click="display(2)">报警
  15. </div>
  16. </el-col>
  17. <el-col :span="3" class="oilInfo-bottom">
  18. <div :style="isDisplay == 3 ? 'border-bottom:1px solid blue' : 'border:none'" @click="display(3)">
  19. ECQS编码状态
  20. </div>
  21. </el-col>
  22. <el-col :span="3" class="oilInfo-bottom">
  23. <div :style="isDisplay == 4 ? 'border-bottom:1px solid blue' : 'border:none'" @click="display(4)">
  24. 维修记录
  25. </div>
  26. </el-col>
  27. <el-row :span="15" class="oilInfo-bottom to-flex" style="position: absolute;right: 0;">
  28. <div style="margin-right: 1em;">
  29. 图例:
  30. </div>
  31. <div style="margin-right: 2em;">
  32. <div class="status-point" style="background-color:#5b53f9;right: 18.5em;top: 0.75em;" />
  33. 在线
  34. </div>
  35. <div style="margin-right: 0.75em;">
  36. <div class="status-point" style="background-color:#9f9fa3;right: 14.5em;top: 0.75em;" />
  37. 离线
  38. </div>
  39. <div style="margin-right: 0.75em;">
  40. <img :src="uurl" style="width: 1em;margin-right: 0.25em;">
  41. 校验成功
  42. </div>
  43. <div style="margin-right: 2em;">
  44. <img :src="urrl" style="width: 1em;margin-right: 0.25em;">
  45. 校验失败
  46. </div>
  47. </el-row>
  48. </el-row>
  49. </el-card>
  50. <div class="tip-con">
  51. <el-alert v-if="detailsData.list.onlineStatus === '离线'" title="加油机长时间离线" type="error"
  52. class="mb15"></el-alert>
  53. <el-alert v-if="detailsData.list.onlineStatus === '在线'" title="加油机长时间在线" type="success"
  54. class="mb15"></el-alert>
  55. </div>
  56. <!-- 油机内容 -->
  57. <el-text tag="b" style="color: #000">油机详情</el-text>
  58. <el-card class="oilInfo-con oilInfo-bottom">
  59. <el-row class='oilInfo-bottom'>
  60. <img class="oilInfo-img" :src="url">
  61. <div>
  62. <el-col :span="24" class="oilInfo-bottom">
  63. <div class="status-point oilInfo-con-first"
  64. :style="detailsData.list.onlineStatus == '在线' ? 'background-color:#5b53f9' : 'background-color:#9f9fa3'" />
  65. <span style="margin:0 0.5em 0 1em">{{ detailsData.list.name }}号机油机</span>
  66. <img :src="uurl" style="width: 1em;">
  67. </el-col>
  68. <el-col :span="24" class="oilInfo-bottom">
  69. <span class='oilInfo-item'>出厂编号:</span>{{ detailsData.list.serialNumber }}
  70. </el-col>
  71. <el-col :span="24" class="oilInfo-bottom">
  72. <span class='oilInfo-item'>制造商:</span>{{ detailsData.list.manufacturer }}
  73. </el-col>
  74. </div>
  75. </el-row>
  76. <div>
  77. <el-row :gutter="20">
  78. <el-col :span="6" class="oilInfo-bottom">
  79. <span class='oilInfo-item'>机型:</span>{{ detailsData.list.model }}
  80. </el-col>
  81. <el-col :span="6" class="oilInfo-bottom">
  82. <span class='oilInfo-item'>规格参数:</span>{{ detailsData.list.modelSpec }}
  83. </el-col>
  84. <el-col :span="6" class="oilInfo-bottom">
  85. <span class='oilInfo-item'>测量范围:</span>{{ detailsData.list.measureRang }}
  86. </el-col>
  87. <el-col :span="6" class="oilInfo-bottom">
  88. <span class='oilInfo-item'>准确度等级:</span>{{ detailsData.list.accuracyLevel }}
  89. </el-col>
  90. </el-row>
  91. <el-row :gutter="20">
  92. <el-col :span="6" class="oilInfo-bottom">
  93. <span class='oilInfo-item'>生产日期:</span>{{ detailsData.list.createdTime }}
  94. </el-col>
  95. <el-col :span="6" class="oilInfo-bottom">
  96. <span class='oilInfo-item'>安装日期:</span>{{ detailsData.list.installationDate }}
  97. </el-col>
  98. <el-col :span="6" class="oilInfo-bottom">
  99. <span class='oilInfo-item'>启用日期:</span>{{ detailsData.list.startupDate }}
  100. </el-col>
  101. <el-col :span="6" class="oilInfo-bottom">
  102. <span class='oilInfo-item'>累计在线时间:</span>{{ detailsData.list.onlineDesc }}
  103. </el-col>
  104. </el-row>
  105. </div>
  106. </el-card>
  107. <el-row :gutter="10" class="oilInfo-bottom">
  108. <el-col :span="0.5" class="oilInfo-bottom">
  109. <el-text tag="b" style="color: #000">油枪列表</el-text>
  110. </el-col>
  111. <el-col :span="0.5" class="oilInfo-bottom">
  112. <div class="oilLabel-con" @click="isOnline('所有')"
  113. :style="flagData.isFlag == '所有' ? 'background-color:#4d4dff' : 'background-color:#89898b'">
  114. 所有
  115. </div>
  116. </el-col>
  117. <el-col :span="0.5" class="oilInfo-bottom">
  118. <div class="oilLabel-con" @click="isOnline('在线')"
  119. :style="flagData.isFlag == '在线' ? 'background-color:#4d4dff' : 'background-color:#89898b'">
  120. 在线</div>
  121. </el-col>
  122. <el-col :span="0.5" class="oilInfo-bottom">
  123. <div class="oilLabel-con" @click="isOnline('离线')"
  124. :style="flagData.isFlag == '离线' ? 'background-color:#4d4dff' : 'background-color:#89898b'">
  125. 离线</div>
  126. </el-col>
  127. <el-col :span="0.5" class="oilInfo-bottom">
  128. <div class="oilLabel-con" style="background-color: #89898b; width: 6em;">校验通过</div>
  129. </el-col>
  130. <el-col :span="0.5" class="oilInfo-bottom">
  131. <div class="oilLabel-con" style="background-color: #89898b; width: 6em;">校验失败</div>
  132. </el-col>
  133. </el-row>
  134. <el-row :gutter="16" style="margin-top:10px;" :key="flagData.keyData">
  135. <el-col :span="8" v-for="(item, index) in listcom" v-bind:key="index">
  136. <el-card class="oilInfo-msg oilInfo-bottom"
  137. @click="toParts(item.name, item.mainBoard_NozzleNo, item.onlineStatus, item.fuelName, item.alarming, item.code)">
  138. <el-row class="oilInfo-bottom">
  139. <img :src="url" class="oilInfo-img">
  140. <div>
  141. <el-col :span="24" class="oilInfo-bottom">
  142. <el-text tag="b">逻辑枪号:{{ item.name }}</el-text>
  143. <div style="position: absolute;right: 10%;top: 5%;">
  144. <div class="status-point"
  145. :style="item.onlineStatus == '在线' ? 'background-color:#5b53f9' : 'background-color:#9f9fa3'">
  146. </div>
  147. <img :src="uurl" style="width: 1em;">
  148. </div>
  149. </el-col>
  150. <el-col :span="24" class="oilInfo-bottom">
  151. <span class="oilInfo-item-two">物理枪号:</span>{{
  152. item.mainBoard_NozzleNo }}
  153. </el-col>
  154. <el-col :span="24" class="oilInfo-bottom">
  155. <span class="oilInfo-item-two">自锁功能:</span>{{ item.alarming }}
  156. </el-col>
  157. </div>
  158. </el-row>
  159. <el-row class="oilInfo-bottom">
  160. <span class="oilInfo-item-two">油品:</span>{{ item.fuelName }}
  161. </el-row>
  162. <el-row>
  163. <span class="oilInfo-item-two">ECQS编码:</span>{{ item.code }}
  164. </el-row>
  165. </el-card>
  166. </el-col>
  167. </el-row>
  168. </div>
  169. </template>
  170. <script setup lang="ts">
  171. import { computed, onMounted, reactive, ref, watch } from "vue";
  172. //import { CirclePlusFilled } from '@element-plus/icons-vue'
  173. import { NozzlecontrolDtl } from "/@/api/admin/reportManagement/moreOilEngineDetails/moreOilEngineDetailsDto";
  174. import { OilEngineDetailsApi } from "/@/api/admin/reportManagement/oilEngineDetails/oilEngineDetailsApi";
  175. import { FuelDispenserEntity, AlarmHistoryDto } from "/@/api/admin/reportManagement/oilEngineDetails/oilEngineDetailsDto"
  176. import router from "/@/router";
  177. import { MoreOilEngineDetailsApi } from "/@/api/admin/reportManagement/moreOilEngineDetails/moreOilEngineDetailsApi";
  178. import {
  179. Document,
  180. Menu as IconMenu,
  181. Location,
  182. Setting,
  183. CaretRight,
  184. CaretLeft,
  185. } from '@element-plus/icons-vue'
  186. /******************************数据对象***************************************/
  187. const url = '/src/assets/logo-com.png'
  188. const uurl = '/src/assets/map/IconParkSolidCheckOne.png'
  189. const urrl = '/src/assets/map/IconParkSolidCloseOne.png'
  190. /**
  191. * 接收index.vue传的id,传递 菜单栏控制参数
  192. */
  193. const props = defineProps({
  194. id: String,
  195. })
  196. const emit = defineEmits(['getIcon'])
  197. /**
  198. * 表格数据对象
  199. */
  200. const tableData = reactive({
  201. loading: false,
  202. list: [] as Array<AlarmHistoryDto>
  203. })
  204. /**
  205. * 油机详情数据对象
  206. */
  207. const detailsData = reactive({
  208. loading: false,
  209. list: {} as FuelDispenserEntity
  210. })
  211. /**
  212. * 油机列表详情数据对象
  213. */
  214. const oilListData = reactive({
  215. loading: false,
  216. list: [] as Array<NozzlecontrolDtl>
  217. })
  218. /**
  219. * 油机列表初始ID
  220. */
  221. const initID = ref()
  222. const toPage = () => {
  223. const id = props.id
  224. router.push({ path: `/statement/${id}/more/moreAlert` })
  225. }
  226. /**
  227. * 油枪列表相关数据
  228. */
  229. let listcom = JSON.parse(JSON.stringify(oilListData.list))
  230. let flagData = reactive({
  231. keyData: 0,
  232. isFlag: '所有'
  233. })
  234. /******************************数据对象***************************************/
  235. /*******************************方法**************************************/
  236. // /**
  237. // * 变换时改样式
  238. // * @param event
  239. // * @param item
  240. // */
  241. // const onCardChange = (event, item) => {
  242. // // console.log(event)
  243. // // console.log(item);
  244. // let ele = event.target
  245. //
  246. // if( ele.getAttribute('name') !== 'card') {
  247. // ele = ele.closest('.card')
  248. // }
  249. //
  250. // if(ele.classList.contains("active-card")) return
  251. //
  252. // initID.value = item.oilEngineName
  253. //
  254. // const parentElement = document.getElementById('top-conId')
  255. // const myElement = parentElement.querySelector('.active-card')
  256. //
  257. // if(myElement){
  258. // myElement.classList.remove('active-card')
  259. // }
  260. //
  261. // ele.classList.add("active-card")
  262. // }
  263. watch(() => initID.value, () => {
  264. initTableData()
  265. initDetailsData()
  266. })
  267. watch(props, (val) => {
  268. init()
  269. })
  270. /*******************************方法**************************************/
  271. /**********************************初始化***********************************/
  272. /**
  273. * 格式化日期
  274. */
  275. const formatDate = (val) => {
  276. const date = new Date(val)
  277. const year: number = date.getFullYear();
  278. const month: string = (date.getMonth() + 1).toString().padStart(2, '0');
  279. const day: string = date.getDate().toString().padStart(2, '0');
  280. const hours: string = date.getHours().toString().padStart(2, '0');
  281. const minutes: string = date.getMinutes().toString().padStart(2, '0');
  282. const seconds: string = date.getSeconds().toString().padStart(2, '0');
  283. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  284. }
  285. /**
  286. * 初始化油机列表详情数据对象
  287. */
  288. const initOilListData = async () => {
  289. oilListData.loading = true
  290. const fuelId = props.id
  291. const { data } = await new MoreOilEngineDetailsApi().getOilListData({ Fuelid: fuelId })
  292. oilListData.list = data
  293. oilListData.loading = false
  294. listcom = data
  295. flagData.keyData = Math.random()
  296. }
  297. /**
  298. * 初始化表格数据对象
  299. */
  300. const initTableData = async () => {
  301. tableData.loading = true
  302. const fuelId = props.id
  303. const filter = { fuelId: fuelId }
  304. const pageInput = { currentPage: 1, pageSize: 5 }
  305. const { data } = await new OilEngineDetailsApi().getAlarmHistoryDto({ ...pageInput, filter: filter })
  306. tableData.list = data.list
  307. tableData.list = tableData.list?.map((item) => {
  308. if (item.createdDate !== null) {
  309. item.createdDate = formatDate(item.createdDate)
  310. }
  311. return item
  312. })
  313. tableData.loading = false
  314. }
  315. /**
  316. * 初始化油机详情数据对象
  317. */
  318. const initDetailsData = async () => {
  319. detailsData.loading = true
  320. const fuelId = props.id
  321. const { data } = await new OilEngineDetailsApi().getBasicInfoDto({ Fuelid: fuelId })
  322. detailsData.list = data
  323. if (detailsData.list.createdTime !== null) {
  324. detailsData.list.createdTime = formatDate(detailsData.list.createdTime)
  325. }
  326. if (detailsData.list.installationDate !== null) {
  327. detailsData.list.installationDate = formatDate(detailsData.list.installationDate)
  328. }
  329. if (detailsData.list.startupDate !== null) {
  330. detailsData.list.startupDate = formatDate(detailsData.list.startupDate)
  331. }
  332. if (detailsData.list.onlineStatus !== null) {
  333. if (detailsData.list.onlineStatus === 'offline') {
  334. detailsData.list.onlineStatus = '离线'
  335. } else {
  336. detailsData.list.onlineStatus = '在线'
  337. }
  338. }
  339. if (detailsData.list.deviceStatus !== null) {
  340. if (detailsData.list.deviceStatus === 'enable') {
  341. detailsData.list.deviceStatus = '启用'
  342. } else if (detailsData.list.deviceStatus === 'factory') {
  343. detailsData.list.deviceStatus = '出厂注册'
  344. } else {
  345. detailsData.list.deviceStatus = '备案'
  346. }
  347. }
  348. detailsData.loading = false
  349. }
  350. const init = () => {
  351. initDetailsData()
  352. initTableData()
  353. initOilListData()
  354. }
  355. onMounted(() => {
  356. init()
  357. })
  358. // 路由跳转 -- 部件信息图
  359. const toParts = ((name: any, NozzleNo: any, status: any, fuelName: any, alarming: any, code: any) => {
  360. router.push({
  361. path: `/statement/partInformation`,
  362. query: {
  363. name: name,
  364. NozzleNo: NozzleNo,
  365. status: status,
  366. fuelName: fuelName,
  367. alarming: alarming,
  368. code: code
  369. }
  370. })
  371. })
  372. /**********************************初始化***********************************/
  373. const isOnline = (statu: string) => {
  374. if (statu == '所有') {
  375. listcom = JSON.parse(JSON.stringify(oilListData.list))
  376. } else {
  377. listcom = oilListData.list.filter((data) => {
  378. return data.onlineStatus === statu
  379. })
  380. }
  381. flagData.keyData = Math.random()
  382. flagData.isFlag = statu
  383. }
  384. const isDisplay = ref(1)
  385. // 内容区顶部导航 变换
  386. const display = (num: number) => {
  387. isDisplay.value = num
  388. if (num == 2) {
  389. toPage()
  390. }
  391. }
  392. // 菜单栏的显示与隐藏
  393. let showicon = ref(true)
  394. const onShowHide = () => {
  395. showicon.value = !showicon.value
  396. emit('getIcon', showicon.value)
  397. }
  398. </script>
  399. <style scoped lang="scss">
  400. .all-con {
  401. flex: 1;
  402. margin-left: 20px;
  403. }
  404. .oilInfo-bottom {
  405. margin-bottom: 10px;
  406. }
  407. .oilInfo-top {
  408. margin-bottom: 10px;
  409. }
  410. .oilInfo-con {
  411. width: 100%;
  412. height: 25%;
  413. border-radius: 10px;
  414. }
  415. .oilInfo-item {
  416. color: rgb(173, 171, 171)
  417. }
  418. .oilInfo-img {
  419. margin-right: 20px;
  420. width: 75px;
  421. height: 75px;
  422. background-color: #ccc;
  423. border-radius: 8px;
  424. }
  425. .oilLabel-con {
  426. background-color: #89898b;
  427. height: 1.5em;
  428. width: 3.9em;
  429. line-height: 1.5em;
  430. text-align: center;
  431. border-radius: 999rem;
  432. color: #fff;
  433. }
  434. .oilInfo-msg {
  435. height: 200px;
  436. .oilInfo-item-two {
  437. color: rgb(173, 171, 171)
  438. }
  439. }
  440. // 小圆点
  441. .status-point {
  442. display: inline-block;
  443. width: 6px;
  444. height: 6px;
  445. border-radius: 50%;
  446. position: absolute;
  447. right: 10%;
  448. top: 30%;
  449. margin-right: 30px;
  450. }
  451. .oilInfo-con-first {
  452. left: 7em;
  453. top: 0.5em;
  454. }
  455. </style>