|
@@ -101,6 +101,9 @@
|
|
|
<el-button size="small" type="primary">批量上传</el-button>
|
|
<el-button size="small" type="primary">批量上传</el-button>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
+ <el-col :span="2" style="text-align: right;">
|
|
|
|
|
+ <el-button size="small" type="danger" class="el-icon-delete" @click="BatchHandleDeleteMaterial">批量刪除</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-loading="materialTableLoading">
|
|
<div v-loading="materialTableLoading">
|
|
@@ -217,7 +220,8 @@ export default {
|
|
|
},
|
|
},
|
|
|
materialTableLoading: false,
|
|
materialTableLoading: false,
|
|
|
selectedMaterials: [],
|
|
selectedMaterials: [],
|
|
|
- materialUploadResultNumber: 0
|
|
|
|
|
|
|
+ materialUploadResultNumber: 0,
|
|
|
|
|
+ selectedMaterialIds: [],
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
@@ -244,6 +248,17 @@ export default {
|
|
|
},
|
|
},
|
|
|
deep: true,
|
|
deep: true,
|
|
|
immediate: true
|
|
immediate: true
|
|
|
|
|
+ },
|
|
|
|
|
+ // 监听selectedMaterials变化,自动同步id
|
|
|
|
|
+ selectedMaterials: {
|
|
|
|
|
+ handler(newUrls) {
|
|
|
|
|
+ // 根据选中的url找到对应的id
|
|
|
|
|
+ this.selectedMaterialIds = this.materialList
|
|
|
|
|
+ .filter(item => newUrls.includes(item.url))
|
|
|
|
|
+ .map(item => item.materialId);
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ deep: true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -533,7 +548,27 @@ export default {
|
|
|
this.$emit("input", this.listToString(this.fileList));
|
|
this.$emit("input", this.listToString(this.fileList));
|
|
|
this.materialDialogVisible = false;
|
|
this.materialDialogVisible = false;
|
|
|
this.selectedMaterials = [];
|
|
this.selectedMaterials = [];
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ BatchHandleDeleteMaterial(){
|
|
|
|
|
+ if (this.selectedMaterialIds.length === 0) {
|
|
|
|
|
+ this.$message.warning('请选择要删除的材料');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$confirm('是否确认删除该素材?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ delMaterial(this.selectedMaterialIds).then(response => {
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.$message.success("成功");
|
|
|
|
|
+ this.getMaterialList();
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ this.$message.error('失败:' + (error.message || '未知错误'));
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|