zgMeasureList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view>
  3. <view class="list_content">
  4. <view class="list_item">整改项</view>
  5. <view class="list_item_text">{{props.zgData.rectificationItems}}</view>
  6. </view>
  7. <view class="list_content">
  8. <view class="list_item">说明</view>
  9. <view class="list_item_text">{{props.zgData.explains}}</view>
  10. </view>
  11. <view class="list_content" v-if="props.zgData.rectificationUrls!=null && props.zgData.rectificationUrls!=''">
  12. <view class="list_item">附件</view>
  13. </view>
  14. <view v-if="props.zgData.rectificationUrls!=null && props.zgData.rectificationUrls!=''">
  15. <uni-file-picker :modelValue="showImage(props.zgData.rectificationUrls)" readonly="false"></uni-file-picker>
  16. </view>
  17. <view class="list_content">
  18. <view class="list_item">整改措施</view>
  19. </view>
  20. <view class="measure_text">
  21. <textarea placeholder="请输入整改措施内容(可填写500字)" v-model="props.zgData.rectificationMeasure" :disabled="props.disabled" maxlength="500" class="measure_text_input"></textarea>
  22. </view>
  23. <view class="list_content">
  24. <view class="list_item">图片</view>
  25. </view>
  26. <view>
  27. <uni-file-picker :modelValue="showImage(props.zgData.measureUrls)" limit="4" @select="selectImg" @delete="deleteImg" :readonly="props.disabled"></uni-file-picker>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { reactive,watch } from "vue";
  33. import {uploadImageModelValue} from '@/pages/controls/image/OssService';
  34. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  35. import http from '@/utils/request';
  36. const props=defineProps({
  37. zgData:Object,
  38. disabled:Boolean
  39. })
  40. // 选中图片,将选中的图片添加列表
  41. const selectImg=(e)=>{
  42. if (props.zgData.measureUrls == null || props.zgData.measureUrls == undefined){
  43. props.zgData.measureUrls = []
  44. }
  45. e.tempFiles.forEach(file=>{
  46. uni.showLoading({
  47. title: '图片上传....',
  48. mask: true
  49. });
  50. http.upload("oss/upload",{file:file.file}).then(e => {
  51. uni.hideLoading()
  52. props.zgData.measureUrls.push(e.id)
  53. })
  54. })
  55. }
  56. // 删除图片,并将其从列表中删除
  57. const deleteImg=(e)=>{
  58. let index=0
  59. props.zgData.measureUrls.forEach((item,idx)=>{
  60. index=e.tempFilePath.indexOf(item)
  61. if(index>0){
  62. // 删除列表中的元素
  63. props.zgData.measureUrls.splice(idx,1)
  64. }
  65. })
  66. }
  67. // 显示图片
  68. const showImage=(id)=>{
  69. return uploadImageModelValue(id)
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .list_content{
  74. display: flex;
  75. padding: 10rpx 20rpx;
  76. .list_item{
  77. font-size: 15px;
  78. font-weight: 400;
  79. letter-spacing: 0px;
  80. line-height: 21.72px;
  81. color: rgba(102, 102, 102, 1);
  82. vertical-align: top;
  83. }
  84. .list_item_text{
  85. padding-right: 20rpx;
  86. padding-left: 30rpx;
  87. flex: 1;
  88. text-align: right;
  89. font-size: 15px;
  90. font-weight: 400;
  91. letter-spacing: 0.5px;
  92. line-height: 22px;
  93. color: rgba(51, 51, 51, 1);
  94. }
  95. }
  96. .measure_text{
  97. border:1px solid rgba(235, 237, 240, 1);
  98. ::v-deep .uni-textarea-placeholder{
  99. font-size: 14px;
  100. color: rgba(153, 153, 153, 1);
  101. }
  102. .measure_text_input{
  103. padding: 20rpx;
  104. }
  105. }
  106. </style>