mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 11:26:45 +08:00
Merge remote-tracking branch 'origin/user-modify' into dev0731
This commit is contained in:
@@ -26,7 +26,7 @@ export const ASSESSMENT_DETAIL = (assessmentId)=>`/assessment/queryAssessmentDet
|
|||||||
|
|
||||||
export const USER_LIST_PAGE = "/admin/thirdApi/user/list";
|
export const USER_LIST_PAGE = "/admin/thirdApi/user/list";
|
||||||
//学员列表 没有分页数据 只能通过名称检索 速度较快
|
//学员列表 没有分页数据 只能通过名称检索 速度较快
|
||||||
export const USER_LIST = "/admin/thirdApi/user/searchList";
|
export const USER_LIST = "/admin/thirdApi/user/list";
|
||||||
export const ORG_LIST = "/admin/thirdApi/org/list";
|
export const ORG_LIST = "/admin/thirdApi/org/list";
|
||||||
export const ORG_CHILD_LIST = "/admin/thirdApi/org/info";
|
export const ORG_CHILD_LIST = "/admin/thirdApi/org/info";
|
||||||
|
|
||||||
|
|||||||
@@ -248,6 +248,58 @@ export function useRowsPage(_url, params, init = true) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页只返回 total 无分页信息
|
||||||
|
* @param _url
|
||||||
|
* @param params
|
||||||
|
* @param init
|
||||||
|
* @param listing
|
||||||
|
*/
|
||||||
|
export function useTotalPage(_url, params, init = true,listing = false) {
|
||||||
|
|
||||||
|
const state = reactive({
|
||||||
|
data: [],
|
||||||
|
total: 1,
|
||||||
|
current: 1,
|
||||||
|
pages: 1,
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
loading: false
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isRef(params) && listing) {
|
||||||
|
watch(params.value, () => {
|
||||||
|
fetch();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRef(_url)) {
|
||||||
|
watchEffect(fetch);
|
||||||
|
} else {
|
||||||
|
init && fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
state.data = [];
|
||||||
|
state.loading = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch() {
|
||||||
|
state.loading = true;
|
||||||
|
return request(unref(_url), unref(params)).then(r => {
|
||||||
|
state.data = r.data.list;
|
||||||
|
state.pages = r.data.total/state.pageSize || 1;
|
||||||
|
state.total = r.data.total;
|
||||||
|
state.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...toRefs(state),
|
||||||
|
fetch,
|
||||||
|
reset,
|
||||||
|
};
|
||||||
|
}
|
||||||
export function usePage(_url, params, init = true,listing = false) {
|
export function usePage(_url, params, init = true,listing = false) {
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
@@ -300,6 +352,7 @@ export function usePage(_url, params, init = true,listing = false) {
|
|||||||
total: 0,
|
total: 0,
|
||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
page: 1,
|
page: 1,
|
||||||
|
pageNo: 1,
|
||||||
...params
|
...params
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -313,8 +366,8 @@ export function usePage(_url, params, init = true,listing = false) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return request(_url, params).then(r => {
|
return request(_url, params).then(r => {
|
||||||
state.data = params.page === 1 ? r.data.records : [...state.data, ...r.data.records];
|
state.data = params.pageNo === 1 ? r.data.list : [...state.data, ...r.data.list];
|
||||||
state.totalPage = r.data.pages;
|
state.totalPage = r.data.total/10 || 1;
|
||||||
state.total = r.data.total;
|
state.total = r.data.total;
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const emit = defineEmits({})
|
|||||||
|
|
||||||
const isOpen = ref(false)
|
const isOpen = ref(false)
|
||||||
|
|
||||||
const memberParam = ref({keyword: '', page: 1, pageSize: 20})
|
const memberParam = ref({keyword: '', pageNo:1, pageSize: 20})
|
||||||
|
|
||||||
const {data: userList, loading} = useThrottlePage(USER_LIST, memberParam.value, false)
|
const {data: userList, loading} = useThrottlePage(USER_LIST, memberParam.value, false)
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
|
|
||||||
const memberScroll = ({target: {scrollHeight, scrollTop, clientHeight}}) => {
|
const memberScroll = ({target: {scrollHeight, scrollTop, clientHeight}}) => {
|
||||||
scrollHeight === (clientHeight + scrollTop) && memberParam.value.page++
|
scrollHeight === (clientHeight + scrollTop) && memberParam.value.pageNo++
|
||||||
};
|
};
|
||||||
|
|
||||||
//搜索学员
|
//搜索学员
|
||||||
@@ -92,7 +92,7 @@ const searchMember = (keyword) => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
isOpen.value = true
|
isOpen.value = true
|
||||||
userList.value = []
|
userList.value = []
|
||||||
memberParam.value.page = 1
|
memberParam.value.pageNo = 1
|
||||||
memberParam.value.keyword = keyword
|
memberParam.value.keyword = keyword
|
||||||
console.log('searchMember', memberParam.value)
|
console.log('searchMember', memberParam.value)
|
||||||
};
|
};
|
||||||
@@ -100,12 +100,12 @@ const searchMember = (keyword) => {
|
|||||||
function blur() {
|
function blur() {
|
||||||
isOpen.value = false
|
isOpen.value = false
|
||||||
memberParam.value.keyword = ''
|
memberParam.value.keyword = ''
|
||||||
memberParam.value.page = 1
|
memberParam.value.pageNo = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
function change(e, l) {
|
function change(e, l) {
|
||||||
memberParam.value.keyword = ''
|
memberParam.value.keyword = ''
|
||||||
memberParam.value.page = 1
|
memberParam.value.pageNo = 1
|
||||||
isOpen.value = false
|
isOpen.value = false
|
||||||
Array.isArray(l) && (selectOptions.value = l)
|
Array.isArray(l) && (selectOptions.value = l)
|
||||||
Array.isArray(selectOptions.value) && emit('onChange', e, l, selectOptions.value.find(e => e.departId)?.departId, selectOptions.value.find(e => e.departId)?.departName, selectOptions.value.find(e => e.departId)?.orgName)
|
Array.isArray(selectOptions.value) && emit('onChange', e, l, selectOptions.value.find(e => e.departId)?.departId, selectOptions.value.find(e => e.departId)?.departName, selectOptions.value.find(e => e.departId)?.orgName)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="tableBox tabb">
|
<div class="tableBox tabb">
|
||||||
<BaseTable ref="auditTableRef" :columns="audiColums" :url="AUDIENCE_LIST" page-key="pageNo"
|
<BaseTable ref="auditTableRef" :columns="audiColums" :url="AUDIENCE_LIST" page-key="pageNo"
|
||||||
v-model:params="audienceName"
|
v-model:params="audienceName" :request="useTotalPage"
|
||||||
v-model:selectedRows="auditSelectRows" v-model:selectedRowKeys="auditSelectRowKeys"
|
v-model:selectedRows="auditSelectRows" v-model:selectedRowKeys="auditSelectRowKeys"
|
||||||
type="checkbox"></BaseTable>
|
type="checkbox"></BaseTable>
|
||||||
</div>
|
</div>
|
||||||
@@ -296,7 +296,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {message} from "ant-design-vue";
|
import {message} from "ant-design-vue";
|
||||||
import {computed, defineEmits, defineProps, ref, watch} from "vue";
|
import {computed, defineEmits, defineProps, ref, watch} from "vue";
|
||||||
import { useNewRowsPageNoInit, request, useRequest} from "@/api/request";
|
import {useNewRowsPageNoInit, request, useRequest, useTotalPage} from "@/api/request";
|
||||||
import {
|
import {
|
||||||
saveStu,
|
saveStu,
|
||||||
} from "@/api/index1";
|
} from "@/api/index1";
|
||||||
@@ -507,14 +507,6 @@ const audiColums = ref([
|
|||||||
align: "center",
|
align: "center",
|
||||||
className: "h",
|
className: "h",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "类型",
|
|
||||||
dataIndex: "audienceType",
|
|
||||||
key: "audienceType",
|
|
||||||
width: 40,
|
|
||||||
align: "center",
|
|
||||||
className: "h",
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
const orgSelectKeys = ref([]);
|
const orgSelectKeys = ref([]);
|
||||||
const auditTableRef = ref();
|
const auditTableRef = ref();
|
||||||
|
|||||||
Reference in New Issue
Block a user