添加模板类型

This commit is contained in:
2024-02-03 13:58:40 +08:00
parent 796b27e343
commit d471cd3776

View File

@@ -1,143 +1,160 @@
<template> <template>
<div> <div>
<!-- 充电站详情 --> <!-- 充电站详情 -->
<!-- 计费模块 --> <!-- 计费模块 -->
<!-- 按钮栏 --> <!-- 按钮栏 -->
<el-dialog <el-dialog
title="发布计费模板" title="发布计费模板"
background-color:pink background-color:pink
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="30%"
height="50%" height="50%"
> >
<!--<el-date-picker <!--<el-date-picker
v-model="value3" v-model="value3"
type="datetime" type="datetime"
placeholder="选择日期时间" placeholder="选择日期时间"
default-time="12:00:00" default-time="12:00:00"
/>--> />-->
<p style="color:red"> <p style="color:red">
点击立即发布后会将该计费模板下发到当前站点下所有的充电桩上面请注意核对收费金额 点击立即发布后会将该计费模板下发到当前站点下所有的充电桩上面请注意核对收费金额
</p> </p>
<el-descriptions title="" :column="2" border> <el-descriptions title="" :column="2" border>
<el-descriptions-item label="尖时段电费单价">{{billingDetail.electricityPriceA}}</el-descriptions-item> <el-descriptions-item label="尖时段电费单价">{{ billingDetail.electricityPriceA }}
<el-descriptions-item label="尖时段服务费单价">{{billingDetail.servicePriceA}}</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="时段费单价">{{billingDetail.electricityPriceB}}</el-descriptions-item> <el-descriptions-item label="时段服务费单价">{{ billingDetail.servicePriceA }}</el-descriptions-item>
<el-descriptions-item label="峰时段服务费单价">{{billingDetail.servicePriceB}}</el-descriptions-item> <el-descriptions-item label="峰时段费单价">{{ billingDetail.electricityPriceB }}
<el-descriptions-item label="平时段电费单价">{{billingDetail.electricityPriceC}}</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="时段服务费单价">{{billingDetail.servicePriceC}}</el-descriptions-item> <el-descriptions-item label="时段服务费单价">{{ billingDetail.servicePriceB }}</el-descriptions-item>
<el-descriptions-item label="时段电费单价">{{billingDetail.electricityPriceD}}</el-descriptions-item> <el-descriptions-item label="时段电费单价">{{ billingDetail.electricityPriceC }}
<el-descriptions-item label="谷时段服务费单价">{{billingDetail.servicePriceD}}</el-descriptions-item> </el-descriptions-item>
</el-descriptions> <el-descriptions-item label="平时段服务费单价">{{ billingDetail.servicePriceC }}</el-descriptions-item>
<span slot="footer" class="dialog-footer"> <el-descriptions-item label="谷时段电费单价">{{ billingDetail.electricityPriceD }}
</el-descriptions-item>
<el-descriptions-item label="谷时段服务费单价">{{ billingDetail.servicePriceD }}</el-descriptions-item>
</el-descriptions>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="clickPublish"> 立即发布 </el-button> <el-button type="primary" @click="clickPublish"> 立即发布 </el-button>
</span> </span>
</el-dialog> </el-dialog>
<!-- 表单区域 --> <!-- 表单区域 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="info" type="info"
plain plain
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
@click="clickRefresh" @click="clickRefresh"
>刷新</el-button >刷新
</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-plus"
size="mini"
@click="clickImport"
v-has-permi="['billing:template:edit']"
>导入
</el-button>
</el-col>
</el-row>
<!-- 弹框 -->
<el-table
:data="stationBillingTemplate"
style="width: 100%"
v-loading="loading"
> >
</el-col> <el-table-column label="模板编号" prop="templateCode"/>
<el-col :span="1.5"> <el-table-column label="名称" prop="templateName"/>
<el-button <el-table-column label="模板类型" prop="memberFlag">
type="warning" <template slot-scope="scope">
plain <tag v-if="scope.row.memberFlag === '0'">通用计费模板</tag>
icon="el-icon-plus" <tag v-if="scope.row.memberFlag === '1'">会员计费模板</tag>
size="mini" </template>
@click="clickImport" </el-table-column>
v-has-permi = "['billing:template:edit']" <el-table-column label="模板状态" prop="status">
>导入</el-button> <template slot-scope="scope">
</el-col> <dict-tag
</el-row> :options="dict.type.template_status"
<!-- 弹框 --> :value="scope.row.status"
<el-table />
:data="stationBillingTemplate" </template>
style="width: 100%" </el-table-column>
v-loading="loading" <!-- matchCars 使用车辆描述 -->
> <el-table-column label="描述" prop="remark"/>
<el-table-column label="模板编号" prop="templateCode" /> <el-table-column label="设备类型" prop="deviceType">
<el-table-column label="名称" prop="templateName" /> <template slot-scope="scope">
<el-table-column label="模板状态" prop="status" > <dict-tag
<template slot-scope="scope"> :options="dict.type.charger_pile_type"
<dict-tag :value="scope.row.deviceType"
:options="dict.type.template_status" />
:value="scope.row.status" </template>
/> </el-table-column>
</template> <el-table-column label="上次发布时间" prop="publishTime"/>
</el-table-column> <el-table-column label="操作" align="center" width="250">
<!-- matchCars 使用车辆描述 --> <template slot-scope="scope">
<el-table-column label="描述" prop="remark" /> <el-button v-if="scope.row.memberFlag === '0'" type="text" size="small"
<el-table-column label="设备类型" prop="deviceType"> @click="issue(scope.row.templateId)">发布
<template slot-scope="scope"> </el-button>
<dict-tag <el-button v-if="scope.row.memberFlag === '0'" type="text" size="small"
:options="dict.type.charger_pile_type" @click="outerVisible = true">绑定设备
:value="scope.row.deviceType" </el-button>
/> <el-button type="text" size="small" @click="handleUpdate(scope.row.templateId)">修改默认费率
</template> </el-button>
</el-table-column> <el-button type="text" size="small" @click="delBilling(scope.row.templateId)">删除</el-button>
<el-table-column label="上次发布时间" prop="publishTime" /> </template>
<el-table-column label="操作" align="center" width="250"> </el-table-column>
<template slot-scope="scope"> </el-table>
<el-button v-if="scope.row.memberFlag === '0'" type="text" size="small" @click="issue(scope.row.templateId)">发布</el-button> <el-dialog width="70%" title="绑定设备" :visible.sync="outerVisible">
<el-button v-if="scope.row.memberFlag === '0'" type="text" size="small" @click="outerVisible = true">绑定设备</el-button> <BondedDevice ref="bondedDevice"/>
<el-button type="text" size="small" @click="handleUpdate(scope.row.templateId)">修改默认费率</el-button> </el-dialog>
<el-button type="text" size="small" @click="delBilling(scope.row.templateId)">删除</el-button> <!-- 费率详情页 -->
</template> <!-- <el-dialog title="费率详情页" :visible.sync="expDialog" width="30%">
</el-table-column> <Expenses />
</el-table> </el-dialog> -->
<el-dialog width="70%" title="绑定设备" :visible.sync="outerVisible"> <el-dialog title="导入" :visible.sync="expDialog" width="30%">
<BondedDevice ref="bondedDevice" /> <el-form :model="form">
</el-dialog> <el-form-item label="选择计费模板" label-width="100px">
<!-- 费率详情页 --> <el-select
<!-- <el-dialog title="费率详情页" :visible.sync="expDialog" width="30%"> placeholder="请选择选择计费模板"
<Expenses /> v-model="selectTemplateId"
</el-dialog> --> >
<el-dialog title="导入" :visible.sync="expDialog" width="30%"> <el-option
<el-form :model="form"> v-for="item in publicBillingTemplate"
<el-form-item label="选择计费模板" label-width="100px"> :key="item.templateCode"
<el-select :label="item.templateName"
placeholder="请选择选择计费模板" :value="item.templateId"
v-model="selectTemplateId" >
> </el-option>
<el-option </el-select>
v-for="item in publicBillingTemplate" </el-form-item>
:key="item.templateCode" </el-form>
:label="item.templateName" <div slot="footer" class="dialog-footer">
:value="item.templateId" <el-button type="primary" @click="submitBtn">提交</el-button>
> <el-button @click="expDialog = false">取消</el-button>
</el-option> </div>
</el-select> </el-dialog>
</el-form-item> <el-dialog
</el-form> title="修改默认费率"
<div slot="footer" class="dialog-footer"> :visible.sync="amendDialog"
<el-button type="primary" @click="submitBtn">提交</el-button> width="70%"
<el-button @click="expDialog = false">取消</el-button> height="70%"
</div> @close="closeDialog"
</el-dialog> >
<el-dialog <!-- <Amend /> -->
title="修改默认费率" <add-billing
:visible.sync="amendDialog" @success="success"
width="70%" :billingTemplateId="billingTemplateId"
height="70%" ref="addBill"
@close="closeDialog" />
> </el-dialog>
<!-- <Amend /> --> </div>
<add-billing
@success="success"
:billingTemplateId="billingTemplateId"
ref="addBill"
/>
</el-dialog>
</div>
</template> </template>
<script> <script>
@@ -155,202 +172,204 @@ import AddBilling from "../../../billing/template/components/addBilling.vue";
import {updateStation} from "@/api/pile/station"; import {updateStation} from "@/api/pile/station";
export default { export default {
components: { BondedDevice, Expenses, AddBilling }, components: {BondedDevice, Expenses, AddBilling},
dicts: ["charger_pile_type", "template_status"], dicts: ["charger_pile_type", "template_status"],
data() { data() {
return { return {
tableData: [], tableData: [],
// 绑定设备 // 绑定设备
outerVisible: false, outerVisible: false,
// 开关 // 开关
value: true, value: true,
dialogVisible: false, dialogVisible: false,
loading: false, loading: false,
// 选择计费模板弹框 // 选择计费模板弹框
expDialog: false, expDialog: false,
amendDialog: false, amendDialog: false,
// 站点计费模板列表 // 站点计费模板列表
stationBillingTemplate: [], stationBillingTemplate: [],
// 公共计费模板列表 // 公共计费模板列表
publicBillingTemplate: [], publicBillingTemplate: [],
// 选择的计费模板id // 选择的计费模板id
selectTemplateId: "", selectTemplateId: "",
// 发布的计费模板id // 发布的计费模板id
publishTemplateId: "", publishTemplateId: "",
// 日期 // 日期
value3: "", value3: "",
stationId: this.$route.params.id, stationId: this.$route.params.id,
form: { form: {
region: "", region: "",
}, },
// 需要向子组件传递的值 // 需要向子组件传递的值
billingTemplateId: "", billingTemplateId: "",
// 计费详情 // 计费详情
billingDetail: {}, billingDetail: {},
}; };
},
created() {
// 发送请求
// this.templateList();
// this.getStationBillingTemplateList();
},
methods: {
// 新增计费模板
clickAdditional() {
// 打开弹窗
this.amendDialog = true;
console.log("新增计费模板按钮");
}, },
/** 修改按钮操作 */ created() {
handleUpdate(billingTemplateId) { // 发送请求
console.log("点击修改按钮", billingTemplateId); // this.templateList();
this.amendDialog = true; // this.getStationBillingTemplateList();
this.billingTemplateId = String(billingTemplateId);
this.title = "修改计费模板";
},
closeDialog() {
console.log("closeDialog");
this.billingTemplateId = "";
this.clickRefresh();
},
// 通知父 关闭弹框
success() {
this.amendDialog = false;
this.$refs.addBill.resetForm();
this.getStationBillingTemplateList();
},
// 发布按钮
issue(id) {
console.log("发布", id);
this.publishTemplateId = id;
this.queryInfo();
this.dialogVisible = true;
},
// 立即发布按钮
clickPublish() {
this.dialogVisible = false;
const data = {
stationId: this.stationId,
templateId: this.publishTemplateId,
};
publishBillingTemplate(data).then(() => {
this.$message.success("发布计费模板成功");
this.publishTemplateId = "";
this.getStationBillingTemplateList();
});
},
changeStatus(info) {
const param = {
id: info.templateId,
status: info.status,
}
console.log("param", param);
changeStationTemplate(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.getStationBillingTemplateList();
});
},
/** 打开导入表弹窗 */
openImportTable() {
console.log("111");
// this.$refs.import.show();
},
// 按钮 删除功能
delBilling(id) {
console.log("删除", id);
delTemplate(id).then((response) => {
this.$message.success("删除计费模板成功");
this.clickRefresh();
});
}, },
methods: {
// 新增计费模板
clickAdditional() {
// 打开弹窗
this.amendDialog = true;
console.log("新增计费模板按钮");
},
/** 修改按钮操作 */
handleUpdate(billingTemplateId) {
console.log("点击修改按钮", billingTemplateId);
this.amendDialog = true;
this.billingTemplateId = String(billingTemplateId);
this.title = "修改计费模板";
},
closeDialog() {
console.log("closeDialog");
this.billingTemplateId = "";
this.clickRefresh();
},
// 通知父 关闭弹框
success() {
this.amendDialog = false;
this.$refs.addBill.resetForm();
this.getStationBillingTemplateList();
},
// 发布按钮
issue(id) {
console.log("发布", id);
this.publishTemplateId = id;
this.queryInfo();
this.dialogVisible = true;
},
// 立即发布按钮
clickPublish() {
this.dialogVisible = false;
const data = {
stationId: this.stationId,
templateId: this.publishTemplateId,
};
publishBillingTemplate(data).then(() => {
this.$message.success("发布计费模板成功");
this.publishTemplateId = "";
this.getStationBillingTemplateList();
});
},
changeStatus(info) {
const param = {
id: info.templateId,
status: info.status,
}
console.log("param", param);
changeStationTemplate(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.getStationBillingTemplateList();
});
},
/** 打开导入表弹窗 */
openImportTable() {
console.log("111");
// this.$refs.import.show();
},
// 按钮 删除功能
delBilling(id) {
console.log("删除", id);
delTemplate(id).then((response) => {
this.$message.success("删除计费模板成功");
this.clickRefresh();
});
},
// 获取计费模块列表信息 // 获取计费模块列表信息
async templateList() { async templateList() {
const res = await listTemplate(); const res = await listTemplate();
console.log(res); console.log(res);
this.tableData = res.rows; this.tableData = res.rows;
}, },
// 查询公共计费模板 // 查询公共计费模板
getPublicBillingTemplateList() { getPublicBillingTemplateList() {
queryPublicBillingTemplateList().then((response) => { queryPublicBillingTemplateList().then((response) => {
console.log(response.rows); console.log(response.rows);
this.publicBillingTemplate = response.rows; this.publicBillingTemplate = response.rows;
}); });
},
// 查计费模板详情
queryInfo() {
getTemplate(this.publishTemplateId).then((response) => {
console.log("点击发布按钮 查询计费模板详情", response);
this.billingDetail = response.data;
// this.form = response.data;
// console.log("timeArray", this.form.timeArray);
// const selectStartTimeArr = [];
// this.form.timeArray.forEach(x => {
// const startTime = {
// startTime: x.startTime,
// type: x.type
// };
// selectStartTimeArr.push(startTime);
// })
// this.selectStartTime = selectStartTimeArr;
});
},
// 通过站点id查询计费模板
getStationBillingTemplateList() {
// console.log("通过站点id查询计费模板", this.stationId)
queryStationBillingTemplateList(this.stationId).then((response) => {
console.log("通过站点id查询计费模板 result: ", response.rows);
this.stationBillingTemplate = response.rows;
});
},
// 刷新按钮
clickRefresh() {
this.loading = true;
setTimeout(() => {
this.getStationBillingTemplateList();
this.loading = false;
}, 800);
},
clickImport() {
console.log("点击导入");
this.getPublicBillingTemplateList();
this.expDialog = true;
},
// 提交按钮
submitBtn() {
this.expDialog = false;
// console.log("提交成功", this.selectTemplateId, this.stationId);
const data = {
stationId: this.stationId,
billingTemplateId: this.selectTemplateId,
};
stationImportBillingTemplate(data).then((response) => {
this.clickRefresh();
});
},
}, },
// 查计费模板详情 watch: {
queryInfo() { expDialog(newName, oldName) {
getTemplate(this.publishTemplateId).then((response) => { if (newName === false) {
console.log("点击发布按钮 查询计费模板详情", response); this.selectTemplateId = "";
this.billingDetail = response.data; }
// this.form = response.data; },
// console.log("timeArray", this.form.timeArray);
// const selectStartTimeArr = [];
// this.form.timeArray.forEach(x => {
// const startTime = {
// startTime: x.startTime,
// type: x.type
// };
// selectStartTimeArr.push(startTime);
// })
// this.selectStartTime = selectStartTimeArr;
});
}, },
// 通过站点id查询计费模板
getStationBillingTemplateList() {
// console.log("通过站点id查询计费模板", this.stationId)
queryStationBillingTemplateList(this.stationId).then((response) => {
console.log("通过站点id查询计费模板 result: ", response.rows);
this.stationBillingTemplate = response.rows;
});
},
// 刷新按钮
clickRefresh() {
this.loading = true;
setTimeout(() => {
this.getStationBillingTemplateList();
this.loading = false;
}, 800);
},
clickImport() {
console.log("点击导入");
this.getPublicBillingTemplateList();
this.expDialog = true;
},
// 提交按钮
submitBtn() {
this.expDialog = false;
// console.log("提交成功", this.selectTemplateId, this.stationId);
const data = {
stationId: this.stationId,
billingTemplateId: this.selectTemplateId,
};
stationImportBillingTemplate(data).then((response) => {
this.clickRefresh();
});
},
},
watch: {
expDialog(newName, oldName) {
if (newName === false) {
this.selectTemplateId = "";
}
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.demo-table-expand { .demo-table-expand {
font-size: 0; font-size: 0;
} }
.demo-table-expand label { .demo-table-expand label {
width: 90px; width: 90px;
color: #99a9bf; color: #99a9bf;
} }
.demo-table-expand .el-form-item { .demo-table-expand .el-form-item {
margin-right: 0; margin-right: 0;
margin-bottom: 0; margin-bottom: 0;
width: 50%; width: 50%;
} }
</style> </style>