54a512fb by lihua

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

1 parent 894dc232
...@@ -141,6 +141,12 @@ export const getConnectorDetail = (guid) => request({ ...@@ -141,6 +141,12 @@ export const getConnectorDetail = (guid) => request({
141 method: 'get' 141 method: 'get'
142 }) 142 })
143 143
144 /** 获取当前连接器状态 */
145 export const getConnectorStatus = () => request({
146 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/tds-connector-identity/get-connector`,
147 method: 'get'
148 })
149
144 /** 判断当前用户企业是否已申请连接器 */ 150 /** 判断当前用户企业是否已申请连接器 */
145 export const checkConnector = () => request({ 151 export const checkConnector = () => request({
146 url: `${import.meta.env.VITE_API_COMMON_URL}/tds-connector-identity/check-connector `, 152 url: `${import.meta.env.VITE_API_COMMON_URL}/tds-connector-identity/check-connector `,
......
...@@ -326,6 +326,12 @@ export const getCurrentUserInfo = (params) => { ...@@ -326,6 +326,12 @@ export const getCurrentUserInfo = (params) => {
326 }); 326 });
327 }; 327 };
328 328
329 /** 管理员连接器注销 */
330 export const stopLogonUserConnector = () => request({
331 url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/connect/log-out`,
332 method: 'get'
333 })
334
329 /** 下载文件模板 */ 335 /** 下载文件模板 */
330 export const exportTemplate = (params) => request({ 336 export const exportTemplate = (params) => request({
331 url: `${import.meta.env.VITE_APP_ADD_FILE}/import-config/export-template?bizGuid=${params.bizGuid}&importType=${params.importType}`, 337 url: `${import.meta.env.VITE_APP_ADD_FILE}/import-config/export-template?bizGuid=${params.bizGuid}&importType=${params.importType}`,
......
...@@ -6,10 +6,12 @@ import { USERROLE } from '@/utils/enum' ...@@ -6,10 +6,12 @@ import { USERROLE } from '@/utils/enum'
6 import { ElMessage } from 'element-plus'; 6 import { ElMessage } from 'element-plus';
7 import Retrievepassword from '@/components/Retrievepassword/index.vue' 7 import Retrievepassword from '@/components/Retrievepassword/index.vue'
8 8
9 import { stopLogonUserConnector } from '@/api/modules/queryService'
9 const router = useRouter() 10 const router = useRouter()
10 const settingsStore = useSettingsStore() 11 const settingsStore = useSettingsStore()
11 const userStore = useUserStore() 12 const userStore = useUserStore()
12 const userData = JSON.parse(userStore.userData); 13 const userData = JSON.parse(userStore.userData);
14 const tenantInfo = JSON.parse(localStorage.getItem('tenantInfo') || '{}');
13 const mainPage = useMainPage() 15 const mainPage = useMainPage()
14 16
15 const { proxy } = getCurrentInstance() as any; 17 const { proxy } = getCurrentInstance() as any;
...@@ -19,6 +21,8 @@ const retrievepassword = ref({ ...@@ -19,6 +21,8 @@ const retrievepassword = ref({
19 visible: false, 21 visible: false,
20 }) 22 })
21 23
24 const { proxy } = getCurrentInstance() as any;
25
22 const dataRole = computed(() => { 26 const dataRole = computed(() => {
23 return localStorage.getItem('userRole'); 27 return localStorage.getItem('userRole');
24 }) 28 })
...@@ -26,7 +30,7 @@ const dataRole = computed(() => { ...@@ -26,7 +30,7 @@ const dataRole = computed(() => {
26 /** 记录用户选择的角色 */ 30 /** 记录用户选择的角色 */
27 const selectRole: any = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。 31 const selectRole: any = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。
28 32
29 function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole') { 33 function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole' | 'stopConnector') {
30 switch (command) { 34 switch (command) {
31 case 'home': 35 case 'home':
32 router.push({ 36 router.push({
...@@ -53,10 +57,35 @@ function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'lo ...@@ -53,10 +57,35 @@ function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'lo
53 selectRole.value = dataRole.value; 57 selectRole.value = dataRole.value;
54 verifyDialogInfo.value.visible = true; 58 verifyDialogInfo.value.visible = true;
55 break; 59 break;
60 case 'stopConnector':
61 stopConnector()
62 break;
56 } 63 }
57 } 64 }
58 65
66 function stopConnector() {
67 proxy.$openMessageBox("是否确认注销当前连接器?", "warning", () => {
68 stopLogonUserConnector().then((res: any) => {
69 if (res?.code == '00000') {
70 localStorage.setItem('isLogOutConnector', 'Y');
71 userStore.isLogOutConnector = 'Y';
72 ElMessage({
73 type: "success",
74 message: "连接器注销成功",
75 });
76 }
77 });
78 }, () => {
79 ElMessage({
80 type: "info",
81 message: "已取消",
82 });
83 })
84 }
59 85
86 function pro() {
87 window.open('https://hooray.gitee.io/fantastic-admin-pro-example/', '_blank')
88 }
60 const loaclStorageInfo: any = localStorage.getItem("userData") 89 const loaclStorageInfo: any = localStorage.getItem("userData")
61 onMounted(() => { 90 onMounted(() => {
62 console.log('mounted', JSON.parse(userStore.userData).abbreviation) 91 console.log('mounted', JSON.parse(userStore.userData).abbreviation)
...@@ -164,6 +193,19 @@ const verifyDialogBtnClick = (btn, info) => { ...@@ -164,6 +193,19 @@ const verifyDialogBtnClick = (btn, info) => {
164 </span> 193 </span>
165 </div> 194 </div>
166 </div> 195 </div>
196 <template v-if="tenantInfo?.logonUser == userData?.mobileNo">
197 <div class="horizontal-line"></div>
198 <div class="user-setting-menu">
199 <div class="menu-wrapper" @click="userCommand('stopConnector')">
200 <span class="color-21">连接器注销</span>
201 <span>
202 <el-icon>
203 <svg-icon name="ep:arrow-right" />
204 </el-icon>
205 </span>
206 </div>
207 </div>
208 </template>
167 <div class="horizontal-line"></div> 209 <div class="horizontal-line"></div>
168 <div class="user-setting-menu"> 210 <div class="user-setting-menu">
169 <div class="menu-wrapper" @click="userCommand('updatePwd')"> 211 <div class="menu-wrapper" @click="userCommand('updatePwd')">
......
...@@ -5,6 +5,7 @@ import { ElMessage } from 'element-plus' ...@@ -5,6 +5,7 @@ import { ElMessage } from 'element-plus'
5 import apiUser from '@/api/modules/user' 5 import apiUser from '@/api/modules/user'
6 import { getCurrentTime } from '@/utils/common' 6 import { getCurrentTime } from '@/utils/common'
7 import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface, getCurrentUserInfo, getTenantDetailInfo } from '@/api/modules/queryService' 7 import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface, getCurrentUserInfo, getTenantDetailInfo } from '@/api/modules/queryService'
8 import { getConnectorStatus } from '@/api/modules/dataRequire'
8 9
9 const useUserStore = defineStore( 10 const useUserStore = defineStore(
10 // 唯一ID 11 // 唯一ID
...@@ -25,6 +26,8 @@ const useUserStore = defineStore( ...@@ -25,6 +26,8 @@ const useUserStore = defineStore(
25 const permissions = ref<string[]>([]) 26 const permissions = ref<string[]>([])
26 const isLoginOut = ref(false); 27 const isLoginOut = ref(false);
27 const isLogin = ref(token.value ? true : false);//退出登录。 28 const isLogin = ref(token.value ? true : false);//退出登录。
29 //当前连接器是否已注销
30 const isLogOutConnector = ref(localStorage.isLogOutConnector ?? 'N');
28 const getTokenPromise: any = ref(null); 31 const getTokenPromise: any = ref(null);
29 /* idass的登录页面url,退出登录需要跳转到登录页。*/ 32 /* idass的登录页面url,退出登录需要跳转到登录页。*/
30 const idassLoginUrl = window.location.origin + '/';; 33 const idassLoginUrl = window.location.origin + '/';;
...@@ -63,6 +66,14 @@ const useUserStore = defineStore( ...@@ -63,6 +66,14 @@ const useUserStore = defineStore(
63 ElMessage.error(res.msg) 66 ElMessage.error(res.msg)
64 } 67 }
65 }) 68 })
69 getConnectorStatus().then((res: any) => {
70 if (res.code == '00000') {
71 isLogOutConnector.value = res.data?.isLogOut || 'N';
72 localStorage.setItem('isLogOutConnector', isLogOutConnector.value);
73 } else {
74 // 暂不弹错误提示
75 }
76 })
66 return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => { 77 return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => {
67 console.log(res, 'getCurrentUserInfo'); 78 console.log(res, 'getCurrentUserInfo');
68 if (res.code == '00000') { 79 if (res.code == '00000') {
...@@ -351,6 +362,7 @@ const useUserStore = defineStore( ...@@ -351,6 +362,7 @@ const useUserStore = defineStore(
351 isLogin, 362 isLogin,
352 isGetCurrUserInfo, 363 isGetCurrUserInfo,
353 isLoginOut, 364 isLoginOut,
365 isLogOutConnector,
354 getTokenPromise, 366 getTokenPromise,
355 getToken, 367 getToken,
356 getUserSystemMenuByRole, 368 getUserSystemMenuByRole,
......
...@@ -2,6 +2,7 @@ import axios, {CancelTokenSource} from "axios"; ...@@ -2,6 +2,7 @@ import axios, {CancelTokenSource} from "axios";
2 import CryptoHelper from './composables/cryptoJs-helper'; 2 import CryptoHelper from './composables/cryptoJs-helper';
3 import { ElMessage } from 'element-plus' 3 import { ElMessage } from 'element-plus'
4 import useUserStore from '@/store/modules/user' 4 import useUserStore from '@/store/modules/user'
5 import router from '@/router'
5 6
6 const CANCELTTYPE = { 7 const CANCELTTYPE = {
7 CACHE: 1, 8 CACHE: 1,
...@@ -13,6 +14,8 @@ interface Request { ...@@ -13,6 +14,8 @@ interface Request {
13 } 14 }
14 const pendingRequests: Request[] = []; 15 const pendingRequests: Request[] = [];
15 const cryptoHelper = new CryptoHelper('cacheKey'); 16 const cryptoHelper = new CryptoHelper('cacheKey');
17 // 记录当前提示过的路由,用于判断是否需要重复提示
18 let currentNotifiedRoute: string | null = null;
16 19
17 const IDaaSBaseURL = 'idaas' 20 const IDaaSBaseURL = 'idaas'
18 21
...@@ -33,6 +36,48 @@ service.interceptors.request.use( ...@@ -33,6 +36,48 @@ service.interceptors.request.use(
33 const source = axios.CancelToken.source(); 36 const source = axios.CancelToken.source();
34 config.headers.tenant = localStorage.getItem('currentTenantGuid'); //会员guid先写死 37 config.headers.tenant = localStorage.getItem('currentTenantGuid'); //会员guid先写死
35 config.cancelToken = source.token; 38 config.cancelToken = source.token;
39
40 // 检查isLogOutConnector为Y的情况
41 const isLogOutConnector = localStorage.getItem('isLogOutConnector');
42 if (isLogOutConnector === 'Y') {
43 // 使用router.currentRoute.value获取当前路由信息
44 const currentRoute = router.currentRoute.value;
45 const routePath = currentRoute.path;
46 // 检查api的url是否包含/connector-invoke
47 if (config.url.includes('/connector-invoke')) {
48 try {
49 // 检查路由的meta配置中editPage是否为true
50 if (currentRoute.meta?.editPage === true || routePath.includes('data-product/product-catalog')) { //产品目录功能比较特殊。
51 // 确保同一个路由只提示一次,但路由切换后再次回来需要重新提示
52 if (currentNotifiedRoute !== routePath) {
53 ElMessage({
54 message: '连接器已注销,无法使用该功能',
55 type: 'error',
56 });
57 currentNotifiedRoute = routePath;
58 }
59 // 取消请求
60 source.cancel(JSON.stringify({
61 type: CANCELTTYPE.REPEAT,
62 data: '连接器已注销,取消请求',
63 }));
64 } else {
65 // 取消请求
66 source.cancel(JSON.stringify({
67 type: CANCELTTYPE.REPEAT,
68 data: '连接器已注销,取消请求',
69 }));
70 }
71 } catch (error) {
72 // 路由获取失败时的处理
73 console.error('获取路由信息失败:', error);
74 }
75 } else {
76 if (currentNotifiedRoute !== routePath) {
77 currentNotifiedRoute = null;
78 }
79 }
80 }
36 if (config.method === "postfile") { 81 if (config.method === "postfile") {
37 config.method = "post"; 82 config.method = "post";
38 config.headers = Object.assign({}, config.headers, { 83 config.headers = Object.assign({}, config.headers, {
...@@ -88,7 +133,7 @@ service.interceptors.request.use( ...@@ -88,7 +133,7 @@ service.interceptors.request.use(
88 // })); 133 // }));
89 // } 134 // }
90 /** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */ 135 /** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */
91 if (config.url.indexOf('/portal/portal')) { 136 if (config.url.indexOf('/portal/portal') > -1) {
92 config.headers.Authorization = localStorage.getItem('token'); 137 config.headers.Authorization = localStorage.getItem('token');
93 config.headers['real-ip'] = localStorage.getItem('ipAddress'); 138 config.headers['real-ip'] = localStorage.getItem('ipAddress');
94 return config; 139 return config;
......
...@@ -306,11 +306,11 @@ onBeforeMount(() => { ...@@ -306,11 +306,11 @@ onBeforeMount(() => {
306 getDamTypesList({ 306 getDamTypesList({
307 dictType: "资产类型", 307 dictType: "资产类型",
308 }).then((res: any) => { 308 }).then((res: any) => {
309 if (res.code == proxy.$passCode) { 309 if (res?.code == proxy.$passCode) {
310 damTypes.value = res.data || []; 310 damTypes.value = res?.data || [];
311 searchItemList.value[1].options = damTypes.value; 311 searchItemList.value[1].options = damTypes.value;
312 } else { 312 } else {
313 proxy.$ElMessage.error(res.msg); 313 res?.msg && proxy.$ElMessage.error(res.msg);
314 } 314 }
315 }) 315 })
316 }) 316 })
......
...@@ -878,7 +878,7 @@ const getUserTenantInfo = () => { ...@@ -878,7 +878,7 @@ const getUserTenantInfo = () => {
878 } 878 }
879 }) 879 })
880 } else { 880 } else {
881 ElMessage.error(res1.msg); 881 res1?.msg && ElMessage.error(res1.msg);
882 } 882 }
883 // 处理公司信息 883 // 处理公司信息
884 let res = resInfos?.[1]; 884 let res = resInfos?.[1];
......
...@@ -649,7 +649,7 @@ const promiseList = async (...promises: (() => Promise<void>)[]) => { ...@@ -649,7 +649,7 @@ const promiseList = async (...promises: (() => Promise<void>)[]) => {
649 const getDataType = async (dictType, fieldName) => { 649 const getDataType = async (dictType, fieldName) => {
650 try { 650 try {
651 const res: any = await getParamsList({ dictType }); 651 const res: any = await getParamsList({ dictType });
652 if (res.code === proxy.$passCode) { 652 if (res?.code === proxy.$passCode) {
653 const data = res.data || []; 653 const data = res.data || [];
654 typeMap.value[fieldName] = JSON.parse(JSON.stringify(data)); 654 typeMap.value[fieldName] = JSON.parse(JSON.stringify(data));
655 if (fieldName == 'tenantType' || fieldName == 'institutionType') { 655 if (fieldName == 'tenantType' || fieldName == 'institutionType') {
...@@ -665,7 +665,7 @@ const getDataType = async (dictType, fieldName) => { ...@@ -665,7 +665,7 @@ const getDataType = async (dictType, fieldName) => {
665 } 665 }
666 } 666 }
667 } else { 667 } else {
668 proxy.$ElMessage.error(res.msg); 668 res?.msg && proxy.$ElMessage.error(res.msg);
669 } 669 }
670 } catch (error) { 670 } catch (error) {
671 throw error; // 将错误向上抛出 671 throw error; // 将错误向上抛出
...@@ -790,7 +790,6 @@ const setFormItems = () => { ...@@ -790,7 +790,6 @@ const setFormItems = () => {
790 790
791 // 获取详情 791 // 获取详情
792 const getDetail = async () => { 792 const getDetail = async () => {
793 try {
794 const res1: any = await getParamsList({ dictType: '开发主体附件类型' }); 793 const res1: any = await getParamsList({ dictType: '开发主体附件类型' });
795 if (res1?.code === proxy.$passCode) { 794 if (res1?.code === proxy.$passCode) {
796 uploadFileList.value = res1.data || []; 795 uploadFileList.value = res1.data || [];
...@@ -808,10 +807,10 @@ const getDetail = async () => { ...@@ -808,10 +807,10 @@ const getDetail = async () => {
808 } 807 }
809 }) 808 })
810 } else { 809 } else {
811 proxy.$ElMessage.error(res1.msg); 810 res1?.msg && proxy.$ElMessage.error(res1.msg);
812 } 811 }
813 const res: any = await getEnterpriseDetail({ guid: bizGuid }); 812 const res: any = await getEnterpriseDetail({ guid: bizGuid });
814 if (res.code === proxy.$passCode) { 813 if (res?.code === proxy.$passCode) {
815 const data = res.data || {}; 814 const data = res.data || {};
816 deploymentId.value = ''; 815 deploymentId.value = '';
817 processInstanceId.value = ''; 816 processInstanceId.value = '';
...@@ -840,16 +839,12 @@ const getDetail = async () => { ...@@ -840,16 +839,12 @@ const getDetail = async () => {
840 item.disabled = true; 839 item.disabled = true;
841 }) 840 })
842 } else { 841 } else {
843 proxy.$ElMessage.error(res.msg); 842 res?.msg && proxy.$ElMessage.error(res.msg);
844 }
845 } catch (error) {
846 throw error; // 将错误向上抛出
847 } 843 }
848 } 844 }
849 845
850 // 获取变更详情 846 // 获取变更详情
851 const getChangeDetail = async () => { 847 const getChangeDetail = async () => {
852 try {
853 const res: any = await getLastChange(bizGuid); 848 const res: any = await getLastChange(bizGuid);
854 if (res.code === proxy.$passCode) { 849 if (res.code === proxy.$passCode) {
855 const data = res.data || {}; 850 const data = res.data || {};
...@@ -860,9 +855,6 @@ const getChangeDetail = async () => { ...@@ -860,9 +855,6 @@ const getChangeDetail = async () => {
860 } else { 855 } else {
861 proxy.$ElMessage.error(res.msg); 856 proxy.$ElMessage.error(res.msg);
862 } 857 }
863 } catch (error) {
864 throw error; // 将错误向上抛出
865 }
866 } 858 }
867 859
868 const setTableField = () => { 860 const setTableField = () => {
...@@ -1314,7 +1306,7 @@ const viewVoucherFile = () => { ...@@ -1314,7 +1306,7 @@ const viewVoucherFile = () => {
1314 @expand="(v) => expand7 = v"> 1306 @expand="(v) => expand7 = v">
1315 <Table ref="orgsTableRef" :tableInfo="orgTableInfo" class="fiveRow-table" /> 1307 <Table ref="orgsTableRef" :tableInfo="orgTableInfo" class="fiveRow-table" />
1316 </ContentWrap> 1308 </ContentWrap>
1317 <ContentWrap id="id-files" title="开发主体附件信息" description="" expandSwicth style="margin-top: 15px" 1309 <ContentWrap id="id-files" v-show="uploadFormItems?.length" title="开发主体附件信息" description="" expandSwicth style="margin-top: 15px"
1318 :isExpand="uploadInfoExpand" @expand="(v) => uploadInfoExpand = v"> 1310 :isExpand="uploadInfoExpand" @expand="(v) => uploadInfoExpand = v">
1319 <Form class='uploadForm' ref="uploadFormRef" :itemList="uploadFormItems" formId="upload-form" 1311 <Form class='uploadForm' ref="uploadFormRef" :itemList="uploadFormItems" formId="upload-form"
1320 :rules="uploadFormRules" col="col2" /> 1312 :rules="uploadFormRules" col="col2" />
......
...@@ -624,13 +624,13 @@ onBeforeMount(() => { ...@@ -624,13 +624,13 @@ onBeforeMount(() => {
624 getDamTypesList({ 624 getDamTypesList({
625 dictType: "资产类型", 625 dictType: "资产类型",
626 }).then((res: any) => { 626 }).then((res: any) => {
627 if (res.code == proxy.$passCode) { 627 if (res?.code == proxy.$passCode) {
628 damTypes.value = res.data || []; 628 damTypes.value = res.data || [];
629 searchItemList.value[1].options = damTypes.value; 629 searchItemList.value[1].options = damTypes.value;
630 // let item = searchItemList.value.find(item => item.field == 'damType'); 630 // let item = searchItemList.value.find(item => item.field == 'damType');
631 // item && (item.options = damTypes.value); 631 // item && (item.options = damTypes.value);
632 } else { 632 } else {
633 proxy.$ElMessage.error(res.msg); 633 res?.msg && proxy.$ElMessage.error(res.msg);
634 } 634 }
635 }) 635 })
636 // 连接器没有通过和驳回,不需要审批通过时填写合规信息。 636 // 连接器没有通过和驳回,不需要审批通过时填写合规信息。
......
...@@ -1050,7 +1050,7 @@ const getFirstPageData = () => { ...@@ -1050,7 +1050,7 @@ const getFirstPageData = () => {
1050 }; 1050 };
1051 onBeforeMount(() => { 1051 onBeforeMount(() => {
1052 getParamsList({ dictType: "业务系统" }).then((res) => { 1052 getParamsList({ dictType: "业务系统" }).then((res) => {
1053 flowList.value = res.data 1053 flowList.value = res?.data || []
1054 contents.value.normal.items[3].options = flowList.value 1054 contents.value.normal.items[3].options = flowList.value
1055 }) 1055 })
1056 getAllFlowData({ dictType: "数据源存储类型" }).then((res) => { 1056 getAllFlowData({ dictType: "数据源存储类型" }).then((res) => {
......
...@@ -850,7 +850,7 @@ onBeforeMount(() => { ...@@ -850,7 +850,7 @@ onBeforeMount(() => {
850 nodeInfoFormItems.value[1].default = ''; //如果是中介的话,不能选择自己吧。 850 nodeInfoFormItems.value[1].default = ''; //如果是中介的话,不能选择自己吧。
851 } 851 }
852 } 852 }
853 getContractDataProduct(userData.tenantGuid).then((res: any) => { 853 userStore.isLogOutConnector != 'Y' && getContractDataProduct(userData.tenantGuid).then((res: any) => {
854 if (res?.code == proxy.$passCode) { 854 if (res?.code == proxy.$passCode) {
855 productList.value = res.data || []; 855 productList.value = res.data || [];
856 productTableInfo.value.editInfo.dataProductId.options = productList.value; 856 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!