This commit is contained in:
MeSHard
2025-11-19 15:51:58 +08:00
parent 89369e9cf6
commit 2ff30e8249
4 changed files with 490 additions and 330 deletions

BIN
dist.zip

Binary file not shown.

View File

@@ -425,3 +425,44 @@ export function getYunYingData(params) {
export function getCaiWuData(params) { export function getCaiWuData(params) {
return request.get('/getCaiWuData', { params }) return request.get('/getCaiWuData', { params })
} }
// 充电站列表
export function getStationList(params) {
return request.get('/getStationList', { params })
}
// 添加充电站
export function addPosition(params) {
return request.post('/addPosition', params)
}
// 充电站详情
export function getStationRead(params) {
return request.get('/getStationRead', { params })
}
// 充电站修改
export function getStationUpdate(params) {
return request.post('/getStationUpdate', params)
}
// 充电站删除
export function getStationDelete(params) {
return request.post('/getStationDelete', params)
}
// 充电桩列表
export function getPileList(params) {
return request.get('/getPileList', { params })
}
// 添加充电桩
export function addPile(params) {
return request.post('/addPile', params)
}
// 充电桩详情
export function getPileRead(params) {
return request.get('/getPileRead', { params })
}
// 充电桩修改
export function getPileUpdate(params) {
return request.post('/getPileUpdate', params)
}
// 充电桩删除
export function getPileDelete(params) {
return request.post('/getPileDelete', params)
}

View File

@@ -1,265 +1,344 @@
<template> <template>
<div class="container"> <div class="container">
<div class="search-area"> <div class="search-area">
<Form ref="formInline" inline :label-width="120" :model="formInline" :rules="ruleInline"> <Form ref="formInline" inline :label-width="120" :model="formInline" :rules="ruleInline">
<FormItem prop="user" label="充电桩名称:"> <FormItem prop="user" label="充电桩名称:">
<Input type="text" v-model="formInline.user" placeholder="" /> <Input type="text" v-model="formInline.user" placeholder="" />
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit('formInline')">搜索</Button> <Button type="primary" @click="handleSubmit('formInline')">搜索</Button>
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
<div class="action-btn"> <div class="action-btn">
<Button type="primary" @click="show_modal = true">添加</Button> <Button type="primary" @click="add">添加</Button>
<!-- <Button type="error">删除</Button> --> <!-- <Button type="error">删除</Button> -->
</div> </div>
<div class="table-container"> <div class="table-container">
<Table border :columns="columns" stripe :height="tableHeight" :data="data"> <Table border :columns="columns" stripe :height="tableHeight" :data="data">
<template #action="{ row, index }"> <template #action="{ row, index }">
<Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">编辑</Button> <Button type="primary" size="small" style="margin-right: 5px" @click="show(row.charge_pile_id)">编辑</Button>
<Button type="error" size="small" @click="remove(index)">删除</Button> <Button type="error" size="small" @click="remove(row.charge_pile_id)">删除</Button>
</template> </template>
</Table> </Table>
<Page :total="total" show-total show-sizer class="page" /> <Page :total="total" show-total show-sizer class="page" @on-change="onChangePage"
</div> @on-page-size-change="onChangePageSize" />
</div>
<!-- 添加编辑 --> <!-- 添加编辑 -->
<Modal v-model="show_modal" title="Common Modal dialog box title" :mask-closable="false" @on-ok="ok" <Modal v-model="show_modal" title="Common Modal dialog box title" :mask-closable="false" @on-ok="ok"
@on-cancel="cancel"> @on-cancel="cancel">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80"> <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
<FormItem label="Name" prop="name"> <FormItem label="Name" prop="name">
<Input v-model="formValidate.name" placeholder="Enter your name" /> <Input v-model="formValidate.name" placeholder="Enter your name" />
</FormItem> </FormItem>
<FormItem label="E-mail" prop="mail"> <FormItem label="E-mail" prop="mail">
<Input v-model="formValidate.mail" placeholder="Enter your e-mail" /> <Input v-model="formValidate.mail" placeholder="Enter your e-mail" />
</FormItem> </FormItem>
<FormItem label="City" prop="city"> <FormItem label="City" prop="city">
<Select v-model="formValidate.city" placeholder="Select your city"> <Select v-model="formValidate.city" placeholder="Select your city">
<Option value="beijing">New York</Option> <Option value="beijing">New York</Option>
<Option value="shanghai">London</Option> <Option value="shanghai">London</Option>
<Option value="shenzhen">Sydney</Option> <Option value="shenzhen">Sydney</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem label="Date"> <FormItem label="Date">
<Row> <Row>
<Col span="11"> <Col span="11">
<DatePicker type="date" placeholder="Select date" v-model="formValidate.date"></DatePicker> <DatePicker type="date" placeholder="Select date" v-model="formValidate.date"></DatePicker>
</Col> </Col>
<Col span="2" style="text-align: center">-</Col> <Col span="2" style="text-align: center">-</Col>
<Col span="11"> <Col span="11">
<TimePicker type="time" placeholder="Select time" v-model="formValidate.time"></TimePicker> <TimePicker type="time" placeholder="Select time" v-model="formValidate.time"></TimePicker>
</Col> </Col>
</Row> </Row>
</FormItem> </FormItem>
<FormItem label="Gender" prop="gender"> <FormItem label="Gender" prop="gender">
<RadioGroup v-model="formValidate.gender"> <RadioGroup v-model="formValidate.gender">
<Radio label="male">Male</Radio> <Radio label="male">Male</Radio>
<Radio label="female">Female</Radio> <Radio label="female">Female</Radio>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem label="Hobby" prop="interest"> <FormItem label="Hobby" prop="interest">
<CheckboxGroup v-model="formValidate.interest"> <CheckboxGroup v-model="formValidate.interest">
<Checkbox label="Eat"></Checkbox> <Checkbox label="Eat"></Checkbox>
<Checkbox label="Sleep"></Checkbox> <Checkbox label="Sleep"></Checkbox>
<Checkbox label="Run"></Checkbox> <Checkbox label="Run"></Checkbox>
<Checkbox label="Movie"></Checkbox> <Checkbox label="Movie"></Checkbox>
</CheckboxGroup> </CheckboxGroup>
</FormItem> </FormItem>
<FormItem label="Desc" prop="desc"> <FormItem label="Desc" prop="desc">
<Input v-model="formValidate.desc" type="textarea" :autosize="{ minRows: 2, maxRows: 5 }" <Input v-model="formValidate.desc" type="textarea" :autosize="{ minRows: 2, maxRows: 5 }"
placeholder="Enter something..." /> placeholder="Enter something..." />
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit2('formValidate')">Submit</Button> <Button type="primary" @click="handleSubmit2('formValidate')">Submit</Button>
<Button @click="handleReset('formValidate')" style="margin-left: 8px">Reset</Button> <Button @click="handleReset('formValidate')" style="margin-left: 8px">Reset</Button>
</FormItem> </FormItem>
</Form> </Form>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import { GetChargeZ } from '@/api' import {
getPileList, addPile, getPileRead, getPileUpdate, getPileDelete,
} from '@/api'
export default { export default {
name: 'charging_station', name: 'charging_station',
data() { data() {
return { return {
show_modal: false, age: 1,
total: 100, pageSize: 10,
tableHeight: 500, show_modal: false,
formInline: { total: 100,
user: '', tableHeight: 500,
password: '', formInline: {
}, user: '',
ruleInline: {}, password: '',
columns: [ },
{ ruleInline: {},
title: '站点名称', columns: [{
key: 'charge_station_name', title: '站点名称',
}, key: 'charge_station_name',
{ },
title: '充电桩编号', {
key: 'ConnectorID', title: '充电桩编号',
}, key: 'ConnectorID',
{ },
title: '充电桩状态', {
key: 'status_text', title: '充电桩状态',
}, key: 'status_text',
{ },
title: '位号', {
key: 'no', title: '位号',
}, key: 'no',
{ },
title: '操作', {
slot: 'action', title: '操作',
width: 150, slot: 'action',
align: 'center', width: 150,
}, align: 'center',
], },
data: [], ],
formValidate: { data: [],
name: '', formValidate: {
mail: '', name: '',
city: '', mail: '',
gender: '', city: '',
interest: [], gender: '',
date: '', interest: [],
time: '', date: '',
desc: '', time: '',
}, desc: '',
ruleValidate: { },
name: [ ruleValidate: {
{ required: true, message: 'The name cannot be empty', trigger: 'blur' }, name: [{
], required: true,
mail: [ message: 'The name cannot be empty',
{ required: true, message: 'Mailbox cannot be empty', trigger: 'blur' }, trigger: 'blur',
{ type: 'email', message: 'Incorrect email format', trigger: 'blur' }, }],
], mail: [{
city: [ required: true,
{ required: true, message: 'Please select the city', trigger: 'change' }, message: 'Mailbox cannot be empty',
], trigger: 'blur',
gender: [ },
{ required: true, message: 'Please select gender', trigger: 'change' }, {
], type: 'email',
interest: [ message: 'Incorrect email format',
{ required: true, type: 'array', min: 1, message: 'Choose at least one hobby', trigger: 'change' }, trigger: 'blur',
{ type: 'array', max: 2, message: 'Choose two hobbies at best', trigger: 'change' }, },
], ],
date: [ city: [{
{ required: true, type: 'date', message: 'Please select the date', trigger: 'change' }, required: true,
], message: 'Please select the city',
time: [ trigger: 'change',
{ required: true, type: 'string', message: 'Please select time', trigger: 'change' }, }],
], gender: [{
desc: [ required: true,
{ required: true, message: 'Please enter a personal introduction', trigger: 'blur' }, message: 'Please select gender',
{ type: 'string', min: 20, message: 'Introduce no less than 20 words', trigger: 'blur' }, trigger: 'change',
], }],
}, interest: [{
} required: true,
}, type: 'array',
mounted() { min: 1,
this.getList() message: 'Choose at least one hobby',
this.calculateTableHeight() trigger: 'change',
window.addEventListener('resize', this.calculateTableHeight) },
}, {
beforeDestroy() { type: 'array',
window.removeEventListener('resize', this.calculateTableHeight) max: 2,
}, message: 'Choose two hobbies at best',
methods: { trigger: 'change',
calculateTableHeight() { },
// 计算表格高度 = 窗口高度 - 搜索区域高度 - 分页高度 - 其他间距 ],
const searchHeight = document.querySelector('.search-area').offsetHeight date: [{
const actionBtnHeight = document.querySelector('.action-btn').offsetHeight required: true,
const pageHeight = 32 // 分页组件大约高度 type: 'date',
const margins = 40 // 上下边距总和 message: 'Please select the date',
this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130 trigger: 'change',
}, }],
async getList() { time: [{
await GetChargeZ({ page: 1 }).then((res) => { required: true,
this.total = res.total type: 'string',
this.data = res.data message: 'Please select time',
this.page = res.current_page trigger: 'change',
}) }],
}, desc: [{
handleSubmit(name) { required: true,
this.$refs[name].validate((valid) => { message: 'Please enter a personal introduction',
if (valid) { trigger: 'blur',
this.$Message.success('Success!') },
} else { {
this.$Message.error('Fail!') type: 'string',
} min: 20,
}) message: 'Introduce no less than 20 words',
}, trigger: 'blur',
handleReset(name) { },
this.$refs[name].resetFields() ],
}, },
handleSubmit2(name) { }
this.$refs[name].validate((valid) => { },
if (valid) { mounted() {
this.$Message.success('Success!') this.getList()
} else { this.calculateTableHeight()
this.$Message.error('Fail!') window.addEventListener('resize', this.calculateTableHeight)
} },
}) beforeDestroy() {
}, window.removeEventListener('resize', this.calculateTableHeight)
show(index) { },
this.$Modal.info({ methods: {
title: 'User Info', calculateTableHeight() {
content: `Name${this.data[index].name}<br>Age${this.data[index].age}<br>Address${this.data[index].address}`, // 计算表格高度 = 窗口高度 - 搜索区域高度 - 分页高度 - 其他间距
}) const searchHeight = document.querySelector('.search-area').offsetHeight
}, const actionBtnHeight = document.querySelector('.action-btn').offsetHeight
remove(index) { const pageHeight = 32 // 分页组件大约高度
this.data.splice(index, 1) const margins = 40 // 上下边距总和
}, this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130
ok() { },
this.$Message.info('Clicked ok') async getList() {
}, await getPileList({
cancel() { page: this.page,
this.$Message.info('Clicked cancel') pageSize: this.pageSize,
}, ...this.formInline,
}, }).then((res) => {
} this.total = res.data.total
this.data = res.data.data
})
},
handleSubmit() {
this.getList()
},
add() {
this.show_modal = true
this.$refs.formValidate.resetFields()
this.formValidate.charge_pile_id = ''
},
cancel() {
this.$refs.formValidate.resetFields()
this.show_modal = false
},
async show(id) {
await getPileRead({ id }).then(res => {
this.formValidate = { ...res.data }
this.show_modal = true
})
},
async remove(id) {
const confirm = await new Promise(resolve => {
this.$Modal.confirm({
title: '确认删除',
content: '您确定要删除此项吗?',
onOk: () => resolve(true),
onCancel: () => resolve(false),
})
})
if (!confirm) {
this.$Message.info('已取消删除')
return
}
await getPileDelete({ id }).then(res => {
this.$Message.success(res.msg)
this.getList()
})
},
async ok() {
const valid = await new Promise(resolve => this.$refs.formValidate.validate(resolve))
if (!valid) {
this.$Message.error('请正确填写表单')
return
}
if (this.formValidate.charge_station_id) {
await getPileUpdate(this.formValidate).then(res => {
this.$Message.success(res.msg)
this.getList()
this.cancel()
})
} else {
await addPile(this.formValidate).then((res) => {
this.$Message.success(res.msg)
this.cancel()
this.getList()
})
}
},
onChangePage(e) {
if (this.page != e) {
this.page = e
this.getList()
}
},
onChangePageSize(e) {
if (this.pageSize != e) {
this.page = 1
this.pageSize = e
this.getList()
}
},
},
}
</script> </script>
<style scoped> <style scoped>
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
.action-btn { .action-btn {
margin: 20px 0; margin: 20px 0;
background-color: white; background-color: white;
padding: 20px; padding: 20px;
border: 1px solid #F3F7FD; border: 1px solid #F3F7FD;
border-radius: 15px; border-radius: 15px;
display: flex; display: flex;
align-items: center; align-items: center;
button {
margin-right: 20px;
}
}
.table-container { button {
flex: 1; margin-right: 20px;
display: flex; }
flex-direction: column; }
}
.page { .table-container {
margin-top: 10px; flex: 1;
text-align: right; display: flex;
} flex-direction: column;
.search-area{ }
background-color: white;
padding-top: 20px; .page {
border: 1px solid #F3F7FD; margin-top: 10px;
border-radius: 15px; text-align: right;
} }
.search-area {
background-color: white;
padding-top: 20px;
border: 1px solid #F3F7FD;
border-radius: 15px;
}
</style> </style>

View File

@@ -3,7 +3,7 @@
<div class="search-area"> <div class="search-area">
<Form ref="formInline" inline :label-width="120" :model="formInline" :rules="ruleInline"> <Form ref="formInline" inline :label-width="120" :model="formInline" :rules="ruleInline">
<FormItem prop="user" label="站点名称:"> <FormItem prop="user" label="站点名称:">
<Input type="text" v-model="formInline.user" placeholder="" /> <Input type="text" clearable v-model="formInline.charge_station_name" placeholder="" />
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit('formInline')">搜索</Button> <Button type="primary" @click="handleSubmit('formInline')">搜索</Button>
@@ -11,20 +11,20 @@
</Form> </Form>
</div> </div>
<div class="action-btn"> <div class="action-btn">
<Button type="primary" @click="show_modal = true">添加</Button> <Button type="primary" @click="show">添加</Button>
<!-- <Button type="error">删除</Button> --> <!-- <Button type="error">删除</Button> -->
</div> </div>
<div class="table-container"> <div class="table-container">
<Table border :columns="columns" stripe :height="tableHeight" :data="data"> <Table border :columns="columns" stripe :height="tableHeight" :data="data">
<template #action="{ row, index }"> <template #action="{ row, index }">
<Button type="primary" size="small" style="margin-right: 5px" @click="show(index)">编辑</Button> <Button type="primary" size="small" style="margin-right: 5px" @click="show(row.charge_station_id)">编辑</Button>
<Button type="error" size="small" @click="remove(index)">删除</Button> <Button type="error" size="small" @click="remove(row.charge_station_id)">删除</Button>
</template> </template>
</Table> </Table>
<Page :total="total" show-total show-sizer class="page" /> <Page :total="total" show-total show-sizer class="page" @on-change="onChangePage"
@on-page-size-change="onChangePageSize" />
</div> </div>
<!-- 添加编辑 --> <!-- 添加编辑 -->
<Modal v-model="show_modal" title="添加站点" :mask-closable="false"> <Modal v-model="show_modal" title="添加站点" :mask-closable="false">
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80"> <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
@@ -34,15 +34,17 @@
<FormItem label="站点编号" prop="charge_station_number"> <FormItem label="站点编号" prop="charge_station_number">
<Input v-model="formValidate.charge_station_number" placeholder="站点编号" /> <Input v-model="formValidate.charge_station_number" placeholder="站点编号" />
</FormItem> </FormItem>
<FormItem label="城市" prop="city"> <FormItem label="" prop="city">
<Select v-model="formValidate.city" placeholder="Select your city"> <Input v-model="formValidate.city" placeholder="省" />
<Option value="beijing">New York</Option>
<Option value="shanghai">London</Option>
<Option value="shenzhen">Sydney</Option>
</Select>
</FormItem> </FormItem>
<FormItem label="地址" prop="address"> <FormItem label="" prop="area">
<Input v-model="formValidate.address" placeholder="地址" /> <Input v-model="formValidate.area" placeholder="" />
</FormItem>
<FormItem label="县" prop="street">
<Input v-model="formValidate.street" placeholder="县" />
</FormItem>
<FormItem label="详细地址" prop="address">
<Input v-model="formValidate.address" placeholder="详细地址" />
</FormItem> </FormItem>
<FormItem label="联系电话" prop="charge_station_phone"> <FormItem label="联系电话" prop="charge_station_phone">
<Input v-model="formValidate.charge_station_phone" placeholder="联系电话" /> <Input v-model="formValidate.charge_station_phone" placeholder="联系电话" />
@@ -53,12 +55,6 @@
<FormItem label="纬度" prop="latitude"> <FormItem label="纬度" prop="latitude">
<Input v-model="formValidate.latitude" placeholder="纬度" /> <Input v-model="formValidate.latitude" placeholder="纬度" />
</FormItem> </FormItem>
<FormItem label="电费" prop="ElectricityFee">
<Input v-model="formValidate.ElectricityFee" placeholder="电费" />
</FormItem>
<FormItem label="服务费" prop="ServiceFee">
<Input v-model="formValidate.ServiceFee" placeholder="服务费" />
</FormItem>
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="text" @click="cancel">取消</Button> <Button type="text" @click="cancel">取消</Button>
@@ -70,7 +66,7 @@
<script> <script>
import { import {
GetPosition, getStationList, addPosition, getStationRead, getStationUpdate, getStationDelete,
} from '@/api' } from '@/api'
export default { export default {
@@ -78,11 +74,12 @@
data() { data() {
return { return {
show_modal: false, show_modal: false,
page: 1,
pageSize: 10,
total: 100, total: 100,
tableHeight: 500, tableHeight: 500,
formInline: { formInline: {
user: '', charge_station_name: '',
password: '',
}, },
ruleInline: {}, ruleInline: {},
columns: [{ columns: [{
@@ -105,14 +102,6 @@
title: '纬度', title: '纬度',
key: 'latitude', key: 'latitude',
}, },
{
title: '电价',
key: 'ElectricityFee',
},
{
title: '服务费',
key: 'ServiceFee',
},
{ {
title: '操作', title: '操作',
slot: 'action', slot: 'action',
@@ -125,42 +114,58 @@
charge_station_name: '', charge_station_name: '',
charge_station_number: '', charge_station_number: '',
city: '', city: '',
area: '',
street: '',
address: '',
charge_station_phone: '', charge_station_phone: '',
longitude: [], longitude: [],
latitude: '', latitude: '',
ElectricityFee: '',
ServiceFee: '',
}, },
ruleValidate: { ruleValidate: {
charge_station_name: [{ charge_station_name: [{
required: true, required: true,
message: 'The name cannot be empty', message: '请输入站点名称',
trigger: 'blur', trigger: 'blur',
}], }],
charge_station_number: [{ charge_station_number: [{
required: true, required: true,
message: 'Mailbox cannot be empty', message: '请输入站点编号',
trigger: 'blur', trigger: 'blur',
}], }],
city: [{ city: [{
required: true, required: true,
message: 'Please select the city', message: '请输入省',
trigger: 'change',
}],
area: [{
required: true,
message: '请输入市',
trigger: 'change',
}],
street: [{
required: true,
message: '请输入县',
trigger: 'change', trigger: 'change',
}], }],
address: [{ address: [{
required: true, required: true,
message: 'Please select gender', message: '请输入详细地址',
trigger: 'change',
}],
charge_station_phone: [{
required: true,
message: '请输入联系电话',
trigger: 'change', trigger: 'change',
}], }],
longitude: [{ longitude: [{
required: true, required: true,
message: 'Please select the date', message: '请输入精度',
trigger: 'change', trigger: 'blur',
}], }],
latitude: [{ latitude: [{
required: true, required: true,
message: 'Please select time', message: '请输入纬度',
trigger: 'change', trigger: 'blur',
}], }],
}, },
} }
@@ -183,49 +188,84 @@
this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130 this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130
}, },
async getList() { async getList() {
await GetPosition({ await getStationList({
page: 1, page: this.page,
pageSize: this.pageSize,
...this.formInline,
}).then((res) => { }).then((res) => {
this.total = res.total this.total = res.data.total
this.data = res.data this.data = res.data.data
this.page = res.current_page
}) })
}, },
handleSubmit(name) { handleSubmit() {
this.$refs[name].validate((valid) => { this.getList()
if (valid) {
this.$Message.success('Success!')
} else {
this.$Message.error('Fail!')
}
})
}, },
handleReset(name) { add() {
this.$refs[name].resetFields() this.show_modal = true
}, this.$refs.formValidate.resetFields()
handleSubmit2(name) { this.formValidate.charge_station_id = ''
this.$refs[name].validate((valid) => {
if (valid) {
this.$Message.success('Success!')
} else {
this.$Message.error('Fail!')
}
})
},
show(index) {
this.$Modal.info({
title: 'User Info',
content: `Name${this.data[index].name}<br>Age${this.data[index].age}<br>Address${this.data[index].address}`,
})
},
remove(index) {
this.data.splice(index, 1)
},
ok() {
this.$Message.info('Clicked ok')
}, },
cancel() { cancel() {
this.$Message.info('Clicked cancel') this.$refs.formValidate.resetFields()
this.show_modal = false
},
// 详情
async show(id) {
await getStationRead({ id }).then(res => {
this.formValidate = { ...res.data }
this.show_modal = true
})
},
async remove(id) {
const confirm = await new Promise(resolve => {
this.$Modal.confirm({
title: '确认删除',
content: '您确定要删除此项吗?',
onOk: () => resolve(true),
onCancel: () => resolve(false),
})
})
if (!confirm) {
this.$Message.info('已取消删除')
return
}
await getStationDelete({ id }).then(res => {
this.$Message.success(res.msg)
this.getList()
})
},
async ok() {
const valid = await new Promise(resolve => this.$refs.formValidate.validate(resolve))
if (!valid) {
this.$Message.error('请正确填写表单')
return
}
if (this.formValidate.charge_station_id) {
await getStationUpdate(this.formValidate).then(res => {
this.$Message.success(res.msg)
this.getList()
this.cancel()
})
} else {
await addPosition(this.formValidate).then((res) => {
this.$Message.success(res.msg)
this.cancel()
this.getList()
})
}
},
onChangePage(e) {
if (this.page != e) {
this.page = e
this.getList()
}
},
onChangePageSize(e) {
if (this.pageSize != e) {
this.page = 1
this.pageSize = e
this.getList()
}
}, },
}, },
} }