change.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. this.$http.swapList(this.changeData)
  188. .then(res => {
  189. if(res.code == 0){
  190. this.showLoadMore = false
  191. res.data.records.forEach(item=>{
  192. if(item.swapState == 0){
  193. item.swapState = '不完整'
  194. }else if(item.swapState == 1){
  195. item.swapState = '换电成功'
  196. }else if(item.swapState == 2){
  197. item.swapState = '换电失败'
  198. }else{
  199. item.swapState = '换电错误'
  200. }
  201. })
  202. this.changelist.push(...res.data.records)
  203. this.total = res.data.total;
  204. }
  205. }).catch(err => {
  206. console.error(err)
  207. })
  208. },
  209. //重置
  210. reset(){
  211. this.changeData.page = 1;
  212. this.changeData.swapState = undefined;
  213. this.changeData.swapBeginTime = undefined;
  214. this.changeData.swapEndTime = undefined;
  215. this.changeData.vehiclePlate = undefined;
  216. this.time = [];
  217. this.changelist = []
  218. this.getswapList()
  219. },
  220. //查询
  221. search(){
  222. if(this.time.length>0){
  223. this.changeData.swapBeginTime = this.time[0] +' ' +'00:00:00';
  224. this.changeData.swapEndTime = this.time[1]+' ' +"23:59:59";
  225. }
  226. this.changeData.page = 1
  227. this.changelist = []
  228. this.getswapList()
  229. },
  230. //下拉加载
  231. pullup(){
  232. this.showLoadMore = true
  233. if (this.total == this.changelist.length) {
  234. this.loadMore = 'no-more'
  235. return
  236. } else {
  237. this.changeData.page++
  238. this.getswapList()
  239. this.loadMore = 'loading'
  240. }
  241. },
  242. //抽屉
  243. drawer(item) {
  244. // console.log(1111111111111111)
  245. this.$refs.showRight.open();
  246. this.dataInfo = item;
  247. // console.log(item, 'item')
  248. },
  249. //关闭抽屉
  250. closeDrawer(){
  251. this.$refs.showRight.close();
  252. },
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .box {
  258. width: 1040px;
  259. height: 66px;
  260. background: #111827;
  261. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  262. border-radius: 2px 2px 2px 2px;
  263. border: 1px solid #192337;
  264. // margin-top: 20px;
  265. }
  266. ::v-deep .search_box_from{
  267. padding-top: 15px;
  268. span{
  269. display: flex;
  270. }
  271. }
  272. .search_box{
  273. display: flex;
  274. justify-content: space-between;
  275. .box_btn{
  276. display: flex;
  277. margin-top: 16px;
  278. padding-right: 16px;
  279. .cx_btn{
  280. width: 60px;
  281. height: 34px;
  282. text-align: center;
  283. line-height: 34px;
  284. background: #91FDB9;
  285. border-radius: 2px 2px 2px 2px;
  286. color: black;
  287. font-size: 14px;
  288. margin-right: 5px;
  289. }
  290. .cz_btn{
  291. width: 60px;
  292. height: 34px;
  293. text-align: center;
  294. line-height: 34px;
  295. border-radius: 2px 2px 2px 2px;
  296. border: 1px solid #263042;
  297. color: #fff;
  298. font-size: 14px;
  299. }
  300. }
  301. }
  302. .main_table {
  303. height: 574px;
  304. margin-top: 20px;
  305. }
  306. ::v-deep .uni-forms-item__content{
  307. background: rgba(255,255,255,0);
  308. border-radius: 2px 2px 2px 2px;
  309. border: 1px solid #263042;
  310. .uni-easyinput__content{
  311. background: none !important;
  312. border: none !important;
  313. color: #fff;
  314. }
  315. }
  316. ::v-deep .uni-select__selector{
  317. background: #111827;
  318. border:1px solid #263042;
  319. color: #606266;
  320. z-index: 9999999;
  321. }
  322. ::v-deep .uni-date-x{
  323. background: none;
  324. }
  325. ::v-deep .uni-date-x--border{
  326. border: none;
  327. }
  328. ::v-deep .uni-select{
  329. border: none;
  330. }
  331. ::v-deep .uni-forms-item{
  332. width: 250px;
  333. }
  334. ::v-deep .uni-popper__arrow::after{
  335. display: none;
  336. }
  337. ::v-deep .uni-popper__arrow{
  338. display: none;
  339. }
  340. ::v-deep .uni-select__input-text{
  341. color:#fff;
  342. }
  343. ::v-deep .uni-date-x{
  344. color:#fff;
  345. }
  346. .last_box{
  347. width: 390px;
  348. }
  349. .header_drawer_btn{
  350. display: flex;
  351. font-size: 14px;
  352. font-family: PingFang SC-Regular, PingFang SC;
  353. font-weight: 400;
  354. color: #FFFFFF;
  355. .header_drawer_btn_left{
  356. width: 74px;
  357. height: 32px;
  358. background: #263042;
  359. border-radius: 2px 0px 0px 2px;
  360. line-height: 32px;
  361. text-align: center;
  362. }
  363. .header_drawer_btn_right{
  364. line-height: 32px;
  365. text-align: center;
  366. width: 74px;
  367. height: 32px;
  368. background: #263042;
  369. border-radius: 0px 2px 2px 0px;
  370. }
  371. .active{
  372. color: black;
  373. background: #91FDB9;
  374. }
  375. }
  376. .drawer_main{
  377. padding-top: 20px;
  378. }
  379. </style>