fix: bug#10706、10678

This commit is contained in:
JiangQiming 2023-03-23 11:47:58 +08:00
parent d19f39a0ae
commit 0e09858d38
3 changed files with 36 additions and 19 deletions

View File

@ -259,8 +259,10 @@ const table: any = {
//
onSelectChange: (row: any) => {
//
if (!row.permissionList.find((item: any) => item.value === 'share'))
if (!row.permissionList.find((item: any) => item.value === 'share')) {
message.warning('该资产不支持共享');
return;
}
const selectedRowKeys = table._selectedRowKeys.value;
const index = selectedRowKeys.indexOf(row.id);
@ -330,7 +332,9 @@ const table: any = {
resolve({
code: 200,
result: {
data: data.sort((a, b) => a.createTime - b.createTime),
data: data.sort(
(a, b) => a.createTime - b.createTime,
),
pageIndex,
pageSize,
total,

View File

@ -18,6 +18,7 @@
placeholder="请选择上级组织"
:tree-data="treeData"
:field-names="{ value: 'id' }"
@change="handleTreeSelectChange"
>
<template #title="{ name }"> {{ name }} </template>
</j-tree-select>
@ -60,6 +61,21 @@ import {
updateDepartment_api,
} from '@/api/system/department';
type treeType = {
id: string;
parentId?: string;
name: string;
sortIndex: string | number;
children?: treeType[];
disabled?: boolean;
};
type formType = {
id?: string;
parentId?: string;
name: string;
sortIndex: string | number;
};
const emits = defineEmits(['refresh', 'update:visible']);
const props = defineProps<{
treeData: any[];
@ -91,8 +107,8 @@ const treeData = computed(() => {
});
/**
* 在给定的树中通过id匹配
* @param node
* @param id
* @param node
* @param id
*/
const findItemById = (node: treeType[], id: string): treeType | null => {
let result = null;
@ -107,7 +123,7 @@ const findItemById = (node: treeType[], id: string): treeType | null => {
};
/**
* 将此树下的所有节点禁用
* @param treeNode
* @param treeNode
*/
const filterTree = (treeNode: treeType[]) => {
if (treeNode.length < 1) return;
@ -160,18 +176,15 @@ const form = reactive({
});
form.init();
type treeType = {
id: string;
parentId?: string;
name: string;
sortIndex: string | number;
children?: treeType[];
disabled?: boolean;
};
type formType = {
id?: string;
parentId?: string;
name: string;
sortIndex: string | number;
/**
* 上级组织选择改变
*/
const handleTreeSelectChange = () => {
//
const parent = treeData.value.find((f: any) => f.id === form.data.parentId);
// , +1, , 1
form.data.sortIndex = parent?.children
? parent.children[parent.children.length - 1].sortIndex + 1
: 1;
};
</script>

View File

@ -520,7 +520,7 @@ const dialogs = reactive({
});
table.init();
nextTick(() => {
watchEffect(() => {
props.bindBool && table.clickAdd();
emits('update:bindBool', false);
});