mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-04 05:58:00 +08:00
后管新增 用户鉴权卡界面
This commit is contained in:
@@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
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