recharge.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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. this.$http.chargeList(this.rechargeData)
  194. .then(res => {
  195. if (res.code == 0) {
  196. this.showLoadMore = false
  197. this.contents.push(...res.data.records);
  198. this.total = res.data.total
  199. }
  200. }).catch(err => {
  201. console.error(err)
  202. })
  203. },
  204. //请求充电机下拉框数据
  205. ChargeCode() {
  206. this.$http.getChargeCode()
  207. .then(res => {
  208. if (res.code == 0) {
  209. res.data.forEach(item => {
  210. this.chargerList.push({
  211. value: item,
  212. text: item + '号充电机'
  213. })
  214. })
  215. }
  216. }).catch(err => {
  217. console.error(err)
  218. })
  219. }
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .box {
  225. width: 1040px;
  226. height: 66px;
  227. background: #111827;
  228. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  229. border-radius: 2px 2px 2px 2px;
  230. border: 1px solid #192337;
  231. // margin-top: 20px;
  232. }
  233. ::v-deep .search_box_from {
  234. padding-top: 15px;
  235. span {
  236. display: flex;
  237. }
  238. }
  239. .search_box {
  240. display: flex;
  241. justify-content: space-between;
  242. .box_btn {
  243. display: flex;
  244. margin-top: 16px;
  245. padding-right: 16px;
  246. .cx_btn {
  247. width: 60px;
  248. height: 34px;
  249. text-align: center;
  250. line-height: 34px;
  251. background: #91FDB9;
  252. border-radius: 2px 2px 2px 2px;
  253. color: black;
  254. font-size: 14px;
  255. margin-right: 5px;
  256. }
  257. .cz_btn {
  258. width: 60px;
  259. height: 34px;
  260. text-align: center;
  261. line-height: 34px;
  262. border-radius: 2px 2px 2px 2px;
  263. border: 1px solid #263042;
  264. color: #fff;
  265. font-size: 14px;
  266. }
  267. }
  268. }
  269. .main_table {
  270. height: 574px;
  271. margin-top: 20px;
  272. }
  273. ::v-deep .uni-forms-item__content {
  274. background: rgba(255, 255, 255, 0);
  275. border-radius: 2px 2px 2px 2px;
  276. border: 1px solid #263042;
  277. .uni-easyinput__content {
  278. background: none !important;
  279. border: none !important;
  280. color: #fff;
  281. }
  282. }
  283. ::v-deep .uni-select__selector {
  284. background: #111827;
  285. border: 1px solid #263042;
  286. color: #606266;
  287. z-index: 9999999;
  288. }
  289. ::v-deep .uni-date-x {
  290. background: none;
  291. }
  292. ::v-deep .uni-date-x--border {
  293. border: none;
  294. }
  295. ::v-deep .uni-select {
  296. border: none;
  297. }
  298. ::v-deep .uni-forms-item {
  299. width: 250px;
  300. }
  301. ::v-deep .uni-popper__arrow::after {
  302. display: none;
  303. }
  304. ::v-deep .uni-popper__arrow {
  305. display: none;
  306. }
  307. ::v-deep .uni-select__input-text {
  308. color: #fff;
  309. }
  310. ::v-deep .uni-date-x {
  311. color: #fff;
  312. }
  313. .last_box {
  314. width: 390px;
  315. }
  316. </style>