planDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. <template>
  2. <view>
  3. <u-navbar title="计划详情">
  4. <view class="details" slot="bottom">
  5. <view class="list">
  6. <view class="list-head">
  7. <view class="title">
  8. 检验时间{{queryDate}}
  9. </view>
  10. <view class="amount" @click="gotoscan('')">
  11. <u-icon name="scan" color="#0051ff" ></u-icon>扫码识别
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </u-navbar>
  17. <u-popup v-model="showpopup" class="scanpopo" mode="bottom"
  18. border-radius="14"
  19. :closeable="true" >
  20. <view class="scantitle">连续扫码</view>
  21. <view class="scanlist">
  22. <view class="scan-list-infos" :style="nowscan.healthStatus&&nowscan.healthStatus!=1?'background-color:#FFC107':''">
  23. <view class="scan-infos-head" @click="gotoInfo(nowscan.id)">
  24. <view class="name">
  25. {{nowscan.title?nowscan.title:'扫码后出当前结果'}}
  26. </view>
  27. <view class="name">
  28. 编号:{{showCode(nowscan)}}
  29. <span class="name" v-show="nowscan&&nowscan.id" style="color:blue;">
  30. 点击查看
  31. </span>
  32. </view>
  33. </view>
  34. <view class="scan-infos-head " style="margin-bottom: 12rpx;">
  35. <view class="name" v-html="descriptionKey(nowscan)">
  36. </view>
  37. </view>
  38. <view class="scan-infos">
  39. <!-- <view class="infos-2">
  40. <view class="infos-item">
  41. <view class="item-name">
  42. 规格:
  43. </view>
  44. <view class="item-value">
  45. {{nowscan.specifications}}
  46. </view>
  47. </view>
  48. <view class="infos-item">
  49. <view class="item-name">
  50. 型号:
  51. </view>
  52. <view class="item-value">
  53. {{nowscan.model}}
  54. </view>
  55. </view>
  56. </view> -->
  57. </view>
  58. </view>
  59. </view>
  60. <!-- #ifdef MP-WEIXIN -->
  61. <camera mode="scanCode" resolution='medium'
  62. @scancode="takeCode" v-if="showpopup"
  63. device-position="back" flash="off" @error="error"
  64. style="width: 100%; height: 300px;"></camera>
  65. <!-- #endif -->
  66. </u-popup>
  67. <view class="container">
  68. <view class="main">
  69. <view class="list-item" v-for="(item,index) in scanList" :key="index">
  70. <!--信息 -->
  71. <view class="list-infos">
  72. <view class="infos-head">
  73. <view class="name">
  74. {{item.title}}
  75. </view>
  76. <view class="qr-code" style="color:red;" @click="delOutListMethod(index)">
  77. 删除
  78. </view>
  79. </view>
  80. <view class="infos">
  81. <view class="infos-1">
  82. <view class="infos-item">
  83. <view class="item-name">
  84. 型号:
  85. </view>
  86. <view class="item-value">
  87. {{item.model}}
  88. </view>
  89. </view>
  90. </view>
  91. <view class="infos-2">
  92. <view class="infos-item">
  93. <view class="item-name">
  94. 设备编号:
  95. </view>
  96. <view class="item-value">
  97. {{showCode(item)}}
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="receive-options">
  104. <view class="title">
  105. 检验结果
  106. </view>
  107. <view class="receive-radio">
  108. <u-radio-group v-model="item.reStatus" @change="radioGroupChange">
  109. <u-radio @change="radioChange" v-for="(radio, index2) in radiolist" :key="index2"
  110. :name="radio.value" :disabled="radio.disabled">
  111. {{radio.name}}
  112. </u-radio>
  113. </u-radio-group>
  114. </view>
  115. </view>
  116. <!-- 备注 -->
  117. <textarea placeholder="备注" class="uni-textarea" v-model="item.reRemark" name="" id="" cols="30" rows="10"></textarea>
  118. <!-- 上传图片 -->
  119. <view class="upload-img">
  120. <ujp-upload width="144" height="144" :ref="'uUpload'+index"
  121. :key="index"
  122. name="photoFile" :multiple="false"
  123. :form-data="formData" :header="header" :action="action"
  124. max-count="4" upload-text=" " del-bg-color="#0051FF" ></ujp-upload>
  125. </view>
  126. </view>
  127. </view>
  128. <u-divider :isnone="scanList.length==0"
  129. nonetext="点击'扫码'进行检验" border-color="#CFD2D5">已经到底了</u-divider>
  130. </view>
  131. <view class="bottom">
  132. <u-button type="primary" @click="gotoOut()">检验完成</u-button>
  133. </view>
  134. </view>
  135. </template>
  136. <script>
  137. import * as API from '@/apis/pagejs/storeManagement.js'
  138. import ujpUpload from "@/pages/storeManagement/components/u-upload.vue"
  139. import {
  140. parseUnixTime
  141. } from '@/apis/utils'
  142. export default {
  143. components:{
  144. ujpUpload
  145. },
  146. data() {
  147. return {
  148. queryDate: "",
  149. nowscan: {
  150. "title": "",
  151. "specifications": "",
  152. "experimentLastTime":"",
  153. "manufactor": "",
  154. "unit": "",
  155. "model": "",
  156. "code": "",
  157. },
  158. scanList: [],
  159. scanFunctionIsUseable: true,
  160. showpopup: false,
  161. action: "",
  162. formData: {
  163. subFolder: "equipmentEnter"
  164. },
  165. header: {
  166. },
  167. radiolist: [{
  168. name: '合格',
  169. value: "1",
  170. disabled: false
  171. },
  172. {
  173. name: '不合格',
  174. value: "2",
  175. disabled: false
  176. },
  177. ],
  178. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  179. value: '合格',
  180. show: false
  181. };
  182. },
  183. onLoad(op) {
  184. // this.id=op.id
  185. // this.getInfo()
  186. this.queryDate = parseUnixTime(new Date(), "{y}-{m}-{d}")
  187. this.action = process.car.BASE_URL + "uploadPicture"
  188. this.formData.subFolder = "planDetail"
  189. //接口应该免登陆
  190. var token = this.carhelp.getToken()
  191. this.header = {
  192. 'Authorization': token
  193. }
  194. },
  195. methods: {
  196. error(e) {
  197. console.log(e);
  198. },
  199. delOutListMethod(c) {
  200. if (c > -1) {
  201. this.scanList.splice(c, 1)
  202. uni.showToast({
  203. title: "删除成功",
  204. icon: "none"
  205. })
  206. }
  207. },
  208. gotoOut() {
  209. if(this.scanList.length==0){
  210. uni.showToast({
  211. title: "请扫码检验设备",
  212. icon: "none"
  213. })
  214. return
  215. }
  216. var bl=true;
  217. for(var x in this.scanList){
  218. var obj=this.scanList[x];
  219. var lists1=[];
  220. var lists2 =this.$refs["uUpload"+x][0].lists
  221. for(var i in lists2){
  222. var item=lists2[i]
  223. if(item.progress==100&&item.response&&item.response.result){
  224. }else{
  225. uni.showToast({
  226. title:"第"+(x+1)+"行图片上传中,请稍后"
  227. })
  228. bl=false
  229. break;
  230. }
  231. var p =item.response.data.fileUrl;
  232. lists1.push(p);
  233. }
  234. if(!bl){
  235. break;
  236. }
  237. obj.imgUrls=lists1.join()
  238. this.scanList[x]=obj;
  239. }
  240. if(!bl){
  241. return;
  242. }
  243. var returnObj=this.scanList.map(item=>{
  244. return {
  245. deviceId:item.id,
  246. remark:item.reRemark,
  247. status:item.reStatus,
  248. imgUrls:item.imgUrls,
  249. }
  250. })
  251. console.log(returnObj);
  252. var json={
  253. deviceData:returnObj
  254. }
  255. this.submitInfo({
  256. recordData:JSON.stringify(json)
  257. })
  258. },submitInfo(obj){
  259. uni.showLoading({
  260. title: "加载中",
  261. mask: true,
  262. })
  263. API.saveInspection(obj).then((res) => {
  264. uni.hideLoading();
  265. const eventChannel = this.getOpenerEventChannel();
  266. eventChannel.emit('refreshData');
  267. uni.navigateBack()
  268. }).catch(error => {
  269. uni.showToast({
  270. title: error,
  271. icon: "none"
  272. })
  273. })
  274. },
  275. // 选中某个单选框时,由radio时触发
  276. radioChange(e) {
  277. // console.log(e);
  278. },
  279. // 选中任一radio时,由radio-group触发
  280. radioGroupChange(e) {
  281. // console.log(e);
  282. },
  283. beforeUpload(index, list) {
  284. // 只上传偶数索引的文件
  285. if (index % 2 == 0) return true;
  286. else return false;
  287. },
  288. changeShow() {
  289. this.show = !this.show
  290. },
  291. gotoscan(val) {
  292. // if(this.deviceposition=='back'){
  293. // this.deviceposition="front"
  294. // }else{
  295. // this.deviceposition="back"
  296. // }
  297. // #ifdef H5
  298. this.gotoscanH5(val)
  299. // #endif
  300. // #ifdef MP-WEIXIN
  301. this.gotoscanMP(val)
  302. // #endif
  303. },
  304. takeCode(e) {
  305. console.log(e);
  306. if (this.scanFunctionIsUseable) {
  307. this.scanFunctionIsUseable = false;
  308. // 对扫码结果进行处理
  309. console.log(e.detail.result);
  310. this.getscan(this.takeCodeJp(e.detail.result))
  311. // 扫码间隔两秒
  312. setTimeout(() => {
  313. this.scanFunctionIsUseable = true;
  314. }, 1000)
  315. }
  316. },
  317. gotoscanMP(val) {
  318. this.showpopup = true;
  319. // const ctx = uni.createCameraContext();
  320. // ctx.takePhoto({
  321. // quality: 'high',
  322. // success: (res) => {
  323. // this.src = res.tempImagePath
  324. // }
  325. // });
  326. },
  327. gotoscanH5(val) {
  328. console.log('111')
  329. var _this = this;
  330. uni.showModal({
  331. title: '提示',
  332. editable: true,
  333. //content: '这是一个模态弹窗',
  334. success: function(res) {
  335. if (res.confirm) {
  336. _this.getscan(res.content)
  337. } else if (res.cancel) {
  338. console.log('用户点击取消');
  339. }
  340. }
  341. });
  342. },
  343. getscan(val) {
  344. this.showpopup = true;
  345. var c = this.scanList.find(item => {
  346. return item.code == val
  347. })
  348. if (c) {
  349. return
  350. }
  351. uni.showLoading({
  352. title: "加载中",
  353. mask: true,
  354. })
  355. API.queryDeviceByCode({
  356. code: val,
  357. }).then((res) => {
  358. uni.hideLoading();
  359. if (res.data.deviceInfo) {
  360. console.log(res.data.deviceInfo)
  361. this.nowscan = res.data.deviceInfo;
  362. var info = res.data.deviceInfo;
  363. info.reStatus="1"
  364. info.reRemark=""
  365. uni.showToast({
  366. title: "扫码成功",
  367. icon: "none"
  368. })
  369. this.scanList.push(info)
  370. } else {
  371. uni.showToast({
  372. title: "二维码无效",
  373. icon: "none"
  374. })
  375. this.nowscan={}
  376. }
  377. }).catch(error => {
  378. uni.showToast({
  379. title: error,
  380. icon: "none"
  381. })
  382. })
  383. },
  384. },
  385. };
  386. </script>
  387. <style scoped lang="scss">
  388. .head {
  389. background-color: #fff;
  390. padding: 32rpx;
  391. .title {
  392. color: rgba(51, 51, 51, 1);
  393. font-size: 36rpx;
  394. margin-bottom: 16rpx;
  395. }
  396. .item {
  397. display: flex;flex-wrap: wrap;
  398. color: #777777;
  399. margin-top: 16rpx;
  400. .name,
  401. .value {
  402. font-weight: bold;
  403. }
  404. .unfold {
  405. margin-left: auto;
  406. position: relative;
  407. color: red;
  408. font-family: Microsoft Yahei;
  409. /deep/.uicon-arrow-down {
  410. margin-left: 8rpx;
  411. }
  412. }
  413. .options {
  414. width: 120rpx;
  415. height: 60rpx;
  416. line-height: 60rpx;
  417. text-align: center;
  418. background-color: #fff;
  419. color: rgba(65, 80, 88, 1);
  420. font-family: Microsoft Yahei;
  421. position: absolute;
  422. top: 320rpx;
  423. right: 24rpx;
  424. box-shadow: 5px 5px 10px gray;
  425. }
  426. }
  427. }
  428. .scantitle{
  429. text-align: center;
  430. font-size: 44rpx;
  431. padding-top: 20px;
  432. }
  433. .details {
  434. background-color: #fff;
  435. margin-top: 24rpx;
  436. padding: 0 32rpx;
  437. .item {
  438. display: flex;flex-wrap: wrap;
  439. justify-content: space-between;
  440. padding: 12rpx 0;
  441. border-bottom: 1px solid rgba(244, 244, 244, 1);
  442. .name {
  443. line-height: 30px;
  444. color: rgba(119, 119, 119, 1);
  445. }
  446. .value {
  447. color: #101010;
  448. }
  449. }
  450. }
  451. .list {
  452. background-color: #fff;
  453. margin: 24rpx;
  454. padding: 22rpx 32rpx;
  455. .list-head {
  456. display: flex;flex-wrap: wrap;
  457. justify-content: space-between;
  458. align-items: center;
  459. .title {
  460. color: #333333;
  461. font-size: 32rpx
  462. }
  463. .amount {
  464. color: #777777;
  465. font-size: 24rpx;
  466. text {
  467. color: #3385FF;
  468. }
  469. /deep/.u-icon--right {
  470. margin-left: 8rpx;
  471. }
  472. }
  473. }
  474. // 清单信息
  475. .list-infos {
  476. border-radius: 8px;
  477. .infos-head {
  478. display: flex;flex-wrap: wrap;
  479. justify-content: space-between;
  480. align-items: center;
  481. margin-bottom: 24rpx;
  482. .name {
  483. color: rgba(51, 51, 51, 1);
  484. font-size: 32rpx;
  485. }
  486. .qr-code {
  487. border-radius: 4px;
  488. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
  489. color:red;
  490. font-size: 24rpx;
  491. width: 160rpx;
  492. text-align: center;
  493. line-height: 64rpx;
  494. text {
  495. img {
  496. vertical-align: middle;
  497. }
  498. }
  499. }
  500. }
  501. .infos {
  502. margin-top: 16rpx;
  503. display: flex;flex-wrap: wrap;
  504. color: #777777;
  505. font-size: 24rpx;
  506. .infos-1 {
  507. margin-right: 68rpx;
  508. }
  509. .infos-item {
  510. display: flex;flex-wrap: wrap;
  511. margin-bottom: 8rpx;
  512. }
  513. }
  514. .address,
  515. .remark {
  516. display: flex;flex-wrap: wrap;
  517. color: #777777;
  518. font-size: 24rpx;
  519. margin-bottom: 8rpx;
  520. }
  521. }
  522. }
  523. .container {
  524. margin-top: 80px;
  525. padding-bottom: 60px;
  526. .main {
  527. padding: 0 24rpx;
  528. .list-item {
  529. border-radius: 8px;
  530. padding: 24rpx;
  531. background-color: #fff;
  532. margin-top: 24rpx;
  533. }
  534. // 信息
  535. .list-infos {
  536. padding-bottom: 24rpx;
  537. border-bottom: 1px solid rgba(232, 232, 232, 1);
  538. .infos-head {
  539. display: flex;flex-wrap: wrap;
  540. justify-content: space-between;
  541. align-items: center;
  542. margin-bottom: 24rpx;
  543. .name {
  544. color: rgba(51, 51, 51, 1);
  545. font-size: 32rpx;
  546. }
  547. .state {
  548. border: 1px solid rgba(69, 186, 69, 1);
  549. border-radius: 4px;
  550. color: rgba(69, 186, 69, 1);
  551. font-size: 24rpx;
  552. line-height: 48rpx;
  553. width: 160rpx;
  554. text-align: center;
  555. text {
  556. img {
  557. vertical-align: middle;
  558. margin-right: 4rpx;
  559. }
  560. }
  561. }
  562. }
  563. .infos {
  564. margin-top: 16rpx;
  565. display: flex;flex-wrap: wrap;
  566. justify-content: space-between;
  567. color: #777777;
  568. font-size: 24rpx;
  569. .infos-item {
  570. display: flex;flex-wrap: wrap;
  571. margin-bottom: 8rpx;
  572. .item-value {
  573. width: 200rpx;
  574. overflow: hidden;
  575. white-space: nowrap;
  576. text-overflow: ellipsis;
  577. }
  578. }
  579. }
  580. }
  581. // 接收选项
  582. .receive-options {
  583. display: flex;flex-wrap: wrap;
  584. align-items: center;
  585. padding: 24rpx 0;
  586. .title {
  587. color: #333333;
  588. margin-right: 24rpx;
  589. font-weight: bold;
  590. }
  591. .receive-radio {
  592. flex: 1;
  593. /deep/.u-radio-group {
  594. width: 100%;
  595. }
  596. /deep/.u-radio {
  597. margin-right: 48rpx;
  598. }
  599. }
  600. }
  601. // 备注
  602. .uni-textarea {
  603. width: 100%;
  604. height: 80rpx;
  605. line-height: 80rpx;
  606. text-indent: 24rpx;
  607. background-color: rgba(241, 242, 245, 1);
  608. color: rgba(136, 136, 136, 1);
  609. border-radius: 8px;
  610. font-family: Microsoft Yahei;
  611. font-size: 28rpx;
  612. }
  613. // 上传图片
  614. .upload-img {
  615. margin-top: 24rpx;
  616. /deep/.u-add-tips {
  617. margin-top: 0;
  618. }
  619. // 右上角删除图标
  620. /deep/.u-delete-icon {
  621. top: -8rpx;
  622. right: -8rpx;
  623. width: 36rpx;
  624. height: 36rpx;
  625. }
  626. /deep/.u-list-item {
  627. overflow: inherit;
  628. }
  629. /deep/.u-list-item {
  630. margin-right: 8rpx;
  631. }
  632. }
  633. }
  634. }
  635. .bottom {
  636. background-color: #fff;
  637. margin-top: 44rpx;
  638. padding: 16rpx 32rpx;
  639. z-index: 999;
  640. position: fixed;
  641. left: 0;
  642. right: 0;
  643. bottom: 0;
  644. uni-button {
  645. border-radius: 8px;
  646. background: linear-gradient(180deg, rgba(22, 119, 255, 1) 0%, rgba(16, 98, 213, 1) 100%);
  647. color: rgba(255, 255, 255, 1);
  648. font-size: 32rpx;
  649. line-height: 88rpx;
  650. }
  651. }
  652. </style>