dataDetail.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="about" v-if="isShow">
  3. <div>
  4. <div class="header_title">
  5. <span>耳标 <strong style="color: mediumturquoise;"> {{earTag}}</strong> 详情</span>
  6. <div class="back" @click="jump">回到上一页</div>
  7. </div>
  8. <div class="box">
  9. <div>耳标</div>
  10. <div>{{earTag}}</div>
  11. <div></div>
  12. <div></div>
  13. <div>首次上传时间(配标时间)</div>
  14. <div>{{tableData.movePigPenData[2].moveDate}}</div>
  15. <div>本次采集时间</div>
  16. <div>{{tableData.eartagdeta.time}}</div>
  17. <div>配标日龄</div>
  18. <div>{{tableData.eartagdeta.dayAge}}</div>
  19. <div>日龄</div>
  20. <div>{{tableData.eartagdeta.dayAge2}}</div>
  21. <div>耳根温度</div>
  22. <div>{{tableData.eartagdeta.earTemp}}℃</div>
  23. <div>环境温度</div>
  24. <div>{{tableData.eartagdeta.envTemp}}℃</div>
  25. <div>运动量</div>
  26. <div>{{tableData.eartagdeta.sportGap}}</div>
  27. <div>耳标电量</div>
  28. <div>{{tableData.eartagdeta.bat}}%</div>
  29. <div>首次位置记录</div>
  30. <div>
  31. <div style="line-height: 14px; font-size: 14px;">时间: {{tableData.movePigPenData[2].moveDate}}</div>
  32. <div style="line-height: 14px; font-size: 14px;">阶段:{{getStage(tableData.movePigPenData[2].stage)}}</div>
  33. <div style="line-height: 14px; font-size: 14px;">{{tableData.movePigPenData[2].penName}}{{tableData.movePigPenData[2].unitname}}</div>
  34. </div>
  35. <div>上一次位置记录</div>
  36. <div>
  37. <div style="line-height: 14px; font-size: 14px;">时间: {{tableData.movePigPenData[1].moveDate}}</div>
  38. <div style="line-height: 14px; font-size: 14px;">阶段:{{getStage(tableData.movePigPenData[1].stage)}}</div>
  39. <div style="line-height: 14px; font-size: 14px;">{{tableData.movePigPenData[1].penName}}{{tableData.movePigPenData[1].unitname}}</div>
  40. </div>
  41. <div>当前位置位置</div>
  42. <div>
  43. <div style="line-height: 14px; font-size: 14px;">时间: {{tableData.movePigPenData[0].moveDate}}</div>
  44. <div style="line-height: 14px; font-size: 14px;">阶段:{{getStage(tableData.movePigPenData[0].stage)}}</div>
  45. <div style="line-height: 14px; font-size: 14px;">位置:{{tableData.movePigPenData[0].penName}}{{tableData.movePigPenData[0].unitname}}</div>
  46. </div>
  47. <div>信号强度</div>
  48. <div>-{{tableData.eartagdeta.rssi}}db(最后一次上传)</div>
  49. </div>
  50. <!-- echarts -->
  51. <div class="echarts">
  52. <div class="echarts_header">
  53. <span>温度走势图</span>
  54. <el-date-picker
  55. style="float: right; margin: 12px 10px 0 0;"
  56. size="mini"
  57. v-model="value2"
  58. type="datetimerange"
  59. range-separator="至"
  60. start-placeholder="开始日期"
  61. end-placeholder="结束日期"
  62. @change="onSelect"
  63. value-format="yyyy-MM-dd HH:mm:ss"
  64. align="right">
  65. </el-date-picker>
  66. </div>
  67. <div class="echart_init">
  68. <chart-temp :tempList="tempList"></chart-temp>
  69. </div>
  70. </div>
  71. <div class="echarts">
  72. <div class="echarts_header">
  73. <span>电量走势图</span>
  74. <el-date-picker
  75. style="float: right; margin: 12px 10px 0 0;"
  76. size="mini"
  77. v-model="value2"
  78. type="datetimerange"
  79. range-separator="至"
  80. start-placeholder="开始日期"
  81. end-placeholder="结束日期"
  82. @change="onSelect"
  83. value-format="yyyy-MM-dd HH:mm:ss"
  84. align="right">
  85. </el-date-picker>
  86. </div>
  87. <div class="echart_init">
  88. <chartDl :dlList="dlList"></chartDl>
  89. </div>
  90. </div>
  91. <div class="echarts">
  92. <div class="echarts_header">
  93. <span>运动量走势图</span>
  94. <el-date-picker
  95. style="float: right; margin: 12px 10px 0 0;"
  96. size="mini"
  97. v-model="value2"
  98. type="datetimerange"
  99. range-separator="至"
  100. start-placeholder="开始日期"
  101. end-placeholder="结束日期"
  102. @change="onSelect"
  103. value-format="yyyy-MM-dd HH:mm:ss"
  104. align="right">
  105. </el-date-picker>
  106. </div>
  107. <div class="echart_init">
  108. <chartYdl :ydlList="ydlList"></chartYdl>
  109. </div>
  110. </div>
  111. <div class="echarts">
  112. <div class="echarts_header">
  113. <span>群体平均温度走势图</span>
  114. <el-date-picker
  115. style="float: right; margin: 12px 10px 0 0;"
  116. size="mini"
  117. v-model="value2"
  118. type="datetimerange"
  119. range-separator="至"
  120. start-placeholder="开始日期"
  121. end-placeholder="结束日期"
  122. value-format="yyyy-MM-dd HH:mm:ss"
  123. align="right">
  124. </el-date-picker>
  125. </div>
  126. <div class="echart_init">
  127. <chartPjwd :pjwdList="pjwdList"></chartPjwd>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="flex" v-else>
  133. <div style="width: 100%; height: 100%" v-loading="loading"
  134. element-loading-text="拼命加载中"
  135. element-loading-spinner="el-icon-loading"
  136. element-loading-background="rgba(0, 0, 0, 0.8)"></div>
  137. </div>
  138. </template>
  139. <script>
  140. import chartTemp from "./chart/chartTemp";
  141. import chartDl from "./chart/chartDl";
  142. import chartYdl from "./chart/chartYdl";
  143. import chartPjwd from "./chart/chartPjwd";
  144. export default {
  145. name: "dataDetail",
  146. components: {
  147. chartTemp,
  148. chartDl,
  149. chartYdl,
  150. chartPjwd
  151. },
  152. data() {
  153. return {
  154. id: '',
  155. earTag: '',
  156. value2: [],
  157. tableData: {},
  158. // 温度曲线数据
  159. tempList: [],
  160. // 电量曲线数据
  161. dlList: [],
  162. // 运动量曲线
  163. ydlList: [],
  164. // 平均温度曲线
  165. pjwdList: {},
  166. loading: true,
  167. isShow: false,
  168. options: [
  169. {
  170. id: 1,
  171. name: '配种'
  172. },
  173. {
  174. id: 2,
  175. name: '分娩'
  176. },
  177. {
  178. id: 3,
  179. name: '保育'
  180. },
  181. {
  182. id: 4,
  183. name: '育成育肥'
  184. },
  185. {
  186. id: 5,
  187. name: '空怀'
  188. },
  189. {
  190. id: 6,
  191. name: '后备母猪'
  192. },
  193. {
  194. id: 7,
  195. name: '公猪'
  196. },
  197. {
  198. id: 8,
  199. name: '病死猪场内收集'
  200. },
  201. {
  202. id: 9,
  203. name: '病死猪无害化'
  204. },
  205. ]
  206. }
  207. },
  208. methods: {
  209. // 过滤
  210. getStage(id) {
  211. let str = '';
  212. this.options.forEach(item => {
  213. if(item.id === id) {
  214. str = item.name;
  215. }
  216. })
  217. return str;
  218. },
  219. init() {
  220. let params = {
  221. id: this.id,
  222. startTime: this.value2[0],
  223. endTime: this.value2[1]
  224. }
  225. this.$http({
  226. url: this.$http.adornUrl('/manager/eartagdata/list_deatils'),
  227. method: 'post',
  228. data: this.$http.adornData(params)
  229. })
  230. .then(res => {
  231. this.loading = false;
  232. if(res.data.code === 0) {
  233. this.isShow = true;
  234. this.tableData = res.data.page;
  235. this.earTag = this.tableData.eartagdeta.eartagNo;
  236. // 温度曲线
  237. this.tempList = [this.tableData.time, this.tableData.temp, this.tableData.environmenttemp];
  238. // 电量曲线
  239. this.dlList = [this.tableData.time, this.tableData.electric];
  240. // 运动量曲线
  241. this.ydlList = [this.tableData.time, this.tableData.sports];
  242. // 平均温度曲线
  243. this.pjwdList = this.tableData.averangeTemp;
  244. } else {
  245. this.$message.error(res.data.msg);
  246. }
  247. })
  248. .catch(() => {
  249. this.loading = false;
  250. this.isShow = true;
  251. })
  252. },
  253. jump() {
  254. this.$router.replace('/');
  255. },
  256. onSelect() {
  257. // console.log(this.value2)
  258. this.isShow = false;
  259. this.init();
  260. }
  261. },
  262. created() {
  263. this.id = this.$route.query.id;
  264. this.value2 = [this.$route.query.startTime, this.$route.query.endTime]
  265. this.init();
  266. },
  267. mounted() {
  268. }
  269. }
  270. </script>
  271. <style scoped>
  272. .about {
  273. width: 100%;
  274. box-sizing: border-box;
  275. padding: 20px;
  276. }
  277. .back {
  278. width: 90px;
  279. height: 30px;
  280. line-height: 30px;
  281. font-size: 14px;
  282. border: 1px solid #ddd;
  283. text-align: center;
  284. border-radius: 10px;
  285. margin-top: 4px;
  286. margin-right: 10px;
  287. float: right;
  288. cursor: pointer;
  289. }
  290. .box {
  291. width: calc(100% - 2px);
  292. height: 300px;
  293. border-top: 1px solid #ddd;
  294. border-left: 1px solid #ddd;
  295. border-right: 1px solid #ddd;
  296. display: grid;
  297. grid-template-columns: 1fr 2fr 1fr 2fr;
  298. grid-template-rows: repeat(7, 1fr);
  299. grid-column-gap: 0;
  300. grid-row-gap: 0;
  301. margin-bottom: 20px;
  302. }
  303. .box>div:nth-child(2n+1) {
  304. background-color: #F9FAFC;
  305. font-size: 14px;
  306. }
  307. .box>div:nth-child(4n-3), .box>div:nth-child(4n-2), .box>div:nth-child(4n-1){
  308. border-right: 1px solid #ddd;
  309. }
  310. .box>div{
  311. border-bottom: 1px solid #ddd;
  312. text-align: center;
  313. line-height: 42px;
  314. }
  315. .echarts {
  316. width: 100%;
  317. height: 500px;
  318. margin-bottom: 20px;
  319. border: 1px solid #ddd;
  320. }
  321. .echarts_header {
  322. height: 50px;
  323. font-size: 14px;
  324. background-color: #F3F3F3;
  325. padding-left: 20px;
  326. font-weight: 600;
  327. line-height: 50px;
  328. border-bottom: 1px solid #ddd;
  329. color: #667E9C;
  330. }
  331. .echart_init {
  332. width: 100%;
  333. height: 450px;
  334. }
  335. .flex {
  336. width: 100%;
  337. height: 1000px;
  338. }
  339. </style>