write-back.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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="500"
  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: []
  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'] ? this.values['filePath'].split(',') : [];
  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. let requestParams = {};
  87. this.btnInfo.params.map(item => {
  88. if(item.valueKey){
  89. requestParams[item.paramsKey] = (
  90. item.isOutvalueKey
  91. ? this.missionDetails
  92. : this.btnInfo
  93. )[item.valueKey];
  94. }else if(item.value){
  95. requestParams[item.paramsKey] = item.value;
  96. }else {
  97. switch(item.paramsKey){
  98. case 'imgPath': // 上传图片
  99. requestParams[item.paramsKey] = this.filePath.join(',');
  100. break;
  101. case 'textarea': // 回复内容
  102. requestParams[item.paramsKey] = this.value;
  103. break;
  104. default:
  105. requestParams[item.paramsKey] = '';
  106. break;
  107. }
  108. }
  109. });
  110. this.$emit('comRequest', requestParams);
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="less">
  116. .write-back-page {
  117. height: 100%;
  118. padding-top: 15rpx;
  119. .scroll-y {
  120. height: calc(100% - 102rpx);
  121. .item-box {
  122. display: flex;
  123. background-color: #FFFFFF;
  124. border-bottom: 0.62rpx solid #DADEE6;
  125. padding: 25rpx 0;
  126. padding-left: 25rpx;
  127. .label-view {
  128. width: 175rpx;
  129. line-height: 37.5rpx;
  130. >text {
  131. font-size: 22.5rpx;
  132. color: #666F80;
  133. }
  134. }
  135. .textarea {
  136. width: 100%;
  137. min-height: 587.5rpx;
  138. background-color: #fff;
  139. padding: 0 25rpx;
  140. line-height: 37.5rpx;
  141. font-size: 22.5rpx;
  142. color: #525866;
  143. box-sizing: border-box;
  144. }
  145. }
  146. }
  147. }
  148. </style>