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 @@ - + + + + + + +