dict.ts 421 B

123456789101112131415
  1. import { post } from "@/utils/request";
  2. import dict from "@/store/modules/dict";
  3. export const getDict = (dictType: string) => {
  4. post("/common/dict", { dictType }).then(([err, data]) => {
  5. if (err) return;
  6. const v = data.list.map((x: any) => ({
  7. key: x.dictLabel,
  8. value: x.dictValue
  9. })) as IDict[];
  10. dict.add({ k: dictType, v });
  11. });
  12. return [{ key: "请选择", value: "" }] as IDict[];
  13. };