xuhongjie
parent
ed6a89c4d9
commit
89bfb8af34
@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<div class="app-container" ref="main">
|
||||
<div ref="search" class="search">
|
||||
<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
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="book-main" :style="{ height: tableHeigth + 'px' }">
|
||||
<div class="child-box" v-for="item in certificatesList" :key="item.id">
|
||||
<div>
|
||||
<el-image
|
||||
style="width: 100%; height: 87%"
|
||||
:src="baseUrl + item.cover"
|
||||
fit="cover"
|
||||
></el-image>
|
||||
<div
|
||||
class="operate"
|
||||
style="font-size: 14px; color: #4d4949; font-weight: bold"
|
||||
>
|
||||
<div>高级</div>
|
||||
<div class="right-operate">
|
||||
<div class="operate-item">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
style="color: #909399"
|
||||
@click="handleInfo(item)"
|
||||
>查看</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="operate-item">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
style="color: #e6a23c; margin: 0 10px"
|
||||
@click="handleUpdate(item)"
|
||||
v-hasPermi="['system:certificates:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="operate-item">
|
||||
<el-button
|
||||
v-hasPermi="['system:certificates:remove']"
|
||||
type="text"
|
||||
size="mini"
|
||||
style="color: #f56c6c"
|
||||
@click="handleDelete(item)"
|
||||
>删除</el-button
|
||||
>
|
||||
</div>
|
||||
</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>
|
||||
<!-- 详情 -->
|
||||
<el-dialog :visible.sync="openInfo" width="950px" append-to-body>
|
||||
<div slot="title" class="dialog-title">
|
||||
<span class="title-line"></span>
|
||||
详情
|
||||
</div>
|
||||
<div class="info-box">
|
||||
<div>
|
||||
<div class="info-item">
|
||||
<div class="item-lable">证书名称:</div>
|
||||
<div class="item-value">{{ form.name }}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="item-lable">证书时间:</div>
|
||||
<div class="item-value">{{ form.datetime }}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="item-lable">服务时长:</div>
|
||||
<div class="item-value">{{ form.serviceDuration }}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="item-lable">证书内容:</div>
|
||||
<div class="item-value">{{ form.content }}</div>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<div class="item-lable">证书封面:</div>
|
||||
<div class="item-value">
|
||||
<ImagePreview :src="form.cover" width="269px" height="192px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listCertificates,
|
||||
getCertificates,
|
||||
delCertificates,
|
||||
addCertificates,
|
||||
updateCertificates,
|
||||
} from "@/api/volunteer/gxhzs/gxhzsgl/index.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
certificatesList: [],
|
||||
tableHeigth: 0,
|
||||
queryParams: {},
|
||||
loading: false,
|
||||
tableData: [],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
form: {},
|
||||
rules: {},
|
||||
open: false,
|
||||
openInfo: false,
|
||||
title: "",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// //给表格一个固定值
|
||||
this.$nextTick(() => {
|
||||
this.tableHeigth =
|
||||
this.$refs.main.offsetHeight - this.$refs.search.offsetHeight - 80;
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询证书管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCertificates(this.queryParams).then((response) => {
|
||||
this.certificatesList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 表单重置
|
||||
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 = "添加证书管理";
|
||||
},
|
||||
/**详情 */
|
||||
handleInfo(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
getCertificates(id).then((response) => {
|
||||
this.form = response.data;
|
||||
this.openInfo = true;
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
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(() => {});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<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;
|
||||
}
|
||||
|
||||
.book-main {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.child-box {
|
||||
height: 50%;
|
||||
width: 20%;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
& > div {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue