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

144 lines
5.1 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <div class="mod-config" style="">
  3. <div class="pad" style="float: left;width: 33%;margin-top: 2%">
  4. <h5 style="margin-left: 30px;font-size: 20px">产品图片</h5>
  5. <el-form inline="true" style="margin-top: -5px;margin-left: 30px" label-position="top">
  6. <el-form-item :label="'工厂编号:'">
  7. <el-input v-model="searchData.site" readonly style="width: 120px"></el-input>
  8. </el-form-item>
  9. <el-form-item :label="'产品编码:'" style="margin-left: 20px">
  10. <el-input v-model="searchData.partNo" readonly style="width: 220px"></el-input>
  11. </el-form-item>
  12. </el-form>
  13. <el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
  14. <el-form-item :label="'产品名称/规格型号:'" style="font-size: 20px">
  15. <el-input v-model="partDescription" readonly style="width: 374px"></el-input>
  16. </el-form-item>
  17. </el-form>
  18. <el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
  19. <el-form-item :label="fileTitle">
  20. <el-input v-model="fileName" style="width: 374px" readonly></el-input>
  21. </el-form-item>
  22. </el-form>
  23. <el-form inline="true" style="margin-top: 20px;margin-left: 30px" label-position="top">
  24. <el-form-item style="margin-top: 30px">
  25. <el-button @click="lastPicture()" style="margin-left: 10px;height: 35px;width: 90px" type="primary">上一张</el-button>
  26. </el-form-item>
  27. <el-form-item style="margin-top: 30px">
  28. <el-button @click="nextPicture()" style="margin-left: 25px;height: 35px;width: 90px" type="primary">下一张</el-button>
  29. </el-form-item>
  30. <el-form-item style="margin-top: 30px">
  31. <el-button @click="jump()" style="margin-left: 25px;height: 35px;width: 80px" type="primary">关闭</el-button>
  32. </el-form-item>
  33. </el-form>
  34. </div>
  35. <div id="padPhoto" style="text-align: center;float: left;height: 750px;width: 66%;vertical-align:middle;" >
  36. <img style="max-width: 100%;max-height: 100%;vertical-align:middle;" :src="photoUrl">
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import {
  42. getPhotoAddressData
  43. } from '@/api/pad.js'
  44. export default {
  45. name: 'padPartPhoto',
  46. data() {
  47. return{
  48. photoUrl:'',
  49. searchData:{
  50. site:'',
  51. partNo:'',
  52. },
  53. partDescription:'',
  54. fileTitle:'',
  55. fileName:'',
  56. num:1,
  57. currentData:'',
  58. photoDatas:[],
  59. uploadImg:[],
  60. showviewer: false,
  61. url: ''
  62. }
  63. },
  64. mounted () {
  65. },
  66. methods: {
  67. getData(){
  68. this.currentData = JSON.parse(localStorage.getItem("pictureData"));
  69. this.searchData.partNo = this.currentData.partNo;
  70. this.searchData.site= this.currentData.site;
  71. this.partDescription= this.currentData.partDescription+'/'+this.currentData.spec;
  72. this.getPhoto();
  73. },
  74. jump(){
  75. this.$router.push('/padPart');
  76. },
  77. getPhoto(){
  78. getPhotoAddressData(this.searchData).then(({data}) => {
  79. this.photoDatas = data.rows;
  80. if(this.photoDatas.length==0){
  81. this.fileTitle="文件名 ("+0+"/"+0+")";
  82. this.$alert('该物料没有上传图片!', '错误', {
  83. confirmButtonText: '确定'
  84. })
  85. return false;
  86. }
  87. this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
  88. this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
  89. this.photoUrl='http://192.168.2.172/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  90. // this.photoUrl='http://192.168.1.83/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  91. })
  92. },
  93. nextPicture(){
  94. if(this.photoDatas.length==0){
  95. this.fileTitle="文件名 ("+0+"/"+0+")";
  96. this.$alert('该物料没有上传图片!', '错误', {
  97. confirmButtonText: '确定'
  98. })
  99. return false;
  100. }
  101. if(this.num==this.photoDatas.length){
  102. this.num=1;
  103. }else{
  104. this.num=this.num+1;
  105. }
  106. this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
  107. this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
  108. this.photoUrl='http://192.168.2.172/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  109. },
  110. lastPicture(){
  111. if(this.photoDatas.length==0){
  112. this.fileTitle="文件名 ("+0+"/"+0+")";
  113. this.$alert('该物料没有上传图片!', '错误', {
  114. confirmButtonText: '确定'
  115. })
  116. return false;
  117. }
  118. if(this.num==1){
  119. this.num=this.photoDatas.length;
  120. }else{
  121. this.num=this.num-1;
  122. }
  123. this.fileName=this.photoDatas[this.num-1].attaFileNameDb;
  124. this.fileTitle="文件名 ("+this.num+"/"+this.photoDatas.length+")";
  125. this.photoUrl='http://192.168.2.172/upload/'+this.photoDatas[this.num-1].attaFileNameDb;
  126. },
  127. },
  128. created () {
  129. this.getData();
  130. }
  131. }
  132. </script>
  133. <style >
  134. .padPhoto .img{
  135. object-fit: cover;
  136. }
  137. </style>