This commit is contained in:
熊丽君
2021-12-30 17:36:28 +08:00
parent 3e8684cb8d
commit 20834b71b7
9 changed files with 1304 additions and 1037 deletions

View File

@ -1,181 +1,203 @@
<template>
<div>
<el-row :gutter="20">
<!--用户数据-->
<el-col :span="24" :xs="24">
<el-row :gutter="10" class="mb8 fr">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
</el-row>
<div>
<el-row :gutter="20">
<!--用户数据-->
<el-col :span="24" :xs="24">
<el-row :gutter="10" class="mb8 fr">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
</el-row>
<el-table v-loading="loading" :data="userList">
<el-table-column label="序号" align="center" prop="id" width="80" />
<el-table-column label="大图类型" align="center" prop="type" >
<el-table v-loading="loading" :data="userList">
<el-table-column label="序号" align="center" prop="id" width="80" />
<el-table-column label="大图类型" align="center" prop="type">
<template slot-scope="scope">
<div v-if="scope.row.type=='1'">
危险点图
</div>
<div v-if="scope.row.type=='2'">
工房图
</div>
<div v-if="scope.row.type == '1'">危险点图</div>
<div v-if="scope.row.type == '2'">工房图</div>
</template>
</el-table-column>
<el-table-column label="大图地址" align="center" prop="pic" >
<el-table-column label="大图地址" align="center" prop="pic">
<template slot-scope="scope">
<el-image style="width: 100px; height: 100px" fit="cover" :src="scope.row.pic"></el-image>
<el-image
style="width: 100px; height: 100px"
fit="cover"
:src="scope.row.pic"
></el-image>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:autoScroll="false"
:pageSizes="[2, 5, 10, 20]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<pagination
v-show="total > 0"
:total="total"
:autoScroll="false"
:pageSizes="[2, 5, 10, 20]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="大图类型">
<el-radio v-model="form.type" label="1">危险点图</el-radio>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="大图类型">
<el-radio v-model="form.type" label="1">危险点图</el-radio>
<el-radio v-model="form.type" label="2">工房图</el-radio>
</el-form-item>
</el-col>
<el-col :span="12">
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="大图" prop="pic">
<ImageUpload v-model="form.pic" :isShowTip="false" :limit="1" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
<ImageUpload v-model="form.pic" :isShowTip="false" :limit="1" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { centerTwoList, delVideo, addVideo, editVideo } from './indexApi'
import { getToken } from '@/utils/auth'
import { centerTwoList, delVideo, addVideo, editVideo } from "./indexApi";
import { getToken } from "@/utils/auth";
export default {
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: this.page_size,
},
// 表单校验
rules: {
pic: [{ required: true, message: '请上传大图', trigger: 'blur' }],
},
}
},
created() {
this.getList()
},
methods: {
/** 查询列表 */
getList() {
this.loading = true
centerTwoList(this.queryParams).then(response => {
this.userList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: undefined,
type: '1',
videoName: undefined,
remark: undefined,
}
this.resetForm('form')
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
this.form = Object.assign({}, row)
this.form.videoFileName='http://192.168.0.115:1818/' + this.form.videoFileName
this.open = true
this.title = '修改装药量概况'
},
/** 提交按钮 */
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
editVideo(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addVideo(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row.id + '"的数据项?')
.then(function () {
return delVideo({hxBigPicId:row.id})
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {})
},
},
}
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: this.page_size,
},
// 表单校验
rules: {
pic: [{ required: true, message: "请上传大图", trigger: "blur" }],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
centerTwoList(this.queryParams).then((response) => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined,
type: "1",
videoName: undefined,
remark: undefined,
};
this.resetForm("form");
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign({}, row);
this.open = true;
this.title = "修改装药量概况";
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
editVideo(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addVideo(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row.id + '"的数据项?')
.then(function () {
return delVideo({ hxBigPicId: row.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,186 +1,226 @@
<template>
<div>
<el-row :gutter="20">
<!--用户数据-->
<el-col :span="24" :xs="24">
<el-row :gutter="10" class="mb8 fr">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
</el-row>
<div>
<el-row :gutter="20">
<!--用户数据-->
<el-col :span="24" :xs="24">
<el-row :gutter="10" class="mb8 fr">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
</el-row>
<el-table v-loading="loading" :data="userList">
<el-table-column label="序号" align="center" prop="id" width="80" />
<el-table-column label="视频类型" align="center" prop="category" >
<el-table v-loading="loading" :data="userList">
<el-table-column label="序号" align="center" prop="id" width="80" />
<el-table-column label="视频类型" align="center" prop="category">
<template slot-scope="scope">
<div v-if="scope.row.category=='1'">
奖惩播放
</div>
<div v-if="scope.row.category=='2'">
典型案例播放
</div>
<div v-if="scope.row.category == '1'">奖惩播放</div>
<div v-if="scope.row.category == '2'">典型案例播放</div>
</template>
</el-table-column>
<el-table-column label="视频名称" align="center" prop="videoName" />
<el-table-column label="视频地址" align="center" prop="videoFileName" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-table-column label="视频名称" align="center" prop="videoName" />
<el-table-column
label="视频地址"
align="center"
prop="videoFileName"
/>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:autoScroll="false"
:pageSizes="[2, 5, 10, 20]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<pagination
v-show="total > 0"
:total="total"
:autoScroll="false"
:pageSizes="[2, 5, 10, 20]"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="视频类型" prop="category">
<el-radio v-model="form.category" label="1">奖惩播放</el-radio>
<el-radio v-model="form.category" label="2">典型案例播放</el-radio>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="视频名称" prop="videoName">
<el-input v-model="form.videoName" placeholder="请输入视频名称" />
</el-form-item>
</el-col>
</el-row>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="40%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="视频类型" prop="category">
<el-radio v-model="form.category" label="1">奖惩播放</el-radio>
<el-radio v-model="form.category" label="2"
>典型案例播放</el-radio
>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="视频名称" prop="videoName">
<el-input v-model="form.videoName" placeholder="请输入视频名称" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" :autosize="{ minRows: 2, maxRows: 6}" placeholder="备注" />
</el-form-item>
<el-input
v-model="form.remark"
type="textarea"
:autosize="{ minRows: 2, maxRows: 6 }"
placeholder="备注"
/>
</el-form-item>
<el-form-item label="视频" prop="videoFileName">
<FileUpload v-model="form.videoFileName" :isShowTip="false" :fileType="['mp4']" :limit="1" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
<FileUpload
v-model="form.videoFileName"
:isShowTip="false"
:fileType="['mp4']"
:limit="1"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { centerTwoList, delVideo, addVideo, editVideo } from './indexApi'
import { getToken } from '@/utils/auth'
import { centerTwoList, delVideo, addVideo, editVideo } from "./indexApi";
import { getToken } from "@/utils/auth";
export default {
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: this.page_size,
},
// 表单校验
rules: {
videoName: [{ required: true, message: '视频名称不能为空', trigger: 'blur' }],
videoFileName: [{ required: true, message: '请上传视频', trigger: 'blur' }],
},
}
},
created() {
this.getList()
},
methods: {
/** 查询列表 */
getList() {
this.loading = true
centerTwoList(this.queryParams).then(response => {
this.userList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
id: undefined,
category: '1',
videoName: undefined,
remark: undefined,
}
this.resetForm('form')
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
this.form = Object.assign({}, row)
this.form.videoFileName='http://192.168.0.115:1818/' + this.form.videoFileName
this.open = true
this.title = '修改装药量概况'
},
/** 提交按钮 */
submitForm: function () {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != undefined) {
editVideo(this.form).then(response => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addVideo(this.form).then(response => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row.id + '"的数据项?')
.then(function () {
return delVideo({hxVideoId:row.id})
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {})
},
},
}
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: this.page_size,
},
// 表单校验
rules: {
videoName: [
{ required: true, message: "视频名称不能为空", trigger: "blur" },
],
videoFileName: [
{ required: true, message: "请上传视频", trigger: "blur" },
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
centerTwoList(this.queryParams).then((response) => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: undefined,
category: "1",
videoName: undefined,
remark: undefined,
};
this.resetForm("form");
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign({}, row);
// this.form.videoFileName =
// "http://192.168.0.115:1818/" + this.form.videoFileName;
this.open = true;
this.title = "修改装药量概况";
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
editVideo(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addVideo(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row.id + '"的数据项?')
.then(function () {
return delVideo({ hxVideoId: row.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script>