4dff1f01 by lihua

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

1 parent 6dd3525f
...@@ -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_APP_DIGITAL_CONTRACT_URL}/tds-connector-identity/check-connector `, 152 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/tds-connector-identity/check-connector `,
......
...@@ -318,6 +318,12 @@ export const getCurrentUserInfo = (params) => { ...@@ -318,6 +318,12 @@ export const getCurrentUserInfo = (params) => {
318 }); 318 });
319 }; 319 };
320 320
321 /** 管理员连接器注销 */
322 export const stopLogonUserConnector = () => request({
323 url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/connect/log-out`,
324 method: 'get'
325 })
326
321 /** 下载文件模板 */ 327 /** 下载文件模板 */
322 export const exportTemplate = (params) => request({ 328 export const exportTemplate = (params) => request({
323 url: `${import.meta.env.VITE_APP_ADD_FILE}/import-config/export-template?bizGuid=${params.bizGuid}&importType=${params.importType}`, 329 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' ...@@ -5,13 +5,17 @@ import useSettingsStore from '@/store/modules/settings'
5 import useUserStore from '@/store/modules/user' 5 import useUserStore from '@/store/modules/user'
6 import { USERROLE } from '@/utils/enum' 6 import { USERROLE } from '@/utils/enum'
7 import { ElMessage } from 'element-plus' 7 import { ElMessage } from 'element-plus'
8 import { stopLogonUserConnector } from '@/api/modules/queryService'
8 const router = useRouter() 9 const router = useRouter()
9 const settingsStore = useSettingsStore() 10 const settingsStore = useSettingsStore()
10 const userStore = useUserStore() 11 const userStore = useUserStore()
11 const userData = JSON.parse(userStore.userData); 12 const userData = JSON.parse(userStore.userData);
13 const tenantInfo = JSON.parse(localStorage.getItem('tenantInfo') || '{}');
12 const mainPage = useMainPage() 14 const mainPage = useMainPage()
13 const { isFullscreen, toggle } = useFullscreen() 15 const { isFullscreen, toggle } = useFullscreen()
14 16
17 const { proxy } = getCurrentInstance() as any;
18
15 const dataRole = computed(() => { 19 const dataRole = computed(() => {
16 return localStorage.getItem('userRole'); 20 return localStorage.getItem('userRole');
17 }) 21 })
...@@ -19,7 +23,7 @@ const dataRole = computed(() => { ...@@ -19,7 +23,7 @@ const dataRole = computed(() => {
19 /** 记录用户选择的角色 */ 23 /** 记录用户选择的角色 */
20 const selectRole: any = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。 24 const selectRole: any = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。
21 25
22 function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole') { 26 function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'logout' | 'changeRole' | 'stopConnector') {
23 switch (command) { 27 switch (command) {
24 case 'home': 28 case 'home':
25 router.push({ 29 router.push({
...@@ -46,8 +50,32 @@ function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'lo ...@@ -46,8 +50,32 @@ function userCommand(command: 'home' | 'setting' | 'updatePwd' | 'hotkeys' | 'lo
46 selectRole.value = dataRole.value; 50 selectRole.value = dataRole.value;
47 verifyDialogInfo.value.visible = true; 51 verifyDialogInfo.value.visible = true;
48 break; 52 break;
53 case 'stopConnector':
54 stopConnector()
55 break;
56 }
57 }
58
59 function stopConnector() {
60 proxy.$openMessageBox("是否确认注销当前连接器?", "warning", () => {
61 stopLogonUserConnector().then((res: any) => {
62 if (res?.code == '00000') {
63 localStorage.setItem('isLogOutConnector', 'Y');
64 userStore.isLogOutConnector = 'Y';
65 ElMessage({
66 type: "success",
67 message: "连接器注销成功",
68 });
49 } 69 }
70 });
71 }, () => {
72 ElMessage({
73 type: "info",
74 message: "已取消",
75 });
76 })
50 } 77 }
78
51 function pro() { 79 function pro() {
52 window.open('https://hooray.gitee.io/fantastic-admin-pro-example/', '_blank') 80 window.open('https://hooray.gitee.io/fantastic-admin-pro-example/', '_blank')
53 } 81 }
...@@ -158,6 +186,19 @@ const verifyDialogBtnClick = (btn, info) => { ...@@ -158,6 +186,19 @@ const verifyDialogBtnClick = (btn, info) => {
158 </span> 186 </span>
159 </div> 187 </div>
160 </div> 188 </div>
189 <template v-if="tenantInfo?.logonUser == userData?.mobileNo">
190 <div class="horizontal-line"></div>
191 <div class="user-setting-menu">
192 <div class="menu-wrapper" @click="userCommand('stopConnector')">
193 <span class="color-21">连接器注销</span>
194 <span>
195 <el-icon>
196 <svg-icon name="ep:arrow-right" />
197 </el-icon>
198 </span>
199 </div>
200 </div>
201 </template>
161 <div class="horizontal-line"></div> 202 <div class="horizontal-line"></div>
162 <div class="login-out"> 203 <div class="login-out">
163 <div class="login-out-btn" @click="userCommand('logout')"> 204 <div class="login-out-btn" @click="userCommand('logout')">
......
...@@ -6,6 +6,7 @@ import { ElMessage } from 'element-plus' ...@@ -6,6 +6,7 @@ import { ElMessage } from 'element-plus'
6 import apiUser from '@/api/modules/user' 6 import apiUser from '@/api/modules/user'
7 import { getCurrentTime } from '@/utils/common' 7 import { getCurrentTime } from '@/utils/common'
8 import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface, getCurrentUserInfo, getTenantDetailInfo } from '@/api/modules/queryService' 8 import { getSystemMenu, getUserInfo, getTokenByCode, loginOut, refreshToken, editPasswordInterface, getCurrentUserInfo, getTenantDetailInfo } from '@/api/modules/queryService'
9 import { getConnectorStatus } from '@/api/modules/dataRequire'
9 10
10 const useUserStore = defineStore( 11 const useUserStore = defineStore(
11 // 唯一ID 12 // 唯一ID
...@@ -26,6 +27,8 @@ const useUserStore = defineStore( ...@@ -26,6 +27,8 @@ const useUserStore = defineStore(
26 const permissions = ref<string[]>([]) 27 const permissions = ref<string[]>([])
27 const isLoginOut = ref(false); 28 const isLoginOut = ref(false);
28 const isLogin = ref(token.value ? true : false);//退出登录。 29 const isLogin = ref(token.value ? true : false);//退出登录。
30 //当前连接器是否已注销
31 const isLogOutConnector = ref(localStorage.isLogOutConnector ?? 'N');
29 const getTokenPromise: any = ref(null); 32 const getTokenPromise: any = ref(null);
30 /* idass的登录页面url,退出登录需要跳转到登录页。*/ 33 /* idass的登录页面url,退出登录需要跳转到登录页。*/
31 const idassLoginUrl = import.meta.env.VITE_IDASS_BASEURL; 34 const idassLoginUrl = import.meta.env.VITE_IDASS_BASEURL;
...@@ -64,6 +67,14 @@ const useUserStore = defineStore( ...@@ -64,6 +67,14 @@ const useUserStore = defineStore(
64 ElMessage.error(res.msg) 67 ElMessage.error(res.msg)
65 } 68 }
66 }) 69 })
70 getConnectorStatus().then((res: any) => {
71 if (res.code == '00000') {
72 isLogOutConnector.value = res.data?.isLogOut || 'N';
73 localStorage.setItem('isLogOutConnector', isLogOutConnector.value);
74 } else {
75 // 暂不弹错误提示
76 }
77 })
67 return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => { 78 return getCurrentUserInfo({tenantGuid: currentTenantGuid.value}).then((res: any) => {
68 console.log(res, 'getCurrentUserInfo'); 79 console.log(res, 'getCurrentUserInfo');
69 if (res.code == '00000') { 80 if (res.code == '00000') {
...@@ -358,6 +369,7 @@ const useUserStore = defineStore( ...@@ -358,6 +369,7 @@ const useUserStore = defineStore(
358 isLogin, 369 isLogin,
359 isGetCurrUserInfo, 370 isGetCurrUserInfo,
360 isLoginOut, 371 isLoginOut,
372 isLogOutConnector,
361 getTokenPromise, 373 getTokenPromise,
362 getToken, 374 getToken,
363 getUserSystemMenuByRole, 375 getUserSystemMenuByRole,
......
...@@ -3,6 +3,7 @@ import Storage from './composables/storage-helper'; ...@@ -3,6 +3,7 @@ import Storage from './composables/storage-helper';
3 import CryptoHelper from './composables/cryptoJs-helper'; 3 import CryptoHelper from './composables/cryptoJs-helper';
4 import { ElMessage } from 'element-plus' 4 import { ElMessage } from 'element-plus'
5 import useUserStore from '@/store/modules/user' 5 import useUserStore from '@/store/modules/user'
6 import router from '@/router'
6 7
7 const CANCELTTYPE = { 8 const CANCELTTYPE = {
8 CACHE: 1, 9 CACHE: 1,
...@@ -13,8 +14,9 @@ interface Request { ...@@ -13,8 +14,9 @@ interface Request {
13 source: CancelTokenSource; 14 source: CancelTokenSource;
14 } 15 }
15 const pendingRequests: Request[] = []; 16 const pendingRequests: Request[] = [];
16 const storage = new Storage();
17 const cryptoHelper = new CryptoHelper('cacheKey'); 17 const cryptoHelper = new CryptoHelper('cacheKey');
18 // 记录当前提示过的路由,用于判断是否需要重复提示
19 let currentNotifiedRoute: string | null = null;
18 20
19 const service = axios.create({ 21 const service = axios.create({
20 baseURL: (import.meta.env.VITE_OPEN_PROXY === 'true') ? `/api/` : `${import.meta.env.VITE_API_BASEURL}`, 22 baseURL: (import.meta.env.VITE_OPEN_PROXY === 'true') ? `/api/` : `${import.meta.env.VITE_API_BASEURL}`,
...@@ -33,6 +35,48 @@ service.interceptors.request.use( ...@@ -33,6 +35,48 @@ service.interceptors.request.use(
33 const source = axios.CancelToken.source(); 35 const source = axios.CancelToken.source();
34 config.headers.tenant = localStorage.getItem('currentTenantGuid'); //会员guid先写死 36 config.headers.tenant = localStorage.getItem('currentTenantGuid'); //会员guid先写死
35 config.cancelToken = source.token; 37 config.cancelToken = source.token;
38
39 // 检查isLogOutConnector为Y的情况
40 const isLogOutConnector = localStorage.getItem('isLogOutConnector');
41 if (isLogOutConnector === 'Y') {
42 // 使用router.currentRoute.value获取当前路由信息
43 const currentRoute = router.currentRoute.value;
44 const routePath = currentRoute.path;
45 // 检查api的url是否包含/connector-invoke
46 if (config.url.includes('/connector-invoke')) {
47 try {
48 // 检查路由的meta配置中editPage是否为true
49 if (currentRoute.meta?.editPage === true || routePath.includes('data-product/product-catalog')) { //产品目录功能比较特殊。
50 // 确保同一个路由只提示一次,但路由切换后再次回来需要重新提示
51 if (currentNotifiedRoute !== routePath) {
52 ElMessage({
53 message: '连接器已注销,无法使用该功能',
54 type: 'error',
55 });
56 currentNotifiedRoute = routePath;
57 }
58 // 取消请求
59 source.cancel(JSON.stringify({
60 type: CANCELTTYPE.REPEAT,
61 data: '连接器已注销,取消请求',
62 }));
63 } else {
64 // 取消请求
65 source.cancel(JSON.stringify({
66 type: CANCELTTYPE.REPEAT,
67 data: '连接器已注销,取消请求',
68 }));
69 }
70 } catch (error) {
71 // 路由获取失败时的处理
72 console.error('获取路由信息失败:', error);
73 }
74 } else {
75 if (currentNotifiedRoute !== routePath) {
76 currentNotifiedRoute = null;
77 }
78 }
79 }
36 if (config.method === "postfile") { 80 if (config.method === "postfile") {
37 config.method = "post"; 81 config.method = "post";
38 config.headers = Object.assign({}, config.headers, { 82 config.headers = Object.assign({}, config.headers, {
...@@ -79,7 +123,7 @@ service.interceptors.request.use( ...@@ -79,7 +123,7 @@ service.interceptors.request.use(
79 // })); 123 // }));
80 // } 124 // }
81 /** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */ 125 /** 若是门户的url,则不做重复请求处理,会出现不同标签页都需要查同一个字典参数列表的 */
82 if (config.url.indexOf('/portal/portal')) { 126 if (config.url.indexOf('/portal/portal') > -1) {
83 config.headers.Authorization = localStorage.getItem('token'); 127 config.headers.Authorization = localStorage.getItem('token');
84 config.headers['real-ip'] = localStorage.getItem('ipAddress'); 128 config.headers['real-ip'] = localStorage.getItem('ipAddress');
85 return config; 129 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 })
......
...@@ -868,7 +868,7 @@ const getUserTenantInfo = () => { ...@@ -868,7 +868,7 @@ const getUserTenantInfo = () => {
868 } 868 }
869 }) 869 })
870 } else { 870 } else {
871 ElMessage.error(res1.msg); 871 res1?.msg && ElMessage.error(res1.msg);
872 } 872 }
873 // 处理公司信息 873 // 处理公司信息
874 let res = resInfos?.[1]; 874 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 // 连接器没有通过和驳回,不需要审批通过时填写合规信息。
......
...@@ -1022,7 +1022,7 @@ const getFirstPageData = () => { ...@@ -1022,7 +1022,7 @@ const getFirstPageData = () => {
1022 }; 1022 };
1023 onMounted(() => { 1023 onMounted(() => {
1024 getParamsList({ dictType: "业务系统" }).then((res) => { 1024 getParamsList({ dictType: "业务系统" }).then((res) => {
1025 flowList.value = res.data 1025 flowList.value = res?.data || []
1026 contents.value.normal.items[3].options = flowList.value 1026 contents.value.normal.items[3].options = flowList.value
1027 }) 1027 })
1028 }) 1028 })
......
...@@ -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!