Commit df84feb5 by cwq0219

车辆管理。子系统管理

1 parent cbff9f9b
...@@ -20,7 +20,7 @@ import VRM from 'vue-role-manager' ...@@ -20,7 +20,7 @@ import VRM from 'vue-role-manager'
Vue.use(VRM, { Vue.use(VRM, {
router, router,
redirect: '403', redirect: '403',
enabled:false enabled: false
}) })
// 核心插件 // 核心插件
Vue.use(d2Admin) Vue.use(d2Admin)
......
...@@ -13,5 +13,9 @@ export default [ ...@@ -13,5 +13,9 @@ export default [
title: '车辆管理', title: '车辆管理',
icon: 'folder-o', icon: 'folder-o',
path: '/carManagement' path: '/carManagement'
}, {
title: '子系统管理',
icon: 'folder-o',
path: '/subSysManagement'
} }
] ]
...@@ -59,6 +59,16 @@ const frameIn = [ ...@@ -59,6 +59,16 @@ const frameIn = [
}, },
component: _import('carManagement') component: _import('carManagement')
}, },
// 子系统管理
{
path: 'subSysManagement',
name: 'subSysManagement',
meta: {
title: '子系统管理',
auth: true
},
component: _import('subSysManagement')
},
// 系统 前端日志 // 系统 前端日志
{ {
path: 'log', path: 'log',
......
<!-- 新增/编辑车辆弹窗 -->
import { constants } from 'fs';
<template>
<div>
<el-dialog
:title="!editForm.carNum ? '添加车辆' : '编辑车辆'"
:visible.sync="isVisible"
:before-close="handleClose"
>
<el-form
:model="editForm"
:rules="rules"
ref="editRuleForm"
label-width="100px"
>
<el-form-item
label="车辆编号"
prop="carNum">
<el-input
:disabled="disabled"
v-model="editForm.carNum"
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
<el-form-item label="归属车辆段" prop="belongCar">
<el-select v-model="editForm.belongCar" placeholder="请选择归属车辆段" clearable filterable>
<el-option label="青岛" value="1"></el-option>
<el-option label="深圳" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="维修承包商" prop="repairContractor">
<el-input v-model="editForm.repairContractor" placeholder="请输入维修承包商" clearable></el-input>
</el-form-item>
<el-form-item label="接口开放" prop="interface">
<el-radio v-model="editForm.interface" label="1">是</el-radio>
<el-radio v-model="editForm.interface" label="0">否</el-radio>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="handleConfirm"
>保存</el-button>
<el-button
@click="handleClose"
>取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'EditDialog',
data () {
return {
disabled: false,
rules: {
carNum: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' }
],
belongCar: [
{ required: true, message: '请选择归属车辆段', trigger: 'change' }
],
repairContractor: [
{ required: true, message: '请输入维修承包商', trigger: 'blur' }
],
interface: [
{ required: true, message: '请选择接口开放', trigger: 'change' }
],
}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
editForm: Object
},
watch: {
isVisible(val) {
this.disabled = this.editForm.carNum ? true : false
this.editForm.interface = this.editForm.carNum ? this.editForm.interface : '1'
this.$refs.editRuleForm.resetFields()
}
},
mounted: {},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$refs.editRuleForm.validate((vaild) => {
if(vaild) {
this.$emit('confirmDialog')
}
})
}
}
}
</script>
<style scoped>
</style>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col span="12">车辆列表</el-col> <el-col span="12">车辆列表</el-col>
<el-col span="12" style="text-align: right"> <el-col span="12" style="text-align: right">
<el-button>添加车辆</el-button> <el-button @click="handleAdd">添加车辆</el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -62,6 +62,21 @@ ...@@ -62,6 +62,21 @@
</template> </template>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
@click="handleEdit(scope.$index, scope.row)"
>编辑</el-button>
<el-button
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
background background
...@@ -74,14 +89,33 @@ ...@@ -74,14 +89,33 @@
layout="sizes,total,->,prev,pager,next,jumper" layout="sizes,total,->,prev,pager,next,jumper"
> >
</el-pagination> </el-pagination>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import EditDialog from './editDialog'
export default { export default {
name: 'carManagement', name: 'carManagement',
components: {
EditDialog
},
data () { data () {
return { return {
// 新增/编辑弹窗
editVisible: false,
editForm: {
carNum: '',
belongCar: '',
repairContractor: '',
interface: ''
},
// 搜索
searchForm: { searchForm: {
carNum: '', carNum: '',
belongCar: '', belongCar: '',
...@@ -89,17 +123,17 @@ export default { ...@@ -89,17 +123,17 @@ export default {
status: '' status: ''
}, },
tableData: [{ tableData: [{
carNum: 'CRH45661-5648', carNum: 'CRH45661-0001',
belongCar: '青岛', belongCar: '青岛',
repairContractor: '长春通富机电设备有限公司', repairContractor: '长春通富机电设备有限公司',
interface: '1' interface: '1'
}, { }, {
carNum: 'CRH45661-5648', carNum: 'CRH45661-0002',
belongCar: '青岛', belongCar: '青岛',
repairContractor: '长春通富机电设备有限公司', repairContractor: '长春通富机电设备有限公司',
interface: '0' interface: '0'
}, { }, {
carNum: 'CRH45661-5648', carNum: 'CRH45661-0003',
belongCar: '青岛', belongCar: '青岛',
repairContractor: '长春通富机电设备有限公司', repairContractor: '长春通富机电设备有限公司',
interface: '1' interface: '1'
...@@ -134,21 +168,69 @@ export default { ...@@ -134,21 +168,69 @@ export default {
methods: { methods: {
// 搜索 // 搜索
handleSearch() { handleSearch () {
console.log(this.searchForm) console.log(this.searchForm)
}, },
// 页码 // 页码
handleSizeChange(value) { handleSizeChange (value) {
console.log(value) console.log(value)
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
}, },
handleCurrentChange(value) { handleCurrentChange (value) {
console.log(value) console.log(value)
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
},
resetForm(obj) {
for (var item in obj) {
if (obj[item] instanceof Array) {
obj[item] = []
} else {
obj[item] = ''
}
}
},
handleAdd () {
this.editVisible = !this.editVisible
},
handleEditClose() {
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
},
handleEditConfirm() {
console.log(JSON.parse(JSON.stringify(this.editForm)))
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
},
// 表格-编辑
handleEdit (index, row) {
console.log(index)
console.log(row)
this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible
},
handleDelete (index, row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(index)
console.log(row)
this.$message({
type: 'success',
message: '删除成功'
})
}).catch(err => {})
} }
} }
} }
......
<!-- 新增/编辑车辆弹窗 -->
import { constants } from 'fs';
<template>
<div>
<el-dialog
:title="!editForm.subSystemNum ? '添加子系统' : '编辑子系统'"
:visible.sync="isVisible"
:before-close="handleClose"
>
<el-form
:model="editForm"
:rules="rules"
ref="editRuleForm"
label-width="110px"
>
<el-form-item
label="子系统编号"
prop="subSystemNum">
<el-input
:disabled="disabled"
v-model="editForm.subSystemNum"
placeholder="请输入子系统编号"
></el-input>
</el-form-item>
<el-form-item
label="车辆编号"
prop="carNum">
<el-input
:disabled="disabled"
v-model="editForm.carNum"
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="editForm.type" placeholder="请选择类型" clearable filterable>
<el-option label="座椅" value="1"></el-option>
<el-option label="桌板" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="生产厂家" prop="manufacturer">
<el-input v-model="editForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item>
<el-form-item label="发送结点序列" prop="xl">
<el-input v-model="editForm.xl" placeholder="请输入发送结点序列" clearable></el-input>
</el-form-item>
<el-form-item label="发送节点端口" prop="jk">
<el-input v-model="editForm.jk" placeholder="请输入发送节点端口" clearable></el-input>
</el-form-item>
<el-form-item label="网关地址" prop="wgdz">
<el-input v-model="editForm.wgdz" placeholder="请输入网关地址" clearable></el-input>
</el-form-item>
<el-form-item label="网关端口" prop="wgdk">
<el-input v-model="editForm.wgdk" placeholder="请输入网关端口" clearable></el-input>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="handleConfirm"
>保存</el-button>
<el-button
@click="handleClose"
>取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'EditDialog',
data () {
return {
disabled: false,
rules: {
subSystemNum: [
{ required: true, message: '请输入子系统编号', trigger: 'blur' }
],
carNum: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' }
],
type: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
manufacturer: [
{ required: true, message: '请输入生产厂家', trigger: 'blur' }
],
xl: [
{ required: true, message: '请输入发送节点序列', trigger: 'blur' }
],
jk: [
{ required: true, message: '请输入发送节点端口', trigger: 'blur' }
],
wgdz: [
{ required: true, message: '请输入网关地址', trigger: 'blur' }
],
wgdk: [
{ required: true, message: '请输入网关端口', trigger: 'blur' }
],
}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
editForm: Object
},
watch: {
isVisible(val) {
this.disabled = this.editForm.subSystemNum ? true : false
// this.editForm.interface = this.editForm.carNum ? this.editForm.interface : '1'
this.$refs.editRuleForm.resetFields()
}
},
mounted: {},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$refs.editRuleForm.validate((vaild) => {
if(vaild) {
this.$emit('confirmDialog')
}
})
}
}
}
</script>
<style scoped>
</style>
<!-- 车辆管理 -->
<template>
<d2-container class="carManagement">
<el-form
:inline="true"
:model="searchForm"
label-width="85px"
>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subSystemNum" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="searchForm.type" placeholder="请选择类型" clearable filterable>
<el-option label="座椅" value="1"></el-option>
<el-option label="桌板" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="车辆编号">
<el-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input>
</el-form-item>
<el-form-item label="生产厂家">
<el-input v-model="searchForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col span="12">子系统列表</el-col>
<el-col span="12" style="text-align: right">
<el-button @click="handleAdd">添加子系统</el-button>
</el-col>
</el-row>
<el-table
:data="tableData"
border
style="margin: 20px 0;"
>
<el-table-column
align="center"
width="60px"
label="序号"
type='index'
></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">
{{item.formatter(scope.row)}}
</template>
<template v-else>
{{tableData[scope.$index][item.prop]}}
</template>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
@click="handleEdit(scope.$index, scope.row)"
>编辑</el-button>
<el-button
type="text"
@click="handleDelete(scope.$index, scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
>
</el-pagination>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>
</d2-container>
</template>
<script>
import EditDialog from './editDialog'
export default {
name: 'subSysManagement',
components: {
EditDialog
},
data () {
return {
// 新增/编辑弹窗
editVisible: false,
editForm: {
subSystemNum: '',
type: '',
carNum: '',
manufacturer: '',
xl: '',
jk: '',
wgdz: '',
wgdk: ''
},
// 搜索
searchForm: {
subSystemNum: '',
type: '',
carNum: '',
manufacturer: ''
},
tableData: [{
subSystemNum: '3#1F',
type: '座椅',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
}, {
subSystemNum: '3#2F',
type: '桌板',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
}, {
subSystemNum: '3#3F',
type: '座椅',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
}],
tableColumns: [{
label: '子系统编号',
prop: 'subSystemNum'
}, {
label: '类型',
prop: 'type'
}, {
label: '车辆编号',
prop: 'carNum'
}, {
label: '生产厂家',
prop: 'manufacturer'
}, {
label: '发送结点序列',
prop: 'xl'
}, {
label: '发送结点接口',
prop: 'jk'
}, {
label: '网关地址',
prop: 'wgdz'
}, {
label: '网关端口',
prop: 'wgdk'
}],
// 页码
currentPage: 1,
pageSize: 10,
total: 30
}
},
methods: {
// 搜索
handleSearch () {
console.log(this.searchForm)
},
// 页码
handleSizeChange (value) {
console.log(value)
this.pageSize = value
// 调接口
},
handleCurrentChange (value) {
console.log(value)
this.currentPage = value
// 调接口
},
resetForm(obj) {
for (var item in obj) {
if (obj[item] instanceof Array) {
obj[item] = []
} else {
obj[item] = ''
}
}
},
handleAdd () {
this.editVisible = !this.editVisible
},
handleEditClose() {
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
},
handleEditConfirm() {
console.log(JSON.parse(JSON.stringify(this.editForm)))
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
},
// 表格-编辑
handleEdit (index, row) {
console.log(index)
console.log(row)
this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible
},
handleDelete (index, row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(index)
console.log(row)
this.$message({
type: 'success',
message: '删除成功'
})
}).catch(err => {})
}
}
}
</script>
<style scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!