NEZ-1237 fix: asset 导入时自动添加的 dc 因没有 longitude,latitude 内容导致编辑 dc 时报错
This commit is contained in:
@@ -70,7 +70,8 @@ import latlngPicker from '../latlngPicker'
|
||||
import editRigthBox from '../mixin/editRigthBox'
|
||||
import { noSpecialChar, latlng } from '@/components/common/js/validate'
|
||||
|
||||
const regNum = /^[0-9]+.?[0-9]*/
|
||||
const latitudeNum = /^[\-\+]?([1-8]?\d{1}\.\d{1,7}|90\.0{1,7}|[1-8]?\d{1}|90)$/ // 纬度正则验证
|
||||
const longitudeNum = /^[\-\+]?(0?\d{1,2}\.\d{1,7}|1[0-7]?\d{1}\.\d{1,7}|180\.0{1,7}|0?\d{1,2}|1[0-7]?\d{1}|180)$/ // 经度正则验证
|
||||
|
||||
export default {
|
||||
name: 'dcBox',
|
||||
@@ -139,10 +140,10 @@ export default {
|
||||
const attr = this.$refs.latlngPicker.getAttribute()
|
||||
param.latitude = attr.latitude
|
||||
param.longitude = attr.longitude
|
||||
if (!regNum.test(param.longitude)) {
|
||||
if (!longitudeNum.test(param.longitude)) {
|
||||
param.longitude = null
|
||||
}
|
||||
if (!regNum.test(param.latitude)) {
|
||||
if (!latitudeNum.test(param.latitude)) {
|
||||
param.latitude = null
|
||||
}
|
||||
this.$post('/dc', param).then(response => {
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'changePin',
|
||||
props: {
|
||||
curUser: { type: String },
|
||||
showDialog: { type: Boolean, default: false }
|
||||
},
|
||||
data () {
|
||||
const temp = this
|
||||
const validatePass = (rule, value, callback) => {
|
||||
@@ -54,12 +50,11 @@ export default {
|
||||
}
|
||||
return {
|
||||
user: {
|
||||
username: '',
|
||||
pin: '',
|
||||
newPin: '',
|
||||
confirmPin: ''
|
||||
},
|
||||
sysUser: sessionStorage.getItem('nz-username'),
|
||||
userId: localStorage.getItem('nz-user-id'),
|
||||
rules: {
|
||||
pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
newPin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: validatePass, trigger: 'blur' }],
|
||||
@@ -68,9 +63,7 @@ export default {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.user.username = this.curUser && this.curUser != '' ? this.curUser : sessionStorage.getItem('nz-username')
|
||||
},
|
||||
created () {},
|
||||
methods: {
|
||||
dialogOpened: function () {
|
||||
if (this.$refs.changePinForm) {
|
||||
@@ -88,9 +81,10 @@ export default {
|
||||
if (valid) {
|
||||
const paramObj = {
|
||||
pin: this.user.pin,
|
||||
newPin: this.user.newPin
|
||||
newPin: this.user.newPin,
|
||||
id: this.userId
|
||||
}
|
||||
this.$put('/sys/user/pin?oldPin=' + paramObj.pin + '&newPin=' + paramObj.newPin).then(response => {
|
||||
this.$put('/sys/user/pin?oldPin=' + paramObj.pin + '&newPin=' + paramObj.newPin + '&id=' + paramObj.id).then(response => {
|
||||
if (response && response.code == 200) {
|
||||
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
|
||||
this.user.pin = ''
|
||||
@@ -103,11 +97,6 @@ export default {
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
showDialog: function (n, o) {
|
||||
this.visible = n
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user