Commit c21f497e authored by wuqinghua's avatar wuqinghua

2022-3-9 吴卿华

parent c738b9cd
......@@ -20,7 +20,7 @@ import com.zehong.framework.config.ServerConfig;
/**
* 通用请求处理
*
*
* @author zehong
*/
@RestController
......@@ -33,7 +33,7 @@ public class CommonController
/**
* 通用下载请求
*
*
* @param fileName 文件名称
* @param delete 是否删除
*/
......@@ -75,8 +75,11 @@ public class CommonController
String filePath = GassafetyProgressConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = file.getOriginalFilename();
//本地存储地址
// String fileName=filePath+FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + FileUploadUtils.upload(filePath, file);
AjaxResult ajax = AjaxResult.success();
// ajax.put("fileName", fileName);
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
......
package com.zehong.web.controller.system;
import java.io.File;
import java.util.List;
import com.zehong.common.config.GassafetyProgressConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -20,6 +23,9 @@ import com.zehong.system.service.ITEnterpriseInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import static com.zehong.common.utils.file.FileUtils.deleteFile;
import static org.apache.tomcat.util.http.fileupload.FileUtils.deleteDirectory;
/**
* 企业信息Controller
*
......@@ -110,6 +116,15 @@ public class TEnterpriseInfoController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody TEnterpriseInfo tEnterpriseInfo)
{
//查询修改之前图片地址
TEnterpriseInfo tEnterpriseInfo1 = tEnterpriseInfoService.selectTEnterpriseInfoById(tEnterpriseInfo.getEnterpriseId());
// //删除图片
// File file = new File(tEnterpriseInfo1.getDoDusiness());
// // 上传文件路径
// String filePath = GassafetyProgressConfig.getUploadPath();
// if(file.isFile()){
// file.delete();
// }
return toAjax(tEnterpriseInfoService.updateTEnterpriseInfo(tEnterpriseInfo));
}
......
......@@ -64,6 +64,32 @@ public class TEnterpriseInfo extends BaseEntity
@Excel(name = "备注")
private String remarks;
/** 营业执照图片地址*/
private String doDusiness;
/**本地存储图片路径*/
private String burl;
public String getBurl() {
return burl;
}
public void setBurl(String burl) {
this.burl = burl;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getDoDusiness() {
return doDusiness;
}
public void setDoDusiness(String doDusiness) {
this.doDusiness = doDusiness;
}
public void setEnterpriseId(Long enterpriseId)
{
this.enterpriseId = enterpriseId;
......@@ -182,21 +208,22 @@ public class TEnterpriseInfo extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("enterpriseId", getEnterpriseId())
.append("enterpriseName", getEnterpriseName())
.append("registerAddress", getRegisterAddress())
.append("legalRepresentative", getLegalRepresentative())
.append("businessArea", getBusinessArea())
.append("licenseKey", getLicenseKey())
.append("licenseValidityTime", getLicenseValidityTime())
.append("annualSupervisionInspection", getAnnualSupervisionInspection())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
return "TEnterpriseInfo{" +
"enterpriseId=" + enterpriseId +
", enterpriseName='" + enterpriseName + '\'' +
", registerAddress='" + registerAddress + '\'' +
", legalRepresentative='" + legalRepresentative + '\'' +
", businessArea='" + businessArea + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +
", iconType='" + iconType + '\'' +
", licenseKey='" + licenseKey + '\'' +
", licenseValidityTime='" + licenseValidityTime + '\'' +
", annualSupervisionInspection='" + annualSupervisionInspection + '\'' +
", isDel='" + isDel + '\'' +
", remarks='" + remarks + '\'' +
", doDusiness='" + doDusiness + '\'' +
", burl='" + burl + '\'' +
'}';
}
}
......@@ -22,12 +22,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remarks" column="remarks" />
<result property="doDusiness" column="do_business" />
</resultMap>
<sql id="selectTEnterpriseInfoVo">
select enterprise_id, enterprise_name, register_address, legal_representative,
business_area, longitude, latitude, icon_type, license_key, license_validity_time, annual_supervision_inspection,
create_by, create_time, update_by, update_time, remarks from t_enterprise_info
create_by, create_time, update_by, update_time, remarks,do_business from t_enterprise_info
</sql>
<select id="selectTEnterpriseInfoList" parameterType="TEnterpriseInfo" resultMap="TEnterpriseInfoResult">
......@@ -70,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
<if test="doDusiness != null">do_business,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpriseName != null">#{enterpriseName},</if>
......@@ -88,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
<if test="doDusiness != null">#{doDusiness},</if>
</trim>
</insert>
......@@ -109,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remarks != null">remarks = #{remarks},</if>
<if test="doDusiness != null">do_business=#{doDusiness},</if>
</trim>
where enterprise_id = #{enterpriseId}
</update>
......
<template>
<div class="upload-file">
<el-upload
:action="uploadFileUrl"
:before-upload="handleBeforeUpload"
:file-list="fileArr"
:limit="1"
:list-type="listType"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
:on-remove="handleRemove"
:on-preview="handleFileClick"
:on-change="fileChange"
:show-file-list="true"
:headers="headers"
class="upload-file-uploader"
:class="{ hide: fileArr.length>0 ||addShow }"
ref="upload"
>
<!-- 上传按钮 -->
<el-button plain type="primary">选取文件</el-button>
<!--<i class="el-icon-plus"></i>-->
<!-- 上传提示 -->
<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>
的文件,且不超过一个
</div>
</el-upload>
<el-image v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
></el-image>
<!-- <el-dialog
:center="true"
width="50%"
:modal="modal"
:visible.sync="dialogVisible"
>
<img :src="dialogImageUrl" alt="" />
</el-dialog> -->
<!-- 文件列表 -->
<!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list">
<el-link :href="file.url" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group> -->
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
props: {
// 值
value: [String, Object, Array],
listType: {
type: String,
defaule: "text",
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
fileArr: {
type: Array,
default: [],
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ['png', 'jpg', 'jpeg'],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true,
},
},
data() {
return {
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
modal: false,
dialogVisible: false,
dialogImageUrl: "",
addShow: true,
};
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
// 列表
list() {
let temp = 1;
if (this.value) {
// 首先将值转为数组
const list = Array.isArray(this.value) ? this.value : [this.value];
// 然后将数组转为对象数组
return list.map((item) => {
if (typeof item === "string") {
item = { name: item, url: item };
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
bigImageArr() {
return [this.dialogImageUrl]
},
},
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(`只允许上传单个文件`);
},
// 上传失败
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
},
// 上传成功回调
handleUploadSuccess(res, file) {
this.$message.success("上传成功");
this.$emit("resFun", res);
},
// 文件列表移除文件
handleRemove(file, fileList) {
console.log("列表移除", file, fileList);
this.addShow = fileList.length > 0 ? true : false;
this.$emit("remove", file);
},
// 删除文件
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", "");
// let that = this,
// param;
// param = file.response ? file.response.fileName.replace(/\\/g, "%")
// : file.response.url.replace(/\\/g, "%").slice(9);
// $.ajax({
// type: "GET",
// url: process.env.VUE_APP_BASE_API + "/common/deleteFile",
// data: {savePath: param},
// dataType: "json",
// success: function(data){
// if (data) that.$message.success("删除成功");
// else return false;
// }
// });
},
handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
// this.dialogVisible = true;
this.$refs.previewImg.showViewer = false;
console.log(file);
// console.log(file.response.url)
},
// 获取文件名称
getFileName(name) {
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
} else {
return "";
}
},
// 当改变列表改变时
fileChange(file, fileList) {
this.addShow = fileList.length > 0 ? true : false;
},
},
created() {
// this.fileList = this.list;
this.addShow = this.fileArr.length > 0 ? true : false;
},
};
</script>
<style scoped lang="scss">
img {
width: 100%;
}
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
.ele-upload-list__item-content-action .el-link {
margin-right: 10px;
}
</style>
......@@ -75,6 +75,11 @@
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="企业id" align="center" prop="enterpriseId" />-->
<el-table-column label="营业执照" align="center" >
<template scope="List">
<img :src="List.row.doDusiness" width="100px">
</template>
</el-table-column>
<el-table-column label="企业名称" align="center" prop="enterpriseName" />
<el-table-column label="注册地址" align="center" prop="registerAddress" />
<el-table-column label="法定代表人" align="center" prop="legalRepresentative" />
......@@ -83,6 +88,18 @@
<el-table-column label="许可证有效期" align="center" prop="licenseValidityTime" />
<el-table-column label="年度监督检查情况" align="center" prop="annualSupervisionInspection" />
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="营业执照" align="center" >
<template slot-scope="List">
<span
class="dbtn"
@click="checkFile(List.row.doDusiness)"
v-if="List.row.doDusiness != ''"
>
<i class="el-icon el-icon-view"></i>查看/下载
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -129,6 +146,19 @@
</el-col>
</el-row>
<el-row>
<el-col :span="22">
<el-form-item label="营业执照">
<FileUpload
listType="picture"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList">
</FileUpload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="法定代表人" prop="legalRepresentative">
......@@ -190,13 +220,20 @@
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/regulation/info";
import FileUpload from '@/components/FileInfoUpload';
export default {
name: "Info",
components: {
FileUpload,
},
data() {
return {
//图片
fileList: [],
//头像数据
fileo :{
name: "",
url:"" },
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -254,6 +291,22 @@ export default {
this.getList();
},
methods: {
/**上传营业执照照片*/
getFileInfo(res){
this.form.dealPlan = res.fileName;
this.form.doDusiness = res.url;
this.fileList.push({
name: res.fileName,
url: uploadfile,
});
},
listRemove(e) {
this.form.dealPlan = "";
this.fileList = [];
},
checkFile(url) {
window.open(url,'_blank');
},
/** 查询企业信息列表 */
getList() {
this.loading = true;
......@@ -284,7 +337,9 @@ export default {
updateBy: null,
updateTime: null,
isDel: null,
remarks: null
remarks: null,
dealPlan:null,
doDusiness: null,
};
this.resetForm("form");
},
......@@ -306,16 +361,25 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.listRemove();
this.reset();
this.open = true;
this.title = "添加企业信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.listRemove();
this.reset();
const enterpriseId = row.enterpriseId || this.ids
getInfo(enterpriseId).then(response => {
this.form = response.data;
//图片回显
if (this.form.doDusiness) {
this.fileList.push({
name: '营业执照',
url: this.form.doDusiness,
});
}
this.open = true;
this.title = "修改企业信息";
});
......@@ -372,3 +436,20 @@ export default {
}
};
</script>
<style>
.dbtn {
display: inline-block;
line-height: normal;
padding-left: 2px;
padding-right: 2px;
cursor: pointer;
border-radius: 3px;
border-style: solid;
border-width: 0;
color: rgb(48, 180, 107);
}
.dbtn:hover {
border-width: 1px;
border-color: rgb(48, 180, 107);
}
</style>
......@@ -97,6 +97,18 @@
<el-table-column label="发证日期" align="center" prop="issueDate" />
<el-table-column label="复检日期" align="center" prop="certificateChange" />
<el-table-column label="备注" align="center" prop="remarks" />
<el-table-column label="照片" align="center" >
<template slot-scope="List">
<span
class="dbtn"
@click="checkFile(List.row.avatarAddress)"
v-if="List.row.avatarAddress != ''"
>
<i class="el-icon el-icon-view"></i>查看/下载
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -151,7 +163,6 @@
@remove="listRemove"
:fileArr="fileList">
</FileUpload>
<el-input v-show="false" disabled v-model="form.avatarAddress"></el-input>
</el-form-item>
</el-col>
</el-row>
......@@ -232,6 +243,7 @@
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo, selectTEnterprise,addFile} from "@/api/regulation/supervise";
import FileUpload from '@/components/FileSuperviseUpload';
export default {
name: "Info",
components: {
......@@ -239,10 +251,8 @@ export default {
},
data() {
return {
//头像 这个数组只用做前端展示已经上传的图片名称使用 不存放真实的文件数据
//头像
fileList: [],
//头像 这个数据存储file文件数据 向后台发送文件数据
fileLists: [],
//头像数据
fileo :{
name: "",
......@@ -303,20 +313,24 @@ export default {
getFileInfo(res){
this.form.dealPlan = res.fileName;
this.form.avatarAddress = res.url;
this.form.burl=res.burl;
this.fileList.push({
name: res.fileName,
url: uploadfile,
burl:res.burl,
});
},
listRemove(e) {
this.form.dealPlan = "";
this.fileList = [];
},
checkFile(url) {
window.open(url,'_blank');
},
/** 查询从业人员信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then(response => {
console.log(response.rows)
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -347,7 +361,7 @@ export default {
updateTime: null,
isDel: null,
remarks: null,
avatarAddress:null
avatarAddress:null,
};
this.resetForm("form");
},
......@@ -387,6 +401,13 @@ export default {
const employedPeopleId = row.employedPeopleId || this.ids
getInfo(employedPeopleId).then(response => {
this.form = response.data;
//图片回显
if (this.form.avatarAddress) {
this.fileList.push({
name: '照片',
url: this.form.avatarAddress,
});
}
this.open = true;
this.title = "修改从业人员信息";
});
......@@ -447,4 +468,21 @@ export default {
}
};
</script>
<style>
.dbtn {
display: inline-block;
line-height: normal;
padding-left: 2px;
padding-right: 2px;
cursor: pointer;
border-radius: 3px;
border-style: solid;
border-width: 0;
color: rgb(48, 180, 107);
}
.dbtn:hover {
border-width: 1px;
border-color: rgb(48, 180, 107);
}
</style>
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