This commit is contained in:
2021-12-14 21:12:32 +08:00
parent 1baad3e64b
commit 38eb8050bd
21 changed files with 412 additions and 212 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: gtz
* @LastEditTime: 2021-12-09 11:21:23
* @LastEditTime: 2021-12-13 16:56:03
* @Description:
-->
<template>
@@ -10,7 +10,7 @@
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form :model="dataForm" ref="dataForm" v-loading="formLoading" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="车辆编码" prop="code">
<el-input v-model="dataForm.code" placeholder="车辆编码"></el-input>
</el-form-item>
@@ -23,6 +23,9 @@
<el-form-item label="IP地址" prop="ip">
<el-input v-model="dataForm.ip" placeholder="IP地址"></el-input>
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input v-model="dataForm.note" placeholder="备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
@@ -41,8 +44,10 @@
code: '',
ip: '',
vehicleName: '',
vehicleAlias: ''
}
vehicleAlias: '',
note: ''
},
formLoading: false
}
},
methods: {
@@ -51,6 +56,7 @@
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.formLoading = true
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/vehicle/get`),
@@ -59,15 +65,23 @@
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm = data.data
} else {
this.$message.error(data.msg)
}
this.formLoading = false
})
} else {
this.$http({
url: this.$http.adornUrl(`/vehicle/codeGenerator`),
method: 'post',
data: this.$http.adornData()
}).then((data) => {
this.dataForm.code = data.data
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.code = data.data
} else {
this.$message.error('编码生成失败')
}
this.formLoading = false
})
}
})
@@ -84,7 +98,8 @@
'code': this.dataForm.code,
'vehicleName': this.dataForm.vehicleName,
'ip': this.dataForm.ip,
'vehicleAlias': this.dataForm.vehicleAlias
'vehicleAlias': this.dataForm.vehicleAlias,
'note': this.dataForm.note
})
}).then(({data}) => {
if (data && data.code === 0) {