From eb4bc778943aa20b6f0a37edb7e42f295ce85bb9 Mon Sep 17 00:00:00 2001 From: a0049873 <79py69t9wb@privaterelay.appleid.com> Date: Mon, 14 Nov 2022 14:48:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=8C=E6=94=BF=E5=8C=BA=E5=9F=9F=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=B0=E5=AD=97=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/sys/region-add-or-update.vue | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/back/src/views/modules/sys/region-add-or-update.vue b/back/src/views/modules/sys/region-add-or-update.vue index fcaa50b8..c76a35f1 100644 --- a/back/src/views/modules/sys/region-add-or-update.vue +++ b/back/src/views/modules/sys/region-add-or-update.vue @@ -8,7 +8,7 @@ - + @@ -26,6 +26,7 @@ import debounce from 'lodash/debounce' export default { data () { return { + flag: true, visible: false, insert: true, regionList: [], @@ -60,7 +61,7 @@ export default { this.visible = true this.dataForm.pid = '0' this.$nextTick(() => { - this.$refs['dataForm'].resetFields() + this.$refs.dataForm.resetFields() this.dataForm.id = id if (this.dataForm.id) { this.insert = false @@ -68,6 +69,13 @@ export default { } }) }, + changeId (val) { + if (val == parseInt(val)) { + this.flag = true + } else { + this.flag = false + } + }, // 获取信息 getInfo () { this.$http.get(`/sys/region/${this.dataForm.id}`).then(({ data: res }) => { @@ -83,10 +91,17 @@ export default { }, // 表单提交 dataFormSubmitHandle: debounce(function () { - this.$refs['dataForm'].validate((valid) => { + this.$refs.dataForm.validate((valid) => { if (!valid) { return false } + if (!this.flag) { + this.$message({ + message: '区域标识只能为数字!', + type: 'warning' + }) + return false + } this.$http[this.insert ? 'post' : 'put']('/sys/region', this.dataForm).then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) @@ -102,7 +117,7 @@ export default { }) }).catch(() => {}) }) - }, 1000, { 'leading': true, 'trailing': false }) + }, 1000, { leading: true, trailing: false }) } }