Commit 151f2366 authored by wanghao's avatar wanghao

1 阀井/调压箱 修改时之前图片重复显示, 有的不显示问题修复。

parent 1be08101
......@@ -146,18 +146,18 @@ public class TDeviceInfoController extends BaseController
public AjaxResult edit(@RequestBody TDeviceInfo tDeviceInfo)
{
TDeviceInfo tDeviceInfos = tDeviceInfoService.selectTDeviceInfoById(tDeviceInfo.getDeviceId());
//文件删除
if (tDeviceInfos.getIconUrl()!=null){
// 上传文件路径
String filePath = GassafetyProgressConfig.getUploadPath();
String[] strs = tDeviceInfos.getIconUrl().split("upload");
//删除图片
File file = new File(filePath+strs[1].toString());
// 上传文件路径
if(file.isFile()){
file.delete();
}
}
//文件删除 20240731 wh 调整去掉删除
// if (tDeviceInfos.getIconUrl()!=null){
// // 上传文件路径
// String filePath = GassafetyProgressConfig.getUploadPath();
// String[] strs = tDeviceInfos.getIconUrl().split("upload");
// //删除图片
// File file = new File(filePath+strs[1].toString());
// // 上传文件路径
// if(file.isFile()){
// file.delete();
// }
// }
//根据企业id查询企业名称
String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tDeviceInfo.getBeyondEnterpriseId());
tDeviceInfo.setBeyondEnterpriseName(EnterpriseName);
......
......@@ -115,7 +115,7 @@
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="照片" align="center" >
<!-- <el-table-column label="照片" align="center" >
<template slot-scope="List">
<img :src="List.row.iconUrl" width="100px">
</template>
......@@ -131,7 +131,7 @@
</span>
<span v-else>-</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -519,6 +519,7 @@ export default {
relationImg: require('@/assets/project/relation.png'),
//头像
fileList: [],
pictureUrlList:[],
/**弹出层*/
//下级设备数据数组
tableData: [],
......@@ -656,9 +657,10 @@ export default {
},
methods: {
/**上传头像*/
getFileInfo(res){
this.form.dealPlan = res.fileName;
this.form.iconUrl = res.url;
getFileInfo(res){
this.pictureUrlList.push(res.url)
// this.form.iconUrl = res.url;
this.form.iconUrl=this.pictureUrlList.join(",");
this.form.burl=res.burl;
this.fileList.push({
name: res.fileName,
......@@ -670,8 +672,31 @@ export default {
window.open(url,'_blank');
},
listRemove(e) {
this.form.dealPlan = "";
this.fileList = [];
this.form.dealPlan = "";
let deleteIndex = -1;
for(var i = 0; i < this.fileList.length; i++){
const item = this.fileList[i];
if (item.uid == e.uid) {
deleteIndex = i;
}
}
if (deleteIndex > -1) {
this.form.iconUrl = "";
this.fileList.splice(deleteIndex,1);
this.pictureUrlList = [];
if (this.fileList.length > 0) {
for(var i = 0; i < this.fileList.length; i++){
const item = this.fileList[i] ;
console.log("item.url" + item.url);
this.pictureUrlList.push(item.url);
this.form.iconUrl=this.pictureUrlList.join(",");
}
}
}
console.log("this.form.iconUrl = " + this.form.iconUrl);
// this.fileList = [];
},
/** 查询设备信息列表 */
getList() {
......@@ -784,12 +809,20 @@ export default {
this.loadings = false;
});
// 隐患信息 上传照片清空
this.fileList = [];
this.pictureUrlList = [];
this.reset();
this.open = true;
this.title = "添加设备信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
// 隐患信息 上传照片清空
this.fileList = [];
this.pictureUrlList = [];
//查询企业名称下拉框数据
selectTEnterprise().then(response => {
this.test = response.data;
......@@ -811,10 +844,14 @@ export default {
this.form = response.data;
//图片回显
if (this.form.iconUrl) {
this.fileList.push({
name: '照片',
url: this.form.iconUrl,
});
for(var i = 0; i < this.form.iconUrl.split(',').length; i++){
console.log("this.form.iconUrl.split(',')" + i+ "=== " + this.form.iconUrl.split(',')[i]);
this.pictureUrlList.push(this.form.iconUrl.split(',')[i])
this.fileList.push({
name: '照片',
url: this.form.iconUrl.split(',')[i],
});
}
}
this.open = true;
this.title = "修改设备信息";
......
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