|  | @@ -19,7 +19,7 @@
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |        <!-- 底部按钮 -->
 | 
	
		
			
				|  |  | -      <div class="bottomClass" v-if="this.$route.params.id.split('_')[1]!=2">
 | 
	
		
			
				|  |  | +      <div class="bottomClass" v-if="this.$route.params.id.split('_')[1] != 2">
 | 
	
		
			
				|  |  |          <van-row>
 | 
	
		
			
				|  |  |            <van-col span="24">
 | 
	
		
			
				|  |  |              <van-button type="info" @click="addInfoHandler">添加调阅记录</van-button>
 | 
	
	
		
			
				|  | @@ -32,15 +32,19 @@
 | 
	
		
			
				|  |  |          </van-row>
 | 
	
		
			
				|  |  |        </div>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  | +    <!-- 扫描弹框 -->
 | 
	
		
			
				|  |  | +    <scandialog ref="scandialog" @change="resultImg" @changeNFC="getNFC"></scandialog>
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import NavBar from '@/components/NavBar'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  // 主机列表组件
 | 
	
		
			
				|  |  |  import MonitoingList from './monitoringList.vue'
 | 
	
		
			
				|  |  | -import { Col, Row, Dialog, Icon, Picker } from 'vant'
 | 
	
		
			
				|  |  | -import { registrationList, getEndInfo, login } from '@/api/toConsult.js'
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +import { Col, Row, Dialog, Toast, Icon, Picker } from 'vant'
 | 
	
		
			
				|  |  | +import { registrationList, getEndInfo, login, registration } from '@/api/toConsult.js'
 | 
	
		
			
				|  |  | +import scandialog from '@/components/nfcPopup/alone.vue'
 | 
	
		
			
				|  |  | +import { base64ToBlob } from '@/utils/base64TurnImg.js'
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    data() {
 | 
	
		
			
				|  |  |      return {
 | 
	
	
		
			
				|  | @@ -48,6 +52,7 @@ export default {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    components: {
 | 
	
		
			
				|  |  | +    scandialog,
 | 
	
		
			
				|  |  |      NavBar,
 | 
	
		
			
				|  |  |      Dialog,
 | 
	
		
			
				|  |  |      Icon,
 | 
	
	
		
			
				|  | @@ -77,17 +82,73 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      //结束调阅
 | 
	
		
			
				|  |  |      endMontor() {
 | 
	
		
			
				|  |  | +      //没有记录的时候不能结束调阅
 | 
	
		
			
				|  |  | +      if(this.taskData?.coreMonitoringTaskRegistrationMonitorVOList.length==0){
 | 
	
		
			
				|  |  | +        Dialog({ message: '该调阅没有记录不能进行结束操作!' })
 | 
	
		
			
				|  |  | +        return 
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        let startDate = JSON.parse(JSON.stringify(this.taskData.taskStartTime))
 | 
	
		
			
				|  |  | -      
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        startDate = Date.parse(new Date(startDate))
 | 
	
		
			
				|  |  |        let endDate = Date.parse(new Date())
 | 
	
		
			
				|  |  |        if (endDate - startDate <= 3600000) {
 | 
	
		
			
				|  |  |          Dialog({ message: '该调阅未满一个小时请确认' })
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +        //未满一小时不能结束调阅
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +      this.$refs.scandialog.visible = true
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |        startDate = new Date(startDate)
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //文件上传
 | 
	
		
			
				|  |  | +    resultImg(img) {
 | 
	
		
			
				|  |  | +      let obj = base64ToBlob(img.base)
 | 
	
		
			
				|  |  | +      let formData = new FormData()
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      obj.name = '调阅.jpg'
 | 
	
		
			
				|  |  | +      formData.append('file', base64ToBlob(img.base))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      upload(formData, 'image')
 | 
	
		
			
				|  |  | +        .then(res => {
 | 
	
		
			
				|  |  | +          console.log(process.env.NODE_ENV)
 | 
	
		
			
				|  |  | +          /*上传成功*/
 | 
	
		
			
				|  |  | +          let imgUrl = process.env.NODE_ENV === 'development' ? res.data.url : window.origin + res.data.url
 | 
	
		
			
				|  |  | +          this.photoHandler(imgUrl)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          // this.$emit("imgUrl", res.data.url);
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .catch(err => {
 | 
	
		
			
				|  |  | +          /*上传失败*/
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //上传NFC
 | 
	
		
			
				|  |  | +    getNFC(nfc) {
 | 
	
		
			
				|  |  | +      this.photoHandler('', nfc)
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //扫描图片并上传到服务器和后端
 | 
	
		
			
				|  |  | +    photoHandler(img = '', nfc = '') {
 | 
	
		
			
				|  |  | +      //上传到服务器
 | 
	
		
			
				|  |  | +      //开始调阅上传
 | 
	
		
			
				|  |  | +      let obj = {
 | 
	
		
			
				|  |  | +        endPicture: img,
 | 
	
		
			
				|  |  | +        endNfc: nfc,
 | 
	
		
			
				|  |  | +        taskId: this.$route.params.id.split('_')[0]
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      registration(obj).then(res => {
 | 
	
		
			
				|  |  | +        let { code, data, msg } = res
 | 
	
		
			
				|  |  | +        if (code == 200) {
 | 
	
		
			
				|  |  | +          Toast.success('扫描成功')
 | 
	
		
			
				|  |  | +          //结束调阅
 | 
	
		
			
				|  |  | +          this.endHandler()
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    endHandler() {
 | 
	
		
			
				|  |  |        getEndInfo({
 | 
	
		
			
				|  |  |          id: this.taskData.id,
 | 
	
		
			
				|  |  | -        taskId: this.$route.params.id
 | 
	
		
			
				|  |  | +        taskId: this.$route.params.id.split('_')[0]
 | 
	
		
			
				|  |  |        }).then(res => {
 | 
	
		
			
				|  |  |          this.$router.push('/monitoringCall')
 | 
	
		
			
				|  |  |        })
 |