Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
1b7a8a1b21
|
@ -0,0 +1,19 @@
|
|||
<template>
|
||||
<div class='full-page-warp' ref='fullPage' :style='{ minHeight: `calc(100vh - ${x + 24}px)`}'>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang='ts' name='FullPage'>
|
||||
import { useElementBounding } from '@vueuse/core'
|
||||
|
||||
const fullPage = ref(null)
|
||||
const { x } = useElementBounding(fullPage)
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.full-page-warp {
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
|
@ -1,2 +1,3 @@
|
|||
export { default as BasicLayoutPage } from './BasicLayoutPage.vue'
|
||||
export { default as BlankLayoutPage } from './BlankLayoutPage.vue'
|
||||
export { default as BlankLayoutPage } from './BlankLayoutPage.vue'
|
||||
export { default as FullPage } from './FullPage.vue'
|
|
@ -8,7 +8,7 @@ import Search from './Search'
|
|||
import NormalUpload from './NormalUpload/index.vue'
|
||||
import FileFormat from './FileFormat/index.vue'
|
||||
import JProUpload from './Upload/index.vue'
|
||||
import { BasicLayoutPage, BlankLayoutPage } from './Layout'
|
||||
import { BasicLayoutPage, BlankLayoutPage, FullPage } from './Layout'
|
||||
import { PageContainer, AIcon, Ellipsis } from 'jetlinks-ui-components'
|
||||
// import Ellipsis from './Ellipsis/index.vue'
|
||||
import JEmpty from './Empty/index.vue'
|
||||
|
@ -38,5 +38,6 @@ export default {
|
|||
.component('PathSimplifier', PathSimplifier)
|
||||
.component('ValueItem', ValueItem)
|
||||
.component('RowPagination', RowPagination)
|
||||
.component('FullPage', FullPage)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import menus, { LoginPath } from './menu'
|
||||
import menus, { AccountCenterBindPath, InitHomePath, LoginPath } from './menu'
|
||||
import { cleanToken, getToken } from '@/utils/comm'
|
||||
import { useUserInfo } from '@/store/userInfo'
|
||||
import { useSystem } from '@/store/system'
|
||||
|
@ -14,6 +14,8 @@ const router = createRouter({
|
|||
}
|
||||
})
|
||||
|
||||
const filterPath = [ InitHomePath, AccountCenterBindPath ]
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
// TODO 切换路由取消请求
|
||||
const token = getToken()
|
||||
|
@ -24,7 +26,7 @@ router.beforeEach((to, from, next) => {
|
|||
const userInfo = useUserInfo()
|
||||
const system = useSystem()
|
||||
const menu = useMenuStore()
|
||||
if (!menu.siderMenus.length) {
|
||||
if (!menu.siderMenus.length && !filterPath.includes(to.path)) {
|
||||
userInfo.getUserInfo().then(() => {
|
||||
system.getSystemVersion().then((menuData: any[]) => {
|
||||
menuData.forEach(r => {
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
export const LoginPath = '/login'
|
||||
export const InitHomePath = '/init-home'
|
||||
export const AccountCenterBindPath = '/account/center/bind'
|
||||
|
||||
export const AccountMenu = {
|
||||
path: '/account',
|
||||
|
@ -55,11 +57,11 @@ export default [
|
|||
component: () => import('@/views/user/Login/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/account/center/bind',
|
||||
path: AccountCenterBindPath,
|
||||
component: () => import('@/views/account/Center/bind/index.vue')
|
||||
},
|
||||
{
|
||||
path: '/init-home', // 初始化
|
||||
path: InitHomePath, // 初始化
|
||||
component: () => import('@/views/init-home/index.vue')
|
||||
},
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ let params = ref();
|
|||
*/
|
||||
const handleSearch = (e: any) => {
|
||||
params.value = e;
|
||||
expandedRowKeys.value = []
|
||||
expandedRowKeys.value = [];
|
||||
};
|
||||
/**
|
||||
* 操作栏按钮
|
||||
|
@ -210,21 +210,20 @@ const table = reactive({
|
|||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
ellipsis: true,
|
||||
width: 600,
|
||||
width: 500,
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortIndex',
|
||||
key: 'sortIndex',
|
||||
scopedSlots: true,
|
||||
width: 200,
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '说明',
|
||||
dataIndex: 'description',
|
||||
key: 'description',
|
||||
ellipsis: true,
|
||||
width: 700,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
|
@ -232,6 +231,7 @@ const table = reactive({
|
|||
fixed: 'right',
|
||||
ellipsis: true,
|
||||
scopedSlots: true,
|
||||
width: 120,
|
||||
},
|
||||
],
|
||||
/**
|
||||
|
|
|
@ -71,6 +71,7 @@ import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
|
|||
import { FILE_UPLOAD } from '@/api/comm';
|
||||
import { LocalStore } from '@/utils/comm';
|
||||
import { message } from 'jetlinks-ui-components';
|
||||
import { useUserInfo } from '@/store/userInfo';
|
||||
const basicRef = ref();
|
||||
const roleRef = ref();
|
||||
const initDataRef = ref();
|
||||
|
@ -81,6 +82,7 @@ const loading = ref(false);
|
|||
*/
|
||||
const activeKey = ref<string>('1');
|
||||
const spinning = ref<boolean>(false);
|
||||
const userInfo = useUserInfo();
|
||||
// const action = ref<string>(`${BASE_API_PATH}/file/static`);
|
||||
// const headers = ref({ [TOKEN_KEY]: LocalStore.get(TOKEN_KEY) });
|
||||
/**
|
||||
|
@ -132,12 +134,16 @@ const submitData = async () => {
|
|||
* 判断是否已有配置
|
||||
*/
|
||||
const judgeInitSet = async () => {
|
||||
const resp:any = await getInit();
|
||||
if(resp.status === 200 && resp.result.length){
|
||||
if (userInfo.$state.userInfos.username === 'admin') {
|
||||
const resp: any = await getInit();
|
||||
if (resp.status === 200 && resp.result.length) {
|
||||
window.location.href = '/';
|
||||
}
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
};
|
||||
onMounted(() => {
|
||||
judgeInitSet();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -220,7 +220,7 @@ Object.assign(formModel, props.value)
|
|||
formModel.when = props.value.when || []
|
||||
|
||||
watchEffect(() => {
|
||||
if(props.value?.period.unit === 'hours') {
|
||||
if(props.value?.period?.unit === 'hours') {
|
||||
unitMax.
|
||||
value = 99999
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<template>
|
||||
<page-container>
|
||||
|
||||
<pro-search :columns="columns" target="scene" @search="handleSearch" />
|
||||
<FullPage>
|
||||
<JProTable
|
||||
ref="sceneRef"
|
||||
:columns="columns"
|
||||
|
@ -125,6 +127,7 @@
|
|||
</j-space>
|
||||
</template>
|
||||
</JProTable>
|
||||
</FullPage>
|
||||
<SaveModal v-if="visible" @close="visible = false" :data="current" />
|
||||
</page-container>
|
||||
</template>
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
message: '请输入页面地址',
|
||||
},
|
||||
{ max: 128, message: '最多可输入128字符' },
|
||||
{ pattern: /^\// ,message:'请正确填写地址,以/开头'},
|
||||
]"
|
||||
>
|
||||
<j-input
|
||||
|
|
|
@ -64,6 +64,11 @@ const columns = [
|
|||
dataIndex: 'summary',
|
||||
key: 'summary',
|
||||
},
|
||||
// {
|
||||
// title: 'ID',
|
||||
// dataIndex: 'id',
|
||||
// key: 'id',
|
||||
// },
|
||||
];
|
||||
const rowSelection = {
|
||||
// onSelect: (record: any) => {
|
||||
|
@ -83,43 +88,60 @@ const rowSelection = {
|
|||
// }
|
||||
// },
|
||||
onChange: (keys: string[]) => {
|
||||
// rowSelection.selectedRowKeys.value = keys;
|
||||
emits('update:selectedRowKeys', keys);
|
||||
keys.forEach((key: string) => {
|
||||
if (props.mode === 'appManger') {
|
||||
emits('update:changedApis', {
|
||||
...props.changedApis,
|
||||
[key]: props.tableData.find((f: any) => f.id === key),
|
||||
});
|
||||
}
|
||||
// 当前节点表格数据id
|
||||
const currenTableKeys = props.tableData.map((m: any) => m.id);
|
||||
// 当前表格, 原有选中的id
|
||||
const oldSelectedKeys = currenTableKeys.filter((key) =>
|
||||
props.sourceKeys.includes(key),
|
||||
);
|
||||
// 除当前表格之外, 勾选上的数据
|
||||
const otherSelectedKeys = props.sourceKeys.filter(
|
||||
(key) => !currenTableKeys.includes(key),
|
||||
);
|
||||
|
||||
// 取消选择的数据项
|
||||
const removeKeys = oldSelectedKeys.filter((key) => !keys.includes(key));
|
||||
// 新增选择的项
|
||||
const addKeys = keys.filter((key) => !oldSelectedKeys.includes(key));
|
||||
emits('update:selectedRowKeys', [...otherSelectedKeys, ...keys]);
|
||||
|
||||
// 新增选中/取消选中的数据
|
||||
const changed = {};
|
||||
[...addKeys, ...removeKeys].forEach((key: string) => {
|
||||
changed[key] = props.tableData.find((f: any) => f.id === key);
|
||||
});
|
||||
if (props.mode === 'appManger') {
|
||||
emits('update:changedApis', changed);
|
||||
}
|
||||
},
|
||||
selectedRowKeys: ref<string[]>([]),
|
||||
};
|
||||
const save = async () => {
|
||||
// fix: #bug10828
|
||||
// 当前节点表格数据id
|
||||
const currenTableKeys = props.tableData.map((m: any) => m.id);
|
||||
// 当前表格选中的id
|
||||
const currentSelectedKeys = rowSelection.selectedRowKeys.value.filter(
|
||||
(key: string) => currenTableKeys.includes(key),
|
||||
);
|
||||
// 当前表格, 原有选中的id
|
||||
const oldSelectedKeys = currenTableKeys.filter((key) =>
|
||||
props.sourceKeys.includes(key),
|
||||
);
|
||||
// const currenTableKeys = props.tableData.map((m: any) => m.id);
|
||||
// // 当前表格选中的id
|
||||
// const currentSelectedKeys = rowSelection.selectedRowKeys.value.filter(
|
||||
// (key: string) => currenTableKeys.includes(key),
|
||||
// );
|
||||
// // 当前表格, 原有选中的id
|
||||
// const oldSelectedKeys = currenTableKeys.filter((key) =>
|
||||
// props.sourceKeys.includes(key),
|
||||
// );
|
||||
|
||||
// const keys = props.selectedRowKeys;
|
||||
// const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key));
|
||||
// const addKeys = keys.filter((key) => !props.sourceKeys.includes(key));
|
||||
const keys = props.selectedRowKeys;
|
||||
const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key));
|
||||
const addKeys = keys.filter((key) => !props.sourceKeys.includes(key));
|
||||
// console.log('addKeys: ', addKeys);
|
||||
// console.log('removeKeys: ', removeKeys);
|
||||
// 取消选择的数据项
|
||||
const removeKeys = oldSelectedKeys.filter(
|
||||
(key) => !currentSelectedKeys.includes(key),
|
||||
);
|
||||
// 新增选择的项
|
||||
const addKeys = currentSelectedKeys.filter(
|
||||
(key) => !oldSelectedKeys.includes(key),
|
||||
);
|
||||
// const removeKeys = oldSelectedKeys.filter(
|
||||
// (key) => !currentSelectedKeys.includes(key),
|
||||
// );
|
||||
// // 新增选择的项
|
||||
// const addKeys = currentSelectedKeys.filter(
|
||||
// (key) => !oldSelectedKeys.includes(key),
|
||||
// );
|
||||
|
||||
if (props.mode === 'api') {
|
||||
// 此时是api配置
|
||||
|
@ -140,15 +162,15 @@ const save = async () => {
|
|||
} else if (props.mode === 'appManger') {
|
||||
const removeItems = removeKeys.map((key) => ({
|
||||
id: key,
|
||||
// permissions: props.changedApis[key]?.security,
|
||||
permissions: props.tableData.find((f: any) => f.id === key)
|
||||
?.security,
|
||||
permissions: props.changedApis[key]?.security,
|
||||
// permissions: props.tableData.find((f: any) => f.id === key)
|
||||
// ?.security,
|
||||
}));
|
||||
const addItems = addKeys.map((key) => ({
|
||||
id: key,
|
||||
// permissions: props.changedApis[key]?.security,
|
||||
permissions: props.tableData.find((f: any) => f.id === key)
|
||||
?.security,
|
||||
permissions: props.changedApis[key]?.security,
|
||||
// permissions: props.tableData.find((f: any) => f.id === key)
|
||||
// ?.security,
|
||||
}));
|
||||
Promise.all([
|
||||
updateOperations_api(code, '_delete', { operations: removeItems }),
|
||||
|
@ -161,9 +183,11 @@ const save = async () => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selectedRowKeys,
|
||||
(n) => {
|
||||
// console.log('props.selectedRowKeys: ', n);
|
||||
rowSelection.selectedRowKeys.value = n;
|
||||
},
|
||||
);
|
||||
|
|
|
@ -109,7 +109,7 @@ const treeSelect = (node: treeNodeTpye, nodeSchemas: object = {}) => {
|
|||
tableData.value = table;
|
||||
};
|
||||
|
||||
const activeKey = ref<'does' | 'test'>('does');
|
||||
const activeKey = ref<'does' | 'test'>('does');
|
||||
const schemas = ref({}); // 对应一级api相关的类
|
||||
const initSelectedApi: apiDetailsType = {
|
||||
url: '',
|
||||
|
@ -156,6 +156,13 @@ function getSelectKeys() {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
// watch(
|
||||
// () => changedApis.value,
|
||||
// (val: any) => {
|
||||
// console.log('changedApis: ', val);
|
||||
// },
|
||||
// );
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
|
@ -237,7 +237,7 @@ const onFinish = async () => {
|
|||
username: form.username,
|
||||
});
|
||||
LocalStore.set(TOKEN_KEY, res?.result.token);
|
||||
if (res.result.username === 'admin') {
|
||||
if (res.result.user?.username === 'admin') {
|
||||
const resp: any = await getInitSet();
|
||||
if (resp.status === 200 && !resp.result.length) {
|
||||
window.location.href = '/#/init-home';
|
||||
|
|
Loading…
Reference in New Issue