opt:增加自动充电功能
This commit is contained in:
@@ -3,7 +3,28 @@
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission" >
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="divOpen"
|
||||
>
|
||||
配置自动充电
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="divOpenStation"
|
||||
>
|
||||
充电桩管理
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
@@ -67,6 +88,8 @@
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<tube-dialog2 :dialog-show.sync="showView2" @AddChanged="querytable" />
|
||||
<station-dialog :dialog-show.sync="showStation" @AddChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -76,6 +99,8 @@ import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import TubeDialog2 from '@/views/system/param/tubeDialog2.vue'
|
||||
import StationDialog from '@/views/system/param/stationDialog.vue'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
@@ -90,7 +115,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'Param',
|
||||
components: { pagination, crudOperation, udOperation },
|
||||
components: { pagination, crudOperation, udOperation, TubeDialog2, StationDialog },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: 'menu.table_title.SystemParam', url: 'api/param', idField: 'id', sort: 'id,desc', crudMethod: { ...crudParam },
|
||||
@@ -110,7 +135,8 @@ export default {
|
||||
edit: ['admin', 'param:edit'],
|
||||
del: ['admin', 'param:del']
|
||||
},
|
||||
|
||||
showView2: false,
|
||||
showStation: false,
|
||||
rules: {
|
||||
id: [
|
||||
{ required: true, message: this.$t('SysParam.rules.NotNull'), trigger: 'blur' }
|
||||
@@ -151,6 +177,15 @@ export default {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
divOpen() {
|
||||
this.showView2 = true
|
||||
},
|
||||
divOpenStation() {
|
||||
this.showStation = true
|
||||
},
|
||||
webSocket() {
|
||||
const that = this
|
||||
if (typeof (WebSocket) === 'undefined') {
|
||||
|
||||
@@ -30,5 +30,35 @@ export function getValueByCode(code) {
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
export function queryParam() {
|
||||
return request({
|
||||
url: '/api/param/queryParam',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getValueByCode }
|
||||
export function setParam(data) {
|
||||
return request({
|
||||
url: 'api/param/setParam',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function showDetail2(params) {
|
||||
return request({
|
||||
url: 'api/dict/showDetail2',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function initDict(data) {
|
||||
return request({
|
||||
url: 'api/dict/initDict',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, getValueByCode, queryParam, setParam, showDetail2, initDict }
|
||||
|
||||
150
acs2/nladmin-ui/src/views/system/param/stationDialog.vue
Normal file
150
acs2/nladmin-ui/src/views/system/param/stationDialog.vue
Normal file
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
v-loading.fullscreen.lock="fullscreenLoading"
|
||||
title="充电桩管理"
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="1200px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<div class="grid-container">
|
||||
<el-table
|
||||
ref="table2"
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
size="mini"
|
||||
:cell-style="cellStyle"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column v-if="false" prop="dict_id" label="uuid" align="center" />
|
||||
<el-table-column min-width="60" prop="label" label="充电桩名称" align="center" />
|
||||
<el-table-column prop="value" label="是否分配车辆(1是0否)" align="center" width="150" />
|
||||
<el-table-column min-width="60" prop="para1" label="充电桩站点" align="center" />
|
||||
<el-table-column min-width="50" prop="para2" label="当前车号" align="center" />
|
||||
<el-table-column min-width="60" prop="use_time" label="充电时长(H)" align="center" :formatter="Myduration" />
|
||||
<el-table-column min-width="60" prop="para3" label="充电状态" align="center" />
|
||||
<el-table-column prop="update_time" label="修改时间" align="center" />
|
||||
<el-table-column prop="update_name" label="修改人" align="center" />
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
label="操作"
|
||||
width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="handleClick(scope.row)" type="danger" size="small">初始化充电桩信息</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudParam, {updateDict} from '@/views/system/param/param'
|
||||
import { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'StationDialog',
|
||||
components: { },
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
fullscreenLoading: false,
|
||||
tableDtl: [],
|
||||
form: {
|
||||
electric: 0,
|
||||
electric2: 0,
|
||||
electric_begin: '06:00',
|
||||
electric_end: '18:00'
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.queryTableDtl()
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.tableDtl = []
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
Myduration(row, column) {
|
||||
const start = new Date(row.update_time)
|
||||
const end = new Date()
|
||||
const diffTime = Math.abs(end - start)
|
||||
let diffDays = 0
|
||||
if (row.para2 && row.para2 !== null) {
|
||||
diffDays = Math.ceil(diffTime / (1000 * 60 * 60)) // 转换为H
|
||||
}
|
||||
return diffDays
|
||||
},
|
||||
handleClick(row) {
|
||||
this.$confirm('此操作将初始化充电桩信息, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.fullscreenLoading = true
|
||||
debugger
|
||||
crudParam.initDict(row).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '初始化成功!'
|
||||
})
|
||||
this.fullscreenLoading = false
|
||||
this.queryTableDtl()
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消操作'
|
||||
})
|
||||
})
|
||||
},
|
||||
cellStyle({ row, column, rowIndex, columnIndex }) {
|
||||
if (column.property === 'use_time') {
|
||||
const start = new Date(row.update_time)
|
||||
const end = new Date()
|
||||
const diffTime = Math.abs(end - start)
|
||||
let diffDays = 0
|
||||
if (row.para2 && row.para2 !== null) {
|
||||
diffDays = Math.ceil(diffTime / (1000 * 60 * 60)) // 转换为H
|
||||
}
|
||||
|
||||
if (diffDays > 0 && diffDays <= 3) {
|
||||
return 'background: #13ce66'
|
||||
} else if (diffDays > 3) {
|
||||
return 'background: red'
|
||||
}
|
||||
}
|
||||
},
|
||||
queryTableDtl() {
|
||||
crudParam.showDetail2({ 'name': 'station' }).then(res => {
|
||||
this.tableDtl = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
136
acs2/nladmin-ui/src/views/system/param/tubeDialog2.vue
Normal file
136
acs2/nladmin-ui/src/views/system/param/tubeDialog2.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
append-to-body
|
||||
title="自动充电配置"
|
||||
:visible.sync="dialogVisible"
|
||||
destroy-on-close
|
||||
width="800px"
|
||||
@close="close"
|
||||
@open="open"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" :inline-message="true" label-width="150px">
|
||||
<el-form-item label="白班充电阈值(%):" prop="electric">
|
||||
<el-input-number v-model="form.electric" size="medium" :min="1" :max="100" :step="1" step-strictly></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="晚班充电阈值(%):" prop="electric2">
|
||||
<el-input-number v-model="form.electric2" size="medium" :min="1" :max="100" step-strictly></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="白班开始时间:" prop="electric_begin">
|
||||
<el-time-select
|
||||
v-model="form.electric_begin"
|
||||
size="medium"
|
||||
:picker-options="{
|
||||
start: '06:00',
|
||||
step: '00:15',
|
||||
end: '12:00'
|
||||
}"
|
||||
placeholder="白班开始时间">
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="白班结束时间:" prop="electric_end">
|
||||
<el-time-select
|
||||
v-model="form.electric_end"
|
||||
size="medium"
|
||||
:picker-options="{
|
||||
start: '18:00',
|
||||
step: '00:15',
|
||||
end: '23:45'
|
||||
}"
|
||||
placeholder="白班结束时间">
|
||||
</el-time-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="save">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudParam from '@/views/system/param/param'
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'TubeDialog2',
|
||||
components: { },
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
rules: {
|
||||
electric: [
|
||||
{ required: true, message: '请输入白班充电阈值(%)', trigger: 'blur' }
|
||||
],
|
||||
electric2: [
|
||||
{ required: true, message: '请输入晚班充电阈值(%)', trigger: 'blur' }
|
||||
],
|
||||
electric_begin: [
|
||||
{ required: true, message: '请输入白班开始时间', trigger: 'blur' }
|
||||
],
|
||||
electric_end: [
|
||||
{ required: true, message: '请输入白班结束时间', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
form: {
|
||||
electric: 0,
|
||||
electric2: 0,
|
||||
electric_begin: '06:00',
|
||||
electric_end: '18:00'
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.queryTableDtl()
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.form.electric = 0
|
||||
this.form.electric2 = 0
|
||||
this.form.electric_begin = '06:00'
|
||||
this.form.electric_end = '18:00'
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
save() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.save_my()
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
save_my() {
|
||||
crudParam.setParam(this.form).then(res => {
|
||||
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.close()
|
||||
})
|
||||
},
|
||||
queryTableDtl() {
|
||||
crudParam.queryParam().then(res => {
|
||||
this.form.electric = res.electric
|
||||
this.form.electric2 = res.electric2
|
||||
this.form.electric_begin = res.electric_begin
|
||||
this.form.electric_end = res.electric_end
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user