maintenanceTaks.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <view class="jpmain ">
  3. <u-navbar title="维修结果" title-color="#101010" :bkUrl="!isBack?'/pages/index/index':''" ></u-navbar>
  4. <u-picker mode="time" v-model="completionTimeShow" @confirm="completionTimeConfirm"
  5. :default-time="taskInfo.completionTime" :params="params"></u-picker>
  6. <view class="list">
  7. <view class="item item-head">
  8. <span v-if="errorRecord.type" :class="'typeN typeN'+errorRecord.type">
  9. {{errorRecord.typeN}}
  10. </span>
  11. <span class="head-text">
  12. {{errorRecord.errorCodeText}}
  13. </span>
  14. </view>
  15. <view class="item item-plus" v-if="errorRecord.errorDesc">
  16. <view class="name">
  17. 问题描述
  18. </view>
  19. <view class="value">
  20. {{errorRecord.errorDesc}}
  21. </view>
  22. </view>
  23. <view class="item item-plus" v-if="imgList.length">
  24. <view class="name">
  25. 照片
  26. </view>
  27. <view class="value" style="display: block;">
  28. <img class="viewImg" v-for="(item,i) in imgList" @click="previewImage(i,'imgList')" :key="i"
  29. :src="item" mode=""></img>
  30. </view>
  31. </view>
  32. <view class="item">
  33. <view class="name">
  34. 创建时间
  35. </view>
  36. <view class="value">
  37. {{errorRecord.createTime}}
  38. </view>
  39. </view>
  40. <view class="item" v-if="errorRecord.type==2">
  41. <view class="name">
  42. 上报人
  43. </view>
  44. <view class="value">
  45. {{errorRecord.errorReportNames}}
  46. </view>
  47. </view>
  48. </view>
  49. <view class="list">
  50. <view class="item" @click="gotoUrl('/pages/station/stationInfo?id='+errorRecord.stationId)">
  51. <view class="name">
  52. 所属站点
  53. </view>
  54. <view class="value valueplus">
  55. {{errorRecord.stationName}}
  56. <u-icon name="arrow-right" size="24" color="#BBBBBB"></u-icon>
  57. </view>
  58. </view>
  59. <view class="item" @click="gotoUrl('/pages/station/stationInfo?id='+errorRecord.stationId)">
  60. <view class="name">
  61. 所属设备
  62. </view>
  63. <view class="value ">
  64. {{errorRecord.deviceName}}
  65. {{errorRecord.deviceNo}}
  66. </view>
  67. </view>
  68. <view class="item">
  69. <view class="name">
  70. 详细地址
  71. </view>
  72. <view class="value valueplus" @click="navigate">
  73. <view>{{errorRecord.stationAddress}}</view>
  74. <image class="img" v-if="errorRecord.latitude&&errorRecord.longitude"
  75. src="@/assets/img/daohuang.png" mode=""></image>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="list" v-if="errorRecord.status==0" >
  80. <view class="item item-plus">
  81. <view class="name">
  82. <span style="color: red;">*</span> 处理人员
  83. </view>
  84. <view class="value " >
  85. <u-checkbox-group>
  86. <u-checkbox v-model="item.checked" @change="memberListchange"
  87. v-for="(item, index) in memberList" :key="index"
  88. :name="item.name">{{item.name}}</u-checkbox>
  89. </u-checkbox-group>
  90. </view>
  91. </view>
  92. <view class="item item-plus" style=" align-items: center;">
  93. <view class="name">
  94. <span style="color: red;">*</span>处理时间
  95. </view>
  96. <view class="value " @click="completionTimeShow=true" >
  97. <view class="valueclock">
  98. <u-icon name="clock" size="32" color="#BBBBBB"></u-icon>
  99. {{taskInfo.completionTime}}
  100. </view>
  101. </view>
  102. </view>
  103. <view class="item item-plus">
  104. <view class="name">
  105. <span style="color: red;">*</span>维修方式
  106. </view>
  107. <view class="value " >
  108. <u-radio-group v-model="valueradio" @change="radioGroupChange">
  109. <u-radio v-for="(item, index) in listradio" :key="index" :name="item.name">
  110. {{item.name}}
  111. </u-radio>
  112. </u-radio-group>
  113. </view>
  114. </view>
  115. <view class="item item-plus">
  116. <view class="name">
  117. <span style="color: red;">*</span>处理结果
  118. </view>
  119. <view class="value" >
  120. <textarea placeholder="请记录处理步骤及结果" placeholder-class="textareaclass" style=" height: 100px;"
  121. v-model="taskInfo.desc" class="textarea"></textarea>
  122. </view>
  123. </view>
  124. <view class="item item-plus">
  125. <view class="name">
  126. <span style="color: red;">*</span>现场照片
  127. </view>
  128. <view class="value">
  129. <u-upload name="photoFile" ref="uUpload" :form-data="formData" :header="header" :action="action"
  130. :file-list="listPic"></u-upload>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="listtimeline" v-else >
  135. <view class="title">
  136. 处理结果
  137. </view>
  138. <u-time-line>
  139. <u-time-line-item nodeTop="2">
  140. <template v-slot:content>
  141. <view>
  142. <view class="u-order-title">
  143. <span class="errorReportNames">{{errorRecord.repairNames}}</span>
  144. 完成故障处理
  145. </view>
  146. <view class="u-order-title">
  147. 处理结果:{{errorRecord.repairDesc}}
  148. </view>
  149. <view class="u-order-desc">
  150. <img class="viewImg" v-for="(item,i) in repairImageList"
  151. @click="previewImage(i,'repairImageList')"
  152. :key="i"
  153. :src="item" mode=""></img>
  154. </view>
  155. <view class="u-order-time" >{{errorRecord.repairTime}}</view>
  156. </view>
  157. </template>
  158. </u-time-line-item>
  159. <u-time-line-item nodeTop="2">
  160. <template v-slot:content>
  161. <view>
  162. <view class="u-order-title">设备故障</view>
  163. <view class="u-order-title">故障类型:{{errorRecord.errorCodeText}}</view>
  164. <view class="u-order-time">{{errorRecord.errorReportTime}}</view>
  165. </view>
  166. </template>
  167. </u-time-line-item>
  168. </u-time-line>
  169. </view>
  170. <view class="floating-button" v-if="errorRecord.status==0">
  171. <view class="button" @click="submit">
  172. 提交
  173. </view>
  174. </view>
  175. </view>
  176. </template>
  177. <script>
  178. import * as API from '@/apis/pagejs/pagesTask.js'
  179. import * as WxJsApi from '@/apis/utils/wxJsApi.js'
  180. import {
  181. currentTimeStamp,
  182. parseUnixTime
  183. } from '@/apis/utils'
  184. export default {
  185. data() {
  186. return {
  187. valueradio:"",
  188. listradio: [{
  189. name: '重启',
  190. disabled: false
  191. },
  192. {
  193. name: '更换设备',
  194. disabled: false
  195. },
  196. {
  197. name: '其他',
  198. disabled: false
  199. }
  200. ],
  201. memberList: [
  202. ],
  203. listPic: [],
  204. action: "",
  205. formData: {
  206. },
  207. header: {
  208. },
  209. params: {
  210. year: true,
  211. month: true,
  212. day: true,
  213. hour: true,
  214. minute: true,
  215. second: true,
  216. timestamp: true,
  217. },
  218. isBack:false,
  219. codeN: "",
  220. selectTaskInfoCode: false,
  221. selectTaskInfoCodeValue: [0],
  222. lockNo: "",
  223. lockName: "",
  224. floorlockInfo: {},
  225. errorRecord: {},
  226. parkingInfo: {},
  227. taskInfo: {
  228. id: "",
  229. desc: "",
  230. images: "",
  231. completionTime: "",
  232. },
  233. codeList: [],
  234. id: "",
  235. imgList: [],
  236. repairImageList: [],
  237. completionTimeShow: false,
  238. };
  239. },
  240. onLoad(op) {
  241. this.action = process.jphelp.BASE_URL + "uploadPicture"
  242. this.formData.subFolder = "/floorlock/inspection/updateErr"
  243. var token = this.jphelp.getToken()
  244. this.header = {
  245. 'Authorization': token
  246. }
  247. this.id = op.id
  248. this.taskInfo.completionTime = parseUnixTime(currentTimeStamp())
  249. this.errDetails()
  250. this.getteamMembers()
  251. if(op.back){
  252. this.isBack=op.back
  253. }
  254. },
  255. onReady() {
  256. WxJsApi.getWxConfig(['openLocation']).then((res) => {
  257. // //(res)
  258. }).catch(error => {
  259. //(res)
  260. })
  261. },
  262. methods: {
  263. memberListchange(e) {
  264. console.log(e)
  265. this.$forceUpdate()
  266. },
  267. getteamMembers() {
  268. uni.showLoading({
  269. title: "加载中",
  270. mask: true,
  271. })
  272. API.teamMembers({
  273. userType:1
  274. }).then((res) => {
  275. var arr = res.data.memberList
  276. this.memberList = arr
  277. this.memberList.forEach(item => {
  278. if (item.id == this.jphelp.getPersonInfo().id) {
  279. item.checked = true
  280. } else {
  281. item.checked = false
  282. }
  283. })
  284. uni.hideLoading();
  285. }).catch(error => {
  286. uni.hideLoading();
  287. uni.showToast({
  288. title: error,
  289. icon: "none"
  290. })
  291. })
  292. },
  293. // 选中任一radio时,由radio-group触发
  294. radioGroupChange(e) {
  295. console.log(e);
  296. this.taskInfo.desc=e
  297. },
  298. completionTimeConfirm(e) {
  299. console.log(e)
  300. this.taskInfo.completionTime = parseUnixTime(new Date(e.timestamp * 1000))
  301. },
  302. previewImage(i, name) {
  303. let imgs = this[name];
  304. //imgs.push(img);
  305. uni.previewImage({
  306. urls: imgs,
  307. current: i
  308. })
  309. },
  310. navigate() {
  311. var item = this.errorRecord
  312. if (!(this.errorRecord.latitude && this.errorRecord.longitude)) {
  313. return
  314. }
  315. //console.log(item)
  316. uni.showLoading({
  317. })
  318. setTimeout(() => {
  319. uni.hideLoading()
  320. }, 3 * 1000)
  321. WxJsApi.openLocation({
  322. latitude: parseFloat(item.latitude), //目的地latitude
  323. longitude: parseFloat(item.longitude), //目的地longitude
  324. name: item.name,
  325. address: item.address,
  326. scale: 15, //地图缩放大小,可根据情况具体调整
  327. success(res) {
  328. uni.hideLoading()
  329. },
  330. complete() {
  331. // uni.hideLoading()
  332. }
  333. });
  334. // //('station'+JSON.stringify(_self.stationDetail.station))
  335. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  336. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  337. },
  338. errDetails() {
  339. uni.showLoading({
  340. title: "加载中",
  341. mask: true,
  342. })
  343. API.errDetails({
  344. id: this.id
  345. }).then((res) => {
  346. this.errorRecord = res.data.record
  347. if (this.errorRecord.errorImage) {
  348. this.imgList = this.errorRecord.errorImage.split(',')
  349. }
  350. if (this.errorRecord.repairImage) {
  351. this.repairImageList = this.errorRecord.repairImage.split(',')
  352. }
  353. uni.hideLoading();
  354. }).catch(error => {
  355. uni.hideLoading();
  356. uni.showToast({
  357. title: error,
  358. icon: "none"
  359. })
  360. })
  361. },
  362. submitApi() {
  363. this.taskInfo.id = this.id;
  364. uni.showLoading({
  365. title: "加载中",
  366. mask: true,
  367. })
  368. API.updateErr(this.taskInfo).then((res) => {
  369. const eventChannel = this.getOpenerEventChannel();
  370. eventChannel.emit('acceptDataFromOpenerPage', {})
  371. uni.showModal({
  372. title: '提示',
  373. showCancel: false,
  374. content: "操作成功",
  375. success: res1 => {
  376. if (res1.confirm) {
  377. uni.navigateBack()
  378. } else if (res1.cancel) {
  379. //('用户点击取消');
  380. }
  381. }
  382. })
  383. uni.hideLoading();
  384. }).catch(error => {
  385. uni.hideLoading();
  386. uni.showToast({
  387. title: error,
  388. icon: "none"
  389. })
  390. })
  391. },
  392. submit() {
  393. var mp=this.memberList.filter(item=>{
  394. return item.checked
  395. }).map(item=>{
  396. return item.id
  397. })
  398. if (mp.length==0) {
  399. uni.showToast({
  400. title: "请选择上报人员"
  401. })
  402. return
  403. }
  404. this.taskInfo.updateUserIds=mp.join()
  405. if (!this.valueradio) {
  406. uni.showToast({
  407. title: "请选择维修方式"
  408. })
  409. return
  410. }
  411. if (!this.taskInfo.desc) {
  412. uni.showToast({
  413. title: "请记录处理步骤及结果"
  414. })
  415. return
  416. }
  417. let files = [];
  418. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  419. files = this.$refs.uUpload.lists.filter(val => {
  420. return val.progress == 100;
  421. })
  422. // 如果您不需要进行太多的处理,直接如下即可
  423. // files = this.$refs.uUpload.lists;
  424. //(files);
  425. var imgUrl = files.map(item => {
  426. return item.response.data;
  427. })
  428. if (imgUrl.length==0) {
  429. uni.showToast({
  430. title: "请拍照上传现场照片"
  431. })
  432. return
  433. }
  434. //(imgUrl);
  435. this.taskInfo.images = imgUrl.join(',');
  436. this.submitApi()
  437. },
  438. }
  439. }
  440. </script>
  441. <style lang="scss">
  442. .jpmain {
  443. padding-bottom: 120rpx;
  444. }
  445. .list {
  446. background-color: rgba(255, 255, 255, 1);
  447. border-radius: 16rpx;
  448. margin: 20rpx;
  449. .item:not(:last-child) {
  450. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  451. }
  452. .item {
  453. padding: 20rpx 24rpx;
  454. display: flex;
  455. justify-content: space-between;
  456. .name {
  457. width: 40%;
  458. font-size: 32rpx;
  459. color: #777777;
  460. span {
  461. color: red
  462. }
  463. white-space: pre;
  464. }
  465. .valueplus {
  466. display: flex;
  467. justify-content: space-between;
  468. }
  469. .valueclock {
  470. width: 100%;
  471. border-radius: 8rpx;
  472. padding: 0 16rpx;
  473. height: 64rpx;
  474. line-height: 64rpx;
  475. background-color: rgba(241, 242, 245, 1);
  476. }
  477. .typeN {
  478. font-size: 24rpx;
  479. margin-right: 8rpx;
  480. display: flex;
  481. align-items: center;
  482. border-radius: 8rpx;
  483. padding: 4rpx 8rpx;
  484. color: #fff;
  485. }
  486. .typeN1 {
  487. background-color: #1677ff;
  488. //border: 2rpx solid #1677ff;
  489. }
  490. .typeN2 {
  491. background-color: #19be6b;
  492. //border: 2rpx solid #19be6b;
  493. }
  494. .value {
  495. font-size: 32rpx;
  496. width: 60%;
  497. display: flex;
  498. align-items: center;
  499. input::placeholder {
  500. color: #AAAAAA;
  501. }
  502. .img {
  503. width: 40rpx;
  504. height: 40rpx;
  505. min-width: 40rpx;
  506. min-height: 40rpx;
  507. }
  508. .textarea {
  509. background-color: rgba(241, 242, 245, 1);
  510. width: 100%;
  511. border-radius: 8rpx;
  512. }
  513. }
  514. }
  515. .item-plus {
  516. flex-direction: column;
  517. .value,
  518. .name {
  519. width: 100%;
  520. }
  521. .name {
  522. padding-bottom: 32rpx;
  523. }
  524. }
  525. .item-head {
  526. justify-content: left;
  527. .head-text {
  528. font-weight: bold;
  529. font-size: 32rpx;
  530. }
  531. }
  532. }
  533. .textareaclass {
  534. padding: 16rpx
  535. }
  536. .floating-button {
  537. z-index: 999;
  538. position: fixed;
  539. bottom: 0;
  540. width: 100%;
  541. display: flex;
  542. height: 120rpx;
  543. justify-content: center;
  544. background-color: rgba(255, 255, 255, 1);
  545. .button {
  546. margin-top: 24rpx;
  547. border-radius: 50px;
  548. height: 80rpx;
  549. width: 80%;
  550. display: flex;
  551. align-items: center;
  552. justify-content: center;
  553. padding: 12rpx;
  554. background-color: rgba(22, 119, 255, 1);
  555. color: rgba(255, 255, 255, 1);
  556. font-size: 36rpx;
  557. }
  558. }
  559. .viewImg {
  560. width: 160rpx;
  561. height: 160rpx;
  562. }
  563. .listtimeline {
  564. background-color: rgba(255, 255, 255, 1);
  565. border-radius: 16rpx;
  566. margin: 20rpx;
  567. padding: 32rpx 24rpx;
  568. .title{
  569. color: rgba(51,51,51,1);
  570. font-size: 32rpx;
  571. margin-bottom: 24rpx;
  572. }
  573. }
  574. ::v-deep .u-dot{
  575. background:#1677FF ;
  576. }
  577. .errorReportNames{
  578. color: #1677FF ;
  579. }
  580. .u-order-title{
  581. margin-bottom: 20rpx;
  582. }
  583. .u-order-time{
  584. margin-bottom: 40rpx;
  585. }
  586. </style>