maintenanceTaks.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <template>
  2. <view class="jpmain " >
  3. <u-navbar title="维修结果" title-color="#101010"></u-navbar>
  4. <u-picker mode="time" v-model="completionTimeShow"
  5. @confirm="completionTimeConfirm" :default-time="taskInfo.completionTime"
  6. :params="params"></u-picker>
  7. <view class="list" >
  8. <view class="item">
  9. <view class="name">
  10. 问题类型
  11. </view>
  12. <view class="value">
  13. <span v-if="floorlockErrorRecord.type" :class="'typeN typeN'+floorlockErrorRecord.type">
  14. {{floorlockErrorRecord.typeN}}
  15. </span>
  16. {{floorlockErrorRecord.errorCodeText}}
  17. </view>
  18. </view>
  19. <view class="item item-plus" v-if="floorlockErrorRecord.errorDesc">
  20. <view class="name">
  21. 问题描述
  22. </view>
  23. <view class="value">
  24. {{floorlockErrorRecord.errorDesc}}
  25. </view>
  26. </view>
  27. <view class="item item-plus" v-if="imgList.length">
  28. <view class="name">
  29. 照片
  30. </view>
  31. <view class="value" style="display: block;">
  32. <img class="viewImg" v-for="(item,i) in imgList"
  33. @click="previewImage(i,'imgList')"
  34. :key="i"
  35. :src="item" mode=""></img>
  36. </view>
  37. </view>
  38. <view class="item">
  39. <view class="name">
  40. 创建时间
  41. </view>
  42. <view class="value">
  43. {{floorlockErrorRecord.createTime}}
  44. </view>
  45. </view>
  46. <view class="item" v-if="floorlockErrorRecord.type==2">
  47. <view class="name">
  48. 上报人
  49. </view>
  50. <view class="value">
  51. {{floorlockErrorRecord.createByName}}
  52. </view>
  53. </view>
  54. </view>
  55. <view class="list" >
  56. <view class="item" @click="gotoUrl('/pages/lockTab/dataLock?id='+floorlockInfo.id)" >
  57. <view class="name">
  58. 地锁编号
  59. </view>
  60. <view class="value valueplus">
  61. {{floorlockInfo.lockNo}}
  62. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  63. </view>
  64. </view>
  65. <view class="item">
  66. <view class="name">
  67. 地锁名称
  68. </view>
  69. <view class="value">
  70. {{floorlockInfo.name}}
  71. </view>
  72. </view>
  73. <view class="item">
  74. <view class="name">
  75. 所属停车场
  76. </view>
  77. <view class="value valueplus" @click="navigate">
  78. <view>{{parkingInfo.name}}</view>
  79. <image class="img" v-if="parkingInfo.latitude&&parkingInfo.longitude"
  80. src="@/assets/img/daohuang.png" mode=""></image>
  81. </view>
  82. </view>
  83. <view class="item" v-if="parkingInfo.address">
  84. <view class="name">
  85. 详细地址
  86. </view>
  87. <view class="value">
  88. {{parkingInfo.address}}
  89. </view>
  90. </view>
  91. </view>
  92. <view class="list" >
  93. <view class="item" >
  94. <view class="name">
  95. 处理时间
  96. </view>
  97. <view class="value" v-if="floorlockErrorRecord.status!=0">
  98. {{floorlockErrorRecord.updateTime}}
  99. </view>
  100. <view class="value valueplus"
  101. @click="completionTimeShow=true"
  102. v-else>
  103. {{taskInfo.completionTime}}
  104. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  105. </view>
  106. </view>
  107. <view class="item item-plus" >
  108. <view class="name">
  109. 处理结果
  110. </view>
  111. <view class="value" v-if="floorlockErrorRecord.status==0" >
  112. <textarea placeholder="请记录处理步骤及结果"
  113. placeholder-class="textareaclass"
  114. v-model="taskInfo.desc"
  115. class="textarea"></textarea>
  116. </view>
  117. <view class="value" v-else >
  118. <textarea placeholder=""
  119. placeholder-class="textareaclass"
  120. v-model="floorlockErrorRecord.repairDesc"
  121. class="textarea"></textarea>
  122. </view>
  123. </view>
  124. <view class="item item-plus" >
  125. <view class="name">
  126. 现场照片
  127. </view>
  128. <view class="value" v-if="floorlockErrorRecord.status==0" >
  129. <u-upload name="photoFile"
  130. ref="uUpload"
  131. :form-data="formData" :header="header" :action="action"
  132. :file-list="listPic" ></u-upload>
  133. </view>
  134. <view class="value" v-else >
  135. <img class="viewImg" v-for="(item,i) in repairImageList"
  136. @click="previewImage(i,'repairImageList')"
  137. :key="i"
  138. :src="item" mode=""></img>
  139. </view>
  140. </view>
  141. <view class="item" v-if="floorlockErrorRecord.status!=0">
  142. <view class="name">
  143. 处理人
  144. </view>
  145. <view class="value">
  146. {{floorlockErrorRecord.updateByName}}
  147. </view>
  148. </view>
  149. </view>
  150. <view class="floating-button" v-if="floorlockErrorRecord.status==0" >
  151. <view class="button" @click="submit" >
  152. 提交
  153. </view>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import * as API from '@/apis/pagejs/pagesTask.js'
  159. import * as WxJsApi from '@/apis/utils/wxJsApi.js'
  160. import {
  161. currentTimeStamp,
  162. parseUnixTime
  163. } from '@/apis/utils'
  164. export default {
  165. data() {
  166. return {
  167. listPic: [],
  168. action:"",
  169. formData:{
  170. },
  171. header:{
  172. },
  173. params: {
  174. year: true,
  175. month: true,
  176. day: true,
  177. hour: true,
  178. minute: true,
  179. second: true,
  180. timestamp: true,
  181. },
  182. codeN:"",
  183. selectTaskInfoCode:false,
  184. selectTaskInfoCodeValue:[0],
  185. lockNo:"",
  186. lockName:"",
  187. floorlockInfo:{},
  188. floorlockErrorRecord:{},
  189. parkingInfo:{},
  190. taskInfo:{
  191. id:"",
  192. desc:"",
  193. images:"",
  194. completionTime:"",
  195. },
  196. codeList:[],
  197. id:"",
  198. imgList:[],
  199. repairImageList:[],
  200. completionTimeShow:false,
  201. };
  202. },
  203. onLoad(op) {
  204. this.action=process.jphelp.BASE_URL+"uploadPicture"
  205. this.formData.subFolder="/floorlock/inspection/updateErr"
  206. var token=this.jphelp.getToken()
  207. this.header={
  208. 'Authorization':token
  209. }
  210. this.id=op.id
  211. this.taskInfo.completionTime= parseUnixTime(currentTimeStamp())
  212. this.errDetails()
  213. },
  214. onReady() {
  215. WxJsApi.getWxConfig([ 'openLocation']).then((res) => {
  216. // //(res)
  217. }).catch(error => {
  218. //(res)
  219. })
  220. },
  221. methods:{
  222. completionTimeConfirm(e){
  223. console.log(e)
  224. this.taskInfo.completionTime= parseUnixTime(new Date(e.timestamp* 1000))
  225. },
  226. previewImage(i,name) {
  227. let imgs = this[name];
  228. //imgs.push(img);
  229. uni.previewImage({
  230. urls: imgs,
  231. current: i
  232. })
  233. },
  234. navigate() {
  235. var item=this.parkingInfo
  236. if(!(this.parkingInfo.latitude&&this.parkingInfo.longitude)){
  237. return
  238. }
  239. //console.log(item)
  240. uni.showLoading({
  241. })
  242. setTimeout(()=>{
  243. uni.hideLoading()
  244. },3*1000)
  245. WxJsApi.openLocation({
  246. latitude: parseFloat(item.latitude), //目的地latitude
  247. longitude: parseFloat(item.longitude), //目的地longitude
  248. name: item.name,
  249. address: item.address,
  250. scale: 15, //地图缩放大小,可根据情况具体调整
  251. success(res) {
  252. uni.hideLoading()
  253. },
  254. complete() {
  255. // uni.hideLoading()
  256. }
  257. });
  258. // //('station'+JSON.stringify(_self.stationDetail.station))
  259. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  260. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  261. },
  262. errDetails(){
  263. uni.showLoading({
  264. title: "加载中",
  265. mask: true,
  266. })
  267. API.errDetails({
  268. id:this.id
  269. }).then((res) => {
  270. this.floorlockErrorRecord=res.data.floorlockErrorRecord
  271. this.floorlockInfo=res.data.floorlockInfo
  272. this.parkingInfo=res.data.parkingInfo
  273. if(this.floorlockErrorRecord.errorImage){
  274. this.imgList=this.floorlockErrorRecord.errorImage.split(',')
  275. }
  276. if(this.floorlockErrorRecord.repairImage){
  277. this.repairImageList=this.floorlockErrorRecord.repairImage.split(',')
  278. }
  279. uni.hideLoading();
  280. }).catch(error => {
  281. uni.hideLoading();
  282. uni.showToast({
  283. title: error,
  284. icon: "none"
  285. })
  286. })
  287. },
  288. submitApi(){
  289. let files = [];
  290. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  291. files = this.$refs.uUpload.lists.filter(val => {
  292. return val.progress == 100;
  293. })
  294. // 如果您不需要进行太多的处理,直接如下即可
  295. // files = this.$refs.uUpload.lists;
  296. //(files);
  297. var imgUrl=files.map(item=>{
  298. return item.response.data;
  299. })
  300. //(imgUrl);
  301. this.taskInfo.images = imgUrl.join(',');
  302. this.taskInfo.id=this.id;
  303. uni.showLoading({
  304. title: "加载中",
  305. mask: true,
  306. })
  307. API.updateErr(this.taskInfo).then((res) => {
  308. const eventChannel = this.getOpenerEventChannel();
  309. eventChannel.emit('acceptDataFromOpenerPage', {})
  310. uni.showModal({
  311. title: '提示',
  312. showCancel: false,
  313. content: "操作成功",
  314. success: res1 => {
  315. if (res1.confirm) {
  316. uni.navigateBack()
  317. } else if (res1.cancel) {
  318. //('用户点击取消');
  319. }
  320. }
  321. })
  322. uni.hideLoading();
  323. }).catch(error => {
  324. uni.hideLoading();
  325. uni.showToast({
  326. title: error,
  327. icon: "none"
  328. })
  329. })
  330. },
  331. submit(){
  332. if(!this.taskInfo.desc){
  333. uni.showModal({
  334. title: '提示',
  335. showCancel: true,
  336. cancelText:"返回填写",
  337. confirmText:"继续提交",
  338. content: "未填写处理步骤,是否继续提交",
  339. success: res1 => {
  340. if (res1.confirm) {
  341. this.submitApi()
  342. } else if (res1.cancel) {
  343. //('用户点击取消');
  344. }
  345. }
  346. })
  347. }else{
  348. this.submitApi()
  349. }
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss">
  355. .jpmain{padding-bottom: 120rpx;}
  356. .list{
  357. background-color: rgba(255,255,255,1);
  358. margin: 20rpx 0;
  359. .item:not(:last-child) {
  360. border-bottom:1px solid rgba(232,232,232,1);
  361. }
  362. .item{
  363. padding: 24rpx;
  364. display: flex;
  365. justify-content: space-between;
  366. .name{
  367. width: 40%;
  368. font-size: 32rpx;
  369. color: #777777;
  370. span{
  371. color:red
  372. }
  373. white-space: pre;
  374. }
  375. .valueplus{
  376. display: flex;
  377. justify-content: space-between;
  378. }
  379. .value{
  380. font-size: 32rpx;
  381. width: 60%;
  382. display: flex;
  383. align-items: center;
  384. input::placeholder{
  385. color:#AAAAAA;
  386. }
  387. .img{
  388. width: 40rpx;
  389. height: 40rpx;
  390. }
  391. .textarea{
  392. background-color: rgba(241,242,245,1);
  393. width: 100%;
  394. border-radius: 4px;
  395. }
  396. .typeN{
  397. font-size: 24rpx;
  398. margin-right: 8rpx;
  399. display: flex;
  400. align-items: center;
  401. border-radius: 4px;
  402. padding: 2px 8rpx;
  403. color: #fff;
  404. }
  405. .typeN1{
  406. background-color:#1677ff;
  407. //border: 1px solid #1677ff;
  408. }
  409. .typeN2{
  410. background-color:#19be6b;
  411. //border: 1px solid #19be6b;
  412. }
  413. }
  414. }
  415. .item-plus{
  416. flex-direction: column;
  417. .value,.name{
  418. width: 100%;
  419. }
  420. .name{
  421. padding-bottom: 32rpx;
  422. }
  423. }
  424. }
  425. .textareaclass{
  426. padding:16rpx
  427. }
  428. .floating-button {
  429. position: fixed;
  430. bottom: 0; /* 距离底部 20px */
  431. width: 100%;
  432. display: flex;
  433. height: 120rpx;
  434. justify-content: center;
  435. background-color: rgba(255,255,255,1);
  436. .button{
  437. margin-top: 24rpx;
  438. border-radius: 50px;
  439. height: 80rpx;
  440. width: 80%;
  441. display: flex;
  442. align-items: center;
  443. justify-content: center;
  444. padding:12rpx;
  445. background-color: rgba(22,119,255,1);
  446. color: rgba(255,255,255,1);
  447. font-size: 36rpx;
  448. }
  449. }
  450. .viewImg{
  451. width: 160rpx;
  452. height: 160rpx;
  453. }
  454. </style>