recharge.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="recharge_box">
  3. <view class="search_box box">
  4. <uni-forms :modelValue="rechargeData" class="search_box_from">
  5. <uni-forms-item label="电池编号:" label-width="85px" label-align="right" name="chgSn">
  6. <uni-easyinput type="text" v-model="rechargeData.chgSn" placeholder="请输入" />
  7. </uni-forms-item>
  8. <uni-forms-item label="充电机ID:" name="chargerId" label-width="85px" label-align="right">
  9. <uni-data-select v-model="rechargeData.chargerId" :localdata="chargerList" @change="changeId">
  10. </uni-data-select>
  11. </uni-forms-item>
  12. <uni-forms-item label="充电时间:" name="time" label-width="85px" label-align="right" class="last_box">
  13. <uni-datetime-picker v-model="time" type="daterange" rangeSeparator="至" />
  14. </uni-forms-item>
  15. </uni-forms>
  16. <view class="box_btn">
  17. <view class="cx_btn" @click="search">
  18. 查询
  19. </view>
  20. <view class="cz_btn" @click="reset">
  21. 重置
  22. </view>
  23. </view>
  24. </view>
  25. <view class="main_table box">
  26. <!-- <PublicTable :loading="loading" :tableData="tableData"></PublicTable> -->
  27. <view style="margin: 20px;">
  28. <lyy-table :headerFixed="true" :battery="1" :showLoadMore="showLoadMore" :loadMore="loadMore"
  29. :columnFixed=1 :contents="contents" :headers="headers" @onPullup="pullup" @charging="charging">
  30. </lyy-table>
  31. </view>
  32. </view>
  33. <!--右侧抽屉 -->
  34. <uni-drawer ref="showRight" mode="right" :width="400" :mask-click="true">
  35. <scroll-view style="height: 100%;" scroll-y="true">
  36. <PublicDrawer :flag="true" :title="titlenum" @closeDrawer="closeDrawer">
  37. <view class="drawer_main">
  38. <rechargeDrawer :infodata="dataInfo"></rechargeDrawer>
  39. </view>
  40. </PublicDrawer>
  41. </scroll-view>
  42. </uni-drawer>
  43. <!-- 右侧抽屉结束 -->
  44. </view>
  45. </template>
  46. <script>
  47. import lyyTable from '@/components/lyy-table/lyy-table.vue'
  48. import rechargeDrawer from "../components/rechargeDrawer.vue"
  49. export default {
  50. name: 'recharge',
  51. components: {
  52. lyyTable,
  53. rechargeDrawer
  54. },
  55. data() {
  56. return {
  57. rechargeData: {
  58. chgSn: undefined, //电池编号
  59. chargerId: undefined, //充电机id号
  60. chgBeginTime: undefined, //开始时间
  61. chgEndTime: undefined, //结束时间
  62. // 每页数据量
  63. pageSize: 10,
  64. // 当前页
  65. page: 1,
  66. orderByWays: "desc", //降序
  67. },
  68. dataInfo: [], //弹出框数据
  69. titlenum: '充电明细',
  70. time: [], //时间
  71. chargerList: [], //充电机数据
  72. // 数据总量
  73. total: 0,
  74. loading: false,
  75. headers: [{
  76. label: '充电流水号',
  77. key: 'chgId',
  78. widtd: 200
  79. }, {
  80. label: '充电机ID',
  81. key: 'chargerId',
  82. widtd: 100
  83. }, {
  84. label: '电池编号',
  85. key: 'chgSn',
  86. widtd: 150
  87. }, {
  88. label: '充电开始时间',
  89. key: 'chgBeginTime',
  90. widtd: 200,
  91. }, {
  92. label: '充电结束时间',
  93. key: 'chgEndTime',
  94. widtd: 200,
  95. }, {
  96. label: '充电时长(秒)',
  97. key: 'chgDuration',
  98. widtd: 150,
  99. sort: true
  100. }, {
  101. label: '开始SOC',
  102. key: 'chgBeginSoc',
  103. widtd: 125,
  104. }, {
  105. label: '结束SOC',
  106. key: 'chgEndSoc',
  107. widtd: 125,
  108. },
  109. {
  110. label: '充电前电表数',
  111. key: 'chgBeginAmmeter',
  112. widtd: 125,
  113. },
  114. {
  115. label: '充电后电表数',
  116. key: 'chgEndAmmeter',
  117. widtd: 125,
  118. },
  119. {
  120. label: '充电量(kW·h)',
  121. key: 'chgCapacity',
  122. widtd: 125,
  123. },
  124. {
  125. label: '时段明细',
  126. key: 'id',
  127. widtd: 98,
  128. }
  129. ],
  130. contents: [],
  131. showLoadMore: false,
  132. loadMore: 'more',
  133. }
  134. },
  135. mounted() {
  136. this.ChargeCode()
  137. this.getchargeList()
  138. },
  139. methods: {
  140. //关闭抽屉
  141. closeDrawer() {
  142. this.$refs.showRight.close();
  143. },
  144. //抽屉
  145. charging(item) {
  146. this.$refs.showRight.open();
  147. this.dataInfo = item.interval;
  148. // console.log(item, 'item')
  149. },
  150. //充电机下拉选择事件
  151. changeId(e) {
  152. console.log(e, 'e')
  153. this.rechargeData.chargerId = e;
  154. },
  155. //重置
  156. reset() {
  157. this.rechargeData.chgSn = undefined;
  158. this.rechargeData.chargerId = undefined;
  159. this.time = [];
  160. this.rechargeData.pageSize = 10;
  161. this.rechargeData.page = 1;
  162. this.rechargeData.chgBeginTime = undefined;
  163. this.rechargeData.chgEndTime = undefined;
  164. this.contents = []
  165. this.getchargeList()
  166. },
  167. //查询
  168. search() {
  169. if (this.time.length>0) {
  170. this.rechargeData.chgBeginTime = this.time[0]+' ' +'00:00:00';
  171. this.rechargeData.chgEndTime = this.time[1]+' ' +'23:59:59';
  172. // this.rechargeData.time = undefined;
  173. }
  174. this.rechargeData.page = 1
  175. this.contents = []
  176. this.getchargeList()
  177. console.log(this.rechargeData, 'rechargedata')
  178. },
  179. //上拉加载事件
  180. pullup() {
  181. this.showLoadMore = true
  182. if (this.total == this.contents.length) {
  183. this.loadMore = 'no-more'
  184. return
  185. } else {
  186. this.rechargeData.page++
  187. this.getchargeList()
  188. this.loadMore = 'loading'
  189. }
  190. },
  191. //请求数据列表
  192. getchargeList() {
  193. uni.showLoading({
  194. title:'数据加载中...'
  195. })
  196. this.$http.chargeList(this.rechargeData)
  197. .then(res => {
  198. if (res.code == 0) {
  199. this.showLoadMore = false
  200. this.contents.push(...res.data.records);
  201. this.total = res.data.total
  202. setTimeout(()=>{
  203. uni.hideLoading()
  204. },1000)
  205. }
  206. }).catch(err => {
  207. console.error(err)
  208. uni.hideLoading()
  209. })
  210. },
  211. //请求充电机下拉框数据
  212. ChargeCode() {
  213. this.$http.getChargeCode()
  214. .then(res => {
  215. if (res.code == 0) {
  216. res.data.forEach(item => {
  217. this.chargerList.push({
  218. value: item,
  219. text: item + '号充电机'
  220. })
  221. })
  222. }
  223. }).catch(err => {
  224. console.error(err)
  225. })
  226. }
  227. }
  228. }
  229. </script>
  230. <style lang="scss" scoped>
  231. .box {
  232. width: 1040px;
  233. height: 66px;
  234. background: #111827;
  235. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  236. border-radius: 2px 2px 2px 2px;
  237. border: 1px solid #192337;
  238. // margin-top: 20px;
  239. }
  240. ::v-deep .search_box_from {
  241. padding-top: 15px;
  242. span {
  243. display: flex;
  244. }
  245. }
  246. .search_box {
  247. display: flex;
  248. justify-content: space-between;
  249. .box_btn {
  250. display: flex;
  251. margin-top: 16px;
  252. padding-right: 16px;
  253. .cx_btn {
  254. width: 60px;
  255. height: 34px;
  256. text-align: center;
  257. line-height: 34px;
  258. background: #91FDB9;
  259. border-radius: 2px 2px 2px 2px;
  260. color: black;
  261. font-size: 14px;
  262. margin-right: 5px;
  263. }
  264. .cz_btn {
  265. width: 60px;
  266. height: 34px;
  267. text-align: center;
  268. line-height: 34px;
  269. border-radius: 2px 2px 2px 2px;
  270. border: 1px solid #263042;
  271. color: #fff;
  272. font-size: 14px;
  273. }
  274. }
  275. }
  276. .main_table {
  277. height: 574px;
  278. margin-top: 20px;
  279. }
  280. ::v-deep .uni-forms-item__content {
  281. background: rgba(255, 255, 255, 0);
  282. border-radius: 2px 2px 2px 2px;
  283. border: 1px solid #263042;
  284. .uni-easyinput__content {
  285. background: none !important;
  286. border: none !important;
  287. color: #fff;
  288. }
  289. }
  290. ::v-deep .uni-select__selector {
  291. background: #111827;
  292. border: 1px solid #263042;
  293. color: #606266;
  294. z-index: 9999999;
  295. }
  296. ::v-deep .uni-date-x {
  297. background: none;
  298. }
  299. ::v-deep .uni-date-x--border {
  300. border: none;
  301. }
  302. ::v-deep .uni-select {
  303. border: none;
  304. }
  305. ::v-deep .uni-forms-item {
  306. width: 250px;
  307. }
  308. ::v-deep .uni-popper__arrow::after {
  309. display: none;
  310. }
  311. ::v-deep .uni-popper__arrow {
  312. display: none;
  313. }
  314. ::v-deep .uni-select__input-text {
  315. color: #fff;
  316. }
  317. ::v-deep .uni-date-x {
  318. color: #fff;
  319. }
  320. .last_box {
  321. width: 390px;
  322. }
  323. </style>