mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-06 11:00:13 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -243,6 +243,17 @@ public class PileService {
|
||||
.build();
|
||||
memberService.checkVerificationCode(registerAndLoginDTO);
|
||||
|
||||
// 判断桩是否为个人桩
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn());
|
||||
if (pileBasicInfo == null) {
|
||||
// 未查到则说明没有此桩
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO);
|
||||
}
|
||||
String businessType = pileBasicInfo.getBusinessType();
|
||||
if (!StringUtils.equals(BusinessTypeEnum.INDIVIDUAL_PILE.getValue(), businessType)){
|
||||
// 不一致则此桩不是个人桩
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_THIS_PILE_NOT_PERSONAL_PILE);
|
||||
}
|
||||
// 检查桩是否已经被绑定
|
||||
PileMemberRelation pileMemberRelation = new PileMemberRelation();
|
||||
pileMemberRelation.setPileSn(dto.getPileSn());
|
||||
@@ -252,11 +263,6 @@ public class PileService {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PILE_HAS_BEEN_BINDING_ERROR);
|
||||
}
|
||||
// 如果没被绑定,先校验桩密钥是否一致
|
||||
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn());
|
||||
if (pileBasicInfo == null) {
|
||||
// 未查到则说明没有此桩
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO);
|
||||
}
|
||||
if (!StringUtils.equals(pileBasicInfo.getSecretKey(), dto.getSecretKey())) {
|
||||
// 错误的密钥信息
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_ERROR);
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.jsowell.web.controller.pile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.jsowell.common.annotation.Log;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.core.domain.AjaxResult;
|
||||
import com.jsowell.common.enums.BusinessType;
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.service.IPileAuthCardService;
|
||||
import com.jsowell.common.util.poi.ExcelUtil;
|
||||
import com.jsowell.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 充电站鉴权卡Controller
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-03-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pile/card")
|
||||
public class PileAuthCardController extends BaseController {
|
||||
@Autowired
|
||||
private IPileAuthCardService pileAuthCardService;
|
||||
|
||||
/**
|
||||
* 查询充电站鉴权卡列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PileAuthCard pileAuthCard) {
|
||||
startPage();
|
||||
List<PileAuthCard> list = pileAuthCardService.selectPileAuthCardList(pileAuthCard);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出充电站鉴权卡列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:export')")
|
||||
@Log(title = "充电站鉴权卡", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, PileAuthCard pileAuthCard) {
|
||||
List<PileAuthCard> list = pileAuthCardService.selectPileAuthCardList(pileAuthCard);
|
||||
ExcelUtil<PileAuthCard> util = new ExcelUtil<PileAuthCard>(PileAuthCard.class);
|
||||
util.exportExcel(response, list, "充电站鉴权卡数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取充电站鉴权卡详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(pileAuthCardService.selectPileAuthCardById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充电站鉴权卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:add')")
|
||||
@Log(title = "充电站鉴权卡", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody PileAuthCard pileAuthCard) {
|
||||
return toAjax(pileAuthCardService.insertPileAuthCard(pileAuthCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充电站鉴权卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:edit')")
|
||||
@Log(title = "充电站鉴权卡", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody PileAuthCard pileAuthCard) {
|
||||
return toAjax(pileAuthCardService.updatePileAuthCard(pileAuthCard));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除充电站鉴权卡
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('pile:card:remove')")
|
||||
@Log(title = "充电站鉴权卡", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(pileAuthCardService.deletePileAuthCardByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,8 @@ public enum ReturnCodeEnum {
|
||||
CODE_PILE_NOT_INFO("00400012", "未查到该该桩的信息,请检查!"),
|
||||
|
||||
CODE_SECRET_KEY_ERROR("00400013", "填写的桩密钥有误,请检查!"),
|
||||
|
||||
CODE_THIS_PILE_NOT_PERSONAL_PILE("00400014", "此桩不是个人桩!"),
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.jsowell.pile.domain;
|
||||
|
||||
import com.jsowell.common.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 充电站鉴权卡对象 pile_auth_card
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-03-16
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PileAuthCard {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 逻辑卡号
|
||||
*/
|
||||
@Excel(name = "逻辑卡号")
|
||||
private String logicCard;
|
||||
|
||||
/**
|
||||
* 物理卡号
|
||||
*/
|
||||
@Excel(name = "物理卡号")
|
||||
private String physicsCard;
|
||||
|
||||
/**
|
||||
* 所属用户的会员id
|
||||
*/
|
||||
@Excel(name = "所属用户的会员id")
|
||||
private String memberId;
|
||||
|
||||
/**
|
||||
* 删除标识(0-正常;1-删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.jsowell.pile.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 充电站鉴权卡Mapper接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-03-16
|
||||
*/
|
||||
@Repository
|
||||
public interface PileAuthCardMapper {
|
||||
/**
|
||||
* 查询充电站鉴权卡
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 充电站鉴权卡
|
||||
*/
|
||||
public PileAuthCard selectPileAuthCardById(Long id);
|
||||
|
||||
/**
|
||||
* 查询充电站鉴权卡列表
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 充电站鉴权卡集合
|
||||
*/
|
||||
public List<PileAuthCard> selectPileAuthCardList(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 新增充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPileAuthCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 修改充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePileAuthCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 删除充电站鉴权卡
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileAuthCardById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除充电站鉴权卡
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileAuthCardByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
|
||||
/**
|
||||
* 充电站鉴权卡Service接口
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-03-16
|
||||
*/
|
||||
public interface IPileAuthCardService {
|
||||
/**
|
||||
* 查询充电站鉴权卡
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 充电站鉴权卡
|
||||
*/
|
||||
public PileAuthCard selectPileAuthCardById(Long id);
|
||||
|
||||
/**
|
||||
* 查询充电站鉴权卡列表
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 充电站鉴权卡集合
|
||||
*/
|
||||
public List<PileAuthCard> selectPileAuthCardList(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 新增充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPileAuthCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 修改充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePileAuthCard(PileAuthCard pileAuthCard);
|
||||
|
||||
/**
|
||||
* 批量删除充电站鉴权卡
|
||||
*
|
||||
* @param ids 需要删除的充电站鉴权卡主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileAuthCardByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除充电站鉴权卡信息
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePileAuthCardById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.jsowell.pile.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jsowell.pile.mapper.PileAuthCardMapper;
|
||||
import com.jsowell.pile.domain.PileAuthCard;
|
||||
import com.jsowell.pile.service.IPileAuthCardService;
|
||||
|
||||
/**
|
||||
* 充电站鉴权卡Service业务层处理
|
||||
*
|
||||
* @author jsowell
|
||||
* @date 2023-03-16
|
||||
*/
|
||||
@Service
|
||||
public class PileAuthCardServiceImpl implements IPileAuthCardService {
|
||||
@Autowired
|
||||
private PileAuthCardMapper pileAuthCardMapper;
|
||||
|
||||
/**
|
||||
* 查询充电站鉴权卡
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 充电站鉴权卡
|
||||
*/
|
||||
@Override
|
||||
public PileAuthCard selectPileAuthCardById(Long id) {
|
||||
return pileAuthCardMapper.selectPileAuthCardById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站鉴权卡列表
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 充电站鉴权卡
|
||||
*/
|
||||
@Override
|
||||
public List<PileAuthCard> selectPileAuthCardList(PileAuthCard pileAuthCard) {
|
||||
return pileAuthCardMapper.selectPileAuthCardList(pileAuthCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertPileAuthCard(PileAuthCard pileAuthCard) {
|
||||
return pileAuthCardMapper.insertPileAuthCard(pileAuthCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改充电站鉴权卡
|
||||
*
|
||||
* @param pileAuthCard 充电站鉴权卡
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updatePileAuthCard(PileAuthCard pileAuthCard) {
|
||||
return pileAuthCardMapper.updatePileAuthCard(pileAuthCard);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除充电站鉴权卡
|
||||
*
|
||||
* @param ids 需要删除的充电站鉴权卡主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePileAuthCardByIds(Long[] ids) {
|
||||
return pileAuthCardMapper.deletePileAuthCardByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除充电站鉴权卡信息
|
||||
*
|
||||
* @param id 充电站鉴权卡主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePileAuthCardById(Long id) {
|
||||
return pileAuthCardMapper.deletePileAuthCardById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jsowell.pile.mapper.PileAuthCardMapper">
|
||||
|
||||
<resultMap type="com.jsowell.pile.domain.PileAuthCard" id="PileAuthCardResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="logicCard" column="logic_card" />
|
||||
<result property="physicsCard" column="physics_card" />
|
||||
<result property="memberId" column="member_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPileAuthCardVo">
|
||||
select id, logic_card, physics_card, member_id, create_time, create_by, update_time, update_by, del_flag from pile_auth_card
|
||||
</sql>
|
||||
|
||||
<select id="selectPileAuthCardList" parameterType="com.jsowell.pile.domain.PileAuthCard" resultMap="PileAuthCardResult">
|
||||
<include refid="selectPileAuthCardVo"/>
|
||||
<where>
|
||||
<if test="logicCard != null and logicCard != ''"> and logic_card = #{logicCard}</if>
|
||||
<if test="physicsCard != null and physicsCard != ''"> and physics_card = #{physicsCard}</if>
|
||||
<if test="memberId != null and memberId != ''"> and member_id = #{memberId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPileAuthCardById" parameterType="Long" resultMap="PileAuthCardResult">
|
||||
<include refid="selectPileAuthCardVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPileAuthCard" parameterType="com.jsowell.pile.domain.PileAuthCard" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pile_auth_card
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="logicCard != null">logic_card,</if>
|
||||
<if test="physicsCard != null">physics_card,</if>
|
||||
<if test="memberId != null">member_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="logicCard != null">#{logicCard},</if>
|
||||
<if test="physicsCard != null">#{physicsCard},</if>
|
||||
<if test="memberId != null">#{memberId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePileAuthCard" parameterType="com.jsowell.pile.domain.PileAuthCard">
|
||||
update pile_auth_card
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="logicCard != null">logic_card = #{logicCard},</if>
|
||||
<if test="physicsCard != null">physics_card = #{physicsCard},</if>
|
||||
<if test="memberId != null">member_id = #{memberId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePileAuthCardById" parameterType="Long">
|
||||
delete from pile_auth_card where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePileAuthCardByIds" parameterType="String">
|
||||
delete from pile_auth_card where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
44
jsowell-ui/src/api/pile/card.js
Normal file
44
jsowell-ui/src/api/pile/card.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询充电站鉴权卡列表
|
||||
export function listCard(query) {
|
||||
return request({
|
||||
url: '/pile/card/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询充电站鉴权卡详细
|
||||
export function getCard(id) {
|
||||
return request({
|
||||
url: '/pile/card/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增充电站鉴权卡
|
||||
export function addCard(data) {
|
||||
return request({
|
||||
url: '/pile/card',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改充电站鉴权卡
|
||||
export function updateCard(data) {
|
||||
return request({
|
||||
url: '/pile/card',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除充电站鉴权卡
|
||||
export function delCard(id) {
|
||||
return request({
|
||||
url: '/pile/card/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
281
jsowell-ui/src/views/pile/card/index.vue
Normal file
281
jsowell-ui/src/views/pile/card/index.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="逻辑卡号" prop="logicCard">
|
||||
<el-input
|
||||
v-model="queryParams.logicCard"
|
||||
placeholder="请输入逻辑卡号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物理卡号" prop="physicsCard">
|
||||
<el-input
|
||||
v-model="queryParams.physicsCard"
|
||||
placeholder="请输入物理卡号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属用户的会员id" prop="memberId">
|
||||
<el-input
|
||||
v-model="queryParams.memberId"
|
||||
placeholder="请输入所属用户的会员id"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['pile:card:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['pile:card:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['pile:card:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['pile:card:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="cardList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="逻辑卡号" align="center" prop="logicCard" />
|
||||
<el-table-column label="物理卡号" align="center" prop="physicsCard" />
|
||||
<el-table-column label="所属用户的会员id" align="center" prop="memberId" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['pile:card:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['pile:card:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改充电站鉴权卡对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="逻辑卡号" prop="logicCard">
|
||||
<el-input v-model="form.logicCard" placeholder="请输入逻辑卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物理卡号" prop="physicsCard">
|
||||
<el-input v-model="form.physicsCard" placeholder="请输入物理卡号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属用户的会员id" prop="memberId">
|
||||
<el-input v-model="form.memberId" placeholder="请输入所属用户的会员id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标识" prop="delFlag">
|
||||
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCard, getCard, delCard, addCard, updateCard } from "@/api/pile/card";
|
||||
|
||||
export default {
|
||||
name: "card",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 充电站鉴权卡表格数据
|
||||
cardList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
logicCard: null,
|
||||
physicsCard: null,
|
||||
memberId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询充电站鉴权卡列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCard(this.queryParams).then(response => {
|
||||
this.cardList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
logicCard: null,
|
||||
physicsCard: null,
|
||||
memberId: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加充电站鉴权卡";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getCard(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改充电站鉴权卡";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateCard(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCard(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除充电站鉴权卡编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delCard(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('pile/card/export', {
|
||||
...this.queryParams
|
||||
}, `card_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user