add.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. <template>
  2. <view class="jpmain " >
  3. <u-navbar title="维修结果" title-color="#101010"></u-navbar>
  4. <u-picker mode="time" v-model="completionTimeShow"
  5. @confirm="completionTimeConfirm" :default-time="taskInfo.completionTime"
  6. :params="params"></u-picker>
  7. <view class="list" >
  8. <view class="item">
  9. 荆鹏充电站
  10. </view>
  11. <view class="item " >
  12. <view class="name">
  13. 站点地址 荆州市沙市区江津东路155号院内
  14. </view>
  15. <view class="value">
  16. 站点地址 荆州市沙市区江津东路155号院内
  17. </view>
  18. </view>
  19. </view>
  20. <view class="list" >
  21. <view class="item " >
  22. 巡检操作记录
  23. </view>
  24. <view class="item item-plus" >
  25. <view class="name">
  26. 处理人员
  27. </view>
  28. <view class="value" v-if="floorlockErrorRecord.status!=0">
  29. {{floorlockErrorRecord.updateTime}}
  30. </view>
  31. <view class="value "
  32. v-else>
  33. <u-checkbox-group >
  34. <u-checkbox
  35. v-model="item.checked"
  36. v-for="(item, index) in listcheckbox" :key="index"
  37. :name="item.name"
  38. >{{item.name}}</u-checkbox>
  39. </u-checkbox-group>
  40. </view>
  41. </view>
  42. <view class="item item-plus" style=" align-items: center;" >
  43. <view class="name">
  44. 处理时间
  45. </view>
  46. <view class="value" v-if="floorlockErrorRecord.status!=0">
  47. {{floorlockErrorRecord.updateTime}}
  48. </view>
  49. <view class="value "
  50. @click="completionTimeShow=true"
  51. v-else>
  52. <view class="valueclock">
  53. <u-icon name="clock" size="32" color="#BBBBBB"></u-icon>
  54. {{taskInfo.completionTime}}
  55. </view>
  56. </view>
  57. </view>
  58. <view class="item item-plus" v-if="0" >
  59. <view class="name">
  60. 现场照片
  61. </view>
  62. <view class="value" v-if="floorlockErrorRecord.status==0" >
  63. <u-upload name="photoFile"
  64. ref="uUpload"
  65. :form-data="formData" :header="header" :action="action"
  66. :file-list="listPic" ></u-upload>
  67. </view>
  68. <view class="value" v-else >
  69. <img class="viewImg" v-for="(item,i) in repairImageList"
  70. @click="previewImage(i,'repairImageList')"
  71. :key="i"
  72. :src="item" mode=""></img>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="floating-button" v-if="floorlockErrorRecord.status==0" >
  77. <view class="button" @click="submit" >
  78. 提交
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import * as API from '@/apis/pagejs/pagesTask.js'
  85. import * as WxJsApi from '@/apis/utils/wxJsApi.js'
  86. import {
  87. currentTimeStamp,
  88. parseUnixTime
  89. } from '@/apis/utils'
  90. export default {
  91. data() {
  92. return {
  93. listcheckbox:[
  94. {
  95. name: 'apple',
  96. checked: false,
  97. disabled: false
  98. },
  99. {
  100. name: 'banner',
  101. checked: false,
  102. disabled: false
  103. },
  104. {
  105. name: 'orange',
  106. checked: false,
  107. disabled: false
  108. }
  109. ],
  110. listPic: [],
  111. action:"",
  112. formData:{
  113. },
  114. header:{
  115. },
  116. params: {
  117. year: true,
  118. month: true,
  119. day: true,
  120. hour: true,
  121. minute: true,
  122. second: true,
  123. timestamp: true,
  124. },
  125. codeN:"",
  126. selectTaskInfoCode:false,
  127. selectTaskInfoCodeValue:[0],
  128. lockNo:"",
  129. lockName:"",
  130. floorlockInfo:{},
  131. floorlockErrorRecord:{},
  132. parkingInfo:{},
  133. taskInfo:{
  134. id:"",
  135. desc:"",
  136. images:"",
  137. completionTime:"",
  138. },
  139. codeList:[],
  140. id:"",
  141. imgList:[],
  142. repairImageList:[],
  143. completionTimeShow:false,
  144. };
  145. },
  146. onLoad(op) {
  147. this.action=process.jphelp.BASE_URL+"uploadPicture"
  148. this.formData.subFolder="/floorlock/inspection/updateErr"
  149. var token=this.jphelp.getToken()
  150. this.header={
  151. 'Authorization':token
  152. }
  153. this.id=op.id
  154. this.taskInfo.completionTime= parseUnixTime(currentTimeStamp())
  155. this.errDetails()
  156. },
  157. onReady() {
  158. WxJsApi.getWxConfig([ 'openLocation']).then((res) => {
  159. // //(res)
  160. }).catch(error => {
  161. //(res)
  162. })
  163. },
  164. methods:{
  165. completionTimeConfirm(e){
  166. console.log(e)
  167. this.taskInfo.completionTime= parseUnixTime(new Date(e.timestamp* 1000))
  168. },
  169. previewImage(i,name) {
  170. let imgs = this[name];
  171. //imgs.push(img);
  172. uni.previewImage({
  173. urls: imgs,
  174. current: i
  175. })
  176. },
  177. navigate() {
  178. var item=this.parkingInfo
  179. if(!(this.parkingInfo.latitude&&this.parkingInfo.longitude)){
  180. return
  181. }
  182. //console.log(item)
  183. uni.showLoading({
  184. })
  185. setTimeout(()=>{
  186. uni.hideLoading()
  187. },3*1000)
  188. WxJsApi.openLocation({
  189. latitude: parseFloat(item.latitude), //目的地latitude
  190. longitude: parseFloat(item.longitude), //目的地longitude
  191. name: item.name,
  192. address: item.address,
  193. scale: 15, //地图缩放大小,可根据情况具体调整
  194. success(res) {
  195. uni.hideLoading()
  196. },
  197. complete() {
  198. // uni.hideLoading()
  199. }
  200. });
  201. // //('station'+JSON.stringify(_self.stationDetail.station))
  202. // window.location.href = "https://uri.amap.com/marker?position=" + _self.stationDetail.station.longitude +
  203. // "," + _self.stationDetail.station.latitude + "&name=" + _self.stationDetail.station.name;
  204. },
  205. errDetails(){
  206. uni.showLoading({
  207. title: "加载中",
  208. mask: true,
  209. })
  210. API.errDetails({
  211. id:this.id
  212. }).then((res) => {
  213. this.floorlockErrorRecord=res.data.floorlockErrorRecord
  214. this.floorlockInfo=res.data.floorlockInfo
  215. this.parkingInfo=res.data.parkingInfo
  216. if(this.floorlockErrorRecord.errorImage){
  217. this.imgList=this.floorlockErrorRecord.errorImage.split(',')
  218. }
  219. if(this.floorlockErrorRecord.repairImage){
  220. this.repairImageList=this.floorlockErrorRecord.repairImage.split(',')
  221. }
  222. uni.hideLoading();
  223. }).catch(error => {
  224. uni.hideLoading();
  225. uni.showToast({
  226. title: error,
  227. icon: "none"
  228. })
  229. })
  230. },
  231. submitApi(){
  232. let files = [];
  233. // 通过filter,筛选出上传进度为100的文件(因为某些上传失败的文件,进度值不为100,这个是可选的操作)
  234. files = this.$refs.uUpload.lists.filter(val => {
  235. return val.progress == 100;
  236. })
  237. // 如果您不需要进行太多的处理,直接如下即可
  238. // files = this.$refs.uUpload.lists;
  239. //(files);
  240. var imgUrl=files.map(item=>{
  241. return item.response.data;
  242. })
  243. //(imgUrl);
  244. this.taskInfo.images = imgUrl.join(',');
  245. this.taskInfo.id=this.id;
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. })
  250. API.updateErr(this.taskInfo).then((res) => {
  251. const eventChannel = this.getOpenerEventChannel();
  252. eventChannel.emit('acceptDataFromOpenerPage', {})
  253. uni.showModal({
  254. title: '提示',
  255. showCancel: false,
  256. content: "操作成功",
  257. success: res1 => {
  258. if (res1.confirm) {
  259. uni.navigateBack()
  260. } else if (res1.cancel) {
  261. //('用户点击取消');
  262. }
  263. }
  264. })
  265. uni.hideLoading();
  266. }).catch(error => {
  267. uni.hideLoading();
  268. uni.showToast({
  269. title: error,
  270. icon: "none"
  271. })
  272. })
  273. },
  274. submit(){
  275. if(!this.taskInfo.desc){
  276. uni.showModal({
  277. title: '提示',
  278. showCancel: true,
  279. cancelText:"返回填写",
  280. confirmText:"继续提交",
  281. content: "未填写处理步骤,是否继续提交",
  282. success: res1 => {
  283. if (res1.confirm) {
  284. this.submitApi()
  285. } else if (res1.cancel) {
  286. //('用户点击取消');
  287. }
  288. }
  289. })
  290. }else{
  291. this.submitApi()
  292. }
  293. },
  294. }
  295. }
  296. </script>
  297. <style lang="scss">
  298. .jpmain{padding-bottom: 120rpx;}
  299. .list{
  300. background-color: rgba(255,255,255,1);
  301. border-radius: 8px;
  302. margin: 20rpx ;
  303. .item:first-child {
  304. border-bottom:2rpx solid rgba(232,232,232,1);
  305. font-size: 16px;
  306. font-weight: bold;
  307. }
  308. .item{
  309. padding: 20rpx 24rpx;
  310. .name{
  311. // width: 40%;
  312. padding-bottom: 32rpx;
  313. font-size: 32rpx;
  314. color: #777777;
  315. span{
  316. color:red
  317. }
  318. white-space: pre;
  319. }
  320. .valueplus{
  321. display: flex;
  322. justify-content: space-between;
  323. }
  324. .valueclock{
  325. width: 100%;
  326. border-radius: 8rpx;
  327. padding: 0 8px;
  328. height: 64rpx;
  329. line-height: 64rpx;
  330. background-color: rgba(241,242,245,1);
  331. }
  332. .value{
  333. font-size: 32rpx;
  334. display: flex;
  335. align-items: center;
  336. input::placeholder{
  337. color:#AAAAAA;
  338. }
  339. .img{
  340. width: 40rpx;
  341. height: 40rpx;
  342. }
  343. .textarea{
  344. background-color: rgba(241,242,245,1);
  345. width: 100%;
  346. border-radius: 8rpx;
  347. }
  348. .typeN{
  349. font-size: 24rpx;
  350. margin-right: 8rpx;
  351. display: flex;
  352. align-items: center;
  353. border-radius: 8rpx;
  354. padding: 4rpx 8rpx;
  355. color: #fff;
  356. }
  357. .typeN1{
  358. background-color:#1677ff;
  359. //border: 2rpx solid #1677ff;
  360. }
  361. .typeN2{
  362. background-color:#19be6b;
  363. //border: 2rpx solid #19be6b;
  364. }
  365. }
  366. }
  367. }
  368. .textareaclass{
  369. padding:16rpx
  370. }
  371. .floating-button {
  372. z-index: 999;
  373. position: fixed;
  374. bottom: 0; /* 距离底部 20px */
  375. width: 100%;
  376. display: flex;
  377. height: 120rpx;
  378. justify-content: center;
  379. background-color: rgba(255,255,255,1);
  380. .button{
  381. margin-top: 24rpx;
  382. border-radius: 50px;
  383. height: 80rpx;
  384. width: 80%;
  385. display: flex;
  386. align-items: center;
  387. justify-content: center;
  388. padding:12rpx;
  389. background-color: rgba(22,119,255,1);
  390. color: rgba(255,255,255,1);
  391. font-size: 36rpx;
  392. }
  393. }
  394. .viewImg{
  395. width: 160rpx;
  396. height: 160rpx;
  397. }
  398. </style>