1
This commit is contained in:
@@ -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)
|
||||||
|
}
|
||||||
@@ -11,17 +11,18 @@
|
|||||||
</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"
|
||||||
|
@on-page-size-change="onChangePageSize" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@@ -81,12 +82,16 @@
|
|||||||
</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 {
|
||||||
|
age: 1,
|
||||||
|
pageSize: 10,
|
||||||
show_modal: false,
|
show_modal: false,
|
||||||
total: 100,
|
total: 100,
|
||||||
tableHeight: 500,
|
tableHeight: 500,
|
||||||
@@ -95,8 +100,7 @@ export default {
|
|||||||
password: '',
|
password: '',
|
||||||
},
|
},
|
||||||
ruleInline: {},
|
ruleInline: {},
|
||||||
columns: [
|
columns: [{
|
||||||
{
|
|
||||||
title: '站点名称',
|
title: '站点名称',
|
||||||
key: 'charge_station_name',
|
key: 'charge_station_name',
|
||||||
},
|
},
|
||||||
@@ -131,32 +135,69 @@ export default {
|
|||||||
desc: '',
|
desc: '',
|
||||||
},
|
},
|
||||||
ruleValidate: {
|
ruleValidate: {
|
||||||
name: [
|
name: [{
|
||||||
{ required: true, message: 'The name cannot be empty', trigger: 'blur' },
|
required: true,
|
||||||
|
message: 'The name cannot be empty',
|
||||||
|
trigger: 'blur',
|
||||||
|
}],
|
||||||
|
mail: [{
|
||||||
|
required: true,
|
||||||
|
message: 'Mailbox cannot be empty',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'email',
|
||||||
|
message: 'Incorrect email format',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
mail: [
|
city: [{
|
||||||
{ required: true, message: 'Mailbox cannot be empty', trigger: 'blur' },
|
required: true,
|
||||||
{ type: 'email', message: 'Incorrect email format', trigger: 'blur' },
|
message: 'Please select the city',
|
||||||
|
trigger: 'change',
|
||||||
|
}],
|
||||||
|
gender: [{
|
||||||
|
required: true,
|
||||||
|
message: 'Please select gender',
|
||||||
|
trigger: 'change',
|
||||||
|
}],
|
||||||
|
interest: [{
|
||||||
|
required: true,
|
||||||
|
type: 'array',
|
||||||
|
min: 1,
|
||||||
|
message: 'Choose at least one hobby',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'array',
|
||||||
|
max: 2,
|
||||||
|
message: 'Choose two hobbies at best',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
city: [
|
date: [{
|
||||||
{ required: true, message: 'Please select the city', trigger: 'change' },
|
required: true,
|
||||||
],
|
type: 'date',
|
||||||
gender: [
|
message: 'Please select the date',
|
||||||
{ required: true, message: 'Please select gender', trigger: 'change' },
|
trigger: 'change',
|
||||||
],
|
}],
|
||||||
interest: [
|
time: [{
|
||||||
{ required: true, type: 'array', min: 1, message: 'Choose at least one hobby', trigger: 'change' },
|
required: true,
|
||||||
{ type: 'array', max: 2, message: 'Choose two hobbies at best', trigger: 'change' },
|
type: 'string',
|
||||||
],
|
message: 'Please select time',
|
||||||
date: [
|
trigger: 'change',
|
||||||
{ required: true, type: 'date', message: 'Please select the date', trigger: 'change' },
|
}],
|
||||||
],
|
desc: [{
|
||||||
time: [
|
required: true,
|
||||||
{ required: true, type: 'string', message: 'Please select time', trigger: 'change' },
|
message: 'Please enter a personal introduction',
|
||||||
],
|
trigger: 'blur',
|
||||||
desc: [
|
},
|
||||||
{ required: true, message: 'Please enter a personal introduction', trigger: 'blur' },
|
{
|
||||||
{ type: 'string', min: 20, message: 'Introduce no less than 20 words', trigger: 'blur' },
|
type: 'string',
|
||||||
|
min: 20,
|
||||||
|
message: 'Introduce no less than 20 words',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -179,61 +220,97 @@ export default {
|
|||||||
this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130
|
this.tableHeight = window.innerHeight - actionBtnHeight - searchHeight - pageHeight - margins - 130
|
||||||
},
|
},
|
||||||
async getList() {
|
async getList() {
|
||||||
await GetChargeZ({ page: 1 }).then((res) => {
|
await getPileList({
|
||||||
this.total = res.total
|
page: this.page,
|
||||||
this.data = res.data
|
pageSize: this.pageSize,
|
||||||
this.page = res.current_page
|
...this.formInline,
|
||||||
|
}).then((res) => {
|
||||||
|
this.total = res.data.total
|
||||||
|
this.data = res.data.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
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_pile_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 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;
|
||||||
@@ -241,25 +318,27 @@ export default {
|
|||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-container {
|
.table-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.search-area{
|
|
||||||
|
.search-area {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
border: 1px solid #F3F7FD;
|
border: 1px solid #F3F7FD;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -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()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user