|
@@ -3,25 +3,32 @@
|
|
|
<el-dialog
|
|
|
title="添加素材"
|
|
|
v-model="materialOpen"
|
|
|
- width="1200"
|
|
|
+ width="1280"
|
|
|
+ :close-on-click-modal="false"
|
|
|
append-to-body
|
|
|
destroy-on-close
|
|
|
+ :before-close="dialogCancel"
|
|
|
>
|
|
|
<el-form :model="form" ref="dataForm" label-width="110px" inline>
|
|
|
<el-row :gutter="10">
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="素材" prop="selectMaterial">
|
|
|
+ <el-col :span="14">
|
|
|
+ <el-form-item label="选择素材" prop="selectMaterial">
|
|
|
<el-radio-group v-model="form.selectMaterial">
|
|
|
<el-radio :label="1">选择已有素材</el-radio>
|
|
|
<el-radio :label="2" @click="uploadSource">上传素材</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" v-show="form.selectMaterial == 1">
|
|
|
- <el-form-item label="">
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="已选素材" prop="selectMaterial">
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="" v-show="form.selectMaterial == 1">
|
|
|
<!-- 列表 -->
|
|
|
<el-table
|
|
|
border
|
|
|
+ ref="tableRef"
|
|
|
row-key="materialId"
|
|
|
v-loading="loading"
|
|
|
:data="libraryList"
|
|
@@ -33,12 +40,12 @@
|
|
|
align="center"
|
|
|
:reserve-selection="true"
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- type="index"
|
|
|
- label="序号"
|
|
|
- width="100"
|
|
|
- align="center"
|
|
|
- />
|
|
|
+ <!-- <el-table-column
|
|
|
+ type="index"
|
|
|
+ label="序号"
|
|
|
+ width="100"
|
|
|
+ align="center"
|
|
|
+ /> -->
|
|
|
<el-table-column
|
|
|
prop="materialName"
|
|
|
label="素材名称"
|
|
@@ -55,13 +62,15 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- 0=未发布,1=发布 -->
|
|
|
- <el-table-column prop="status" label="状态" align="center">
|
|
|
- <template #default="{ row }">
|
|
|
- {{ libraryStatus[row.status] }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <!-- <el-table-column prop="status" label="状态" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ {{ libraryStatus[row.status] }}
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
</el-table>
|
|
|
<pagination
|
|
|
+ layout="total,sizes, prev, pager, next"
|
|
|
+ pager-count="5"
|
|
|
v-show="total > 0"
|
|
|
:total="total"
|
|
|
v-model:page="queryParams.pageNum"
|
|
@@ -70,16 +79,68 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col
|
|
|
+ :span="4"
|
|
|
+ style="display: flex; justify-content: center; align-items: center"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ v-show="form.selectMaterial == 1"
|
|
|
+ type="primary"
|
|
|
+ :loading="confirmLoading"
|
|
|
+ @click="dialogSubmit"
|
|
|
+ >确定选择 =></el-button
|
|
|
+ >
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="10">
|
|
|
+ <el-form-item label="" style="width: 100%">
|
|
|
+ <!-- 列表 -->
|
|
|
+ <el-table
|
|
|
+ border
|
|
|
+ row-key="materialId"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="releateList"
|
|
|
+ >
|
|
|
+ <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 label="操作" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ @click="handleDelete(row)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
+
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button
|
|
|
+ <!-- <el-button
|
|
|
type="primary"
|
|
|
:loading="confirmLoading"
|
|
|
@click="dialogSubmit"
|
|
|
>确 定</el-button
|
|
|
- >
|
|
|
+ > -->
|
|
|
<el-button :loading="confirmLoading" @click="dialogCancel"
|
|
|
>取 消</el-button
|
|
|
>
|
|
@@ -148,7 +209,9 @@
|
|
|
<script setup name="FormFields">
|
|
|
import {
|
|
|
getLibraryList,
|
|
|
+ getReleateList,
|
|
|
libraryAdd,
|
|
|
+ releateDelete,
|
|
|
} from "@/api/interactVideo/sourceMaterialManage";
|
|
|
import { updateMaterialInfo } from "@/api/interactVideo/videoManage";
|
|
|
const { proxy } = getCurrentInstance();
|
|
@@ -172,6 +235,8 @@ const materialOpen = ref(false);
|
|
|
const confirmLoading = ref(false);
|
|
|
const loading = ref(false);
|
|
|
const libraryList = ref([]);
|
|
|
+const releateList = ref([]);
|
|
|
+const releateIds = ref([]);
|
|
|
const total = ref(0);
|
|
|
const materialConfirmLoading = ref(false);
|
|
|
const addSourceOpen = ref(false);
|
|
@@ -230,6 +295,8 @@ watchEffect(() => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+const tableRef = ref();
|
|
|
+
|
|
|
// 互动视频新增并关联素材
|
|
|
function dialogSubmit() {
|
|
|
proxy.$refs["dataForm"].validate((valid) => {
|
|
@@ -239,9 +306,10 @@ function dialogSubmit() {
|
|
|
proxy.$modal.msgError("请选择素材");
|
|
|
return;
|
|
|
}
|
|
|
+ const materialIds = [...ids.value, ...releateIds.value];
|
|
|
confirmLoading.value = true;
|
|
|
const params = {
|
|
|
- materialIds: ids.value,
|
|
|
+ materialIds,
|
|
|
...props.baseInfo,
|
|
|
};
|
|
|
updateMaterialInfo(params)
|
|
@@ -249,7 +317,10 @@ function dialogSubmit() {
|
|
|
// 新增成功后拿到id跳转互动视频节点编辑
|
|
|
if (res.code == 200) {
|
|
|
proxy.$modal.msgSuccess("添加成功");
|
|
|
- dialogCancel();
|
|
|
+ // dialogCancel();
|
|
|
+ getList();
|
|
|
+ // 清除勾选
|
|
|
+ tableRef.value.clearSelection();
|
|
|
}
|
|
|
})
|
|
|
.finally(() => {
|
|
@@ -267,11 +338,28 @@ function dialogCancel() {
|
|
|
/** 查询素材列表 */
|
|
|
function getList() {
|
|
|
loading.value = true;
|
|
|
- getLibraryList(queryParams.value).then((response) => {
|
|
|
- libraryList.value = response.rows;
|
|
|
- total.value = response.total;
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
+ console.log(props.baseInfo);
|
|
|
+ const interactionId = props.baseInfo.interactionId;
|
|
|
+ queryParams.value = {
|
|
|
+ ...queryParams.value,
|
|
|
+ interactionId,
|
|
|
+ };
|
|
|
+ // 未关联的素材
|
|
|
+ getLibraryList(queryParams.value)
|
|
|
+ .then((res) => {
|
|
|
+ libraryList.value = res.rows;
|
|
|
+ total.value = res.total;
|
|
|
+ })
|
|
|
+ .finally(() => (loading.value = false));
|
|
|
+ // 已关联的素材
|
|
|
+ getReleateList(interactionId)
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ const arr = res.data.materialLibraryVOList || [];
|
|
|
+ releateList.value = arr;
|
|
|
+ releateIds.value = arr.map((item) => item.materialId);
|
|
|
+ })
|
|
|
+ .finally(() => (loading.value = false));
|
|
|
}
|
|
|
// 选中素材id
|
|
|
function handleSelectionChange(selection) {
|
|
@@ -329,4 +417,21 @@ function uploadChange(file) {
|
|
|
function uploadRemove() {
|
|
|
materialForm.value.fileList = [];
|
|
|
}
|
|
|
+
|
|
|
+// 删除
|
|
|
+function handleDelete(row) {
|
|
|
+ console.log(row);
|
|
|
+ const interactionId = props.baseInfo.interactionId;
|
|
|
+ const materialId = row.materialId;
|
|
|
+ proxy.$modal
|
|
|
+ .confirm("是否确认删除当前素材?")
|
|
|
+ .then(function () {
|
|
|
+ return releateDelete(interactionId, materialId);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ getList();
|
|
|
+ proxy.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+}
|
|
|
</script>
|