maintenanceTaks.vue 14 KB

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