Commit 0fa854df by cwq0219

接口修改

1 parent 55928a93
import request from './request'
const path = 'fims.subsystem.'
const methods = {
Add: `${path}add`,
Edit: `${path}edit`
}
function getListApi (data) {
data.method = `${path}list`
return request(data)
}
function editApi (data) {
return request(data)
}
function removeApi (data) {
data.method = `${path}remove`
return request(data)
}
export {
getListApi,
methods,
editApi,
removeApi
}
\ No newline at end of file \ No newline at end of file
const sysMonitorPath = 'fims.system.'
const trafficManagePath = 'fims.traffic.'
const sysMonitorMethods = {
Search: `${sysMonitorPath}list`,
Report: `${sysMonitorPath}report`
}
const trafficManageMethods = {
Add: `${trafficManagePath}add`,
Search: `${trafficManagePath}list`,
Edit: `${trafficManagePath}edit`,
Remove: `${trafficManagePath}remove`
}
export {
sysMonitorMethods,
trafficManageMethods
}
import request from './request' import request from './request'
const sysMonitorPath = 'fims.system.' const path = 'fims.system.'
function getListApi (data) { function getListApi (data) {
data.method = `${sysMonitorPath}list` data.method = `${path}list`
return request(data) return request(data)
} }
function reportApi (data) { function reportApi (data) {
data.method = `${sysMonitorPath}report` data.method = `${path}report`
return request(data) return request(data)
} }
......
import request from './request' import request from './request'
const trafficManagePath = 'fims.traffic.' const path = 'fims.traffic.'
function getListApi (data) { const methods = {
data.method = `${trafficManagePath}list` Add: `${path}add`,
return request(data) Edit: `${path}edit`
} }
function addApi (data) { function getListApi (data) {
data.method = `${trafficManagePath}add` data.method = `${path}list`
return request(data) return request(data)
} }
// function addApi (data) {
// data.method = `${path}add`
// return request(data)
// }
function editApi (data) { function editApi (data) {
data.method = `${trafficManagePath}edit` // data.method = `${path}edit`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi (data) {
data.method = `${trafficManagePath}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
export { export {
getListApi, getListApi,
addApi, methods,
// addApi,
editApi, editApi,
removeApi removeApi
} }
\ No newline at end of file \ No newline at end of file
...@@ -87,14 +87,14 @@ export const resources = { ...@@ -87,14 +87,14 @@ export const resources = {
}, },
component: _import('demo/page3') component: _import('demo/page3')
}, },
// '103': { // '102': {
// path: 'trafficManagement', // path: 'trafficManagement',
// icon: 'folder-o', // icon: 'folder-o',
// name: '车辆管理', // name: '车辆管理',
// meta: { // meta: {
// auth: true, // auth: true,
// title: '车辆管理', // title: '车辆管理',
// id: '103', // id: '102',
// pid: '0' // pid: '0'
// }, // },
// component: _import('trafficManagement') // component: _import('trafficManagement')
...@@ -114,10 +114,10 @@ export const resources = { ...@@ -114,10 +114,10 @@ export const resources = {
'104': { '104': {
path: 'trafficManagement', path: 'trafficManagement',
icon: 'folder-o', icon: 'folder-o',
name: '物料管理', name: '车辆管理',
meta: { meta: {
auth: true, auth: true,
title: '物料管理', title: '车辆管理',
id: '104', id: '104',
pid: '0' pid: '0'
}, },
......
...@@ -3,7 +3,7 @@ import { constants } from 'fs'; ...@@ -3,7 +3,7 @@ import { constants } from 'fs';
<template> <template>
<div> <div>
<el-dialog <el-dialog
:title="!editForm.subSystemNum ? '添加子系统' : '编辑子系统'" :title="!editForm.subsystemCode ? '添加子系统' : '编辑子系统'"
:visible.sync="isVisible" :visible.sync="isVisible"
:before-close="handleClose" :before-close="handleClose"
> >
...@@ -15,42 +15,42 @@ import { constants } from 'fs'; ...@@ -15,42 +15,42 @@ import { constants } from 'fs';
> >
<el-form-item <el-form-item
label="子系统编号" label="子系统编号"
prop="subSystemNum"> prop="subsystemCode">
<el-input <el-input
:disabled="disabled" :disabled="disabled"
v-model="editForm.subSystemNum" v-model="editForm.subsystemCode"
placeholder="请输入子系统编号" placeholder="请输入子系统编号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="车辆编号" label="车辆编号"
prop="carNum"> prop="trafficCode">
<el-input <el-input
:disabled="disabled" :disabled="disabled"
v-model="editForm.carNum" v-model="editForm.trafficCode"
placeholder="请输入车辆编号" placeholder="请输入车辆编号"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="systemType">
<el-select v-model="editForm.type" placeholder="请选择类型" clearable filterable> <el-select v-model="editForm.systemType" placeholder="请选择类型" clearable filterable>
<el-option label="座椅" value="1"></el-option> <el-option label="座椅" value="1"></el-option>
<el-option label="桌板" value="2"></el-option> <el-option label="桌板" value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="生产厂家" prop="manufacturer"> <el-form-item label="生产厂家" prop="merchantName">
<el-input v-model="editForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input> <el-input v-model="editForm.merchantName" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发送结点序列" prop="xl"> <el-form-item label="发送结点序列" prop="sendSequence">
<el-input v-model="editForm.xl" placeholder="请输入发送结点序列" clearable></el-input> <el-input v-model="editForm.sendSequence" placeholder="请输入发送结点序列" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="发送节点端口" prop="jk"> <el-form-item label="发送节点端口" prop="sendPort">
<el-input v-model="editForm.jk" placeholder="请输入发送节点端口" clearable></el-input> <el-input v-model="editForm.sendPort" placeholder="请输入发送节点端口" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="网关地址" prop="wgdz"> <el-form-item label="网关地址" prop="gatewayUrl">
<el-input v-model="editForm.wgdz" placeholder="请输入网关地址" clearable></el-input> <el-input v-model="editForm.gatewayUrl" placeholder="请输入网关地址" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="网关端口" prop="wgdk"> <el-form-item label="网关端口" prop="gatewayPort">
<el-input v-model="editForm.wgdk" placeholder="请输入网关端口" clearable></el-input> <el-input v-model="editForm.gatewayPort" placeholder="请输入网关端口" clearable></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
...@@ -73,28 +73,28 @@ export default { ...@@ -73,28 +73,28 @@ export default {
return { return {
disabled: false, disabled: false,
rules: { rules: {
subSystemNum: [ subsystemCode: [
{ required: true, message: '请输入子系统编号', trigger: 'blur' } { required: true, message: '请输入子系统编号', trigger: 'blur' }
], ],
carNum: [ trafficCode: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' } { required: true, message: '请输入车辆编号', trigger: 'blur' }
], ],
type: [ systemType: [
{ required: true, message: '请选择类型', trigger: 'change' } { required: true, message: '请选择类型', trigger: 'change' }
], ],
manufacturer: [ merchantName: [
{ required: true, message: '请输入生产厂家', trigger: 'blur' } { required: true, message: '请输入生产厂家', trigger: 'blur' }
], ],
xl: [ sendSequence: [
{ required: true, message: '请输入发送节点序列', trigger: 'blur' } { required: true, message: '请输入发送节点序列', trigger: 'blur' }
], ],
jk: [ sendPort: [
{ required: true, message: '请输入发送节点端口', trigger: 'blur' } { required: true, message: '请输入发送节点端口', trigger: 'blur' }
], ],
wgdz: [ gatewayUrl: [
{ required: true, message: '请输入网关地址', trigger: 'blur' } { required: true, message: '请输入网关地址', trigger: 'blur' }
], ],
wgdk: [ gatewayPort: [
{ required: true, message: '请输入网关端口', trigger: 'blur' } { required: true, message: '请输入网关端口', trigger: 'blur' }
] ]
} }
...@@ -110,8 +110,7 @@ export default { ...@@ -110,8 +110,7 @@ export default {
watch: { watch: {
isVisible (val) { isVisible (val) {
this.disabled = !!this.editForm.subSystemNum this.disabled = this.editForm.subsystemCode ? true : false
// this.editForm.interface = this.editForm.carNum ? this.editForm.interface : '1'
this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm.resetFields()
} }
}, },
......
...@@ -7,19 +7,19 @@ ...@@ -7,19 +7,19 @@
label-width="85px" label-width="85px"
> >
<el-form-item label="子系统编号"> <el-form-item label="子系统编号">
<el-input v-model="searchForm.subSystemNum" placeholder="请输入子系统编号" clearable></el-input> <el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="类型"> <el-form-item label="类型">
<el-select v-model="searchForm.type" placeholder="请选择类型" clearable filterable> <el-select v-model="searchForm.systemTypeCode" placeholder="请选择类型" clearable filterable>
<el-option label="座椅" value="1"></el-option> <el-option label="座椅" value="1"></el-option>
<el-option label="桌板" value="2"></el-option> <el-option label="桌板" value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="车辆编号"> <el-form-item label="车辆编号">
<el-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input> <el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="生产厂家"> <el-form-item label="生产厂家">
<el-input v-model="searchForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input> <el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button> <el-button type="primary" @click="handleSearch">查询</el-button>
...@@ -97,6 +97,8 @@ ...@@ -97,6 +97,8 @@
<script> <script>
import EditDialog from './editDialog' import EditDialog from './editDialog'
import { getListApi, methods, editApi, removeApi } from '@api/subSysManagement'
import notice from '@/common/notice'
export default { export default {
name: 'subSysManagement', name: 'subSysManagement',
components: { components: {
...@@ -107,74 +109,74 @@ export default { ...@@ -107,74 +109,74 @@ export default {
// 新增/编辑弹窗 // 新增/编辑弹窗
editVisible: false, editVisible: false,
editForm: { editForm: {
subSystemNum: '', subsystemCode: '',
type: '', systemType: '',
carNum: '', trafficCode: '',
manufacturer: '', merchantName: '',
xl: '', sendSequence: '',
jk: '', sendPort: '',
wgdz: '', gatewayUrl: '',
wgdk: '' gatewayPort: ''
}, },
// 搜索 // 搜索
searchForm: { searchForm: {
subSystemNum: '', subsystemCode: '',
type: '', systemTypeCode: '',
carNum: '', trafficCode: '',
manufacturer: '' merchantName: ''
}, },
tableData: [{ tableData: [{
subSystemNum: '3#1F', subsystemCode: '3#1F',
type: '座椅', systemType: '座椅',
carNum: 'CRH45661-5648', trafficCode: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司', merchantName: '长春通富机电设备有限公司',
xl: '1.56', sendSequence: '1.56',
jk: '4000', sendPort: '4000',
wgdz: '192.168.1.1', gatewayUrl: '192.168.1.1',
wgdk: '8000' gatewayPort: '8000'
}, { }, {
subSystemNum: '3#2F', subsystemCode: '3#2F',
type: '桌板', systemType: '桌板',
carNum: 'CRH45661-5648', trafficCode: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司', merchantName: '长春通富机电设备有限公司',
xl: '1.56', sendSequence: '1.56',
jk: '4000', sendPort: '4000',
wgdz: '192.168.1.1', gatewayUrl: '192.168.1.1',
wgdk: '8000' gatewayPort: '8000'
}, { }, {
subSystemNum: '3#3F', subsystemCode: '3#3F',
type: '座椅', systemType: '座椅',
carNum: 'CRH45661-5648', trafficCode: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司', merchantName: '长春通富机电设备有限公司',
xl: '1.56', sendSequence: '1.56',
jk: '4000', sendPort: '4000',
wgdz: '192.168.1.1', gatewayUrl: '192.168.1.1',
wgdk: '8000' gatewayPort: '8000'
}], }],
tableColumns: [{ tableColumns: [{
label: '子系统编号', label: '子系统编号',
prop: 'subSystemNum' prop: 'subsystemCode'
}, { }, {
label: '类型', label: '类型',
prop: 'type' prop: 'systemType'
}, { }, {
label: '车辆编号', label: '车辆编号',
prop: 'carNum' prop: 'trafficCode'
}, { }, {
label: '生产厂家', label: '生产厂家',
prop: 'manufacturer' prop: 'merchantName'
}, { }, {
label: '发送结点序列', label: '发送结点序列',
prop: 'xl' prop: 'sendSequence'
}, { }, {
label: '发送结点接口', label: '发送结点接口',
prop: 'jk' prop: 'sendPort'
}, { }, {
label: '网关地址', label: '网关地址',
prop: 'wgdz' prop: 'gatewayUrl'
}, { }, {
label: '网关端口', label: '网关端口',
prop: 'wgdk' prop: 'gatewayPort'
}], }],
// 页码 // 页码
currentPage: 1, currentPage: 1,
...@@ -183,10 +185,49 @@ export default { ...@@ -183,10 +185,49 @@ export default {
} }
}, },
mounted() {
this.loadingGetList()
},
methods: { methods: {
loadingGetList () {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams () {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
editSubSystem(value) {
const params = value
params.method = value.id ? methods.Edit : methods.Add
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch () {
console.log(this.searchForm) console.log(this.searchForm)
this.loadingGetList()
}, },
// 页码 // 页码
...@@ -194,12 +235,14 @@ export default { ...@@ -194,12 +235,14 @@ export default {
console.log(value) console.log(value)
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange (value) {
console.log(value) console.log(value)
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList()
}, },
resetForm (obj) { resetForm (obj) {
...@@ -213,18 +256,22 @@ export default { ...@@ -213,18 +256,22 @@ export default {
}, },
handleAdd () { handleAdd () {
console.log(this.editForm)
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleEditClose () { handleEditClose () {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
this.resetForm(this.editForm) this.resetForm(this.editForm)
console.log(this.editForm)
}, },
handleEditConfirm () { handleEditConfirm () {
console.log(JSON.parse(JSON.stringify(this.editForm))) console.log(JSON.parse(JSON.stringify(this.editForm)))
this.editVisible = !this.editVisible var editParams = JSON.parse(JSON.stringify(this.editForm))
this.resetForm(this.editForm) this.editSubSystem(this.editForm)
// this.editVisible = !this.editVisible
// this.resetForm(this.editForm)
}, },
// 表格-编辑 // 表格-编辑
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<script> <script>
import EditDialog from './editDialog' import EditDialog from './editDialog'
import { getListApi, addApi, editApi, removeApi } from '@api/trafficManagement' import { getListApi, methods, editApi, removeApi } from '@api/trafficManagement'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'trafficManagement', name: 'trafficManagement',
...@@ -175,7 +175,6 @@ export default { ...@@ -175,7 +175,6 @@ export default {
}, },
getList () { getList () {
const params = this.getParams() const params = this.getParams()
// params.method = trafficManageMethods.Search
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res this.tableData = res
this.tableLoading = false this.tableLoading = false
...@@ -184,9 +183,10 @@ export default { ...@@ -184,9 +183,10 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
addTraffic(value) { editTraffic(value) {
const params = value const params = value
addApi(params).then(res => { params.method = value.id ? methods.Edit : methods.Add
editApi(params).then(res => {
this.handleEditClose() this.handleEditClose()
notice.okTips() notice.okTips()
this.loadingGetList() this.loadingGetList()
...@@ -227,19 +227,20 @@ export default { ...@@ -227,19 +227,20 @@ export default {
}, },
handleAdd () { handleAdd () {
console.log(this.editForm)
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleEditClose () { handleEditClose () {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
this.resetForm(this.editForm) this.resetForm(this.editForm)
console.log(this.editForm)
}, },
handleEditConfirm () { handleEditConfirm () {
console.log(JSON.parse(JSON.stringify(this.editForm))) console.log(JSON.parse(JSON.stringify(this.editForm)))
var editParams = JSON.parse(JSON.stringify(this.editForm)) var editParams = JSON.parse(JSON.stringify(this.editForm))
// this.editVisible = !this.editVisible this.editTraffic(editParams)
// this.resetForm(this.editForm)
}, },
// 表格-编辑 // 表格-编辑
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!