mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-04 14:08:01 +08:00
601 lines
22 KiB
Vue
601 lines
22 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="queryParams"
|
|
ref="queryForm"
|
|
size="small"
|
|
:inline="true"
|
|
v-show="showSearch"
|
|
label-width="68px"
|
|
@submit.native.prevent
|
|
>
|
|
<el-form-item label="桩号" prop="pileSn">
|
|
<el-input
|
|
v-model="queryParams.pileSn"
|
|
placeholder="请输入桩号"
|
|
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
|
|
v-hasPermi="['pile:station:add']"
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleUpdate"
|
|
>修改充电桩
|
|
</el-button>
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
v-hasPermi="['pile:basic:batchAdd']"
|
|
>新增充电桩
|
|
</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-table
|
|
v-loading="loading"
|
|
:data="pileList"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
<el-table-column label="桩号" align="center" prop="sn">
|
|
<template slot-scope="scope">
|
|
<router-link
|
|
:to="'/pile/detail/index/' + scope.row.pileId"
|
|
class="link-type"
|
|
>
|
|
<span>{{ scope.row.pileSn }}</span>
|
|
</router-link>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="运营类型" align="center" prop="businessType">
|
|
<template slot-scope="scope">
|
|
<dict-tag
|
|
:options="dict.type.pile_business_type"
|
|
:value="scope.row.businessType"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
<template slot-scope="scope">
|
|
<dict-tag
|
|
:options="dict.type.pile_status"
|
|
:value="scope.row.status"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="接口数量" align="center" prop="gunNum"/>
|
|
<el-table-column label="密钥" align="center" prop="secretKey"/>
|
|
<el-table-column label="电桩类型" align="center" prop="pileType">
|
|
<template slot-scope="scope">
|
|
<dict-tag
|
|
:options="dict.type.connector_type"
|
|
:value="scope.row.pileType"
|
|
/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="运营商"
|
|
align="center"
|
|
prop="merchantName"
|
|
/>
|
|
<el-table-column label="充电站" align="center" prop="stationName"/>
|
|
<el-table-column
|
|
label="注册时间"
|
|
align="center"
|
|
prop="registrationTime"
|
|
/>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total > 0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getPileList"
|
|
/>
|
|
|
|
<!-- 修改充电桩站点 -->
|
|
<el-dialog
|
|
:title="title"
|
|
:visible.sync="openUpdateDialog"
|
|
width="45%"
|
|
append-to-body
|
|
:before-close="handleClose"
|
|
>
|
|
<el-form ref="form" :model="updateData" label-width="120px">
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="已选择的桩">
|
|
<el-tag
|
|
v-for="tag in updateData.pileSnList"
|
|
:key="tag"
|
|
>
|
|
{{ tag }}
|
|
</el-tag>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="运营商">
|
|
<el-select
|
|
v-model="updateData.merchantId"
|
|
placeholder="请选择运营商"
|
|
@change="
|
|
changeSelectMerchant(updateData.merchantId)
|
|
"
|
|
>
|
|
<el-option
|
|
v-for="item in merchantList"
|
|
:key="item.merchantName"
|
|
:label="item.merchantName"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="站点" prop="stationId">
|
|
<el-select
|
|
v-model="updateData.stationId"
|
|
placeholder="请选择站点"
|
|
filterable
|
|
>
|
|
<el-option
|
|
v-for="item in stationList"
|
|
:key="item.id"
|
|
:label="item.stationName"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="产品型号" prop="modelId">
|
|
<el-select
|
|
v-model="updateData.modelId"
|
|
filterable
|
|
placeholder="请选择产品型号"
|
|
v-selectLoadMore="selectLoadMore"
|
|
>
|
|
<el-option
|
|
v-for="item in modelList"
|
|
:key="item.modelName"
|
|
:label="item.modelName"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="枪口数量" prop="connectorNum">
|
|
<el-input
|
|
v-model="updateData.connectorNum"
|
|
placeholder="请输入枪口数量"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="batchUpdate">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
<!-- 添加或修改设备管理对话框 -->
|
|
<el-dialog :title="title" :visible.sync="openAddDialog" width="50%" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="软件协议" prop="softwareProtocol">
|
|
<el-select
|
|
v-model="form.softwareProtocol"
|
|
placeholder="软件协议"
|
|
clearable
|
|
>
|
|
<el-option
|
|
v-for="dict in dict.type.software_protocol"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="生产日期" prop="productionDate">
|
|
<el-date-picker
|
|
clearable
|
|
v-model="form.productionDate"
|
|
type="date"
|
|
value-format="yyyy-MM-dd"
|
|
placeholder="请选择生产日期"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="产品型号" prop="modelId">
|
|
<el-select
|
|
filterable
|
|
remote
|
|
v-model="form.modelId"
|
|
placeholder="请选择产品型号"
|
|
v-selectLoadMore="selectLoadMore"
|
|
>
|
|
<!-- :remote-method="remoteMethod" -->
|
|
<el-option
|
|
v-for="item in modelList"
|
|
:key="item.modelName"
|
|
:label="item.modelName"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="桩类型" prop="modelId">
|
|
<el-select
|
|
v-model="form.chargerPileType"
|
|
placeholder="请选择桩类型"
|
|
>
|
|
<el-option label="运营桩" value="1"/>
|
|
<el-option label="个人桩" value="2"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<!--<el-form-item label="充电桩型号" prop="modelId">
|
|
<el-input v-model="form.modelId" placeholder="请输入充电桩型号"/>
|
|
</el-form-item>-->
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="枪口数量" prop="connectorNum">
|
|
<el-input
|
|
v-model="form.connectorNum"
|
|
placeholder="请输入枪口数量"
|
|
style="width: 220px"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="生产数量" prop="num">
|
|
<el-input
|
|
v-model="form.num"
|
|
placeholder="请输入生产数量"
|
|
style="width: 220px"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input
|
|
v-model="form.remark"
|
|
placeholder="请输入备注"
|
|
style="width: 95%"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</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 {batchAddBasic, batchUpdatePileList, listBasic, updateBasic} from "@/api/pile/basic";
|
|
import {getMerchantList} from "@/api/pile/merchant";
|
|
import {getStationInfo, getStationListByMerchantId} from "@/api/pile/station";
|
|
import {listModel} from "@/api/pile/model";
|
|
|
|
export default {
|
|
name: "PileList",
|
|
dicts: ["pile_status", "software_protocol", "connector_type", "pile_business_type"],
|
|
props: {
|
|
stationId: "",
|
|
},
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
softwareProtocol: [
|
|
{required: true, message: "请输入软件协议", trigger: "blur"},
|
|
],
|
|
productionDate: [
|
|
{required: true, message: "请选择生产日期", trigger: "blur"},
|
|
],
|
|
modelId: [
|
|
{required: true, message: "请输入产品型号", trigger: "blur"},
|
|
],
|
|
connectorNum: [
|
|
{required: true, message: "请输入枪口数量", trigger: "blur"},
|
|
],
|
|
num: [{required: true, message: "请输入生产数量", trigger: "blur"}],
|
|
remark: [{required: true, message: "请输入备注", trigger: "blur"}],
|
|
},
|
|
// 查询参数
|
|
queryParams: {
|
|
stationId: null,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pileSn: null,
|
|
},
|
|
pileList: [],
|
|
// 选中数组
|
|
ids: [],
|
|
// 是否显示弹出层
|
|
openAddDialog: false,
|
|
openUpdateDialog: false,
|
|
// 弹出层标题
|
|
title: "",
|
|
// 充电站详情
|
|
stationDetail: {},
|
|
// 运营商列表
|
|
merchantList: [],
|
|
// 站点列表
|
|
stationList: [],
|
|
// 更新站点参数
|
|
updateData: {
|
|
merchantId: null,
|
|
stationId: null,
|
|
pileIdList: [],
|
|
pileSnList: [],
|
|
connectorNum: null,
|
|
modelId: null,
|
|
},
|
|
// 型号列表
|
|
modelList: [],
|
|
modelTotal: 0,
|
|
loadMoreFlag: true,
|
|
searchModelParam: {
|
|
name: "",
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
// this.getPileList();
|
|
},
|
|
methods: {
|
|
// 下拉加载更多
|
|
selectLoadMore() {
|
|
console.log("触底了 ", this.searchModelParam.pageSize);
|
|
if (this.loadMoreFlag === false) {
|
|
return;
|
|
}
|
|
this.searchModelParam.pageSize =
|
|
this.searchModelParam.pageSize + 10;
|
|
console.log("触底了执行查询", this.searchModelParam);
|
|
this.getModelList();
|
|
},
|
|
|
|
// 远程搜索
|
|
// remoteMethod(val) {
|
|
// console.log("输入了", val);
|
|
// this.loading = true;
|
|
// this.search.name = val;
|
|
// this.search.start = 1;
|
|
// this.list = [];
|
|
// setTimeout(() => {
|
|
// this.loading = false;
|
|
// this.getModelList();
|
|
// }, 500);
|
|
// },
|
|
|
|
// 分页查询
|
|
getModelList() {
|
|
listModel(this.searchModelParam).then((response) => {
|
|
console.log("分页查询response", response);
|
|
this.modelTotal = response.total;
|
|
this.modelList = response.rows;
|
|
this.loadMoreFlag =
|
|
this.searchModelParam.pageSize <= this.modelTotal;
|
|
});
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getPileList();
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset();
|
|
this.getMerchantList();
|
|
this.queryStationInfo();
|
|
this.title = "批量添加设备";
|
|
this.openAddDialog = true;
|
|
this.getModelList();
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
console.log("提交按钮", this.form);
|
|
this.$refs["form"].validate((valid) => {
|
|
if (valid) {
|
|
if (this.form.id != null) {
|
|
updateBasic(this.form).then((response) => {
|
|
this.$modal.msgSuccess("修改成功");
|
|
this.openAddDialog = false;
|
|
this.getPileList();
|
|
});
|
|
} else {
|
|
batchAddBasic(this.form).then((response) => {
|
|
this.$modal.msgSuccess("新增成功");
|
|
this.openAddDialog = false;
|
|
this.getPileList();
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.queryParams = {
|
|
pageNum: 1,
|
|
};
|
|
// this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
/** 查询充电桩列表 */
|
|
getPileList() {
|
|
this.loading = true;
|
|
this.queryParams.stationId = this.stationId;
|
|
listBasic(this.queryParams).then((response) => {
|
|
this.pileList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
// console.log(this.pileList);
|
|
});
|
|
},
|
|
getMerchantList() {
|
|
getMerchantList().then((response) => {
|
|
this.merchantList = response.rows;
|
|
});
|
|
},
|
|
// 查询站点信息
|
|
queryStationInfo() {
|
|
getStationInfo(this.stationId).then((res) => {
|
|
console.log("查询站点信息:", res);
|
|
this.stationDetail = res.data;
|
|
this.form.merchantId = this.stationDetail.merchantId;
|
|
this.form.stationId = this.stationDetail.id;
|
|
});
|
|
},
|
|
changeSelectMerchant(value) {
|
|
console.log(value);
|
|
// 通过接口查
|
|
getStationListByMerchantId(value).then((response) => {
|
|
this.stationList = response.data;
|
|
});
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
// console.log(selection);
|
|
this.updateData.pileSnList = selection.map((item) => item.pileSn);
|
|
this.updateData.pileIdList = selection.map((item) => item.pileId);
|
|
// console.log(this.updateData.pileIdList);
|
|
},
|
|
/** 按钮操作 */
|
|
handleUpdate() {
|
|
if (this.updateData.pileIdList.length === 0) {
|
|
return this.$message({
|
|
message: "请选择充电桩",
|
|
type: "warning",
|
|
});
|
|
}
|
|
this.getMerchantList();
|
|
this.getModelList();
|
|
this.reset();
|
|
this.openUpdateDialog = true;
|
|
this.title = "更换站点";
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.openAddDialog = false;
|
|
this.openUpdateDialog = false;
|
|
this.reset();
|
|
this.stationList = [];
|
|
},
|
|
// 点击弹框右上角×
|
|
handleClose() {
|
|
this.openAddDialog = false;
|
|
this.openUpdateDialog = false;
|
|
this.reset();
|
|
this.stationList = [];
|
|
},
|
|
reset() {
|
|
this.updateData.merchantId = null;
|
|
this.updateData.stationId = null;
|
|
this.updateData.modelId = null;
|
|
this.updateData.connectorNum = null;
|
|
},
|
|
batchUpdate() {
|
|
if (this.updateData.merchantId === null) {
|
|
return this.$message({
|
|
message: "请选择运营商",
|
|
type: "warning",
|
|
});
|
|
}
|
|
if (this.updateData.stationId === null) {
|
|
return this.$message({
|
|
message: "请选择站点",
|
|
type: "warning",
|
|
});
|
|
}
|
|
console.log("点击批量更新", this.updateData);
|
|
this.loading = true;
|
|
batchUpdatePileList(this.updateData)
|
|
.then((response) => {
|
|
this.loading = false;
|
|
this.$message({
|
|
message: "操作成功",
|
|
type: "success",
|
|
});
|
|
this.openUpdateDialog = false;
|
|
this.getPileList();
|
|
this.stationList = [];
|
|
})
|
|
.catch((error) => {
|
|
this.loading = false;
|
|
console.log(error);
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.el-tag {
|
|
margin-left: 10px;
|
|
}
|
|
</style>
|