humiture.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <!-- 温湿度 -->
  3. <view>
  4. <u-navbar title="温湿度记录" autoBack placeholder></u-navbar>
  5. <view class="card_qiucharts" v-if="userType == 'customer'">
  6. <view class="card_echart">
  7. <qiun-data-charts type="gauge" :opts="opts" :chartData="chartData" />
  8. </view>
  9. <view class="card_echart">
  10. <qiun-data-charts type="gauge" :opts="opts1" :chartData="chartData1" />
  11. </view>
  12. </view>
  13. <view v-else>
  14. <view v-if="humitureList.length > 0">
  15. <view class="card_particulars" v-for="(item,index) in humitureList" :key="index">
  16. <view class="card_describe">
  17. <view class="describe_title">{{item.title}}</view>
  18. <view class="describe_time">{{item.startTime}}</view>
  19. <view class="describe_time">{{item.endTime}}</view>
  20. </view>
  21. <view class="humiture_details" @click="foldingPanel(item)">
  22. <view class="title_details">温湿度</view>
  23. <view style="display: flex;">
  24. <view class="title_blue title_details">查看详情</view>
  25. <u-icon name="arrow-down"></u-icon>
  26. </view>
  27. </view>
  28. <view v-show="item.collapseil">
  29. <x-humiture ref="humiture" :taskId="item.id" :waybillNo="orderList.waybillNo"
  30. :current="item.presentNum" :probeList="item.deviceSensorList"
  31. @sectionChange="sectionChange"></x-humiture>
  32. </view>
  33. </view>
  34. </view>
  35. <view style="margin-top: 30%;" v-else>
  36. <u-empty mode="data" text="当前没有温湿度记录"></u-empty>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. orderList: {},
  46. humitureList: [],
  47. userType: '',
  48. myChart: null,
  49. chartData: {},
  50. chartData1: {},
  51. opts: {
  52. color: ["#3592FE"],
  53. padding: undefined,
  54. title: {
  55. // name: "66℃",
  56. fontSize: 25,
  57. color: "#3592FE",
  58. offsetY: 0
  59. },
  60. subtitle: {
  61. name: "当前温度",
  62. fontSize: 15,
  63. color: "#1890ff",
  64. offsetY: 0
  65. },
  66. extra: {
  67. gauge: {
  68. type: "progress",
  69. width: 20,
  70. labelColor: "#666666",
  71. startAngle: 0.75,
  72. endAngle: 0.25,
  73. // startNumber: 5,
  74. // endNumber: 35,
  75. labelFormat: "",
  76. splitLine: {
  77. fixRadius: -10,
  78. splitNumber: 10,
  79. width: 15,
  80. color: "#FFFFFF",
  81. childNumber: 5,
  82. childWidth: 12
  83. },
  84. pointer: {
  85. width: 24,
  86. color: "auto"
  87. }
  88. }
  89. },
  90. },
  91. opts1: {
  92. color: ["#67C23A"],
  93. padding: 20,
  94. title: {
  95. // name: "66℃",
  96. fontSize: 25,
  97. color: "#2fc25b",
  98. offsetY: 0
  99. },
  100. subtitle: {
  101. name: "当前湿度",
  102. fontSize: 15,
  103. color: "#67C23A",
  104. offsetY: 0
  105. },
  106. extra: {
  107. gauge: {
  108. type: "progress",
  109. width: 20,
  110. labelColor: "#000000",
  111. startAngle: 0.75,
  112. endAngle: 0.25,
  113. // startNumber: 0,
  114. // endNumber: 100,
  115. labelFormat: "",
  116. splitLine: {
  117. fixRadius: -10,
  118. splitNumber: 10,
  119. width: 15,
  120. color: "#67C23A",
  121. childNumber: 5,
  122. childWidth: 12
  123. },
  124. labelOffset: 20,
  125. pointer: {
  126. width: 24,
  127. color: "auto"
  128. }
  129. }
  130. },
  131. }
  132. }
  133. },
  134. mounted() {
  135. var userInfo = this.$cache.getCache('userInfo')
  136. this.userType = userInfo.userType
  137. var orderList = this.$cache.getCache('orderDetails')
  138. this.orderList = orderList
  139. if (this.userType == 'customer') {
  140. this.getServerData();
  141. } else {
  142. this.getList()
  143. }
  144. },
  145. methods: {
  146. getList() {
  147. this.$api.get('/api/waybill-task', {
  148. waybillNo: this.orderList.waybillNo,
  149. }).then(res => {
  150. if (res.code == 200) {
  151. this.humitureList = res.data.list
  152. this.humitureList.forEach((item, index) => {
  153. item.title = ''
  154. item.collapseil = false
  155. if (item.car.id) {
  156. item.title = item.car.carNo
  157. } else if (item.warehouse.id) {
  158. item.title = item.warehouse.name
  159. }
  160. })
  161. }
  162. })
  163. },
  164. // 折叠面板
  165. foldingPanel(value) {
  166. this.humitureList.forEach((item, index) => {
  167. if (item.id == value.id) {
  168. if (item.collapseil) {
  169. item.collapseil = false
  170. } else {
  171. this.$refs.humiture[index].getlist(item.deviceSensorList[0].T_id)
  172. item.collapseil = true
  173. }
  174. }
  175. })
  176. this.$forceUpdate()
  177. },
  178. open(e) {
  179. // console.log('open', e)
  180. },
  181. close(e) {
  182. // console.log('close', e)
  183. },
  184. change(e) {
  185. if (e[0].status == 'open') {
  186. this.humitureList.forEach((item, index) => {
  187. this.$refs.humiture[index].getlist(item.deviceSensorList[0].T_id)
  188. })
  189. }
  190. },
  191. getServerData() {
  192. this.$api.post('/api/waybill-task/newest-locus', {
  193. waybillNo: this.orderList.waybillNo,
  194. }).then((res) => {
  195. if (res.code == 200) {
  196. this.opts.title.name = res.data.T_t + '℃'
  197. this.opts.extra.gauge.startNumber = res.data.T_tl
  198. this.opts.extra.gauge.endNumber = res.data.T_tu
  199. this.opts1.title.name = res.data.T_rh + '℃'
  200. this.opts1.extra.gauge.startNumber = res.data.T_rhl
  201. this.opts1.extra.gauge.endNumber = res.data.T_rhu
  202. let arr = (res.data.T_t - res.data.T_tl) / (res.data.T_tu - res.data.T_tl)
  203. let arr1 = (res.data.T_rh - res.data.T_rhl) / (res.data.T_rhu - res.data.T_rhl)
  204. let value = {
  205. categories: [{
  206. "value": 0.2,
  207. "color": "#1890ff"
  208. }, {
  209. "value": 0.8,
  210. "color": "#2fc25b"
  211. }, {
  212. "value": 1,
  213. "color": "#f04864"
  214. }],
  215. series: [{
  216. data: arr.toFixed(1)
  217. }]
  218. };
  219. let value1 = {
  220. categories: [{
  221. "value": 0.2,
  222. "color": "#1890ff"
  223. }, {
  224. "value": 0.8,
  225. "color": "#2fc25b"
  226. }, {
  227. "value": 1,
  228. "color": "#f04864"
  229. }],
  230. series: [{
  231. data: arr1.toFixed(1)
  232. }]
  233. };
  234. this.chartData = JSON.parse(JSON.stringify(value));
  235. this.chartData1 = JSON.parse(JSON.stringify(value1));
  236. }
  237. })
  238. },
  239. }
  240. }
  241. </script>
  242. <style lang="scss">
  243. .card_particulars {
  244. display: flex;
  245. flex-direction: column;
  246. padding-top: 20rpx;
  247. margin: 30rpx 20rpx 20rpx 20rpx;
  248. border-radius: 20rpx;
  249. background-color: #fff;
  250. }
  251. .card_describe {
  252. padding-left: 20rpx;
  253. padding-bottom: 20rpx;
  254. border-bottom: 1rpx solid #EBEEF5;
  255. }
  256. .describe_title {
  257. font-size: 30rpx;
  258. font-weight: 600;
  259. }
  260. .describe_time {
  261. font-size: 28rpx;
  262. }
  263. .humiture_details {
  264. display: flex;
  265. justify-content: space-between;
  266. align-items: center;
  267. padding: 20rpx;
  268. }
  269. .title_blue {
  270. color: #2979ff;
  271. margin-right: 10rpx;
  272. }
  273. .title_details {
  274. font-size: 28rpx;
  275. }
  276. ::v-deep .u-collapse-item__content__text {
  277. padding: 0rpx 0rpx 30rpx 0rpx;
  278. }
  279. ::v-deep .u-line {
  280. display: none;
  281. }
  282. .card_qiucharts {
  283. display: flex;
  284. align-items: center;
  285. flex-direction: column;
  286. }
  287. .card_echart {
  288. width: 80%;
  289. height: 500rpx;
  290. }
  291. .card_echart {
  292. width: 80%;
  293. height: 500rpx;
  294. }
  295. </style>