add.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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">
  8. 荆鹏充电站
  9. </view>
  10. <view class="item ">
  11. <view class="name">
  12. 站点地址 荆州市沙市区江津东路155号院内
  13. </view>
  14. <view class="value">
  15. 站点地址 荆州市沙市区江津东路155号院内
  16. </view>
  17. </view>
  18. </view>
  19. <view class="list">
  20. <view class="item ">
  21. 巡检操作记录
  22. </view>
  23. <view class="item item-plus">
  24. <view class="name">
  25. 处理人员
  26. </view>
  27. <view class="value ">
  28. <u-checkbox-group>
  29. <u-checkbox v-model="item.checked" v-for="(item, index) in memberList" :key="index"
  30. :name="item.name">{{item.name}}</u-checkbox>
  31. </u-checkbox-group>
  32. </view>
  33. </view>
  34. <view class="item item-plus" style=" align-items: center;">
  35. <view class="name">
  36. 处理时间
  37. </view>
  38. <view class="value " @click="completionTimeShow=true">
  39. <view class="valueclock">
  40. <u-icon name="clock" size="32" color="#BBBBBB"></u-icon>
  41. {{taskInfo.completionTime}}
  42. </view>
  43. </view>
  44. </view>
  45. <view class="item item-plus" v-if="0">
  46. <view class="name">
  47. 现场照片
  48. </view>
  49. <view class="value" v-if="floorlockErrorRecord.status==0">
  50. <u-upload name="photoFile" ref="uUpload" :form-data="formData" :header="header" :action="action"
  51. :file-list="listPic"></u-upload>
  52. </view>
  53. <view class="value" v-else>
  54. <img class="viewImg" v-for="(item,i) in repairImageList" @click="previewImage(i,'repairImageList')"
  55. :key="i" :src="item" mode=""></img>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="list" v-for="(item,index) in contentList" >
  60. <view class="item ">
  61. {{index+1}} {{item.name}}
  62. </view>
  63. <view class="item item-plus">
  64. <view class="name">
  65. <span style="color: red;">*</span>检测结果
  66. </view>
  67. <view class="value ">
  68. <u-radio-group v-model="submitcontent[index].result">
  69. <u-radio
  70. v-for="(it, i) in item.btn" :key="index+'-'+i"
  71. :name="it.value"
  72. >
  73. {{it.name}}
  74. </u-radio>
  75. </u-radio-group>
  76. </view>
  77. </view>
  78. <view class="item item-plus">
  79. <view class="name">
  80. {{item.desc}}
  81. </view>
  82. <view class="value ">
  83. <u-input style="background-color: #888888;" :placeholder="item.descP"></u-input>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="floating-button" v-if="floorlockErrorRecord.status==0">
  88. <view class="button" @click="submit">
  89. 提交
  90. </view>
  91. </view>
  92. </view>
  93. </template>
  94. <script>
  95. import * as API from '@/apis/pagejs/pagesTask.js'
  96. import * as WxJsApi from '@/apis/utils/wxJsApi.js'
  97. import {
  98. currentTimeStamp,
  99. parseUnixTime
  100. } from '@/apis/utils'
  101. export default {
  102. data() {
  103. return {
  104. memberList: [
  105. ],
  106. listPic: [],
  107. action: "",
  108. formData: {
  109. },
  110. header: {
  111. },
  112. params: {
  113. year: true,
  114. month: true,
  115. day: true,
  116. hour: true,
  117. minute: true,
  118. second: true,
  119. timestamp: true,
  120. },
  121. codeN: "",
  122. selectTaskInfoCode: false,
  123. selectTaskInfoCodeValue: [0],
  124. lockNo: "",
  125. lockName: "",
  126. floorlockInfo: {},
  127. floorlockErrorRecord: {},
  128. parkingInfo: {},
  129. taskInfo: {
  130. id: "",
  131. desc: "",
  132. images: "",
  133. completionTime: "",
  134. },
  135. codeList: [],
  136. id: "",
  137. imgList: [],
  138. repairImageList: [],
  139. completionTimeShow: false,
  140. content: [
  141. "变压器外观是否正常无损坏?",
  142. "配线柜内线缆是否完好,接头是否有过热或烧伤痕迹?",
  143. "断路器是否有异响,是否有异味(烧焦的味道)?",
  144. {
  145. name:"电度表读数(否完远程电表)?",
  146. btn:[{
  147. name:"是",
  148. value:"1"
  149. },{
  150. name:"数字输入",
  151. value:"-1"
  152. }],
  153. desc:"电度表读数",
  154. descP:"例如:000-217",
  155. },
  156. "充电桩外观是否正常无损坏,枪头是否正常无损坏,无积水、无异物?",
  157. "散热板是否清洁?",
  158. "充电桩箱体内接头是否有过热或烧伤痕迹?",
  159. "充电电缆是否无破损?",
  160. "基座是否完好、无损坏,无积水?",
  161. "消防设施是否完好?",
  162. "充电桩是否有异响动,外观是否干净清洁,附近是否有易燃、易爆或可燃材料、化学品、可燃蒸汽等危险物品?",
  163. ],
  164. contentList:[],
  165. submitcontent:[]
  166. };
  167. },
  168. onLoad(op) {
  169. this.action = process.jphelp.BASE_URL + "uploadPicture"
  170. this.formData.subFolder = "/floorlock/inspection/updateErr"
  171. var token = this.jphelp.getToken()
  172. this.header = {
  173. 'Authorization': token
  174. }
  175. this.id = op.id
  176. this.taskInfo.completionTime = parseUnixTime(currentTimeStamp())
  177. //this.errDetails()
  178. this.contentList=this.content.map(item=>{
  179. if(typeof item === "string" ){
  180. return {
  181. name:item,
  182. btn:[{
  183. name:"正常",
  184. value:"1"
  185. },{
  186. name:"异常",
  187. value:"0"
  188. }],
  189. desc:"问题描述",
  190. descP:"请简单描述发现的问题",
  191. }
  192. }else{
  193. return item
  194. }
  195. })
  196. this.submitcontent=this.contentList.map(item=>{
  197. return {
  198. name:item.name,
  199. result:"1",
  200. image:"",
  201. extended1:""
  202. }
  203. })
  204. this.getteamMembers()
  205. },
  206. onReady() {
  207. WxJsApi.getWxConfig(['openLocation']).then((res) => {
  208. // //(res)
  209. }).catch(error => {
  210. //(res)
  211. })
  212. },
  213. methods: {
  214. getteamMembers() {
  215. uni.showLoading({
  216. title: "加载中",
  217. mask: true,
  218. })
  219. API.teamMembers().then((res) => {
  220. var arr = res.data.memberList
  221. this.memberList = arr
  222. this.memberList.forEach(item => {
  223. if (item.id == this.jphelp.getPersonInfo().id) {
  224. item.checked = true
  225. } else {
  226. item.checked = false
  227. }
  228. })
  229. uni.hideLoading();
  230. }).catch(error => {
  231. uni.hideLoading();
  232. uni.showToast({
  233. title: error,
  234. icon: "none"
  235. })
  236. })
  237. },
  238. completionTimeConfirm(e) {
  239. console.log(e)
  240. this.taskInfo.completionTime = parseUnixTime(new Date(e.timestamp * 1000))
  241. },
  242. previewImage(i, name) {
  243. let imgs = this[name];
  244. //imgs.push(img);
  245. uni.previewImage({
  246. urls: imgs,
  247. current: i
  248. })
  249. },
  250. navigate() {
  251. var item = this.parkingInfo
  252. if (!(this.parkingInfo.latitude && this.parkingInfo.longitude)) {
  253. return
  254. }
  255. //console.log(item)
  256. uni.showLoading({
  257. })
  258. setTimeout(() => {
  259. uni.hideLoading()
  260. }, 3 * 1000)
  261. WxJsApi.openLocation({
  262. latitude: parseFloat(item.latitude), //目的地latitude
  263. longitude: parseFloat(item.longitude), //目的地longitude
  264. name: item.name,
  265. address: item.address,
  266. scale: 15, //地图缩放大小,可根据情况具体调整
  267. success(res) {
  268. uni.hideLoading()
  269. },
  270. complete() {
  271. // uni.hideLoading()
  272. }
  273. });
  274. // //('station'+JSON.stringify(_self.stationDetail.station))
  275. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  276. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  277. },
  278. errDetails() {
  279. uni.showLoading({
  280. title: "加载中",
  281. mask: true,
  282. })
  283. API.errDetails({
  284. id: this.id
  285. }).then((res) => {
  286. this.floorlockErrorRecord = res.data.floorlockErrorRecord
  287. this.floorlockInfo = res.data.floorlockInfo
  288. this.parkingInfo = res.data.parkingInfo
  289. if (this.floorlockErrorRecord.errorImage) {
  290. this.imgList = this.floorlockErrorRecord.errorImage.split(',')
  291. }
  292. if (this.floorlockErrorRecord.repairImage) {
  293. this.repairImageList = this.floorlockErrorRecord.repairImage.split(',')
  294. }
  295. uni.hideLoading();
  296. }).catch(error => {
  297. uni.hideLoading();
  298. uni.showToast({
  299. title: error,
  300. icon: "none"
  301. })
  302. })
  303. },
  304. submitApi() {
  305. let files = [];
  306. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  307. files = this.$refs.uUpload.lists.filter(val => {
  308. return val.progress == 100;
  309. })
  310. // 如果您不需要进行太多的处理,直接如下即可
  311. // files = this.$refs.uUpload.lists;
  312. //(files);
  313. var imgUrl = files.map(item => {
  314. return item.response.data;
  315. })
  316. //(imgUrl);
  317. this.taskInfo.images = imgUrl.join(',');
  318. this.taskInfo.id = this.id;
  319. uni.showLoading({
  320. title: "加载中",
  321. mask: true,
  322. })
  323. API.updateErr(this.taskInfo).then((res) => {
  324. const eventChannel = this.getOpenerEventChannel();
  325. eventChannel.emit('acceptDataFromOpenerPage', {})
  326. uni.showModal({
  327. title: '提示',
  328. showCancel: false,
  329. content: "操作成功",
  330. success: res1 => {
  331. if (res1.confirm) {
  332. uni.navigateBack()
  333. } else if (res1.cancel) {
  334. //('用户点击取消');
  335. }
  336. }
  337. })
  338. uni.hideLoading();
  339. }).catch(error => {
  340. uni.hideLoading();
  341. uni.showToast({
  342. title: error,
  343. icon: "none"
  344. })
  345. })
  346. },
  347. submit() {
  348. if (!this.taskInfo.desc) {
  349. uni.showModal({
  350. title: '提示',
  351. showCancel: true,
  352. cancelText: "返回填写",
  353. confirmText: "继续提交",
  354. content: "未填写处理步骤,是否继续提交",
  355. success: res1 => {
  356. if (res1.confirm) {
  357. this.submitApi()
  358. } else if (res1.cancel) {
  359. //('用户点击取消');
  360. }
  361. }
  362. })
  363. } else {
  364. this.submitApi()
  365. }
  366. },
  367. }
  368. }
  369. </script>
  370. <style lang="scss">
  371. .jpmain {
  372. padding-bottom: 120rpx;
  373. }
  374. .list {
  375. background-color: rgba(255, 255, 255, 1);
  376. border-radius: 16rpx;
  377. margin: 20rpx;
  378. .item:first-child {
  379. border-bottom: 2rpx solid rgba(232, 232, 232, 1);
  380. font-size: 32rpx;
  381. font-weight: bold;
  382. }
  383. .item {
  384. padding: 20rpx 24rpx;
  385. .name {
  386. // width: 40%;
  387. padding-bottom: 32rpx;
  388. font-size: 32rpx;
  389. color: #777777;
  390. span {
  391. color: red
  392. }
  393. white-space: pre;
  394. }
  395. .valueplus {
  396. display: flex;
  397. justify-content: space-between;
  398. }
  399. .valueclock {
  400. width: 100%;
  401. border-radius: 8rpx;
  402. padding: 0 16rpx;
  403. height: 64rpx;
  404. line-height: 64rpx;
  405. background-color: rgba(241, 242, 245, 1);
  406. }
  407. .value {
  408. font-size: 32rpx;
  409. display: flex;
  410. align-items: center;
  411. input::placeholder {
  412. color: #AAAAAA;
  413. }
  414. .img {
  415. width: 40rpx;
  416. height: 40rpx;
  417. }
  418. .textarea {
  419. background-color: rgba(241, 242, 245, 1);
  420. width: 100%;
  421. border-radius: 8rpx;
  422. }
  423. .typeN {
  424. font-size: 24rpx;
  425. margin-right: 8rpx;
  426. display: flex;
  427. align-items: center;
  428. border-radius: 8rpx;
  429. padding: 4rpx 8rpx;
  430. color: #fff;
  431. }
  432. .typeN1 {
  433. background-color: #1677ff;
  434. //border: 2rpx solid #1677ff;
  435. }
  436. .typeN2 {
  437. background-color: #19be6b;
  438. //border: 2rpx solid #19be6b;
  439. }
  440. }
  441. }
  442. }
  443. .textareaclass {
  444. padding: 16rpx
  445. }
  446. .floating-button {
  447. z-index: 999;
  448. position: fixed;
  449. bottom: 0;
  450. width: 100%;
  451. display: flex;
  452. height: 120rpx;
  453. justify-content: center;
  454. background-color: rgba(255, 255, 255, 1);
  455. .button {
  456. margin-top: 24rpx;
  457. border-radius: 50px;
  458. height: 80rpx;
  459. width: 80%;
  460. display: flex;
  461. align-items: center;
  462. justify-content: center;
  463. padding: 12rpx;
  464. background-color: rgba(22, 119, 255, 1);
  465. color: rgba(255, 255, 255, 1);
  466. font-size: 36rpx;
  467. }
  468. }
  469. .viewImg {
  470. width: 160rpx;
  471. height: 160rpx;
  472. }
  473. </style>