修改查看按钮

This commit is contained in:
闫晓茹 2023-04-13 11:47:45 +08:00
parent 2227ba63a4
commit 5a9d792ed0

View File

@ -35,8 +35,16 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
@ -48,7 +56,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:motionPrescriptionLibrary:add']" v-hasPermi="['system:motionPrescriptionLibrary:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -59,7 +68,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:motionPrescriptionLibrary:edit']" v-hasPermi="['system:motionPrescriptionLibrary:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -70,7 +80,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:motionPrescriptionLibrary:remove']" v-hasPermi="['system:motionPrescriptionLibrary:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
@ -82,7 +93,10 @@
v-hasPermi="['system:motionPrescriptionLibrary:export']" v-hasPermi="['system:motionPrescriptionLibrary:export']"
>导出</el-button> >导出</el-button>
</el-col>--> </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table <el-table
v-loading="loading" v-loading="loading"
@ -90,54 +104,86 @@
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="身体素质名称" align="center" prop="physicalQualityName" /> <el-table-column
<el-table-column label="运动程度开始值" align="center" prop="degreeStartFraction" /> label="身体素质名称"
<el-table-column label="运动程度结束值" align="center" prop="degreeEndFraction" /> align="center"
prop="physicalQualityName"
/>
<el-table-column
label="运动程度开始值"
align="center"
prop="degreeStartFraction"
/>
<el-table-column
label="运动程度结束值"
align="center"
prop="degreeEndFraction"
/>
<el-table-column label="运动类型" align="center" prop="motionType" /> <el-table-column label="运动类型" align="center" prop="motionType" />
<el-table-column label="运动频率" align="center" prop="motionFrequency" /> <el-table-column label="运动频率" align="center" prop="motionFrequency" />
<el-table-column label="运动强度" align="center" prop="motionStrength" /> <el-table-column label="运动强度" align="center" prop="motionStrength" />
<el-table-column label="运动时间" align="center" prop="motionTime" /> <el-table-column label="运动时间" align="center" prop="motionTime" />
<el-table-column label="运动量" align="center" prop="motionCapacity" /> <el-table-column label="运动量" align="center" prop="motionCapacity" />
<el-table-column label="进阶时间" align="center" prop="advancedTime" /> <el-table-column label="进阶时间" align="center" prop="advancedTime" />
<el-table-column label="进阶方案" align="center" prop="advancedScheme" show-overflow-tooltip /> <el-table-column
<el-table-column label="处方视频" align="center" prop="prescriptionVideoUrl"> label="进阶方案"
align="center"
prop="advancedScheme"
show-overflow-tooltip
/>
<el-table-column
label="处方视频"
align="center"
prop="prescriptionVideoUrl"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-view" icon="el-icon-view"
v-if="scope.row.prescriptionVideoFlag == 'YES'"
@click="uploadhandle(scope.row)" @click="uploadhandle(scope.row)"
v-hasPermi="['system:motionPrescriptionLibrary:getPrescriptionVideoInfo']" v-hasPermi="[
>查看</el-button> 'system:motionPrescriptionLibrary:getPrescriptionVideoInfo',
]"
>查看</el-button
>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-upload2" icon="el-icon-upload2"
@click="uploadopentrue(scope.row)" @click="uploadopentrue(scope.row)"
>上传视频</el-button> >上传视频</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:motionPrescriptionLibrary:edit']" v-hasPermi="['system:motionPrescriptionLibrary:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:motionPrescriptionLibrary:remove']" v-hasPermi="['system:motionPrescriptionLibrary:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@ -145,15 +191,25 @@
/> />
<!-- 添加或修改运动处方库数据对话框 --> <!-- 添加或修改运动处方库数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px" :inline="true"> <el-form
ref="form"
:model="form"
:rules="rules"
label-width="120px"
:inline="true"
>
<el-form-item label="身体素质名称" prop="physicalQualityName"> <el-form-item label="身体素质名称" prop="physicalQualityName">
<el-input v-model="form.physicalQualityName" placeholder="请输入身体素质名称" style="width:250px" /> <el-input
v-model="form.physicalQualityName"
placeholder="请输入身体素质名称"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="运动程度开始值" prop="degreeStartFraction"> <el-form-item label="运动程度开始值" prop="degreeStartFraction">
<el-input <el-input
v-model="form.degreeStartFraction" v-model="form.degreeStartFraction"
placeholder="请输入运动程度开始值" placeholder="请输入运动程度开始值"
style="width:250px" style="width: 250px"
oninput="value=value.replace(/[^\d]/g,'')" oninput="value=value.replace(/[^\d]/g,'')"
/> />
</el-form-item> </el-form-item>
@ -161,31 +217,51 @@
<el-input <el-input
v-model="form.degreeEndFraction" v-model="form.degreeEndFraction"
placeholder="请输入运动程度结束值" placeholder="请输入运动程度结束值"
style="width:250px" style="width: 250px"
oninput="value=value.replace(/[^\d]/g,'')" oninput="value=value.replace(/[^\d]/g,'')"
/> />
</el-form-item> </el-form-item>
<el-form-item label="运动频率" prop="motionFrequency"> <el-form-item label="运动频率" prop="motionFrequency">
<el-input v-model="form.motionFrequency" placeholder="请输入运动频率" style="width:250px" /> <el-input
v-model="form.motionFrequency"
placeholder="请输入运动频率"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="运动强度" prop="motionStrength"> <el-form-item label="运动强度" prop="motionStrength">
<el-input v-model="form.motionStrength" placeholder="请输入运动强度" style="width:250px" /> <el-input
v-model="form.motionStrength"
placeholder="请输入运动强度"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="运动时间" prop="motionTime"> <el-form-item label="运动时间" prop="motionTime">
<el-input v-model="form.motionTime" placeholder="请输入运动时间" style="width:250px" /> <el-input
v-model="form.motionTime"
placeholder="请输入运动时间"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="运动量" prop="motionCapacity"> <el-form-item label="运动量" prop="motionCapacity">
<el-input v-model="form.motionCapacity" placeholder="请输入运动量" style="width:250px" /> <el-input
v-model="form.motionCapacity"
placeholder="请输入运动量"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="进阶时间" prop="advancedTime"> <el-form-item label="进阶时间" prop="advancedTime">
<el-input v-model="form.advancedTime" placeholder="请输入进阶时间" style="width:250px" /> <el-input
v-model="form.advancedTime"
placeholder="请输入进阶时间"
style="width: 250px"
/>
</el-form-item> </el-form-item>
<el-form-item label="进阶方案" prop="advancedScheme"> <el-form-item label="进阶方案" prop="advancedScheme">
<el-input <el-input
v-model="form.advancedScheme" v-model="form.advancedScheme"
type="textarea" type="textarea"
placeholder="请输入内容" placeholder="请输入内容"
style="width:500px" style="width: 500px"
:rows="7" :rows="7"
/> />
</el-form-item> </el-form-item>
@ -196,7 +272,12 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- // --> <!-- // -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> <el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<!-- <video <!-- <video
v-if="videourl" v-if="videourl"
:src="baseurl+videourl" :src="baseurl+videourl"
@ -229,13 +310,23 @@
</el-dialog> </el-dialog>
<!-- 查看视频 --> <!-- 查看视频 -->
<el-dialog title="查看" :visible.sync="lookvideoshow" width="1200px" append-to-body> <el-dialog
<div v-if="lookvideolist.length>0"> title="查看"
:visible.sync="lookvideoshow"
width="1200px"
append-to-body
>
<div v-if="lookvideolist.length > 0">
<video <video
v-for="(item,index) in lookvideolist" v-for="(item, index) in lookvideolist"
:key="index" :key="index"
:src="item" :src="item"
style="width:350px;height:200px;display: inline-block;margin:0 30px 30px 0" style="
width: 350px;
height: 200px;
display: inline-block;
margin: 0 30px 30px 0;
"
controls="controls" controls="controls"
></video> ></video>
</div> </div>
@ -243,7 +334,9 @@
<el-empty description="暂无视频"></el-empty> <el-empty description="暂无视频"></el-empty>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="lookvideoshow = false"> </el-button> <el-button type="primary" @click="lookvideoshow = false"
> </el-button
>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -258,7 +351,7 @@ import {
getPrescriptionVideoInfo, getPrescriptionVideoInfo,
confirmUploadVideo, confirmUploadVideo,
deletePrescriptionVideo, deletePrescriptionVideo,
prescriptionVideoUpload prescriptionVideoUpload,
} from "@/api/system/motionPrescriptionLibrary"; } from "@/api/system/motionPrescriptionLibrary";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import baseurl from "@/api/baseurl"; import baseurl from "@/api/baseurl";
@ -303,7 +396,7 @@ export default {
motionCapacity: null, motionCapacity: null,
advancedTime: null, advancedTime: null,
advancedScheme: null, advancedScheme: null,
prescriptionVideoUrl: null prescriptionVideoUrl: null,
}, },
// //
form: {}, form: {},
@ -322,12 +415,12 @@ export default {
// //
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: "Bearer " + getToken() },
data: { data: {
motionPrescriptionId: null motionPrescriptionId: null,
}, },
// //
url: url:
process.env.VUE_APP_BASE_API + process.env.VUE_APP_BASE_API +
"/system/motionPrescriptionLibrary/uploadMotionPrescriptionVideo" "/system/motionPrescriptionLibrary/uploadMotionPrescriptionVideo",
}, },
// //
rules: { rules: {
@ -335,75 +428,75 @@ export default {
{ {
required: true, required: true,
message: "请输入身体素质名称", message: "请输入身体素质名称",
trigger: "blur" trigger: "blur",
} },
], ],
degreeStartFraction: [ degreeStartFraction: [
{ {
required: true, required: true,
message: "请输入运动程度开始值", message: "请输入运动程度开始值",
trigger: "blur" trigger: "blur",
} },
], ],
degreeEndFraction: [ degreeEndFraction: [
{ {
required: true, required: true,
message: "请输入运动程度结束值", message: "请输入运动程度结束值",
trigger: "blur" trigger: "blur",
} },
], ],
motionType: [ motionType: [
{ {
required: true, required: true,
message: "请输入运动类型", message: "请输入运动类型",
trigger: "blur" trigger: "blur",
} },
], ],
motionFrequency: [ motionFrequency: [
{ {
required: true, required: true,
message: "请输入运动频率", message: "请输入运动频率",
trigger: "blur" trigger: "blur",
} },
], ],
motionStrength: [ motionStrength: [
{ {
required: true, required: true,
message: "请输入运动强度", message: "请输入运动强度",
trigger: "blur" trigger: "blur",
} },
], ],
motionTime: [ motionTime: [
{ {
required: true, required: true,
message: "请输入运动时间", message: "请输入运动时间",
trigger: "blur" trigger: "blur",
} },
], ],
motionCapacity: [ motionCapacity: [
{ {
required: true, required: true,
message: "请输入运动量", message: "请输入运动量",
trigger: "blur" trigger: "blur",
} },
], ],
advancedTime: [ advancedTime: [
{ {
required: true, required: true,
message: "请输入进阶时间", message: "请输入进阶时间",
trigger: "blur" trigger: "blur",
} },
], ],
advancedScheme: [ advancedScheme: [
{ {
required: true, required: true,
message: "请输入进阶方案", message: "请输入进阶方案",
trigger: "blur" trigger: "blur",
} },
] ],
}, },
fileList: [] fileList: [],
}; };
}, },
created() { created() {
@ -414,7 +507,7 @@ export default {
/** 查询运动处方库数据列表 */ /** 查询运动处方库数据列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listMotionPrescriptionLibrary(this.queryParams).then(response => { listMotionPrescriptionLibrary(this.queryParams).then((response) => {
this.motionPrescriptionLibraryList = response.rows; this.motionPrescriptionLibraryList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -443,7 +536,7 @@ export default {
createBy: null, createBy: null,
createTime: null, createTime: null,
updateBy: null, updateBy: null,
updateTime: null updateTime: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@ -459,7 +552,7 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id); this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
@ -473,7 +566,7 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids; const id = row.id || this.ids;
getMotionPrescriptionLibrary(id).then(response => { getMotionPrescriptionLibrary(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改运动处方数据"; this.title = "修改运动处方数据";
@ -481,16 +574,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateMotionPrescriptionLibrary(this.form).then(response => { updateMotionPrescriptionLibrary(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addMotionPrescriptionLibrary(this.form).then(response => { addMotionPrescriptionLibrary(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -504,7 +597,7 @@ export default {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm("是否确认删除?") .confirm("是否确认删除?")
.then(function() { .then(function () {
return delMotionPrescriptionLibrary(ids); return delMotionPrescriptionLibrary(ids);
}) })
.then(() => { .then(() => {
@ -518,15 +611,15 @@ export default {
this.download( this.download(
"system/motionPrescriptionLibrary/export", "system/motionPrescriptionLibrary/export",
{ {
...this.queryParams ...this.queryParams,
}, },
`motionPrescriptionLibrary_${new Date().getTime()}.xlsx` `motionPrescriptionLibrary_${new Date().getTime()}.xlsx`
); );
}, },
uploadhandle(e) { uploadhandle(e) {
this.lookvideolist = []; this.lookvideolist = [];
getPrescriptionVideoInfo(e.id).then(res => { getPrescriptionVideoInfo(e.id).then((res) => {
res.data.forEach(e => { res.data.forEach((e) => {
e.prescriptionVideoUrl = baseurl + e.prescriptionVideoUrl; e.prescriptionVideoUrl = baseurl + e.prescriptionVideoUrl;
this.lookvideolist.push(e.prescriptionVideoUrl); this.lookvideolist.push(e.prescriptionVideoUrl);
}); });
@ -538,18 +631,18 @@ export default {
this.videourl = []; this.videourl = [];
this.fileList = []; this.fileList = [];
this.upload.data.motionPrescriptionId = e.id; this.upload.data.motionPrescriptionId = e.id;
prescriptionVideoUpload(e.id).then(res => { prescriptionVideoUpload(e.id).then((res) => {
if ( if (
res.data.prescriptionVideoUrlList && res.data.prescriptionVideoUrlList &&
res.data.prescriptionVideoUrlList.length > 0 res.data.prescriptionVideoUrlList.length > 0
) { ) {
res.data.prescriptionVideoUrlList.forEach(e => { res.data.prescriptionVideoUrlList.forEach((e) => {
var arr = e.split("/"); var arr = e.split("/");
var obj = { var obj = {
name: arr[4], name: arr[4],
response: { response: {
prescriptionVideoUrl: e prescriptionVideoUrl: e,
} },
}; };
this.fileList.push(obj); this.fileList.push(obj);
}); });
@ -568,7 +661,7 @@ export default {
// deletePrescriptionVideo(file.response.prescriptionVideoUrl).then(res => { // deletePrescriptionVideo(file.response.prescriptionVideoUrl).then(res => {
// this.$modal.msgSuccess(""); // this.$modal.msgSuccess("");
// }); // });
this.fileList = this.fileList.filter(e => e != file); this.fileList = this.fileList.filter((e) => e != file);
}, },
// //
handleFileSuccess(response, file, fileList) { handleFileSuccess(response, file, fileList) {
@ -585,20 +678,20 @@ export default {
}, },
// //
submitFileForm() { submitFileForm() {
this.fileList.forEach(e => { this.fileList.forEach((e) => {
this.videourl.push(e.response.prescriptionVideoUrl); this.videourl.push(e.response.prescriptionVideoUrl);
}); });
var obj = { var obj = {
motionPrescriptionId: this.upload.data.motionPrescriptionId, motionPrescriptionId: this.upload.data.motionPrescriptionId,
prescriptionVideoUrlList: this.videourl prescriptionVideoUrlList: this.videourl,
}; };
confirmUploadVideo(obj).then(res => { confirmUploadVideo(obj).then((res) => {
this.upload.open = false; this.upload.open = false;
this.$modal.msgSuccess("上传视频成功"); this.$modal.msgSuccess("上传视频成功");
this.getList(); this.getList();
}); });
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>