赫艾前端
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.
 
 
 
 
 

147 lines
5.3 KiB

<template>
<div class="mod-config" style="">
<div class="pad" style="float: left;width: 33%;margin-top: 2%">
<h5 style="margin-left: 30px;font-size: 20px">产品图片</h5>
<el-form inline="true" style="margin-left: 30px" label-position="top">
<el-form-item :label="'工厂编号:'">
<el-input v-model="searchData.site" readonly style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'产品编码:'" style="margin-left: 20px">
<el-input v-model="searchData.partNo" readonly style="width: 220px"></el-input>
</el-form-item>
</el-form>
<el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
<el-form-item :label="'产品名称/规格型号:'" style="font-size: 20px">
<el-input v-model="partDescription" readonly style="width: 374px"></el-input>
</el-form-item>
</el-form>
<el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
<el-form-item :label="fileTitle">
<el-input v-model="fileName" style="width: 374px" readonly></el-input>
</el-form-item>
</el-form>
<el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
<el-form-item :label="' '">
<el-button @click="lastPicture()" style="margin-left: 10px;height: 35px;width: 90px" type="primary">上一张</el-button>
</el-form-item>
<el-form-item :label="' '">
<el-button @click="nextPicture()" style="margin-left: 25px;height: 35px;width: 90px" type="primary">下一张</el-button>
</el-form-item>
<el-form-item :label="' '">
<el-button @click="jump()" style="margin-left: 25px;height: 35px;width: 80px" type="primary">关闭</el-button>
</el-form-item>
</el-form>
</div>
<div id="padPhoto" style="text-align: center;float: left;height: 750px;width: 66%;vertical-align:middle;" >
<img style="max-width: 100%;max-height: 100%;vertical-align:middle;" :src="photoUrl">
</div>
</div>
</template>
<script>
import {
getPhotoAddressData
} from '@/api/pad.js'
export default {
name: 'padPartPhoto',
data() {
return{
photoUrl:'',
searchData:{
site:'',
partNo:'',
},
partDescription:'',
fileTitle:'',
fileName:'',
num:1,
currentData:'',
photoDatas:[],
uploadImg:[],
showviewer: false,
url: ''
}
},
mounted () {
},
methods: {
getData(){
this.currentData = JSON.parse(localStorage.getItem("pictureData"));
this.searchData.partNo = this.currentData.partNo;
this.searchData.site= this.currentData.site;
this.partDescription= this.currentData.partDescription+'/'+this.currentData.spec;
this.getPhoto();
},
jump(){
// this.$router.push('/padPart');
this.$router.back();
},
getPhoto(){
getPhotoAddressData(this.searchData).then(({data}) => {
this.photoDatas = data.rows;
if(this.photoDatas.length==0){
this.fileTitle="文件名 ("+0+"/"+0+")";
this.$alert('该物料没有上传图片!', '错误', {
confirmButtonText: '确定'
})
return false;
}
this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
this.photoUrl=this.$store.state.user.padSopUrl+this.photoDatas[this.num-1].attaFileNameDb;
// this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
})
},
nextPicture(){
if(this.photoDatas.length==0){
this.fileTitle="文件名 ("+0+"/"+0+")";
this.$alert('该物料没有上传图片!', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.num==this.photoDatas.length){
this.num=1;
}else{
this.num=this.num+1;
}
this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
this.photoUrl=this.$store.state.user.padSopUrl+this.photoDatas[this.num-1].attaFileNameDb;
// this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
},
lastPicture(){
if(this.photoDatas.length==0){
this.fileTitle="文件名 ("+0+"/"+0+")";
this.$alert('该物料没有上传图片!', '错误', {
confirmButtonText: '确定'
})
return false;
}
if(this.num==1){
this.num=this.photoDatas.length;
}else{
this.num=this.num-1;
}
this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
this.photoUrl=this.$store.state.user.padSopUrl+this.photoDatas[this.num-1].attaFileNameDb;
// this.photoUrl='http://192.168.1.83:81/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
},
},
created () {
this.getData();
}
}
</script>
<style >
.padPhoto .img{
object-fit: cover;
}
</style>