Commit 5113ef9d authored by liwei's avatar liwei

通用文件操作页面完善

parent d36860b1
......@@ -10,7 +10,7 @@
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { useMessage } from '@/hooks/web/useMessage';
import { useModal } from '@/components/Modal';
import {addUserData, columns, searchFormSchema, TreeData} from './institutionData';
import {addUserData, columns, searchFormSchema, TreeData} from './commonFileData';
import { useGo } from '@/hooks/web/usePage';
import { downloadByData } from '@/utils/file/download';
import { useRoute,onBeforeRouteLeave } from 'vue-router';
......
......@@ -18,7 +18,7 @@ import {nextTick, onMounted, ref, unref} from 'vue';
import {BasicTree, TreeActionType, TreeItem} from '@/components/Tree';
import { getDeptList } from '@/api/system/dept/dept';
import {Nullable} from "@vben/types";
import { DetailTreeData } from "@/views/commonFile/institutionData";
import { DetailTreeData } from "@/views/commonFile/commonFileData";
defineOptions({ name: 'DeptTree' });
......
......@@ -35,7 +35,6 @@
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
setModalProps({ showCancelBtn: false });
setModalProps({ showOkBtn: false });
isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove;
......
......@@ -19,7 +19,7 @@ import {nextTick, onMounted, ref, unref} from 'vue';
import {BasicTree, TreeActionType, TreeItem} from '@/components/Tree';
import { getDeptList } from '@/api/system/dept/dept';
import {Nullable} from "@vben/types";
import { TreeData } from "@/views/commonFile/institutionData";
import { TreeData } from "@/views/commonFile/commonFileData";
defineOptions({ name: 'DeptTree' });
......
......@@ -132,19 +132,18 @@ export const resetNameFormSchema: FormSchema[] = [
];
export const createFileFormSchema: FormSchema[] = [
{
field: 'name',
field: 'institutionId',
label: '路径',
component: 'Input',
component: 'TreeSelect',
colProps: { lg: 24, md: 24 },
rules: [
{
required: true,
message: '请输入路径',
},
],
componentProps: {
placeholder: '请输入路径',
fieldNames: {
label: 'fileName',
value: 'businessId',
},
getPopupContainer: () => document.body,
},
required: true,
},
{
field: 'fileName',
......@@ -170,7 +169,7 @@ export const createTaskFormSchema: FormSchema[] = [
colProps: { lg: 24, md: 24 },
componentProps: {
fieldNames: {
label: 'institutionName',
label: 'fileName',
value: 'businessId',
},
getPopupContainer: () => document.body,
......
......@@ -63,7 +63,7 @@ export const TreeData: any[] = [
"orderNum" : 0,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -80,7 +80,7 @@ export const TreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -97,7 +97,7 @@ export const TreeData: any[] = [
"orderNum" : 2,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -106,7 +106,7 @@ export const TreeData: any[] = [
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 103,
"businessId" : 201,
"fileName" : "总-智慧财务总体流程",
"parentId" : 101,
"code:": "005",
......@@ -114,7 +114,7 @@ export const TreeData: any[] = [
"orderNum" : 2,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -123,7 +123,7 @@ export const TreeData: any[] = [
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 104,
"businessId" : 202,
"fileName" : "分-落地区",
"parentId" : 101,
"code:": "006",
......@@ -131,7 +131,7 @@ export const TreeData: any[] = [
"orderNum" : 3,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -140,7 +140,7 @@ export const TreeData: any[] = [
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 106,
"businessId" : 203,
"fileName" : "分-改良区",
"parentId" : 101,
"code:": "008",
......@@ -148,7 +148,7 @@ export const TreeData: any[] = [
"orderNum" : 5,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -157,7 +157,7 @@ export const TreeData: any[] = [
{
"delFlag" : "0",
"flag" : "1",
"businessId" : 202,
"businessId" : 204,
"fileName" : "分-个人体验1",
"parentId" : 107,
"code:": "009",
......@@ -165,7 +165,7 @@ export const TreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -174,7 +174,7 @@ export const TreeData: any[] = [
{
"delFlag" : "0",
"flag" : "0",
"businessId" : 203,
"businessId" : 205,
"fileName" : "分-个人体验2",
"parentId" : 107,
"code:": "010",
......@@ -182,7 +182,7 @@ export const TreeData: any[] = [
"orderNum" : 2,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -201,7 +201,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 0,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -218,7 +218,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -235,7 +235,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 2,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -252,7 +252,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 2,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -269,7 +269,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -286,7 +286,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -303,7 +303,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -320,7 +320,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -337,7 +337,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......@@ -354,7 +354,7 @@ export const DetailTreeData: any[] = [
"orderNum" : 1,
// "children" : [ ],
"selectType" : null,
"fileSize": 1024,
"fileSize": '1024KB',
"location":"位置1",
"holder":"admin",
"createDate": "2024-10-24 10:04:04",
......
......@@ -12,7 +12,7 @@
import {addUserApi,UserDetailApi,UserUpdataApi} from '@/api/system/user/user'
import { useMessage } from '@/hooks/web/useMessage';
import {createFileFormSchema} from './account.data';
import {TreeData} from "@/views/system/institution/institutionData";
import {TreeData} from "@/views/commonFile/commonFileData";
defineOptions({ name: 'AccountModal' });
const emit = defineEmits(['success', 'register']);
......@@ -37,6 +37,15 @@
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove;
const treeList = handleTree(TreeData, 'businessId',undefined,undefined,undefined)
updateSchema([
{
field: 'institutionId',
componentProps: {
treeData: treeList
},
},
]);
});
const getTitle = computed(() => ('重命名'));
......@@ -47,4 +56,24 @@
closeModal()
}
/**数组对象转成树*/
function handleTree(data, id, parentId, children, rootId) {
id = id || 'id'
parentId = parentId || 'parentId'
children = children || 'children'
rootId = rootId || Math.min.apply(Math, data.map(item => { return item[parentId] })) || 0
// 对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data))
// 循环所有项
const treeData = cloneData.filter(father => {
const branchArr = cloneData.filter(child => {
// 返回每一项的子级数组
return father[id] === child[parentId]
})
branchArr.length > 0 ? father.children = branchArr : ''
// 返回第一层
return father[parentId] === rootId
})
return treeData !== '' ? treeData : data
}
</script>
......@@ -11,7 +11,7 @@
import { getDeptList } from '@/api/system/dept/dept';
import {addUserApi,UserDetailApi,UserUpdataApi} from '@/api/system/user/user'
import { useMessage } from '@/hooks/web/useMessage';
import {TreeData} from "@/views/system/institution/institutionData";
import {TreeData} from "@/views/commonFile/commonFileData";
import {createTaskFormSchema} from './account.data';
defineOptions({ name: 'AccountModal' });
......
......@@ -76,7 +76,7 @@
import { useFilterStore } from '@/store/modules/filterData';
import {useUserStore} from "@/store/modules/user";
import {getMenuListByPage} from "@/api/system/menu/menu";
import {fileData, TreeData} from "@/views/commonFile/institutionData";
import {fileData, TreeData} from "@/views/commonFile/commonFileData";
import AddUserModal from './AddUserModal.vue';
import {forEach} from "lodash-es";
import { router } from '@/router';
......@@ -108,7 +108,7 @@
};
//过滤掉tableData.value中,businessId等于100的
var data = [];
data = tableData.value.filter((item) => item.businessId !== 100);
data = tableData.value.filter((item) => item.businessId >= 200);
//过滤data中的数据,取出等于params.deptId的数据
return { ...response,data: data };
},
......@@ -125,6 +125,7 @@
},
useSearchForm: true,
showTableSetting: false,
showIndexColumn:false,
bordered: true,
handleSearchInfoFn(info) {
return info;
......@@ -138,7 +139,6 @@
/**查看详情*/
function showDetails(record) {
console.log('record:',record)
router.push({
path: '/commonFile/fileDetail',
query: {
......
......@@ -11,7 +11,7 @@ import {accountFormSchema, MoveFormSchema } from './account.data';
import { getDeptList } from '@/api/system/dept/dept';
import {resetUserPwd} from '@/api/system/user/user'
import { useMessage } from '@/hooks/web/useMessage';
import { TreeData } from "./institutionData";
import { TreeData } from "./commonFileData";
defineOptions({ name: 'AccountModal' });
const emit = defineEmits(['success', 'register']);
......
......@@ -46,6 +46,7 @@
/**确定按钮*/
async function handleSubmit() {
createMessage.success('重命名成功');
closeModal()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment