maintenanceTaks.vue 13 KB

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