filter.js 4.47 KB
/*
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-09-25 10:56:39
 */
import store from '@/store'
import { log } from 'bpmn-js-token-simulation'
// table 内部过滤器 由于过滤器只能在模板中使用 所以 就有了 jsx内部方法过滤器
export default class filter {
  /**
   * @description: selected
   * @param {*} row
   * @author: renchao
   */
  selected (row) {
    // if (row.sfbl == 0) { // 正在办理不能申请
    //   return false
    // } else {
    //   return true //可选择
    // }
    return true
  }
  // 业务来源
  /**
   * @description: 业务来源
   * @param {*} val
   * @author: renchao
   */
  busSource (val) {
    let status = { 1: '办事大厅', 2: '微信小程序' }
    return status[val]
  }

  //申请分类(1:正常申请,2:一并申请,3:补录申请)
  /**
   * @description: 申请分类
   * @param {*} val
   * @author: renchao
   */
  sqfls (val) {
    let status = { 1: '正常申请', 2: '一并申请', 3: '补录申请' }
    return status[val]
  }
  /**
   * @description: 字典
   * @param {*} val
   * @param {*} code
   * @author: renchao
   */
  dicStatus (val, code) {
    let data = store.getters.dictData[code],
      name = '暂无'
    if (data) {
      data.map((item) => {
        if (item.dcode == val) {
          name = item.dname
        }
      })
      return name
    }
  }

  /**
   * @description: blzt
   * @param {*} val
   * @author:
   */
  blzt (val) {
    if (val ===  0) {
      return "未提交"
    } else if (val === 1) {
      return "已提交"
    } else if (val === 2) {
      return "办理中"
    } else if (val === 3) {
      return "已办结"
    } else if (val === 4) {
      return "已终止"
    } else if (val === 5) {
      return "已退回"
    } else if (val === 8) {
      return "已登簿"
    }
  }

  /**
   * @description: ywlx
   * @param {*} val
   * @author:
   */
  ywlx (val) {
    if (val === "1") {
      return "预售商品房买卖预告登记"
    } else if (val === "2") {
      return "预售商品房抵押权预告登记"
    } else if (val === "3") {
      return "商品房初始登记"
    } else if (val === "4") {
      return "不动产抵押登记"
    } else if (val === "5") {
      return "预购商品房预告登记/预购商品房抵押登记"
    } else if (val === "6") {
      return "预售商品房预告登记转房屋所有权登记/预售商品房抵押登记转抵押权登记"
    } else if (val === "7") {
      return "查封登记"
    } else if (val === "8") {
      return "解封登记"
    } else if (val === "9") {
      return "商品房转移登记"
    } else if (val === "10") {
      return "存量房转移登记"
    } else if (val === "23") {
      return "续封登记"
    } else if (val === "41") {
      return "独幢宅基地首次登记"
    } else if (val === "42") {
      return "多幢宅基地首次登记"
    }
  }

  /**
   * @description: filterHtml
   * @param {*} content
   * @author: renchao
   */
  filterHtml (content) {
    return content.replace(/<[^>]+>/g, '');
  }
  /**
   * @description: getDictData
   * @param {*} val
   * @author: renchao
   */
  getDictData (val) {
    return store.getters.dictData[val]
  }
  /**
   * @description: yWstatus
   * @param {*} row
   * @author: renchao
   */
  yWstatus (row) {
    let text = "";
    let keys = 0;
    // 定义策略对象
    const strategies = {
      djblzt: "正在办理",
      zjgcdyzt: "在建工程抵押",
      ycfzt: "已预查封",
      cfzt: "已查封",
      diyizt: "已地役",
      yyzt: "异议中",
      xzzt: "已限制",
      ygmmzt: "已预告买卖",
      ygdyzt: "已预告抵押",
      dyzt: "已抵押",
      sfbl: "正在补录",
      qqzt:"已确权"
    };

    for (let key in row) {
      if (row[key] === 1 && strategies[key]) {
        keys++;
        if (keys == 1) {
          if(text){
            text += ',' +strategies[key];
          }else{
            text += strategies[key];
          }

        } else {
          text += ',' + strategies[key];
        }
      }else if(row[key] ==2 && key=="qqzt"){
        if(text){
          text += ','+"已灭失";
        }else{
          text += "已灭失";
        }

      }else if(row[key] ==0 && key=="qqzt"){
        if(text){
          text += ','+"未确权";
        }else{
          text += "未确权";
        }

      }
    }

    return text;
  }
  joinItem (val) {
    if (Array.isArray(val) && val.length > 0) {
      return val.join()
    } else {
      return val
    }
  }
}