write-back.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="write-back-page">
  3. <scroll-view class="scroll-y" scroll-y="true" >
  4. <view class="item-box">
  5. <view class="label-view">
  6. <text>回复内容</text>
  7. </view>
  8. <textarea class="textarea"
  9. placeholder="请输入"
  10. placeholder-style="color: #B8BECC"
  11. :maxlength="-1"
  12. :disabled="disabled"
  13. auto-height
  14. :value="disabled ? values['textarea'] : value"
  15. @input="changeValue"
  16. />
  17. </view>
  18. <tm-upload-img
  19. :filePaths="filePath"
  20. :isMultiple="true"
  21. :disabled="disabled"
  22. @changeFilePaths="changeFilePaths"
  23. />
  24. </scroll-view>
  25. <view class="fixed-buttom-btn"
  26. v-if="!disabled"
  27. @click="sure">
  28. <text class="btn-text">确定</text>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. // 改善回复
  34. export default {
  35. props: {
  36. // 是否禁用
  37. disabled: {
  38. type: Boolean,
  39. default: false
  40. },
  41. // 详情回显的数据
  42. values: {
  43. type: Object,
  44. default: () => {
  45. return {}
  46. }
  47. },
  48. // 按钮信息 (包过请求的key)
  49. btnInfo: {
  50. type: Object,
  51. default: () => {
  52. return {}
  53. }
  54. },
  55. // 任务详情
  56. missionDetails: {
  57. type: Object,
  58. default: () => {
  59. return {}
  60. }
  61. }
  62. },
  63. data() {
  64. return {
  65. value: '',
  66. filePath: ['/static/img-icon.png', '/static/img-icon.png']
  67. }
  68. },
  69. created() {
  70. uni.setNavigationBarTitle({
  71. title: '原因'
  72. });
  73. if(this.disabled) {
  74. this.value = this.values['textarea'];
  75. this.filePath = this.values['filePath'] || [];
  76. }
  77. },
  78. methods: {
  79. changeValue(e) {
  80. this.value = e.detail.value;
  81. },
  82. changeFilePaths(filePath) {
  83. this.filePath = filePath;
  84. },
  85. sure() {
  86. const { params } = this.btnInfo;
  87. let requestParams = {};
  88. params.map(item => {
  89. if(item.valueKey){
  90. requestParams[item.paramsKey] = (item.isOutvalueKey ? this.missionDetails : this.btnInfo)[item.valueKey];
  91. }else {
  92. if(item.paramsKey === 'imgPath'){ // 上传图片
  93. requestParams[item.paramsKey] = this.filePath.join(',');
  94. }else {
  95. requestParams[item.paramsKey] = this.value;
  96. }
  97. }
  98. })
  99. this.$emit('comRequest', requestParams);
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="less">
  105. .write-back-page {
  106. height: 100%;
  107. padding-top: 15rpx;
  108. .scroll-y {
  109. height: calc(100% - 102rpx);
  110. .item-box {
  111. display: flex;
  112. background-color: #FFFFFF;
  113. border-bottom: 0.62rpx solid #DADEE6;
  114. padding: 25rpx 0;
  115. padding-left: 25rpx;
  116. .label-view {
  117. width: 175rpx;
  118. line-height: 37.5rpx;
  119. >text {
  120. font-size: 22.5rpx;
  121. color: #666F80;
  122. }
  123. }
  124. .textarea {
  125. width: 100%;
  126. min-height: 587.5rpx;
  127. background-color: #fff;
  128. padding: 0 25rpx;
  129. line-height: 37.5rpx;
  130. font-size: 22.5rpx;
  131. color: #525866;
  132. box-sizing: border-box;
  133. }
  134. }
  135. }
  136. }
  137. </style>