|
@@ -214,6 +214,19 @@
|
|
|
expandType="popup"
|
|
|
v-model="contextmenu.activeValue"
|
|
|
>
|
|
|
+ <t-submenu
|
|
|
+ value="moveTo"
|
|
|
+ :title="`移动到${activedGroup==='方案'?'模板':'方案'}`"
|
|
|
+ v-if="['方案', '模板'].includes(activedGroup)"
|
|
|
+ :disabled="contextmenu.component['3d']"
|
|
|
+ >
|
|
|
+ <t-menu-item
|
|
|
+ v-for="subMenu in moveGroups[activedGroup==='方案'?'模板':'方案']"
|
|
|
+ :value="'moveTo:' + subMenu.name"
|
|
|
+ >
|
|
|
+ {{ subMenu.name }}
|
|
|
+ </t-menu-item>
|
|
|
+ </t-submenu>
|
|
|
<t-submenu
|
|
|
value="move"
|
|
|
title="移动到"
|
|
@@ -403,6 +416,10 @@ const { select } = useSelection();
|
|
|
const activedGroup = ref('');
|
|
|
const activeAssets = ref('system');
|
|
|
let groups = reactive([]);
|
|
|
+let moveGroups = reactive<any>({
|
|
|
+ '方案':[],
|
|
|
+ '模板':[]
|
|
|
+});
|
|
|
const systemGroups = [
|
|
|
{
|
|
|
icon: 'desktop',
|
|
@@ -563,6 +580,8 @@ const groupChange = async (name: string) => {
|
|
|
|
|
|
//用户方案
|
|
|
subGroups.value = await getCollectionImageList('方案', 'v',1);
|
|
|
+ moveGroups['方案'] = [];
|
|
|
+ subGroups.value.forEach((item)=>{if(item.name!=='默认'){ moveGroups['方案'].push({name:item.name})}});
|
|
|
groupType.value = 1;
|
|
|
userLastName = name;
|
|
|
}
|
|
@@ -592,6 +611,8 @@ const groupChange = async (name: string) => {
|
|
|
// await getPrivateProjects('le5leV-template');
|
|
|
// userLastName = name;
|
|
|
subGroups.value = await getCollectionImageList('模板', 'v',2);
|
|
|
+ moveGroups['模板'] = [];
|
|
|
+ subGroups.value.forEach((item)=>{if(item.name!=='默认'){ moveGroups['模板'].push({name:item.name})}});
|
|
|
groupType.value = 1;
|
|
|
userLastName = name;
|
|
|
}
|
|
@@ -1529,6 +1550,28 @@ const onContextMenu = async (e: MouseEvent, group: any, item: any) => {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ if(!(moveGroups['模板']&&moveGroups['模板'].length)){
|
|
|
+ let ret: { list: any[] } = await axios.post('/api/directory/list', {
|
|
|
+ fullpath:"/大屏/模板",
|
|
|
+ });
|
|
|
+ moveGroups['模板'] = [];
|
|
|
+ ret.list.forEach((item)=>{
|
|
|
+ if(item.fullpath!=='/大屏/模板/默认'){
|
|
|
+ moveGroups['模板'].push({name:item.fullpath.split('/')[3]})
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(!(moveGroups['方案']&&moveGroups['方案'].length)){
|
|
|
+ let ret: { list: any[] } = await axios.post('/api/directory/list', {
|
|
|
+ fullpath:"/大屏/方案",
|
|
|
+ });
|
|
|
+ moveGroups['方案'] = [];
|
|
|
+ ret.list.forEach((item)=>{
|
|
|
+ if(item.fullpath!=='/大屏/方案/默认'){
|
|
|
+ moveGroups['方案'].push({name:item.fullpath.split('/')[3]})
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
contextmenu.subMenus = [];
|
|
|
for (const elem of subGroups.value) {
|
|
|
if (elem === group || elem.name === '默认' || elem.name === '3D') {
|
|
@@ -1604,6 +1647,40 @@ const onMenu = async (val: string) => {
|
|
|
Object.assign(delDialog.contextmenuObj, contextmenu);
|
|
|
break;
|
|
|
default:
|
|
|
+ if(val.startsWith('moveTo:')){
|
|
|
+ val = val.replace('moveTo:', '');
|
|
|
+
|
|
|
+ //更新前端
|
|
|
+ contextmenu.group.list.forEach((item: any, index: number, arr: any[]) => {
|
|
|
+ if (id === item._id || id === item.id) {
|
|
|
+ arr.splice(index, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //更新后端图纸
|
|
|
+ let ret = await updateCollection('v', {
|
|
|
+ id,
|
|
|
+ folder: val === '默认' ? '' : val,
|
|
|
+ userFlag:activedGroup.value === '方案' ? 2 : 1
|
|
|
+ });
|
|
|
+ if (!ret) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //更新后端 图片
|
|
|
+ let path: string =
|
|
|
+ contextmenu.component.filename || contextmenu.component.image;
|
|
|
+ if (imageDrive && path.startsWith(imageDrive)) {
|
|
|
+ path = path.slice(imageDrive.length);
|
|
|
+ }
|
|
|
+ if(!path.startsWith('/api/file')) {
|
|
|
+ path = '/api/file' + path;
|
|
|
+ }
|
|
|
+ await axios.patch(`${path}`, {
|
|
|
+ // filenames: [filename],
|
|
|
+ directory: `/大屏/${activedGroup.value==='方案'?'模板':'方案' }/${val || '默认'}`,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
if (val.indexOf('move:')) {
|
|
|
return;
|
|
|
}
|