index.js 487 B

1234567891011121314151617181920212223
  1. /** @format */
  2. import { getDictConfig } from "@/api/login";
  3. export async function useDict(...args) {
  4. let dictList = [];
  5. for (let key of args) {
  6. dictList.push(getDictConfig({ key }));
  7. }
  8. let syncRes = await Promise.all(dictList);
  9. return syncRes[0].data;
  10. }
  11. export function paraseDict(dictList, value) {
  12. if (!dictList.length) return "";
  13. let arr = dictList.filter((dict) => dict.dictValue == value);
  14. if (!arr.length) {
  15. return "";
  16. }
  17. return arr[0].dictLabel;
  18. }