|
@@ -30,7 +30,7 @@
|
|
|
</el-popconfirm>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <el-table @selection-change="selectionChange" :data="tableData" style="width: 100%">
|
|
|
+ <el-table @selection-change="selectionChange" ref="table" :data="tableData" style="width: 100%">
|
|
|
<el-table-column type="selection" width="55" v-if="query != -1" />
|
|
|
<el-table-column prop="stuffName" label="名称">
|
|
|
<template #default="scope">
|
|
@@ -188,6 +188,7 @@ import type {
|
|
|
ISourceMaterialProps,
|
|
|
SourceMaterialItem,
|
|
|
} from '@/types/SourceMaterial'
|
|
|
+import type { ElTable } from 'element-plus'
|
|
|
import { formatDateSite, getStatus } from '@/tool/index'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { ElMessage } from 'element-plus'
|
|
@@ -200,7 +201,7 @@ import {
|
|
|
updateMaterialStatus,
|
|
|
addMaterial,
|
|
|
} from '@/api/index'
|
|
|
-import { ref, reactive } from 'vue'
|
|
|
+import { ref, reactive, nextTick } from 'vue'
|
|
|
|
|
|
import MediaComponents from '@/components/mediaComponents.vue'
|
|
|
// vue3 获取url参数
|
|
@@ -217,8 +218,10 @@ const rules = reactive<FormRules<ISourceMaterialProps>>({
|
|
|
height: [{ required: true, message: '请输入高', trigger: 'change' }],
|
|
|
})
|
|
|
const dialogVideo = ref(false)
|
|
|
+const table = ref<InstanceType<typeof ElTable> | null>(null)
|
|
|
const dialogVideoUrl = ref('')
|
|
|
const originalityList = ref<OriginalityList>([])
|
|
|
+const selectObj: SourceMaterialItem[] = []
|
|
|
getOriginalityList({
|
|
|
pageNum: 1,
|
|
|
pageSize: 999999,
|
|
@@ -259,11 +262,18 @@ const onSubmit = () => {
|
|
|
}).then(({ data }) => {
|
|
|
tableData.value = data.records
|
|
|
pages.total = data.total
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ for (let i = 0; i < tableData.value.length; i++) {
|
|
|
+ const v = tableData.value[i]
|
|
|
+ const index = selectObj.findIndex((o) => o.stuffId === v.stuffId)
|
|
|
+ if (v.creativeId !== query.value && index === -1) continue
|
|
|
+ table.value?.toggleRowSelection(v, undefined, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-let selectObj: SourceMaterialItem[] = []
|
|
|
-
|
|
|
const moreAdd = () => {
|
|
|
addMaterial({
|
|
|
creativeId: query.value,
|
|
@@ -277,7 +287,12 @@ const moreAdd = () => {
|
|
|
}
|
|
|
|
|
|
const selectionChange = (val: SourceMaterialItem[]) => {
|
|
|
- selectObj = val
|
|
|
+ for (let i = 0; i < val.length; i++) {
|
|
|
+ const v = val[i]
|
|
|
+ const index: number = selectObj.findIndex((o) => o.stuffId === v.stuffId)
|
|
|
+ if (index !== -1) continue
|
|
|
+ selectObj.push(v)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const creatMaterial = (formEl: FormInstance | undefined) => {
|
|
@@ -330,7 +345,6 @@ const addNewMaterial = (formEl: FormInstance | undefined) => {
|
|
|
|
|
|
const page = (val: number) => {
|
|
|
pages.pageNum = val
|
|
|
- selectObj = []
|
|
|
onSubmit()
|
|
|
}
|
|
|
|