change.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view class="recharge_box">
  3. <view class="search_box box">
  4. <uni-forms :modelValue="changeData" class="search_box_from">
  5. <uni-forms-item label="车牌号码:" label-width="85px" label-align="right" name="vehiclePlate">
  6. <uni-easyinput type="text" v-model="changeData.vehiclePlate" placeholder="请输入" />
  7. </uni-forms-item>
  8. <uni-forms-item label="换电结果:" name="swapState" label-width="85px" label-align="right" >
  9. <uni-data-select v-model="changeData.swapState" :localdata="range" @change="changeId"></uni-data-select>
  10. </uni-forms-item>
  11. <uni-forms-item label="换电日期:" name="time" label-width="85px" label-align="right" class="last_box">
  12. <uni-datetime-picker v-model="time" type="daterange" rangeSeparator="至"/>
  13. </uni-forms-item>
  14. </uni-forms>
  15. <view class="box_btn">
  16. <view class="cx_btn" @click="search">
  17. 查询
  18. </view>
  19. <view class="cz_btn" @click="reset">
  20. 重置
  21. </view>
  22. </view>
  23. </view>
  24. <view class="main_table box">
  25. <view style="margin: 20px;">
  26. <lyy-table @drawer='drawer' :headerFixed="true" :battery="1" :showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed = 1 :contents="changelist" :headers="headers" @onPullup="pullup"></lyy-table>
  27. </view>
  28. </view>
  29. <!--右侧抽屉 -->
  30. <uni-drawer ref="showRight" mode="right" :width="400" :mask-click="true">
  31. <scroll-view style="height: 100%;" scroll-y="true">
  32. <PublicDrawer :flag="true" :title="titlenum" @closeDrawer="closeDrawer">
  33. <view class="header_drawer_btn">
  34. <view class="header_drawer_btn_left" :class="batteryInfoActive == 0?'active':''" @click="batteryInfoActive = 0">
  35. 基本信息
  36. </view>
  37. <view class="header_drawer_btn_right" :class="batteryInfoActive == 1?'active':''" @click="batteryInfoActive = 1">
  38. 车辆信息
  39. </view>
  40. <view class="header_drawer_btn_right" :class="batteryInfoActive == 2?'active':''" @click="batteryInfoActive = 2">
  41. 预选电池
  42. </view>
  43. <view class="header_drawer_btn_right" :class="batteryInfoActive == 3?'active':''" @click="batteryInfoActive = 3">
  44. 同步信息
  45. </view>
  46. </view>
  47. <view class="drawer_main">
  48. <changeDrawer :batteryInfoActive = 'batteryInfoActive' :infodata = "dataInfo"></changeDrawer>
  49. </view>
  50. </PublicDrawer>
  51. </scroll-view>
  52. </uni-drawer>
  53. <!-- 右侧抽屉结束 -->
  54. </view>
  55. </template>
  56. <script>
  57. import lyyTable from '@/components/lyy-table/lyy-table.vue'
  58. import changeDrawer from "../components/changeDrawer.vue"
  59. export default {
  60. name: 'change',
  61. components:{
  62. lyyTable,changeDrawer
  63. },
  64. data() {
  65. return {
  66. changeData: {
  67. vehiclePlate: undefined, // 车牌号
  68. swapState: undefined, //换电结果
  69. // 每页数据量
  70. pageSize: 10,
  71. // 当前页
  72. page: 1,
  73. swapBeginTime: undefined,
  74. swapEndTime: undefined,
  75. orderByWays: 'desc'// 排序方式
  76. },
  77. dataInfo:{},
  78. batteryInfoActive:0,//0代表基本信息1代表车辆信息2预选电池3同步信息
  79. titlenum:'换电详情',
  80. time:[],//换电日期
  81. range: [
  82. {
  83. value: 4,
  84. text: "全部"
  85. },{
  86. value: 0,
  87. text: "不完整"
  88. },
  89. {
  90. value: 1,
  91. text: "成功"
  92. },
  93. {
  94. value: 2,
  95. text: "失败"
  96. },
  97. {
  98. value: 3,
  99. text: "换电错误"
  100. },
  101. ],
  102. headers:[{
  103. label: '换电编号',
  104. key: 'swapId',
  105. widtd: 150
  106. }, {
  107. label: '车牌号',
  108. key: 'vehiclePlate',
  109. widtd: 100
  110. },
  111. {
  112. label: '车辆识别码',
  113. key: 'vehicleVin',
  114. widtd: 100
  115. },{
  116. label: '换电开始时间',
  117. key: 'swapBeginTime',
  118. widtd: 200
  119. }, {
  120. label: '安装满电时长',
  121. key: 'fullDuration',
  122. widtd: 150,
  123. },{
  124. label:'换电时长',
  125. key:'swapDuration',
  126. widtd:130,
  127. },{
  128. label: '亏电电池SN',
  129. key: 'vehicleSn',
  130. widtd: 200,
  131. }, {
  132. label: '亏电电池SOC',
  133. key: 'vehicleSoc',
  134. widtd: 125,
  135. }, {
  136. label: '亏电电池SOH',
  137. key: 'vehicleSoh',
  138. widtd: 125,
  139. }, {
  140. label: '满电电池SN',
  141. key: 'swapSn',
  142. widtd: 200,
  143. }, {
  144. label: '满电电池SOC',
  145. key: 'swapSoc',
  146. widtd: 125,
  147. }, {
  148. label: '满电电池SOH',
  149. key: 'swapSoh',
  150. widtd: 125,
  151. }, {
  152. label: '换电结果',
  153. key: 'swapState',
  154. widtd: 125,
  155. },
  156. {
  157. label: '操作',
  158. key: 'id',
  159. widtd: 98,
  160. }],
  161. changelist:[],
  162. // 数据总量
  163. total: 0,
  164. loading: false,
  165. showLoadMore: false,
  166. loadMore: 'more',
  167. }
  168. },
  169. mounted() {
  170. this.getswapList()
  171. },
  172. methods: {
  173. //关闭抽屉
  174. closeDrawer() {
  175. this.$refs.showRight.close();
  176. },
  177. //充电机下拉选择事件
  178. changeId(e) {
  179. if(e == 4){
  180. e = ''
  181. }
  182. this.changeData.swapState = e
  183. console.log(e, 'e')
  184. },
  185. //请求数据列表
  186. getswapList(){
  187. uni.showLoading({
  188. title:'数据加载中...'
  189. })
  190. this.$http.swapList(this.changeData)
  191. .then(res => {
  192. if(res.code == 0){
  193. this.showLoadMore = false
  194. res.data.records.forEach(item=>{
  195. if(item.swapState == 0){
  196. item.swapState = '不完整'
  197. }else if(item.swapState == 1){
  198. item.swapState = '换电成功'
  199. }else if(item.swapState == 2){
  200. item.swapState = '换电失败'
  201. }else{
  202. item.swapState = '换电错误'
  203. }
  204. })
  205. this.changelist.push(...res.data.records)
  206. this.total = res.data.total;
  207. setTimeout(()=>{
  208. uni.hideLoading()
  209. },1000)
  210. }
  211. }).catch(err => {
  212. console.error(err)
  213. uni.hideLoading()
  214. })
  215. },
  216. //重置
  217. reset(){
  218. this.changeData.page = 1;
  219. this.changeData.swapState = undefined;
  220. this.changeData.swapBeginTime = undefined;
  221. this.changeData.swapEndTime = undefined;
  222. this.changeData.vehiclePlate = undefined;
  223. this.time = [];
  224. this.changelist = []
  225. this.getswapList()
  226. },
  227. //查询
  228. search(){
  229. if(this.time.length>0){
  230. this.changeData.swapBeginTime = this.time[0] +' ' +'00:00:00';
  231. this.changeData.swapEndTime = this.time[1]+' ' +"23:59:59";
  232. }
  233. this.changeData.page = 1
  234. this.changelist = []
  235. this.getswapList()
  236. },
  237. //下拉加载
  238. pullup(){
  239. this.showLoadMore = true
  240. if (this.total == this.changelist.length) {
  241. this.loadMore = 'no-more'
  242. return
  243. } else {
  244. this.changeData.page++
  245. this.getswapList()
  246. this.loadMore = 'loading'
  247. }
  248. },
  249. //抽屉
  250. drawer(item) {
  251. // console.log(1111111111111111)
  252. this.$refs.showRight.open();
  253. this.dataInfo = item;
  254. // console.log(item, 'item')
  255. },
  256. //关闭抽屉
  257. closeDrawer(){
  258. this.$refs.showRight.close();
  259. },
  260. }
  261. }
  262. </script>
  263. <style lang="scss" scoped>
  264. .box {
  265. width: 1040px;
  266. height: 66px;
  267. background: #111827;
  268. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  269. border-radius: 2px 2px 2px 2px;
  270. border: 1px solid #192337;
  271. // margin-top: 20px;
  272. }
  273. ::v-deep .search_box_from{
  274. padding-top: 15px;
  275. span{
  276. display: flex;
  277. }
  278. }
  279. .search_box{
  280. display: flex;
  281. justify-content: space-between;
  282. .box_btn{
  283. display: flex;
  284. margin-top: 16px;
  285. padding-right: 16px;
  286. .cx_btn{
  287. width: 60px;
  288. height: 34px;
  289. text-align: center;
  290. line-height: 34px;
  291. background: #91FDB9;
  292. border-radius: 2px 2px 2px 2px;
  293. color: black;
  294. font-size: 14px;
  295. margin-right: 5px;
  296. }
  297. .cz_btn{
  298. width: 60px;
  299. height: 34px;
  300. text-align: center;
  301. line-height: 34px;
  302. border-radius: 2px 2px 2px 2px;
  303. border: 1px solid #263042;
  304. color: #fff;
  305. font-size: 14px;
  306. }
  307. }
  308. }
  309. .main_table {
  310. height: 574px;
  311. margin-top: 20px;
  312. }
  313. ::v-deep .uni-forms-item__content{
  314. background: rgba(255,255,255,0);
  315. border-radius: 2px 2px 2px 2px;
  316. border: 1px solid #263042;
  317. .uni-easyinput__content{
  318. background: none !important;
  319. border: none !important;
  320. color: #fff;
  321. }
  322. }
  323. ::v-deep .uni-select__selector{
  324. background: #111827;
  325. border:1px solid #263042;
  326. color: #606266;
  327. z-index: 9999999;
  328. }
  329. ::v-deep .uni-date-x{
  330. background: none;
  331. }
  332. ::v-deep .uni-date-x--border{
  333. border: none;
  334. }
  335. ::v-deep .uni-select{
  336. border: none;
  337. }
  338. ::v-deep .uni-forms-item{
  339. width: 250px;
  340. }
  341. ::v-deep .uni-popper__arrow::after{
  342. display: none;
  343. }
  344. ::v-deep .uni-popper__arrow{
  345. display: none;
  346. }
  347. ::v-deep .uni-select__input-text{
  348. color:#fff;
  349. }
  350. ::v-deep .uni-date-x{
  351. color:#fff;
  352. }
  353. .last_box{
  354. width: 390px;
  355. }
  356. .header_drawer_btn{
  357. display: flex;
  358. font-size: 14px;
  359. font-family: PingFang SC-Regular, PingFang SC;
  360. font-weight: 400;
  361. color: #FFFFFF;
  362. .header_drawer_btn_left{
  363. width: 74px;
  364. height: 32px;
  365. background: #263042;
  366. border-radius: 2px 0px 0px 2px;
  367. line-height: 32px;
  368. text-align: center;
  369. }
  370. .header_drawer_btn_right{
  371. line-height: 32px;
  372. text-align: center;
  373. width: 74px;
  374. height: 32px;
  375. background: #263042;
  376. border-radius: 0px 2px 2px 0px;
  377. }
  378. .active{
  379. color: black;
  380. background: #91FDB9;
  381. }
  382. }
  383. .drawer_main{
  384. padding-top: 20px;
  385. }
  386. </style>