mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 11:56:46 +08:00
fix bug 用户中心接口调整
This commit is contained in:
@@ -28,7 +28,7 @@ import BreadCrumb from "@/components/BreadCrumb";
|
|||||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||||
import * as api1 from "@/api/index1";
|
import * as api1 from "@/api/index1";
|
||||||
import * as api2 from "@/api/index";
|
import * as api2 from "@/api/index";
|
||||||
import {boeRequest, request} from "@/api/request";
|
import {request} from "@/api/request";
|
||||||
import {USER_PERMISSION} from "@/api/apis";
|
import {USER_PERMISSION} from "@/api/apis";
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|||||||
@@ -79,68 +79,68 @@ export function useBoeApiPage(_url, params = {}, config = {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useBoeApi(_url, params = {}, config = {
|
// export function useBoeApi(_url, params = {}, config = {
|
||||||
init: true,
|
// init: true,
|
||||||
result: res => res.result,
|
// result: res => res.result,
|
||||||
}) {
|
// }) {
|
||||||
|
//
|
||||||
|
// const state = reactive({
|
||||||
|
// data: [],
|
||||||
|
// loading: false,
|
||||||
|
// });
|
||||||
|
// watch(() => params, () => {
|
||||||
|
// fetch();
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// function fetch() {
|
||||||
|
// state.loading = true;
|
||||||
|
// return boeRequest(_url, params).then(r => {
|
||||||
|
// state.data = config.result(r);
|
||||||
|
// state.loading = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// config.init && fetch();
|
||||||
|
// return {
|
||||||
|
// ...toRefs(state),
|
||||||
|
// fetch,
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
const state = reactive({
|
// export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||||
data: [],
|
//
|
||||||
loading: false,
|
// const state = reactive({
|
||||||
});
|
// data: [],
|
||||||
watch(() => params, () => {
|
// loading: false,
|
||||||
fetch();
|
// total: 0,
|
||||||
});
|
// totalPage: 0,
|
||||||
|
// page: 1,
|
||||||
function fetch() {
|
// ...params
|
||||||
state.loading = true;
|
// });
|
||||||
return boeRequest(_url, params).then(r => {
|
//
|
||||||
state.data = config.result(r);
|
// watch(() => params.keyword, throttle(fetch, 600));
|
||||||
state.loading = false;
|
// watch(() => params.page, fetch);
|
||||||
});
|
//
|
||||||
}
|
// function fetch() {
|
||||||
|
// state.loading = true;
|
||||||
config.init && fetch();
|
// if (!params.keyword) {
|
||||||
return {
|
// state.loading = false;
|
||||||
...toRefs(state),
|
// return;
|
||||||
fetch,
|
// }
|
||||||
};
|
// return boeRequest(_url, params).then(r => {
|
||||||
}
|
// state.data = params.page === 1 ? r.result.userInfoList : [...state.data, ...r.result.userInfoList];
|
||||||
|
// state.totalPage = r.result.totalPage;
|
||||||
export function useBoeUserListPage(_url, params = {}, init = true) {
|
// state.total = r.result.totalElement;
|
||||||
|
// state.loading = false;
|
||||||
const state = reactive({
|
// });
|
||||||
data: [],
|
// }
|
||||||
loading: false,
|
//
|
||||||
total: 0,
|
// init && fetch();
|
||||||
totalPage: 0,
|
// return {
|
||||||
page: 1,
|
// ...toRefs(state),
|
||||||
...params
|
// fetch,
|
||||||
});
|
// };
|
||||||
|
// }
|
||||||
watch(() => params.keyword, throttle(fetch, 600));
|
|
||||||
watch(() => params.page, fetch);
|
|
||||||
|
|
||||||
function fetch() {
|
|
||||||
state.loading = true;
|
|
||||||
if (!params.keyword) {
|
|
||||||
state.loading = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return boeRequest(_url, params).then(r => {
|
|
||||||
state.data = params.page === 1 ? r.result.userInfoList : [...state.data, ...r.result.userInfoList];
|
|
||||||
state.totalPage = r.result.totalPage;
|
|
||||||
state.total = r.result.totalElement;
|
|
||||||
state.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
init && fetch();
|
|
||||||
return {
|
|
||||||
...toRefs(state),
|
|
||||||
fetch,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export function useNewRowsPageNoInit(_url, params) {
|
export function useNewRowsPageNoInit(_url, params) {
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
@@ -318,7 +318,32 @@ export function useRequest(_url, params, init = true) {
|
|||||||
fetchData,
|
fetchData,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
export function useArrayRequest(_url, params, init = true) {
|
||||||
|
|
||||||
|
const data = ref([]);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
if (isRef(params)) {
|
||||||
|
watch(params.value, () => {
|
||||||
|
fetchData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchData() {
|
||||||
|
loading.value = true;
|
||||||
|
request(_url, unref(params)).then(r => {
|
||||||
|
data.value = r.data;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
init && fetchData();
|
||||||
|
return {
|
||||||
|
data,
|
||||||
|
loading,
|
||||||
|
fetchData,
|
||||||
|
};
|
||||||
|
}
|
||||||
export async function boeRequest(_url, params = {}) {
|
export async function boeRequest(_url, params = {}) {
|
||||||
const s = _url.split(" ");
|
const s = _url.split(" ");
|
||||||
let url = s[0];
|
let url = s[0];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { defineEmits, defineProps, ref, watch } from "vue";
|
import { defineEmits, defineProps, ref, watch } from "vue";
|
||||||
import {boeRequest, useRequest} from "@/api/request";
|
import {request, useArrayRequest, useRequest} from "@/api/request";
|
||||||
import {ORG_CHILD_LIST, ORG_LIST} from "@/api/apis";
|
import {ORG_CHILD_LIST, ORG_LIST} from "@/api/apis";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -50,7 +50,7 @@ const props = defineProps({
|
|||||||
const emit = defineEmits({});
|
const emit = defineEmits({});
|
||||||
const stuTreeExpandedKeys = ref([]);
|
const stuTreeExpandedKeys = ref([]);
|
||||||
const labelValue = ref({ value: props.value, label: props.name });
|
const labelValue = ref({ value: props.value, label: props.name });
|
||||||
const { data: options, loading: orgLoading } = useRequest(
|
const { data: options, loading: orgLoading } = useArrayRequest(
|
||||||
ORG_LIST,
|
ORG_LIST,
|
||||||
{ keyword: "" },
|
{ keyword: "" },
|
||||||
);
|
);
|
||||||
@@ -66,9 +66,9 @@ watch(props, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onLoadData(treeNode) {
|
function onLoadData(treeNode) {
|
||||||
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
return useArrayRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||||||
(r) => {
|
(r) => {
|
||||||
treeNode.dataRef.treeChildList = r.result.directChildList;
|
treeNode.dataRef.treeChildList = r.data;
|
||||||
options.value = [...options.value];
|
options.value = [...options.value];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -83,7 +83,6 @@ function change(
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
console.log("label2222", label, namePath, value);
|
|
||||||
emit("update:name", label);
|
emit("update:name", label);
|
||||||
emit("update:fullName", namePath);
|
emit("update:fullName", namePath);
|
||||||
emit("update:value", value);
|
emit("update:value", value);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {defineEmits, defineProps, ref, watch, watchEffect} from "vue";
|
import {defineEmits, defineProps, ref, watch, watchEffect} from "vue";
|
||||||
import {boeRequest, useRequest} from "@/api/request";
|
import {request, useRequest} from "@/api/request";
|
||||||
import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi";
|
import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -80,9 +80,9 @@ watch(props, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onLoadData(treeNode) {
|
function onLoadData(treeNode) {
|
||||||
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||||||
(r) => {
|
(r) => {
|
||||||
treeNode.dataRef.treeChildList = r.result.directChildList;
|
treeNode.dataRef.treeChildList = r.data;
|
||||||
options.value = [...options.value];
|
options.value = [...options.value];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user