index.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  1. <template>
  2. <view class="basic-data">
  3. <view class="basic-top">
  4. <view class="service_header_left">
  5. <view class="btn" :class="isSelect===0?'active':''" @click="handleData(0)">车辆管理</view>
  6. <view class="btn" :class="isSelect===2?'active':''" @click="handleData(2)">电池管理</view>
  7. <view class="btn" :class="isSelect===1?'active':''" @click="handleData(1)" v-if="$storage.getJson('userId')==1">站控配置</view>
  8. </view>
  9. <view class="basci-header-right">
  10. <view class="times">最近同步时间:{{synchronizationTime || '-'}}</view>
  11. <view class="sync-btn" @click="syncCloud">云端同步</view>
  12. <!-- <view class="title">车辆管理</view> -->
  13. </view>
  14. </view>
  15. <view v-if="isSelect===0">
  16. <view class="basic-search">
  17. <uni-forms ref="form" :modelValue="queryParams" class="searchForm">
  18. <uni-forms-item label="车牌号码:" label-width="72px" label-align="right" name="vehiclePlate">
  19. <uni-easyinput type="text" v-model="queryParams.vehiclePlate" placeholder="请输入车牌号码" />
  20. </uni-forms-item>
  21. <uni-forms-item label="车辆识别码:" label-width="128px" label-align="right" name="vehicleVin">
  22. <uni-easyinput type="text" v-model="queryParams.vehicleVin" placeholder="请输入车辆识别码" />
  23. </uni-forms-item>
  24. <uni-forms-item label="来源:" label-width="80px" label-align="right">
  25. <uni-data-select v-model="queryParams.source" :localdata="formSelect" style="width: 100px;"
  26. @change="change"></uni-data-select>
  27. </uni-forms-item>
  28. </uni-forms>
  29. <view class="search-btn" @click="handleQuery">查询</view>
  30. <view class="reset-btn" @click="resetForm">重置</view>
  31. </view>
  32. <view class="basic-table">
  33. <!-- <view class="search-btn marginZero" @click="OpenAddDrawer">新增</view> -->
  34. <baseDateTable @DelCarData="DelCarData" @EditCarData="EditCarData" :headerFixed="true"
  35. :showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed=1 :contents="datalist" :headers="carheaders"
  36. @onPullup="pullup">
  37. </baseDateTable>
  38. </view>
  39. </view>
  40. <view v-else-if="isSelect===1">
  41. <view class="basic-zkset">
  42. <view class="setTitle">配置管理:</view>
  43. <view class="setCont">
  44. <uni-forms ref="formSet" :modelValue="queryParamsSet" class="formSet">
  45. <uni-forms-item label="充电机温度(°C):" label-width="116px" label-align="left">
  46. <uni-easyinput type="text" class="tempIpt" @blur="regTemp" :maxlength="3" placeholder="充电机温度" :clearable="false" v-model="queryParamsSet.temp" />
  47. <view class="search-temp" @click="resetTemp">恢复默认</view>
  48. </uni-forms-item>
  49. <uni-forms-item label="换电站连接方式:" label-width="128px" label-align="right">
  50. <uni-data-checkbox v-model="connWayArr" multiple :localdata="connWays" />
  51. </uni-forms-item>
  52. <uni-forms-item label="中转仓:" label-width="80px" label-align="right">
  53. <uni-data-checkbox v-model="queryParamsSet.transitWarehouse" :localdata="transitWarehouse" />
  54. </uni-forms-item>
  55. <uni-forms-item v-if="queryParamsSet.transitWarehouse==1">
  56. <uni-easyinput type="text" class="tempIpt" :clearable="false" :maxlength="2" v-model.trim="queryParamsSet.positionNumber" placeholder="中转仓仓位号" />
  57. </uni-forms-item>
  58. <view class="search-btn" @click="handleSave">保存</view>
  59. </uni-forms>
  60. </view>
  61. </view>
  62. <view class="basic-table">
  63. <view class="search-temp marginZero" @click="AddCangDrawer">新增仓位</view>
  64. <cangDateTable @DelCangData="DelCangData" @EditCangData="EditCangData" :isEdit="1" :headerFixed="true"
  65. :showLoadMore="showLoadMore" :loadMore="loadMore" :contents="dataCanglist" :headers="headers"
  66. @onPullup="pullCangup">
  67. </cangDateTable>
  68. </view>
  69. </view>
  70. <view v-else>
  71. <view class="basic-search">
  72. <uni-forms ref="form" :modelValue="batteryParams" class="searchForm">
  73. <uni-forms-item label="电池编号:" label-width="72px" label-align="right" name="sn">
  74. <uni-easyinput type="text" v-model="batteryParams.sn" placeholder="请输入电池编号" />
  75. </uni-forms-item>
  76. </uni-forms>
  77. <view class="search-btn" @click="handleBatteryQuery">查询</view>
  78. <view class="reset-btn" @click="resetBatteryForm">重置</view>
  79. </view>
  80. <view class="basic-table">
  81. <view class="search-temp marginZero" @click="AddBatteryDrawer">新增</view>
  82. <baseDateTable @DelBatteryData="DelBatteryData" @EditBatteryData="EditBatteryData" :isEdit="2" :headerFixed="true"
  83. :showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed=1 :contents="dataBatterylist" :headers="batteryheaders"
  84. @onPullup="pullBatteryup">
  85. </baseDateTable>
  86. </view>
  87. </view>
  88. <!--右侧抽屉 -->
  89. <uni-drawer ref="BasicDrawer" mode="right" :width="400" :mask-click="true">
  90. <scroll-view style="height: 100%;" scroll-y="true" v-if="isSelect===0">
  91. <PublicDrawer :flag="false" :title="dialogType=='new'?'新增车辆':'编辑车辆'" @closeDrawer="closeDrawer"
  92. @AddCarinfo="AddCarinfo" @EditCarInfo="EditCarInfo">
  93. <view class="drawer_main">
  94. <view>
  95. <BasicDrawer :basicFrom="basicFrom" :range="range"></BasicDrawer>
  96. </view>
  97. </view>
  98. </PublicDrawer>
  99. </scroll-view>
  100. <scroll-view style="height: 100%;" scroll-y="true" v-else-if="isSelect===1">
  101. <PublicDrawer :flag="false" :title="dialogCangType=='new'?'新增仓位':'编辑仓位'" @closeDrawer="closeDrawer"
  102. @AddCanginfo="AddCanginfo" @EditCangInfo="EditCangInfo">
  103. <view class="drawer_main">
  104. <view>
  105. <ChargeDrawer ref="addSetForm" @changeChargerId="changeChargerId" :setForm="setForm" :rangeCharge="rangeCharge" :rangePower="rangePower" :rules="rules"></ChargeDrawer>
  106. </view>
  107. </view>
  108. </PublicDrawer>
  109. </scroll-view>
  110. <scroll-view style="height: 100%;" scroll-y="true" v-else>
  111. <PublicDrawer :flag="false" :title="dialogBatteryType=='new'?'新增电池':'编辑电池'" @closeDrawer="closeDrawer"
  112. @AddBatteryinfo="AddBatteryinfo" @EditBatteryInfo="EditBatteryInfo">
  113. <view class="drawer_main">
  114. <view>
  115. <BatteryDrawer ref="addBatteryForm" :BatteryForm="BatteryForm" :rules="batteryRules"></BatteryDrawer>
  116. </view>
  117. </view>
  118. </PublicDrawer>
  119. </scroll-view>
  120. </uni-drawer>
  121. <!-- 右侧抽屉结束 -->
  122. <!-- 顶部公共提示信息 -->
  123. <uni-popup ref="Exchangepopup" type="message">
  124. <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
  125. </uni-popup>
  126. <!-- 顶部提示信息结束-->
  127. </view>
  128. </template>
  129. <script>
  130. import baseDateTable from './baseData-table/baseDateTable'
  131. import cangDateTable from './baseData-table/cangDateTable'
  132. import BasicDrawer from './BasicDrawer'
  133. import ChargeDrawer from './ChargeDrawer'
  134. import BatteryDrawer from './BatteryDrawer'
  135. export default {
  136. name: 'BasicData',
  137. components: {
  138. baseDateTable,
  139. cangDateTable,
  140. BasicDrawer,
  141. ChargeDrawer,
  142. BatteryDrawer
  143. },
  144. data() {
  145. return {
  146. popupMessage: '成功消息',
  147. popupType: 'success',
  148. formSelect: [{
  149. value: 0,
  150. text: "站控"
  151. },
  152. {
  153. value: 1,
  154. text: "云端"
  155. },
  156. ],
  157. //站控配置
  158. queryParamsSet:{
  159. temp:null,
  160. oneLink:0,//单连:0未启用,1启用
  161. fourLink:0,//四连:0未启用,1启用
  162. transitWarehouse:null,//中转仓:0无中转仓,1有固定中转仓
  163. positionNumber:null,//固定中转仓位号
  164. },
  165. connWayArr:[],
  166. basicFrom: {
  167. id: 0,
  168. CarDistance: null,
  169. CarPlate: undefined,
  170. CarVin: undefined,
  171. state: undefined,
  172. },
  173. //充电机仓位抽屉
  174. setForm:{
  175. chargerId:null,//仓位号
  176. chargerCode:null,//桩编号
  177. isSwap:null,//是否可以换电(0不支持 1支持)
  178. isCheck:null,//连接器类型(-1空架子 0单四连可切换 1单连 4四连)
  179. },
  180. //电池抽屉数据
  181. BatteryForm:{
  182. sn:null,//编号
  183. length:null,//长
  184. width:null,//宽
  185. height:null,//高
  186. weight:null,//重量
  187. },
  188. batteryRules:{
  189. sn:{
  190. rules:[
  191. {
  192. required: true,
  193. errorMessage: '请输入电池编号',
  194. },
  195. ]
  196. },
  197. length:{
  198. rules:[
  199. {
  200. required: true,
  201. errorMessage: '请输入长度',
  202. },
  203. {
  204. validateFunction:function(rule,value,data,callback){
  205. let reg=/^[1-9]\d*$/
  206. if (!reg.test(value)) {
  207. callback('请输入正整数')
  208. }
  209. return true
  210. },
  211. }
  212. ]
  213. },
  214. width:{
  215. rules:[
  216. {
  217. required: true,
  218. errorMessage: '请输入宽度',
  219. },
  220. {
  221. validateFunction:function(rule,value,data,callback){
  222. let reg=/^[1-9]\d*$/
  223. if (!reg.test(value)) {
  224. callback('请输入正整数')
  225. }
  226. return true
  227. },
  228. }
  229. ]
  230. },
  231. height:{
  232. rules:[
  233. {
  234. required: true,
  235. errorMessage: '请输入高度',
  236. },
  237. {
  238. validateFunction:function(rule,value,data,callback){
  239. let reg=/^[1-9]\d*$/
  240. if (!reg.test(value)) {
  241. callback('请输入正整数')
  242. }
  243. return true
  244. },
  245. }
  246. ]
  247. },
  248. weight:{
  249. rules:[
  250. {
  251. required: true,
  252. errorMessage: '请输入重量',
  253. },
  254. {
  255. validateFunction:function(rule,value,data,callback){
  256. let reg=/^[1-9]\d*$/
  257. if (!reg.test(value)) {
  258. callback('请输入正整数')
  259. }
  260. return true
  261. },
  262. }
  263. ]
  264. }
  265. },
  266. rules:{
  267. chargerId:{
  268. rules:[
  269. {
  270. required: true,
  271. errorMessage: '请输入仓位号',
  272. },
  273. {
  274. format: 'number',
  275. errorMessage: '请输入数字'
  276. },
  277. ]
  278. },
  279. chargerCode:{
  280. rules:[
  281. {
  282. required: true,
  283. errorMessage: '请输入桩编号',
  284. },
  285. {
  286. pattern:/^[A-Za-z0-9]+$/,
  287. errorMessage:'请输入正确的桩编号'
  288. }
  289. ]
  290. },
  291. isSwap:{
  292. rules:[
  293. {
  294. required: true,
  295. errorMessage: '请选择是否可换电',
  296. },
  297. ]
  298. },
  299. isCheck:{
  300. rules:[
  301. {
  302. required: true,
  303. errorMessage: '请选择充电连接控制方式',
  304. },
  305. ]
  306. }
  307. },
  308. range: [{
  309. value: 0,
  310. text: "停用"
  311. },
  312. {
  313. value: 1,
  314. text: "启用"
  315. },
  316. ],
  317. //中转仓
  318. transitWarehouse: [{
  319. text: '无中转仓',
  320. value: 0
  321. }, {
  322. text: '有中转仓',
  323. value: 1
  324. }],
  325. //连接方式
  326. connWays: [{
  327. text: '单连',
  328. value: 1
  329. }, {
  330. text: '四连',
  331. value: 4
  332. }],
  333. //是否可换电
  334. rangePower: [{
  335. value: 1,
  336. text: "是"
  337. },
  338. {
  339. value: 0,
  340. text: "否"
  341. },
  342. ],
  343. //是否切换充电
  344. rangeCharge: [{
  345. value: 1,
  346. text: "单连不可切换"
  347. },
  348. {
  349. value: 4,
  350. text: "四连不可切换"
  351. },
  352. {
  353. value: 0,
  354. text: "单四联切换"
  355. },
  356. {
  357. value: -1,
  358. text: "无"
  359. }
  360. ],
  361. datalist: [],//车辆列表
  362. dataCanglist: [],//仓位列表
  363. dataBatterylist: [],//电池列表
  364. queryParams: {
  365. page: 1, //当前页
  366. pageSize: 10, //每页条数
  367. source: undefined, //来源
  368. vehiclePlate: undefined, //车牌号
  369. vehicleVin: undefined, //VIN码
  370. orderByField: 'id', //排序字段
  371. orderByWays: 'desc' //排序方式
  372. },
  373. cangParams: {
  374. page: 1, //当前页
  375. pageSize: 10, //每页条数
  376. orderByField: 'id', //排序字段
  377. orderByWays: 'desc' //排序方式
  378. },
  379. batteryParams: {
  380. page: 1, //当前页
  381. pageSize: 10, //每页条数
  382. orderByField: 'id', //排序字段
  383. orderByWays: 'desc' ,//排序方式
  384. sn:null,//电池编号
  385. },
  386. total: 0, //总条数,
  387. cangTotal: 0, //仓位总条数,
  388. batteryTotal: 0, //电池总条数,
  389. loading: false,
  390. headers: [{
  391. label: '仓位号',
  392. key: 'chargerId',
  393. widtd: 98,
  394. }, {
  395. label: '桩编号',
  396. key: 'chargerCode',
  397. widtd: 315,
  398. }, {
  399. label: '是否可换电',
  400. key: 'isSwap',
  401. widtd: 200,
  402. }, {
  403. label: '充电连接控制方式',
  404. key: 'isCheck',
  405. widtd: 218,
  406. },
  407. {
  408. label: '操作',
  409. key: 'id',
  410. widtd: 118,
  411. },
  412. ],
  413. batteryheaders: [{
  414. label: '电池编号',
  415. key: 'sn',
  416. widtd: 278
  417. }, {
  418. label: '长(cm)',
  419. key: 'length',
  420. widtd: 148
  421. }, {
  422. label: '宽(cm)',
  423. key: 'width',
  424. widtd: 148
  425. },{
  426. label: '高(cm)',
  427. key: 'height',
  428. widtd: 148,
  429. },
  430. {
  431. label: '重量(kg)',
  432. key: 'weight',
  433. widtd: 148,
  434. },
  435. {
  436. label: '操作',
  437. key: 'id',
  438. widtd: 88,
  439. },
  440. ],
  441. //车辆列表
  442. carheaders: [{
  443. label: '车牌号',
  444. key: 'vehiclePlate',
  445. widtd: 210
  446. }, {
  447. label: '车辆识别码(VIN码)',
  448. key: 'vehicleVin',
  449. widtd: 315
  450. }, {
  451. label: '前端电池距离(mm)',
  452. key: 'modelDistance',
  453. widtd: 200
  454. },
  455. {
  456. label: '供电接口',
  457. key: 'link',
  458. widtd: 100,
  459. },
  460. // {
  461. // label: '来源',
  462. // key: 'source',
  463. // widtd: 100,
  464. // },
  465. {
  466. label: '操作',
  467. key: 'id',
  468. widtd: 108,
  469. },
  470. ],
  471. showLoadMore: false,
  472. loadMore: 'more',
  473. dialogType: 'new', // 按钮类型(new、edit)
  474. EditCarForm: {}, //编辑车辆表单数据接收
  475. synchronizationTime:'',//同步时间
  476. isSelect:0,
  477. dialogCangType:'new',
  478. dialogBatteryType:'new',
  479. }
  480. },
  481. mounted() {
  482. this.vehicleList();
  483. this.getsynchronization()
  484. },
  485. methods: {
  486. //充电机温度正则
  487. regTemp(e){
  488. const reg=/^\d*$/
  489. if(!reg.test(e.detail.value) || e.detail.value==0){
  490. console.log(121212)
  491. this.queryParamsSet.temp=90
  492. }
  493. },
  494. //温度恢复默认
  495. resetTemp(){
  496. this.$http.setTemp(90+'').then((res) => {
  497. if(res.code===0){
  498. this.queryParamsSet.temp=90
  499. this.ExchangeMessage('success','恢复成功!')
  500. }
  501. })
  502. },
  503. //设置温度
  504. handleSettemp(){
  505. this.$http.setTemp(this.queryParamsSet.temp).then((res) => {
  506. if(res.code!==0){
  507. this.ExchangeMessage('error',res.msg)
  508. }else{
  509. this.getCurrentTemp()
  510. }
  511. })
  512. },
  513. //获取站控配置
  514. getStationConfig(){
  515. this.$http.getOtherStation(4+'').then((res) => {
  516. if(res.data.content==1){
  517. this.connWayArr.push(1)
  518. }
  519. });
  520. this.$http.getOtherStation(5+'').then((res) => {
  521. if(res.data.content==1){
  522. this.connWayArr.push(4)
  523. }
  524. });
  525. this.$http.getOtherStation(6+'').then((res) => {
  526. if(res.data.content==1){
  527. this.queryParamsSet.transitWarehouse=1
  528. this.$http.getOtherStation(7+'').then((res) => {
  529. this.queryParamsSet.positionNumber=res.data.content*1
  530. });
  531. }else{
  532. this.queryParamsSet.transitWarehouse=0
  533. }
  534. });
  535. this.getCurrentTemp()
  536. },
  537. //获取温度
  538. getCurrentTemp(){
  539. //获取温度
  540. this.$http.serchTemp().then((res) => {
  541. if(res.code===0){
  542. this.queryParamsSet.temp=res.data*1
  543. }
  544. });
  545. },
  546. //保存站控配置
  547. handleSave(){
  548. const reg=/^\d*$/
  549. if(!this.queryParamsSet.temp){
  550. this.ExchangeMessage('warn', '请输入充电机温度!')
  551. return
  552. }
  553. if(this.connWayArr.length===0){
  554. this.ExchangeMessage('warn', '请选择换电站连接方式!')
  555. return
  556. }
  557. if(this.queryParamsSet.transitWarehouse==null){
  558. this.ExchangeMessage('warn', '请选择中转仓!')
  559. return
  560. }
  561. if(this.queryParamsSet.transitWarehouse==1){
  562. if(!this.queryParamsSet.positionNumber){
  563. this.ExchangeMessage('warn', '请输入中转仓仓位号!')
  564. return
  565. }else{
  566. if(!reg.test(this.queryParamsSet.positionNumber) || this.queryParamsSet.positionNumber<=0){
  567. this.ExchangeMessage('warn', '请输入正整数!')
  568. return
  569. }
  570. }
  571. this.queryParamsSet.positionNumber=this.queryParamsSet.positionNumber*1
  572. }else{
  573. this.queryParamsSet.positionNumber=undefined
  574. }
  575. if(this.connWayArr.length===2){
  576. this.queryParamsSet.oneLink=1
  577. this.queryParamsSet.fourLink=1
  578. }else{
  579. if(this.connWayArr[0]===1){
  580. this.queryParamsSet.oneLink=1
  581. this.queryParamsSet.fourLink=0
  582. }else{
  583. this.queryParamsSet.oneLink=0
  584. this.queryParamsSet.fourLink=1
  585. }
  586. }
  587. this.$http.setStation(this.queryParamsSet).then((res) => {
  588. if(res.code === 0){
  589. this.getStationConfig()
  590. this.handleSettemp()
  591. }
  592. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '设置成功' : res.msg)
  593. });
  594. },
  595. //切换数据按钮
  596. handleData(num){
  597. this.showLoadMore=false
  598. this.isSelect=num
  599. if(num===0){
  600. this.vehicleList()
  601. }else if(num===1){
  602. this.getStationConfig()
  603. this.encodeList()
  604. }else{
  605. this.batteryList()
  606. }
  607. },
  608. //顶部公共消息提示
  609. ExchangeMessage(type, message) {
  610. this.popupType = type
  611. this.popupMessage = message ? message : '后端接口404错误!'
  612. this.$refs.Exchangepopup.open()
  613. },
  614. //获取最近同步时间
  615. getsynchronization(){
  616. this.$http.getSyncTime().then(res=>{
  617. if(res.code == 0){
  618. this.synchronizationTime = res.data
  619. }
  620. })
  621. },
  622. //删除车辆
  623. DelCarData(id) {
  624. let that = this
  625. uni.showModal({
  626. title: `确认删除车辆信息吗?`,
  627. content: '',
  628. success: function(res) {
  629. if (res.confirm) {
  630. that.$http.delvehicle(id + '')
  631. .then(res => {
  632. if (res.code === 0) {
  633. that.vehicleList()
  634. }
  635. that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除车辆成功' : '删除车辆失败')
  636. }).catch(err => {
  637. console.error(err)
  638. })
  639. } else if (res.cancel) {
  640. return false
  641. //用户点击取消按钮触发
  642. }
  643. }
  644. })
  645. },
  646. //删除充电机仓位
  647. DelCangData(id) {
  648. let that = this
  649. uni.showModal({
  650. title: `确认删除仓位吗?`,
  651. content: '',
  652. success: function(res) {
  653. if (res.confirm) {
  654. that.$http.delEncode(id+'')
  655. .then(res => {
  656. if (res.code === 0) {
  657. that.encodeList()
  658. }
  659. that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除成功' : res.msg)
  660. }).catch(err => {
  661. console.error(err)
  662. })
  663. } else if (res.cancel) {
  664. return false
  665. //用户点击取消按钮触发
  666. }
  667. }
  668. })
  669. },
  670. //删除电池
  671. DelBatteryData(id) {
  672. let that = this
  673. uni.showModal({
  674. title: `确认删除电池信息吗?`,
  675. content: '',
  676. success: function(res) {
  677. if (res.confirm) {
  678. that.$http.delBattery(id+'')
  679. .then(res => {
  680. if (res.code === 0) {
  681. that.batteryList()
  682. }
  683. that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除成功' : res.msg)
  684. }).catch(err => {
  685. console.error(err)
  686. })
  687. } else if (res.cancel) {
  688. return false
  689. //用户点击取消按钮触发
  690. }
  691. }
  692. })
  693. },
  694. // 打开添加车辆抽屉
  695. OpenAddDrawer() {
  696. this.dialogType = 'new'
  697. this.basicFrom = {
  698. id: 0,
  699. CarDistance: null,
  700. CarPlate: undefined,
  701. CarVin: undefined,
  702. state: undefined,
  703. }
  704. this.$refs.BasicDrawer.open();
  705. },
  706. //新增仓位抽屉
  707. AddCangDrawer(){
  708. this.dialogCangType='new'
  709. this.setForm={
  710. cangNum:null,//桩编号
  711. isPower:null,//是否可换电
  712. isCharger:null,//是否切换充电连接
  713. },
  714. this.$refs.BasicDrawer.open()
  715. },
  716. //新增电池抽屉
  717. AddBatteryDrawer(){
  718. this.dialogBatteryType='new'
  719. this.BatteryForm={
  720. sn:null,//编号
  721. length:null,//长
  722. width:null,//宽
  723. height:null,//高
  724. weight:null,//重量
  725. },
  726. this.$refs.BasicDrawer.open()
  727. },
  728. //编辑充电仓位抽屉
  729. EditCangData(row){
  730. this.dialogCangType='edit'
  731. this.$refs.BasicDrawer.open()
  732. this.setForm={...row}
  733. },
  734. //编辑电池抽屉
  735. EditBatteryData(row){
  736. this.dialogBatteryType='edit'
  737. this.$refs.BasicDrawer.open()
  738. this.BatteryForm={...row}
  739. },
  740. //编辑充电仓位请求接口
  741. EditCangInfo() {
  742. this.$refs.addSetForm.$refs.setvalueForm.validate().then(res=>{
  743. const params = {
  744. id: this.setForm.id,
  745. chargerId: this.setForm.chargerId*1,
  746. chargerCode: this.setForm.chargerCode,
  747. isSwap: this.setForm.isSwap,
  748. isCheck: this.setForm.isCheck,
  749. }
  750. this.$http.editEncode(params)
  751. .then(res => {
  752. this.closeDrawer()
  753. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '修改成功!' : res.msg)
  754. if (res.code === 0) {
  755. this.encodeList()
  756. }
  757. }).catch(err => {
  758. console.error(err)
  759. })
  760. })
  761. // if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
  762. // this.ExchangeMessage('warn', '请填写完整!')
  763. // } else {
  764. // const params = {
  765. // modelDistance: this.basicFrom.CarDistance,
  766. // vehiclePlate: this.basicFrom.CarPlate,
  767. // vehicleVin: this.basicFrom.CarVin,
  768. // state: this.basicFrom.state * 1,
  769. // id: this.basicFrom.id
  770. // }
  771. // this.$http.Editvehicle(params)
  772. // .then(res => {
  773. // this.closeDrawer()
  774. // this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
  775. // if (res.code === 0) {
  776. // this.vehicleList()
  777. // }
  778. // }).catch(err => {
  779. // console.error(err)
  780. // })
  781. // }
  782. },
  783. //编辑电池
  784. EditBatteryInfo() {
  785. this.$refs.addBatteryForm.$refs.valueForm.validate().then(res=>{
  786. const params = {
  787. id: this.BatteryForm.id,
  788. sn: this.BatteryForm.sn,
  789. length: this.BatteryForm.length*1,
  790. width: this.BatteryForm.width*1,
  791. height: this.BatteryForm.height*1,
  792. weight: this.BatteryForm.weight*1,
  793. }
  794. this.$http.editBattery(params)
  795. .then(res => {
  796. this.closeDrawer()
  797. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '修改成功!' : res.msg)
  798. if (res.code === 0) {
  799. this.batteryList()
  800. }
  801. }).catch(err => {
  802. console.error(err)
  803. })
  804. })
  805. },
  806. //添加充电仓位请求接口
  807. AddCanginfo() {
  808. this.$refs.addSetForm.$refs.setvalueForm.validate().then(res=>{
  809. const params = {
  810. chargerId: this.setForm.chargerId*1,
  811. chargerCode: this.setForm.chargerCode,
  812. isSwap: this.setForm.isSwap,
  813. isCheck: this.setForm.isCheck,
  814. }
  815. this.$http.addEncode(params)
  816. .then(res => {
  817. this.closeDrawer()
  818. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增仓位成功' : res.msg)
  819. if (res.code === 0) {
  820. this.encodeList()
  821. }
  822. }).catch(err => {
  823. console.error(err)
  824. })
  825. })
  826. },
  827. //添加电池请求接口
  828. AddBatteryinfo() {
  829. this.$refs.addBatteryForm.$refs.valueForm.validate().then(res=>{
  830. const params = {
  831. sn: this.BatteryForm.sn,
  832. length: this.BatteryForm.length*1,
  833. width: this.BatteryForm.width*1,
  834. height: this.BatteryForm.height*1,
  835. weight: this.BatteryForm.weight*1,
  836. }
  837. this.$http.addBattery(params)
  838. .then(res => {
  839. this.closeDrawer()
  840. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增电池成功' : res.msg)
  841. if (res.code === 0) {
  842. this.batteryList()
  843. }
  844. }).catch(err => {
  845. console.error(err)
  846. })
  847. })
  848. },
  849. //打开编辑车辆抽屉
  850. EditCarData(row) {
  851. console.log(row)
  852. this.dialogType = 'edit'
  853. this.$refs.BasicDrawer.open();
  854. this.basicFrom.CarDistance = row.modelDistance
  855. this.basicFrom.CarPlate = row.vehiclePlate
  856. this.basicFrom.CarVin = row.vehicleVin
  857. this.basicFrom.state = row.state
  858. this.basicFrom.id = row.id
  859. },
  860. //编辑车辆请求接口
  861. EditCarInfo() {
  862. if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
  863. this.ExchangeMessage('warn', '请填写完整!')
  864. } else {
  865. const params = {
  866. modelDistance: this.basicFrom.CarDistance,
  867. vehiclePlate: this.basicFrom.CarPlate,
  868. vehicleVin: this.basicFrom.CarVin,
  869. state: this.basicFrom.state * 1,
  870. id: this.basicFrom.id
  871. }
  872. this.$http.Editvehicle(params)
  873. .then(res => {
  874. this.closeDrawer()
  875. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
  876. if (res.code === 0) {
  877. this.vehicleList()
  878. }
  879. }).catch(err => {
  880. console.error(err)
  881. })
  882. }
  883. },
  884. // 添加车辆请求接口
  885. AddCarinfo() {
  886. if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
  887. this.ExchangeMessage('warn', '请填写完整!')
  888. } else {
  889. const params = {
  890. modelDistance: this.basicFrom.CarDistance,
  891. vehiclePlate: this.basicFrom.CarPlate,
  892. vehicleVin: this.basicFrom.CarVin,
  893. source: 0,
  894. }
  895. this.$http.addvehicle(params)
  896. .then(res => {
  897. this.closeDrawer()
  898. this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增车辆成功' : '新增车辆失败')
  899. if (res.code === 0) {
  900. this.vehicleList()
  901. }
  902. }).catch(err => {
  903. console.error(err)
  904. })
  905. }
  906. },
  907. //查询
  908. handleQuery() {
  909. this.queryParams.page = 1
  910. this.datalist = []
  911. this.showLoadMore = false
  912. this.vehicleList()
  913. },
  914. //查询电池
  915. handleBatteryQuery () {
  916. this.batteryParams.page = 1
  917. this.dataBatterylist = []
  918. this.showLoadMore = false
  919. this.batteryList()
  920. },
  921. //重置
  922. resetForm() {
  923. this.queryParams = {
  924. page: 1,
  925. pageSize: 10,
  926. source: undefined, //来源
  927. vehiclePlate: undefined, //车牌号
  928. vehicleVin: undefined, //VIN码
  929. }
  930. this.vehicleList()
  931. },
  932. //重置电池
  933. resetBatteryForm() {
  934. this.batteryParams = {
  935. page: 1,
  936. pageSize: 10,
  937. orderByField: 'id', //排序字段
  938. orderByWays: 'desc' ,//排序方式
  939. sn: null, //来源
  940. }
  941. this.batteryList()
  942. },
  943. //车辆列表,
  944. vehicleList() {
  945. uni.showLoading({
  946. title:'数据加载中...'
  947. })
  948. this.$http.vehicleList(this.queryParams).then((res) => {
  949. this.datalist = res.data.records;
  950. this.total = res.data.total;
  951. uni.hideLoading()
  952. }).catch(err => {uni.hideLoading()});
  953. },
  954. //仓位列表
  955. encodeList() {
  956. uni.showLoading({
  957. title:'数据加载中...'
  958. })
  959. this.$http.encodeList(this.cangParams).then((res) => {
  960. this.dataCanglist = res.data;
  961. uni.hideLoading()
  962. }).catch(err => {uni.hideLoading()});
  963. },
  964. //电池列表
  965. batteryList() {
  966. uni.showLoading({
  967. title:'数据加载中...'
  968. })
  969. this.$http.batteryList(this.batteryParams).then((res) => {
  970. this.dataBatterylist = res.data.records;
  971. this.batteryTotal=res.data.total
  972. uni.hideLoading()
  973. }).catch(err => {uni.hideLoading()});
  974. },
  975. //关闭抽屉
  976. closeDrawer() {
  977. this.$refs.BasicDrawer.close();
  978. },
  979. //车辆触底加载数据
  980. pullup() {
  981. this.showLoadMore = true
  982. if(this.isSelect!==0){
  983. this.loadMore = 'no-more'
  984. }else{
  985. if (this.total == this.datalist.length) {
  986. this.loadMore = 'no-more'
  987. return
  988. } else {
  989. this.queryParams.page++
  990. this.vehicleList()
  991. this.loadMore = 'loading'
  992. }
  993. }
  994. },
  995. //仓位触底加载数据
  996. pullCangup() {
  997. this.showLoadMore = true
  998. if(this.isSelect!==1){
  999. this.loadMore = 'no-more'
  1000. }else{
  1001. if (this.cangTotal == this.dataCanglist.length) {
  1002. this.loadMore = 'no-more'
  1003. return
  1004. } else {
  1005. this.cangParams.page++
  1006. this.encodeList()
  1007. this.loadMore = 'loading'
  1008. }
  1009. }
  1010. },
  1011. //仓位触底加载数据
  1012. pullBatteryup() {
  1013. this.showLoadMore = true
  1014. if(this.isSelect!==2){
  1015. this.loadMore = 'no-more'
  1016. }else{
  1017. if (this.batteryTotal == this.dataBatterylist.length) {
  1018. this.loadMore = 'no-more'
  1019. return
  1020. } else {
  1021. this.batteryParams.page++
  1022. this.batteryList()
  1023. this.loadMore = 'loading'
  1024. }
  1025. }
  1026. },
  1027. //同步云端
  1028. syncCloud() {
  1029. let that = this
  1030. uni.showModal({
  1031. title: "是否同步云端",
  1032. content: "",
  1033. success: function(res) {
  1034. if (res.confirm) {
  1035. that.$http.getSync().then(res=>{
  1036. that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '同步成功':'同步失败')
  1037. })
  1038. //用户点击确认按钮触发
  1039. } else if (res.cancel) {
  1040. return
  1041. //用户点击取消按钮触发
  1042. }
  1043. }
  1044. })
  1045. },
  1046. //chargerId等于0时更改为1
  1047. changeChargerId(){
  1048. this.setForm.chargerId=1
  1049. }
  1050. }
  1051. }
  1052. </script>
  1053. <style lang="scss" scoped>
  1054. ::v-deep .uni-forms-item__content {
  1055. .is-input-error-border .uni-easyinput__placeholder-class{
  1056. color: #999;
  1057. }
  1058. .uni-easyinput,.uni-select{
  1059. background: rgba(255, 255, 255, 0);
  1060. border-radius: 2px;
  1061. border: 1px solid #263042;
  1062. }
  1063. .uni-select__selector {
  1064. background: none;
  1065. border: 1px solid #263042;
  1066. }
  1067. .uni-select__selector-item {
  1068. font-size: 14px;
  1069. font-weight: 400;
  1070. color: #A8ADC8;
  1071. }
  1072. .uni-popper__arrow {
  1073. display: none;
  1074. }
  1075. .uni-select__input-text {
  1076. color: white;
  1077. }
  1078. .uni-easyinput__content {
  1079. background: none !important;
  1080. border: none !important;
  1081. color: #fff;
  1082. width: 188px;
  1083. }
  1084. .tempIpt{
  1085. .uni-easyinput__content{
  1086. width: 92px !important;
  1087. }
  1088. }
  1089. }
  1090. ::v-deep .uni-forms-item__label {
  1091. font-size: 14px;
  1092. font-weight: 400;
  1093. color: #FFFFFF;
  1094. }
  1095. ::v-deep .uni-select__selector {
  1096. background: #111827 !important;
  1097. border: 1px solid #263042;
  1098. color: #606266;
  1099. z-index: 9999999;
  1100. }
  1101. .basic-data {
  1102. width: 100%;
  1103. height: 100%;
  1104. color: white;
  1105. font-size: 24px;
  1106. overflow: hidden;
  1107. .basic-top {
  1108. display: flex;
  1109. justify-content: space-between;
  1110. .service_header_left {
  1111. display: flex;
  1112. .btn {
  1113. width: 100px;
  1114. height: 48px;
  1115. background: #263042;
  1116. border-radius: 0px 2px 2px 0px;
  1117. font-size: 16px;
  1118. text-align: center;
  1119. line-height: 48px;
  1120. }
  1121. .active {
  1122. background: #91FDB9;
  1123. border-radius: 2px 0px 0px 2px;
  1124. color: black;
  1125. }
  1126. }
  1127. .basci-header-right{
  1128. display:flex;
  1129. align-items: center;
  1130. }
  1131. .times {
  1132. font-size: 14px;
  1133. font-weight: 400;
  1134. color: #A8ADC8;
  1135. line-height: 32px;
  1136. }
  1137. .sync-btn {
  1138. width: 88px;
  1139. height: 32px;
  1140. border-radius: 2px;
  1141. line-height: 32px;
  1142. text-align: center;
  1143. border: 1px solid #91FDB9;
  1144. font-size: 14px;
  1145. font-weight: 400;
  1146. color: #91FDB9;
  1147. margin-left: 20px;
  1148. }
  1149. .title {
  1150. margin-left: auto;
  1151. line-height: 32px;
  1152. font-size: 16px;
  1153. font-weight: 600;
  1154. color: rgba(255, 255, 255, 0.85);
  1155. line-height: 19px;
  1156. text-shadow: 0px 0px 4px #0027D8
  1157. }
  1158. }
  1159. .basic-search {
  1160. display: flex;
  1161. padding: 16px 20px;
  1162. width: 100%;
  1163. height: 66px;
  1164. box-sizing: border-box;
  1165. background: #111827;
  1166. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  1167. border-radius: 2px;
  1168. border: 1px solid #192337;
  1169. // margin-top: 20px;
  1170. ::v-deep .searchForm {
  1171. span {
  1172. display: flex;
  1173. }
  1174. }
  1175. }
  1176. .basic-zkset{
  1177. display: flex;
  1178. padding: 16px 20px;
  1179. width: 100%;
  1180. min-height: 66px;
  1181. box-sizing: border-box;
  1182. background: #111827;
  1183. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  1184. border-radius: 2px;
  1185. border: 1px solid #192337;
  1186. flex-direction: column;
  1187. .setTitle{
  1188. font-size: 15px;
  1189. font-weight: bold;
  1190. }
  1191. .setCont{
  1192. .tempIpt{
  1193. width: 88px;
  1194. }
  1195. ::v-deep .uni-data-checklist{
  1196. margin-top: 5px !important;
  1197. .checklist-box{
  1198. margin-right: 12px;
  1199. }
  1200. .checklist-text{
  1201. color: white
  1202. }
  1203. .checklist-group .checklist-box.is--default.is-checked .checklist-text{
  1204. color: #91FDB9;
  1205. }
  1206. .checklist-group .checklist-box.is--default.is-checked .radio__inner{
  1207. border-color:#91FDB9;
  1208. }
  1209. .checklist-group .checklist-box.is--default.is-checked .radio__inner .radio__inner-icon{
  1210. background-color:#91FDB9;
  1211. }
  1212. .checklist-group .checklist-box.is--default.is-checked .checkbox__inner{
  1213. border-color:#91FDB9;
  1214. background-color:#91FDB9;
  1215. }
  1216. }
  1217. ::v-deep .formSet {
  1218. span {
  1219. display: flex;
  1220. align-items: center;
  1221. }
  1222. .uni-forms-item__content{
  1223. display: flex;
  1224. }
  1225. .uni-forms-item{
  1226. margin-bottom: 0;
  1227. }
  1228. }
  1229. }
  1230. }
  1231. .search-btn {
  1232. width: 60px;
  1233. height: 34px;
  1234. background: #91FDB9;
  1235. border-radius: 2px;
  1236. font-size: 14px;
  1237. font-weight: 400;
  1238. color: #000000;
  1239. text-align: center;
  1240. line-height: 34px;
  1241. margin-left: 20px;
  1242. margin-top: 1px;
  1243. }
  1244. .search-temp {
  1245. width: 68px;
  1246. height: 34px;
  1247. background: #91FDB9;
  1248. border-radius: 2px;
  1249. font-size: 14px;
  1250. font-weight: 400;
  1251. color: #000000;
  1252. text-align: center;
  1253. line-height: 34px;
  1254. margin-left: 20px;
  1255. margin-top: 1px;
  1256. margin-right: 15px;
  1257. }
  1258. .reset-btn {
  1259. width: 60px;
  1260. height: 32px;
  1261. border-radius: 2px;
  1262. font-size: 14px;
  1263. font-weight: 400;
  1264. color: #FFFFFF;
  1265. text-align: center;
  1266. line-height: 32px;
  1267. margin-left: 20px;
  1268. margin-top: 1px;
  1269. border: 1px solid #263042;
  1270. }
  1271. .basic-table {
  1272. width: 100%;
  1273. height: 576px;
  1274. background: #111827;
  1275. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  1276. border-radius: 2px;
  1277. border: 1px solid #192337;
  1278. margin-top: 16px;
  1279. box-sizing: border-box;
  1280. padding: 16px 20px;
  1281. display: flex;
  1282. flex-direction: column;
  1283. .marginZero {
  1284. margin-left: 0px;
  1285. margin-bottom: 15px;
  1286. }
  1287. }
  1288. }
  1289. </style>