| 123456789101112131415161718192021222324252627282930313233343536373839 | import { getDict } from '@/api/toConsult.js'import dayjs from 'dayjs'import Dicts from '../utils/dicts'export default {  data() {    return {      //字典['dict_type']      dicts:[]    }  },  created() {    /** 组件中设置dictType,即可获取相应的value*/    if(this.dicts && this.dicts.length > 0){      this.dicts.forEach(item=>{        this.getDictHandler(item,(res)=>{          this[item] = res        })      })    }  },  computed:{  },  methods: {    //时间范围模板:2020-01-01~2020-01-02    rangDate(start,end,a){      if(!start || !end) return '暂无';      !a && (a = '~')      return  `${start}${a}${end}`;    },    //根据字典类型获取字典值    getDictHandler(dictType,callBack) {      getDict( dictType ).then(res => {        let { data } = res        callBack(data)      })    },  }}
 |