From 4029ec0f7ee0c971053d37a2b72ba1ea6b321cce Mon Sep 17 00:00:00 2001
From: rd <1344903914@qq.com>
Date: Sat, 23 Aug 2025 16:14:05 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8E=9F=E6=96=99=E5=BA=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/all/generationWorkshop.ts | 20 +++
src/utils/tools.ts | 2 +-
.../components/filter-block/index.vue | 121 ++++++++++++++++
.../components/table/delete-file-modal.vue | 54 +++++++
.../raw-material/components/table/index.vue | 137 ++++++++++++++++++
.../raw-material/components/table/style.scss | 16 ++
.../components/raw-material/constants.ts | 87 +++++++++++
.../components/raw-material/index.vue | 135 ++++++++++++++++-
.../components/raw-material/style.scss | 38 ++++-
.../components/raw-material/constants.ts | 26 ++++
.../components/raw-material/index.vue | 17 ++-
11 files changed, 647 insertions(+), 6 deletions(-)
create mode 100644 src/views/material-center/components/raw-material/components/filter-block/index.vue
create mode 100644 src/views/material-center/components/raw-material/components/table/delete-file-modal.vue
create mode 100644 src/views/material-center/components/raw-material/components/table/index.vue
create mode 100644 src/views/material-center/components/raw-material/components/table/style.scss
create mode 100644 src/views/material-center/components/raw-material/constants.ts
create mode 100644 src/views/writer-material-center/components/raw-material/constants.ts
diff --git a/src/api/all/generationWorkshop.ts b/src/api/all/generationWorkshop.ts
index 8c9a16d..f31186e 100644
--- a/src/api/all/generationWorkshop.ts
+++ b/src/api/all/generationWorkshop.ts
@@ -150,3 +150,23 @@ export const deleteShareWorksComments = (id: string, commentId: string, shareCod
headers: { 'share-code': shareCode },
});
};
+
+// 原料库-分页
+export const getRawMaterialsPage = (params = {}) => {
+ return Http.get('/v1/raw-materials', params);
+};
+
+// 原料库-删除
+export const deleteRawMaterial = (id: string) => {
+ return Http.delete(`/v1/raw-materials/${id}`);
+};
+
+// 原料库-批量删除
+export const batchDeleteRawMaterials = (params = {}) => {
+ return Http.delete(`/v1/raw-materials/batch`, { data: params });
+};
+
+// 原料库-AI添加
+export const postRawMaterialsAI = (params = {}) => {
+ return Http.post('/v1/raw-materials/ai', params);
+};
diff --git a/src/utils/tools.ts b/src/utils/tools.ts
index bf1c356..acbb191 100644
--- a/src/utils/tools.ts
+++ b/src/utils/tools.ts
@@ -115,7 +115,7 @@ export function formatFileSize(bytes: number): string {
if (bytes === 0) return '0 Bytes';
const k = 1024;
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
+ const sizes = ['Bytes', 'kb', 'mB', 'gB', 'tB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
diff --git a/src/views/material-center/components/raw-material/components/filter-block/index.vue b/src/views/material-center/components/raw-material/components/filter-block/index.vue
new file mode 100644
index 0000000..00525a5
--- /dev/null
+++ b/src/views/material-center/components/raw-material/components/filter-block/index.vue
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+ 重置
+
+
+
+
+
+
+
diff --git a/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue b/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue
new file mode 100644
index 0000000..fe55b31
--- /dev/null
+++ b/src/views/material-center/components/raw-material/components/table/delete-file-modal.vue
@@ -0,0 +1,54 @@
+
+
+
+
![]()
+
确认删除 {{ fileName }} 文件吗?
+
+
+ 取消
+ 确认删除
+
+
+
+
+
diff --git a/src/views/material-center/components/raw-material/components/table/index.vue b/src/views/material-center/components/raw-material/components/table/index.vue
new file mode 100644
index 0000000..7694052
--- /dev/null
+++ b/src/views/material-center/components/raw-material/components/table/index.vue
@@ -0,0 +1,137 @@
+
+ emits('select', selectedKeys, rowKeyValue, record)"
+ @select-all="(check) => emits('selectAll', check)"
+ >
+
+
+
+
+
+
+
+
{{ column.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ TABS_LIST.find((item) => item.value === record.type)?.label ?? '-' }}
+
+
+ {{ formatFileSize(record.size) }}
+
+
+ {{ ORIGIN_LIST.find((item) => item.value === record.origin)?.label ?? '-' }}
+
+
+ {{ record[column.dataIndex].name || record[column.dataIndex].mobile }}
+
+
+ {{ exactFormatTime(record[column.dataIndex]) }}
+
+
+
+
![]()
+
下载
+
+
+
+ {{ formatTableField(column, record, true) }}
+
+
+
+
+
+
+
+
+
diff --git a/src/views/material-center/components/raw-material/components/table/style.scss b/src/views/material-center/components/raw-material/components/table/style.scss
new file mode 100644
index 0000000..d03c8da
--- /dev/null
+++ b/src/views/material-center/components/raw-material/components/table/style.scss
@@ -0,0 +1,16 @@
+.manuscript-table {
+ .cts {
+ color: var(--Text-1, #211f24);
+ font-family: $font-family-medium;
+ font-size: 14px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 22px;
+ &.num {
+ font-family: $font-family-manrope-regular;
+ }
+ &.regular {
+ font-family: $font-family-regular;
+ }
+ }
+}
diff --git a/src/views/material-center/components/raw-material/constants.ts b/src/views/material-center/components/raw-material/constants.ts
new file mode 100644
index 0000000..436dd01
--- /dev/null
+++ b/src/views/material-center/components/raw-material/constants.ts
@@ -0,0 +1,87 @@
+export enum RawMaterialType {
+ All = '',
+ Image = 0,
+ Video = 1,
+ Text = 2,
+}
+
+export const TABS_LIST = [
+ {
+ label: '全部',
+ value: RawMaterialType.All,
+ },
+ {
+ label: '图片',
+ value: RawMaterialType.Image,
+ },
+ {
+ label: '视频',
+ value: RawMaterialType.Video,
+ },
+ {
+ label: '文本',
+ value: RawMaterialType.Text,
+ },
+];
+
+export const ORIGIN_LIST = [
+ {
+ label: '本地上传',
+ value: 0,
+ },
+ {
+ label: 'AI生成',
+ value: 1,
+ },
+]
+
+export const INITIAL_QUERY = {
+ name: '',
+ uid: '',
+ type: RawMaterialType.All,
+ created_at: [],
+ sort_column: undefined,
+ sort_order: undefined,
+};
+
+export const TABLE_COLUMNS = [
+ {
+ title: '文件名称',
+ dataIndex: 'name',
+ width: 400,
+ },
+ {
+ title: '类型',
+ dataIndex: 'type',
+ width: 80,
+ },
+ {
+ title: '来源',
+ dataIndex: 'origin',
+ width: 120,
+ },
+ {
+ title: '大小',
+ dataIndex: 'size',
+ width: 120,
+ },
+ {
+ title: '上传时间',
+ dataIndex: 'created_at',
+ width: 180,
+ sortable: {
+ sortDirections: ['ascend', 'descend'],
+ },
+ },
+ {
+ title: '上传人员',
+ dataIndex: 'uploader',
+ width: 180,
+ },
+ {
+ title: '操作',
+ dataIndex: 'operation',
+ width: 100,
+ fixed: 'right',
+ }
+]
\ No newline at end of file
diff --git a/src/views/material-center/components/raw-material/index.vue b/src/views/material-center/components/raw-material/index.vue
index f5c4aaf..3dd1de8 100644
--- a/src/views/material-center/components/raw-material/index.vue
+++ b/src/views/material-center/components/raw-material/index.vue
@@ -1,10 +1,143 @@