|
@@ -1,117 +1,133 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <!-- 查询条件 -->
|
|
|
- <el-form
|
|
|
- :model="queryParams"
|
|
|
- ref="queryRef"
|
|
|
- :inline="true"
|
|
|
- label-width="68px"
|
|
|
- >
|
|
|
- <el-form-item label="素材名称" prop="materialName">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.materialName"
|
|
|
- placeholder="请输入素材名称"
|
|
|
- clearable
|
|
|
- style="width: 240px"
|
|
|
- @keyup.enter="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" icon="Search" @click="handleQuery"
|
|
|
- >搜索</el-button
|
|
|
- >
|
|
|
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <!-- 操作按钮 -->
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button type="primary" plain icon="Plus" @click="handleAdd"
|
|
|
- >新增</el-button
|
|
|
+ <div style="display:flex;">
|
|
|
+ <el-card style="width: 300px;margin-right: 20px">
|
|
|
+ <el-tree
|
|
|
+ ref="treeRef"
|
|
|
+ :data="treeData"
|
|
|
+ :props="{
|
|
|
+ label: 'name',
|
|
|
+ value: 'name',
|
|
|
+ children: 'childs'
|
|
|
+ }"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ ></el-tree>
|
|
|
+ </el-card>
|
|
|
+ <el-card style="width: 100%">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryRef"
|
|
|
+ :inline="true"
|
|
|
+ label-width="68px"
|
|
|
>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="success"
|
|
|
- plain
|
|
|
- icon="Edit"
|
|
|
- :disabled="single"
|
|
|
- @click="handleUpdate"
|
|
|
- >修改</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- icon="Delete"
|
|
|
- :disabled="multiple"
|
|
|
- @click="handleDelete"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <!-- 列表 -->
|
|
|
- <el-table
|
|
|
- border
|
|
|
- v-loading="loading"
|
|
|
- :data="libraryList"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- @sort-change="sortChange"
|
|
|
- >
|
|
|
- <el-table-column type="selection" width="100" align="center" />
|
|
|
- <el-table-column type="index" label="序号" width="100" align="center" />
|
|
|
- <el-table-column prop="materialName" label="素材名称" align="center" />
|
|
|
- <!-- 素材类型,0-视频、1-图片 -->
|
|
|
- <el-table-column prop="materialType" label="素材类型" align="center">
|
|
|
- <template #default="{ row }">
|
|
|
- {{ libraryType[row.materialType] }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="createTime"
|
|
|
- label="创建时间"
|
|
|
- align="center"
|
|
|
- sortable="custom"
|
|
|
- />
|
|
|
- <!-- 0=未发布,1=发布 -->
|
|
|
- <el-table-column prop="status" label="状态" align="center">
|
|
|
- <template #default="{ row }">
|
|
|
- {{ libraryStatus[row.status] }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-button type="primary" icon="Edit" link @click="handleUpdate(row)"
|
|
|
- >编辑</el-button
|
|
|
- >
|
|
|
- <el-button type="danger" icon="Delete" link @click="handleDelete(row)"
|
|
|
+ <el-form-item label="素材名称" prop="materialName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.materialName"
|
|
|
+ placeholder="请输入素材名称"
|
|
|
+ clearable
|
|
|
+ style="width: 240px"
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" plain icon="Plus" @click="handleAdd"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="Edit"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="Delete"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
>删除</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- link
|
|
|
- @click="handlepreview(row)"
|
|
|
- v-if="row.materialType == 0"
|
|
|
- >视频预览</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- link
|
|
|
- @click="handleViewPic(row)"
|
|
|
- v-if="row.materialType == 1"
|
|
|
- >图片预览</el-button
|
|
|
- >
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <pagination
|
|
|
- v-show="total > 0"
|
|
|
- :total="total"
|
|
|
- v-model:page="queryParams.pageNum"
|
|
|
- v-model:limit="queryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <!-- 列表 -->
|
|
|
+ <el-table
|
|
|
+ border
|
|
|
+ v-loading="loading"
|
|
|
+ :data="libraryList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ @sort-change="sortChange"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="100" align="center" />
|
|
|
+ <el-table-column type="index" label="序号" width="100" align="center" />
|
|
|
+ <el-table-column prop="materialName" label="素材名称" align="center" />
|
|
|
+ <!-- 素材类型,0-视频、1-图片 -->
|
|
|
+ <el-table-column prop="materialType" label="素材类型" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ libraryType[row.materialType] }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ label="创建时间"
|
|
|
+ align="center"
|
|
|
+ sortable="custom"
|
|
|
+ />
|
|
|
+ <!-- 0=未发布,1=发布 -->
|
|
|
+ <el-table-column prop="status" label="状态" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ libraryStatus[row.status] }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="primary" icon="Edit" link @click="handleUpdate(row)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button type="danger" icon="Delete" link @click="handleDelete(row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ @click="handlepreview(row)"
|
|
|
+ v-if="row.materialType == 0"
|
|
|
+ >视频预览</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ link
|
|
|
+ @click="handleViewPic(row)"
|
|
|
+ v-if="row.materialType == 1"
|
|
|
+ >图片预览</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ <!-- 查询条件 -->
|
|
|
<!-- 新增编辑素材 -->
|
|
|
<el-dialog
|
|
|
:title="dialogTitle"
|
|
@@ -129,6 +145,16 @@
|
|
|
<el-form-item label="素材名称" prop="materialName">
|
|
|
<el-input v-model="form.materialName" placeholder="请输入素材名称" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="素材分类名称">
|
|
|
+ <el-tree-select
|
|
|
+ v-model="form.materialLibraryType"
|
|
|
+ :data="treeData"
|
|
|
+ :props="{ value: 'id', label: 'name', children: 'childs' }"
|
|
|
+ value-key="id"
|
|
|
+ placeholder="选择上级素材分类"
|
|
|
+ check-strictly
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="素材类型" prop="materialType">
|
|
|
<el-select v-model="form.materialType" placeholder="请选择素材类型">
|
|
|
<el-option :value="0" label="视频" />
|
|
@@ -206,6 +232,7 @@ import {
|
|
|
libraryDelete,
|
|
|
libraryUpdate,
|
|
|
} from "@/api/interactVideo/sourceMaterialManage";
|
|
|
+import {listSourceType} from "@/api/interactVideo/sourceType.js";
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
|
const loading = ref(false);
|
|
@@ -226,10 +253,12 @@ const data = reactive({
|
|
|
form: {
|
|
|
materialName: undefined,
|
|
|
materialType: undefined,
|
|
|
+ materialLibraryType: undefined,
|
|
|
fileList: [],
|
|
|
},
|
|
|
queryParams: {
|
|
|
orderByColumn: "m.create_time",
|
|
|
+ materialLibraryType: undefined,
|
|
|
isAsc: "desc",
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
@@ -292,6 +321,7 @@ function handleQuery() {
|
|
|
/** 重置按钮操作 */
|
|
|
function resetQuery() {
|
|
|
proxy.resetForm("queryRef");
|
|
|
+ queryParams.value.materialLibraryType = undefined
|
|
|
handleQuery();
|
|
|
}
|
|
|
/** 删除按钮操作 */
|
|
@@ -345,9 +375,10 @@ function dialogSubmit() {
|
|
|
proxy.$refs["dataForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
confirmLoading.value = true;
|
|
|
- const { materialName, materialType, fileList = [] } = form.value;
|
|
|
+ const { materialName, materialType, fileList = [], materialLibraryType } = form.value;
|
|
|
formData.append("materialName", materialName);
|
|
|
formData.append("materialType", materialType);
|
|
|
+ formData.append("materialLibraryType", materialLibraryType);
|
|
|
fileList.forEach((file) => {
|
|
|
file.raw && formData.append("file", file.raw || "");
|
|
|
});
|
|
@@ -426,4 +457,21 @@ function handleViewPic(row) {
|
|
|
imgUrl.value = import.meta.env.VITE_APP_BASE_API + row.url;
|
|
|
picViewOpen.value = true;
|
|
|
}
|
|
|
+
|
|
|
+// 树形列表
|
|
|
+const treeRef = ref()
|
|
|
+const treeData = ref([])
|
|
|
+/** 查询素材分类列表 */
|
|
|
+function getTreeList() {
|
|
|
+ loading.value = true;
|
|
|
+ listSourceType(queryParams.value).then(response => {
|
|
|
+ treeData.value = response.data;
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+}
|
|
|
+const handleNodeClick = (data) => {
|
|
|
+ queryParams.value.materialLibraryType = data.id
|
|
|
+ getList()
|
|
|
+}
|
|
|
+getTreeList()
|
|
|
</script>
|