Commit 236a20c0 authored by 耿迪迪's avatar 耿迪迪

安全管理功能

parent 26ebbfa6
......@@ -27,8 +27,8 @@ public class TSafeInspectLedger extends BaseEntity
private String content;
/** 设备状态 */
@Excel(name = "设备状态")
private Integer address;
@Excel(name = "地点")
private String address;
/** 照片 */
@Excel(name = "照片")
......@@ -73,12 +73,12 @@ public class TSafeInspectLedger extends BaseEntity
{
return content;
}
public void setAddress(Integer address)
public void setAddress(String address)
{
this.address = address;
}
public Integer getAddress()
public String getAddress()
{
return address;
}
......
......@@ -27,8 +27,8 @@ public class TSafeMeetingLedger extends BaseEntity
private String content;
/** 设备状态 */
@Excel(name = "设备状态")
private Integer address;
@Excel(name = "地点")
private String address;
/** 照片 */
@Excel(name = "照片")
......@@ -73,12 +73,12 @@ public class TSafeMeetingLedger extends BaseEntity
{
return content;
}
public void setAddress(Integer address)
public void setAddress(String address)
{
this.address = address;
}
public Integer getAddress()
public String getAddress()
{
return address;
}
......
......@@ -19,7 +19,7 @@ public class TSafeTrainLedger extends BaseEntity
private Long trainId;
/** 检查标题 */
@Excel(name = "检查标题")
@Excel(name = "培训标题")
private String title;
/** 内容 */
......@@ -27,8 +27,8 @@ public class TSafeTrainLedger extends BaseEntity
private String content;
/** 设备状态 */
@Excel(name = "设备状态")
private Integer address;
@Excel(name = "地点")
private String address;
/** 照片 */
@Excel(name = "照片")
......@@ -73,12 +73,12 @@ public class TSafeTrainLedger extends BaseEntity
{
return content;
}
public void setAddress(Integer address)
public void setAddress(String address)
{
this.address = address;
}
public Integer getAddress()
public String getAddress()
{
return address;
}
......
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSafeInspectLedgerMapper;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TSafeInspectLedger;
import com.zehong.system.mapper.TSafeInspectLedgerMapper;
import com.zehong.system.service.ITSafeInspectLedgerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 安全检查台账Service业务层处理
......@@ -17,7 +19,7 @@ import com.zehong.system.service.ITSafeInspectLedgerService;
@Service
public class TSafeInspectLedgerServiceImpl implements ITSafeInspectLedgerService
{
@Autowired
@Resource
private TSafeInspectLedgerMapper tSafeInspectLedgerMapper;
/**
......@@ -54,6 +56,7 @@ public class TSafeInspectLedgerServiceImpl implements ITSafeInspectLedgerService
public int insertTSafeInspectLedger(TSafeInspectLedger tSafeInspectLedger)
{
tSafeInspectLedger.setCreateTime(DateUtils.getNowDate());
tSafeInspectLedger.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeInspectLedgerMapper.insertTSafeInspectLedger(tSafeInspectLedger);
}
......@@ -67,6 +70,7 @@ public class TSafeInspectLedgerServiceImpl implements ITSafeInspectLedgerService
public int updateTSafeInspectLedger(TSafeInspectLedger tSafeInspectLedger)
{
tSafeInspectLedger.setUpdateTime(DateUtils.getNowDate());
tSafeInspectLedger.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeInspectLedgerMapper.updateTSafeInspectLedger(tSafeInspectLedger);
}
......
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSafeMeetingLedgerMapper;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TSafeMeetingLedger;
import com.zehong.system.mapper.TSafeMeetingLedgerMapper;
import com.zehong.system.service.ITSafeMeetingLedgerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 安全例会台账Service业务层处理
......@@ -17,7 +19,7 @@ import com.zehong.system.service.ITSafeMeetingLedgerService;
@Service
public class TSafeMeetingLedgerServiceImpl implements ITSafeMeetingLedgerService
{
@Autowired
@Resource
private TSafeMeetingLedgerMapper tSafeMeetingLedgerMapper;
/**
......@@ -54,6 +56,7 @@ public class TSafeMeetingLedgerServiceImpl implements ITSafeMeetingLedgerService
public int insertTSafeMeetingLedger(TSafeMeetingLedger tSafeMeetingLedger)
{
tSafeMeetingLedger.setCreateTime(DateUtils.getNowDate());
tSafeMeetingLedger.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeMeetingLedgerMapper.insertTSafeMeetingLedger(tSafeMeetingLedger);
}
......@@ -67,6 +70,7 @@ public class TSafeMeetingLedgerServiceImpl implements ITSafeMeetingLedgerService
public int updateTSafeMeetingLedger(TSafeMeetingLedger tSafeMeetingLedger)
{
tSafeMeetingLedger.setUpdateTime(DateUtils.getNowDate());
tSafeMeetingLedger.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeMeetingLedgerMapper.updateTSafeMeetingLedger(tSafeMeetingLedger);
}
......
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TSafeTrainLedgerMapper;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TSafeTrainLedger;
import com.zehong.system.mapper.TSafeTrainLedgerMapper;
import com.zehong.system.service.ITSafeTrainLedgerService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 安全培训台账Service业务层处理
......@@ -17,7 +19,7 @@ import com.zehong.system.service.ITSafeTrainLedgerService;
@Service
public class TSafeTrainLedgerServiceImpl implements ITSafeTrainLedgerService
{
@Autowired
@Resource
private TSafeTrainLedgerMapper tSafeTrainLedgerMapper;
/**
......@@ -54,6 +56,7 @@ public class TSafeTrainLedgerServiceImpl implements ITSafeTrainLedgerService
public int insertTSafeTrainLedger(TSafeTrainLedger tSafeTrainLedger)
{
tSafeTrainLedger.setCreateTime(DateUtils.getNowDate());
tSafeTrainLedger.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeTrainLedgerMapper.insertTSafeTrainLedger(tSafeTrainLedger);
}
......@@ -67,6 +70,7 @@ public class TSafeTrainLedgerServiceImpl implements ITSafeTrainLedgerService
public int updateTSafeTrainLedger(TSafeTrainLedger tSafeTrainLedger)
{
tSafeTrainLedger.setUpdateTime(DateUtils.getNowDate());
tSafeTrainLedger.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return tSafeTrainLedgerMapper.updateTSafeTrainLedger(tSafeTrainLedger);
}
......
......@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTSafeInspectLedgerList" parameterType="TSafeInspectLedger" resultMap="TSafeInspectLedgerResult">
<include refid="selectTSafeInspectLedgerVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="address != null "> and address = #{address}</if>
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
......
......@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTSafeMeetingLedgerList" parameterType="TSafeMeetingLedger" resultMap="TSafeMeetingLedgerResult">
<include refid="selectTSafeMeetingLedgerVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="address != null "> and address = #{address}</if>
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
......
......@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTSafeTrainLedgerList" parameterType="TSafeTrainLedger" resultMap="TSafeTrainLedgerResult">
<include refid="selectTSafeTrainLedgerVo"/>
<where>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="address != null "> and address = #{address}</if>
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
......
<template>
<div class="upload-file">
<el-upload
:action="uploadImgUrl"
:headers="headers"
multiple
list-type="text"
:fileType="fileType"
:file-list="fileList"
:limit="limit"
:before-upload="handleBeforeUpload"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:class="{hide: isHide}"
>
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
</el-upload>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize">
大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
</template>
<template v-if="fileType">
格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
</template>
的文件,且不超过{{limit}}个
</div>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
name: "multiple-image-upload",
props: {
// 值
value: [String, Object, Array],
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
//回显数组
/*fileList: {
type: Array,
default: () => [],
},*/
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
},
limit: {
type: Number,
default: 5
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
},
data(){
return{
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
previewImg: null,
dialogImageUrl: null,
fileList: [],
isHide: false
}
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
const isTypeOk = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
}
}
// 校检文件大小
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
return true;
},
// 文件个数超出
handleExceed() {
this.$message.error(`只允许上传单`+ this.limit +`文件`);
},
handleUploadSuccess(res,file,fileList) {
if (res.code == 200) {
let files = this.getFile(fileList);
this.$message.success("上传成功");
this.$emit("input", JSON.stringify(files));
this.hideUpload(fileList);
}
},
handleUploadError() {
this.$message.error("上传失败, 请重试");
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.$refs.previewImg.showViewer = true;
},
handleRemove(file, fileList) {
let files = this.getFile(fileList);
this.$emit("input", JSON.stringify(files));
this.hideUpload(fileList);
},
getFile(fileList){
if (fileList.every(item => item.status == "success")) {
//由于fileList是所有的文件包含之前已上传过的,这里需要做区分(带response的即为新上传的)
return fileList.map(item => {
const files = {name: item.name};
if(item.response){
files.url = item.response.url;
}else{
files.url = item.url;
}
return files;
})
}else{
return [];
}
},
hideUpload(fileList){
if(fileList.length > 4){
this.isHide = true;
}else{
this.isHide = false;
}
}
}
}
</script>
<style scoped lang="scss">
.hide ::v-deep .el-upload--picture-card {
display: none;
}
</style>
......@@ -163,7 +163,7 @@
}
},
hideUpload(fileList){
if(fileList.length > 4){
if(fileList.length > this.limit){
this.isHide = true;
}else{
this.isHide = false;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment