addCamera.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view>
  3. <view
  4. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;">
  5. <span
  6. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 20rpx;"></span>
  7. <!-- <h4 style="width: 140rpx;border-radius: 200rpx;text-align: center;color: #2979ff;border: 2rpx solid #1785FF;float: right;margin-right: 10rpx;margin-top: 10rpx;">2222222</h4> -->
  8. <view style="width: 92%;margin: 0 auto;margin: 0 auto;">
  9. <view
  10. style="display: flex;justify-content: space-between;height: 80rpx;line-height: 80rpx;border-bottom: 1rpx solid #eff4ff;">
  11. <h3>添加监控信息</h3>
  12. </view>
  13. <view>
  14. <u-field v-model="form.deviceName" label="监控名称:" label-width="150" required placeholder="请填写监控名称" />
  15. <u-field v-model="form.deviceSerial" label="设备序列号:" label-width="150" required
  16. placeholder="请填写设备序列号" />
  17. <u-field v-model="form.fWarehouseName" label="绑定仓库:" label-width="150" required disabled @click="show = !show" placeholder="请填写仓库" />
  18. <u-field v-model="dataForm.devices[0].connection.validateCode" label="萤石验证码:" label-width="150" required
  19. placeholder="请填写萤石验证码" />
  20. </view>
  21. </view>
  22. </view>
  23. <view
  24. style="width: 100%;position:fixed; bottom:44rpx;background-color: #FFFFFF;padding-left: 20px;padding-right: 20px;">
  25. <u-button type="primary" @click="appCheckCode">确认添加</u-button>
  26. </view>
  27. <!-- <u-action-sheet :list="listData" @click="click" v-model="show" :mask-close-able="false"></u-action-sheet> -->
  28. <u-select v-model="show" :list="listData" @confirm="click" value-name="fId" label-name="text"></u-select>
  29. <u-toast ref="uToast" />
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. form: {
  37. deviceSerial: "",
  38. fWarehouseId:"",
  39. fWarehouseName:"",
  40. projectId: ""
  41. },
  42. show:false,
  43. listData:[],
  44. dataForm: {
  45. devices: [{
  46. deviceTypeCode: "IPCamera", //设备二级分类
  47. deviceSerial: "G26011245", //设备序列号
  48. deviceCategory: "Video", //设备大类
  49. // deviceRelatedInfo: {
  50. // deviceOrgId: "1320208694555696" //组织ID
  51. // },
  52. connection: {
  53. validateCode: "" //验证码mkdirmd5A
  54. },
  55. projectId: "1390317392767280", //项目ID
  56. deviceName: "", //设备名称
  57. treatyType: "ezviz_net" //传输协议
  58. }]
  59. }
  60. }
  61. },
  62. created() {
  63. this.$u.get('/basicdata/warehouse/appList').then(res=>{
  64. console.log(res)
  65. for(let item in res.rows){
  66. this.listData.push({
  67. text:res.rows[item].fName,
  68. fId:res.rows[item].fId
  69. })
  70. }
  71. console.log(this.listData)
  72. })
  73. },
  74. methods: {
  75. //选择仓库
  76. click(item){
  77. this.form.fWarehouseId = item[0].value
  78. this.form.fWarehouseName = item[0].label
  79. },
  80. // 确认添加监控
  81. appCheckCode() {
  82. if(!this.form.deviceSerial){
  83. this.$refs.uToast.show({
  84. title: '请填写设备序列号',
  85. position:'bottom'
  86. })
  87. }
  88. if(!this.form.fWarehouseId){
  89. this.$refs.uToast.show({
  90. title: '请选择仓库',
  91. position:'bottom'
  92. })
  93. }
  94. if(!this.form.deviceName){
  95. this.$refs.uToast.show({
  96. title: '请填写监控名称',
  97. position:'bottom'
  98. })
  99. }
  100. if(!this.dataForm.devices[0].connection.validateCode){
  101. this.$refs.uToast.show({
  102. title: '请填写萤石验证码',
  103. position:'bottom'
  104. })
  105. }
  106. this.haikangInterfaceAdd()
  107. },
  108. haikangInterfaceAdd() {
  109. this.dataForm.devices[0].deviceName = this.form.deviceName
  110. this.dataForm.devices[0].deviceSerial = this.form.deviceSerial
  111. uni.request({
  112. url: 'https://open.hikyun.com/artemis/api/eits/v2/global/device/ezviz/save', //添加设备到第三方平台
  113. data: this.dataForm,
  114. header: {
  115. 'access_token': uni.getStorageSync('access_token') //自定义请求头信息
  116. },
  117. method:'POST',
  118. success: (res) => {
  119. if(res.data.code == 200){
  120. this.form.projectId = '1390317392767280'
  121. this.$u.post('/warehouse/webcam/', this.form).then(res => {
  122. this.$refs.uToast.show({
  123. title: '添加成功',
  124. position:'bottom'
  125. })
  126. })
  127. }else{
  128. this.$refs.uToast.show({
  129. title: res.data.msg,
  130. position:'bottom'
  131. })
  132. }
  133. }
  134. });
  135. },
  136. }
  137. }
  138. </script>
  139. <style>
  140. </style>