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, () => user.userInfos,
(val: any) => { (val: any) => {
// //
if (val.username === 'admin') selectValue.value = 'comprehensive'; if (val.username === 'admin') {
selectValue.value = 'comprehensive';
confirm();
}
}, },
); );
</script> </script>

View File

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

View File

@ -172,12 +172,16 @@ const confirm = () => {
return message.warning('请先勾选数据'); return message.warning('请先勾选数据');
} }
console.log('table.selectedRows: ', table.selectedRows);
const params = table.selectedRows.map((item: any) => ({ const params = table.selectedRows.map((item: any) => ({
targetType: 'org', targetType: 'org',
targetId: props.parentId, targetId: props.parentId,
assetType: props.assetType, assetType: props.assetType,
assetIdList: [item.id], 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> </template>
<script setup lang="ts"> <script setup lang="ts">
import { cloneDeep } from 'lodash-es'; import { cloneDeep, uniqBy } from 'lodash-es';
import { getPrimissTree_api } from '@/api/system/role'; import { getPrimissTree_api } from '@/api/system/role';
import { getCurrentInstance } from 'vue'; import { getCurrentInstance } from 'vue';
const emits = defineEmits(['update:selectItems']); const emits = defineEmits(['update:selectItems']);
@ -156,7 +156,7 @@ const selectAllChange = () => {
}); });
} }
}); });
console.log('selectAllChange: ', flatTableData); // console.log('selectAllChange: ', flatTableData);
indeterminate.value = false; indeterminate.value = false;
emits( emits(
'update:selectItems', 'update:selectItems',
@ -165,24 +165,25 @@ const selectAllChange = () => {
}; };
// - // -
const bulkShow = ref<boolean>(false); const bulkShow = ref<boolean>(false);
const bulkOptions = [ const bulkOptions = ref();
{ // const bulkOptions = [
label: '全部数据', // {
value: 'ignore', // label: '',
}, // value: 'ignore',
{ // },
label: '所在组织及下级组织', // {
value: 'org-include-children', // label: '',
}, // value: 'org-include-children',
{ // },
label: '所在组织', // {
value: 'org', // label: '',
}, // value: 'org',
{ // },
label: '自己创建的', // {
value: 'creator', // label: '',
}, // value: 'creator',
]; // },
// ];
const bulkValue = ref<string>(''); const bulkValue = ref<string>('');
const bulkChange = () => { const bulkChange = () => {
if (!bulkValue) return; if (!bulkValue) return;
@ -198,7 +199,7 @@ const bulkChange = () => {
}); });
} }
}); });
console.log('bulkChange: ', flatTableData); // console.log('bulkChange: ', flatTableData);
emits( emits(
'update:selectItems', 'update:selectItems',
flatTableData.filter((item) => item.granted), flatTableData.filter((item) => item.granted),
@ -396,6 +397,16 @@ function treeToSimple(treeData: tableItemType[]) {
flatTableData.push(item); flatTableData.push(item);
item.children && treeToSimple(item.children); 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]: { [env.VITE_APP_BASE_API]: {
// target: 'http://192.168.33.22:8800', // target: 'http://192.168.33.22:8800',
// target: 'http://192.168.32.244:8881', // target: 'http://192.168.32.244:8881',
// target: 'http://120.77.179.54:8844', // 120测试 target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境 // target: 'http://192.168.33.46:8844', // 本地开发环境
ws: 'ws://192.168.33.46:8844', ws: 'ws://192.168.33.46:8844',
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')