select.ts 775 B

123456789101112131415161718192021222324252627282930
  1. import { http } from "@/utils/http";
  2. import { ref } from "vue";
  3. export const select = ref<any>([]);
  4. export const selectFrom = ref<any>([]);
  5. // 字典
  6. type QuotaPageList = {
  7. code: number;
  8. msg: string;
  9. data: Array<any>;
  10. };
  11. export const selectDictList = data => {
  12. return http.request<QuotaPageList>("get", "/commonDict/selectDictList", {
  13. data
  14. });
  15. };
  16. export const getSelectDictListtApi = async () => {
  17. const { code, data } = await selectDictList({ dictType: "1" });
  18. if (code == 200) {
  19. select.value = data;
  20. return data;
  21. }
  22. };
  23. export const getFromSelectDictListtApi = async () => {
  24. const { code, data } = await selectDictList({ dictType: "2" });
  25. if (code == 200) {
  26. selectFrom.value = data;
  27. console.log("11111", data);
  28. return data;
  29. }
  30. };