From 5a9d792ed03def5ce90165dc3e6fd2974a50d6d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=97=AB=E6=99=93=E8=8C=B9?= <1935832701@qq.com> Date: Thu, 13 Apr 2023 11:47:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E7=9C=8B=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../motionPrescriptionLibrary/index.vue | 255 ++++++++++++------ 1 file changed, 174 insertions(+), 81 deletions(-) diff --git a/src/views/system/motionPrescriptionLibrary/index.vue b/src/views/system/motionPrescriptionLibrary/index.vue index 2865ba7..be60b6a 100644 --- a/src/views/system/motionPrescriptionLibrary/index.vue +++ b/src/views/system/motionPrescriptionLibrary/index.vue @@ -35,8 +35,16 @@ /> - 搜索 - 重置 + 搜索 + 重置 @@ -48,7 +56,8 @@ size="mini" @click="handleAdd" v-hasPermi="['system:motionPrescriptionLibrary:add']" - >新增 + >新增 修改 + >修改 删除 + >删除 - + - - - + + + - - + + - + - + - + @@ -161,31 +217,51 @@ - + - + - + - + - + @@ -196,7 +272,12 @@ - + - -
+ +
@@ -243,7 +334,9 @@
@@ -258,7 +351,7 @@ import { getPrescriptionVideoInfo, confirmUploadVideo, deletePrescriptionVideo, - prescriptionVideoUpload + prescriptionVideoUpload, } from "@/api/system/motionPrescriptionLibrary"; import { getToken } from "@/utils/auth"; import baseurl from "@/api/baseurl"; @@ -303,7 +396,7 @@ export default { motionCapacity: null, advancedTime: null, advancedScheme: null, - prescriptionVideoUrl: null + prescriptionVideoUrl: null, }, // 表单参数 form: {}, @@ -322,12 +415,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: { @@ -335,75 +428,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() { @@ -414,7 +507,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; @@ -443,7 +536,7 @@ export default { createBy: null, createTime: null, updateBy: null, - updateTime: null + updateTime: null, }; this.resetForm("form"); }, @@ -459,7 +552,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; }, @@ -473,7 +566,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 = "修改运动处方数据"; @@ -481,16 +574,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(); @@ -504,7 +597,7 @@ export default { const ids = row.id || this.ids; this.$modal .confirm("是否确认删除?") - .then(function() { + .then(function () { return delMotionPrescriptionLibrary(ids); }) .then(() => { @@ -518,15 +611,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); }); @@ -538,18 +631,18 @@ 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 => { + res.data.prescriptionVideoUrlList.forEach((e) => { var arr = e.split("/"); var obj = { name: arr[4], response: { - prescriptionVideoUrl: e - } + prescriptionVideoUrl: e, + }, }; this.fileList.push(obj); }); @@ -568,7 +661,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) { @@ -585,20 +678,20 @@ export default { }, // 提交上传文件 submitFileForm() { - this.fileList.forEach(e => { + this.fileList.forEach((e) => { this.videourl.push(e.response.prescriptionVideoUrl); }); 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(); }); - } - } + }, + }, };