接口调整

This commit is contained in:
yuping
2023-07-02 18:21:27 +08:00
parent 4e2ed3c456
commit 0e8341f980
14 changed files with 98 additions and 74 deletions

View File

@@ -28,8 +28,8 @@ import BreadCrumb from "@/components/BreadCrumb";
import zhCN from "ant-design-vue/es/locale/zh_CN";
import * as api1 from "@/api/index1";
import * as api2 from "@/api/index";
import {boeRequest} from "@/api/request";
import {USER_PERMISSION} from "@/api/ThirdApi";
import {boeRequest, request} from "@/api/request";
import {USER_PERMISSION} from "@/api/apis";
const store = useStore();
const isLogin = ref(false);
@@ -85,7 +85,7 @@ async function initDict(key) {
}
function getUserPermission(){
boeRequest(USER_PERMISSION,{permissionType:'PAGE'}).then(res=>{
request(USER_PERMISSION,{permissionType:'PAGE'}).then(res=>{
store.commit("SET_PERMISSION", res.result.flatMap(t=>t?.permissionPageList.map(s=>s.url)));
})
}

View File

@@ -1,13 +1,13 @@
//学员列表带分页
export const USER_LIST_PAGE = "/userbasic/user/list post";
//学员列表 没有分页数据 只能通过名称检索 速度较快
export const USER_LIST = "/userbasic/user/searchList post";
export const ORG_LIST = "/userbasic/org/list post";
export const ORG_CHILD_LIST = "/userbasic/org/info post";
// export const AUDIENCE_LIST = '/userbasic/audience/list post'
//当前用户可以查看的受众接口
export const AUDIENCE_LIST = "/userbasic/audience/userAudiencesFilter post";
export const USER_PERMISSION = "/userbasic/permission/listByUser post";
// export const USER_LIST_PAGE = "/userbasic/user/list post";
// //学员列表 没有分页数据 只能通过名称检索 速度较快
// export const USER_LIST = "/userbasic/user/searchList post";
// export const ORG_LIST = "/userbasic/org/list post";
// export const ORG_CHILD_LIST = "/userbasic/org/info post";
// // export const AUDIENCE_LIST = '/userbasic/audience/list post'
// //当前用户可以查看的受众接口
// export const AUDIENCE_LIST = "/userbasic/audience/userAudiences post";
// export const USER_PERMISSION = "/userbasic/permission/listByUser post";
export const CASE_PAGE = "/systemapi/xboe/m/boe/cases/pagelist post formData";
export const EXAM_PAPER_PAGE = "/systemapi/xboe/m/exam/paper/querylist post formData";
export const TEST_PAGE = "/api/b1/system/quiz/quiz-list post formData";

View File

@@ -23,3 +23,12 @@ export const WORK_DETAIL = workId => `/work/queryWorkDetailById?workId=${workId}
export const EXAM_DETAIL = examinationId => `/examination/queryExaminationDetailById?examinationId=${examinationId} post`;
//评估
export const ASSESSMENT_DETAIL = (assessmentId)=>`/assessment/queryAssessmentDetailById?assessmentId=${assessmentId} post`;
export const USER_LIST_PAGE = "/admin/thirdApi/user/list";
//学员列表 没有分页数据 只能通过名称检索 速度较快
export const USER_LIST = "/admin/thirdApi/user/searchList";
export const ORG_LIST = "/admin/thirdApi/org/list";
export const ORG_CHILD_LIST = "/admin/thirdApi/org/info";
export const AUDIENCE_LIST = "/admin/thirdApi/audience/userAudiences";
export const USER_PERMISSION = "/admin/thirdApi/permission/listByUser";

View File

@@ -141,7 +141,35 @@ export function useBoeUserListPage(_url, params = {}, init = true) {
fetch,
};
}
export function useNewRowsPageNoInit(_url, params) {
const state = reactive({
data: [],
total: 1,
pageNo: 1,
pages: 1,
loading: false
});
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.total = r.data.total;
state.loading = false;
});
}
return {
...toRefs(state),
fetch,
reset,
};
}
export function useRowsPageNoInit(_url, params) {
const state = reactive({
data: [],

View File

@@ -13,7 +13,7 @@
</template>
<script setup>
import {defineProps, defineExpose, ref, computed, onMounted, defineEmits, nextTick} from "vue";
import {useRowsPageNoInit} from "@/api/request";
import {usePage, useRequest, useRowsPageNoInit} from "@/api/request";
import {useResetRef} from "@/utils/useCommon";
const props = defineProps({
@@ -43,7 +43,7 @@ const props = defineProps({
},
request: {
type: Function,
default: useRowsPageNoInit
default: usePage
}
});
const emit = defineEmits(["update:params", "update:selectedRowKeys", "update:selectedRows"]);

View File

@@ -36,8 +36,8 @@
</template>
<script setup>
import { defineEmits, defineProps, ref, watch } from "vue";
import { boeRequest, useBoeApi } from "@/api/request";
import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi";
import {boeRequest, useBoeApi, useRequest} from "@/api/request";
import {ORG_CHILD_LIST, ORG_LIST} from "@/api/apis";
const props = defineProps({
value: String,
@@ -50,13 +50,9 @@ const props = defineProps({
const emit = defineEmits({});
const stuTreeExpandedKeys = ref([]);
const labelValue = ref({ value: props.value, label: props.name });
const { data: options, loading: orgLoading } = useBoeApi(
const { data: options, loading: orgLoading } = useRequest(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
watch(props, () => {

View File

@@ -37,7 +37,7 @@
</template>
<script setup>
import {defineEmits, defineProps, ref, watch, watchEffect} from "vue";
import { boeRequest, useBoeApi } from "@/api/request";
import {boeRequest, useBoeApi, useRequest} from "@/api/request";
import { ORG_CHILD_LIST, ORG_LIST } from "@/api/ThirdApi";
const props = defineProps({
@@ -57,13 +57,9 @@ const props = defineProps({
const emit = defineEmits({});
const stuTreeExpandedKeys = ref([]);
const labelValue = ref([]);
const { data: options, loading: orgLoading } = useBoeApi(
const { data: options, loading: orgLoading } = useRequest(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
watchEffect(()=>{

View File

@@ -28,8 +28,8 @@
</template>
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref, watch} from "vue";
import {useBoeUserListPage} from "@/api/request";
import {USER_LIST} from "@/api/ThirdApi";
import {useBoeUserListPage, usePage} from "@/api/request";
import {USER_LIST} from "@/api/apis";
const props = defineProps({
value: {
@@ -58,7 +58,7 @@ const isOpen = ref(false)
const memberParam = ref({keyword: '', page: 1, pageSize: 20})
const {data: userList, loading} = useBoeUserListPage(USER_LIST, memberParam.value, false)
const {data: userList, loading} = usePage(USER_LIST, memberParam.value, false)
const options = computed(() => userList.value.filter(e => !(props.value + '').includes(e.id)).map(e => ({
label: e.realName + e.userNo,

View File

@@ -75,8 +75,8 @@
margin: 0px 4px 120px 10px;
border: 1px solid #f0f0f0;
">
<BaseTable ref="stuTableRef" :columns="stuColumns" :url="USER_LIST_PAGE" pageKey="page"
:request="useBoeApiUserInfoPage" v-model:params="nameSearch"
<BaseTable ref="stuTableRef" :columns="stuColumns" :url="USER_LIST_PAGE" pageKey="pageNo"
v-model:params="nameSearch" :request="useNewRowsPageNoInit"
v-model:selectedRows="stuSelectRows" type="checkbox"></BaseTable>
</div>
</div>
@@ -131,8 +131,8 @@
</a-form-item>
</div>
<div class="tableBox tabb">
<BaseTable ref="auditTableRef" :columns="audiColums" :url="AUDIENCE_LIST" page-key="page"
:request="useBoeApiAuditPage" v-model:params="audienceName"
<BaseTable ref="auditTableRef" :columns="audiColums" :url="AUDIENCE_LIST" page-key="pageNo"
v-model:params="audienceName"
v-model:selectedRows="auditSelectRows" v-model:selectedRowKeys="auditSelectRowKeys"
type="checkbox"></BaseTable>
</div>
@@ -296,19 +296,13 @@
<script setup>
import {message} from "ant-design-vue";
import {computed, defineEmits, defineProps, ref, watch} from "vue";
import {boeRequest, useBoeApi, useBoeApiPage, useBoeApiUserInfoPage, useBoeApiAuditPage} from "@/api/request";
import {
ORG_CHILD_LIST,
ORG_LIST,
USER_LIST_PAGE,
AUDIENCE_LIST,
} from "@/api/ThirdApi";
import {boeRequest, useBoeApi, useBoeApiPage, useBoeApiUserInfoPage, useBoeApiAuditPage, usePage, useNewRowsPageNoInit, request, useRequest} from "@/api/request";
import {
saveStu,
} from "@/api/index1";
import dialog from "@/utils/dialog";
import BaseTable from "@/components/common/BaseTable";
import {STUDENT_LIST} from "@/api/apis";
import {AUDIENCE_LIST, ORG_CHILD_LIST, ORG_LIST, STUDENT_LIST, USER_LIST_PAGE} from "@/api/apis";
const emit = defineEmits({});
const props = defineProps({
@@ -392,7 +386,7 @@ const stageId = ref();
const nameSearch = ref({
keyword: "",
departId: null,
departId: '',
});
const stuTreeSelectKeys = ref([]);
const stuTreeExpandedKeys = ref([]);
@@ -401,30 +395,22 @@ const audienceName = ref({
});
const searchOrgName = ref({
keyword: "",
page: 1,
pageNo: 1,
pageSize: 10,
});
const stageIds = computed(() => props.stage);
const { data: orgData, fetch: searchOrg } = useBoeApiPage(
const { data: orgData, fetchData: searchOrg } = useRequest(
ORG_LIST,
searchOrgName.value
searchOrgName.value,
);
const { data: treeData, loading: orgLoading } = useBoeApi(
const { data: treeData, loading: orgLoading } = useRequest(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
const { data: treeOrgData, loading: orgOrgLoading } = useBoeApi(
const { data: treeOrgData, loading: orgOrgLoading } = useRequest(
ORG_LIST,
{ keyword: "" },
{
init: true,
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
}
);
const projectStuColumns = ref([
@@ -553,18 +539,18 @@ function searchAudi() {
}
function onLoadData(treeNode) {
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeNode.dataRef.treeChildList = r.data;
treeData.value = [...treeData.value];
}
);
}
function onLoadOrgData(treeNode) {
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
return request(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
(r) => {
treeNode.dataRef.treeChildList = r.result.directChildList;
treeNode.dataRef.treeChildList = r.data;
treeOrgData.value = [...treeOrgData.value];
}
);
@@ -605,7 +591,7 @@ function onOrgSelectChange(e, l) {
const resetStu = () => {
nameSearch.value.keyword = "";
stuTableRef.value.reset({ keyword: "", departId: null });
stuTableRef.value.reset({ keyword: "", departId: '' });
};
//清空选择部门信息
const deleteDepSelect = () => {
@@ -675,7 +661,7 @@ watch(visiable, () => {
orgSelectKeys.value = [];
deptList.value = [];
audienceName.value.keyword = "";
nameSearch.value.departId = null;
nameSearch.value.departId = '';
stuTreeExpandedKeys.value = [];
stuTreeSelectKeys.value = [];
activeKey.value = props.isGroup ? 4 : 1;
@@ -689,7 +675,7 @@ watch(visiable, () => {
auditTableRef.value && auditTableRef.value.clear();
auditTableRef.value && auditTableRef.value.reset({ keyword: "" });
stuTableRef.value && stuTableRef.value.clear();
stuTableRef.value && stuTableRef.value.reset({ keyword: "", departId: null });
stuTableRef.value && stuTableRef.value.reset({ keyword: "", departId: '' });
projectStuTableRef.value && projectStuTableRef.value.clear();
projectStuTableRef.value && projectStuTableRef.value.reset({ pid: props.infoId, type: props.infoType, studentName: "" });
}

View File

@@ -28,11 +28,20 @@ export function traverseArr(arr, traverseObj, saveOld = false) {
return newArr;
}
// const admin = [5, 6, 8, 9, 11, 12];
const admin = [5, 6, 8, 9, 11, 12];
//检查 管理权和归属权
export function checkPer() {
return true;
export function checkPer(per,createId) {
if (createId && store?.state?.userInfo?.id === createId) {
return true;
}
if (store?.state?.userInfo?.isSystemAdmin) {
return true;
}
if (per) {
return (per + "").split(",").some(t => admin.some(s => s == t));
}
return false;
}
const adminOwner = [6, 9, 12];

View File

@@ -367,9 +367,7 @@
>管理
</a-button>
<DropDown
v-if="
checkPer(record.permissions,createId) && checkOwner(record.permissions)
"
v-if="checkOwner(record.permissions)"
value="授权"
>
<OwnerTableModelStudent :types="[10, 11, 12]" :id="record.id" :type="12"

View File

@@ -120,7 +120,7 @@
>编辑</a-button
> -->
<a-button @click="manage(record.id)" type="link">管理</a-button>
<DropDown v-if="checkPer(record.permissions)" value="授权">
<DropDown v-if="checkOwner(record.permissions)" value="授权">
<OwnerTableModelStudent
:types="[7, 8, 9]"
:id="record.id"
@@ -753,7 +753,8 @@ import OrgClass from "@/components/project/OrgClass";
import NameInput from "@/components/project/NameInput";
import { validateName } from "@/api/index1";
import DropDown from "@/components/common/DropDown";
import { checkPer } from "@/utils/utils";
import { checkPer ,checkOwner} from "@/utils/utils";
export default {
name: "learningPath",
@@ -1612,6 +1613,7 @@ export default {
showLearnBgMore,
closeLearnBgMore,
checkPer,
checkOwner,
getLearnPathInfo,
};
},

View File

@@ -24,7 +24,7 @@
>
<div :style="{ fontSize: '24px', paddingBottom: '30px' }">用户登录</div>
<div>
<a-input placeholder="用户名" v-model:value="form.account" />
<a-input placeholder="用户名" v-model:value="form.username" />
<a-input
placeholder="密码"
v-model:value="form.password"
@@ -51,7 +51,7 @@ export default {
const state = reactive({
form: {
// account: "00004409",
account: "10181457",
username: "10181457",
password: "1234567890Aa",
},
});

View File

@@ -160,7 +160,7 @@
>撤回发布</a-button
>
<a-button v-if="record.type === 3" @click="baseInfo(record)" type="link">管理</a-button>
<DropDown v-if="checkPer(record.permissions) && checkOwner(record.permissions)" value="授权">
<DropDown v-if="checkOwner(record.permissions)" value="授权">
<OwnerTableModelStudent
:types="[4, 5, 6]"
:id="record.id"