deviceInfo.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <div>
  3. <div class="header_title">设备详情</div>
  4. <div class="device-info">
  5. <!-- 标题 -->
  6. <div class="deviceTitle">
  7. <span>设备号{{ info.deviceCode }}详情</span>
  8. <div><el-button plain size="mini" @click="closeInfo">关闭</el-button></div>
  9. </div>
  10. <!-- 表格 -->
  11. <div>
  12. <table class="table">
  13. <tr>
  14. <th>设备编号</th><td>{{ info.deviceCode }}</td>
  15. <th>注册ID</th><td>{{ info.id }}</td>
  16. </tr>
  17. <tr>
  18. <th>省市县</th><td>{{ info.countyName }}</td>
  19. <th>省市县编码</th><td>{{ info.countyCode }}</td>
  20. </tr>
  21. <tr>
  22. <th>牧场名称</th><td>{{ info.farmName }}</td>
  23. <th>牧场编码</th><td>{{ info.farmCode }}</td>
  24. </tr>
  25. <tr>
  26. <th>阶段</th><td>{{ stageList[info.stage - 1].label }}</td>
  27. <th>栋舍</th><td>{{ info.pigpenName }}</td>
  28. </tr>
  29. <tr>
  30. <th>上传服务器地址</th><td>{{ info.serverIp }}</td>
  31. <th>端口</th><td>{{ info.port }}</td>
  32. </tr>
  33. <tr>
  34. <th>注册时间</th><td>{{ info.registerTime }}</td>
  35. <th>最后一次上传时间</th><td>{{ info.lastTime }}</td>
  36. </tr>
  37. <tr>
  38. <th>网络通信状态</th><td><span :class="{ 'normal': info.networkStatus === 1, 'abnormal': info.networkStatus === 0}">{{ networkList[1 - info.networkStatus].label }}</span></td>
  39. <th>采集状态</th><td><span :class="{ 'normal': info.acqStatus === 1, 'abnormal': info.acqStatus === 2}">{{ acqList[info.acqStatus - 1].label }}</span></td>
  40. </tr>
  41. <tr>
  42. <th>注销状态</th><td><span :class="{ 'normal': info.canStatus === 1, 'logout': info.canStatus === 0}">{{ canList[1 - info.canStatus].label }}</span></td>
  43. </tr>
  44. </table>
  45. </div>
  46. <!-- 上传数据走势图 -->
  47. <div class="chartDiv">
  48. <div class="title">
  49. <span>上传数据走势图</span>
  50. <div class="right">
  51. <el-date-picker
  52. v-model="timeSelected"
  53. type="datetimerange"
  54. range-separator="—"
  55. start-placeholder="开始时间"
  56. end-placeholder="结束时间"
  57. size="mini">
  58. </el-date-picker>
  59. </div>
  60. </div>
  61. <his-and-line :time="timeSelected"></his-and-line>
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import {mapState} from 'vuex'
  68. import hisAndLine from './charts/hisAndLine.vue'
  69. export default {
  70. data() {
  71. return {
  72. info: {
  73. deviceCode: '',
  74. registerTime: '',
  75. countyName: '',
  76. farmName: '',
  77. stage: 1,
  78. serverIp: '',
  79. lastTime: '',
  80. id: '',
  81. networkStatus: 1,
  82. acqStatus: 1,
  83. canStatus: 1,
  84. countyCode: '',
  85. farmCode: '',
  86. pigpenName: '',
  87. port: ''
  88. },
  89. networkList: [ // 网络通信状态
  90. {
  91. value: 1,
  92. label: '正常'
  93. },
  94. {
  95. value: 0,
  96. label: '异常'
  97. }
  98. ],
  99. acqList: [ // 采集状态
  100. {
  101. value: 1,
  102. label: '正常'
  103. },
  104. {
  105. value: 2,
  106. label: '异常'
  107. }
  108. ],
  109. canList: [ // 注销状态
  110. {
  111. value: 1,
  112. label: '正常'
  113. },
  114. {
  115. value: 0,
  116. label: '注销'
  117. }
  118. ],
  119. timeSelected: [], // 时间选择
  120. stageList: [ // 阶段
  121. {
  122. value: 1,
  123. label: '配怀'
  124. },
  125. {
  126. value: 2,
  127. label: '分娩'
  128. },
  129. {
  130. value: 3,
  131. label: '保育'
  132. },
  133. {
  134. value: 4,
  135. label: '育成育肥'
  136. },
  137. {
  138. value: 5,
  139. label: '空怀'
  140. },
  141. {
  142. value: 6,
  143. label: '后备母猪'
  144. },
  145. {
  146. value: 7,
  147. label: '公猪'
  148. },
  149. {
  150. value: 8,
  151. label: '病死猪场内收集'
  152. },
  153. {
  154. value: 9,
  155. label: '病死猪无害化'
  156. }
  157. ]
  158. }
  159. },
  160. computed: {
  161. ...mapState(['baseUrl'])
  162. },
  163. components: {
  164. hisAndLine
  165. },
  166. methods: {
  167. init () {
  168. let id = this.$route.params.id
  169. console.log(id);
  170. this.$http({
  171. url: this.$http.adornUrl(`${this.baseUrl}/manager/collectorregister/info/${id}`),
  172. method: 'get'
  173. }).then(async({data}) => {
  174. // 遍历 + 对应放置
  175. for (let item in this.info) {
  176. if (Object.hasOwnProperty.call(this.info, item)) {
  177. this.info[item] = data.collectorRegister[item]
  178. }
  179. }
  180. }).catch(() => {})
  181. },
  182. closeInfo () {
  183. this.$router.push('/deviceAdmin')
  184. }
  185. },
  186. mounted() {
  187. this.init()
  188. },
  189. }
  190. </script>
  191. <style scoped>
  192. .header_title {
  193. height: 40px;
  194. background-color: #F7F7F7;
  195. border: 1px solid #ddd;
  196. line-height: 40px;
  197. color: #6FA8C8;
  198. margin-bottom: 10px;
  199. padding-left: 20px;
  200. position: fixed;
  201. width: 1660px;
  202. z-index: 1000;
  203. }
  204. .device-info {
  205. padding: 50px 20px 0;
  206. }
  207. .deviceTitle {
  208. border: 1px solid #ddd;
  209. font-size: 14px;
  210. background-color: rgba(243, 243, 243, 1);
  211. height: 45px;
  212. line-height: 45px;
  213. padding: 0 20px;
  214. display: flex;
  215. flex-direction: row;
  216. justify-content: space-between;
  217. }
  218. /* table 样式修改 */
  219. .table {
  220. width: 100%;
  221. margin-top: 20px;
  222. font-size: 12px;
  223. border-collapse: collapse;
  224. }
  225. .table tr {
  226. height: 20px;
  227. }
  228. .table th {
  229. background-color: rgb(250, 250, 248);
  230. width: 180px;
  231. height: 30px;
  232. font-weight: normal;
  233. }
  234. .table td {
  235. text-align: center;
  236. }
  237. .table,
  238. .table td,
  239. .table th {
  240. border: 1px solid #ddd;
  241. }
  242. /* 正常 */
  243. .normal {
  244. color: #37c20ce1;
  245. }
  246. .abnormal {
  247. color: #ff0000d3;
  248. }
  249. .logout {
  250. color: #ffd900;
  251. }
  252. /* 图表结构的大局 */
  253. .chartDiv {
  254. margin-top: 20px;
  255. border: 1px solid #ddd;
  256. height: 380px;
  257. background-color: #fff;
  258. }
  259. .title {
  260. background-color: rgba(243, 243, 243, 1);
  261. height: 50px;
  262. line-height: 50px;
  263. padding-left: 50px;
  264. font-size: 14px;
  265. border-bottom: 1px solid #ddd;
  266. }
  267. .right {
  268. float: right;
  269. margin-right: 20px;
  270. font-size: 12px;
  271. }
  272. </style>