reset.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view class="work-container">
  3. <view style="margin-top: 10px">
  4. <u-cell @click="resetUser" title="扫码注销" :isLink="true" arrow-direction="left"></u-cell>
  5. <u-cell title="注销记录" :isLink="true" url="/subpkg/device/reset/resetrecord" arrow-direction="left"></u-cell>
  6. </view>
  7. <u-modal :show="show" :title="dlgTitle" @cancel="cancel" :showCancelButton="true" @confirm="bingDevice" >
  8. <view class="slot-content">
  9. <view>设备名称:{{ scanDevice.deviceName }}</view>
  10. <view>产品名称:{{ scanDevice.productName }}</view>
  11. <view>设备编号:{{ scanDevice.serialNumber }}</view>
  12. <view>激活日期:{{ scanDevice.activeTime }}</view>
  13. </view>
  14. </u-modal>
  15. </view>
  16. </template>
  17. <script>
  18. import {getDevcieByQrcode,resetDevice} from '@/api/device/device';
  19. export default {
  20. data() {
  21. return {
  22. dlgTitle:"",
  23. current: 0,
  24. swiperDotIndex: 0,
  25. show:false,
  26. scanDevice:{},
  27. }
  28. },
  29. onLoad(){
  30. },
  31. methods: {
  32. bingDevice(){
  33. this.show = false;
  34. resetDevice(this.scanDevice).then(res=>{
  35. if(res.code == 200){
  36. this.$modal.showToast('操作成功')
  37. }else{
  38. this.$modal.showToast(res.msg);
  39. }
  40. })
  41. },
  42. cancel(){
  43. this.show = false;
  44. this.scanDevice = {};
  45. },
  46. resetUser(){
  47. let self = this;
  48. uni.scanCode({
  49. success: function (res) {
  50. console.log('条码内容:' + res.result);
  51. getDevcieByQrcode(res.result).then(res=>{
  52. let device = res.data;
  53. if(!device){
  54. self.$modal.showToast('未查到设备信息')
  55. }else{
  56. if(device.deptId == null){
  57. self.$modal.showToast('该设备未绑定用户')
  58. }else{
  59. self.scanDevice = device;
  60. self.dlgTitle = "解绑设备";
  61. device.deptId = -1;
  62. self.show = true;
  63. }
  64. }
  65. });
  66. },
  67. fail(res){
  68. console.log(res);
  69. }
  70. });
  71. },
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. /* #ifndef APP-NVUE */
  77. .u-collapse-content{
  78. display: flex;
  79. flex-direction: column;
  80. }
  81. page {
  82. display: flex;
  83. flex-direction: column;
  84. box-sizing: border-box;
  85. background-color: #fff;
  86. min-height: 100%;
  87. height: auto;
  88. }
  89. view {
  90. font-size: 14px;
  91. line-height: inherit;
  92. }
  93. /* #endif */
  94. .text {
  95. text-align: center;
  96. font-size: 26rpx;
  97. margin-top: 10rpx;
  98. }
  99. .grid-item-box {
  100. flex: 1;
  101. /* #ifndef APP-NVUE */
  102. display: flex;
  103. /* #endif */
  104. flex-direction: column;
  105. align-items: center;
  106. justify-content: center;
  107. padding: 15px 0;
  108. }
  109. .uni-margin-wrap {
  110. width: 690rpx;
  111. width: 100%;
  112. ;
  113. }
  114. .swiper {
  115. height: 300rpx;
  116. }
  117. .swiper-box {
  118. height: 150px;
  119. }
  120. .swiper-item {
  121. /* #ifndef APP-NVUE */
  122. display: flex;
  123. /* #endif */
  124. flex-direction: column;
  125. justify-content: center;
  126. align-items: center;
  127. color: #fff;
  128. height: 300rpx;
  129. line-height: 300rpx;
  130. }
  131. @media screen and (min-width: 500px) {
  132. .uni-swiper-dot-box {
  133. width: 400px;
  134. /* #ifndef APP-NVUE */
  135. margin: 0 auto;
  136. /* #endif */
  137. margin-top: 8px;
  138. }
  139. .image {
  140. width: 100%;
  141. }
  142. }
  143. </style>