|
@@ -6,9 +6,9 @@
|
|
|
|
|
|
<script setup lang="ts" name="my-select-request">
|
|
|
import {onMounted, reactive, ref, watch} from "vue";
|
|
|
- import type {selectDto} from "/@/components/my-select-request/mySelectRequestDto";
|
|
|
- import {localStorageSet} from "/@/utils/localStorageSet";
|
|
|
- import {MySelectRequest} from "/@/components/my-select-request/mySelectRequest";
|
|
|
+import {localStorageSet} from "/@/utils/localStorageSet";
|
|
|
+import {DictApi} from "/@/api/admin/Dict";
|
|
|
+import {DictGetListDto} from "/@/api/admin/data-contracts";
|
|
|
/**
|
|
|
* 接受父组件中传过来的数据字典id,
|
|
|
* 根据id去查询
|
|
@@ -34,12 +34,11 @@ import {onMounted, reactive, ref, watch} from "vue";
|
|
|
|
|
|
const state = reactive({
|
|
|
/**选择选择值*/
|
|
|
- selectDto: <selectDto>[],
|
|
|
+ selectDto: <DictGetListDto>[],
|
|
|
})
|
|
|
|
|
|
const onChange = () =>{
|
|
|
emits('search',localSelect)
|
|
|
- console.log(localSelect)
|
|
|
}
|
|
|
/**
|
|
|
* 获取缓存,缓存不存在就发送请求
|
|
@@ -47,7 +46,7 @@ import {onMounted, reactive, ref, watch} from "vue";
|
|
|
const init = async () => {
|
|
|
state.selectDto = localStorageSet.getItemWithExpiration(props.code as string)
|
|
|
if (!state.selectDto){
|
|
|
- const res = await new MySelectRequest().getCodeDict([props.code])
|
|
|
+ const res = await new DictApi().getList([props.code] as string[])
|
|
|
/**存一天的缓存*/
|
|
|
localStorageSet.setItemWithExpiration(props.code as string, res?.data,1)
|
|
|
state.selectDto = localStorageSet.getItemWithExpiration(props.code as string)
|