|
@@ -57,10 +57,9 @@
|
|
|
<template v-else>
|
|
|
<div
|
|
|
v-if="
|
|
|
- activedGroup === '组件' ||
|
|
|
activedGroup === '图片' ||
|
|
|
(activeAssets === 'user' &&
|
|
|
- (activedGroup === '方案' || activedGroup === '模板'))
|
|
|
+ (activedGroup === '方案' || activedGroup === '模板' || activedGroup === '组件'))
|
|
|
"
|
|
|
class="px-16 mt-12 mb-8 ml-4"
|
|
|
>
|
|
@@ -92,12 +91,9 @@
|
|
|
<template #headerRightContent>
|
|
|
<t-space size="small" @click.stop tabindex="0">
|
|
|
<t-upload
|
|
|
- v-if="
|
|
|
- item.canEdited &&
|
|
|
- (activedGroup === '组件' || activedGroup === '图片')
|
|
|
- "
|
|
|
+ v-if="item.canEdited && activedGroup === '图片'"
|
|
|
action="/api/image/upload"
|
|
|
- :accept="activedGroup === '组件' ? '.svg' : 'image/*'"
|
|
|
+ accept="image/*"
|
|
|
:headers="headers"
|
|
|
:data="{
|
|
|
directory: `/大屏/${activedGroup}/${item.name}`,
|
|
@@ -378,6 +374,12 @@ const systemGroups = [
|
|
|
name: '模板',
|
|
|
key: '',
|
|
|
},
|
|
|
+ {
|
|
|
+ icon: 'l-zujian',
|
|
|
+ name: '组件',
|
|
|
+ key: 'chart',
|
|
|
+ type: 'iconfont',
|
|
|
+ },
|
|
|
{
|
|
|
icon: 'chart',
|
|
|
name: '图表',
|
|
@@ -446,6 +448,7 @@ const activedPanels = reactive<any>({});
|
|
|
|
|
|
const caseCaches = [];
|
|
|
const templateCaches = [];
|
|
|
+const componentCaches = [];
|
|
|
const materials = [];
|
|
|
const pngs = [];
|
|
|
|
|
@@ -489,7 +492,7 @@ const groupChange = async (name: string) => {
|
|
|
if (activeAssets.value === 'system') {
|
|
|
if (!caseCaches.length) {
|
|
|
loading.value = true;
|
|
|
- caseCaches.push(...(await getCaseProjects('系统方案')));
|
|
|
+ caseCaches.push(...(await getCaseProjects('系统方案',1)));
|
|
|
for (const group of cases) {
|
|
|
group.list = [];
|
|
|
for (const item of caseCaches) {
|
|
@@ -511,7 +514,7 @@ const groupChange = async (name: string) => {
|
|
|
// userLastName = name;
|
|
|
|
|
|
//用户方案
|
|
|
- subGroups.value = await getCollectionImageList('方案', 'v');
|
|
|
+ subGroups.value = await getCollectionImageList('方案', 'v',1);
|
|
|
groupType.value = 1;
|
|
|
userLastName = name;
|
|
|
}
|
|
@@ -520,7 +523,7 @@ const groupChange = async (name: string) => {
|
|
|
if (activeAssets.value === 'system') {
|
|
|
if (!templateCaches.length) {
|
|
|
loading.value = true;
|
|
|
- templateCaches.push(...(await getCaseProjects('系统模板')));
|
|
|
+ templateCaches.push(...(await getCaseProjects('系统模板',2)));
|
|
|
for (const group of templates) {
|
|
|
group.list = [];
|
|
|
for (const item of templateCaches) {
|
|
@@ -540,7 +543,7 @@ const groupChange = async (name: string) => {
|
|
|
// groupType.value = 1;
|
|
|
// await getPrivateProjects('le5leV-template');
|
|
|
// userLastName = name;
|
|
|
- subGroups.value = await getCollectionImageList('模板', 'le5leV');
|
|
|
+ subGroups.value = await getCollectionImageList('模板', 'v',2);
|
|
|
groupType.value = 1;
|
|
|
userLastName = name;
|
|
|
}
|
|
@@ -588,16 +591,28 @@ const groupChange = async (name: string) => {
|
|
|
lastName = name;
|
|
|
break;
|
|
|
case '组件':
|
|
|
- // subGroups.value = await getUserComponents();
|
|
|
- // groupType.value = 1;
|
|
|
- // await getPrivateGraphics();
|
|
|
- // userLastName = name;
|
|
|
- subGroups.value = await getCollectionImageList(
|
|
|
- '组件',
|
|
|
- 'le5leV-components'
|
|
|
- );
|
|
|
- groupType.value = 1;
|
|
|
- userLastName = name;
|
|
|
+ if (activeAssets.value === 'system') {
|
|
|
+ if (!componentCaches.length) {
|
|
|
+ loading.value = true;
|
|
|
+ componentCaches.push(...(await getCaseProjects('系统组件',1)));
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ groupType.value = 1;
|
|
|
+ subGroups.value = componentCaches;
|
|
|
+ lastName = name;
|
|
|
+ } else {
|
|
|
+ // subGroups.value = await getUserComponents();
|
|
|
+ // groupType.value = 1;
|
|
|
+ // await getPrivateGraphics();
|
|
|
+ // userLastName = name;
|
|
|
+ subGroups.value = await getCollectionImageList(
|
|
|
+ '组件',
|
|
|
+ 'v.component',
|
|
|
+ 1
|
|
|
+ );
|
|
|
+ groupType.value = 1;
|
|
|
+ userLastName = name;
|
|
|
+ }
|
|
|
break;
|
|
|
case '图片':
|
|
|
loading.value = true;
|
|
@@ -628,7 +643,7 @@ const groupChange = async (name: string) => {
|
|
|
};
|
|
|
// TODO 获取方案文件
|
|
|
//获取方案文件夹
|
|
|
-const getCollectionImageList = async (name?: string, collection?: string) => {
|
|
|
+const getCollectionImageList = async (name?: string, collection?: string, userFlag?:number) => {
|
|
|
//1. 获取网盘文件夹
|
|
|
const fullpath = `/大屏/${name}`;
|
|
|
let ret: { list: any[] } = await axios.post('/api/directory/list', {
|
|
@@ -647,13 +662,13 @@ const getCollectionImageList = async (name?: string, collection?: string) => {
|
|
|
list.push(i);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
const data = {
|
|
|
- directory: "/大屏/方案/123",
|
|
|
+ // directory: `/大屏/${name}`,
|
|
|
// query: {
|
|
|
// // folder: '',
|
|
|
// tags: name !== '组件' ? name : undefined,
|
|
|
// },
|
|
|
+ userFlag,
|
|
|
projection: {
|
|
|
image: 1,
|
|
|
id: 1,
|
|
@@ -743,15 +758,15 @@ const getImageList = async () => {
|
|
|
let list = _ret.list.map((_item) => {
|
|
|
return {
|
|
|
..._item,
|
|
|
- image: _item.metadata.url || `/file${_item.filename}`,
|
|
|
+ image: _item.url || `/file${_item.filename}`,
|
|
|
visible: true,
|
|
|
folder: item.fullpath,
|
|
|
- _id: _item._id,
|
|
|
+ id: _item.id || _item._id,
|
|
|
};
|
|
|
});
|
|
|
return {
|
|
|
name: secondDir[3],
|
|
|
- _id: item._id,
|
|
|
+ id: item.id || item._id,
|
|
|
canEdited: secondDir[3] !== '默认',
|
|
|
list: list,
|
|
|
};
|
|
@@ -759,11 +774,11 @@ const getImageList = async () => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-const getCaseProjects = async (name: string, current = 1, pageSize = 1000) => {
|
|
|
+const getCaseProjects = async (name: string,systemFlag = 1, current = 1, pageSize = 1000) => {
|
|
|
const query: any = { tags: name };
|
|
|
-
|
|
|
+ let collection = name == '系统组件' ? 'v.vomponent' : 'v';
|
|
|
const ret: any = await axios.post(
|
|
|
- '/api/data/le5leV/list',
|
|
|
+ `/api/data/${collection}/list`,
|
|
|
{
|
|
|
query,
|
|
|
shared: 'true',
|
|
@@ -776,6 +791,7 @@ const getCaseProjects = async (name: string, current = 1, pageSize = 1000) => {
|
|
|
case: 1,
|
|
|
},
|
|
|
sort: { createdAt: 1 },
|
|
|
+ systemFlag
|
|
|
},
|
|
|
{
|
|
|
params: {
|
|
@@ -857,9 +873,9 @@ const getPrivateGroups = async () => {
|
|
|
name: 1,
|
|
|
list: 1,
|
|
|
},
|
|
|
- query: {
|
|
|
- type: `le5leV-components`,
|
|
|
- },
|
|
|
+ // query: {
|
|
|
+ // type: `v-components`,
|
|
|
+ // },
|
|
|
sort: { createdAt: 1 },
|
|
|
},
|
|
|
config
|
|
@@ -904,7 +920,7 @@ const getUserComponents = async () => {
|
|
|
list: 1,
|
|
|
},
|
|
|
query: {
|
|
|
- type: `le5leV-components`,
|
|
|
+ type: `v.component`,
|
|
|
},
|
|
|
sort: { createdAt: 1 },
|
|
|
},
|
|
@@ -969,7 +985,7 @@ const getPrivateProjects = async (type: string) => {
|
|
|
const data = {
|
|
|
query: {
|
|
|
folder: '',
|
|
|
- tags: type === 'le5leV-template' ? '模板' : '方案',
|
|
|
+ tags: type === 'v-template' ? '模板' : '方案',
|
|
|
},
|
|
|
projection: {
|
|
|
image: 1,
|
|
@@ -984,7 +1000,7 @@ const getPrivateProjects = async (type: string) => {
|
|
|
pageSize: 1000,
|
|
|
},
|
|
|
};
|
|
|
- const res: any = await getCollectionList('le5leV', data, config);
|
|
|
+ const res: any = await getCollectionList('v', data, config);
|
|
|
if (res?.list) {
|
|
|
// res.list.forEach((item) => {
|
|
|
// item.draggable = false;
|
|
@@ -1056,7 +1072,7 @@ const dragStart = async (event: DragEvent | MouseEvent, item: any) => {
|
|
|
// 默认
|
|
|
if (!item.componentDatas && !item.componentData) {
|
|
|
isAsync = true;
|
|
|
- const ret: any = await axios.post(`/api/data/le5leV-components/get`, {
|
|
|
+ const ret: any = await axios.post(`/api/data/v.component/get`, {
|
|
|
id,
|
|
|
});
|
|
|
item.componentDatas = ret.componentDatas;
|
|
@@ -1196,7 +1212,7 @@ const getPrivateGraphics = async () => {
|
|
|
},
|
|
|
};
|
|
|
const res: any = await axios.post(
|
|
|
- '/api/data/le5le3d/list',
|
|
|
+ '/api/data/3d/list',
|
|
|
data,
|
|
|
config
|
|
|
);
|
|
@@ -1249,7 +1265,7 @@ const createFoder = async () => {
|
|
|
if (activeAssets.value !== 'user') {
|
|
|
return;
|
|
|
}
|
|
|
- if (editedFolder.value.id) {
|
|
|
+ if (editedFolder.value.id || editedFolder.value._id) {
|
|
|
const ret: any = await axios.post('/api/directory/update', {
|
|
|
oldFullpath: `/大屏/${activedGroup.value}/` + editedFolder.value.oldLabel,
|
|
|
newFullpath: `/大屏/${activedGroup.value}/` + editedFolder.value.label,
|
|
@@ -1261,11 +1277,11 @@ const createFoder = async () => {
|
|
|
//更新图纸的folder
|
|
|
if (['组件', '方案', '模板'].includes(activedGroup.value)) {
|
|
|
const collection =
|
|
|
- activedGroup.value === '组件' ? 'le5leV-components' : 'le5leV';
|
|
|
+ activedGroup.value === '组件' ? 'v.component' : 'v';
|
|
|
editedFolder.value.list?.forEach(async (item) => {
|
|
|
item.folder = editedFolder.value.label;
|
|
|
await updateCollection(collection, {
|
|
|
- id: item.id,
|
|
|
+ id: item.id || item._id,
|
|
|
folder: editedFolder.value.label,
|
|
|
});
|
|
|
});
|
|
@@ -1276,7 +1292,7 @@ const createFoder = async () => {
|
|
|
});
|
|
|
if (ret) {
|
|
|
editedFolder.value.name = editedFolder.value.label;
|
|
|
- editedFolder.value._id = ret._id || ret.id;
|
|
|
+ editedFolder.value.id = ret.id;
|
|
|
editedFolder.value.edited = false;
|
|
|
}
|
|
|
}
|
|
@@ -1314,10 +1330,10 @@ const _createFoder = async () => {
|
|
|
} else {
|
|
|
let type =
|
|
|
activedGroup.value === '组件'
|
|
|
- ? 'le5leV-components'
|
|
|
+ ? 'v.component'
|
|
|
: activedGroup.value === '模板'
|
|
|
- ? 'le5leV-template'
|
|
|
- : 'le5leV';
|
|
|
+ ? 'v-template'
|
|
|
+ : 'v';
|
|
|
const ret: any = await axios.post('/api/data/folders/add', {
|
|
|
name: editedFolder.value.label,
|
|
|
type,
|
|
@@ -1362,11 +1378,11 @@ const onEditHeader = (item: any) => {
|
|
|
const onAdd = (item: any) => {
|
|
|
blank();
|
|
|
if (activedGroup.value === '方案') {
|
|
|
- item.vType = 'le5leV';
|
|
|
+ item.vType = 'v';
|
|
|
} else if (activedGroup.value === '模板') {
|
|
|
- item.vType = 'le5leV-template';
|
|
|
+ item.vType = 'v-template';
|
|
|
} else if (activedGroup.value === '组件') {
|
|
|
- item.vType = 'le5leV-components';
|
|
|
+ item.vType = 'v.component';
|
|
|
}
|
|
|
setFolder(item);
|
|
|
const query: any = {
|
|
@@ -1468,7 +1484,8 @@ const onMenu = async (val: string) => {
|
|
|
contextmenu.activeValue = 0;
|
|
|
return;
|
|
|
}
|
|
|
- if (contextmenu.component.component) {
|
|
|
+ // if (contextmenu.component.component) {
|
|
|
+ if (activedGroup.value == '组件') {
|
|
|
autoSave();
|
|
|
router.push({
|
|
|
path: '/',
|
|
@@ -1545,8 +1562,8 @@ const onMenu = async (val: string) => {
|
|
|
}
|
|
|
});
|
|
|
if (activedGroup.value !== '图片') {
|
|
|
- let collection = contextmenu.component.component
|
|
|
- ? 'v-components'
|
|
|
+ let collection = activedGroup.value === '组件'
|
|
|
+ ? 'v.component'
|
|
|
: 'v';
|
|
|
// 更新后端组件信息
|
|
|
let ret = await updateCollection(collection, {
|
|
@@ -1578,10 +1595,16 @@ const onMenu = async (val: string) => {
|
|
|
if (imageDrive && filename.startsWith(imageDrive)) {
|
|
|
filename = filename.slice(imageDrive.length);
|
|
|
}
|
|
|
+ let fullname: string =
|
|
|
+ contextmenu.component.filename || contextmenu.component.image;
|
|
|
//更新缩略图位置
|
|
|
- await axios.post('/api/files/update', {
|
|
|
- filenames: [filename],
|
|
|
- 'metadata.directory': `/大屏/${activedGroup.value}/${val || '默认'}`,
|
|
|
+ // await axios.post('/api/files/update', {
|
|
|
+ // filenames: [filename],
|
|
|
+ // 'metadata.directory': `/大屏/${activedGroup.value}/${val || '默认'}`,
|
|
|
+ // });
|
|
|
+ await axios.patch(`/api${fullname}`, {
|
|
|
+ // filenames: [filename],
|
|
|
+ directory: `/大屏/${activedGroup.value}/${val || '默认'}`,
|
|
|
});
|
|
|
break;
|
|
|
}
|
|
@@ -1596,8 +1619,8 @@ const _delComponent = async () => {
|
|
|
// const id = contextmenu.component._id || contextmenu.component.id;
|
|
|
if (['组件', '方案', '模板'].includes(activedGroup.value)) {
|
|
|
let collection = delDialog.contextmenuObj.component.component
|
|
|
- ? 'le5leV-components'
|
|
|
- : 'le5leV';
|
|
|
+ ? 'v.component'
|
|
|
+ : 'v';
|
|
|
const id =
|
|
|
delDialog.contextmenuObj.component._id ||
|
|
|
delDialog.contextmenuObj.component.id;
|
|
@@ -1649,7 +1672,7 @@ const _delComponent = async () => {
|
|
|
}
|
|
|
);
|
|
|
await axios.post(`/api/files/delete`, {
|
|
|
- filenames: [delDialog.contextmenuObj.component.filename],
|
|
|
+ fullnames: [delDialog.contextmenuObj.component.filename],
|
|
|
physically: false,
|
|
|
});
|
|
|
}
|
|
@@ -1662,9 +1685,15 @@ const _delComponent = async () => {
|
|
|
const delComponent = async () => {
|
|
|
// const id = contextmenu.component._id || contextmenu.component.id;
|
|
|
if (['组件', '方案', '模板'].includes(activedGroup.value)) {
|
|
|
- let collection = delDialog.contextmenuObj.component.component
|
|
|
- ? 'v-components'
|
|
|
- : 'v';
|
|
|
+ // let collection = delDialog.contextmenuObj.component.component
|
|
|
+ // ? 'v.component'
|
|
|
+ // : 'v';
|
|
|
+ let collection = '';
|
|
|
+ if(activedGroup.value == '组件') {
|
|
|
+ collection = 'v.component'
|
|
|
+ } else {
|
|
|
+ collection = 'v'
|
|
|
+ }
|
|
|
const id =
|
|
|
delDialog.contextmenuObj.component._id ||
|
|
|
delDialog.contextmenuObj.component.id;
|
|
@@ -1701,14 +1730,17 @@ const delComponent = async () => {
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
- let filename: string =
|
|
|
- delDialog.contextmenuObj.component.filename ||
|
|
|
+ let fullname: string =
|
|
|
+ delDialog.contextmenuObj.component.fullname ||
|
|
|
delDialog.contextmenuObj.component.image;
|
|
|
- if (imageDrive && filename.startsWith(imageDrive)) {
|
|
|
- filename = filename.slice(imageDrive.length);
|
|
|
+ if (imageDrive && fullname.startsWith(imageDrive)) {
|
|
|
+ fullname = fullname.slice(imageDrive.length);
|
|
|
+ }
|
|
|
+ if(fullname.startsWith('/file')) {
|
|
|
+ fullname = fullname.slice('/file'.length);
|
|
|
}
|
|
|
await axios.post(`/api/files/delete`, {
|
|
|
- filenames: [filename],
|
|
|
+ fullnames: [fullname],
|
|
|
physically: false,
|
|
|
});
|
|
|
delDialog.show = false;
|
|
@@ -1729,7 +1761,7 @@ const drop = (obj: any) => {
|
|
|
|
|
|
const onSubmitOrder = async () => {
|
|
|
const result: any = await axios.post('/api/order/datas/submit', {
|
|
|
- collection: 'le5leV',
|
|
|
+ collection: 'v',
|
|
|
id: chargeDialog.data._id,
|
|
|
});
|
|
|
if (result) {
|
|
@@ -1844,21 +1876,22 @@ function processFileObj(fileObj, c) {
|
|
|
}
|
|
|
|
|
|
const fileSuccessed = async (content: any) => {
|
|
|
- if (activedGroup.value === '组件') {
|
|
|
- const c: any = {
|
|
|
- name: filename(content.file.name),
|
|
|
- image:
|
|
|
- content.response.url ||
|
|
|
- content.response.metadata.url ||
|
|
|
- `/file${content.response.filename}`,
|
|
|
- folder: uploadGroup.name === '默认' ? '' : uploadGroup.name,
|
|
|
- };
|
|
|
- let rst = await processFileObj(
|
|
|
- { raw: content.file.raw, name: content.file.name },
|
|
|
- c
|
|
|
- );
|
|
|
- const ret: any = await addCollection('le5leV-components', rst);
|
|
|
- c._id = ret._id || ret.id;
|
|
|
+ // 组件中去掉了上传图片入口
|
|
|
+ // if (activedGroup.value === '组件') {
|
|
|
+ // const c: any = {
|
|
|
+ // name: filename(content.file.name),
|
|
|
+ // image:
|
|
|
+ // content.response.url ||
|
|
|
+ // content.response.metadata.url ||
|
|
|
+ // `/file${content.response.filename}`,
|
|
|
+ // folder: uploadGroup.name === '默认' ? '' : uploadGroup.name,
|
|
|
+ // };
|
|
|
+ // let rst = await processFileObj(
|
|
|
+ // { raw: content.file.raw, name: content.file.name },
|
|
|
+ // c
|
|
|
+ // );
|
|
|
+ // const ret: any = await addCollection('v.component', rst);
|
|
|
+ // c._id = ret._id || ret.id;
|
|
|
// if (ret && uploadGroup.name !== '默认') {
|
|
|
// if (!uploadGroup.list) {
|
|
|
// uploadGroup.list = [];
|
|
@@ -1875,8 +1908,8 @@ const fileSuccessed = async (content: any) => {
|
|
|
// }
|
|
|
// uploadGroup.list.push(c);
|
|
|
// }
|
|
|
- uploadGroup.list.push(c);
|
|
|
- } else if (activedGroup.value === '图片') {
|
|
|
+ // uploadGroup.list.push(c);
|
|
|
+ // } else if (activedGroup.value === '图片') {
|
|
|
uploadGroup.list.push({
|
|
|
...content.response,
|
|
|
image:
|
|
@@ -1884,9 +1917,9 @@ const fileSuccessed = async (content: any) => {
|
|
|
content.response.metadata.url ||
|
|
|
`/file${content.response.filename}`,
|
|
|
visible: true,
|
|
|
- folder: content.response.metadata.directory,
|
|
|
+ folder: content.response.directory || content.response.metadata.directory,
|
|
|
});
|
|
|
- }
|
|
|
+ // }
|
|
|
MessagePlugin.success('上传成功');
|
|
|
};
|
|
|
|
|
@@ -1928,9 +1961,9 @@ const reloadCurrent = () => {
|
|
|
|
|
|
const updateAfterSave = (e) => {
|
|
|
if (activeAssets.value === 'user') {
|
|
|
- if (e === 'le5leV-components' && activedGroup.value === '组件') {
|
|
|
+ if (e === 'v.component' && activedGroup.value === '组件') {
|
|
|
groupChange('组件');
|
|
|
- } else if (e === 'le5leV-template' && activedGroup.value === '模板') {
|
|
|
+ } else if (e === 'v-template' && activedGroup.value === '模板') {
|
|
|
groupChange('模板');
|
|
|
} else if (e === '' && activedGroup.value === '方案') {
|
|
|
groupChange('方案');
|