|
@@ -187,6 +187,7 @@ import {
|
|
|
uploadMaterial,
|
|
|
editMaterial,
|
|
|
delMaterial,
|
|
|
+ delFolder,
|
|
|
checkUserSize
|
|
|
} from "@/api";
|
|
|
|
|
@@ -304,55 +305,97 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
del(item) {
|
|
|
- this.$confirm({
|
|
|
- title: i18n.t("gather.delete_material"),
|
|
|
- content: i18n.t("gather.comfirm_delete_material"),
|
|
|
- okText: i18n.t("gather.delete"),
|
|
|
- ok: () => {
|
|
|
- delMaterial(item.id, () => {
|
|
|
- this.$msg.success(i18n.t("gather.delete_success"));
|
|
|
- this.isRequestingMoreData = true
|
|
|
- const lastestUsedSearchKey = this.searchKey
|
|
|
- getMaterialList(
|
|
|
- {
|
|
|
- dirId: this.currentFolderId,
|
|
|
- pageNum: this.list.length + 1,
|
|
|
- pageSize: 1,
|
|
|
- searchKey: this.searchKey,
|
|
|
- type: TYPE,
|
|
|
- },
|
|
|
- (data) => {
|
|
|
- const index = this.list.findIndex((eachItem) => {
|
|
|
- return eachItem.id === item.id
|
|
|
- })
|
|
|
- if (index >= 0) {
|
|
|
- this.list.splice(index, 1)
|
|
|
- const newData = data.data.list.map((i) => {
|
|
|
- i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
- return i;
|
|
|
- });
|
|
|
- this.list = this.list.concat(newData)
|
|
|
- if (this.list.length === data.data.total) {
|
|
|
- this.hasMoreData = false
|
|
|
- }
|
|
|
- if (this.list.length === 0) {
|
|
|
- this.$refs['image-previewer'].onClickClose()
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.error('在素材列表里没找到要删除的那一项!');
|
|
|
+ if (item.type === 'dir') {
|
|
|
+ this.delFolder(item.id, (lastestUsedSearchKey) => {
|
|
|
+ getMaterialList(
|
|
|
+ {
|
|
|
+ dirId: this.currentFolderId,
|
|
|
+ pageNum: this.list.length + 1,
|
|
|
+ pageSize: 1,
|
|
|
+ searchKey: this.searchKey,
|
|
|
+ type: TYPE,
|
|
|
+ },
|
|
|
+ (data) => {
|
|
|
+ const index = this.list.findIndex((eachItem) => {
|
|
|
+ return eachItem.id === item.id
|
|
|
+ })
|
|
|
+ if (index >= 0) {
|
|
|
+ this.list.splice(index, 1)
|
|
|
+ const newData = data.data.list.map((i) => {
|
|
|
+ i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.list = this.list.concat(newData)
|
|
|
+ if (this.list.length === data.data.total) {
|
|
|
+ this.hasMoreData = false
|
|
|
}
|
|
|
-
|
|
|
- this.isRequestingMoreData = false
|
|
|
- this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.isRequestingMoreData = false
|
|
|
- this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
+ if (this.list.length === 0) {
|
|
|
+ this.$refs['image-previewer'].onClickClose()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error('在素材列表里没找到要删除的那一项!');
|
|
|
}
|
|
|
- )
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
+
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
+ }
|
|
|
+ )
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$confirm({
|
|
|
+ title: i18n.t("gather.delete_material"),
|
|
|
+ content: i18n.t("gather.comfirm_delete_material"),
|
|
|
+ okText: i18n.t("gather.delete"),
|
|
|
+ ok: () => {
|
|
|
+ delMaterial(item.id, () => {
|
|
|
+ this.$msg.success(i18n.t("gather.delete_success"));
|
|
|
+ this.isRequestingMoreData = true
|
|
|
+ const lastestUsedSearchKey = this.searchKey
|
|
|
+ getMaterialList(
|
|
|
+ {
|
|
|
+ dirId: this.currentFolderId,
|
|
|
+ pageNum: this.list.length + 1,
|
|
|
+ pageSize: 1,
|
|
|
+ searchKey: this.searchKey,
|
|
|
+ type: TYPE,
|
|
|
+ },
|
|
|
+ (data) => {
|
|
|
+ const index = this.list.findIndex((eachItem) => {
|
|
|
+ return eachItem.id === item.id
|
|
|
+ })
|
|
|
+ if (index >= 0) {
|
|
|
+ this.list.splice(index, 1)
|
|
|
+ const newData = data.data.list.map((i) => {
|
|
|
+ i.fileSize = changeByteUnit(Number(i.fileSize));
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.list = this.list.concat(newData)
|
|
|
+ if (this.list.length === data.data.total) {
|
|
|
+ this.hasMoreData = false
|
|
|
+ }
|
|
|
+ if (this.list.length === 0) {
|
|
|
+ this.$refs['image-previewer'].onClickClose()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.error('在素材列表里没找到要删除的那一项!');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.isRequestingMoreData = false
|
|
|
+ this.lastestUsedSearchKey = lastestUsedSearchKey
|
|
|
+ }
|
|
|
+ )
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
previewImage(targetItem) {
|
|
|
const index = this.list.findIndex((eachItem) => {
|