Files
jsowell-charger-web/jsowell-ui/src/views/pile/station/detail.vue

458 lines
16 KiB
Vue
Raw Normal View History

2023-03-04 16:29:55 +08:00
<template>
2023-08-30 15:07:33 +08:00
<div class="app-container Input">
2023-08-25 15:51:51 +08:00
<el-tabs type="border-card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="订单" name="order">
2023-08-25 17:06:29 +08:00
<stationOrderList ref="order" :stationId="stationId" />
2023-08-25 15:51:51 +08:00
</el-tab-pane>
2023-03-04 16:29:55 +08:00
2023-08-25 15:51:51 +08:00
<el-tab-pane label="设备" name="pile">
2023-08-25 17:06:29 +08:00
<pileList ref="pile" :stationId="stationId" />
2023-08-25 15:51:51 +08:00
</el-tab-pane>
2023-03-04 16:29:55 +08:00
2023-08-25 15:51:51 +08:00
<el-tab-pane label="充电接口" name="connector">
2023-08-25 17:06:29 +08:00
<connectorList ref="connector" :stationId="stationId" />
2023-08-25 15:51:51 +08:00
</el-tab-pane>
2023-03-04 16:29:55 +08:00
2023-08-25 15:51:51 +08:00
<el-tab-pane label="基本资料" name="stationInfo">
<div class="over">
<div id="map_wrap">
2024-01-19 11:03:37 +08:00
<MapContainer ref="map" :stationLat="stationLat" :stationLng="stationLng" />
2023-08-25 15:51:51 +08:00
</div>
<div class="menu">
2023-08-25 17:06:29 +08:00
<site-info ref="stationInfo" />
2023-08-25 15:51:51 +08:00
</div>
</div>
</el-tab-pane>
<el-tab-pane label="计费模块" name="billing">
<!-- billing 文件到时引入 -->
2023-08-25 17:06:29 +08:00
<billing ref="billing" :stationId="stationId" />
2023-08-25 15:51:51 +08:00
</el-tab-pane>
<el-tab-pane label="运营管理" name="operation">
2023-08-25 17:06:29 +08:00
<el-card style="margin-bottom: 10px">
2023-08-25 15:51:51 +08:00
<h2>二维码配置</h2>
2024-01-19 11:03:37 +08:00
<el-form label-position="right" label-width="200px" style="margin-top: 10px">
2023-08-25 15:51:51 +08:00
<el-row>
<el-col :span="12">
<el-form-item label="当前配置二维码规则:">
2024-01-19 11:03:37 +08:00
<el-input v-model="stationDetail.qrcodePrefix" maxlength="100px" :disabled="true" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
2024-01-19 11:03:37 +08:00
<el-button icon="el-icon-setting" size="big" @click="handleCreate"
v-has-permi="['pile:station:edit']">配置参数
2023-08-25 15:51:51 +08:00
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
2023-03-04 16:29:55 +08:00
2023-08-25 15:51:51 +08:00
<el-card>
<h2>互联互通配置</h2>
2024-01-19 11:43:20 +08:00
<!-- <el-button icon="el-icon-edit" size="big" @click="openEdit" v-has-permi="['pile:station:edit']">编辑参数-->
<!-- </el-button>-->
2024-01-19 11:03:37 +08:00
<el-form ref="stationSettingForm" :model="stationSettingInfo" label-position="right" label-width="200px"
style="margin-top: 10px">
2023-08-25 15:51:51 +08:00
<el-row>
<el-col :span="12">
<el-form-item label="对接平台名称:" prop="type">
2024-01-19 11:03:37 +08:00
<el-checkbox-group v-model="checkList">
<el-checkbox v-for="dict in dict.type.third_party_type" :label="dict.label" :key="dict.value"
:value="dict.value" :disabled="firstList.includes(dict.label)"
@change="getPlatform(dict.raw.dictValue)" />
</el-checkbox-group>
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
2024-01-19 11:03:37 +08:00
<el-button size="big" @click="pushStation" v-has-permi="['pile:station:edit']">
2023-08-25 15:51:51 +08:00
推送站点信息
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
2023-05-24 17:06:45 +08:00
2023-08-25 15:51:51 +08:00
<el-card>
<h2>绑定停车平台(配置完成后订单完成将自动下发优惠券)</h2>
2024-01-19 11:03:37 +08:00
<el-button icon="el-icon-edit" size="big" @click="parkingOpenEdit" v-has-permi="['pile:station:edit']">编辑参数
2023-08-25 15:51:51 +08:00
</el-button>
2024-01-19 11:03:37 +08:00
<el-form ref="parkingForm" :model="parkingInfo" label-position="right" label-width="200px"
style="margin-top: 10px">
2023-08-25 15:51:51 +08:00
<el-row>
2023-08-25 17:06:29 +08:00
<el-col :span="5">
2023-08-25 15:51:51 +08:00
<el-form-item label="停车平台名称:" prop="type">
2024-01-19 11:03:37 +08:00
<el-select v-model="parkingInfo.parkingName" placeholder="请选择停车平台名称" clearable filterable
style="width: 220px" :disabled="parkingDisableFlag" @change="getParkingInfo($event)">
<el-option v-for="item in parkingInfoList" :key="item.id" :label="item.parkingName"
:value="item.id" />
2023-08-25 15:51:51 +08:00
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
2023-08-25 17:06:29 +08:00
<el-form-item>
2024-01-19 11:03:37 +08:00
<el-button size="big" @click="saveParkingSetting(parkingInfo.id)" v-has-permi="['pile:station:edit']">
2023-08-25 17:06:29 +08:00
保存
</el-button>
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="停车场库secretKey:" prop="secretKey">
2024-01-19 11:03:37 +08:00
<el-input placeholder="请输入" v-model="parkingInfo.secretKey" :disabled="true" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
2023-08-25 15:50:23 +08:00
2023-08-25 15:51:51 +08:00
<el-col :span="12">
<el-form-item label="停车场库appId:" prop="appId">
2024-01-19 11:03:37 +08:00
<el-input placeholder="请输入" v-model="parkingInfo.appId" :disabled="true" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="票券id:" prop="couponId">
2024-01-19 11:03:37 +08:00
<el-input placeholder="请输入" v-model="parkingInfo.couponId" :disabled="false" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
<el-col :span="12">
2023-08-25 17:06:29 +08:00
<el-form-item label="停车场库商户id:" prop="parkingMerchantId">
2024-01-19 11:03:37 +08:00
<el-input placeholder="请输入" v-model="parkingInfo.parkingMerchantId" :disabled="false" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
2023-08-25 15:50:23 +08:00
2023-08-25 17:06:29 +08:00
<el-card style="margin-top: 10px">
2023-08-25 15:51:51 +08:00
<h2>地锁二维码</h2>
2024-01-19 11:03:37 +08:00
<el-form label-position="right" label-width="200px" style="margin-top: 10px">
2023-08-25 15:51:51 +08:00
<el-row>
<el-col :span="12">
2023-08-25 17:06:29 +08:00
<el-form-item label="查询地锁列表二维码:" />
2023-08-25 15:51:51 +08:00
<div>
2024-01-19 11:03:37 +08:00
<vue-qr ref="Qrcode" :text="queryGroundLockQrCode" qid="lockListQrCode" :width="150"
style="margin-left: 190px; margin-top: -10px" />
2023-08-25 15:51:51 +08:00
</div>
</el-col>
</el-row>
</el-form>
</el-card>
</el-tab-pane>
2023-06-06 08:44:00 +08:00
2023-08-25 15:51:51 +08:00
<el-tab-pane label="站点白名单" name="whitelist">
2023-08-25 17:06:29 +08:00
<whitelist ref="whitelist" :stationId="stationId" />
2023-08-25 15:51:51 +08:00
</el-tab-pane>
2023-08-25 15:51:51 +08:00
<el-tab-pane label="订单日报" name="orderReport">
<order-report ref="orderReport"></order-report>
</el-tab-pane>
</el-tabs>
2023-08-25 15:51:51 +08:00
<el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-form ref="form" :model="form" @submit.native.prevent>
<el-form-item label="二维码前缀:" prop="prefix" label-width="100px">
2024-01-19 11:03:37 +08:00
<el-input v-model="form.prefix" placeholder="请输入二维码前缀" style="width: 300px" />
2023-08-25 15:51:51 +08:00
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" align="center">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
2023-03-04 16:29:55 +08:00
</template>
<script>
import VueQr from "vue-qr";
2023-03-04 16:29:55 +08:00
import Billing from "./components/billing.vue";
import SiteInfo from "./components/SiteInfo.vue";
import connectorList from "./connectorList.vue";
import pileList from "./pileList.vue";
import MapContainer from "../../../components/MapContainer/MapContainer.vue";
import stationOrderList from "@/views/pile/station/stationOrderList";
2023-06-06 13:51:27 +08:00
import stationWhiteList from "@/views/pile/station/stationWhiteList";
import {
2024-01-19 11:03:37 +08:00
getStationInfo,
updateStationQRCodePrefix,
getSettingByStationId,
updateSettingByStationId,
pushStationInfo,
getSettingInfo,
getParkingInfoList,
bindParkingPlatform, getRelationByStationId,
} from "@/api/pile/station";
2023-04-20 15:04:46 +08:00
import Whitelist from "@/views/pile/station/stationWhiteList";
2023-08-25 17:06:29 +08:00
import OrderReport from "./orderReport.vue";
2023-04-20 15:04:46 +08:00
2023-03-04 16:29:55 +08:00
export default {
2023-08-25 15:51:51 +08:00
dicts: ["third_party_type"],
components: {
VueQr,
Whitelist,
SiteInfo,
pileList,
connectorList,
Billing,
MapContainer,
stationOrderList,
stationWhiteList,
2023-08-25 17:06:29 +08:00
OrderReport,
2023-08-25 15:51:51 +08:00
},
data() {
return {
2023-08-25 17:06:29 +08:00
activeName: "pile",
2023-08-25 15:51:51 +08:00
form: {
2023-08-25 17:06:29 +08:00
prefix: "",
2023-08-25 15:51:51 +08:00
},
parkingInfo: {},
parkingInfoList: [],
2023-08-25 17:06:29 +08:00
queryGroundLockQrCode: "",
dialogTitle: "",
qrcodePrefix: "",
2023-08-25 15:51:51 +08:00
dialogFormVisible: false,
2024-01-19 11:03:37 +08:00
checkList: [],
2023-08-25 15:51:51 +08:00
stationId: this.$route.params.id,
stationName: this.$route.params.stationName,
stationDetail: {},
stationLat: null,
stationLng: null,
stationSettingInfo: {},
disableFlag: true,
parkingDisableFlag: true,
2024-01-19 11:03:37 +08:00
exchange: [],
firstList: [], //第一次复选框的默认值
2023-08-25 15:51:51 +08:00
};
},
created() {
// console.log(this.stationId, "充电桩详情 create");
// const stationId = this.stationId;
2023-08-25 17:06:29 +08:00
this.queryGroundLockQrCode =
"https://api.jsowellcloud.com/app-xcx-h5/getGroundLockInfo/" +
this.stationId;
2024-04-22 15:02:55 +08:00
this.updateTitle();
this.getRelationByStationId();
2023-08-25 15:51:51 +08:00
this.getParkingList();
this.queryStationInfo();
},
mounted() {
this.initializeData(this.activeName);
},
methods: {
2024-04-22 15:02:55 +08:00
// 更新页面title显示
updateTitle() {
const stationName = this.stationName;
const title = "【" + stationName + "】站点详情";
const route = Object.assign({}, this.$route, { title: `${title}` });
this.$store.dispatch("tagsView/updateVisitedView", route);
},
2023-08-25 15:51:51 +08:00
handleClick(tab, event) {
// console.log(tab, event);
this.initializeData(tab.name);
},
2023-08-25 15:51:51 +08:00
// 执行对应页面的查询数据方法
initializeData(name) {
2023-08-25 17:06:29 +08:00
console.log("执行对应页面的查询数据方法", name);
2023-08-25 15:51:51 +08:00
if (name === "pile") {
this.$refs.pile.getPileList();
} else if (name === "connector") {
this.$refs.connector.getList();
} else if (name === "billing") {
this.$refs.billing.getStationBillingTemplateList();
} else if (name === "stationInfo") {
this.$refs.map.initMap();
this.$refs.stationInfo.queryStationInfo();
} else if (name === "order") {
this.$refs.order.dataLoading();
2023-08-25 17:06:29 +08:00
} else if (name === "orderReport") {
2023-08-25 15:51:51 +08:00
this.$refs.orderReport.getList();
}
2023-04-10 14:01:48 +08:00
},
2023-08-25 15:51:51 +08:00
queryStationInfo() {
console.log("stationId", this.stationId);
getStationInfo(this.stationId).then((res) => {
// console.log(res);
this.stationDetail = res.data;
2023-08-25 17:06:29 +08:00
this.stationLat = res.data.stationLat;
this.stationLng = res.data.stationLng;
console.log(this.stationLat, this.stationLng, "父组件里面的经纬度");
console.log("res.data", res.data);
2023-08-25 15:51:51 +08:00
if (res.data.parkingId != null) {
2023-08-25 17:06:29 +08:00
this.getParkingInfo(parseInt(res.data.parkingId));
2023-08-25 15:51:51 +08:00
}
});
console.log("queryStationInfo==", this.stationDetail);
},
2023-08-25 15:51:51 +08:00
// 查询站点互联互通配置信息
2024-01-19 11:03:37 +08:00
getRelationByStationId() {
getRelationByStationId(this.stationId).then((res) => {
2023-08-25 17:06:29 +08:00
console.log("stationId:", this.stationId);
console.log("res", res);
console.log("res.rows", res.rows);
2024-01-19 11:03:37 +08:00
res.rows.forEach((item, index) => {
this.checkList.push(item.thirdPartyType);
this.firstList.push(item.thirdPartyType);
})
2024-01-19 11:03:37 +08:00
console.log("this.checkList", this.checkList, this.firstList);
// if (res.data === undefined) {
// this.stationSettingInfo.thirdPartyType = "0";
// } else {
// this.stationSettingInfo = res.data;
// }
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
2023-08-25 15:51:51 +08:00
// 根据对接平台类型查询配置信息
// getSettingParams() {
// const param = {
// // stationId: this.stationId,
// type: this.stationSettingInfo.type,
// };
// console.log("param", param);
// getSettingInfo(param).then((res) => {
// console.log("getSettingInfo", res);
// if (res.data === undefined) {
// this.stationSettingInfo = [];
// } else {
// this.stationSettingInfo = res.data;
// }
// });
// },
2023-08-25 15:50:23 +08:00
2023-08-25 15:51:51 +08:00
// 获取停车平台列表
getParkingList() {
getParkingInfoList().then((response) => {
2023-08-25 17:06:29 +08:00
console.info("response", response);
2023-08-25 15:51:51 +08:00
this.parkingInfoList = response.obj;
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
// 通过id获取停车平台信息
getParkingInfo(parkingId) {
2023-08-25 17:06:29 +08:00
console.log("parkingId", parkingId);
this.parkingInfoList.forEach((item) => {
2023-08-25 15:51:51 +08:00
if (parkingId === item.id) {
2023-08-25 17:06:29 +08:00
console.log("item", item);
2023-08-25 15:51:51 +08:00
this.parkingInfo = item;
2023-08-30 15:07:33 +08:00
console.log("this.parkingInfo", this.parkingInfo);
2023-08-25 15:51:51 +08:00
}
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
2023-05-25 17:23:34 +08:00
2023-08-25 15:51:51 +08:00
// 开放编辑按钮
openEdit() {
this.disableFlag = this.disableFlag === false;
},
parkingOpenEdit() {
2023-08-25 17:06:29 +08:00
this.parkingDisableFlag = !this.parkingDisableFlag;
2023-08-25 15:51:51 +08:00
},
2023-08-25 15:51:51 +08:00
// 提交配置设置
submitConfigForm() {
const param = {
stationId: this.stationId,
urlAddress: this.stationSettingInfo.urlAddress,
operatorId: this.stationSettingInfo.operatorId,
operatorSecret: this.stationSettingInfo.operatorSecret,
dataSecret: this.stationSettingInfo.dataSecret,
signSecret: this.stationSettingInfo.signSecret,
dataSecretIv: this.stationSettingInfo.dataSecretIv,
2023-08-25 17:06:29 +08:00
};
2023-08-25 15:51:51 +08:00
console.log("param:", param);
this.$refs.stationSettingForm.validate((valid) => {
if (valid) {
updateSettingByStationId(param).then((response) => {
2023-08-25 17:06:29 +08:00
this.$modal.msgSuccess("修改成功");
2023-08-25 15:51:51 +08:00
this.disableFlag = true;
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
} else {
2023-08-25 17:06:29 +08:00
return false;
2023-08-25 15:50:23 +08:00
}
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
// 推送站点
pushStation() {
2024-01-19 11:03:37 +08:00
let exchange = ''
2023-08-25 15:51:51 +08:00
const param = {
stationId: this.stationId,
2024-01-19 11:03:37 +08:00
thirdPartyTypes: this.exchange,
2023-08-25 17:06:29 +08:00
};
2024-01-19 11:03:37 +08:00
console.log('param', param);
2023-08-25 15:51:51 +08:00
pushStationInfo(param).then((response) => {
2023-08-25 17:06:29 +08:00
console.log("response", response);
this.$modal.msg(response.obj);
2023-08-25 15:51:51 +08:00
this.disableFlag = true;
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
// 绑定站点与停车平台配置
saveParkingSetting(parkingId) {
2023-08-25 17:06:29 +08:00
console.log("parkingId", parkingId, this.stationId);
2023-08-25 15:51:51 +08:00
const params = {
stationId: this.stationId,
parkingId: parkingId,
2023-08-25 17:06:29 +08:00
};
bindParkingPlatform(params).then((response) => {
console.log("绑定站点与停车平台配置 response", response);
});
2023-08-25 15:51:51 +08:00
},
// 配置参数按钮
handleCreate() {
2023-08-25 17:06:29 +08:00
this.dialogTitle = "配置参数";
2023-08-25 15:51:51 +08:00
this.form = {
2023-08-25 17:06:29 +08:00
prefix: "",
2023-08-25 15:51:51 +08:00
};
this.dialogFormVisible = true;
},
// 配置参数提交按钮
submitForm(form) {
const param = {
stationId: this.stationId,
2023-08-25 17:06:29 +08:00
qrcodePrefix: this.form.prefix,
};
2023-08-25 15:51:51 +08:00
console.log("form:", this.form);
console.log("param:", param);
this.$refs.form.validate((valid) => {
if (valid) {
updateStationQRCodePrefix(param).then((response) => {
2023-08-25 17:06:29 +08:00
this.$modal.msgSuccess("修改成功");
this.dialogFormVisible = false;
});
2023-08-25 15:51:51 +08:00
} else {
2023-08-25 17:06:29 +08:00
return false;
}
2023-08-25 17:06:29 +08:00
});
2023-08-25 15:51:51 +08:00
},
// 取消按钮
cancel() {
2023-08-25 17:06:29 +08:00
this.dialogFormVisible = false;
},
2024-01-19 11:03:37 +08:00
// 复选框状态
getPlatform(id) {
this.exchange.push(id);
}
},
//监听复选框状态
watch: {
checkList: {
handler(newVal) {
this.exchange = newVal.map(item => this.dict.type.third_party_type.find(dict => dict.label === item)?.raw?.dictValue);
},
deep: true,
},
2023-08-25 17:06:29 +08:00
},
2023-03-04 16:29:55 +08:00
};
</script>
<style scoped lang="scss">
#container {
2023-08-25 15:51:51 +08:00
width: 800px;
height: 400px;
// margin-left: 50%; transform: translate(-50%,0);
2023-03-04 16:29:55 +08:00
}
2024-01-19 11:03:37 +08:00
2023-08-30 15:07:33 +08:00
::v-deep .Input .el-input--medium {
2023-08-25 17:06:29 +08:00
width: 400px;
}
2023-03-04 16:29:55 +08:00
</style>