12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427 |
- <template>
- <view class="basic-data">
- <view class="basic-top">
- <view class="service_header_left">
- <view class="btn" :class="isSelect===0?'active':''" @click="handleData(0)">车辆管理</view>
- <view class="btn" :class="isSelect===2?'active':''" @click="handleData(2)">电池管理</view>
- <view class="btn" :class="isSelect===1?'active':''" @click="handleData(1)" v-if="$storage.getJson('userId')==1">站控配置</view>
- </view>
- <view class="basci-header-right" v-if="isSelect===0">
- <view class="times">最近同步时间:{{synchronizationTime || '-'}}</view>
- <view class="sync-btn" @click="syncCloud">云端同步</view>
- <!-- <view class="title">车辆管理</view> -->
- </view>
-
- </view>
- <view v-if="isSelect===0">
- <view class="basic-search">
- <uni-forms ref="form" :modelValue="queryParams" class="searchForm">
- <uni-forms-item label="车牌号码:" label-width="72px" label-align="right" name="vehiclePlate">
- <uni-easyinput type="text" v-model="queryParams.vehiclePlate" placeholder="请输入车牌号码" />
- </uni-forms-item>
- <uni-forms-item label="车辆识别码:" label-width="128px" label-align="right" name="vehicleVin">
- <uni-easyinput type="text" v-model="queryParams.vehicleVin" placeholder="请输入车辆识别码" />
- </uni-forms-item>
- <uni-forms-item label="来源:" label-width="80px" label-align="right">
- <uni-data-select v-model="queryParams.source" :localdata="formSelect" style="width: 100px;"
- @change="change"></uni-data-select>
- </uni-forms-item>
- </uni-forms>
- <view class="search-btn" @click="handleQuery">查询</view>
- <view class="reset-btn" @click="resetForm">重置</view>
- </view>
- <view class="basic-table">
- <!-- <view class="search-btn marginZero" @click="OpenAddDrawer">新增</view> -->
- <baseDateTable @DelCarData="DelCarData" @EditCarData="EditCarData" @bindHandle="bindHandle" :isBind="true" :headerFixed="true"
- :showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed=1 :contents="datalist" :headers="carheaders"
- @onPullup="pullup">
- </baseDateTable>
- </view>
- </view>
- <view v-else-if="isSelect===1">
- <view class="basic-zkset">
- <view class="setTitle">配置管理:</view>
- <view class="setCont">
- <uni-forms ref="formSet" :modelValue="queryParamsSet" class="formSet">
- <uni-forms-item label="充电机温度(°C):" label-width="116px" label-align="left">
- <uni-easyinput type="text" class="tempIpt" @blur="regTemp" :maxlength="3" placeholder="充电机温度" :clearable="false" v-model="queryParamsSet.temp" />
- <view class="search-temp" @click="resetTemp">恢复默认</view>
- </uni-forms-item>
- <uni-forms-item label="换电站连接方式:" label-width="128px" label-align="right">
- <uni-data-checkbox v-model="connWayArr" multiple :localdata="connWays" />
- </uni-forms-item>
- <uni-forms-item label="中转仓:" label-width="116px" label-align="right">
- <uni-data-checkbox v-model="queryParamsSet.transitWarehouse" :localdata="transitWarehouse" />
- </uni-forms-item>
- <uni-forms-item v-if="queryParamsSet.transitWarehouse==1">
- <uni-easyinput type="text" class="tempIpt" :clearable="false" :maxlength="2" v-model.trim="queryParamsSet.positionNumber" placeholder="中转仓仓位号" />
- </uni-forms-item>
- <uni-forms-item label="雷达:" label-width="116px" qlabel-align="right">
- <uni-data-checkbox v-model="queryParamsSet.radar" :localdata="radarList" />
- </uni-forms-item>
- <view class="search-btn" @click="handleSave">保存</view>
- </uni-forms>
- </view>
- </view>
- <view class="basic-table">
- <view class="search-temp marginZero" @click="AddCangDrawer">新增仓位</view>
- <cangDateTable @DelCangData="DelCangData" @EditCangData="EditCangData" :isEdit="1" :headerFixed="true"
- :showLoadMore="showLoadMore" :loadMore="loadMore" :contents="dataCanglist" :headers="headers"
- @onPullup="pullCangup">
- </cangDateTable>
- </view>
- </view>
- <view v-else>
- <view class="basic-search">
- <uni-forms ref="form" :modelValue="batteryParams" class="searchForm">
- <uni-forms-item label="电池编号:" label-width="72px" label-align="right" name="sn">
- <uni-easyinput type="text" v-model="batteryParams.sn" placeholder="请输入电池编号" />
- </uni-forms-item>
- </uni-forms>
- <view class="search-btn" @click="handleBatteryQuery">查询</view>
- <view class="reset-btn" @click="resetBatteryForm">重置</view>
- </view>
- <view class="basic-table">
- <view class="search-temp marginZero" @click="AddBatteryDrawer">新增</view>
- <baseDateTable @DelBatteryData="DelBatteryData" @EditBatteryData="EditBatteryData" :isEdit="2" :headerFixed="true"
- :showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed=1 :contents="dataBatterylist" :headers="batteryheaders"
- @onPullup="pullBatteryup">
- </baseDateTable>
- </view>
- </view>
- <!--右侧抽屉 -->
- <uni-drawer ref="BasicDrawer" mode="right" :width="400" :mask-click="true">
- <scroll-view style="height: 100%;" scroll-y="true" v-if="isSelect===0">
- <PublicDrawer :flag="false" :title="dialogType=='new'?'新增车辆':'编辑车辆'" @closeDrawer="closeDrawer"
- @AddCarinfo="AddCarinfo" @EditCarInfo="EditCarInfo">
- <view class="drawer_main">
- <view>
- <BasicDrawer :basicFrom="basicFrom" :range="range" @redHandle="redHandle"></BasicDrawer>
- </view>
- </view>
- </PublicDrawer>
- </scroll-view>
- <scroll-view style="height: 100%;" scroll-y="true" v-else-if="isSelect===1">
- <PublicDrawer :flag="false" :title="dialogCangType=='new'?'新增仓位':'编辑仓位'" @closeDrawer="closeDrawer"
- @AddCanginfo="AddCanginfo" @EditCangInfo="EditCangInfo">
- <view class="drawer_main">
- <view>
- <ChargeDrawer ref="addSetForm" @changeChargerId="changeChargerId" :setForm="setForm" :rangeCharge="rangeCharge" :rangePower="rangePower" :rules="rules"></ChargeDrawer>
- </view>
- </view>
- </PublicDrawer>
- </scroll-view>
- <scroll-view style="height: 100%;" scroll-y="true" v-else>
- <PublicDrawer :flag="false" :title="dialogBatteryType=='new'?'新增电池':'编辑电池'" @closeDrawer="closeDrawer"
- @AddBatteryinfo="AddBatteryinfo" @EditBatteryInfo="EditBatteryInfo">
- <view class="drawer_main">
- <view>
- <BatteryDrawer ref="addBatteryForm" :BatteryForm="BatteryForm" :rules="batteryRules"></BatteryDrawer>
- </view>
- </view>
- </PublicDrawer>
- </scroll-view>
- </uni-drawer>
- <uni-drawer ref="BindDrawer" mode="right" :width="400" :mask-click="true">
- <scroll-view style="height: 100%;" scroll-y="true" v-if="isSelect===0">
- <PublicDrawer :flag="false" :title="'绑定RFID'" @closeDrawer="closeDrawer" @BindFRIDHandle="BindFRIDHandle">
- <view class="drawer_main">
- <view>
- <BindDrawer :basicFrom="basicFrom" :range="range" @redHandle="redHandle" @inputHandle="inputHandle"></BindDrawer>
- </view>
- </view>
- </PublicDrawer>
- </scroll-view>
- </uni-drawer>
- <!-- 右侧抽屉结束 -->
- <!-- 顶部公共提示信息 -->
- <uni-popup ref="Exchangepopup" type="message">
- <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
- </uni-popup>
- <!-- 顶部提示信息结束-->
- </view>
- </template>
- <script>
- import baseDateTable from './baseData-table/baseDateTable'
- import cangDateTable from './baseData-table/cangDateTable'
- import BasicDrawer from './BasicDrawer'
- import BindDrawer from './BindDrawer'
- import ChargeDrawer from './ChargeDrawer'
- import BatteryDrawer from './BatteryDrawer'
- export default {
- name: 'BasicData',
- components: {
- baseDateTable,
- cangDateTable,
- BasicDrawer,
- ChargeDrawer,
- BatteryDrawer,
- BindDrawer
- },
- data() {
- return {
- popupMessage: '成功消息',
- popupType: 'success',
- formSelect: [{
- value: 0,
- text: "站控"
- },
- {
- value: 1,
- text: "云端"
- },
- ],
- //站控配置
- queryParamsSet:{
- temp:null,
- oneLink:0,//单连:0未启用,1启用
- fourLink:0,//四连:0未启用,1启用
- transitWarehouse:null,//中转仓:0无中转仓,1有固定中转仓
- positionNumber:null,//固定中转仓位号
- radar: null,//雷达 0-无, 1-有
- },
- connWayArr:[],
- basicFrom: {
- id: 0,
- CarDistance: null,
- CarPlate: undefined,
- CarVin: undefined,
- state: undefined,
- rfidEpc: undefined,
- epcFour: undefined,
- frid: undefined,
- },
- //充电机仓位抽屉
- setForm:{
- chargerId:null,//仓位号
- chargerCode:null,//桩编号
- isSwap:null,//是否可以换电(0不支持 1支持)
- isCheck:null,//连接器类型(-1空架子 0单四连可切换 1单连 4四连)
- },
- //电池抽屉数据
- BatteryForm:{
- sn:null,//编号
- length:null,//长
- width:null,//宽
- height:null,//高
- weight:null,//重量
- },
- batteryRules:{
- sn:{
- rules:[
- {
- required: true,
- errorMessage: '请输入电池编号',
- },
- ]
- },
- length:{
- rules:[
- {
- required: true,
- errorMessage: '请输入长度',
- },
- {
- validateFunction:function(rule,value,data,callback){
- let reg=/^[1-9]\d*$/
- if (!reg.test(value)) {
- callback('请输入正整数')
- }
- return true
- },
- }
- ]
- },
- width:{
- rules:[
- {
- required: true,
- errorMessage: '请输入宽度',
- },
- {
- validateFunction:function(rule,value,data,callback){
- let reg=/^[1-9]\d*$/
- if (!reg.test(value)) {
- callback('请输入正整数')
- }
- return true
- },
- }
- ]
- },
- height:{
- rules:[
- {
- required: true,
- errorMessage: '请输入高度',
- },
- {
- validateFunction:function(rule,value,data,callback){
- let reg=/^[1-9]\d*$/
- if (!reg.test(value)) {
- callback('请输入正整数')
- }
- return true
- },
- }
- ]
- },
- weight:{
- rules:[
- {
- required: true,
- errorMessage: '请输入重量',
- },
- {
- validateFunction:function(rule,value,data,callback){
- let reg=/^[1-9]\d*$/
- if (!reg.test(value)) {
- callback('请输入正整数')
- }
- return true
- },
- }
- ]
- }
- },
- rules:{
- chargerId:{
- rules:[
- {
- required: true,
- errorMessage: '请输入仓位号',
- },
- {
- format: 'number',
- errorMessage: '请输入数字'
- },
- ]
- },
- chargerCode:{
- rules:[
- {
- required: true,
- errorMessage: '请输入桩编号',
- },
- {
- pattern:/^[A-Za-z0-9]+$/,
- errorMessage:'请输入正确的桩编号'
- }
- ]
- },
- isSwap:{
- rules:[
- {
- required: true,
- errorMessage: '请选择是否可换电',
- },
- ]
- },
- isCheck:{
- rules:[
- {
- required: true,
- errorMessage: '请选择充电连接控制方式',
- },
- ]
- }
- },
- range: [{
- value: 0,
- text: "停用"
- },
- {
- value: 1,
- text: "启用"
- },
- ],
- //中转仓
- transitWarehouse: [{
- text: '无中转仓',
- value: 0
- }, {
- text: '有中转仓',
- value: 1
- }],
- //连接方式
- connWays: [{
- text: '单连',
- value: 1
- }, {
- text: '四连',
- value: 4
- }],
- //雷达
- radarList: [{
- text: '有雷达',
- value: 1
- }, {
- text: '无雷达',
- value: 0
- }],
- //是否可换电
- rangePower: [{
- value: 1,
- text: "是"
- },
- {
- value: 0,
- text: "否"
- },
- ],
- //是否切换充电
- rangeCharge: [{
- value: 1,
- text: "单连不可切换"
- },
- {
- value: 4,
- text: "四连不可切换"
- },
- {
- value: 0,
- text: "单四联切换"
- },
- {
- value: -1,
- text: "无"
- }
- ],
- datalist: [],//车辆列表
- dataCanglist: [],//仓位列表
- dataBatterylist: [],//电池列表
- queryParams: {
- page: 1, //当前页
- pageSize: 10, //每页条数
- source: undefined, //来源
- vehiclePlate: undefined, //车牌号
- vehicleVin: undefined, //VIN码
- orderByField: 'id', //排序字段
- orderByWays: 'desc' //排序方式
- },
- cangParams: {
- page: 1, //当前页
- pageSize: 10, //每页条数
- orderByField: 'id', //排序字段
- orderByWays: 'desc' //排序方式
- },
- batteryParams: {
- page: 1, //当前页
- pageSize: 10, //每页条数
- orderByField: 'id', //排序字段
- orderByWays: 'desc' ,//排序方式
- sn:null,//电池编号
- },
- total: 0, //总条数,
- cangTotal: 0, //仓位总条数,
- batteryTotal: 0, //电池总条数,
- loading: false,
- headers: [{
- label: '仓位号',
- key: 'chargerId',
- widtd: 98,
- }, {
- label: '桩编号',
- key: 'chargerCode',
- widtd: 315,
- }, {
- label: '是否可换电',
- key: 'isSwap',
- widtd: 200,
- }, {
- label: '充电连接控制方式',
- key: 'isCheck',
- widtd: 218,
- },
- {
- label: '操作',
- key: 'id',
- widtd: 118,
- },
- ],
- batteryheaders: [{
- label: '电池编号',
- key: 'sn',
- widtd: 278
- }, {
- label: '长(cm)',
- key: 'length',
- widtd: 148
- }, {
- label: '宽(cm)',
- key: 'width',
- widtd: 148
- },{
- label: '高(cm)',
- key: 'height',
- widtd: 148,
- },
- {
- label: '重量(kg)',
- key: 'weight',
- widtd: 148,
- },
- {
- label: '操作',
- key: 'id',
- widtd: 88,
- },
- ],
- //车辆列表
- carheaders: [{
- label: '车牌号',
- key: 'vehiclePlate',
- widtd: 130
- }, {
- label: '车辆识别码(VIN码)',
- key: 'vehicleVin',
- widtd: 225
- }, {
- label: 'RFID',
- key: 'rfidEpc',
- widtd: 255,
- }, {
- label: '前端电池距离(mm)',
- key: 'modelDistance',
- widtd: 200
- },
- {
- label: '供电接口',
- key: 'link',
- widtd: 100,
- },
- // {
- // label: '来源',
- // key: 'source',
- // widtd: 100,
- // },
- {
- label: '操作',
- key: 'id',
- widtd: 108,
- },
- ],
- showLoadMore: false,
- loadMore: 'more',
- dialogType: 'new', // 按钮类型(new、edit)
- EditCarForm: {}, //编辑车辆表单数据接收
- synchronizationTime:'',//同步时间
- isSelect:0,
- dialogCangType:'new',
- dialogBatteryType:'new',
- }
- },
- mounted() {
- this.vehicleList();
- this.getsynchronization()
- },
- methods: {
- //充电机温度正则
- regTemp(e){
- const reg=/^\d*$/
- if(!reg.test(e.detail.value) || e.detail.value==0){
- this.queryParamsSet.temp=90
- }
- },
- //温度恢复默认
- resetTemp(){
- this.$http.setTemp(90+'').then((res) => {
- if(res.code===0){
- this.queryParamsSet.temp=90
- this.ExchangeMessage('success','恢复成功!')
- }
- })
- },
- //设置温度
- handleSettemp(){
- this.$http.setTemp(this.queryParamsSet.temp).then((res) => {
- if(res.code!==0){
- this.ExchangeMessage('error',res.msg)
- }else{
- this.getCurrentTemp()
- }
- })
- },
- //获取站控配置
- getStationConfig(){
- this.$http.getOtherStation(4+'').then((res) => {
- if(res.data.content==1){
- this.connWayArr.push(1)
- }
- });
- this.$http.getOtherStation(8+'').then((res) => {
- if(res.data && res.data.content && (res.data.content=='0' || res.data.content=='1')){
- this.queryParamsSet.radar = Number(res.data.content)
- }
- });
- this.$http.getOtherStation(5+'').then((res) => {
- if(res.data.content==1){
- this.connWayArr.push(4)
- }
- });
- this.$http.getOtherStation(6+'').then((res) => {
- if(res.data.content==1){
- this.queryParamsSet.transitWarehouse=1
- this.$http.getOtherStation(7+'').then((res) => {
- this.queryParamsSet.positionNumber=res.data.content*1
- });
- }else{
- this.queryParamsSet.transitWarehouse=0
- }
- });
- this.getCurrentTemp()
- },
- //获取温度
- getCurrentTemp(){
- //获取温度
- this.$http.serchTemp().then((res) => {
- if(res.code===0){
- this.queryParamsSet.temp=res.data*1
- }
- });
- },
- //读取frid
- redHandle() {
- this.$http.getEpc().then((res) => {
- if(res.code===0){
- let frid = res.data
- this.basicFrom.frid=frid.replace(/.{4}$/, '****')
- this.basicFrom.rfidEpc=frid
- } else {
- return this.ExchangeMessage('warn', '未获取FRID卡号')
- }
- });
- },
- inputHandle(data) {
- console.log(data.toUpperCase(), '000')
- this.basicFrom.epcFour = data.toUpperCase()
- console.log(this.basicFrom, '333')
- },
- //保存站控配置
- handleSave(){
- const reg=/^\d*$/
- if(!this.queryParamsSet.temp){
- this.ExchangeMessage('warn', '请输入充电机温度!')
- return
- }
- if(this.connWayArr.length===0){
- this.ExchangeMessage('warn', '请选择换电站连接方式!')
- return
- }
- if(this.queryParamsSet.transitWarehouse==null){
- this.ExchangeMessage('warn', '请选择中转仓!')
- return
- }
- if(this.queryParamsSet.radar==null){
- this.ExchangeMessage('warn', '请选择是否有雷达!')
- return
- }
- if(this.queryParamsSet.transitWarehouse==1){
- if(!this.queryParamsSet.positionNumber){
- this.ExchangeMessage('warn', '请输入中转仓仓位号!')
- return
- }else{
- if(!reg.test(this.queryParamsSet.positionNumber) || this.queryParamsSet.positionNumber<=0){
- this.ExchangeMessage('warn', '请输入正整数!')
- return
- }
- }
- this.queryParamsSet.positionNumber=this.queryParamsSet.positionNumber*1
- }else{
- this.queryParamsSet.positionNumber=undefined
- }
-
- if(this.connWayArr.length===2){
- this.queryParamsSet.oneLink=1
- this.queryParamsSet.fourLink=1
- }else{
- if(this.connWayArr[0]===1){
- this.queryParamsSet.oneLink=1
- this.queryParamsSet.fourLink=0
- }else{
- this.queryParamsSet.oneLink=0
- this.queryParamsSet.fourLink=1
- }
- }
- this.$http.setStation(this.queryParamsSet).then((res) => {
- if(res.code === 0){
- this.getStationConfig()
- this.handleSettemp()
- }
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '设置成功' : res.msg)
- });
- },
- //切换数据按钮
- handleData(num){
- this.showLoadMore=false
- this.isSelect=num
- if(num===0){
- this.vehicleList()
- }else if(num===1){
- this.getStationConfig()
- this.encodeList()
- }else{
- this.batteryList()
- }
-
- },
- //顶部公共消息提示
- ExchangeMessage(type, message) {
- this.popupType = type
- this.popupMessage = message ? message : '后端接口404错误!'
- this.$refs.Exchangepopup.open()
- },
- //获取最近同步时间
- getsynchronization(){
- this.$http.getSyncTime().then(res=>{
- if(res.code == 0){
- this.synchronizationTime = res.data
- }
- })
- },
- //删除车辆
- DelCarData(id) {
- let that = this
- uni.showModal({
- title: `确认删除车辆信息吗?`,
- content: '',
- success: function(res) {
- if (res.confirm) {
- that.$http.delvehicle(id + '')
- .then(res => {
- if (res.code === 0) {
- that.vehicleList()
- }
- that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除车辆成功' : '删除车辆失败')
- }).catch(err => {
- console.error(err)
- })
- } else if (res.cancel) {
- return false
- //用户点击取消按钮触发
- }
- }
- })
- },
- //删除充电机仓位
- DelCangData(id) {
- let that = this
- uni.showModal({
- title: `确认删除仓位吗?`,
- content: '',
- success: function(res) {
- if (res.confirm) {
- that.$http.delEncode(id+'')
- .then(res => {
- if (res.code === 0) {
- that.encodeList()
- }
- that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除成功' : res.msg)
- }).catch(err => {
- console.error(err)
- })
- } else if (res.cancel) {
- return false
- //用户点击取消按钮触发
- }
- }
- })
- },
- //删除电池
- DelBatteryData(id) {
- let that = this
- uni.showModal({
- title: `确认删除电池信息吗?`,
- content: '',
- success: function(res) {
- if (res.confirm) {
- that.$http.delBattery(id+'')
- .then(res => {
- if (res.code === 0) {
- that.batteryList()
- }
- that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '删除成功' : res.msg)
- }).catch(err => {
- console.error(err)
- })
- } else if (res.cancel) {
- return false
- //用户点击取消按钮触发
- }
- }
- })
- },
- // 打开添加车辆抽屉
- OpenAddDrawer() {
- this.dialogType = 'new'
- this.basicFrom = {
- id: 0,
- CarDistance: null,
- CarPlate: undefined,
- CarVin: undefined,
- state: undefined,
- }
- this.$refs.BasicDrawer.open();
- },
- //新增仓位抽屉
- AddCangDrawer(){
- this.dialogCangType='new'
- this.setForm={
- cangNum:null,//桩编号
- isPower:null,//是否可换电
- isCharger:null,//是否切换充电连接
- },
- this.$refs.BasicDrawer.open()
- },
- //新增电池抽屉
- AddBatteryDrawer(){
- this.dialogBatteryType='new'
- this.BatteryForm={
- sn:null,//编号
- length:null,//长
- width:null,//宽
- height:null,//高
- weight:null,//重量
- },
- this.$refs.BasicDrawer.open()
- },
- //编辑充电仓位抽屉
- EditCangData(row){
- this.dialogCangType='edit'
- this.$refs.BasicDrawer.open()
- this.setForm={...row}
- },
- //编辑电池抽屉
- EditBatteryData(row){
- this.dialogBatteryType='edit'
- this.$refs.BasicDrawer.open()
- this.BatteryForm={...row}
- },
- //编辑充电仓位请求接口
- EditCangInfo() {
- this.$refs.addSetForm.$refs.setvalueForm.validate().then(res=>{
- const params = {
- id: this.setForm.id,
- chargerId: this.setForm.chargerId*1,
- chargerCode: this.setForm.chargerCode,
- isSwap: this.setForm.isSwap,
- isCheck: this.setForm.isCheck,
- }
- this.$http.editEncode(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '修改成功!' : res.msg)
- if (res.code === 0) {
- this.encodeList()
- }
- }).catch(err => {
- console.error(err)
- })
- })
- // if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
- // this.ExchangeMessage('warn', '请填写完整!')
- // } else {
- // const params = {
- // modelDistance: this.basicFrom.CarDistance,
- // vehiclePlate: this.basicFrom.CarPlate,
- // vehicleVin: this.basicFrom.CarVin,
- // state: this.basicFrom.state * 1,
- // id: this.basicFrom.id
- // }
- // this.$http.Editvehicle(params)
- // .then(res => {
- // this.closeDrawer()
- // this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
- // if (res.code === 0) {
- // this.vehicleList()
- // }
- // }).catch(err => {
- // console.error(err)
- // })
- // }
- },
- //编辑电池
- EditBatteryInfo() {
- this.$refs.addBatteryForm.$refs.valueForm.validate().then(res=>{
- const params = {
- id: this.BatteryForm.id,
- sn: this.BatteryForm.sn,
- length: this.BatteryForm.length*1,
- width: this.BatteryForm.width*1,
- height: this.BatteryForm.height*1,
- weight: this.BatteryForm.weight*1,
- }
- this.$http.editBattery(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '修改成功!' : res.msg)
- if (res.code === 0) {
- this.batteryList()
- }
- }).catch(err => {
- console.error(err)
- })
- })
- },
- //添加充电仓位请求接口
- AddCanginfo() {
- this.$refs.addSetForm.$refs.setvalueForm.validate().then(res=>{
- const params = {
- chargerId: this.setForm.chargerId*1,
- chargerCode: this.setForm.chargerCode,
- isSwap: this.setForm.isSwap,
- isCheck: this.setForm.isCheck,
- }
- this.$http.addEncode(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增仓位成功' : res.msg)
- if (res.code === 0) {
- this.encodeList()
- }
- }).catch(err => {
- console.error(err)
- })
- })
- },
- //添加电池请求接口
- AddBatteryinfo() {
- this.$refs.addBatteryForm.$refs.valueForm.validate().then(res=>{
- const params = {
- sn: this.BatteryForm.sn,
- length: this.BatteryForm.length*1,
- width: this.BatteryForm.width*1,
- height: this.BatteryForm.height*1,
- weight: this.BatteryForm.weight*1,
- }
- this.$http.addBattery(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增电池成功' : res.msg)
- if (res.code === 0) {
- this.batteryList()
- }
- }).catch(err => {
- console.error(err)
- })
- })
- },
- //打开编辑车辆抽屉
- EditCarData(row) {
- this.dialogType = 'edit'
- this.$refs.BasicDrawer.open();
- this.basicFrom.CarDistance = row.modelDistance
- this.basicFrom.CarPlate = row.vehiclePlate
- this.basicFrom.CarVin = row.vehicleVin
- this.basicFrom.state = row.state
- this.basicFrom.id = row.id
- },
- //打开绑定frid
- bindHandle(row) {
- let _that = this
- if(row.rfidEpc) {
- uni.showModal({
- title:`该车已经绑定FRID,是否继续绑定?`,
- content:'',
- success: function(res) {
- if (res.confirm) {
- _that.$refs.BindDrawer.open();
- _that.basicFrom.CarDistance = row.modelDistance
- _that.basicFrom.CarPlate = row.vehiclePlate
- _that.basicFrom.CarVin = row.vehicleVin
- _that.basicFrom.state = row.state
- _that.basicFrom.id = row.id
- _that.basicFrom.rfidEpc = row.rfidEpc
- _that.basicFrom.frid = row.rfidEpc.replace(/.{4}$/, '****')
- } else if (res.cancel) {
- return false
- //用户点击取消按钮触发
- }
- }
- })
- } else {
- _that.$refs.BindDrawer.open();
- _that.basicFrom.CarDistance = row.modelDistance
- _that.basicFrom.CarPlate = row.vehiclePlate
- _that.basicFrom.CarVin = row.vehicleVin
- _that.basicFrom.state = row.state
- _that.basicFrom.id = row.id
- _that.basicFrom.rfidEpc = row.rfidEpc
- _that.basicFrom.frid = row.rfidEpc.replace(/.{4}$/, '****')
- }
- },
- //绑定建权
- BindFRIDHandle() {
- if (!this.basicFrom.rfidEpc || !this.basicFrom.epcFour) {
- this.ExchangeMessage('warn', '请填写完整!')
- } else {
- const params = {
- id: this.basicFrom.id,
- rfidEpc: this.basicFrom.rfidEpc,
- epcFour: this.basicFrom.epcFour
- }
- this.$http.vehicleBind(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
- if (res.code === 0) {
- this.vehicleList()
- }
- }).catch(err => {
- console.error(err)
- })
- }
- },
- //编辑车辆请求接口
- EditCarInfo() {
- if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
- this.ExchangeMessage('warn', '请填写完整!')
- } else {
- const params = {
- modelDistance: this.basicFrom.CarDistance,
- vehiclePlate: this.basicFrom.CarPlate,
- vehicleVin: this.basicFrom.CarVin,
- state: this.basicFrom.state * 1,
- id: this.basicFrom.id
- }
- this.$http.Editvehicle(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
- if (res.code === 0) {
- this.vehicleList()
- }
- }).catch(err => {
- console.error(err)
- })
- }
- },
- // 添加车辆请求接口
- AddCarinfo() {
- if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
- this.ExchangeMessage('warn', '请填写完整!')
- } else {
- const params = {
- modelDistance: this.basicFrom.CarDistance,
- vehiclePlate: this.basicFrom.CarPlate,
- vehicleVin: this.basicFrom.CarVin,
- source: 0,
- }
- this.$http.addvehicle(params)
- .then(res => {
- this.closeDrawer()
- this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '新增车辆成功' : '新增车辆失败')
- if (res.code === 0) {
- this.vehicleList()
- }
- }).catch(err => {
- console.error(err)
- })
- }
- },
- //查询
- handleQuery() {
- this.queryParams.page = 1
- this.datalist = []
- this.showLoadMore = false
- this.vehicleList()
- },
- //查询电池
- handleBatteryQuery () {
- this.batteryParams.page = 1
- this.dataBatterylist = []
- this.showLoadMore = false
- this.batteryList()
- },
- //重置
- resetForm() {
- this.queryParams = {
- page: 1,
- pageSize: 10,
- source: undefined, //来源
- vehiclePlate: undefined, //车牌号
- vehicleVin: undefined, //VIN码
- }
- this.vehicleList()
- },
- //重置电池
- resetBatteryForm() {
- this.batteryParams = {
- page: 1,
- pageSize: 10,
- orderByField: 'id', //排序字段
- orderByWays: 'desc' ,//排序方式
- sn: null, //来源
- }
- this.batteryList()
- },
- //车辆列表,
- vehicleList() {
- uni.showLoading({
- title:'数据加载中...'
- })
- this.$http.vehicleList(this.queryParams).then((res) => {
- this.datalist = res.data.records;
- this.total = res.data.total;
- uni.hideLoading()
- }).catch(err => {uni.hideLoading()});
- },
- //仓位列表
- encodeList() {
- uni.showLoading({
- title:'数据加载中...'
- })
- this.$http.encodeList(this.cangParams).then((res) => {
-
- this.dataCanglist = res.data;
- uni.hideLoading()
- }).catch(err => {uni.hideLoading()});
- },
- //电池列表
- batteryList() {
- uni.showLoading({
- title:'数据加载中...'
- })
- this.$http.batteryList(this.batteryParams).then((res) => {
- this.dataBatterylist = res.data.records;
- this.batteryTotal=res.data.total
- uni.hideLoading()
- }).catch(err => {uni.hideLoading()});
- },
- //关闭抽屉
- closeDrawer() {
- this.$refs.BasicDrawer.close();
- this.$refs.BindDrawer.close();
- },
- //车辆触底加载数据
- pullup() {
- this.showLoadMore = true
- if(this.isSelect!==0){
- this.loadMore = 'no-more'
- }else{
- if (this.total == this.datalist.length) {
- this.loadMore = 'no-more'
- return
- } else {
- this.queryParams.page++
- this.vehicleList()
- this.loadMore = 'loading'
- }
- }
-
- },
- //仓位触底加载数据
- pullCangup() {
- this.showLoadMore = true
- if(this.isSelect!==1){
- this.loadMore = 'no-more'
- }else{
- if (this.cangTotal == this.dataCanglist.length) {
- this.loadMore = 'no-more'
- return
- } else {
- this.cangParams.page++
- this.encodeList()
- this.loadMore = 'loading'
- }
- }
- },
- //仓位触底加载数据
- pullBatteryup() {
- this.showLoadMore = true
- if(this.isSelect!==2){
- this.loadMore = 'no-more'
- }else{
- if (this.batteryTotal == this.dataBatterylist.length) {
- this.loadMore = 'no-more'
- return
- } else {
- this.batteryParams.page++
- this.batteryList()
- this.loadMore = 'loading'
- }
- }
- },
- //同步云端
- syncCloud() {
- let that = this
- uni.showModal({
- title: "是否云端同步",
- content: "",
- success: function(res) {
- if (res.confirm) {
- that.$http.getSync().then(res=>{
- that.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.code === 0 ? '同步成功':'同步失败')
- })
- //用户点击确认按钮触发
- } else if (res.cancel) {
- return
- //用户点击取消按钮触发
- }
- }
- })
- },
- //chargerId等于0时更改为1
- changeChargerId(){
- this.setForm.chargerId=1
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .uni-forms-item__content {
- .is-input-error-border .uni-easyinput__placeholder-class{
- color: #999;
- }
- .uni-easyinput,.uni-select{
- background: rgba(255, 255, 255, 0);
- border-radius: 2px;
- border: 1px solid #263042;
-
- }
- .uni-select__selector {
- background: none;
- border: 1px solid #263042;
- }
- .uni-select__selector-item {
- font-size: 14px;
- font-weight: 400;
- color: #A8ADC8;
- }
- .uni-popper__arrow {
- display: none;
- }
- .uni-select__input-text {
- color: white;
- }
- .uni-easyinput__content {
- background: none !important;
- border: none !important;
- color: #fff;
- width: 188px;
- }
- .tempIpt{
- .uni-easyinput__content{
- width: 92px !important;
- }
- }
- }
- ::v-deep .uni-forms-item__label {
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- }
- ::v-deep .uni-select__selector {
- background: #111827 !important;
- border: 1px solid #263042;
- color: #606266;
- z-index: 9999999;
- }
- .basic-data {
- width: 100%;
- height: 100%;
- color: white;
- font-size: 24px;
- overflow: hidden;
- .basic-top {
- display: flex;
- justify-content: space-between;
- .service_header_left {
- display: flex;
-
- .btn {
- width: 100px;
- height: 48px;
- background: #263042;
- border-radius: 0px 2px 2px 0px;
- font-size: 16px;
- text-align: center;
- line-height: 48px;
- }
-
- .active {
- background: #91FDB9;
- border-radius: 2px 0px 0px 2px;
- color: black;
- }
- }
- .basci-header-right{
- display:flex;
- align-items: center;
- }
- .times {
- font-size: 14px;
- font-weight: 400;
- color: #A8ADC8;
- line-height: 32px;
- }
- .sync-btn {
- width: 88px;
- height: 32px;
- border-radius: 2px;
- line-height: 32px;
- text-align: center;
- border: 1px solid #91FDB9;
- font-size: 14px;
- font-weight: 400;
- color: #91FDB9;
- margin-left: 20px;
- }
- .title {
- margin-left: auto;
- line-height: 32px;
- font-size: 16px;
- font-weight: 600;
- color: rgba(255, 255, 255, 0.85);
- line-height: 19px;
- text-shadow: 0px 0px 4px #0027D8
- }
- }
- .basic-search {
- display: flex;
- padding: 16px 20px;
- width: 100%;
- height: 66px;
- box-sizing: border-box;
- background: #111827;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
- border-radius: 2px;
- border: 1px solid #192337;
- // margin-top: 20px;
- ::v-deep .searchForm {
- span {
- display: flex;
- }
- }
- }
- .basic-zkset{
- display: flex;
- padding: 16px 20px;
- width: 100%;
- min-height: 66px;
- box-sizing: border-box;
- background: #111827;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
- border-radius: 2px;
- border: 1px solid #192337;
- flex-direction: column;
- .setTitle{
- font-size: 15px;
- font-weight: bold;
- }
- .setCont{
- .tempIpt{
- width: 88px;
-
- }
- ::v-deep .uni-data-checklist{
- margin-top: 5px !important;
- .checklist-box{
- margin-right: 12px;
- }
- .checklist-text{
- color: white
- }
- .checklist-group .checklist-box.is--default.is-checked .checklist-text{
- color: #91FDB9;
- }
- .checklist-group .checklist-box.is--default.is-checked .radio__inner{
- border-color:#91FDB9;
- }
- .checklist-group .checklist-box.is--default.is-checked .radio__inner .radio__inner-icon{
- background-color:#91FDB9;
- }
- .checklist-group .checklist-box.is--default.is-checked .checkbox__inner{
- border-color:#91FDB9;
- background-color:#91FDB9;
- }
- }
- ::v-deep .formSet {
- span {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- }
- .uni-forms-item__content{
- display: flex;
- }
- .uni-forms-item{
- margin-bottom: 0;
- }
- }
- }
- }
- .search-btn {
- width: 60px;
- height: 34px;
- background: #91FDB9;
- border-radius: 2px;
- font-size: 14px;
- font-weight: 400;
- color: #000000;
- text-align: center;
- line-height: 34px;
- margin-left: 20px;
- margin-top: 1px;
- }
- .search-temp {
- width: 68px;
- height: 34px;
- background: #91FDB9;
- border-radius: 2px;
- font-size: 14px;
- font-weight: 400;
- color: #000000;
- text-align: center;
- line-height: 34px;
- margin-left: 20px;
- margin-top: 1px;
- margin-right: 15px;
- }
- .reset-btn {
- width: 60px;
- height: 32px;
- border-radius: 2px;
- font-size: 14px;
- font-weight: 400;
- color: #FFFFFF;
- text-align: center;
- line-height: 32px;
- margin-left: 20px;
- margin-top: 1px;
- border: 1px solid #263042;
- }
- .basic-table {
- width: 100%;
- height: 576px;
- background: #111827;
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
- border-radius: 2px;
- border: 1px solid #192337;
- margin-top: 16px;
- box-sizing: border-box;
- padding: 16px 20px;
- display: flex;
- flex-direction: column;
- .marginZero {
- margin-left: 0px;
- margin-bottom: 15px;
- }
- }
- }
- </style>
|