write-back.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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" placeholder="请输入" placeholder-style="color: #B8BECC" :maxlength="500"
  9. :disabled="disabled" auto-height :value="disabled ? values['textarea'] : value"
  10. @input="changeValue" />
  11. </view>
  12. <tm-upload-img :filePaths="filePath" :isMultiple="true" :disabled="disabled"
  13. @changeFilePaths="changeFilePaths" />
  14. </scroll-view>
  15. <view class="fixed-buttom-btn" v-if="!disabled" @click="sure">
  16. <text class="btn-text">确定</text>
  17. </view>
  18. <!-- <view class="bottomBtn" @click="goToPrevPage" v-if="disabled">返回改善任务详情</view> -->
  19. </view>
  20. </template>
  21. <script>
  22. // 改善回复
  23. export default {
  24. props: {
  25. // 是否禁用
  26. disabled: {
  27. type: Boolean,
  28. default: false
  29. },
  30. // 详情回显的数据
  31. values: {
  32. type: Object,
  33. default: () => {
  34. return {}
  35. }
  36. },
  37. // 按钮信息 (包过请求的key)
  38. btnInfo: {
  39. type: Object,
  40. default: () => {
  41. return {}
  42. }
  43. },
  44. // 任务详情
  45. missionDetails: {
  46. type: Object,
  47. default: () => {
  48. return {}
  49. }
  50. }
  51. },
  52. data() {
  53. return {
  54. value: '',
  55. filePath: []
  56. }
  57. },
  58. created() {
  59. uni.setNavigationBarTitle({
  60. title: '原因'
  61. });
  62. if (this.disabled) {
  63. this.value = this.values['textarea'];
  64. this.filePath = this.values['filePath'] ? this.values['filePath'].split(',') : [];
  65. }
  66. },
  67. methods: {
  68. changeValue(e) {
  69. this.value = e.detail.value;
  70. },
  71. goToPrevPage(){
  72. // window.history.back();
  73. uni.navigateBack({
  74. delta: 1
  75. });
  76. },
  77. /**
  78. * @param {{
  79. files
  80. index,
  81. }} fileInfo
  82. files:文件集合
  83. index:当前编辑的下标
  84. */
  85. changeFilePaths({files}) {
  86. this.filePath = files;
  87. },
  88. sure() {
  89. let requestParams = {};
  90. let _value = this.value;
  91. this.btnInfo.params.map(item => {
  92. if (item.valueKey) {
  93. requestParams[item.paramsKey] = (
  94. item.isOutvalueKey ?
  95. this.missionDetails :
  96. this.btnInfo
  97. )[item.valueKey];
  98. } else if (item.value) {
  99. requestParams[item.paramsKey] = item.value;
  100. } else {
  101. switch (item.paramsKey) {
  102. case 'improveUrl': // 上传图片
  103. requestParams[item.paramsKey] = this.filePath.join(',');
  104. break;
  105. case 'improveUrl': // 上传图片
  106. requestParams[item.paramsKey] = this.filePath.join(',');
  107. break;
  108. case 'textarea': // 回复内容
  109. requestParams[item.paramsKey] = this.value;
  110. break;
  111. case 'approveReason': // 单位负责人改善回复内容
  112. requestParams[item.paramsKey] = this.value;
  113. break;
  114. default:
  115. requestParams[item.paramsKey] = '';
  116. break;
  117. }
  118. }
  119. });
  120. this.$emit('comRequest', requestParams);
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="less">
  126. .write-back-page {
  127. height: 100%;
  128. padding-top: 15rpx;
  129. .scroll-y {
  130. height: calc(100% - 102rpx);
  131. .item-box {
  132. display: flex;
  133. background-color: #FFFFFF;
  134. border-bottom: 0.62rpx solid #DADEE6;
  135. padding: 25rpx 0;
  136. padding-left: 25rpx;
  137. .label-view {
  138. width: 175rpx;
  139. line-height: 37.5rpx;
  140. >text {
  141. font-size: 22.5rpx;
  142. color: #666F80;
  143. }
  144. }
  145. .textarea {
  146. width: 100%;
  147. min-height: 587.5rpx;
  148. background-color: #fff;
  149. padding: 0 25rpx;
  150. line-height: 37.5rpx;
  151. font-size: 22.5rpx;
  152. color: #525866;
  153. box-sizing: border-box;
  154. }
  155. }
  156. }
  157. .bottomBtn {
  158. position: fixed;
  159. bottom: 0;
  160. width: 100%;
  161. height: 75rpx;
  162. line-height: 75rpx;
  163. text-align: center;
  164. font-size: 22.5rpx;
  165. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  166. font-weight: 400;
  167. color: #FFFFFF;
  168. background: #3377FF;
  169. }
  170. }
  171. </style>