diff --git a/src/api/doc/index.ts b/src/api/doc/index.ts index 86ca4bb..df9310a 100644 --- a/src/api/doc/index.ts +++ b/src/api/doc/index.ts @@ -24,6 +24,36 @@ export function getShareList( uid:string,data?: matterPage): AxiosPromise { + return request({ + url: '/hxpan/api/space/page', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} + +/** + * 新建目录 + */ +export function doCreateSpaceDir(uid:string,data?: createDir){ + return request({ + url: '/hxpan/api/space/directory', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} + +/** + * 空间权限控制管理 + */ +export function doAccessManage(uid:string,data?: any){ + return request({ + url: '/hxpan/api/space/access', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} + +/** + * 删除空间 + */ +export function doDelSpace(uid:string,data?: any){ + return request({ + url: '/hxpan/api/space/delete', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} + +/** + * 删除文件或目录 + */ +export function doDelSpaceMatter(uid:string,data?: any){ + return request({ + url: '/hxpan/api/space/materdelete', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} \ No newline at end of file diff --git a/src/api/hr/people/share_ctrol.ts b/src/api/hr/people/share_ctrol.ts index c9dae72..febfdd3 100644 --- a/src/api/hr/people/share_ctrol.ts +++ b/src/api/hr/people/share_ctrol.ts @@ -71,6 +71,20 @@ export function getPermitedList(uid:string,data:{uuid:string}): AxiosPromise<{pe data: data }); } +/** + * 获取空间成员列表 + */ +export function getSpaceMemberList(uid:string,data:{space?:string}): AxiosPromise<{members:string[],dprts:string[]}> { + return request({ + url: '/hxpan/api/space/members', + method: 'post', + headers: { + 'Identifier':uid, + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: data + }); +} /** * 保存文档成员权限修改 diff --git a/src/views/doc/manage.vue b/src/views/doc/manage.vue index d98c36b..5ae4898 100644 --- a/src/views/doc/manage.vue +++ b/src/views/doc/manage.vue @@ -7,7 +7,7 @@ import { getExpirTime, getFileIcon, readableSize} from "./tools" import sharePermission from './sharePermission.vue'; import { useUserStore } from "@/store/modules/user"; -import { getMatterList,postCreateDir,postDelMatter,postCreateShare,postMatterRename,postDelMatBatch} from "@/api/doc/index" +import { getMatterList,postCreateDir,postDelMatter,postCreateShare,postMatterRename,postDelMatBatch,getMySpaces,doCreateSpace} from "@/api/doc/index" import { matterPage,matterInfo,respCreateShare,matterTree } from "@/api/doc/type" import { h } from 'vue' import { @@ -19,11 +19,13 @@ import { Edit, Promotion, Folder, - Avatar + Avatar, + Plus } from '@element-plus/icons-vue' import {ElSelect,ElOption, ElText,ElInput,TableInstance,ElMessage,UploadFile,UploadFiles,ElPagination,ElTree,TreeInstance} from "element-plus"; import type { TreeNode } from 'element-plus/es/components/tree/src/tree.type' import preview from './preview.vue'; +import space from './space.vue'; //TODO: add file icons done! //TODO: click on table-item, 1)preview on file ..................... @@ -50,16 +52,21 @@ const currentHoverRow=ref("") //table 行的按钮控制 const selectedValue = ref("sixhour") //分享弹窗的世间变量 const tabSelected=ref([]) //table组件多选数据维护 //to support tree mode refactor -const treeData=ref([{name:'root',uuid:'root',children:[]}]) +const treeData=ref([{name:'个人空间',uuid:'root',children:[]}]) const treeRef = ref(); const currentNode=ref({}) //打开的路径层次 const officeHost=import.meta.env.VITE_OFFICE_HOST const dynamicVNode = ref(null) //permission 组件的父组件 const multipleTableRef = ref() const paginInfo = ref({ page: 0, total: 0 }) -const formHeaders=ref({ - "user-id":uid, + +const PRIVATESPACE = ref(true) //是空间状态的控制 2种:私有云盘和共享空间 +const SpaceID= ref<{name:string,uuid:string,userUuid:string}>({}) //当前space的id +const SpaceList=ref<{name:string,uuid:string,userUuid:string}[]>([]) +const Departs = computed(() => { + return `${userStore.userInfoCont.company},${userStore.userInfoCont.department},${userStore.userInfoCont.organization}` }) + const uploadFormData = computed(() => { return { userUuid: uid, // 用户的uuid @@ -312,7 +319,7 @@ function onNodeExpand(node: TreeNode, resolve: (data: matterTree[]) => void, rej if ((node.data as matterTree).uuid) { const cuuid = (node.data as matterTree).uuid currentNode.value = node.data - + let _page: matterPage = { page: 0, pageSize: 50, @@ -340,6 +347,9 @@ function onNodeExpand(node: TreeNode, resolve: (data: matterTree[]) => void, rej } //树节点单击 function onNodeClick(data:matterTree,node:TreeNode,self:any,env:any){ + if(!PRIVATESPACE.value) { + PRIVATESPACE.value=true + } if (currentNode.value.uuid === data.uuid) return; const cuuid = data.uuid currentNode.value = data @@ -407,11 +417,39 @@ interface uploadError{ function handleSigLoadErr(error: Error, uploadFile: UploadFile, uploadFiles:UploadFiles){ ElMessage.error(JSON.parse(error.message).msg) } +//-------------------space feature--------------------- +function onNewSpace(){ + const newname=ref("") + ElMessageBox({ + title:"请输入空间名称", + customStyle: { bottom:'200px'}, + confirmButtonText: "确定", + cancelButtonText: "取消", + message: () => h(ElInput, { + style: { width:'360px' }, + modelValue: newname.value, + 'onUpdate:modelValue': (val) => { + newname.value = val + }, + }), + }).then(() => { + if(newname.value!==""){ + doCreateSpace(uid,newname.value).then((resp)=>{ + SpaceList.value.push({name:resp.data.name,uuid:resp.data.uuid,userUuid:"p0"+userStore.userInfoCont.userId}) + }) + } + }) +} +//------------------------------------------------------ //http://172.20.2.87:6010/api/alien/preview/5a10aaf6-396e-4d9a-7e87-3c5c8029d4db/123.png?ir=fill_100_100 //渲染完页面再执行 onMounted(() => { onNodeClick(treeData.value[0], null as unknown as TreeNode, null, null) + //加载我的空间列表 + getMySpaces(uid,{roles:Departs}).then((resp)=>{ + SpaceList.value=resp.data + }) }); const handleSelectionChange = (val:matterInfo[]) => { @@ -434,8 +472,13 @@ const handleSelectionChange = (val:matterInfo[]) => { :default-expanded-keys="['root']" @node-click="onNodeClick" /> + 共享空间 +
    +
  • {{ sp.name }}
  • +
-
+ +
根目录/ @@ -446,7 +489,6 @@ const handleSelectionChange = (val:matterInfo[]) => { {
+
+ +
+ -
- -
+
+ +
@@ -559,9 +606,21 @@ const handleSelectionChange = (val:matterInfo[]) => { } } +.spaceitem{ + height: 50px; + align-content: center; + padding: 14px; + color: #606266; + font-weight:bold; +} .dynamic-width-message-box-byme .el-message-box__message{ width: 100%; } - +.el-overlay-message-box{ + top: 200x; + bottom: auto; +} + + \ No newline at end of file diff --git a/src/views/doc/share.vue b/src/views/doc/share.vue index 42f0a98..e0cb2b8 100644 --- a/src/views/doc/share.vue +++ b/src/views/doc/share.vue @@ -154,7 +154,6 @@ async function onlyOfficeEdit(row:matterInfo){ } let filepath="" await getShareBrowse("",{shareUuid:row.uuid,code:row.code,puuid:'root',rootUuid:'root',dprt:udprt}).then((resp)=>{ - console.log(resp.data,"<<<<<<<<<<<") filepath= resp.data.matters[0].path }) ElMessageBox.confirm("线上资源有限,确定继续线上编辑吗", "提示", { diff --git a/src/views/doc/sharePermission.vue b/src/views/doc/sharePermission.vue index d62ee60..cf6feb4 100644 --- a/src/views/doc/sharePermission.vue +++ b/src/views/doc/sharePermission.vue @@ -5,6 +5,7 @@ import { shareOrgInfo, memberInfo, getPermitedList, + getSpaceMemberList, postPermitedList} from '@/api/hr/people/share_ctrol' import { ElDialog, ElMessageBox,TableInstance, TreeInstance } from 'element-plus'; @@ -12,6 +13,7 @@ import { ElDialog, ElMessageBox,TableInstance, TreeInstance } from 'element-plus const props = withDefaults(defineProps<{ uid:string, //当前用户的uuid uuid:string, //文档的uuid + spaceid?:string, //支持空间feature confirmFunc?:(data:string[],infos:string[])=>void, //父级组件完全接管提交流程,组件不在做相关处理 closeFunc:(refresh?:boolean)=>void, //父级只需销毁组件 }>(),{}) @@ -122,7 +124,21 @@ onMounted(()=>{ permitedInfos.add(item) }) }) + }else if(props.spaceid!==""){ + //空间支持 + getSpaceMemberList(props.uid,{space:props.spaceid}).then(resp=>{ + resp.data?.members?.forEach(item=>{ + permited.add(item) //userUuids constitue the permited list + }); + + resp.data?.dprts?.forEach(val=>{ + if(val.match("[a-z]")) return; //去除可能不合规的内容 + treeSelected.push(parseInt(val)) + }) + }) } + + getOrgTreeList({}).then(resp=>{ treeData.value=resp.data @@ -137,7 +153,7 @@ onMounted(()=>{ -
+