1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405 |
- <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">
- <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="80px" 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>
- <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="'绑定FRID'" @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,//固定中转仓位号
- },
- 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
- }],
- //是否可换电
- 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: 'FRID',
- 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(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.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;
- 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>
|