Преглед на файлове

feat: 优化:素材管理列表新增创建时间字段并支持排序;互动视频管理列表新增创建时间和备注字段并支持排序;两个模块的删除提示中的id改成名称

mnisting преди 2 месеца
родител
ревизия
ef72a1eba6

+ 8 - 0
src/api/interactVideo/sourceMaterialManage.js

@@ -2,6 +2,14 @@ import request from "@/utils/request";
 
 // 查询素材库未关联列表  /interactionVideo/noRelation/list
 export function getLibraryList(params) {
+  return request({
+    url: "/business/library/list",
+    method: "get",
+    params,
+  });
+}
+// 查询素材库未关联列表  /interactionVideo/noRelation/list
+export function getnoRelationList(params) {
   return request({
     url: "/interactionVideo/noRelation/list",
     method: "get",

+ 23 - 1
src/views/interactVideo/sourceMaterialManage/index.vue

@@ -57,6 +57,7 @@
       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" />
@@ -67,6 +68,12 @@
           {{ 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 }">
@@ -220,6 +227,8 @@ const data = reactive({
     fileList: [],
   },
   queryParams: {
+    orderByColumn: "m.create_time",
+    isAsc: "desc",
     pageNum: 1,
     pageSize: 10,
     materialName: undefined,
@@ -257,6 +266,19 @@ function getList() {
     loading.value = false;
   });
 }
+
+const sortableKeyMap = {
+  descending: "desc",
+  ascending: "asc",
+};
+
+// 排序
+function sortChange(sortData) {
+  // console.log(sortData);
+  queryParams.value.isAsc = sortableKeyMap[sortData.order];
+  getList();
+}
+
 /** 搜索按钮操作 */
 function handleQuery() {
   queryParams.value.pageNum = 1;
@@ -271,7 +293,7 @@ function resetQuery() {
 function handleDelete(row) {
   const materialIds = row.materialId || ids.value;
   proxy.$modal
-    .confirm('是否确认删除视频编号为"' + materialIds + '"的数据项?')
+    .confirm('是否确认删除素材名称为"' + row.materialName + '"的数据项?')
     .then(function () {
       return libraryDelete(materialIds);
     })

+ 6 - 5
src/views/interactVideo/videoManage/addSouce.vue

@@ -208,7 +208,7 @@
 
 <script setup name="FormFields">
 import {
-  getLibraryList,
+  getnoRelationList,
   getReleateList,
   libraryAdd,
   releateDelete,
@@ -241,7 +241,7 @@ const total = ref(0);
 const materialConfirmLoading = ref(false);
 const addSourceOpen = ref(false);
 const ids = ref([]);
-const uploadId = ref([]);
+const uploadId = ref(null);
 const data = reactive({
   form: {
     nodeType: "root-node",
@@ -306,7 +306,7 @@ function dialogSubmit() {
         proxy.$modal.msgError("请选择素材");
         return;
       }
-      const materialIds = [...ids.value, ...releateIds.value];
+      const materialIds = [...ids.value, ...releateIds.value, uploadId.value];
       confirmLoading.value = true;
       const params = {
         materialIds,
@@ -345,7 +345,7 @@ function getList() {
     interactionId,
   };
   // 未关联的素材
-  getLibraryList(queryParams.value)
+  getnoRelationList(queryParams.value)
     .then((res) => {
       libraryList.value = res.rows;
       total.value = res.total;
@@ -390,8 +390,9 @@ function sourceAdd() {
         .then((res) => {
           if (res.code == 200) {
             proxy.$modal.msgSuccess("新增成功");
-            uploadId.value.push(res.data);
+            uploadId.value = res.data;
             addSourceOpen.value = false;
+            dialogSubmit();
           }
         })
         .finally(() => {

+ 5 - 1
src/views/interactVideo/videoManage/formFields.vue

@@ -35,7 +35,11 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="备注" prop="remark">
-              <el-input v-model="form.remark" placeholder="请输入备注" />
+              <el-input
+                v-model="form.remark"
+                placeholder="请输入备注"
+                maxLength="100"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="6">

+ 26 - 2
src/views/interactVideo/videoManage/index.vue

@@ -57,10 +57,18 @@
       v-loading="loading"
       :data="videoList"
       @selection-change="handleSelectionChange"
+      @sort-change="sortChange"
     >
       <el-table-column type="selection" width="50" />
       <el-table-column type="index" label="序号" align="center" width="80" />
       <el-table-column prop="interactionName" label="视频名称" align="center" />
+      <el-table-column
+        prop="createTime"
+        label="创建时间"
+        align="center"
+        sortable="custom"
+      />
+      <el-table-column prop="remark" label="备注" align="center" />
       <el-table-column label="操作" align="center">
         <template #default="{ row }">
           <el-button type="primary" icon="Edit" link @click="handleUpdate(row)"
@@ -125,6 +133,8 @@ const multiple = ref(true);
 const materialOpen = ref(false);
 const data = reactive({
   queryParams: {
+    orderByColumn: "create_time",
+    isAsc: "desc",
     pageNum: 1,
     pageSize: 10,
     interactionName: undefined,
@@ -150,6 +160,19 @@ function getList() {
       loading.value = false;
     });
 }
+
+const sortableKeyMap = {
+  descending: "desc",
+  ascending: "asc",
+};
+
+// 排序
+function sortChange(sortData) {
+  // console.log(sortData);
+  queryParams.value.isAsc = sortableKeyMap[sortData.order];
+  getList();
+}
+
 /** 搜索按钮操作 */
 function handleQuery() {
   queryParams.value.pageNum = 1;
@@ -164,7 +187,7 @@ function resetQuery() {
 function handleDelete(row) {
   const interactionIds = row.interactionId || ids.value;
   proxy.$modal
-    .confirm('是否确认删除互动视频编号为"' + interactionIds + '"的数据项?')
+    .confirm('是否确认删除互动视频名称为"' + row.interactionName + '"的数据项?')
     .then(function () {
       return interactionVideoDel(interactionIds);
     })
@@ -200,7 +223,8 @@ function handleView(row) {
   // 获取互动视频基本信息以及节点
   getInteractionVideoDetail(row.interactionId).then((res) => {
     if (res.code == 200) {
-      if(!res.data.rootNode) return proxy.$modal.msgError("暂无可播放视频,可添加视频素材后预览");
+      if (!res.data.rootNode)
+        return proxy.$modal.msgError("暂无可播放视频,可添加视频素材后预览");
       graphData.value = transfromReturnGraphdata(res.data.rootNode);
       videoDetail.value = graphData.value;
       if (!videoDetail.value.data.uri) {