reset.vue 3.3 KB

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