reset.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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,bingDeviceDept} 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. bingDeviceDept(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. });
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. /* #ifndef APP-NVUE */
  75. .u-collapse-content{
  76. display: flex;
  77. flex-direction: column;
  78. }
  79. page {
  80. display: flex;
  81. flex-direction: column;
  82. box-sizing: border-box;
  83. background-color: #fff;
  84. min-height: 100%;
  85. height: auto;
  86. }
  87. view {
  88. font-size: 14px;
  89. line-height: inherit;
  90. }
  91. /* #endif */
  92. .text {
  93. text-align: center;
  94. font-size: 26rpx;
  95. margin-top: 10rpx;
  96. }
  97. .grid-item-box {
  98. flex: 1;
  99. /* #ifndef APP-NVUE */
  100. display: flex;
  101. /* #endif */
  102. flex-direction: column;
  103. align-items: center;
  104. justify-content: center;
  105. padding: 15px 0;
  106. }
  107. .uni-margin-wrap {
  108. width: 690rpx;
  109. width: 100%;
  110. ;
  111. }
  112. .swiper {
  113. height: 300rpx;
  114. }
  115. .swiper-box {
  116. height: 150px;
  117. }
  118. .swiper-item {
  119. /* #ifndef APP-NVUE */
  120. display: flex;
  121. /* #endif */
  122. flex-direction: column;
  123. justify-content: center;
  124. align-items: center;
  125. color: #fff;
  126. height: 300rpx;
  127. line-height: 300rpx;
  128. }
  129. @media screen and (min-width: 500px) {
  130. .uni-swiper-dot-box {
  131. width: 400px;
  132. /* #ifndef APP-NVUE */
  133. margin: 0 auto;
  134. /* #endif */
  135. margin-top: 8px;
  136. }
  137. .image {
  138. width: 100%;
  139. }
  140. }
  141. </style>