diff --git a/src/views/system/motionPrescriptionLibrary/index.vue b/src/views/system/motionPrescriptionLibrary/index.vue index 38239af..8149ffd 100644 --- a/src/views/system/motionPrescriptionLibrary/index.vue +++ b/src/views/system/motionPrescriptionLibrary/index.vue @@ -35,16 +35,8 @@ /> - 搜索 - 重置 + 搜索 + 重置 @@ -56,8 +48,7 @@ size="mini" @click="handleAdd" v-hasPermi="['system:motionPrescriptionLibrary:add']" - >新增 + >新增 修改 + >修改 删除 + >删除 - + - - - + + + - - + + - + @@ -193,13 +149,7 @@ /> - + - + - + - + - + - + - + - +
@@ -353,7 +271,7 @@ import { getPrescriptionVideoInfo, confirmUploadVideo, deletePrescriptionVideo, - prescriptionVideoUpload, + prescriptionVideoUpload } from "@/api/system/motionPrescriptionLibrary"; import { getToken } from "@/utils/auth"; import baseurl from "@/api/baseurl"; @@ -398,7 +316,7 @@ export default { motionCapacity: null, advancedTime: null, advancedScheme: null, - prescriptionVideoUrl: null, + prescriptionVideoUrl: null }, // 表单参数 form: {}, @@ -417,12 +335,12 @@ export default { // 设置上传的请求头部 headers: { Authorization: "Bearer " + getToken() }, data: { - motionPrescriptionId: null, + motionPrescriptionId: null }, // 上传的地址 url: process.env.VUE_APP_BASE_API + - "/system/motionPrescriptionLibrary/uploadMotionPrescriptionVideo", + "/system/motionPrescriptionLibrary/uploadMotionPrescriptionVideo" }, // 表单校验 rules: { @@ -430,75 +348,75 @@ export default { { required: true, message: "请输入身体素质名称", - trigger: "blur", - }, + trigger: "blur" + } ], degreeStartFraction: [ { required: true, message: "请输入运动程度开始值", - trigger: "blur", - }, + trigger: "blur" + } ], degreeEndFraction: [ { required: true, message: "请输入运动程度结束值", - trigger: "blur", - }, + trigger: "blur" + } ], motionType: [ { required: true, message: "请输入运动类型", - trigger: "blur", - }, + trigger: "blur" + } ], motionFrequency: [ { required: true, message: "请输入运动频率", - trigger: "blur", - }, + trigger: "blur" + } ], motionStrength: [ { required: true, message: "请输入运动强度", - trigger: "blur", - }, + trigger: "blur" + } ], motionTime: [ { required: true, message: "请输入运动时间", - trigger: "blur", - }, + trigger: "blur" + } ], motionCapacity: [ { required: true, message: "请输入运动量", - trigger: "blur", - }, + trigger: "blur" + } ], advancedTime: [ { required: true, message: "请输入进阶时间", - trigger: "blur", - }, + trigger: "blur" + } ], advancedScheme: [ { required: true, message: "请输入进阶方案", - trigger: "blur", - }, - ], + trigger: "blur" + } + ] }, - fileList: [], + fileList: [] }; }, created() { @@ -509,7 +427,7 @@ export default { /** 查询运动处方库数据列表 */ getList() { this.loading = true; - listMotionPrescriptionLibrary(this.queryParams).then((response) => { + listMotionPrescriptionLibrary(this.queryParams).then(response => { this.motionPrescriptionLibraryList = response.rows; this.total = response.total; this.loading = false; @@ -538,7 +456,7 @@ export default { createBy: null, createTime: null, updateBy: null, - updateTime: null, + updateTime: null }; this.resetForm("form"); }, @@ -554,7 +472,7 @@ export default { }, // 多选框选中数据 handleSelectionChange(selection) { - this.ids = selection.map((item) => item.id); + this.ids = selection.map(item => item.id); this.single = selection.length !== 1; this.multiple = !selection.length; }, @@ -568,7 +486,7 @@ export default { handleUpdate(row) { this.reset(); const id = row.id || this.ids; - getMotionPrescriptionLibrary(id).then((response) => { + getMotionPrescriptionLibrary(id).then(response => { this.form = response.data; this.open = true; this.title = "修改运动处方数据"; @@ -576,16 +494,16 @@ export default { }, /** 提交按钮 */ submitForm() { - this.$refs["form"].validate((valid) => { + this.$refs["form"].validate(valid => { if (valid) { if (this.form.id != null) { - updateMotionPrescriptionLibrary(this.form).then((response) => { + updateMotionPrescriptionLibrary(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); }); } else { - addMotionPrescriptionLibrary(this.form).then((response) => { + addMotionPrescriptionLibrary(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); @@ -599,7 +517,7 @@ export default { const ids = row.id || this.ids; this.$modal .confirm("是否确认删除?") - .then(function () { + .then(function() { return delMotionPrescriptionLibrary(ids); }) .then(() => { @@ -613,15 +531,15 @@ export default { this.download( "system/motionPrescriptionLibrary/export", { - ...this.queryParams, + ...this.queryParams }, `motionPrescriptionLibrary_${new Date().getTime()}.xlsx` ); }, uploadhandle(e) { this.lookvideolist = []; - getPrescriptionVideoInfo(e.id).then((res) => { - res.data.forEach((e) => { + getPrescriptionVideoInfo(e.id).then(res => { + res.data.forEach(e => { e.prescriptionVideoUrl = baseurl + e.prescriptionVideoUrl; this.lookvideolist.push(e.prescriptionVideoUrl); }); @@ -633,18 +551,16 @@ export default { this.videourl = []; this.fileList = []; this.upload.data.motionPrescriptionId = e.id; - prescriptionVideoUpload(e.id).then((res) => { + prescriptionVideoUpload(e.id).then(res => { if ( res.data.prescriptionVideoUrlList && res.data.prescriptionVideoUrlList.length > 0 ) { - res.data.prescriptionVideoUrlList.forEach((e) => { - var arr = e.split("/"); + res.data.prescriptionVideoUrlList.forEach(el => { + var arr = el.prescriptionVideoUrl.split("/"); var obj = { name: arr[4], - response: { - prescriptionVideoUrl: e, - }, + response: el }; this.fileList.push(obj); }); @@ -663,7 +579,7 @@ export default { // deletePrescriptionVideo(file.response.prescriptionVideoUrl).then(res => { // this.$modal.msgSuccess("删除视频成功"); // }); - this.fileList = this.fileList.filter((e) => e != file); + this.fileList = this.fileList.filter(e => e != file); }, // 文件上传成功处理 handleFileSuccess(response, file, fileList) { @@ -680,20 +596,20 @@ export default { }, // 提交上传文件 submitFileForm() { - this.fileList.forEach((e) => { - this.videourl.push(e.response.prescriptionVideoUrl); + this.fileList.forEach(e => { + this.videourl.push(e.response); }); var obj = { motionPrescriptionId: this.upload.data.motionPrescriptionId, - prescriptionVideoUrlList: this.videourl, + prescriptionVideoUrlList: this.videourl }; - confirmUploadVideo(obj).then((res) => { + confirmUploadVideo(obj).then(res => { this.upload.open = false; this.$modal.msgSuccess("上传视频成功"); this.getList(); }); - }, - }, + } + } };