You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
volunteer-pc/src/views/volunteer/gxhzs/gxhzsgl/index.vue

317 lines
8.2 KiB

2 years ago
<template>
2 years ago
<div class="app-container" ref="main">
<div ref="search" class="search">
2 years ago
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
class="search-container"
>
<el-form-item prop="name">
<el-input
v-model="queryParams.input"
placeholder="请输入关键字"
clearable
>
<div class="search-btn" slot="append">
<i class="el-icon-search"></i>
</div>
</el-input>
</el-form-item>
</el-form>
<el-button
v-hasPermi="['system:certificates:add']"
type="primary"
size="small"
@click="handleAdd"
>新增</el-button
>
2 years ago
</div>
<div class="book-main" :style="{ height: tableHeigth + 'px' }">
<div v-for="(item, index) in 10" :key="index">
<el-image
style="width: 100%; height: 87%"
src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
fit="cover"
></el-image>
<div
class="operate"
style="font-size: 14px; color: #4d4949; font-weight: bold"
>
2 years ago
<div>高级</div>
<div class="right-operate">
<div class="operate-item">
<el-button type="text" size="mini" style="color: #909399"
>查看</el-button
>
</div>
<div class="operate-item">
<el-button
type="text"
size="mini"
style="color: #e6a23c; margin: 0 10px"
@click="handleUpdate"
v-hasPermi="['system:certificates:edit']"
2 years ago
>修改</el-button
>
</div>
<div class="operate-item">
<el-button
v-hasPermi="['system:certificates:remove']"
type="text"
size="mini"
style="color: #f56c6c"
@click="handleDelete"
2 years ago
>删除</el-button
>
</div>
</div>
</div>
</div>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改证书管理对话框 -->
<el-dialog :visible.sync="open" width="950px" append-to-body>
<div slot="title" class="dialog-title">
<span class="title-line"></span>
{{ title }}
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="证书名称" prop="name">
<el-input v-model="form.name" placeholder="请输入证书名称" />
</el-form-item>
<el-form-item label="证书时间" prop="datetime">
<el-date-picker
clearable
v-model="form.datetime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择证书时间"
>
</el-date-picker>
</el-form-item>
<el-form-item label="服务时长" prop="serviceDuration">
<el-input
v-model="form.serviceDuration"
placeholder="请输入服务时长"
/>
</el-form-item>
<el-form-item label="证书内容">
<el-input
type="textarea"
:rows="3"
v-model="form.content"
placeholder="请输入证书内容"
/>
</el-form-item>
<el-form-item label="证书封面" prop="cover">
<ImageUpload :limit="1" v-model="form.cover" />
</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>
2 years ago
</div>
2 years ago
</template>
<script>
import {
listCertificates,
getCertificates,
delCertificates,
addCertificates,
updateCertificates,
} from "@/api/volunteer/gxhzs/gxhzsgl/index.js";
2 years ago
export default {
data() {
return {
tableHeigth: 0,
queryParams: {},
loading: false,
tableData: [],
total: 1,
queryParams: {
pageNum: 0,
pageSize: 10,
},
form: {},
rules: {},
open: false,
title: "",
fileList: [],
2 years ago
};
},
created() {
// //给表格一个固定值
this.$nextTick(() => {
this.tableHeigth =
this.$refs.main.offsetHeight - this.$refs.search.offsetHeight - 80;
2 years ago
console.log(this.$refs.search.offsetHeight, "高度");
});
},
methods: {
getList() {},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
type: null,
cover: null,
content: null,
datetime: null,
serviceDuration: null,
createId: null,
createBy: null,
createTime: null,
updateId: null,
updateBy: null,
updateTime: null,
remark: null,
userId: null,
deptId: null,
};
this.resetForm("form");
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加证书管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getCertificates(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改证书管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateCertificates(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCertificates(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除证书管理编号为"' + ids + '"的数据项?')
.then(function () {
return delCertificates(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
2 years ago
},
};
2 years ago
</script>
2 years ago
<style lang="scss" scoped>
// @import "@/assets/styles/myTable.scss";
// @import "@/assets/styles/element-variables.scss";
.search {
display: flex;
align-items: center;
justify-content: space-between;
}
2 years ago
::v-deep .search-container {
.el-form-item__content {
width: 550px;
}
.el-input-group__append {
padding-left: 15px !important;
padding-right: 15px !important;
background: #f8414d !important;
border-color: #f8414d !important;
.search-btn {
color: #fff !important;
}
}
}
.book-main {
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
& > div {
flex-basis: calc(20% - 20px);
margin: 10px; /* 设置元素之间的间距 */
display: flex;
flex-direction: column;
box-shadow: 0px 3px 15px 0px rgba(184, 184, 184, 0.22);
border-radius: 10px;
overflow: hidden;
.operate {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 10px;
.right-operate {
display: flex;
align-items: center;
justify-content: center;
}
.operate-item {
text-align: center;
font-size: 14px;
color: #8a8585;
cursor: pointer;
}
}
}
}
::v-deep .el-dialog__header {
background: #f7f5f5;
.dialog-title {
font-size: 17px;
font-family: "Alibaba-PuHuiTi-Bold";
color: #4c4949;
display: flex;
align-items: center;
.title-line {
display: inline-block;
width: 5px;
height: 18px;
background: #f8414d;
margin-right: 6px;
}
}
}
2 years ago
</style>