repairDetail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view>
  3. <form action="">
  4. <view style='height:30rpx'></view>
  5. <view class="form-item">
  6. <view class="title">
  7. 报修地址:
  8. </view>
  9. <view>{{this.getData.address}}</view>
  10. <!-- <input type="text" v-model="this.getData.address"> -->
  11. </view>
  12. <view class="form-item margin-top">
  13. <view class="title">
  14. 故障状态:
  15. </view>
  16. <view>{{this.getData.type_name}}</view>
  17. </view>
  18. <view class="form-item margin-top">
  19. <view class="title">
  20. 处理状态:
  21. </view>
  22. <view style="color:#FDCA60" v-if="cl_type==1">未处理</view>
  23. <view style="color:#59D1EA" v-if="cl_type==2">未审核</view>
  24. <view style="color:#F77070" v-if="cl_type==3">未通过</view>
  25. <view style="color:#72D06A" v-if="cl_type==4" >已完成</view>
  26. <view style="color:#F7895E" v-if="cl_type==5">超时完成</view>
  27. </view>
  28. <view v-if="cl_type!=1&&cl_type!=2" >
  29. <view class="form-item margin-top flex justify-between" @click="detailClick()">
  30. <view style="position:relative;display:block;color:#007AFF">
  31. 处理记录:
  32. </view>
  33. <text class="icon iconfont margin-right-xs margin-left-lg">{{showDetail?'&#xe63d;':'&#xe629;'}}</text>
  34. </view>
  35. <block v-for="(item,index) in getData2" :key="index" v-if="showDetail" >
  36. <view class="form-item" style="color:#aaa">
  37. <view class="title">图片:</view>
  38. <img :src="imgFront+item.picture_path" alt="" style="max-width:50%">
  39. </view>
  40. <view class="form-item" style="color:#aaa">
  41. <view class="title">处理时间:</view>
  42. <view>{{item.cl_time}}</view>
  43. </view>
  44. <view class="form-item" style="color:#aaa">
  45. <view class="title">处理结果:</view>
  46. <view>{{item.jg_remarks}}</view>
  47. </view>
  48. </block>
  49. </view>
  50. <view v-if="cl_type==1||cl_type==3">
  51. <view class="form-item margin-top">
  52. <view class="title">
  53. <text class="necessary">*</text>
  54. 上传图片:
  55. </view>
  56. <view class="unload-box" @tap="goCamera()">
  57. <image v-if="this.imgUrl" mode="aspectFit" style="width:70rpx;height:70rpx" :src="this.imgUrl"
  58. :data-src="this.imgUrl"></image>
  59. <view v-else
  60. style="background:rgb(223 215 215 / 63%);font-size:22rpx;line-height:40rpx;margin-top:20rpx;padding:0 20px;display:inline-block;border-radius:10rpx">
  61. 请上传 + </view>
  62. </view>
  63. </view>
  64. <view class="form-item margin-top" style="padding-bottom: 200rpx;">
  65. <view class="title">
  66. <text class="necessary">*</text>
  67. 报修描述:
  68. </view>
  69. <textarea maxlength="-1" @input="textareaAInput" placeholder="" v-model="msg" width="250"></textarea>
  70. </view>
  71. <view class="btn-area submitBottomBtn padding-lr-sm">
  72. <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
  73. </view>
  74. </view>
  75. </form>
  76. <helang-compress ref="helangCompress"></helang-compress>
  77. </view>
  78. </template>
  79. <script>
  80. import helangCompress from '../../../components/helang-compress/helang-compress';
  81. export default {
  82. components: {
  83. helangCompress
  84. },
  85. data() {
  86. return {
  87. getData:{},
  88. getData2:[],
  89. imgFront:'',
  90. msg: '',
  91. id: '',
  92. reportName: '',
  93. radioOne: 0,
  94. zb_id: 0,
  95. cl_type:'',
  96. imgUrl: '',
  97. // reportName: '',
  98. // radioOne: 0,
  99. // zb_id: 0,
  100. params: {
  101. maxSize: 800,
  102. fileType: 'png',
  103. quality: 0.85,
  104. minSize: 640
  105. },
  106. showDetail:true,
  107. }
  108. },
  109. onLoad: function(option) {
  110. if(option.cl_type==1||option.cl_type==3){
  111. this.showDetail=false
  112. }
  113. this.imgFront=this.$websiteUrl
  114. this.id = option.id;
  115. this.zb_id = option.zb_id,
  116. this.cl_type=option.cl_type
  117. this.getRepairDetail({'company_code':uni.getStorageSync('selectedCode'),"id":option.id})
  118. this.getRepairDetail2({'company_code':uni.getStorageSync('selectedCode'),"event_processing_id":option.id})
  119. },
  120. mounted() {
  121. },
  122. methods: {
  123. detailClick(){
  124. this.showDetail=!this.showDetail
  125. // alert(this.showDetail)
  126. },
  127. radioChange(e) {
  128. console.log('type:' + e.detail.value);
  129. this.radioOne = e.detail.value;
  130. },
  131. //回显请求
  132. async getRepairDetail(params = {}) {
  133. const res = await this.$myRequest({
  134. url: 'Repair/getFormData',
  135. data:params,
  136. showLoading: true
  137. })
  138. this.getData=res.data.data[0];
  139. console.log(this.getData)
  140. },
  141. //回显请求 记录回显
  142. async getRepairDetail2(params = {}) {
  143. const res = await this.$myRequest({
  144. url: 'Repair/getRecordDetails',
  145. data:params,
  146. showLoading: true
  147. })
  148. this.getData2=res.data.data;
  149. console.log('this.getData2')
  150. console.log(this.getData2)
  151. },
  152. goCamera() {
  153. const that = this;
  154. uni.chooseImage({
  155. count: 1, // 最多可以选择的图片张数
  156. sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
  157. sourceType: ['camera', 'album'],
  158. success: function(res) {
  159. console.log(res);
  160. that.imgUrl = res.tempFilePaths[0];
  161. var tempFilePaths = res.tempFilePaths[0];
  162. that.$refs.helangCompress.compress({
  163. src: tempFilePaths,
  164. maxSize: that.params.maxSize,
  165. fileType: that.params.fileType,
  166. quality: that.params.quality,
  167. minSize: that.params.minSize
  168. }).then((res) => {
  169. uni.hideLoading();
  170. // uni.showToast({
  171. // title: "压缩成功",
  172. // icon: "success"
  173. // })
  174. tempFilePaths = [res][0];
  175. uni.uploadFile({
  176. url: that.$BASE_URL + 'Inspection/setUpload',
  177. filePath: tempFilePaths,
  178. name: 'file',
  179. success: (uploadFileRes) => {
  180. uni.showToast({
  181. title: "上传成功",
  182. icon: "success"
  183. })
  184. that.img = JSON.parse(uploadFileRes.data).img_url;
  185. }
  186. });
  187. }).catch((err) => {
  188. uni.hideLoading();
  189. uni.showToast({
  190. title: "压缩失败",
  191. icon: "none"
  192. })
  193. })
  194. }
  195. })
  196. },
  197. addSubmit() {
  198. if (!this.img) {
  199. uni.showToast({
  200. title: "请上传图片",
  201. icon: "none"
  202. });
  203. return
  204. }
  205. if (!this.msg) {
  206. uni.showToast({
  207. title: "请输入报修描述",
  208. icon: "none"
  209. });
  210. return
  211. }
  212. this.powerSubmitRes({
  213. "id": this.id,
  214. "img": this.img,
  215. "remarks": this.msg,
  216. })
  217. },
  218. async powerSubmitRes(params = {}) {
  219. const res = await this.$myRequest({
  220. url: 'Repair/setRepair',
  221. data: params
  222. })
  223. if (res.data.flag) {
  224. uni.showToast({
  225. title: "提交成功",
  226. });
  227. setTimeout(() => {
  228. uni.navigateTo({
  229. url: '/pages/repair/repair',
  230. });
  231. }, 1000);
  232. }
  233. },
  234. textareaAInput(e) {
  235. this.textareaAValue = e.detail.value
  236. },
  237. }
  238. }
  239. </script>
  240. <style scoped>
  241. .form-item .title{
  242. width:180rpx!important
  243. }
  244. </style>