maintenanceTaks.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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().then((res) => {
  273. var arr = res.data.memberList
  274. this.memberList = arr
  275. this.memberList.forEach(item => {
  276. if (item.id == this.jphelp.getPersonInfo().id) {
  277. item.checked = true
  278. } else {
  279. item.checked = false
  280. }
  281. })
  282. uni.hideLoading();
  283. }).catch(error => {
  284. uni.hideLoading();
  285. uni.showToast({
  286. title: error,
  287. icon: "none"
  288. })
  289. })
  290. },
  291. // 选中任一radio时,由radio-group触发
  292. radioGroupChange(e) {
  293. console.log(e);
  294. this.taskInfo.desc=e
  295. },
  296. completionTimeConfirm(e) {
  297. console.log(e)
  298. this.taskInfo.completionTime = parseUnixTime(new Date(e.timestamp * 1000))
  299. },
  300. previewImage(i, name) {
  301. let imgs = this[name];
  302. //imgs.push(img);
  303. uni.previewImage({
  304. urls: imgs,
  305. current: i
  306. })
  307. },
  308. navigate() {
  309. var item = this.errorRecord
  310. if (!(this.errorRecord.latitude && this.errorRecord.longitude)) {
  311. return
  312. }
  313. //console.log(item)
  314. uni.showLoading({
  315. })
  316. setTimeout(() => {
  317. uni.hideLoading()
  318. }, 3 * 1000)
  319. WxJsApi.openLocation({
  320. latitude: parseFloat(item.latitude), //目的地latitude
  321. longitude: parseFloat(item.longitude), //目的地longitude
  322. name: item.name,
  323. address: item.address,
  324. scale: 15, //地图缩放大小,可根据情况具体调整
  325. success(res) {
  326. uni.hideLoading()
  327. },
  328. complete() {
  329. // uni.hideLoading()
  330. }
  331. });
  332. // //('station'+JSON.stringify(_self.stationDetail.station))
  333. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  334. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  335. },
  336. errDetails() {
  337. uni.showLoading({
  338. title: "加载中",
  339. mask: true,
  340. })
  341. API.errDetails({
  342. id: this.id
  343. }).then((res) => {
  344. this.errorRecord = res.data.record
  345. if (this.errorRecord.errorImage) {
  346. this.imgList = this.errorRecord.errorImage.split(',')
  347. }
  348. if (this.errorRecord.repairImage) {
  349. this.repairImageList = this.errorRecord.repairImage.split(',')
  350. }
  351. uni.hideLoading();
  352. }).catch(error => {
  353. uni.hideLoading();
  354. uni.showToast({
  355. title: error,
  356. icon: "none"
  357. })
  358. })
  359. },
  360. submitApi() {
  361. this.taskInfo.id = this.id;
  362. uni.showLoading({
  363. title: "加载中",
  364. mask: true,
  365. })
  366. API.updateErr(this.taskInfo).then((res) => {
  367. const eventChannel = this.getOpenerEventChannel();
  368. eventChannel.emit('acceptDataFromOpenerPage', {})
  369. uni.showModal({
  370. title: '提示',
  371. showCancel: false,
  372. content: "操作成功",
  373. success: res1 => {
  374. if (res1.confirm) {
  375. uni.navigateBack()
  376. } else if (res1.cancel) {
  377. //('用户点击取消');
  378. }
  379. }
  380. })
  381. uni.hideLoading();
  382. }).catch(error => {
  383. uni.hideLoading();
  384. uni.showToast({
  385. title: error,
  386. icon: "none"
  387. })
  388. })
  389. },
  390. submit() {
  391. var mp=this.memberList.filter(item=>{
  392. return item.checked
  393. }).map(item=>{
  394. return item.id
  395. })
  396. if (mp.length==0) {
  397. uni.showToast({
  398. title: "请选择上报人员"
  399. })
  400. return
  401. }
  402. this.taskInfo.updateUserIds=mp.join()
  403. if (!this.valueradio) {
  404. uni.showToast({
  405. title: "请选择维修方式"
  406. })
  407. return
  408. }
  409. if (!this.taskInfo.desc) {
  410. uni.showToast({
  411. title: "请记录处理步骤及结果"
  412. })
  413. return
  414. }
  415. let files = [];
  416. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  417. files = this.$refs.uUpload.lists.filter(val => {
  418. return val.progress == 100;
  419. })
  420. // 如果您不需要进行太多的处理,直接如下即可
  421. // files = this.$refs.uUpload.lists;
  422. //(files);
  423. var imgUrl = files.map(item => {
  424. return item.response.data;
  425. })
  426. if (imgUrl.length==0) {
  427. uni.showToast({
  428. title: "请拍照上传现场照片"
  429. })
  430. return
  431. }
  432. //(imgUrl);
  433. this.taskInfo.images = imgUrl.join(',');
  434. this.submitApi()
  435. },
  436. }
  437. }
  438. </script>
  439. <style lang="scss">
  440. .jpmain {
  441. padding-bottom: 120rpx;
  442. }
  443. .list {
  444. background-color: rgba(255, 255, 255, 1);
  445. border-radius: 16rpx;
  446. margin: 20rpx;
  447. .item:not(:last-child) {
  448. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  449. }
  450. .item {
  451. padding: 20rpx 24rpx;
  452. display: flex;
  453. justify-content: space-between;
  454. .name {
  455. width: 40%;
  456. font-size: 32rpx;
  457. color: #777777;
  458. span {
  459. color: red
  460. }
  461. white-space: pre;
  462. }
  463. .valueplus {
  464. display: flex;
  465. justify-content: space-between;
  466. }
  467. .valueclock {
  468. width: 100%;
  469. border-radius: 8rpx;
  470. padding: 0 16rpx;
  471. height: 64rpx;
  472. line-height: 64rpx;
  473. background-color: rgba(241, 242, 245, 1);
  474. }
  475. .typeN {
  476. font-size: 24rpx;
  477. margin-right: 8rpx;
  478. display: flex;
  479. align-items: center;
  480. border-radius: 8rpx;
  481. padding: 4rpx 8rpx;
  482. color: #fff;
  483. }
  484. .typeN1 {
  485. background-color: #1677ff;
  486. //border: 2rpx solid #1677ff;
  487. }
  488. .typeN2 {
  489. background-color: #19be6b;
  490. //border: 2rpx solid #19be6b;
  491. }
  492. .value {
  493. font-size: 32rpx;
  494. width: 60%;
  495. display: flex;
  496. align-items: center;
  497. input::placeholder {
  498. color: #AAAAAA;
  499. }
  500. .img {
  501. width: 40rpx;
  502. height: 40rpx;
  503. min-width: 40rpx;
  504. min-height: 40rpx;
  505. }
  506. .textarea {
  507. background-color: rgba(241, 242, 245, 1);
  508. width: 100%;
  509. border-radius: 8rpx;
  510. }
  511. }
  512. }
  513. .item-plus {
  514. flex-direction: column;
  515. .value,
  516. .name {
  517. width: 100%;
  518. }
  519. .name {
  520. padding-bottom: 32rpx;
  521. }
  522. }
  523. .item-head {
  524. justify-content: left;
  525. .head-text {
  526. font-weight: bold;
  527. font-size: 32rpx;
  528. }
  529. }
  530. }
  531. .textareaclass {
  532. padding: 16rpx
  533. }
  534. .floating-button {
  535. z-index: 999;
  536. position: fixed;
  537. bottom: 0;
  538. width: 100%;
  539. display: flex;
  540. height: 120rpx;
  541. justify-content: center;
  542. background-color: rgba(255, 255, 255, 1);
  543. .button {
  544. margin-top: 24rpx;
  545. border-radius: 50px;
  546. height: 80rpx;
  547. width: 80%;
  548. display: flex;
  549. align-items: center;
  550. justify-content: center;
  551. padding: 12rpx;
  552. background-color: rgba(22, 119, 255, 1);
  553. color: rgba(255, 255, 255, 1);
  554. font-size: 36rpx;
  555. }
  556. }
  557. .viewImg {
  558. width: 160rpx;
  559. height: 160rpx;
  560. }
  561. .listtimeline {
  562. background-color: rgba(255, 255, 255, 1);
  563. border-radius: 16rpx;
  564. margin: 20rpx;
  565. padding: 32rpx 24rpx;
  566. .title{
  567. color: rgba(51,51,51,1);
  568. font-size: 32rpx;
  569. margin-bottom: 24rpx;
  570. }
  571. }
  572. ::v-deep .u-dot{
  573. background:#1677FF ;
  574. }
  575. .errorReportNames{
  576. color: #1677FF ;
  577. }
  578. .u-order-title{
  579. margin-bottom: 20rpx;
  580. }
  581. .u-order-time{
  582. margin-bottom: 40rpx;
  583. }
  584. </style>