zgMeasureList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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="showImageStr(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. import { UrlPath } from "@/utils/commonuni"
  37. const props=defineProps({
  38. zgData:Object,
  39. disabled:Boolean
  40. })
  41. // 选中图片,将选中的图片添加列表
  42. const selectImg=(e)=>{
  43. if (props.zgData.measureUrls == null || props.zgData.measureUrls == undefined){
  44. props.zgData.measureUrls = []
  45. }
  46. e.tempFiles.forEach(file=>{
  47. uni.showLoading({
  48. title: '图片上传....',
  49. mask: true
  50. });
  51. http.upload("admin-api/infra/file/upload",{file:file.file}).then(e => {
  52. uni.hideLoading()
  53. props.zgData.measureUrls.push(e)
  54. })
  55. })
  56. }
  57. // 删除图片,并将其从列表中删除
  58. const deleteImg=(val)=>{
  59. if (val.index != -1) {
  60. props.zgData.measureUrls.splice(val.index,1)
  61. }
  62. }
  63. const showImageStr = (urlStr) => {
  64. const rawPrefix = UrlPath.getBaseUrl()
  65. const prefix = rawPrefix.replace(/\/+$/, '');
  66. const urlArray = urlStr.split(",").map(url => prefix + url);
  67. return urlArray
  68. }
  69. // 显示图片
  70. const showImage=(urlStr)=>{
  71. if (!urlStr)return
  72. const rawPrefix = UrlPath.getBaseUrl()
  73. const prefix = rawPrefix.replace(/\/+$/, '');
  74. const result = urlStr.map(url => {
  75. return prefix + url;
  76. });
  77. return result;
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .list_content{
  82. display: flex;
  83. padding: 10rpx 20rpx;
  84. .list_item{
  85. font-size: 15px;
  86. font-weight: 400;
  87. letter-spacing: 0px;
  88. line-height: 21.72px;
  89. color: rgba(102, 102, 102, 1);
  90. vertical-align: top;
  91. }
  92. .list_item_text{
  93. padding-right: 20rpx;
  94. padding-left: 30rpx;
  95. flex: 1;
  96. text-align: right;
  97. font-size: 15px;
  98. font-weight: 400;
  99. letter-spacing: 0.5px;
  100. line-height: 22px;
  101. color: rgba(51, 51, 51, 1);
  102. }
  103. }
  104. .measure_text{
  105. border:1px solid rgba(235, 237, 240, 1);
  106. ::v-deep .uni-textarea-placeholder{
  107. font-size: 14px;
  108. color: rgba(153, 153, 153, 1);
  109. }
  110. .measure_text_input{
  111. padding: 20rpx;
  112. }
  113. }
  114. </style>