Browse Source

哨卡管理 新增,唯一id获取异常bug

master
zhangyongzhangyong 6 years ago
parent
commit
cf71b1d6d1
  1. 51
      src/views/modules/custom/epidemicsentrypost-add-or-update.vue

51
src/views/modules/custom/epidemicsentrypost-add-or-update.vue

@ -1,7 +1,7 @@
<template>
<el-dialog
:visible.sync="visible"
:title="!dataForm.sentryPostCode ? $t('add') : $t('update')"
:title="!dataForm.id ? $t('add') : $t('add')"
:close-on-click-modal="false"
:close-on-press-escape="false"
:append-to-body="true"
@ -16,13 +16,13 @@
<el-form-item label="哨卡编码" prop="sentryPostCode">
<el-input v-model="dataForm.sentryPostCode" placeholder="哨卡编码(唯一性最长6位)" style="width: 800px"></el-input>
</el-form-item>
<el-form-item label="哨卡名称" prop="sentryPostName">
<el-select v-model="dataForm.sentryPostName" clearable filterable
placeholder="请选择" style="width: 800px" @change="selectModel($event)">
<el-form-item label="哨卡名称" prop="id">
<el-select v-model="dataForm.id" clearable filterable
placeholder="请选择" style="width: 800px" >
<el-option v-for="item in verifyOptions"
:key="item.id"
:label="item.sentryPostName"
:value="item.sentryPostName">
:value="item.id">
</el-option>
</el-select>
</el-form-item>
@ -43,7 +43,6 @@ export default {
dataForm: {
id: '',
sentryPostCode: '',
sentryPostName: '',
gridId: ''
},
verifyOptions: []
@ -59,7 +58,7 @@ export default {
trigger: 'blur'
}
],
sentryPostName: [
id: [
{
required: true,
message: this.$t('validate.required'),
@ -76,7 +75,7 @@ export default {
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
// this.getInfo()
}
})
},
@ -92,29 +91,21 @@ export default {
})
.catch(() => {})
},
// value key
selectModel (sentryPostName) {
let obj = {}
obj = this.verifyOptions.find((dataForm) => {
return this.dataForm.sentryPostName === sentryPostName
})
this.dataForm.id = obj.id
},
//
getInfo () {
this.$http
.get(`/news/epidemicSentryPost/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
})
.catch(() => {})
},
// getInfo () {
// this.$http
// .get(`/news/epidemicSentryPost/${this.dataForm.id}`)
// .then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// this.dataForm = {
// ...this.dataForm,
// ...res.data
// }
// })
// .catch(() => {})
// },
//
// sentryPostCodeIsRepeat () {
// if (this.dataForm.sentryPostCode.replace(/\s+/g, '').length === 0) {

Loading…
Cancel
Save