dispatchPlan.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. // 分派计划
  2. <template>
  3. <div class="inwardOrder">
  4. <div class="sache">
  5. <el-input
  6. placeholder="可查询车牌号、物资、装卸货点"
  7. v-model="inputText"
  8. clearable
  9. >
  10. </el-input>
  11. <span>订单时间:</span>
  12. <el-date-picker
  13. v-model="startTime"
  14. type="datetime"
  15. placeholder="选择日期"
  16. style="width:220px"
  17. >
  18. </el-date-picker>
  19. <span>至</span>
  20. <el-date-picker
  21. v-model="endTime"
  22. type="datetime"
  23. placeholder="选择日期"
  24. style="width:220px"
  25. >
  26. </el-date-picker>
  27. <el-button type="primary" class="btn" @click="onClick">
  28. <i class="el-icon-search"></i>查询
  29. </el-button>
  30. </div>
  31. <!-- 车辆信息 -->
  32. <el-dialog
  33. title="车辆信息"
  34. :visible.sync="dialogTableVisible"
  35. :before-close="handleClose"
  36. >
  37. <el-input v-model="truckInput" style="width:250px"></el-input>
  38. <el-button type="primary" @click="clickTruck">查询</el-button>
  39. <dilTable v-bind.sync="truck" @radio-change="currentRadioChange1">
  40. </dilTable>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button @click="dialogTableVisible = false">取 消</el-button>
  43. <el-button type="primary" @click="updateTruckCapacity()"
  44. >确 定</el-button
  45. >
  46. </span>
  47. </el-dialog>
  48. <template>
  49. <div>
  50. <el-tabs v-model="activeName" @tab-click="handleClick">
  51. <el-tab-pane label="待接收" name="first">
  52. <dilTable v-bind.sync="first" ref="table">
  53. <el-table-column fixed="right" label="操作" width="120">
  54. <template slot-scope="scope">
  55. <el-button type="text" size="mini" @click="updatePlan(scope)">
  56. 修改
  57. </el-button>
  58. <el-button
  59. type="text"
  60. size="mini"
  61. @click="deleteClick(scope)"
  62. >
  63. 删除
  64. </el-button>
  65. </template>
  66. </el-table-column>
  67. </dilTable>
  68. </el-tab-pane>
  69. <el-tab-pane label="已接收" name="second">
  70. <dilTable v-bind.sync="second">
  71. <el-table-column fixed="right" label="操作" width="80">
  72. <template slot-scope="scope">
  73. <el-button
  74. type="text"
  75. size="mini"
  76. @click="deleteClick(scope)"
  77. >
  78. 关闭
  79. </el-button>
  80. </template>
  81. </el-table-column>
  82. </dilTable>
  83. </el-tab-pane>
  84. <el-tab-pane label="已完成" name="third">
  85. <dilTable v-bind.sync="third"> </dilTable>
  86. </el-tab-pane>
  87. </el-tabs>
  88. </div>
  89. </template>
  90. </div>
  91. </template>
  92. <script>
  93. import { getCookie } from '@/utils/util.js'
  94. import { sjTime } from '@/utils/sharedJsFile'
  95. export default {
  96. data() {
  97. return {
  98. startTime: null,
  99. endTime: null,
  100. inputText: null,
  101. truckInput: null,
  102. userCarrierId: '',
  103. //是否弹出对话框
  104. dialogTableVisible: false,
  105. first: {},
  106. //车辆信息的表格
  107. truck: {
  108. requestUrl:
  109. '/api/v1/oms/getCapacityAndDriverList?apiId=246&carrierId=' + '',
  110. // 控制显示当选列
  111. selectionType: 'radio'
  112. },
  113. //选中的运力id
  114. capacityId: null,
  115. activeName: 'first',
  116. second: {
  117. requestUrl: ''
  118. },
  119. third: {
  120. requestUrl: ''
  121. }
  122. }
  123. },
  124. created() {
  125. if (getCookie('orgCode') == 'chengyunshang') {
  126. this.first.requestUrl =
  127. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=' +
  128. getCookie('userId')
  129. this.second.requestUrl =
  130. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=' +
  131. getCookie('userId')
  132. this.third.requestUrl =
  133. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=2&carrierId=' +
  134. getCookie('userId')
  135. } else {
  136. this.first.requestUrl =
  137. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4'
  138. this.second.requestUrl =
  139. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5'
  140. this.third.requestUrl =
  141. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=2'
  142. }
  143. },
  144. methods: {
  145. onClick() {
  146. console.log('dks')
  147. let orgCode = null
  148. let startTime = null
  149. let endTime = null
  150. if (this.startTime && this.endTime) {
  151. startTime = sjTime(this.startTime)
  152. endTime = sjTime(this.endTime)
  153. }
  154. if (getCookie('orgCode') == 'chengyunshang') {
  155. orgCode = getCookie('userId')
  156. }
  157. if (this.activeName == 'first') {
  158. this.first.requestUrl =
  159. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&orgCode=' +
  160. orgCode +
  161. '&con=' +
  162. this.inputText +
  163. '&startTime=' +
  164. startTime +
  165. '&endTime=' +
  166. endTime +
  167. '&i=' +
  168. new Date()
  169. } else if (this.activeName == 'second') {
  170. this.second.requestUrl =
  171. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&orgCode=' +
  172. orgCode +
  173. '&con=' +
  174. this.inputText +
  175. '&startTime=' +
  176. startTime +
  177. '&endTime=' +
  178. endTime +
  179. '&i=' +
  180. new Date()
  181. } else {
  182. this.third.requestUrl =
  183. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=2&orgCode=' +
  184. orgCode +
  185. '&con=' +
  186. this.inputText +
  187. '&startTime=' +
  188. startTime +
  189. '&endTime=' +
  190. endTime +
  191. '&i=' +
  192. new Date()
  193. }
  194. },
  195. getRequest() {
  196. if (getCookie('orgCode') == 'chengyunshang') {
  197. this.first.requestUrl =
  198. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4&carrierId=' +
  199. getCookie('userId') +
  200. '&i=' +
  201. new Date()
  202. this.second.requestUrl =
  203. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5&carrierId=' +
  204. getCookie('userId') +
  205. '&i=' +
  206. new Date()
  207. this.third.requestUrl =
  208. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=2&carrierId=' +
  209. getCookie('userId') +
  210. '&i=' +
  211. new Date()
  212. } else {
  213. this.first.requestUrl =
  214. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=4' +
  215. '&i=' +
  216. new Date()
  217. this.second.requestUrl =
  218. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=5' +
  219. '&i=' +
  220. new Date()
  221. this.third.requestUrl =
  222. '/api/v1/oms/getInwardOrderList?apiId=260&orderStatus=2' +
  223. '&i=' +
  224. new Date()
  225. }
  226. },
  227. handleClick() {
  228. this.getRequest()
  229. },
  230. handleClose(done) {
  231. done()
  232. this.$message.info('取消修改运力')
  233. },
  234. currentRadioChange1(row) {
  235. console.log(row)
  236. this.capacityId = row.capacityId
  237. },
  238. getTruckRequestUrl() {
  239. if (getCookie('orgCode') == 'chengyunshang') {
  240. this.truck.requestUrl =
  241. '/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=' +
  242. getCookie('userId') +
  243. '&test=' +
  244. new Date()
  245. } else {
  246. this.truck.requestUrl =
  247. '/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=' +
  248. null +
  249. '&test=' +
  250. new Date()
  251. }
  252. },
  253. //修改运输订单
  254. updatePlan(scope) {
  255. this.getTruckRequestUrl()
  256. this.orderId = scope.row.orderId
  257. this.dialogTableVisible = true
  258. console.log(scope.row.orderId)
  259. },
  260. updateTruckCapacity() {
  261. if (this.capacityId == null) {
  262. this.$message.error('未选中运力')
  263. return
  264. }
  265. this.axios
  266. .post('/api/v1/oms/updateCapacityId', {
  267. capacityId: this.capacityId,
  268. orderId: this.orderId
  269. })
  270. .then(res => {
  271. if (res.data.code == '200') {
  272. this.$message.success('修改运力成功')
  273. this.dialogTableVisible = false
  274. this.getRequest()
  275. } else {
  276. this.$message.error('修改运力失败')
  277. this.dialogTableVisible = false
  278. this.getRequest()
  279. }
  280. })
  281. },
  282. clickTruck() {
  283. this.truck.requestUrl =
  284. '/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=' +
  285. null +
  286. '&index=' +
  287. this.truckInput
  288. },
  289. //删除运输订单
  290. deleteClick(scope) {
  291. let map = {
  292. orderId: scope.row.orderId,
  293. userId: getCookie('userId')
  294. }
  295. this.$confirm('是否删除?', '提示', {
  296. confirmButtonText: '确定',
  297. cancelButtonText: '取消',
  298. type: 'warning'
  299. })
  300. .then(() => {
  301. this.axios.post('/api/v1/oms/closeOmstruckOrder', map).then(res => {
  302. if (res.data.code == 200) {
  303. this.$message({
  304. type: 'success',
  305. message: '删除成功!'
  306. })
  307. this.getRequest()
  308. } else {
  309. this.$message({
  310. message: '删除失败',
  311. type: 'warning'
  312. })
  313. }
  314. })
  315. })
  316. .catch(() => {
  317. this.$message({
  318. type: 'info',
  319. message: '已取消删除'
  320. })
  321. })
  322. }
  323. }
  324. }
  325. </script>
  326. <style lang="scss">
  327. .inwardOrder {
  328. margin-top: 20px;
  329. margin-left: 20px;
  330. .sache {
  331. .el-input {
  332. width: 20%;
  333. margin-right: 1.25rem;
  334. }
  335. }
  336. }
  337. </style>