电速宝
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // pages/userlist/index.js
  2. const api = require('../../../api/index.js');
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. userdata:[],
  9. visible:false,
  10. selectdriveralldata:[],
  11. selectcaralldata:[],
  12. workorderId:'',
  13. driverindex:0,
  14. carindex:0
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad(options) {
  20. this.getuser()
  21. this.onselectdriverall()
  22. this.onselectcarall()
  23. },
  24. getuser(){
  25. let data ={
  26. workorderType:0
  27. }
  28. api.request(`/sysworkorder/selectworkorderlist`, 'post',data,{ isPublic: false })
  29. .then((data) => {
  30. console.log(data.data);
  31. if (data.code==200) {
  32. this.setData({
  33. userdata:data.data
  34. })
  35. }
  36. })
  37. .catch((err) => {
  38. console.error('请求失败:', err);
  39. });
  40. },
  41. cancelOrder(e){
  42. console.log(e.currentTarget.dataset.id);
  43. this.setData({
  44. workorderId:e.currentTarget.dataset.id,
  45. visible:true
  46. })
  47. },
  48. // 查询全部司机
  49. onselectdriverall(){
  50. let data = {
  51. operationId:'',
  52. driverType:'',
  53. driverName:''
  54. }
  55. api.request(`/sysdriver/selectdriverall`, 'post',data,{ isPublic: false })
  56. .then((data) => {
  57. console.log(data.data);
  58. if (data.code==200) {
  59. this.setData({
  60. selectdriveralldata:data.data
  61. })
  62. }
  63. })
  64. .catch((err) => {
  65. console.error('请求失败:', err);
  66. });
  67. },
  68. // 查询全部车辆
  69. onselectcarall(){
  70. let data = {
  71. }
  72. api.request(`/syscar/selectcarall`, 'post',data,{ isPublic: false })
  73. .then((data) => {
  74. if (data.code==200) {
  75. this.setData({
  76. selectcaralldata:data.data
  77. })
  78. }
  79. })
  80. .catch((err) => {
  81. console.error('请求失败:', err);
  82. });
  83. },
  84. ondriverChange(){
  85. this.setData({
  86. visible:false
  87. })
  88. },
  89. onVisibleChange1() {
  90. this.setData({
  91. visible:false
  92. })
  93. },
  94. onVisibleChange(e) {
  95. this.setData({
  96. driverindex: e.detail.value,
  97. });
  98. },
  99. oncarChange(e) {
  100. console.log(e);
  101. this.setData({
  102. carindex: e.detail.value,
  103. });
  104. },
  105. submit(){
  106. let data = {
  107. driverId:this.data.selectdriveralldata[this.data.driverindex].operationId,
  108. carId:this.data.selectcaralldata[this.data.carindex].carId,
  109. workorderId:this.data.workorderId
  110. }
  111. api.request(`/sysoperationsstaff/allocatedriver`, 'post',data,{ isPublic: false })
  112. .then((data) => {
  113. if (data.code==200) {
  114. console.log(data);
  115. this.setData({
  116. visible:false
  117. })
  118. this.getuser()
  119. }
  120. })
  121. .catch((err) => {
  122. console.error('请求失败:', err);
  123. });
  124. },
  125. /**
  126. *
  127. */
  128. onReady() {
  129. },
  130. /**
  131. * 生命周期函数--监听页面显示
  132. */
  133. onShow() {
  134. },
  135. /**
  136. * 生命周期函数--监听页面隐藏
  137. */
  138. onHide() {
  139. },
  140. /**
  141. * 生命周期函数--监听页面卸载
  142. */
  143. onUnload() {
  144. },
  145. /**
  146. * 页面相关事件处理函数--监听用户下拉动作
  147. */
  148. onPullDownRefresh() {
  149. },
  150. /**
  151. * 页面上拉触底事件的处理函数
  152. */
  153. onReachBottom() {
  154. },
  155. /**
  156. * 用户点击右上角分享
  157. */
  158. onShareAppMessage() {
  159. }
  160. })