filter.js 2.38 KB
/*
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-08-28 15:31:31
 */
import store from '@/store'
// 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: 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: "正在补录"
    };

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

    return text;
  }
}