uploadExecute.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <popup
  3. class="active-upload-popup"
  4. v-model:show="show"
  5. closeable
  6. :close-on-click-overlay="false"
  7. >
  8. <div class="header">
  9. <div class="title">
  10. <span class="required">*</span>
  11. 请上传执行照片
  12. </div>
  13. </div>
  14. <upload exampleImg class="upload-wrap" @handleUpload="handleUpload">
  15. <img class="example" src="@/assets/img/home/example-4.png" alt="" />
  16. <img class="example" src="@/assets/img/home/plus.png" alt="">
  17. </upload>
  18. <div class="btn" @click="handleConfirm">请求确认</div>
  19. </popup>
  20. <FnShareSheet v-model:show="showShare" @select="onSelect" :class="className" />
  21. </template>
  22. <script setup>
  23. import { Popup } from "vant";
  24. import { ref } from "vue";
  25. import upload from "@/components/upload";
  26. import { ElMessage } from "element-plus";
  27. import FnShareSheet from "@/components/pageComponents/FnShareSheet.vue";
  28. const props = defineProps({
  29. onlyShare: {
  30. type: Boolean,
  31. default: false,
  32. },
  33. });
  34. const show = ref(false);
  35. const className = ref(null);
  36. const farmWorkRecordId = ref(null);
  37. function showPopup(id,classNameVal) {
  38. if (props.onlyShare) {
  39. showShare.value = true;
  40. className.value = classNameVal;
  41. } else {
  42. show.value = true;
  43. farmWorkRecordId.value = id;
  44. }
  45. }
  46. const images = ref([]);
  47. function handleUpload({imgArr}) {
  48. images.value = imgArr;
  49. }
  50. function handleConfirm() {
  51. const params = {
  52. recordId: farmWorkRecordId.value,
  53. executeEvidence: images.value,
  54. };
  55. VE_API.z_farm_work_record.addExecuteImg(params).then((res) => {
  56. if (res.code === 0) {
  57. ElMessage.success('请求确认成功');
  58. show.value = false;
  59. showShare.value = true;
  60. }
  61. });
  62. }
  63. const showShare = ref(false);
  64. const onSelect = ({type}) => {
  65. console.log(type);
  66. };
  67. defineExpose({
  68. showPopup,
  69. });
  70. </script>
  71. <style lang="scss" scoped>
  72. .active-upload-popup {
  73. width: 90%;
  74. box-sizing: border-box;
  75. padding: 24px 18px 20px;
  76. background: linear-gradient(0deg, #ffffff 70%, #d1ebff 100%);
  77. border-radius: 10px;
  78. ::v-deep {
  79. .van-popup__close-icon {
  80. color: #000;
  81. }
  82. }
  83. .header {
  84. .title {
  85. font-size: 16px;
  86. font-weight: 500;
  87. display: flex;
  88. align-items: center;
  89. .required {
  90. color: #ff4d4f;
  91. margin-right: 4px;
  92. }
  93. }
  94. .date-input {
  95. margin: 12px 0;
  96. }
  97. }
  98. .tips-text {
  99. font-weight: 500;
  100. }
  101. .upload-wrap {
  102. margin: 12px 0 24px;
  103. }
  104. .example {
  105. width: 80px;
  106. height: 80px;
  107. }
  108. .example + .example {
  109. margin-left: 12px;
  110. }
  111. }
  112. .btn {
  113. padding: 8px;
  114. background: #2199f8;
  115. border-radius: 25px;
  116. color: #fff;
  117. font-size: 16px;
  118. text-align: center;
  119. }
  120. </style>
  121. <style>
  122. .share-sheet{
  123. bottom: 50px;
  124. }
  125. </style>