return.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view>
  3. <view class="vtitle">借用人信息</view>
  4. <view class="form_group">
  5. <view class="lable">扫码</view>
  6. <view class="tag" @click="qr()">
  7. <text class="span" style="width: 90%;"></text>
  8. <text class="icon code">&#xe60e;</text>
  9. </view>
  10. </view>
  11. <view class="form_group">
  12. <view class="lable">设备所属部门</view>
  13. <view class="tag" @click="qr()">
  14. <text class="span">智能技术研究所</text>
  15. <text class="icon more">&#xe631;</text>
  16. </view>
  17. </view>
  18. <view class="form_group">
  19. <view class="lable">借用人</view>
  20. <view class="tag" @click="qr()">
  21. <text class="span"></text>
  22. <text class="icon more">&#xe631;</text>
  23. </view>
  24. </view>
  25. <view class="form_group" v-if="op=='设备借用'">
  26. <view class="lable">借用人部门</view>
  27. <view class="tag">
  28. <text class="span">{{item.UNIT}}</text>
  29. <text class="icon more">&#xe631;</text>
  30. </view>
  31. </view>
  32. <view class="form_group">
  33. <view class="lable">手机号</view>
  34. <view class="tag" @click="qr()">
  35. <text class="span"></text>
  36. <text class="icon more">&#xe631;</text>
  37. </view>
  38. </view>
  39. <view class="vtitle">借用设备信息</view>
  40. <view class="form_group">
  41. <view class="lable">手机号</view>
  42. <view class="tag" @click="qr()"><text class="span">PMQ133701437</text></view>
  43. </view>
  44. <view class="form_group">
  45. <view class="lable">设备名称</view>
  46. <view class="tag" @click="qr()"><text class="span">压力传感器</text></view>
  47. </view>
  48. <view class="form_group">
  49. <view class="lable">计量编号</view>
  50. <view class="tag" @click="qr()"><text class="span">压力传感器</text></view>
  51. </view>
  52. <view class="form_group">
  53. <view class="lable">设备名称</view>
  54. <view class="tag" @click="qr()"><text class="span">PMQ137700009</text></view>
  55. </view>
  56. <view class="form_group">
  57. <view class="lable">三向加速度计</view>
  58. <view class="tag" @click="qr()"><text class="span">三向加速度计</text></view>
  59. </view>
  60. <button class="btn">提交</button>
  61. </view>
  62. </template>
  63. <script>
  64. let qrcode = require('@/common/code.js');
  65. export default {
  66. data() {
  67. return {
  68. item: {},
  69. op: '设备归还',
  70. current: 0
  71. };
  72. },
  73. onLoad(e) {
  74. this.op = e.op;
  75. this.empty();
  76. //选中审批人员监听函数,其它类型的参考这个
  77. uni.$on('select', res => {
  78. console.log('asd:' + JSON.stringify(res));
  79. });
  80. },
  81. onReady() {
  82. uni.setNavigationBarTitle({
  83. title: this.op
  84. });
  85. },
  86. methods: {
  87. qr() {
  88. // 调用uni提供的调用相机api
  89. uni.chooseImage({
  90. sizeType: ['original'],
  91. sourceType: ['camera'],
  92. count: 1,
  93. success: res => {
  94. const tempFilePaths = res.tempFilePaths[0]; // 获取到二维码图片的链接
  95. qrcode.decode(tempFilePaths); // 解析二维码图片
  96. qrcode.callback = r => {
  97. this.item.code = r;
  98. console.log('asd:' + r);
  99. this.$forceUpdate();
  100. };
  101. }
  102. });
  103. },
  104. //选择结果形式
  105. change(e) {
  106. this.current = e;
  107. console.log('aa:' + this.radio[this.current].name);
  108. },
  109. //选择审批人员
  110. select() {
  111. uni.navigateTo({
  112. url: '/pages/index/select'
  113. });
  114. },
  115. empty() {
  116. var url= "";
  117. if(this.op=='设备借用'){
  118. url=this.http.urls.borr_empty
  119. }else{
  120. url=this.http.urls.return_empty
  121. }
  122. this.http.request({
  123. url: url,
  124. data: this.item,
  125. success: res => {
  126. this.item = res.data.data.items;
  127. console.log('res2:' + JSON.stringify(this.item ));
  128. }
  129. });
  130. },
  131. //提交
  132. validate() {
  133. this.http.request({
  134. url: this.http.urls.validate,
  135. data: this.item,
  136. method: 'POST',
  137. success: res => {
  138. uni.showModal({
  139. title: '提示',
  140. content: '提交成功',
  141. showCancel: false,
  142. success: res => {
  143. if (res.confirm) {
  144. uni.navigateBack();
  145. }
  146. }
  147. });
  148. }
  149. });
  150. },
  151. //提交
  152. add() {
  153. this.http.request({
  154. url: this.http.urls.user_task_add,
  155. data: this.item,
  156. method: 'POST',
  157. success: res => {
  158. uni.showModal({
  159. title: '提示',
  160. content: '提交成功',
  161. showCancel: false,
  162. success: res => {
  163. if (res.confirm) {
  164. uni.navigateBack();
  165. }
  166. }
  167. });
  168. }
  169. });
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss">
  175. .btn {
  176. width: 80%;
  177. margin-top: 20px;
  178. margin-bottom: 20px;
  179. }
  180. </style>