IntellOper.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <script lang="ts" setup>
  2. import {onMounted, reactive, ref} from 'vue'
  3. import {useRoute} from 'vue-router'
  4. import RightFrame from '@/components/RightFrame.vue'
  5. import Card01 from '@/components/card/Card01.vue'
  6. import StripeTable from '@/components/StripeTable.vue'
  7. import ColorTag from '@/components/tag/ColorTag.vue'
  8. import {getDeviceInfo, getOperationsPersonnelData} from '@/api/device'
  9. import Chart from '@/components/Chart.vue'
  10. import {getPie3DSimple} from "@/utils/chart";
  11. import {View} from "@/utils/tdInstruction";
  12. import StationRightButtonGroup from "@/components/StationRightButtonGroup.vue";
  13. import {getDeviceByName} from "@/utils/device";
  14. import {getAlarmInfo} from '@/api/alarm'
  15. const route = useRoute()
  16. const color = ['#005aff', '#f8b551']
  17. const equipmentStatusData = reactive({
  18. total: 10,
  19. onlineTotal: 8,
  20. '缺数': 0,
  21. '上下限异常': 1,
  22. '数据中断': 0,
  23. '其他': 1
  24. })
  25. const operationsPersonnelColumns = [
  26. {label: '姓名', prop: 'name'},
  27. {label: '已处理', prop: 'processed', width: '100'},
  28. {label: '未处理', prop: 'untreated', width: '100'}
  29. ]
  30. const operationsPersonnelData = reactive([])
  31. const deviceColumns = [
  32. {label: '设备类型', prop: 'deviceType', width: '110'},
  33. {label: '设备名称', prop: 'deviceName'},
  34. {label: '运行状态', prop: 'state', width: '90'}
  35. ]
  36. const deviceData = reactive([])
  37. const alarmColumns = [
  38. {
  39. label: '报警类型', prop: 'deviceName', width: '100', convertFn: (data) => {
  40. return data ? data.trim() : ''
  41. }
  42. },
  43. {
  44. label: '时间', prop: 'tm', convertFn: (data) => {
  45. return data ? data.substring(5, 16) : ''
  46. }
  47. },
  48. {
  49. label: '告警内容', prop: 'content', width: '180', convertFn: (data) => {
  50. return data ? data.trim() : ''
  51. }
  52. },
  53. ]
  54. const alarmData = reactive([])
  55. function getAlarmList() {
  56. getAlarmInfo().then(res => {
  57. alarmData.push(...res)
  58. // initPoints()
  59. })
  60. }
  61. const right3Ref = ref(null)
  62. function reloadRight3() {
  63. const optionData = [
  64. {
  65. name: '故障',
  66. value: 1,
  67. itemStyle: {
  68. color: '#f3914b'
  69. }
  70. },
  71. {
  72. name: '提醒',
  73. value: 4,
  74. itemStyle: {
  75. color: '#f5bf53'
  76. }
  77. },
  78. {
  79. name: '巡检',
  80. value: 6,
  81. itemStyle: {
  82. color: '#92d1f4'
  83. }
  84. },
  85. {
  86. name: '定时巡检',
  87. value: 3,
  88. itemStyle: {
  89. color: '#0e2d5b'
  90. }
  91. }
  92. ]
  93. const option = getPie3DSimple(optionData, 0.8)
  94. //是否需要label指引线,如果要就添加一个透明的2d饼状图并调整角度使得labelLine和3d的饼状图对齐,并再次setOption
  95. option.series.push({
  96. name: 'pie2d',
  97. type: 'pie',
  98. label: {
  99. opacity: 1,
  100. position: 'outside',
  101. fontSize: 12,
  102. lineHeight: 20,
  103. textStyle: {
  104. fontSize: 12,
  105. color: '#fff'
  106. }
  107. },
  108. labelLine: {
  109. length: 30,
  110. length2: 30
  111. },
  112. minAngle: 10,
  113. startAngle: -50, // 起始角度,支持范围[0, 360]。
  114. clockwise: false, // 饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
  115. radius: ['40%', '60%'],
  116. center: ['50%', '50%'],
  117. data: optionData.map(item => {
  118. item.itemStyle.opacity = 0
  119. return item
  120. })
  121. })
  122. right3Ref.value.loadChart(option, 'bindListen')
  123. }
  124. function getDeviceInfoList() {
  125. getDeviceInfo().then(res => {
  126. deviceData.push(...res)
  127. })
  128. }
  129. function getDeviceDetailInfoList() {
  130. getOperationsPersonnelData().then(res => {
  131. operationsPersonnelData.push(...res)
  132. })
  133. }
  134. const imgSrc = ref(new URL('@/assets/images/szpj.png', import.meta.url).href)
  135. onMounted(() => {
  136. getDeviceInfoList()
  137. getDeviceDetailInfoList()
  138. getAlarmList()
  139. reloadRight3()
  140. })
  141. function handleDeviceClick(row) {
  142. const device = getDeviceByName(row.deviceName);
  143. if (device) {
  144. if (device["deviceType"] === "水质测验设备") {
  145. View.changeDeviceView('打开模型', route.params.stcd, device.ueDeviceName)
  146. } else {
  147. View.changeView(`${route.params.stcd}_${device.ueDeviceName}`)
  148. }
  149. }
  150. }
  151. </script>
  152. <template>
  153. <right-frame>
  154. <template #leftModule>
  155. <card01 style="height: 33%" title="运行实态">
  156. <el-row style="height: 66%;">
  157. <el-col :span="7">
  158. <div class="device_num">
  159. <span class="background-image">设备管理</span>
  160. <span style="font-size: 26px;font-weight: bold;">{{ equipmentStatusData.total }}</span>
  161. </div>
  162. </el-col>
  163. <el-col :span="10">
  164. <div style="display: flex;justify-content: center;">
  165. <!-- <div style="position: absolute;bottom:40%;font-size:16px;">设备清单</div>-->
  166. <img :src="imgSrc" style="height: 120px;"/>
  167. </div>
  168. </el-col>
  169. <el-col :span="7">
  170. <div class="device_num">
  171. <span class="background-image">在线设备</span>
  172. <span style="font-size: 26px;font-weight: bold;">{{ equipmentStatusData.onlineTotal }}</span>
  173. </div>
  174. </el-col>
  175. </el-row>
  176. <el-row :gutter="10" style="height: 33%;">
  177. <el-col :span="6" style="height: 100%;">
  178. <!-- #adcbe0 -->
  179. <color-tag :value="equipmentStatusData['缺数']" backgroundColor="#bb232f" label="缺数"></color-tag>
  180. </el-col>
  181. <el-col :span="6" style="height: 100%;">
  182. <!-- #adcbe0 -->
  183. <color-tag :value="equipmentStatusData['上下限异常']" backgroundColor="#b38b30"
  184. label="上下限异常"></color-tag>
  185. </el-col>
  186. <el-col :span="6" style="height: 100%;">
  187. <!-- #adcbe0 -->
  188. <color-tag :value="equipmentStatusData['数据中断']" background-color="#97759c" label="数据中断"></color-tag>
  189. </el-col>
  190. <el-col :span="6" style="height: 100%;">
  191. <color-tag :value="equipmentStatusData['其他']" backgroundColor="#adcbe0" label="其他"></color-tag>
  192. </el-col>
  193. </el-row>
  194. </card01>
  195. <card01 style="height: 65%" title="设备清单">
  196. <stripe-table :columns="deviceColumns" :data="deviceData" @row-click="handleDeviceClick"></stripe-table>
  197. </card01>
  198. <!-- <card01 style="height: 33%" title="运维人员统计">-->
  199. <!-- <stripe-table :columns="operationsPersonnelColumns" :data="operationsPersonnelData"></stripe-table>-->
  200. <!-- </card01>-->
  201. </template>
  202. <template #rightModule>
  203. <card01 style="height: 33%" title="维护情况">
  204. <chart ref="right3Ref"></chart>
  205. </card01>
  206. <card01 style="height: 65%" title="故障报警列表">
  207. <stripe-table :columns="alarmColumns" :data="alarmData"></stripe-table>
  208. </card01>
  209. </template>
  210. <template #btnGroup>
  211. <station-right-button-group></station-right-button-group>
  212. </template>
  213. </right-frame>
  214. </template>
  215. <style lang="scss" scoped>
  216. .background-image {
  217. background-image: url(/src/assets/images/layout/menu-right.png);
  218. background-repeat: no-repeat;
  219. background-size: 100%;
  220. background-position: center;
  221. height: 50px;
  222. width: 100%;
  223. text-align: center;
  224. line-height: 40px;
  225. }
  226. .device_num {
  227. display: flex;
  228. align-items: center;
  229. flex-direction: column;
  230. justify-content: center;
  231. height: 100%;
  232. }
  233. .right-btn-container {
  234. display: flex;
  235. flex-direction: column;
  236. .right-btn-item {
  237. cursor: pointer;
  238. position: relative;
  239. &:hover, &.active {
  240. img {
  241. background-color: rgba(16, 136, 215, 0.6);
  242. border-radius: 8px;
  243. }
  244. > .right-btn-option-list {
  245. display: block;
  246. }
  247. }
  248. .right-btn-option-list {
  249. display: none;
  250. position: absolute;
  251. top: 0;
  252. right: 1.8rem;
  253. width: 160px;
  254. padding: 0 20px;
  255. }
  256. .right-btn-option {
  257. padding: 10px;
  258. margin-bottom: 10px;
  259. border-radius: 4px;
  260. background-color: #394139;
  261. text-align: center;
  262. color: #fff;
  263. box-sizing: border-box;
  264. display: flex;
  265. justify-content: center;
  266. align-items: center;
  267. font-size: 1rem;
  268. svg {
  269. width: 1rem;
  270. height: 1rem;
  271. margin-left: .5rem;
  272. }
  273. }
  274. }
  275. }
  276. </style>