Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
jackhoo_98 2023-03-31 21:22:04 +08:00
commit 990a2f73af
5 changed files with 45 additions and 31 deletions

View File

@ -56,7 +56,10 @@ watch(
() => user.userInfos,
(val: any) => {
//
if (val.username === 'admin') selectValue.value = 'comprehensive';
if (val.username === 'admin') {
selectValue.value = 'comprehensive';
confirm();
}
},
);
</script>

View File

@ -134,12 +134,8 @@ const submitData = async () => {
* 判断是否已有配置
*/
const judgeInitSet = async () => {
if (userInfo.$state.userInfos.username === 'admin') {
const resp: any = await getInit();
if (resp.status === 200 && resp.result.length) {
window.location.href = '/';
}
} else {
const resp: any = await getInit();
if (resp.status === 200 && resp.result.length) {
window.location.href = '/';
}
};

View File

@ -172,12 +172,16 @@ const confirm = () => {
return message.warning('请先勾选数据');
}
console.log('table.selectedRows: ', table.selectedRows);
const params = table.selectedRows.map((item: any) => ({
targetType: 'org',
targetId: props.parentId,
assetType: props.assetType,
assetIdList: [item.id],
permission: item.selectPermissions,
// ,
permission: item.selectPermissions.filter((f: any) =>
item.permissionList.map((m: any) => m.value).includes(f),
),
}));
// , ,

View File

@ -98,7 +98,7 @@
</template>
<script setup lang="ts">
import { cloneDeep } from 'lodash-es';
import { cloneDeep, uniqBy } from 'lodash-es';
import { getPrimissTree_api } from '@/api/system/role';
import { getCurrentInstance } from 'vue';
const emits = defineEmits(['update:selectItems']);
@ -156,7 +156,7 @@ const selectAllChange = () => {
});
}
});
console.log('selectAllChange: ', flatTableData);
// console.log('selectAllChange: ', flatTableData);
indeterminate.value = false;
emits(
'update:selectItems',
@ -165,24 +165,25 @@ const selectAllChange = () => {
};
// -
const bulkShow = ref<boolean>(false);
const bulkOptions = [
{
label: '全部数据',
value: 'ignore',
},
{
label: '所在组织及下级组织',
value: 'org-include-children',
},
{
label: '所在组织',
value: 'org',
},
{
label: '自己创建的',
value: 'creator',
},
];
const bulkOptions = ref();
// const bulkOptions = [
// {
// label: '',
// value: 'ignore',
// },
// {
// label: '',
// value: 'org-include-children',
// },
// {
// label: '',
// value: 'org',
// },
// {
// label: '',
// value: 'creator',
// },
// ];
const bulkValue = ref<string>('');
const bulkChange = () => {
if (!bulkValue) return;
@ -198,7 +199,7 @@ const bulkChange = () => {
});
}
});
console.log('bulkChange: ', flatTableData);
// console.log('bulkChange: ', flatTableData);
emits(
'update:selectItems',
flatTableData.filter((item) => item.granted),
@ -396,6 +397,16 @@ function treeToSimple(treeData: tableItemType[]) {
flatTableData.push(item);
item.children && treeToSimple(item.children);
});
// console.log('flatTableData: ', flatTableData);
// , assetAccesses
let assets: any[] = [];
flatTableData?.forEach((item: any) => {
assets = [...assets, ...item.assetAccesses];
});
bulkOptions.value = uniqBy(assets, 'supportId')?.map((m: any) => ({
label: m.name,
value: m.supportId,
}));
}
/**
* 设置子节点的状态

View File

@ -92,8 +92,8 @@ export default defineConfig(({ mode}) => {
[env.VITE_APP_BASE_API]: {
// target: 'http://192.168.33.22:8800',
// target: 'http://192.168.32.244:8881',
// target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境
target: 'http://120.77.179.54:8844', // 120测试
// target: 'http://192.168.33.46:8844', // 本地开发环境
ws: 'ws://192.168.33.46:8844',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')