Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
77d8044cf2
|
@ -13,7 +13,7 @@ export const delApply_api = (id: string) => server.remove(`/application/${id}`)
|
|||
// 获取组织列表
|
||||
export const getDepartmentList_api = (params: any) => server.get(`/organization/_all/tree`, params);
|
||||
// 获取应用详情
|
||||
export const getAppInfo_api = (id: string) => server.get(`/application/${id}`);
|
||||
export const getAppInfo_api = (id: string) => server.get<any>(`/application/${id}`);
|
||||
// 新增应用
|
||||
export const addApp_api = (data: object) => server.post(`/application`, data);
|
||||
// 更新应用
|
||||
|
|
|
@ -265,7 +265,7 @@ const unBind = (id: string) => {
|
|||
};
|
||||
const clickBind = (id: string) => {
|
||||
window.open(
|
||||
`${location.host}${BASE_API_PATH}/application/sso/${id}/login?autoCreateUser=false`,
|
||||
`${BASE_API_PATH}/application/sso/${id}/login?autoCreateUser=false`,
|
||||
);
|
||||
localStorage.setItem('onBind', 'false');
|
||||
localStorage.setItem('onLogin', 'yes');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<span>精简模式下参数只支持输入框的方式录入</span>
|
||||
</j-space>
|
||||
</div>
|
||||
<j-tabs v-model="activeKey" tab-position="left">
|
||||
<j-tabs v-model="activeKey" tab-position="left" @change="onTabChange" :destroyInactiveTabPane="true">
|
||||
<j-tab-pane v-for="func in newFunctions" :key="func.id">
|
||||
<template #tab>
|
||||
<Ellipsis style="width: 100px; text-align: left">
|
||||
|
@ -95,7 +95,7 @@
|
|||
:ref="`result${func.id}Ref`"
|
||||
class="execute-result"
|
||||
>
|
||||
{{ func.executeResult }}
|
||||
{{ executeResult || '' }}
|
||||
</span>
|
||||
</j-col>
|
||||
</j-row>
|
||||
|
@ -135,6 +135,8 @@ const columns = ref([
|
|||
},
|
||||
]);
|
||||
|
||||
const executeResult = ref('')
|
||||
|
||||
// 设备功能数据处理
|
||||
const newFunctions = computed(() => {
|
||||
const result: any = [];
|
||||
|
@ -205,7 +207,7 @@ const handleExecute = async (func: any) => {
|
|||
);
|
||||
if (!success) return;
|
||||
message.success('操作成功');
|
||||
func.executeResult = result instanceof Array ? result[0] : result;
|
||||
executeResult.value = result instanceof Array ? result[0] : result;
|
||||
proxy?.$forceUpdate();
|
||||
})
|
||||
.catch((err: any) => {
|
||||
|
@ -216,8 +218,13 @@ const handleExecute = async (func: any) => {
|
|||
* 清空
|
||||
*/
|
||||
const handleClear = (func: any) => {
|
||||
executeResult.value = ''
|
||||
proxy?.$refs[`${func.id}Ref`][0].resetFields();
|
||||
};
|
||||
|
||||
const onTabChange = (_key: string) => {
|
||||
executeResult.value = ''
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
</template>
|
||||
<template #createTime="slotProps">
|
||||
<span>{{
|
||||
dayjs(slotProps.createTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
slotProps?.createTime ? dayjs(slotProps.createTime).format('YYYY-MM-DD HH:mm:ss') : ''
|
||||
}}</span>
|
||||
</template>
|
||||
<template #action="slotProps">
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</template>
|
||||
<template #registerTime="slotProps">
|
||||
<span>{{
|
||||
dayjs(slotProps.registerTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
slotProps?.registerTime ? dayjs(slotProps.registerTime).format('YYYY-MM-DD HH:mm:ss') : ''
|
||||
}}</span>
|
||||
</template>
|
||||
</JProTable>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<template>
|
||||
<page-container>
|
||||
<iframe
|
||||
:src="iframeUrl"
|
||||
frameBorder="0"
|
||||
style="width: 100%; height: calc(100vh - 140px)"
|
||||
></iframe>
|
||||
</page-container>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { TOKEN_KEY } from '@/utils/variable';
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { getAppInfo_api } from '@/api/system/apply';
|
||||
|
||||
const iframeUrl = ref<string>('');
|
||||
|
||||
const handle = async (appId: string, url: string) => {
|
||||
const res = await getAppInfo_api(appId);
|
||||
let menuUrl: any = url;
|
||||
if (res.status === 200) {
|
||||
// console.log(res.result);
|
||||
if (res.result.page.routeType === 'hash') {
|
||||
menuUrl = `${url}`;
|
||||
}
|
||||
if (res.result.provider === 'internal-standalone') {
|
||||
//{baseUrl}/api/application/sso/{appId}/login?redirect={menuUrl}
|
||||
const urlStandalone = `${res.result.page.baseUrl}/api/application/sso/${appId}/login?redirect=${menuUrl}?layout=false`;
|
||||
iframeUrl.value = urlStandalone;
|
||||
// console.log(urlStandalone);
|
||||
} else if (res.result.provider === 'internal-integrated') {
|
||||
const tokenUrl = `${
|
||||
res.result.page.baseUrl
|
||||
}?X-Access-Token=${LocalStore.get(TOKEN_KEY)}`;
|
||||
iframeUrl.value = tokenUrl;
|
||||
} else {
|
||||
const urlOther = `${res.result.page.baseUrl}/${menuUrl}`;
|
||||
iframeUrl.value = urlOther;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watchEffect(() => {
|
||||
const params = location.pathname.split('/')?.[1];
|
||||
const url = location.pathname.split('/').slice(2).join('/');
|
||||
// console.log(params, url);
|
||||
handle(params, url);
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue