write-back.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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 'imgPath': // 上传图片
  103. requestParams[item.paramsKey] = this.filePath.join(',');
  104. break;
  105. case 'textarea': // 回复内容
  106. requestParams[item.paramsKey] = this.value;
  107. break;
  108. case 'approveReason': // 单位负责人改善回复内容
  109. requestParams[item.paramsKey] = this.value;
  110. break;
  111. default:
  112. requestParams[item.paramsKey] = '';
  113. break;
  114. }
  115. }
  116. });
  117. this.$emit('comRequest', requestParams);
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less">
  123. .write-back-page {
  124. height: 100%;
  125. padding-top: 15rpx;
  126. .scroll-y {
  127. height: calc(100% - 102rpx);
  128. .item-box {
  129. display: flex;
  130. background-color: #FFFFFF;
  131. border-bottom: 0.62rpx solid #DADEE6;
  132. padding: 25rpx 0;
  133. padding-left: 25rpx;
  134. .label-view {
  135. width: 175rpx;
  136. line-height: 37.5rpx;
  137. >text {
  138. font-size: 22.5rpx;
  139. color: #666F80;
  140. }
  141. }
  142. .textarea {
  143. width: 100%;
  144. min-height: 587.5rpx;
  145. background-color: #fff;
  146. padding: 0 25rpx;
  147. line-height: 37.5rpx;
  148. font-size: 22.5rpx;
  149. color: #525866;
  150. box-sizing: border-box;
  151. }
  152. }
  153. }
  154. .bottomBtn {
  155. position: fixed;
  156. bottom: 0;
  157. width: 100%;
  158. height: 75rpx;
  159. line-height: 75rpx;
  160. text-align: center;
  161. font-size: 22.5rpx;
  162. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  163. font-weight: 400;
  164. color: #FFFFFF;
  165. background: #3377FF;
  166. }
  167. }
  168. </style>