deleteUploadImgTaskPhoto.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div class="deleteUploadImgTaskPhoto">
  3. <van-row gutter="10">
  4. <van-col span="6" style="background: #f5f5f5">
  5. <div class="addImg">
  6. <uploadVNormalTaskPhoto
  7. :imgArr="imgs"
  8. :shouws="true"
  9. :storeGroupId="storeGroupId"
  10. :taskList="taskIds.split(',')"
  11. :collectionItemId="collectionItemId"
  12. :visitModel="1 + ''"
  13. :visitsId="visitsId"
  14. :putInCode="putInCode"
  15. :photoIdentifyType="photoIdentifyType"
  16. :pictureSource="pictureSource"
  17. :continuousShoot="continuousShoot"
  18. :objectType="objectType"
  19. @newimgarr="newimgarr"
  20. ref="uploadVNormal" />
  21. </div>
  22. </van-col>
  23. <van-col span="6" v-for="(urls, index) in imgs" :key="urls.id">
  24. <div class="imgview">
  25. <van-icon
  26. v-if="(photoIdentifyType != 6 || photoIdentifyType != 7) && types != 'edit'"
  27. name="close"
  28. size="16"
  29. v-on:click="deleteImg(index, urls.fileIdSplicing)" />
  30. <img
  31. v-if="urls.type == '2'"
  32. :src="urls.fileUrl"
  33. width="100px"
  34. height="100px"
  35. @click="previewsImg(index)" />
  36. <img
  37. v-else
  38. :src="urls.fileUrl"
  39. width="100px"
  40. height="100px"
  41. @click="previewsImg(index)" />
  42. </div>
  43. </van-col>
  44. </van-row>
  45. <!-- <div style="padding: 10px 16px 0;">-->
  46. <!-- <div class="img-box" v-for="(urls, index) in imgs" :key="index">-->
  47. <!-- <van-icon name="clear" v-on:click="deleteImg(index,urls.id)"/>-->
  48. <!-- <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
  49. <!-- <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
  50. <!-- </div>-->
  51. <!-- </div>-->
  52. </div>
  53. </template>
  54. <script>
  55. import { ImagePreview } from 'vant';
  56. import { removePhotoBatch } from '@/api/index';
  57. import uploadVNormalTaskPhoto from '@/components/uploadVNormalTaskPhoto';
  58. export default {
  59. name: 'deleteUploadImgTaskPhoto',
  60. components: { uploadVNormalTaskPhoto },
  61. props: {
  62. imgs: {
  63. type: Array,
  64. default() {
  65. return [];
  66. },
  67. },
  68. photoIdentifyType: {
  69. // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招,6:sku陈列照)
  70. type: String,
  71. default: '',
  72. },
  73. types: {
  74. // edit 编辑
  75. type: String,
  76. },
  77. storeGroupId: {
  78. type: String,
  79. },
  80. taskIds: {
  81. type: [Array, String],
  82. default() {
  83. return [];
  84. },
  85. },
  86. collectionItemId: {
  87. type: [String, Number],
  88. },
  89. visitsId: {
  90. type: String,
  91. default: '',
  92. },
  93. putInCode: {
  94. type: String,
  95. default: '',
  96. },
  97. pictureSource: {
  98. // 是否允许从相册选择图片 1:允许;0:不允许
  99. type: String,
  100. default: '0',
  101. },
  102. continuousShoot: {
  103. // 是否允许连拍/相册多选 1:允许;0:不允许
  104. type: String,
  105. default: '0',
  106. },
  107. objectType: {
  108. type: String,
  109. default: '',
  110. },
  111. },
  112. watch: {
  113. imgs: {
  114. handler(val) {},
  115. deep: true,
  116. immediate: true,
  117. },
  118. },
  119. data() {
  120. return {
  121. url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
  122. };
  123. },
  124. methods: {
  125. deleteImg(index, fileIdList) {
  126. removePhotoBatch({ fileIdList: fileIdList.split(',') }).then((res) => {
  127. if (res.code == 200) {
  128. this.$toast('删除成功!');
  129. this.$emit('upDataDetail');
  130. } else {
  131. this.$toast('删除失败!');
  132. }
  133. });
  134. },
  135. previewsImg(index) {
  136. var arrimg = [];
  137. for (var imgi = 0; imgi < this.imgs.length; imgi++) {
  138. arrimg.push(this.imgs[imgi].fileUrl);
  139. }
  140. ImagePreview({
  141. images: arrimg,
  142. startPosition: index,
  143. onClose() {
  144. // do something
  145. },
  146. });
  147. },
  148. newimgarr() {
  149. this.$emit('upDataDetail');
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="scss" scoped>
  155. .deleteUploadImgTaskPhoto {
  156. }
  157. .addImg {
  158. width: 100%;
  159. height: 72px;
  160. display: flex;
  161. align-items: center;
  162. justify-content: center;
  163. }
  164. .imgview {
  165. width: 100%;
  166. height: 72px;
  167. position: relative;
  168. display: inline-block;
  169. i {
  170. position: absolute;
  171. right: -2px;
  172. top: -3px;
  173. color: white;
  174. background: red;
  175. overflow: hidden;
  176. border-radius: 50%;
  177. }
  178. img {
  179. width: 100%;
  180. height: 100%;
  181. }
  182. }
  183. </style>