mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 22:06:45 +08:00
Merge remote-tracking branch 'origin/user-modify' into cloud
This commit is contained in:
37
src/App.vue
37
src/App.vue
@@ -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 {request} from "@/api/request";
|
||||
import {USER_PERMISSION, VALIDATE_TOKEN} from "@/api/apis";
|
||||
|
||||
const store = useStore();
|
||||
const isLogin = ref(false);
|
||||
@@ -37,13 +37,11 @@ const isLogin = ref(false);
|
||||
console.log("版本3.1.1------------");
|
||||
|
||||
|
||||
|
||||
// 监听关闭浏览器
|
||||
let time1 = ref(0);
|
||||
let time2 = ref(0);
|
||||
|
||||
onMounted(() => {
|
||||
init()
|
||||
window.addEventListener('beforeunload', e => beforeunloadHandler(e));
|
||||
window.addEventListener('unload', e => unloadHandler(e));
|
||||
})
|
||||
@@ -53,18 +51,7 @@ function beforeunloadHandler() {
|
||||
time1.value = new Date().getTime();
|
||||
}
|
||||
|
||||
function init() {
|
||||
getUserInfo();
|
||||
getUserPermission();
|
||||
initDict("content_type"); //内容分类
|
||||
initDict("project_level"); //项目级别
|
||||
initDict("project_sys"); //培训分类
|
||||
initDict("project_pic"); //项目封面
|
||||
initDict("router_pic"); //路径图封面
|
||||
initDict("course_pic"); //课程封面
|
||||
initDict("job_type"); //岗位
|
||||
initDict("band"); //band
|
||||
}
|
||||
|
||||
|
||||
function unloadHandler() {
|
||||
time2.value = new Date().getTime() - time1.value;
|
||||
@@ -74,23 +61,6 @@ function unloadHandler() {
|
||||
}
|
||||
}
|
||||
|
||||
async function getUserInfo() {
|
||||
const userInfo = await api2.userInfo();
|
||||
store.commit("SET_USER", userInfo.data.data);
|
||||
}
|
||||
|
||||
async function initDict(key) {
|
||||
const list = await getDictList(key);
|
||||
store.commit("SET_DICT", {key, data: list});
|
||||
}
|
||||
|
||||
function getUserPermission(){
|
||||
boeRequest(USER_PERMISSION,{permissionType:'PAGE'}).then(res=>{
|
||||
store.commit("SET_PERMISSION", res.result.flatMap(t=>t?.permissionPageList.map(s=>s.url)));
|
||||
})
|
||||
}
|
||||
|
||||
const getDictList = (param) => api1.getDictTree({code: param,}).then((res) => res.data.data);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
#app {
|
||||
@@ -109,6 +79,7 @@ const getDictList = (param) => api1.getDictTree({code: param,}).then((res) => re
|
||||
text-align: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-table-tbody > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td {
|
||||
background: #f6f9fd;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -23,3 +23,16 @@ 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";
|
||||
export const VALIDATE_TOKEN = "/admin/thirdApi/validateToken";
|
||||
export const REFRESH_TOKEN = "/admin/thirdApi/refreshToken";
|
||||
export const LOGOUT = "/admin/thirdApi/logOut";
|
||||
export const USER_INFO = "/admin/CheckUser/userInfo";
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import {isRef, reactive, ref, toRefs, unref, watch, watchEffect} from "vue";
|
||||
import {getCookieForName, throttle} from "@/api/method";
|
||||
import {getCookieForName, setCookie, throttle} from "@/api/method";
|
||||
import JSONBigInt from "json-bigint";
|
||||
import router from "@/router";
|
||||
import {message} from "ant-design-vue";
|
||||
import {REFRESH_TOKEN, VALIDATE_TOKEN} from "@/api/apis";
|
||||
|
||||
const JSONBigIntStr = JSONBigInt({ storeAsString: true });
|
||||
|
||||
@@ -79,69 +80,97 @@ export function useBoeApiPage(_url, params = {}, config = {
|
||||
};
|
||||
}
|
||||
|
||||
export function useBoeApi(_url, params = {}, config = {
|
||||
init: true,
|
||||
result: res => res.result,
|
||||
}) {
|
||||
// export function useBoeApi(_url, params = {}, config = {
|
||||
// init: true,
|
||||
// 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,
|
||||
// };
|
||||
// }
|
||||
|
||||
// export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
//
|
||||
// const state = reactive({
|
||||
// data: [],
|
||||
// loading: false,
|
||||
// total: 0,
|
||||
// totalPage: 0,
|
||||
// page: 1,
|
||||
// ...params
|
||||
// });
|
||||
//
|
||||
// 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) {
|
||||
const state = reactive({
|
||||
data: [],
|
||||
loading: false,
|
||||
});
|
||||
watch(() => params, () => {
|
||||
fetch();
|
||||
total: 1,
|
||||
pageNo: 1,
|
||||
pages: 1,
|
||||
loading: false
|
||||
});
|
||||
|
||||
function reset() {
|
||||
state.data = [];
|
||||
state.loading = false;
|
||||
}
|
||||
|
||||
function fetch() {
|
||||
state.loading = true;
|
||||
return boeRequest(_url, params).then(r => {
|
||||
state.data = config.result(r);
|
||||
return request(unref(_url), unref(params)).then(r => {
|
||||
state.data = r.data.list;
|
||||
state.total = r.data.total;
|
||||
state.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
config.init && fetch();
|
||||
return {
|
||||
...toRefs(state),
|
||||
fetch,
|
||||
reset,
|
||||
};
|
||||
}
|
||||
|
||||
export function useBoeUserListPage(_url, params = {}, init = true) {
|
||||
|
||||
const state = reactive({
|
||||
data: [],
|
||||
loading: false,
|
||||
total: 0,
|
||||
totalPage: 0,
|
||||
page: 1,
|
||||
...params
|
||||
});
|
||||
|
||||
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 useRowsPageNoInit(_url, params) {
|
||||
const state = reactive({
|
||||
data: [],
|
||||
@@ -290,7 +319,32 @@ export function useRequest(_url, params, init = true) {
|
||||
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 = {}) {
|
||||
const s = _url.split(" ");
|
||||
let url = s[0];
|
||||
@@ -352,13 +406,21 @@ export async function request(_url, params) {
|
||||
if (res.code === 0 || res.code === 200) {
|
||||
return res;
|
||||
}
|
||||
if (res.code === 1000) {
|
||||
if (res.code === 1000 || res.code === 1002) {
|
||||
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ?
|
||||
router.push({path: 'login', query: { returnUrl: router.currentRoute.value.fullPath }}) :
|
||||
(window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath))
|
||||
localStorage.removeItem('refreshPage')
|
||||
return Promise.reject(res);
|
||||
}else if(res.code=== 1001){
|
||||
request(REFRESH_TOKEN).then((res)=>{
|
||||
if(res.code===0 || res.code === 200){
|
||||
|
||||
return request(_url, params)
|
||||
}
|
||||
})
|
||||
}
|
||||
//刷新token
|
||||
res.show ? message.error(res.msg):message.error('系统接口数据异常,请联系管理员');
|
||||
return Promise.reject(res);
|
||||
});
|
||||
|
||||
@@ -174,26 +174,26 @@
|
||||
<router-link to="/researchmanage">评估管理</router-link>
|
||||
</a-menu-item>
|
||||
|
||||
<a-sub-menu key="sub6">
|
||||
<template #icon>
|
||||
<div class="imgBox">
|
||||
<img
|
||||
style="width: 22px; height: 22px"
|
||||
src="../assets/images/navleft/review.png"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #title>系统管理</template>
|
||||
<a-menu-item key="sub6-1">
|
||||
<span
|
||||
:class="{
|
||||
circleActive: selectedKeys[0] === 'sub6-1',
|
||||
circle: selectedKeys[0]!=='sub6-1',
|
||||
}"
|
||||
></span>
|
||||
<router-link to="/dictmanage">字典管理</router-link>
|
||||
</a-menu-item>
|
||||
</a-sub-menu>
|
||||
<!-- <a-sub-menu key="sub6">-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <div class="imgBox">-->
|
||||
<!-- <img-->
|
||||
<!-- style="width: 22px; height: 22px"-->
|
||||
<!-- src="../assets/images/navleft/review.png"-->
|
||||
<!-- />-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
<!-- <template #title>系统管理</template>-->
|
||||
<!-- <a-menu-item key="sub6-1">-->
|
||||
<!-- <span-->
|
||||
<!-- :class="{-->
|
||||
<!-- circleActive: selectedKeys[0] === 'sub6-1',-->
|
||||
<!-- circle: selectedKeys[0]!=='sub6-1',-->
|
||||
<!-- }"-->
|
||||
<!-- ></span>-->
|
||||
<!-- <router-link to="/dictmanage">字典管理</router-link>-->
|
||||
<!-- </a-menu-item>-->
|
||||
<!-- </a-sub-menu>-->
|
||||
|
||||
<a-menu-item key="sub5" v-if="checkMenu('systemManage')">
|
||||
<div class="imgBox">
|
||||
|
||||
@@ -49,6 +49,8 @@ import {computed, reactive} from "vue";
|
||||
import {studentUrl,teacherUrl} from "@/api/method";
|
||||
import router from "@/router";
|
||||
import {useStore, createStore} from "vuex";
|
||||
import {LOGOUT} from "@/api/apis";
|
||||
import {request} from "@/api/request";
|
||||
|
||||
const store = useStore();
|
||||
|
||||
@@ -83,7 +85,8 @@ const changeRole = (value) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
const logOut = () => {
|
||||
const logOut = async () => {
|
||||
await request(LOGOUT)
|
||||
store.replaceState(createStore({state: {openpages: []}}).state);
|
||||
localStorage.clear();
|
||||
(process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'alpine') ? router.push({path: '/login'}) : (window.location.href = window.location.protocol + process.env.VUE_APP_LOGIN_URL)
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
@@ -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 {request, useArrayRequest, 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 } = useArrayRequest(
|
||||
ORG_LIST,
|
||||
{ keyword: "" },
|
||||
{
|
||||
init: true,
|
||||
result: (res) => res.result.map((e) => ({ ...e, isLeaf: false })),
|
||||
}
|
||||
);
|
||||
|
||||
watch(props, () => {
|
||||
@@ -70,9 +66,9 @@ watch(props, () => {
|
||||
});
|
||||
|
||||
function onLoadData(treeNode) {
|
||||
return boeRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||||
return useArrayRequest(ORG_CHILD_LIST, { keyword: "", orgId: treeNode.id }).then(
|
||||
(r) => {
|
||||
treeNode.dataRef.treeChildList = r.result.directChildList;
|
||||
treeNode.dataRef.treeChildList = r.data;
|
||||
options.value = [...options.value];
|
||||
}
|
||||
);
|
||||
@@ -87,7 +83,6 @@ function change(
|
||||
},
|
||||
}
|
||||
) {
|
||||
console.log("label2222", label, namePath, value);
|
||||
emit("update:name", label);
|
||||
emit("update:fullName", namePath);
|
||||
emit("update:value", value);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</template>
|
||||
<script setup>
|
||||
import {defineEmits, defineProps, ref, watch, watchEffect} from "vue";
|
||||
import { boeRequest, useBoeApi } from "@/api/request";
|
||||
import {request, 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(()=>{
|
||||
@@ -84,9 +80,9 @@ watch(props, () => {
|
||||
});
|
||||
|
||||
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;
|
||||
options.value = [...options.value];
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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 {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,
|
||||
|
||||
@@ -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 { 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: "" });
|
||||
}
|
||||
|
||||
48
src/main.js
48
src/main.js
@@ -16,6 +16,10 @@ import 'element-plus/dist/index.css'
|
||||
import "@/assets/scss/common.scss"
|
||||
import Antd from 'ant-design-vue';
|
||||
import 'ant-design-vue/dist/antd.css';
|
||||
import {request} from "@/api/request";
|
||||
import {USER_INFO, USER_PERMISSION, VALIDATE_TOKEN} from "@/api/apis";
|
||||
import * as api1 from "@/api/index1";
|
||||
import {getCookieForName} from "@/api/method";
|
||||
// import axios from 'axios'
|
||||
// axios.defaults.withCredentials = true;
|
||||
// import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||
@@ -25,7 +29,51 @@ app.config.warnHandler = () => null;
|
||||
// app.use(ElementPlus, {
|
||||
// locale: zhCn,
|
||||
// })
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (!getCookieForName("token")) {
|
||||
window.location.href = process.env.VUE_APP_LOGIN_URL + encodeURIComponent(window.location.protocol + process.env.VUE_APP_BOE_API_URL + process.env.VUE_APP_BASE + router.currentRoute.value.fullPath)
|
||||
return
|
||||
}
|
||||
//第一次进入 没有用户信息
|
||||
if(!store.state.userInfo.userId){
|
||||
try{
|
||||
await request(VALIDATE_TOKEN)
|
||||
await getUserInfo()
|
||||
await getUserPermission();
|
||||
init()
|
||||
next();
|
||||
}catch (e){
|
||||
console.log('token失效 跳转到登录页')
|
||||
}
|
||||
}
|
||||
})
|
||||
app.use(Antd);
|
||||
app.use(router);
|
||||
app.use(store);
|
||||
app.mount('#app');
|
||||
async function getUserPermission() {
|
||||
return request(USER_PERMISSION, {permissionType: 'PAGE'}).then(res => {
|
||||
store.commit("SET_PERMISSION", res.data?.map(s => s.url));
|
||||
})
|
||||
}
|
||||
async function getUserInfo() {
|
||||
const userInfo = await request(USER_INFO);
|
||||
store.commit("SET_USER", userInfo.data.data);
|
||||
}
|
||||
async function initDict(key) {
|
||||
const list = await getDictList(key);
|
||||
store.commit("SET_DICT", {key, data: list});
|
||||
}
|
||||
const getDictList = (param) => api1.getDictTree({code: param,}).then((res) => res.data.data);
|
||||
|
||||
async function init() {
|
||||
initDict("content_type"); //内容分类
|
||||
initDict("project_level"); //项目级别
|
||||
initDict("project_sys"); //培训分类
|
||||
initDict("project_pic"); //项目封面
|
||||
initDict("router_pic"); //路径图封面
|
||||
initDict("course_pic"); //课程封面
|
||||
initDict("job_type"); //岗位
|
||||
initDict("band"); //band
|
||||
}
|
||||
@@ -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];
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = defineConfig({
|
||||
port: 8070,
|
||||
proxy: {
|
||||
"/manageApi": {
|
||||
target: 'http:' + process.env.VUE_APP_PROXY_URL,
|
||||
target: 'https:' + process.env.VUE_APP_PROXY_URL,
|
||||
changeOrigin: true, //表示是否改变原域名
|
||||
pathRewrite: {
|
||||
"^/manageApi": "",
|
||||
|
||||
Reference in New Issue
Block a user