transfer.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="assign-container">
  3. <u-popup :show="popShow" @close="close">
  4. <view class="select-container">
  5. <view class="title">
  6. <text class="btn cancel" @tap="close">取消</text>
  7. 工单转派
  8. <text class="btn confirm" @tap="submit">确定</text>
  9. </view>
  10. <view class="select-wrapper">
  11. <view class="col deptInp">
  12. <text class="label">车辆:</text>
  13. <zxz-uni-data-select :localdata="carList" v-model="formData.trakId" @change="handleCarChange"
  14. filterable></zxz-uni-data-select>
  15. </view>
  16. <view class="col userInp">
  17. <text class="label">司机:</text>
  18. <!-- multiple -->
  19. <zxz-uni-data-select :localdata="driverList" v-model="formData.driverId"
  20. @change="handleDriverChange" filterable></zxz-uni-data-select>
  21. </view>
  22. </view>
  23. </view>
  24. </u-popup>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. carListAPI,
  30. driverListAPI,
  31. logistictraklistnoteUpdateAPI
  32. } from '@/api/pda/dispatchManage/index.js'
  33. import baTreePicker from '@/components/ba-tree-picker/ba-tree-picker.vue'
  34. export default {
  35. components: {
  36. baTreePicker
  37. },
  38. data() {
  39. return {
  40. popShow: false,
  41. carList: [],
  42. driverList: [],
  43. currentRow: {},
  44. formData: {
  45. trakId: '',
  46. trakNumber: '',
  47. driverId: '',
  48. driverName: "",
  49. phone: "",
  50. },
  51. }
  52. },
  53. created() {
  54. },
  55. methods: {
  56. //工单id
  57. open(currentRow) {
  58. this.currentRow = currentRow
  59. this.popShow = true
  60. this.getInit()
  61. },
  62. openPicker() {
  63. this.$refs.treePicker._show()
  64. // this.deptPickerShow = true
  65. // console.log(1111);
  66. },
  67. handleUserChange(obj) {
  68. this.formData.executorName = obj.text
  69. },
  70. close() {
  71. this.formData = {
  72. id: '',
  73. trakId: '',
  74. trakNumber: '',
  75. driverId: '',
  76. driverName: "",
  77. phone: "",
  78. }
  79. this.popShow = false
  80. },
  81. submit() {
  82. if (!this.formData.driverId) {
  83. uni.showToast({
  84. icon: 'error',
  85. title: '请选择司机'
  86. })
  87. return
  88. }
  89. let params = {
  90. ...this.currentRow,
  91. ...this.formData
  92. }
  93. logistictraklistnoteUpdateAPI(params).then(() => {
  94. this.close()
  95. const _this = this
  96. uni.showModal({
  97. title: `此工单已转派成功`,
  98. content: '',
  99. confirmText: '确认',
  100. showCancel: false, // 是否显示取消按钮,默认为 true
  101. success: function(res) {
  102. if (res.confirm) {
  103. _this.$emit('success')
  104. }
  105. }
  106. })
  107. })
  108. },
  109. getInit() {
  110. carListAPI().then(data => {
  111. this.carList = data.map(item => {
  112. item.text = item.trakNumber
  113. item.value = item.id
  114. return item
  115. })
  116. })
  117. driverListAPI().then(data => {
  118. this.driverList = data.map(item => {
  119. item.text = item.driverName
  120. item.value = item.driverId
  121. return item
  122. })
  123. })
  124. },
  125. handleCarChange() {
  126. let find = this.carList.find(item => item.id == this.formData.trakId)
  127. this.formData.driverId = find.defaultDriverId
  128. this.formData.driverName = find.defaultDriver
  129. this.formData.phone = find.phone
  130. this.formData.trakNumber = find.trakNumber
  131. },
  132. handleDriverChange() {
  133. let find = this.driverList.find(item => item.driverId == this.formData.driverId)
  134. console.log(find)
  135. this.formData.driverName = find.driverName
  136. this.formData.phone = find.phone
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .select-container {
  143. min-height: 60vh;
  144. .title {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. height: 100rpx;
  149. line-height: 100rpx;
  150. text-align: center;
  151. background-color: $j-primary-border-green;
  152. font-weight: bold;
  153. position: relative;
  154. font-size: 32rpx;
  155. color: #fff;
  156. // .btn-box {
  157. // position: absolute;
  158. // top: 50%;
  159. // right: 10rpx;
  160. // transform: translateY(-50%);
  161. // }
  162. .btn {
  163. width: 80rpx;
  164. height: 32rpx;
  165. display: inline-block;
  166. font-size: 32rpx;
  167. border: 1px solid #fff;
  168. text-align: center;
  169. line-height: 30rpx;
  170. }
  171. }
  172. .select-wrapper {
  173. .col {
  174. display: flex;
  175. // min-height: 0rpx;
  176. margin-top: 22rpx;
  177. align-items: center;
  178. padding-right: 14rpx;
  179. .label {
  180. display: inline-block;
  181. width: 200rpx;
  182. text-align: right;
  183. }
  184. .input_text {
  185. flex: 1;
  186. height: 66rpx;
  187. line-height: 66rpx;
  188. padding: 0rpx 16rpx;
  189. box-sizing: border-box;
  190. font-size: 28rpx;
  191. border: 1px solid #eceeec;
  192. border-radius: 8rpx;
  193. }
  194. input {
  195. flex: 1;
  196. border: 1rpx solid #e5e5e5;
  197. height: 66rpx;
  198. border-radius: 8rpx;
  199. font-size: 28rpx;
  200. padding: 0rpx 16rpx;
  201. color: #6a6a6a;
  202. }
  203. textarea {
  204. border: 1rpx solid #e5e5e5;
  205. flex: 1;
  206. height: 100rpx;
  207. }
  208. .tab_box {
  209. display: flex;
  210. flex-direction: row;
  211. flex-wrap: wrap;
  212. width: 520rpx;
  213. .tab {
  214. display: flex;
  215. flex-direction: row;
  216. border: 2rpx solid #d9ecff;
  217. background-color: #f4f4f5;
  218. border-color: #e9e9eb;
  219. color: #909399;
  220. margin-left: 8rpx;
  221. margin-bottom: 8rpx;
  222. padding: 2rpx 8rpx;
  223. font-size: 28rpx;
  224. }
  225. .icon {
  226. margin-left: 6rpx;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>