|
|
@@ -4,9 +4,11 @@ import { MaterialAPI } from '@/config/API.ts'
|
|
|
import { useMaterial } from '@/hooks/Material/useMaterial.ts'
|
|
|
import router from '@/router'
|
|
|
import type { ResponseInfo } from '@/types/axios.ts'
|
|
|
-import type { BaseMenu } from '@/types/Promotion/Menu.ts'
|
|
|
import type { TablePaginationProps } from '@/types/Tables/pagination.ts'
|
|
|
-import { type SelectFilterOptions } from '@/types/Tables/table.ts'
|
|
|
+import {
|
|
|
+ type CustomIndicatorScheme,
|
|
|
+ type SelectFilterOptions,
|
|
|
+} from '@/types/Tables/table.ts'
|
|
|
import axiosInstance from '@/utils/axios/axiosInstance.ts'
|
|
|
import {
|
|
|
imgFields,
|
|
|
@@ -16,17 +18,64 @@ import {
|
|
|
} from '@/views/Material/config/FimLibraryConfig.ts'
|
|
|
import { Plus } from '@element-plus/icons-vue'
|
|
|
|
|
|
-import { nextTick, onMounted, reactive, ref } from 'vue'
|
|
|
-
|
|
|
-type PromotionTableType = InstanceType<typeof PromotionTable>
|
|
|
+import { computed, nextTick, onMounted, reactive, ref } from 'vue'
|
|
|
+import DrawerBaseInfo from '@/views/Material/DrawerTagsView/DrawerBaseInfo.vue'
|
|
|
+import type { BaseTableInfo } from '@/types/Tables/tablePageData.ts'
|
|
|
+import { type TableType, useMenuTable } from '@/hooks/useMenuTable.ts'
|
|
|
+import type TableCustomIndicatorController from '@/utils/localStorage/tableCustomIndicatorController.ts'
|
|
|
|
|
|
const { getGameInfo, getAllTags } = useMaterial()
|
|
|
|
|
|
// const defaultActive = ref<string>('filmLibrary')
|
|
|
-const menuList = reactive<BaseMenu[]>([])
|
|
|
-const listRef = ref<PromotionTableType>()
|
|
|
+// const menuList = reactive<BaseMenu[]>([])
|
|
|
+const listRef = ref<TableType | null>(null)
|
|
|
const isVideo = ref<boolean>(false)
|
|
|
-const tableContainer = ref<HTMLElement | null>(null)
|
|
|
+
|
|
|
+const assetTypeName = computed(() => {
|
|
|
+ return isVideo.value ? 'img' : 'video'
|
|
|
+})
|
|
|
+
|
|
|
+const tableInfo = reactive<BaseTableInfo>({
|
|
|
+ img: {
|
|
|
+ data: [],
|
|
|
+ fields: imgFields,
|
|
|
+ tableSortedFields: [],
|
|
|
+ filters: imgFilterInfo,
|
|
|
+ fixedFields: [],
|
|
|
+ remote: true,
|
|
|
+ },
|
|
|
+ video: {
|
|
|
+ data: [],
|
|
|
+ fields: videoFields,
|
|
|
+ tableSortedFields: [],
|
|
|
+ filters: videoFilterInfo,
|
|
|
+ fixedFields: [],
|
|
|
+ remote: true,
|
|
|
+ },
|
|
|
+})
|
|
|
+
|
|
|
+const drawerVisible = ref(false)
|
|
|
+
|
|
|
+const drawerTagConfig = [
|
|
|
+ {
|
|
|
+ name: 'base',
|
|
|
+ label: '基本信息',
|
|
|
+ component: DrawerBaseInfo,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'other',
|
|
|
+ label: '占位信息',
|
|
|
+ component: DrawerBaseInfo,
|
|
|
+ },
|
|
|
+]
|
|
|
+
|
|
|
+const activeName = ref(drawerTagConfig[0].name)
|
|
|
+
|
|
|
+// 自定义指标保存的方案
|
|
|
+const customIndicatorScheme = ref<Array<CustomIndicatorScheme>>([])
|
|
|
+
|
|
|
+const selectRowInfo = ref<any>()
|
|
|
+
|
|
|
/**
|
|
|
* 跳转上传页面
|
|
|
*/
|
|
|
@@ -43,7 +92,7 @@ const updateGameInfo = async () => {
|
|
|
ElMessage.error('获取游戏信息失败')
|
|
|
return
|
|
|
}
|
|
|
- const filterInfo = isVideo.value ? videoFilterInfo : imgFilterInfo
|
|
|
+ const filterInfo = tableInfo[assetTypeName.value].filters
|
|
|
const pidInfo: SelectFilterOptions[] = []
|
|
|
const gidInfo: SelectFilterOptions[] = []
|
|
|
const filterInfoPid = (filterInfo as any)['pid']
|
|
|
@@ -79,37 +128,11 @@ const updateTags = async () => {
|
|
|
value: item.id,
|
|
|
}
|
|
|
})
|
|
|
- const filterInfo = isVideo.value ? videoFilterInfo : imgFilterInfo
|
|
|
+ const filterInfo = tableInfo[assetTypeName.value].filters
|
|
|
const filterTag = (filterInfo as any)['tags']
|
|
|
filterTag['options'] = options
|
|
|
}
|
|
|
|
|
|
-const createMenu = async () => {
|
|
|
- const info = await getGameInfo()
|
|
|
- if (info === null) {
|
|
|
- ElMessage.error('游戏信息获取失败')
|
|
|
- return
|
|
|
- }
|
|
|
- menuList.splice(0, menuList.length)
|
|
|
- for (let [k, v] of Object.entries(info)) {
|
|
|
- menuList.push({
|
|
|
- name: k,
|
|
|
- title: k === '' ? '默认' : k,
|
|
|
- iconDefault: '/file/project-default.svg',
|
|
|
- iconActive: '/file/project-active.svg',
|
|
|
- children: [],
|
|
|
- })
|
|
|
- for (let item of v) {
|
|
|
- menuList[menuList.length - 1].children?.push({
|
|
|
- name: item.gid,
|
|
|
- title: item.gameName,
|
|
|
- iconDefault: '/file/folder-default.svg',
|
|
|
- iconActive: '/file/folder-active.png',
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
const tableData = reactive<Array<any>>([])
|
|
|
|
|
|
const paginationConfig = reactive<TablePaginationProps>({
|
|
|
@@ -125,10 +148,11 @@ const updateTableData = async () => {
|
|
|
}
|
|
|
const result = (await axiosInstance.post(url, params)) as ResponseInfo
|
|
|
paginationConfig.total = result.data.count
|
|
|
+ const data = tableInfo[assetTypeName.value].data
|
|
|
if (paginationConfig.total === 0) {
|
|
|
- tableData.splice(0, tableData.length)
|
|
|
+ data.splice(0, tableData.length)
|
|
|
} else {
|
|
|
- tableData.splice(0, tableData.length, ...result.data.list)
|
|
|
+ data.splice(0, tableData.length, ...result.data.list)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -143,7 +167,7 @@ const updateResolution = async () => {
|
|
|
return
|
|
|
}
|
|
|
const resolutionList = result.data['resolution']
|
|
|
- const filterInfo = isVideo.value ? videoFilterInfo : imgFilterInfo
|
|
|
+ const filterInfo = tableInfo[assetTypeName.value].filters
|
|
|
const filterResolution = (filterInfo as any)['resolution']
|
|
|
filterResolution['options'] = resolutionList.map((item: any) => {
|
|
|
return {
|
|
|
@@ -153,6 +177,39 @@ const updateResolution = async () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const viewDetails = (row: any) => {
|
|
|
+ drawerVisible.value = true
|
|
|
+ selectRowInfo.value = row
|
|
|
+}
|
|
|
+
|
|
|
+const saveTableName = '素材'
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 保存的文件名
|
|
|
+ * @return {*}
|
|
|
+ */
|
|
|
+const fileName = computed(() => {
|
|
|
+ return `${saveTableName}-${assetTypeName.value}`
|
|
|
+})
|
|
|
+
|
|
|
+// 每个表格的自定义方案的IO控制器
|
|
|
+const tableControllers: {
|
|
|
+ [key: string]: TableCustomIndicatorController
|
|
|
+} = {}
|
|
|
+
|
|
|
+const { changeScheme, updateCustomIndicator, initData } = useMenuTable(
|
|
|
+ saveTableName,
|
|
|
+ fileName,
|
|
|
+ assetTypeName,
|
|
|
+ customIndicatorScheme,
|
|
|
+ tableControllers,
|
|
|
+ tableInfo,
|
|
|
+ {},
|
|
|
+ paginationConfig,
|
|
|
+ listRef,
|
|
|
+ [],
|
|
|
+)
|
|
|
+
|
|
|
const updateFilterInfo = async () => {
|
|
|
await updateResolution()
|
|
|
await updateGameInfo()
|
|
|
@@ -166,7 +223,9 @@ const changeAssetType = async () => {
|
|
|
|
|
|
onMounted(async () => {
|
|
|
await updateFilterInfo()
|
|
|
+
|
|
|
await updateTableData()
|
|
|
+ await initData(false)
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
@@ -185,15 +244,18 @@ onMounted(async () => {
|
|
|
</div>
|
|
|
<div class="flContent">
|
|
|
<PromotionTable
|
|
|
- :table-container="tableContainer"
|
|
|
- :filters-info="isVideo ? videoFilterInfo : imgFilterInfo"
|
|
|
- :table-data="tableData"
|
|
|
- :table-fields="isVideo ? videoFields : imgFields"
|
|
|
:pagination-config="paginationConfig"
|
|
|
+ :table-fields="tableInfo[assetTypeName].fields"
|
|
|
+ :filters-info="tableInfo[assetTypeName].filters"
|
|
|
+ :sorted-table-fields="tableInfo[assetTypeName].tableSortedFields"
|
|
|
+ :table-data="tableInfo[assetTypeName].data"
|
|
|
:need-export="false"
|
|
|
- :remote-pagination="true"
|
|
|
- :fixed-fields="['action']"
|
|
|
+ :remote-pagination="tableInfo[assetTypeName].remote"
|
|
|
+ :fixed-fields="tableInfo[assetTypeName].fixedFields"
|
|
|
+ :scheme-list="customIndicatorScheme"
|
|
|
@query-table="updateTableData"
|
|
|
+ @update-custom-indicator="updateCustomIndicator"
|
|
|
+ @change-scheme="changeScheme"
|
|
|
ref="listRef"
|
|
|
style="height: 100%"
|
|
|
>
|
|
|
@@ -206,14 +268,35 @@ onMounted(async () => {
|
|
|
>上传素材
|
|
|
</el-button>
|
|
|
</template>
|
|
|
- <template #operations>
|
|
|
+ <template #operations="{ row }">
|
|
|
<div>
|
|
|
- <el-button text type="primary">预览</el-button>
|
|
|
+ <el-button text type="primary" @click="viewDetails(row)"
|
|
|
+ >详情</el-button
|
|
|
+ >
|
|
|
<el-button text type="success">下载</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
</PromotionTable>
|
|
|
</div>
|
|
|
+ <el-drawer
|
|
|
+ v-model="drawerVisible"
|
|
|
+ direction="rtl"
|
|
|
+ :size="1160"
|
|
|
+ :show-close="false"
|
|
|
+ :with-header="false"
|
|
|
+ :append-to-body="true"
|
|
|
+ :destroy-on-close="true"
|
|
|
+ >
|
|
|
+ <el-tabs v-model="activeName">
|
|
|
+ <el-tab-pane
|
|
|
+ v-for="item in drawerTagConfig"
|
|
|
+ :label="item.label"
|
|
|
+ :name="item.name"
|
|
|
+ >
|
|
|
+ <component :info="selectRowInfo" :is="item.component"></component>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-drawer>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -226,14 +309,11 @@ onMounted(async () => {
|
|
|
overflow: scroll;
|
|
|
}
|
|
|
|
|
|
-.gameSelectContainer,
|
|
|
-.flQueryForm,
|
|
|
.flContent {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
|
|
|
-.gameSelectContainer,
|
|
|
.filmLibraryHeader,
|
|
|
.flContent {
|
|
|
padding: 10px 20px;
|