transfer.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. padding: 0 30rpx;
  157. box-sizing: border-box;
  158. .btn {
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. width: 120rpx;
  163. height: 56rpx;
  164. font-size: 28rpx;
  165. border: 1px solid #fff;
  166. text-align: center;
  167. line-height: 56rpx;
  168. border-radius: 8rpx;
  169. transition: opacity 0.3s;
  170. cursor: pointer;
  171. &:active {
  172. opacity: 0.7;
  173. }
  174. &.cancel {
  175. background-color: transparent;
  176. color: #fff;
  177. }
  178. &.confirm {
  179. background-color: rgba(255, 255, 255, 0.2);
  180. color: #fff;
  181. }
  182. }
  183. }
  184. .select-wrapper {
  185. .col {
  186. display: flex;
  187. // min-height: 0rpx;
  188. margin-top: 22rpx;
  189. align-items: center;
  190. padding-right: 14rpx;
  191. .label {
  192. display: inline-block;
  193. width: 200rpx;
  194. text-align: right;
  195. }
  196. .input_text {
  197. flex: 1;
  198. height: 66rpx;
  199. line-height: 66rpx;
  200. padding: 0rpx 16rpx;
  201. box-sizing: border-box;
  202. font-size: 28rpx;
  203. border: 1px solid #eceeec;
  204. border-radius: 8rpx;
  205. }
  206. input {
  207. flex: 1;
  208. border: 1rpx solid #e5e5e5;
  209. height: 66rpx;
  210. border-radius: 8rpx;
  211. font-size: 28rpx;
  212. padding: 0rpx 16rpx;
  213. color: #6a6a6a;
  214. }
  215. textarea {
  216. border: 1rpx solid #e5e5e5;
  217. flex: 1;
  218. height: 100rpx;
  219. }
  220. .tab_box {
  221. display: flex;
  222. flex-direction: row;
  223. flex-wrap: wrap;
  224. width: 520rpx;
  225. .tab {
  226. display: flex;
  227. flex-direction: row;
  228. border: 2rpx solid #d9ecff;
  229. background-color: #f4f4f5;
  230. border-color: #e9e9eb;
  231. color: #909399;
  232. margin-left: 8rpx;
  233. margin-bottom: 8rpx;
  234. padding: 2rpx 8rpx;
  235. font-size: 28rpx;
  236. }
  237. .icon {
  238. margin-left: 6rpx;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>