Commit 5113ef9d authored by liwei's avatar liwei

通用文件操作页面完善

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