From 49861c1923aa5e6bb383663e54e6280e64a5b4ef Mon Sep 17 00:00:00 2001 From: huangyuxuan Date: Wed, 23 Oct 2024 14:42:19 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E=E6=B5=81=E7=A8=8B]=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=B9=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 27 +++++++++++++++++++ .../PersonManager/user/components/add.vue | 7 ++--- .../PersonManager/user/components/edit.vue | 10 +++++-- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/main.js b/src/main.js index 5e9c056..ebdb7d5 100644 --- a/src/main.js +++ b/src/main.js @@ -74,3 +74,30 @@ new Vue({ components: { App }, template: '' }) + +/** + * json格式转树状结构 + * @param {json} json数据 + * @param {String} id的字符串 + * @param {String} 父id的字符串 + * @param {String} children的字符串 + * @return {Array} 数组 + */ +Vue.prototype.listTransTree = function(json, idStr, pidStr, chindrenStr) { + // eslint-disable-next-line one-var + var r = [], hash = {}, id = idStr, pid = pidStr, children = chindrenStr, i = 0, j = 0, len = json.length + for (; i < len; i++) { + hash[json[i][id]] = json[i] + } + for (; j < len; j++) { + // eslint-disable-next-line one-var + var aVal = json[j], hashVP = hash[aVal[pid]] + if (hashVP) { + !hashVP[children] && (hashVP[children] = []) + hashVP[children].push(aVal) + } else { + r.push(aVal) + } + } + return r +} diff --git a/src/views/PersonManager/user/components/add.vue b/src/views/PersonManager/user/components/add.vue index 2a8396b..2124c47 100644 --- a/src/views/PersonManager/user/components/add.vue +++ b/src/views/PersonManager/user/components/add.vue @@ -437,10 +437,7 @@ export default { } var hasCARD = (rule, value, callback) => { requestFN( - '/user/hasUserCARD', - { - CARD_ID: value - } + '/user/goCheck?CARD_NO=' + value ).then((data) => { if (data.pd) { callback(new Error('身份证号已存在')) @@ -648,7 +645,7 @@ export default { }, { validator: hasCARD, trigger: 'blur' } ], - EMAIL: [{ required: true, message: '电子邮箱不能为空', trigger: 'blur' }], + // EMAIL: [{ required: true, message: '电子邮箱不能为空', trigger: 'blur' }], AGE: [{ required: true, message: '年龄不能为空', trigger: 'blur' }, { pattern: /^\d{2}$/, diff --git a/src/views/PersonManager/user/components/edit.vue b/src/views/PersonManager/user/components/edit.vue index deb203d..e6ad350 100644 --- a/src/views/PersonManager/user/components/edit.vue +++ b/src/views/PersonManager/user/components/edit.vue @@ -67,7 +67,7 @@ - + @@ -91,7 +91,13 @@ - + + + + + + +