shuishen
2024-01-05 50d114ffb36cd494b0708206c6ca49e99d85a855
住户管理--房屋管理下住户新增:
字段调整,显示调整、校验添加
3 files modified
1124 ■■■■■ changed files
src/util/util.js 241 ●●●●● patch | view | raw | blame | history
src/views/userHouse/components/householdManager.vue 428 ●●●●● patch | view | raw | blame | history
src/views/userHouse/houseHoldList.vue 455 ●●●●● patch | view | raw | blame | history
src/util/util.js
@@ -1,53 +1,55 @@
import {validatenull} from './validate'
import { validatenull } from "./validate";
//表单序列化
export const serialize = data => {
export const serialize = (data) => {
  let list = [];
  Object.keys(data).forEach(ele => {
    list.push(`${ele}=${data[ele]}`)
  })
  return list.join('&');
  Object.keys(data).forEach((ele) => {
    list.push(`${ele}=${data[ele]}`);
  });
  return list.join("&");
};
export const getObjType = obj => {
export const getObjType = (obj) => {
  var toString = Object.prototype.toString;
  var map = {
    '[object Boolean]': 'boolean',
    '[object Number]': 'number',
    '[object String]': 'string',
    '[object Function]': 'function',
    '[object Array]': 'array',
    '[object Date]': 'date',
    '[object RegExp]': 'regExp',
    '[object Undefined]': 'undefined',
    '[object Null]': 'null',
    '[object Object]': 'object'
    "[object Boolean]": "boolean",
    "[object Number]": "number",
    "[object String]": "string",
    "[object Function]": "function",
    "[object Array]": "array",
    "[object Date]": "date",
    "[object RegExp]": "regExp",
    "[object Undefined]": "undefined",
    "[object Null]": "null",
    "[object Object]": "object",
  };
  if (obj instanceof Element) {
    return 'element';
    return "element";
  }
  return map[toString.call(obj)];
};
export const getViewDom = () => {
  return window.document.getElementById('avue-view').getElementsByClassName('el-scrollbar__wrap')[0]
}
  return window.document
    .getElementById("avue-view")
    .getElementsByClassName("el-scrollbar__wrap")[0];
};
/**
 * 对象深拷贝
 */
export const deepClone = data => {
export const deepClone = (data) => {
  var type = getObjType(data);
  var obj;
  if (type === 'array') {
  if (type === "array") {
    obj = [];
  } else if (type === 'object') {
  } else if (type === "object") {
    obj = {};
  } else {
    //不再具有下一层次
    return data;
  }
  if (type === 'array') {
  if (type === "array") {
    for (var i = 0, len = data.length; i < len; i++) {
      obj.push(deepClone(data[i]));
    }
  } else if (type === 'object') {
  } else if (type === "object") {
    for (var key in data) {
      obj[key] = deepClone(data[key]);
    }
@@ -59,9 +61,9 @@
 */
export const toggleGrayMode = (status) => {
  if (status) {
    document.body.className = document.body.className + ' grayMode';
    document.body.className = document.body.className + " grayMode";
  } else {
    document.body.className = document.body.className.replace(' grayMode', '');
    document.body.className = document.body.className.replace(" grayMode", "");
  }
};
/**
@@ -69,32 +71,25 @@
 */
export const setTheme = (name) => {
  document.body.className = name;
}
};
/**
 * 加密处理
 */
export const encryption = (params) => {
  let {
    data,
    type,
    param,
    key
  } = params;
  let { data, type, param, key } = params;
  let result = JSON.parse(JSON.stringify(data));
  if (type == 'Base64') {
    param.forEach(ele => {
  if (type == "Base64") {
    param.forEach((ele) => {
      result[ele] = btoa(result[ele]);
    })
  } else if (type == 'Aes') {
    param.forEach(ele => {
    });
  } else if (type == "Aes") {
    param.forEach((ele) => {
      result[ele] = window.CryptoJS.AES.encrypt(result[ele], key).toString();
    })
    });
  }
  return result;
};
/**
 * 浏览器判断是否全屏
@@ -111,7 +106,7 @@
 */
export const listenfullscreen = (callback) => {
  function listen() {
    callback()
    callback();
  }
  document.addEventListener("fullscreenchange", function () {
@@ -131,9 +126,12 @@
 * 浏览器判断是否全屏
 */
export const fullscreenEnable = () => {
  var isFullscreen = document.isFullScreen || document.mozIsFullScreen || document.webkitIsFullScreen
  var isFullscreen =
    document.isFullScreen ||
    document.mozIsFullScreen ||
    document.webkitIsFullScreen;
  return isFullscreen;
}
};
/**
 * 浏览器全屏
@@ -186,12 +184,12 @@
 * 动态插入css
 */
export const loadStyle = url => {
  const link = document.createElement('link');
  link.type = 'text/css';
  link.rel = 'stylesheet';
export const loadStyle = (url) => {
  const link = document.createElement("link");
  link.type = "text/css";
  link.rel = "stylesheet";
  link.href = url;
  const head = document.getElementsByTagName('head')[0];
  const head = document.getElementsByTagName("head")[0];
  head.appendChild(link);
};
/**
@@ -201,7 +199,8 @@
  delete obj1.close;
  var o1 = obj1 instanceof Object;
  var o2 = obj2 instanceof Object;
  if (!o1 || !o2) { /*  判断不是对象  */
  if (!o1 || !o2) {
    /*  判断不是对象  */
    return obj1 === obj2;
  }
@@ -220,14 +219,18 @@
    }
  }
  return true;
}
};
/**
 * 根据字典的value显示label
 */
export const findByvalue = (dic, value) => {
  let result = '';
  let result = "";
  if (validatenull(dic)) return value;
  if (typeof (value) == 'string' || typeof (value) == 'number' || typeof (value) == 'boolean') {
  if (
    typeof value == "string" ||
    typeof value == "number" ||
    typeof value == "boolean"
  ) {
    let index = 0;
    index = findArray(dic, value);
    if (index != -1) {
@@ -238,7 +241,7 @@
  } else if (value instanceof Array) {
    result = [];
    let index = 0;
    value.forEach(ele => {
    value.forEach((ele) => {
      index = findArray(dic, ele);
      if (index != -1) {
        result.push(dic[index].label);
@@ -265,8 +268,10 @@
 * 生成随机len位数字
 */
export const randomLenNum = (len, date) => {
  let random = '';
  random = Math.ceil(Math.random() * 100000000000000).toString().substr(0, len ? len : 4);
  let random = "";
  random = Math.ceil(Math.random() * 100000000000000)
    .toString()
    .substr(0, len ? len : 4);
  if (date) random = random + Date.now();
  return random;
};
@@ -275,28 +280,49 @@
 */
export const openWindow = (url, title, w, h) => {
  // Fixes dual-screen position                            Most browsers       Firefox
  const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left
  const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top
  const dualScreenLeft =
    window.screenLeft !== undefined ? window.screenLeft : screen.left;
  const dualScreenTop =
    window.screenTop !== undefined ? window.screenTop : screen.top;
  const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
  const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
  const width = window.innerWidth
    ? window.innerWidth
    : document.documentElement.clientWidth
    ? document.documentElement.clientWidth
    : screen.width;
  const height = window.innerHeight
    ? window.innerHeight
    : document.documentElement.clientHeight
    ? document.documentElement.clientHeight
    : screen.height;
  const left = ((width / 2) - (w / 2)) + dualScreenLeft
  const top = ((height / 2) - (h / 2)) + dualScreenTop
  const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
  const left = width / 2 - w / 2 + dualScreenLeft;
  const top = height / 2 - h / 2 + dualScreenTop;
  const newWindow = window.open(
    url,
    title,
    "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=" +
      w +
      ", height=" +
      h +
      ", top=" +
      top +
      ", left=" +
      left
  );
  // Puts focus on the newWindow
  if (window.focus) {
    newWindow.focus()
    newWindow.focus();
  }
}
};
/**
 * 获取顶部地址栏地址
 */
export const getTopUrl = () => {
  return window.location.href.split("/#/")[0];
}
};
/**
 * 获取url参数
@@ -307,7 +333,7 @@
  let r = window.location.search.substr(1).match(reg);
  if (r != null) return unescape(decodeURI(r[2]));
  return null;
}
};
/**
 * 下载文件
@@ -316,19 +342,19 @@
 */
export const downloadFileBlob = (path, name) => {
  const xhr = new XMLHttpRequest();
  xhr.open('get', path);
  xhr.responseType = 'blob';
  xhr.open("get", path);
  xhr.responseType = "blob";
  xhr.send();
  xhr.onload = function () {
    if (this.status === 200 || this.status === 304) {
      // 如果是IE10及以上,不支持download属性,采用msSaveOrOpenBlob方法,但是IE10以下也不支持msSaveOrOpenBlob
      if ('msSaveOrOpenBlob' in navigator) {
      if ("msSaveOrOpenBlob" in navigator) {
        navigator.msSaveOrOpenBlob(this.response, name);
        return;
      }
      const url = URL.createObjectURL(this.response);
      const a = document.createElement('a');
      a.style.display = 'none';
      const a = document.createElement("a");
      a.style.display = "none";
      a.href = url;
      a.download = name;
      document.body.appendChild(a);
@@ -337,7 +363,7 @@
      URL.revokeObjectURL(url);
    }
  };
}
};
/**
 * 下载文件
@@ -346,16 +372,16 @@
 */
export const downloadFileBase64 = (path, name) => {
  const xhr = new XMLHttpRequest();
  xhr.open('get', path);
  xhr.responseType = 'blob';
  xhr.open("get", path);
  xhr.responseType = "blob";
  xhr.send();
  xhr.onload = function () {
    if (this.status === 200 || this.status === 304) {
      const fileReader = new FileReader();
      fileReader.readAsDataURL(this.response);
      fileReader.onload = function () {
        const a = document.createElement('a');
        a.style.display = 'none';
        const a = document.createElement("a");
        a.style.display = "none";
        a.href = this.result;
        a.download = name;
        document.body.appendChild(a);
@@ -364,7 +390,7 @@
      };
    }
  };
}
};
/**
 * 下载excel
@@ -372,34 +398,63 @@
 * @param {String} filename 文件名称
 */
export const downloadXls = (fileArrayBuffer, filename) => {
  let data = new Blob([fileArrayBuffer], {type: 'application/vnd.ms-excel,charset=utf-8'});
  if (typeof window.chrome !== 'undefined') {
  let data = new Blob([fileArrayBuffer], {
    type: "application/vnd.ms-excel,charset=utf-8",
  });
  if (typeof window.chrome !== "undefined") {
    // Chrome
    var link = document.createElement('a');
    var link = document.createElement("a");
    link.href = window.URL.createObjectURL(data);
    link.download = filename;
    link.click();
  } else if (typeof window.navigator.msSaveBlob !== 'undefined') {
  } else if (typeof window.navigator.msSaveBlob !== "undefined") {
    // IE
    var blob = new Blob([data], {type: 'application/force-download'});
    var blob = new Blob([data], { type: "application/force-download" });
    window.navigator.msSaveBlob(blob, filename);
  } else {
    // Firefox
    var file = new File([data], filename, {type: 'application/force-download'});
    var file = new File([data], filename, {
      type: "application/force-download",
    });
    window.open(URL.createObjectURL(file));
  }
}
};
export const processArray = (arr) => {
    arr.forEach(item => {
        if ('children' in item && item.children.length > 0) {
            item.children = processArray(item.children)
  arr.forEach((item) => {
    if ("children" in item && item.children.length > 0) {
      item.children = processArray(item.children);
        } else {
            if ('children' in item) {
                delete item.children
      if ("children" in item) {
        delete item.children;
            }
        }
    })
  });
    return arr
  return arr;
};
export const findParentOrCur = (data, targetId) => {
  function traverse(node, path) {
    if (node.id === targetId) {
      return path.concat(node.name);
}
    if (node.children) {
      for (let child of node.children) {
        let result = traverse(child, path.concat(node.name));
        if (result) {
          return result;
        }
      }
    }
  }
  for (let node of data) {
    let result = traverse(node, []);
    if (result) {
      return result.join("-");
    }
  }
  return null; // 如果找不到目标id,返回null
};
src/views/userHouse/components/householdManager.vue
@@ -48,7 +48,8 @@
    getToken
} from '@/util/auth'
import {
    downloadXls
    downloadXls,
    findParentOrCur,
} from "@/util/util"
import {
    dateNow
@@ -59,6 +60,62 @@
export default {
    data () {
        let isCardId = function (rule, value, callback) {
            // 15位和18位身份证号码的正则表达式
            var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
            // 如果通过该验证,说明身份证格式正确,但准确性还需计算
            if (regIdCard.test(value)) {
                if (value.length == 18) {
                    var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10,
                        5, 8, 4, 2) // 将前17位加权因子保存在数组里
                    var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2) // 这是除以11后,可能产生的11位余数、验证码,也保存成数组
                    var idCardWiSum = 0 // 用来保存前17位各自乖以加权因子后的总和
                    for (var i = 0; i < 17; i++) {
                        idCardWiSum += value.substring(i, i + 1) * idCardWi[i]
                    }
                    var idCardMod = idCardWiSum % 11// 计算出校验码所在数组的位置
                    var idCardLast = value.substring(17)// 得到最后一位身份证号码
                    // 如果等于2,则说明校验码是10,身份证号码最后一位应该是X
                    if (idCardMod == 2) {
                        if (idCardLast == "X" || idCardLast == "x") {
                            callback()
                        } else {
                            callback(new Error("身份证号格式有误!"))
                        }
                    } else {
                        // 用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
                        if (idCardLast == idCardY[idCardMod]) {
                            callback()
                        } else {
                            callback(new Error("身份证号格式有误!"))
                        }
                    }
                } else {
                    callback()
                }
            } else {
                //alert("身份证格式不正确!");
                callback(new Error("身份证号格式有误!"))
            }
            callback()
        }
        //手机号格式校验
        let validatorPhone = function (rule, value, callback) {
            if (value) {
                if (!/^1[3456789]\d{9}$/.test(value)) {
                    callback(new Error('手机号格式有误!'))
                } else {
                    callback()
                }
            }
            callback()
        }
        return {
            form: {},
            search: {},
@@ -85,11 +142,77 @@
                addBtn: true,
                dialogType: 'dialog',
                dialogClickModal: false,
                column: [{
                column: [
                    {
                        label: "与业主关系",
                        prop: "relationship",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                        dataType: "number",
                        hide: true,
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择与业主关系",
                                trigger: "blur",
                            }
                        ],
                    },
                    {
                        width: 96,
                    label: "姓名",
                    prop: "name",
                    search: true,
                        searchSpan: 3,
                        rules: [
                            {
                                required: true,
                                message: "请输入姓名",
                                trigger: "blur",
                            }
                        ],
                    },
                    {
                        hide: true,
                        label: "证件类型",
                        prop: "cardType",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        display: true,
                        width: 160,
                        label: "身份证号",
                        prop: "idCard",
                        search: true,
                    searchSpan: 4,
                        slot: true,
                        rules: [
                            {
                                validator: isCardId,
                                trigger: 'blur'
                            }
                        ],
                    },
                    {
                        hide: true,
                        display: false,
                        width: 160,
                        label: "证件号码",
                        prop: "cardNo",
                },
                {
@@ -113,66 +236,37 @@
                },
                {
                    label: "电话",
                        width: 120,
                        label: "手机号码",
                    prop: "phoneNumber",
                    search: true,
                    searchSpan: 4,
                        searchSpan: 3,
                        slot: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入手机号码",
                                trigger: "blur",
                            },
                            {
                                validator: validatorPhone,
                                trigger: 'blur'
                            }
                        ],
                },
                {
                    label: "身份证号",
                    prop: "idCard",
                },
                {
                    label: "证件类型",
                    prop: "cardType",
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    width: 160,
                    label: "证件号码",
                    prop: "cardNo",
                },
                // {
                // label: "关系",
                // prop: "roleType",
                // type: "select",
                // dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleType",
                // dataType: "number",
                //     props: {
                //         label: "dictValue",
                //         value: "dictKey",
                //     },
                // },
                {
                    label: "与业主关系",
                    prop: "relationship",
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                    dataType: "number",
                        label: "其他联系方式",
                        prop: "otherContact",
                    hide: true,
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                        rules: [
                {
                    label: "小区",
                    prop: "aoiName",
                    display: false
                                validator: validatorPhone,
                                trigger: 'blur'
                            }
                        ],
                },
                {
                    label: "地址",
                    prop: "address",
                    display: false
                },
                {
                    label: "主要联系人",
                    prop: "isPrimaryContact",
@@ -185,6 +279,8 @@
                        value: "dictKey",
                    },
                },
                {
                    label: "居住情况",
                    prop: "residentialStatus",
@@ -199,6 +295,19 @@
                },
                {
                        width: 142,
                        label: "小区",
                        prop: "aoiName",
                        display: false
                    },
                    {
                        label: "地址",
                        prop: "address",
                        display: false
                    },
                    {
                    label: "生日",
                    prop: "birthday",
                    type: "date",
@@ -206,48 +315,20 @@
                    valueFormat: "yyyy-MM-dd",
                    hide: true,
                },
                {
                    label: "港澳台通行证",
                    prop: "hkmtPass",
                    hide: true,
                },
                {
                    label: "护照",
                    prop: "passport",
                    hide: true,
                },
                {
                    label: "民族",
                    prop: "ethnicity",
                    type: "select",
                    hide: true,
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    label: "学历",
                    prop: "education",
                    type: "select",
                    hide: true,
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    hide: true,
                    parent: false,
                    width: 160,
                    label: "籍贯地行政区划",
                        label: "籍贯地区",
                    prop: "nativePlaceAdcode",
                    type: "tree",
                        typeformat (item, label, value) {
                            return item.addressDetail
                        },
                        change: ({ value, column, item, dic }) => {
                            item.addressDetail = findParentOrCur(dic, item.id)
                        },
                    props: {
                        label: 'name',
                        value: 'id'
@@ -256,6 +337,7 @@
                },
                {
                        hide: true,
                    label: "户籍类型",
                    prop: "residentType",
                    type: "select",
@@ -271,9 +353,15 @@
                    hide: true,
                    parent: false,
                    width: 160,
                    label: "户籍地行政区划",
                        label: "户籍地区",
                    prop: "residentAdcode",
                    type: "tree",
                        typeformat (item, label, value) {
                            return item.addressDetail
                        },
                        change: ({ value, column, item, dic }) => {
                            item.addressDetail = findParentOrCur(dic, item.id)
                        },
                    props: {
                        label: 'name',
                        value: 'id'
@@ -289,7 +377,7 @@
                {
                    disabled: false,
                    label: "居住地行政区划",
                        label: "居住地区",
                    prop: "homeAdcode",
                    hide: true,
                    type: 'select',
@@ -302,84 +390,55 @@
                {
                    disabled: false,
                    label: "现居住地址",
                        label: "现居住地",
                    prop: "currentAddress",
                    hide: true,
                },
                {
                    label: "婚姻状态",
                    prop: "maritalStatus",
                        label: "民族",
                        prop: "ethnicity",
                    type: "select",
                    hide: true,
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    label: "车牌号",
                    prop: "cardNumber",
                    hide: true,
                },
                {
                    label: "残疾证",
                    prop: "disabilityCert",
                    hide: true,
                },
                {
                    hide: true,
                    width: 160,
                    label: "宗教信仰",
                    prop: "religiousBelief",
                },
                {
                    hide: true,
                    label: "健康状况",
                    prop: "healthStatus",
                        label: "学历",
                        prop: "education",
                    type: "select",
                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
                    dataType: "number",
                    props: {
                        label: "dictValue",
                        value: "dictKey",
                    },
                },
                {
                    hide: true,
                    width: 160,
                    label: "疾病名称",
                    prop: "diseaseName"
                        label: "职业类别",
                        prop: "occupation"
                    },
                    {
                        label: "工作单位",
                        prop: "employer",
                        hide: true,
                },
                {
                    hide: true,
                    width: 160,
                    label: "外出时间",
                    prop: "goOutTime"
                },
                {
                    hide: true,
                    width: 160,
                    label: "外出原因",
                    prop: "goOutReason"
                },
                {
                    hide: true,
                    width: 160,
                    label: "外出去向",
                    prop: "goOutWhere"
                },
                {
                    hide: true,
                    width: 160,
                    label: "外出详址",
                    prop: "goOutAddr"
                        label: "工作单位地址",
                        prop: "cmpyRegAddr"
                },
                {
@@ -396,27 +455,79 @@
                },
                {
                    label: "就职单位",
                    prop: "employer",
                        label: "婚姻状态",
                        prop: "maritalStatus",
                        type: "select",
                    hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                },
                {
                    hide: true,
                    width: 160,
                    label: "职业类别",
                    prop: "occupation"
                        label: "宗教信仰",
                        prop: "religiousBelief",
                    },
                    {
                        hide: true,
                        label: "健康状态",
                        prop: "healthStatus",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                },
                {
                    hide: true,
                    width: 160,
                    label: "就职单位地址",
                    prop: "cmpyRegAddr"
                        label: "疾病名称",
                        prop: "diseaseName"
                },
                {
                    label: "其他联系方式",
                    prop: "otherContact",
                        hide: true,
                        width: 160,
                        label: "外出去向",
                        prop: "goOutWhere"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出原因",
                        prop: "goOutReason"
                    },
                    {
                        hide: true,
                        label: "外出时间",
                        prop: "goOutTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        width: 160,
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出详址",
                        prop: "goOutAddr"
                    },
                    {
                        label: "车牌号",
                        prop: "cardNumber",
                    hide: true,
                },
                ]
@@ -495,6 +606,29 @@
                }
            },
            immediate: true
        },
        'form.cardType': {
            handler (newData) {
                let idCardColumn = this.findObject(
                    this.option.column,
                    'idCard'
                )
                let cardNoColumn = this.findObject(
                    this.option.column,
                    'cardNo'
                )
                if (newData == 111) {
                    idCardColumn.display = true
                    cardNoColumn.display = false
                } else {
                    idCardColumn.display = false
                    cardNoColumn.display = true
                }
            },
            immediate: true
        }
    },
    computed: {
src/views/userHouse/houseHoldList.vue
@@ -138,7 +138,8 @@
    getToken
} from '@/util/auth'
import {
    downloadXls
    downloadXls,
    findParentOrCur,
} from "@/util/util"
import {
    dateNow
@@ -150,6 +151,62 @@
export default {
    data () {
        let isCardId = function (rule, value, callback) {
            // 15位和18位身份证号码的正则表达式
            var regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/
            // 如果通过该验证,说明身份证格式正确,但准确性还需计算
            if (regIdCard.test(value)) {
                if (value.length == 18) {
                    var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10,
                        5, 8, 4, 2) // 将前17位加权因子保存在数组里
                    var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2) // 这是除以11后,可能产生的11位余数、验证码,也保存成数组
                    var idCardWiSum = 0 // 用来保存前17位各自乖以加权因子后的总和
                    for (var i = 0; i < 17; i++) {
                        idCardWiSum += value.substring(i, i + 1) * idCardWi[i]
                    }
                    var idCardMod = idCardWiSum % 11// 计算出校验码所在数组的位置
                    var idCardLast = value.substring(17)// 得到最后一位身份证号码
                    // 如果等于2,则说明校验码是10,身份证号码最后一位应该是X
                    if (idCardMod == 2) {
                        if (idCardLast == "X" || idCardLast == "x") {
                            callback()
                        } else {
                            callback(new Error("身份证号格式有误!"))
                        }
                    } else {
                        // 用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码
                        if (idCardLast == idCardY[idCardMod]) {
                            callback()
                        } else {
                            callback(new Error("身份证号格式有误!"))
                        }
                    }
                } else {
                    callback()
                }
            } else {
                //alert("身份证格式不正确!");
                callback(new Error("身份证号格式有误!"))
            }
            callback()
        }
        //手机号格式校验
        let validatorPhone = function (rule, value, callback) {
            if (value) {
                if (!/^1[3456789]\d{9}$/.test(value)) {
                    callback(new Error('手机号格式有误!'))
                } else {
                    callback()
                }
            }
            callback()
        }
        return {
            labelData: [],
            form: {},
@@ -183,11 +240,75 @@
                menuFixed: 'right',
                column: [
                    {
                        label: "与业主关系",
                        prop: "relationship",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                        dataType: "number",
                        hide: true,
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择与业主关系",
                                trigger: "blur",
                            }
                        ],
                    },
                    {
                        width: 96,
                        label: "姓名",
                        prop: "name",
                        search: true,
                        searchSpan: 3,
                        rules: [
                            {
                                required: true,
                                message: "请输入姓名",
                                trigger: "blur",
                            }
                        ],
                    },
                    {
                        hide: true,
                        label: "证件类型",
                        prop: "cardType",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        display: true,
                        width: 160,
                        label: "身份证号",
                        prop: "idCard",
                        search: true,
                        searchSpan: 4,
                        slot: true,
                        rules: [
                            {
                                validator: isCardId,
                                trigger: 'blur'
                            }
                        ],
                    },
                    {
                        hide: true,
                        display: false,
                        width: 160,
                        label: "证件号码",
                        prop: "cardNo",
                    },
                    {
@@ -210,36 +331,61 @@
                    },
                    {
                        width: 110,
                        label: "电话",
                        width: 120,
                        label: "手机号码",
                        prop: "phoneNumber",
                        search: true,
                        searchSpan: 3,
                        slot: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入手机号码",
                                trigger: "blur",
                    },
                    {
                        width: 160,
                        label: "身份证号",
                        prop: "idCard",
                        search: true,
                        searchSpan: 4,
                        slot: true,
                                validator: validatorPhone,
                                trigger: 'blur'
                            }
                        ],
                    },
                    {
                        label: "证件类型",
                        prop: "cardType",
                        label: "其他联系方式",
                        prop: "otherContact",
                        hide: true,
                        rules: [
                            {
                                validator: validatorPhone,
                                trigger: 'blur'
                            }
                        ],
                    },
                    {
                        label: "是否主要联系人",
                        prop: "isPrimaryContact",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType",
                        dataType: "number",
                        hide: true,
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        width: 160,
                        label: "证件号码",
                        prop: "cardNo",
                        label: "居住情况",
                        prop: "residentialStatus",
                        type: "select",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    // {
@@ -253,20 +399,9 @@
                    //         value: "dictKey",
                    //     },
                    // },
                    {
                        label: "与业主关系",
                        prop: "relationship",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation",
                        dataType: "number",
                        hide: true,
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        width: 132,
                        width: 142,
                        label: "小区",
                        prop: "aoiName",
                        search: true,
@@ -275,71 +410,43 @@
                    },
                    {
                        width: 120,
                        addDisplay: false,
                        editDisplay: false,
                        viewDisplay: false,
                        width: 96,
                        label: "所属街道",
                        prop: "townStreetName",
                        search: true,
                        searchSpan: 4
                    },
                    {
                        width: 160,
                        addDisplay: false,
                        editDisplay: false,
                        viewDisplay: false,
                        width: 160,
                        label: "所属社区",
                        prop: "neiName",
                        search: true,
                        searchSpan: 4
                    },
                    {
                        width: 120,
                        addDisplay: false,
                        editDisplay: false,
                        viewDisplay: false,
                        width: 96,
                        label: "所属网格",
                        prop: "gridName",
                    },
                    {
                        width: 132,
                        width: 140,
                        label: "地址",
                        prop: "address",
                        display: false
                    },
                    {
                        width: 210,
                        label: "标签",
                        prop: "householdLabelList",
                        display: false
                    },
                    {
                        label: "主要联系人",
                        prop: "isPrimaryContact",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType",
                        dataType: "number",
                        hide: true,
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        label: "居住情况",
                        prop: "residentialStatus",
                        type: "select",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        label: "生日",
                        prop: "birthday",
@@ -348,48 +455,20 @@
                        valueFormat: "yyyy-MM-dd",
                        hide: true,
                    },
                    {
                        label: "港澳台通行证",
                        prop: "hkmtPass",
                        hide: true,
                    },
                    {
                        label: "护照",
                        prop: "passport",
                        hide: true,
                    },
                    {
                        label: "民族",
                        prop: "ethnicity",
                        type: "select",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        label: "学历",
                        prop: "education",
                        type: "select",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        hide: true,
                        parent: false,
                        width: 160,
                        label: "籍贯地行政区划",
                        label: "籍贯地区",
                        prop: "nativePlaceAdcode",
                        type: "tree",
                        typeformat (item, label, value) {
                            return item.addressDetail
                        },
                        change: ({ value, column, item, dic }) => {
                            item.addressDetail = findParentOrCur(dic, item.id)
                        },
                        props: {
                            label: 'name',
                            value: 'id'
@@ -398,6 +477,7 @@
                    },
                    {
                        hide: true,
                        label: "户籍类型",
                        prop: "residentType",
                        type: "select",
@@ -413,9 +493,15 @@
                        hide: true,
                        parent: false,
                        width: 160,
                        label: "户籍地行政区划",
                        label: "户籍地区",
                        prop: "residentAdcode",
                        type: "tree",
                        typeformat (item, label, value) {
                            return item.addressDetail
                        },
                        change: ({ value, column, item, dic }) => {
                            item.addressDetail = findParentOrCur(dic, item.id)
                        },
                        props: {
                            label: 'name',
                            value: 'id'
@@ -431,7 +517,7 @@
                    {
                        disabled: false,
                        label: "居住地行政区划",
                        label: "居住地区",
                        prop: "homeAdcode",
                        hide: true,
                        type: 'select',
@@ -444,83 +530,62 @@
                    {
                        disabled: false,
                        label: "现居住地址",
                        label: "现居住地",
                        prop: "currentAddress",
                        hide: true,
                    },
                    {
                        label: "婚姻状态",
                        prop: "maritalStatus",
                        width: 210,
                        label: "标签",
                        prop: "householdLabelList",
                        display: false
                    },
                    {
                        label: "民族",
                        prop: "ethnicity",
                        type: "select",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        label: "车牌号",
                        prop: "cardNumber",
                        hide: true,
                    },
                    {
                        label: "残疾证",
                        prop: "disabilityCert",
                        hide: true,
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "宗教信仰",
                        prop: "religiousBelief",
                    },
                    {
                        hide: true,
                        label: "健康状况",
                        prop: "healthStatus",
                        label: "学历",
                        prop: "education",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
                        hide: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "疾病名称",
                        prop: "diseaseName"
                        label: "职业类别",
                        prop: "occupation"
                    },
                    {
                        label: "工作单位",
                        prop: "employer",
                        hide: true,
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出时间",
                        prop: "goOutTime"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出原因",
                        prop: "goOutReason"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出去向",
                        prop: "goOutWhere"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出详址",
                        prop: "goOutAddr"
                        label: "工作单位地址",
                        prop: "cmpyRegAddr"
                    },
                    {
@@ -537,28 +602,79 @@
                    },
                    {
                        label: "婚姻状态",
                        prop: "maritalStatus",
                        type: "select",
                        hide: true,
                        width: 160,
                        label: "职业类别",
                        prop: "occupation"
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                    },
                    {
                        label: "就职单位",
                        prop: "employer",
                        hide: true,
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "就职单位地址",
                        prop: "cmpyRegAddr"
                        label: "宗教信仰",
                        prop: "religiousBelief",
                    },
                    {
                        label: "其他联系方式",
                        prop: "otherContact",
                        hide: true,
                        label: "健康状态",
                        prop: "healthStatus",
                        type: "select",
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus",
                        dataType: "number",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "疾病名称",
                        prop: "diseaseName"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出去向",
                        prop: "goOutWhere"
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出原因",
                        prop: "goOutReason"
                    },
                    {
                        hide: true,
                        label: "外出时间",
                        prop: "goOutTime",
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        width: 160,
                    },
                    {
                        hide: true,
                        width: 160,
                        label: "外出详址",
                        prop: "goOutAddr"
                    },
                    {
                        label: "车牌号",
                        prop: "cardNumber",
                        hide: true,
                    },
                ]
@@ -675,6 +791,29 @@
                }
            },
            immediate: true
        },
        'form.cardType': {
            handler (newData) {
                let idCardColumn = this.findObject(
                    this.option.column,
                    'idCard'
                )
                let cardNoColumn = this.findObject(
                    this.option.column,
                    'cardNo'
                )
                if (newData == 111) {
                    idCardColumn.display = true
                    cardNoColumn.display = false
                } else {
                    idCardColumn.display = false
                    cardNoColumn.display = true
                }
            },
            immediate: true
        }
    },
    computed: {