From e443fc657f39242d0168ea4db57c51e250f2006d Mon Sep 17 00:00:00 2001 From: "luoJunYong.123" Date: Thu, 16 Dec 2021 10:27:27 +0800 Subject: [PATCH] check_update --- .../manage/list/acceptanceDraft/invoice.vue | 11 +++-- src/pages/manage/list/cityWide/cityWideIn.vue | 17 ++++--- .../manage/list/cityWide/cityWideOut.vue | 15 +++--- src/utils/utilFunction.js | 49 +++++++++++++------ 4 files changed, 57 insertions(+), 35 deletions(-) diff --git a/src/pages/manage/list/acceptanceDraft/invoice.vue b/src/pages/manage/list/acceptanceDraft/invoice.vue index 4429707..0ee041f 100644 --- a/src/pages/manage/list/acceptanceDraft/invoice.vue +++ b/src/pages/manage/list/acceptanceDraft/invoice.vue @@ -11,13 +11,13 @@ - + - + @@ -26,7 +26,7 @@ - + import { vername, vermob } from '@/utils/verify.js' -import { checkRequired, ismoney } from '@/utils/utilFunction.js' +import { checkRequired, ismoney, checkHanzi } from '@/utils/utilFunction.js' export default { name: 'index', @@ -159,7 +159,8 @@ export default { console.log('校验成功') } }, - ismoney: ismoney + ismoney: ismoney, + checkHanzi: checkHanzi } } diff --git a/src/pages/manage/list/cityWide/cityWideIn.vue b/src/pages/manage/list/cityWide/cityWideIn.vue index 3619e98..a04d449 100644 --- a/src/pages/manage/list/cityWide/cityWideIn.vue +++ b/src/pages/manage/list/cityWide/cityWideIn.vue @@ -13,7 +13,7 @@ - + @@ -26,13 +26,13 @@ - + - + - + @@ -51,10 +51,10 @@ - + - + @@ -93,7 +93,7 @@ diff --git a/src/pages/manage/list/cityWide/cityWideOut.vue b/src/pages/manage/list/cityWide/cityWideOut.vue index 0e9f5ad..e89e60e 100644 --- a/src/pages/manage/list/cityWide/cityWideOut.vue +++ b/src/pages/manage/list/cityWide/cityWideOut.vue @@ -13,7 +13,7 @@ - + @@ -26,7 +26,7 @@ - + - + @@ -52,10 +52,10 @@ - + - + @@ -91,7 +91,7 @@ diff --git a/src/utils/utilFunction.js b/src/utils/utilFunction.js index df7b917..87d633f 100644 --- a/src/utils/utilFunction.js +++ b/src/utils/utilFunction.js @@ -10,21 +10,26 @@ const mailBoxListen = function(val, form, prop) { form[prop] = val; } } -const checkRequired = function(form, obj) { - for(const prop in obj) { - if(form[prop] === '') { - MessageBox.alert('请填写' + obj[prop], '提示', { - type: 'info', - confirmButtonText: '确定' - }); - return false - } + +// 校验中文 +const checkHanzi = function(val, form, prop) { + // 检查空格 + const tmpCheck = val.substr(val.length-1, 1); + if(tmpCheck === ' ') { + return; + } + if(!/[\u4E00-\u9FA5]/i.test(val)) { + form[prop] = val; } - return true; } // 监听数字 const inputListen = function(val, row, prop) { + // 检查空格 + const tmpCheck = val.substr(val.length-1, 1); + if(tmpCheck === ' ') { + return; + } if(val === '') { row[prop] = val; return; @@ -33,7 +38,11 @@ const inputListen = function(val, row, prop) { } const ismoney = function(val, row, prop) { - + // 检查空格 + const tmpCheck = val.substr(val.length-1, 1); + if(tmpCheck === ' ') { + return; + } // const reg = /([1-9]\d{0,9}|0)(\.\d{1,2})?$/ // 不用保留 const reg2 = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; // 保留小数点后两位 if (reg2.test(Number(val)) || val==='') { @@ -41,14 +50,24 @@ const ismoney = function(val, row, prop) { } } -/* -刷卡器逻辑 -*/ +const checkRequired = function(form, obj) { + for(const prop in obj) { + if(form[prop] === '') { + MessageBox.alert('请填写' + obj[prop], '提示', { + type: 'info', + confirmButtonText: '确定' + }); + return false + } + } + return true; +} export { phoneListen, mailBoxListen, checkRequired, inputListen, - ismoney + ismoney, + checkHanzi } \ No newline at end of file