maintenanceTaks.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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/station/stationInfo?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 item-plus" >
  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 "
  101. v-else>
  102. <u-checkbox-group >
  103. <u-checkbox
  104. v-model="item.checked"
  105. v-for="(item, index) in listcheckbox" :key="index"
  106. :name="item.name"
  107. >{{item.name}}</u-checkbox>
  108. </u-checkbox-group>
  109. </view>
  110. </view>
  111. <view class="item item-plus" style=" align-items: center;" >
  112. <view class="name">
  113. 处理时间
  114. </view>
  115. <view class="value" v-if="floorlockErrorRecord.status!=0">
  116. {{floorlockErrorRecord.updateTime}}
  117. </view>
  118. <view class="value "
  119. @click="completionTimeShow=true"
  120. v-else>
  121. <view class="valueclock">
  122. <u-icon name="clock" size="32" color="#BBBBBB"></u-icon>
  123. {{taskInfo.completionTime}}
  124. </view>
  125. </view>
  126. </view>
  127. <view class="item item-plus" >
  128. <view class="name">
  129. 维修方式
  130. </view>
  131. <view class="value" v-if="floorlockErrorRecord.status!=0">
  132. {{floorlockErrorRecord.updateTime}}
  133. </view>
  134. <view class="value "
  135. v-else>
  136. <u-radio-group v-model="value" @change="radioGroupChange">
  137. <u-radio
  138. v-for="(item, index) in listradio" :key="index"
  139. :name="item.name"
  140. >
  141. {{item.name}}
  142. </u-radio>
  143. </u-radio-group>
  144. </view>
  145. </view>
  146. <view class="item item-plus" >
  147. <view class="name">
  148. 处理结果
  149. </view>
  150. <view class="value" v-if="floorlockErrorRecord.status==0" >
  151. <textarea placeholder="请记录处理步骤及结果"
  152. placeholder-class="textareaclass"
  153. style=" height: 100px;"
  154. v-model="taskInfo.desc"
  155. class="textarea"></textarea>
  156. </view>
  157. <view class="value" v-else >
  158. <textarea style=" height: 100px;"
  159. placeholder=""
  160. placeholder-class="textareaclass"
  161. v-model="floorlockErrorRecord.repairDesc"
  162. class="textarea"></textarea>
  163. </view>
  164. </view>
  165. <view class="item item-plus" >
  166. <view class="name">
  167. 现场照片
  168. </view>
  169. <view class="value" v-if="floorlockErrorRecord.status==0" >
  170. <u-upload name="photoFile"
  171. ref="uUpload"
  172. :form-data="formData" :header="header" :action="action"
  173. :file-list="listPic" ></u-upload>
  174. </view>
  175. <view class="value" v-else >
  176. <img class="viewImg" v-for="(item,i) in repairImageList"
  177. @click="previewImage(i,'repairImageList')"
  178. :key="i"
  179. :src="item" mode=""></img>
  180. </view>
  181. </view>
  182. </view>
  183. <view class="floating-button" v-if="floorlockErrorRecord.status==0" >
  184. <view class="button" @click="submit" >
  185. 提交
  186. </view>
  187. </view>
  188. </view>
  189. </template>
  190. <script>
  191. import * as API from '@/apis/pagejs/pagesTask.js'
  192. import * as WxJsApi from '@/apis/utils/wxJsApi.js'
  193. import {
  194. currentTimeStamp,
  195. parseUnixTime
  196. } from '@/apis/utils'
  197. export default {
  198. data() {
  199. return {
  200. listradio:[
  201. {
  202. name: '重启',
  203. disabled: false
  204. },
  205. {
  206. name: '更换设备',
  207. disabled: false
  208. },
  209. {
  210. name: '其他',
  211. disabled: false
  212. }
  213. ],
  214. listcheckbox:[
  215. {
  216. name: 'apple',
  217. checked: false,
  218. disabled: false
  219. },
  220. {
  221. name: 'banner',
  222. checked: false,
  223. disabled: false
  224. },
  225. {
  226. name: 'orange',
  227. checked: false,
  228. disabled: false
  229. }
  230. ],
  231. listPic: [],
  232. action:"",
  233. formData:{
  234. },
  235. header:{
  236. },
  237. params: {
  238. year: true,
  239. month: true,
  240. day: true,
  241. hour: true,
  242. minute: true,
  243. second: true,
  244. timestamp: true,
  245. },
  246. codeN:"",
  247. selectTaskInfoCode:false,
  248. selectTaskInfoCodeValue:[0],
  249. lockNo:"",
  250. lockName:"",
  251. floorlockInfo:{},
  252. floorlockErrorRecord:{},
  253. parkingInfo:{},
  254. taskInfo:{
  255. id:"",
  256. desc:"",
  257. images:"",
  258. completionTime:"",
  259. },
  260. codeList:[],
  261. id:"",
  262. imgList:[],
  263. repairImageList:[],
  264. completionTimeShow:false,
  265. };
  266. },
  267. onLoad(op) {
  268. this.action=process.jphelp.BASE_URL+"uploadPicture"
  269. this.formData.subFolder="/floorlock/inspection/updateErr"
  270. var token=this.jphelp.getToken()
  271. this.header={
  272. 'Authorization':token
  273. }
  274. this.id=op.id
  275. this.taskInfo.completionTime= parseUnixTime(currentTimeStamp())
  276. this.errDetails()
  277. },
  278. onReady() {
  279. WxJsApi.getWxConfig([ 'openLocation']).then((res) => {
  280. // //(res)
  281. }).catch(error => {
  282. //(res)
  283. })
  284. },
  285. methods:{
  286. // 选中任一radio时,由radio-group触发
  287. radioGroupChange(e) {
  288. console.log(e);
  289. },
  290. completionTimeConfirm(e){
  291. console.log(e)
  292. this.taskInfo.completionTime= parseUnixTime(new Date(e.timestamp* 1000))
  293. },
  294. previewImage(i,name) {
  295. let imgs = this[name];
  296. //imgs.push(img);
  297. uni.previewImage({
  298. urls: imgs,
  299. current: i
  300. })
  301. },
  302. navigate() {
  303. var item=this.parkingInfo
  304. if(!(this.parkingInfo.latitude&&this.parkingInfo.longitude)){
  305. return
  306. }
  307. //console.log(item)
  308. uni.showLoading({
  309. })
  310. setTimeout(()=>{
  311. uni.hideLoading()
  312. },3*1000)
  313. WxJsApi.openLocation({
  314. latitude: parseFloat(item.latitude), //目的地latitude
  315. longitude: parseFloat(item.longitude), //目的地longitude
  316. name: item.name,
  317. address: item.address,
  318. scale: 15, //地图缩放大小,可根据情况具体调整
  319. success(res) {
  320. uni.hideLoading()
  321. },
  322. complete() {
  323. // uni.hideLoading()
  324. }
  325. });
  326. // //('station'+JSON.stringify(_self.stationDetail.station))
  327. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  328. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  329. },
  330. errDetails(){
  331. uni.showLoading({
  332. title: "加载中",
  333. mask: true,
  334. })
  335. API.errDetails({
  336. id:this.id
  337. }).then((res) => {
  338. this.floorlockErrorRecord=res.data.floorlockErrorRecord
  339. this.floorlockInfo=res.data.floorlockInfo
  340. this.parkingInfo=res.data.parkingInfo
  341. if(this.floorlockErrorRecord.errorImage){
  342. this.imgList=this.floorlockErrorRecord.errorImage.split(',')
  343. }
  344. if(this.floorlockErrorRecord.repairImage){
  345. this.repairImageList=this.floorlockErrorRecord.repairImage.split(',')
  346. }
  347. uni.hideLoading();
  348. }).catch(error => {
  349. uni.hideLoading();
  350. uni.showToast({
  351. title: error,
  352. icon: "none"
  353. })
  354. })
  355. },
  356. submitApi(){
  357. let files = [];
  358. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  359. files = this.$refs.uUpload.lists.filter(val => {
  360. return val.progress == 100;
  361. })
  362. // 如果您不需要进行太多的处理,直接如下即可
  363. // files = this.$refs.uUpload.lists;
  364. //(files);
  365. var imgUrl=files.map(item=>{
  366. return item.response.data;
  367. })
  368. //(imgUrl);
  369. this.taskInfo.images = imgUrl.join(',');
  370. this.taskInfo.id=this.id;
  371. uni.showLoading({
  372. title: "加载中",
  373. mask: true,
  374. })
  375. API.updateErr(this.taskInfo).then((res) => {
  376. const eventChannel = this.getOpenerEventChannel();
  377. eventChannel.emit('acceptDataFromOpenerPage', {})
  378. uni.showModal({
  379. title: '提示',
  380. showCancel: false,
  381. content: "操作成功",
  382. success: res1 => {
  383. if (res1.confirm) {
  384. uni.navigateBack()
  385. } else if (res1.cancel) {
  386. //('用户点击取消');
  387. }
  388. }
  389. })
  390. uni.hideLoading();
  391. }).catch(error => {
  392. uni.hideLoading();
  393. uni.showToast({
  394. title: error,
  395. icon: "none"
  396. })
  397. })
  398. },
  399. submit(){
  400. if(!this.taskInfo.desc){
  401. uni.showModal({
  402. title: '提示',
  403. showCancel: true,
  404. cancelText:"返回填写",
  405. confirmText:"继续提交",
  406. content: "未填写处理步骤,是否继续提交",
  407. success: res1 => {
  408. if (res1.confirm) {
  409. this.submitApi()
  410. } else if (res1.cancel) {
  411. //('用户点击取消');
  412. }
  413. }
  414. })
  415. }else{
  416. this.submitApi()
  417. }
  418. },
  419. }
  420. }
  421. </script>
  422. <style lang="scss">
  423. .jpmain{padding-bottom: 120rpx;}
  424. .list{
  425. background-color: rgba(255,255,255,1);
  426. border-radius: 8px;
  427. margin: 20rpx ;
  428. .item:not(:last-child) {
  429. border-bottom:1px solid rgba(232,232,232,1);
  430. }
  431. .item{
  432. padding: 20rpx 24rpx;
  433. display: flex;
  434. justify-content: space-between;
  435. .name{
  436. width: 40%;
  437. font-size: 32rpx;
  438. color: #777777;
  439. span{
  440. color:red
  441. }
  442. white-space: pre;
  443. }
  444. .valueplus{
  445. display: flex;
  446. justify-content: space-between;
  447. }
  448. .valueclock{
  449. width: 100%;
  450. border-radius: 4px;
  451. padding: 0 8px;
  452. height: 64rpx;
  453. line-height: 64rpx;
  454. background-color: rgba(241,242,245,1);
  455. }
  456. .value{
  457. font-size: 32rpx;
  458. width: 60%;
  459. display: flex;
  460. align-items: center;
  461. input::placeholder{
  462. color:#AAAAAA;
  463. }
  464. .img{
  465. width: 40rpx;
  466. height: 40rpx;
  467. }
  468. .textarea{
  469. background-color: rgba(241,242,245,1);
  470. width: 100%;
  471. border-radius: 4px;
  472. }
  473. .typeN{
  474. font-size: 24rpx;
  475. margin-right: 8rpx;
  476. display: flex;
  477. align-items: center;
  478. border-radius: 4px;
  479. padding: 2px 8rpx;
  480. color: #fff;
  481. }
  482. .typeN1{
  483. background-color:#1677ff;
  484. //border: 1px solid #1677ff;
  485. }
  486. .typeN2{
  487. background-color:#19be6b;
  488. //border: 1px solid #19be6b;
  489. }
  490. }
  491. }
  492. .item-plus{
  493. flex-direction: column;
  494. .value,.name{
  495. width: 100%;
  496. }
  497. .name{
  498. padding-bottom: 32rpx;
  499. }
  500. }
  501. }
  502. .textareaclass{
  503. padding:16rpx
  504. }
  505. .floating-button {
  506. z-index: 999;
  507. position: fixed;
  508. bottom: 0; /* 距离底部 20px */
  509. width: 100%;
  510. display: flex;
  511. height: 120rpx;
  512. justify-content: center;
  513. background-color: rgba(255,255,255,1);
  514. .button{
  515. margin-top: 24rpx;
  516. border-radius: 50px;
  517. height: 80rpx;
  518. width: 80%;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. padding:12rpx;
  523. background-color: rgba(22,119,255,1);
  524. color: rgba(255,255,255,1);
  525. font-size: 36rpx;
  526. }
  527. }
  528. .viewImg{
  529. width: 160rpx;
  530. height: 160rpx;
  531. }
  532. </style>