017b3a25 by lihua

连接器注销后进入系统,只提示一次无法使用

1 parent 6703289d
......@@ -141,6 +141,12 @@ export const getConnectorDetail = (guid) => request({
method: 'get'
})
/** 获取当前连接器状态 */
export const getConnectorStatus = () => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/tds-connector-identity/get-connector`,
method: 'get'
})
/** 判断当前用户企业是否已申请连接器 */
export const checkConnector = () => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/tds-connector-identity/check-connector `,
......
......@@ -318,6 +318,12 @@ export const getCurrentUserInfo = (params) => {
});
};
/** 管理员连接器注销 */
export const stopLogonUserConnector = () => request({
url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/connect/log-out`,
method: 'get'
})
/** 下载文件模板 */
export const exportTemplate = (params) => request({
url: `${import.meta.env.VITE_APP_ADD_FILE}/import-config/export-template?bizGuid=${params.bizGuid}&importType=${params.importType}`,
......
......@@ -5,13 +5,17 @@ import useSettingsStore from '@/store/modules/settings'
import useUserStore from '@/store/modules/user'
import { USERROLE } from '@/utils/enum'
import { ElMessage } from 'element-plus'
import { stopLogonUserConnector } from '@/api/modules/queryService'
const router = useRouter()
const settingsStore = useSettingsStore()
const userStore = useUserStore()
const userData = JSON.parse(userStore.userData);
const tenantInfo = JSON.parse(localStorage.getItem('tenantInfo') || '{}');
const mainPage = useMainPage()
const { isFullscreen, toggle } = useFullscreen()
const { proxy } = getCurrentInstance() as any;
const dataRole = computed(() => {
return localStorage.getItem('userRole');
})
......@@ -19,7 +23,7 @@ const dataRole = computed(() => {
/** 记录用户选择的角色 */
const selectRole: any = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。
function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole') {
function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole' | 'stopConnector') {
switch (command) {
case 'home':
router.push({
......@@ -46,8 +50,32 @@ function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'lo
selectRole.value = dataRole.value;
verifyDialogInfo.value.visible = true;
break;
case 'stopConnector':
stopConnector()
break;
}
}
function stopConnector() {
proxy.$openMessageBox("是否确认注销当前连接器?", "warning", () => {
stopLogonUserConnector().then((res: any) => {
if (res?.code == '00000') {
localStorage.setItem('isLogOutConnector', 'Y');
userStore.isLogOutConnector = 'Y';
ElMessage({
type: "success",
message: "连接器注销成功",
});
}
});
}, () => {
ElMessage({
type: "info",
message: "已取消",
});
})
}
function pro() {
window.open('https://hooray.gitee.io/fantastic-admin-pro-example/', '_blank')
}
......@@ -158,6 +186,19 @@ const verifyDialogBtnClick = (btn, info) => {
</span>
</div>
</div>
<template v-if="tenantInfo?.logonUser == userData?.mobileNo">
<div class="horizontal-line"></div>
<div class="user-setting-menu">
<div class="menu-wrapper" @click="userCommand('stopConnector')">
<span class="color-21">连接器注销</span>
<span>
<el-icon>
<svg-icon name="ep:arrow-right" />
</el-icon>
</span>
</div>
</div>
</template>
<div class="horizontal-line"></div>
<div class="login-out">
<div class="login-out-btn" @click="userCommand('logout')">
......
......@@ -5,6 +5,7 @@ import { ElMessage } from 'element-plus'
import apiUser from '@/api/modules/user'
import { getCurrentTime } from '@/utils/common'
import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface, getCurrentUserInfo, getTenantDetailInfo } from '@/api/modules/queryService'
import { getConnectorStatus } from '@/api/modules/dataRequire'
const useUserStore = defineStore(
// 唯一ID
......@@ -25,6 +26,8 @@ const useUserStore = defineStore(
const permissions = ref<string[]>([])
const isLoginOut = ref(false);
const isLogin = ref(token.value ? true : false);//退出登录。
//当前连接器是否已注销
const isLogOutConnector = ref(localStorage.isLogOutConnector ?? 'N');
const getTokenPromise: any = ref(null);
/* idass的登录页面url,退出登录需要跳转到登录页。*/
const idassLoginUrl = import.meta.env.VITE_IDASS_BASEURL;
......@@ -63,6 +66,14 @@ const useUserStore = defineStore(
ElMessage.error(res.msg)
}
})
getConnectorStatus().then((res: any) => {
if (res.code == '00000') {
isLogOutConnector.value = res.data?.isLogOut || 'N';
localStorage.setItem('isLogOutConnector', isLogOutConnector.value);
} else {
// 暂不弹错误提示
}
})
return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => {
console.log(res, 'getCurrentUserInfo');
if (res.code == '00000') {
......@@ -351,6 +362,7 @@ const useUserStore = defineStore(
isLogin,
isGetCurrUserInfo,
isLoginOut,
isLogOutConnector,
getTokenPromise,
getToken,
getUserSystemMenuByRole,
......
......@@ -3,6 +3,7 @@ import Storage from './composables/storage-helper';
import CryptoHelper from './composables/cryptoJs-helper';
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
import router from '@/router'
const CANCELTTYPE = {
CACHE: 1,
......@@ -13,8 +14,9 @@ interface Request {
source: CancelTokenSource;
}
const pendingRequests: Request[] = [];
const storage = new Storage();
const cryptoHelper = new CryptoHelper('cacheKey');
// 记录当前提示过的路由,用于判断是否需要重复提示
let currentNotifiedRoute: string | null = null;
const service = axios.create({
baseURL: (import.meta.env.VITE_OPEN_PROXY === 'true') ? `/api/` : `${import.meta.env.VITE_API_BASEURL}`,
......@@ -33,6 +35,48 @@ service.interceptors.request.use(
const source = axios.CancelToken.source();
config.headers.tenant = localStorage.getItem('currentTenantGuid'); //会员guid先写死
config.cancelToken = source.token;
// 检查isLogOutConnector为Y的情况
const isLogOutConnector = localStorage.getItem('isLogOutConnector');
if (isLogOutConnector === 'Y') {
// 使用router.currentRoute.value获取当前路由信息
const currentRoute = router.currentRoute.value;
const routePath = currentRoute.path;
// 检查api的url是否包含/connector-invoke
if (config.url.includes('/connector-invoke')) {
try {
// 检查路由的meta配置中editPage是否为true
if (currentRoute.meta?.editPage === true || routePath.includes('data-product/product-catalog')) { //产品目录功能比较特殊。
// 确保同一个路由只提示一次,但路由切换后再次回来需要重新提示
if (currentNotifiedRoute !== routePath) {
ElMessage({
message: '连接器已注销,无法使用该功能',
type: 'error',
});
currentNotifiedRoute = routePath;
}
// 取消请求
source.cancel(JSON.stringify({
type: CANCELTTYPE.REPEAT,
data: '连接器已注销,取消请求',
}));
} else {
// 取消请求
source.cancel(JSON.stringify({
type: CANCELTTYPE.REPEAT,
data: '连接器已注销,取消请求',
}));
}
} catch (error) {
// 路由获取失败时的处理
console.error('获取路由信息失败:', error);
}
} else {
if (currentNotifiedRoute !== routePath) {
currentNotifiedRoute = null;
}
}
}
if (config.method === "postfile") {
config.method = "post";
config.headers = Object.assign({}, config.headers, {
......@@ -79,7 +123,7 @@ service.interceptors.request.use(
// }));
// }
/** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */
if (config.url.indexOf('/portal/portal')) {
if (config.url.indexOf('/portal/portal') > -1) {
config.headers.Authorization = localStorage.getItem('token');
config.headers['real-ip'] = localStorage.getItem('ipAddress');
return config;
......
......@@ -306,11 +306,11 @@ onBeforeMount(() => {
getDamTypesList({
dictType: "资产类型",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
damTypes.value = res.data || [];
if (res?.code == proxy.$passCode) {
damTypes.value = res?.data || [];
searchItemList.value[1].options = damTypes.value;
} else {
proxy.$ElMessage.error(res.msg);
res?.msg && proxy.$ElMessage.error(res.msg);
}
})
})
......
......@@ -868,7 +868,7 @@ const getUserTenantInfo = () => {
}
})
} else {
ElMessage.error(res1.msg);
res1?.msg && ElMessage.error(res1.msg);
}
// 处理公司信息
let res = resInfos?.[1];
......
......@@ -639,8 +639,8 @@ const promiseList = async (...promises: (() => Promise<void>)[]) => {
if (approveStaffGuids.indexOf(userData.staffGuid) > -1) {
flowState.value = 2;
}
} catch (e) {
} catch (e) {
loading.value = false;
}
};
......@@ -649,7 +649,7 @@ const promiseList = async (...promises: (() => Promise<void>)[]) => {
const getDataType = async (dictType, fieldName) => {
try {
const res: any = await getParamsList({ dictType });
if (res.code === proxy.$passCode) {
if (res?.code === proxy.$passCode) {
const data = res.data || [];
typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
if (fieldName == 'tenantType' || fieldName == 'institutionType') {
......@@ -665,7 +665,7 @@ const getDataType = async (dictType, fieldName) => {
}
}
} else {
proxy.$ElMessage.error(res.msg);
res?.msg && proxy.$ElMessage.error(res.msg);
}
} catch (error) {
throw error; // 将错误向上抛出
......@@ -790,78 +790,70 @@ const setFormItems = () => {
// 获取详情
const getDetail = async () => {
try {
const res1: any = await getParamsList({ dictType: '开发主体附件类型' });
if (res1?.code === proxy.$passCode) {
uploadFileList.value = res1.data || [];
uploadFormItems.value = uploadFileList.value.map(d => {
const res1: any = await getParamsList({ dictType: '开发主体附件类型' });
if (res1?.code === proxy.$passCode) {
uploadFileList.value = res1.data || [];
uploadFormItems.value = uploadFileList.value.map(d => {
return {
label: d.label,
tip: '支持扩展名:pdf、png、jpg、rar、zip,单个文件不得大于10M',
type: 'upload-file',
accept: '.pdf, .png, .jpg, .rar, .zip',
required: false,
disabled: true,
limitSize: 10,
default: [],
field: `files-${d.value}`,
}
})
} else {
res1?.msg && proxy.$ElMessage.error(res1.msg);
}
const res: any = await getEnterpriseDetail({ guid: bizGuid });
if (res?.code === proxy.$passCode) {
const data = res.data || {};
deploymentId.value = '';
processInstanceId.value = '';
flowState.value = 0;
flowDetail.value = data;
tableData.value = data.changeList || [];
beforeChangeList.value = data.beforeChangeList || [];
getMergeRow();
orgData.value = data.domainRSVOS || [];;
orgTableInfo.value.data = orgData.value;
let attachmentRQVOS = data.attachmentRSVOS || [];
uploadFormItems.value.forEach(item => {
let field = item.field;
let key = field.slice(6);
item.default = attachmentRQVOS.filter(a => a.fileType == key).map(f => {
return {
label: d.label,
tip: '支持扩展名:pdf、png、jpg、rar、zip,单个文件不得大于10M',
type: 'upload-file',
accept: '.pdf, .png, .jpg, .rar, .zip',
required: false,
disabled: true,
limitSize: 10,
default: [],
field: `files-${d.value}`,
name: f.fileName,
url: f.fileUrl
}
})
} else {
proxy.$ElMessage.error(res1.msg);
}
const res: any = await getEnterpriseDetail({ guid: bizGuid });
if (res.code === proxy.$passCode) {
const data = res.data || {};
deploymentId.value = '';
processInstanceId.value = '';
flowState.value = 0;
flowDetail.value = data;
tableData.value = data.changeList || [];
beforeChangeList.value = data.beforeChangeList || [];
getMergeRow();
orgData.value = data.domainRSVOS || [];;
orgTableInfo.value.data = orgData.value;
let attachmentRQVOS = data.attachmentRSVOS || [];
uploadFormItems.value.forEach(item => {
let field = item.field;
let key = field.slice(6);
item.default = attachmentRQVOS.filter(a => a.fileType == key).map(f => {
return {
name: f.fileName,
url: f.fileUrl
}
})
// if (!item.default?.length) {
// item.visible = false;
// } else {
// item.visible = true;
// }
item.disabled = true;
})
} else {
proxy.$ElMessage.error(res.msg);
}
} catch (error) {
throw error; // 将错误向上抛出
// if (!item.default?.length) {
// item.visible = false;
// } else {
// item.visible = true;
// }
item.disabled = true;
})
} else {
res?.msg && proxy.$ElMessage.error(res.msg);
}
}
// 获取变更详情
const getChangeDetail = async () => {
try {
const res: any = await getLastChange(bizGuid);
if (res.code === proxy.$passCode) {
const data = res.data || {};
const bizData = JSON.parse(data.bizDataJson || '{}');
const approveVO = data.approveVO || {};
flowDetail.value = { ...flowDetail.value, approveVO: { ...flowDetail.value.approveVO, ...approveVO }, ...bizData };
const res: any = await getLastChange(bizGuid);
if (res.code === proxy.$passCode) {
const data = res.data || {};
const bizData = JSON.parse(data.bizDataJson || '{}');
const approveVO = data.approveVO || {};
flowDetail.value = { ...flowDetail.value, approveVO: { ...flowDetail.value.approveVO, ...approveVO }, ...bizData };
} else {
proxy.$ElMessage.error(res.msg);
}
} catch (error) {
throw error; // 将错误向上抛出
} else {
proxy.$ElMessage.error(res.msg);
}
}
......@@ -1314,7 +1306,7 @@ const viewVoucherFile = () => {
@expand="(v) => expand7 = v">
<Table ref="orgsTableRef" :tableInfo="orgTableInfo" class="fiveRow-table" />
</ContentWrap>
<ContentWrap id="id-files" title="开发主体附件信息" description="" expandSwicth style="margin-top: 15px"
<ContentWrap id="id-files" v-show="uploadFormItems?.length" title="开发主体附件信息" description="" expandSwicth style="margin-top: 15px"
:isExpand="uploadInfoExpand" @expand="(v) => uploadInfoExpand = v">
<Form class='uploadForm' ref="uploadFormRef" :itemList="uploadFormItems" formId="upload-form"
:rules="uploadFormRules" col="col2" />
......
......@@ -624,13 +624,13 @@ onBeforeMount(() => {
getDamTypesList({
dictType: "资产类型",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
if (res?.code == proxy.$passCode) {
damTypes.value = res.data || [];
searchItemList.value[1].options = damTypes.value;
// let item = searchItemList.value.find(item => item.field == 'damType');
// item && (item.options = damTypes.value);
} else {
proxy.$ElMessage.error(res.msg);
res?.msg && proxy.$ElMessage.error(res.msg);
}
})
// 连接器没有通过和驳回,不需要审批通过时填写合规信息。
......
......@@ -1022,7 +1022,7 @@ const getFirstPageData = () => {
};
onMounted(() => {
getParamsList({ dictType: "业务系统" }).then((res) => {
flowList.value = res.data
flowList.value = res?.data || []
contents.value.normal.items[3].options = flowList.value
})
})
......
......@@ -849,7 +849,7 @@ onBeforeMount(() => {
nodeInfoFormItems.value[1].default = ''; //如果是中介的话,不能选择自己吧。
}
}
getContractDataProduct(userData.tenantGuid).then((res: any) => {
userStore.isLogOutConnector != 'Y' && getContractDataProduct(userData.tenantGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
productList.value = res.data || [];
productTableInfo.value.editInfo.dataProductId.options = productList.value;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!