dictionary.js 918 Bytes
/*
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-08-16 11:30:45
 */
import store from '@/store'

/**
 * @description: getSjlx
 * @param {*} level
 * @author: renchao
 */
export function getSjlx (level) {
  const resultMap = {
    1: '系统数据',
    2: '存量数据',
    3: '补录数据',
  }
  return resultMap[level] || resultMap.default;
}

/**
 * @description: getDictLeabel
 * @param {*} level
 * @param {*} code
 * @author: renchao
 */
export function getDictLeabel (level, code) {
  const resultMap = store.getters.dictData[code]
  function findNode(tree, func) {
    for (const node of tree) {
        if (func(node)) return node
        if (node.children) {
            const res = findNode(node.children, func)
            if (res) return res
        }
    }
    return {dname:""}
  }
  let data = findNode(resultMap, (node) => {
    return node.dcode === level
  })
  return data.dname
}