|
@@ -66,6 +66,16 @@
|
|
|
v-hasPermi="['course:videoResource:batchAdd']"
|
|
|
>批量新增</el-button>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleBatchUpdate"
|
|
|
+ v-hasPermi="['course:videoResource:batchUpdateClass']"
|
|
|
+ >批量修改分类</el-button>
|
|
|
+ </el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="danger"
|
|
@@ -340,6 +350,37 @@
|
|
|
<video ref="up-video" id="video" width="100%" height="400px" controls :src="videoPreviewUrl" />
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!--批量修改弹框-->
|
|
|
+ <minimizable-dialog :title="'批量修改'" :visible.sync="batchUpdateVisible" width="700px" append-to-body :before-close="cancel"
|
|
|
+ @minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
|
|
|
+ <el-form ref="form" :model="batchUpdateForm" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="分类" prop="typeId">
|
|
|
+ <el-select v-model="batchUpdateForm.typeId" placeholder="请选择分类" style="width: 100%" @change="val => changeCateType(val, 2)">
|
|
|
+ <el-option
|
|
|
+ v-for="item in rootTypeList"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="子分类" prop="typeSubId">
|
|
|
+ <el-select v-model="batchUpdateForm.typeSubId" clearable placeholder="请选择子分类" style="width: 100%">
|
|
|
+ <el-option
|
|
|
+ v-for="item in subTypeList"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button @click="cancelBatch">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitBatchUpdate">保 存</el-button>
|
|
|
+ </div>
|
|
|
+ </minimizable-dialog>
|
|
|
<!-- 批量选择视频弹窗 -->
|
|
|
<minimizable-dialog :title="'选择视频'" :visible.sync="batchAddVisible" width="1200px" append-to-body class="batch-dialog" :close-on-click-modal="false" :before-close="cancelBeforeBatch"
|
|
|
@minimize="hasMinimizableDialog = true" @restore="hasMinimizableDialog = false">
|
|
@@ -720,7 +761,8 @@ import {
|
|
|
getVideoResource,
|
|
|
listVideoResource,
|
|
|
updateVideoResource,
|
|
|
- batchAddVideoResource
|
|
|
+ batchAddVideoResource,
|
|
|
+ batchUpdateVideoResource
|
|
|
} from '@/api/course/videoResource'
|
|
|
import {listUserCourseCategory,getCatePidList,getCateListByPid} from '@/api/course/userCourseCategory'
|
|
|
import {getByIds, listCourseQuestionBank} from '@/api/course/courseQuestionBank'
|
|
@@ -828,6 +870,15 @@ export default {
|
|
|
batchLoading: false,
|
|
|
videoList: [],
|
|
|
|
|
|
+ // 批量修改相关
|
|
|
+ batchUpdateVisible: false,
|
|
|
+ batchUpdateLoading: false,
|
|
|
+ batchUpdateForm: {
|
|
|
+ typeId: null,
|
|
|
+ typeSubId: null,
|
|
|
+ ids: [],
|
|
|
+ },
|
|
|
+
|
|
|
// 批量上传相关
|
|
|
showUpload: false,
|
|
|
batchUploadForm: {
|
|
@@ -1383,6 +1434,17 @@ export default {
|
|
|
this.batchAddVisible = true;
|
|
|
this.videoList = []; // 清空之前的视频列表
|
|
|
},
|
|
|
+ /** 批量修改 */
|
|
|
+ handleBatchUpdate(){
|
|
|
+ if (this.ids.length === 0) {
|
|
|
+ this.$message.warning("请至少选择一条数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.batchUpdateForm.typeId = null;
|
|
|
+ this.batchUpdateForm.typeSubId = null;
|
|
|
+ this.batchUpdateForm.ids = this.ids; // 将选中的ID传递给批量修改表单
|
|
|
+ this.batchUpdateVisible = true;
|
|
|
+ },
|
|
|
cancelBeforeBatch(done, cancel) {
|
|
|
if (!this.videoList || this.videoList.length === 0) {
|
|
|
done()
|
|
@@ -1414,6 +1476,35 @@ export default {
|
|
|
}).catch(() => {
|
|
|
});
|
|
|
},
|
|
|
+ /** 批量修改 */
|
|
|
+ submitBatchUpdate() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.batchUpdateForm.ids.length === 0) {
|
|
|
+ this.$message.warning("未选择任何数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm('是否确认修改视频素材库编号为"' + this.batchUpdateForm.ids.join(',') + '"的数据项?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ // 构造正确的参数格式
|
|
|
+ const params = new URLSearchParams();
|
|
|
+ params.append('typeId', this.batchUpdateForm.typeId || '');
|
|
|
+ params.append('typeSubId', this.batchUpdateForm.typeSubId || '');
|
|
|
+ params.append('ids', this.batchUpdateForm.ids.join(','));
|
|
|
+
|
|
|
+ return batchUpdateVideoResource(params);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.batchUpdateVisible = false;
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
/** 提交批量添加 */
|
|
|
submitBatchAdd() {
|