getPlanOrder.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. // 分派计划
  2. <template>
  3. <div class="inwardOrder">
  4. <div class="sache">
  5. <el-input placeholder="请输入内容" v-model="inputText" clearable>
  6. </el-input>
  7. <el-button type="primary" class="btn">
  8. <i class="el-icon-search"></i>查询
  9. </el-button>
  10. <el-button type="primary" class="btn" @click="cancel">
  11. 返回
  12. </el-button>
  13. </div>
  14. <!-- 车辆信息 -->
  15. <el-dialog
  16. title="车辆信息"
  17. :visible.sync="dialogTableVisible"
  18. :before-close="handleClose"
  19. >
  20. <el-input v-model="truckInput" style="width:250px"></el-input>
  21. <el-button type="primary" @click="clickTruck">查询</el-button>
  22. <dilTable
  23. v-bind.sync="truck"
  24. @radio-change="currentRadioChange1"
  25. >
  26. </dilTable>
  27. <span slot="footer" class="dialog-footer">
  28. <el-button @click="cancelUpdate()">取 消</el-button>
  29. <el-button type="primary" @click="updateTruckCapacity()"
  30. >确 定</el-button>
  31. </span>
  32. </el-dialog>
  33. <template>
  34. <div>
  35. <el-tabs v-model="activeName" @tab-click="handleClick">
  36. <el-tab-pane label="待接收" name="first">
  37. <dilTable v-bind.sync="first" ref="table">
  38. <el-table-column fixed="right" label="操作" width="180">
  39. <template slot-scope="scope">
  40. <el-button
  41. type="text"
  42. size="mini"
  43. @click="getRequirementMaterial(scope.row)"
  44. >
  45. 物资详情
  46. </el-button>
  47. <el-button type="text" size="mini" @click="updatePlan(scope)">
  48. 修改
  49. </el-button>
  50. <el-button type="text" size="mini" @click="deleteClick(scope)">
  51. 删除
  52. </el-button>
  53. </template>
  54. </el-table-column>
  55. <!-- 物资详情抽屉 -->
  56. <el-table-column type="expand" width="1">
  57. <template slot-scope="props">
  58. <el-form
  59. label-position="center"
  60. inline
  61. class="demo-table-expand"
  62. >
  63. <div v-if="false">{{ props }}</div>
  64. <div>
  65. <el-table :data="tableData" border>
  66. <el-table-column
  67. v-for="(item, i) in tableHead"
  68. :key="i"
  69. :prop="item.prop"
  70. :label="item.label"
  71. :width="item.width"
  72. ></el-table-column>
  73. </el-table>
  74. </div>
  75. </el-form>
  76. </template>
  77. </el-table-column>
  78. </dilTable>
  79. </el-tab-pane>
  80. <el-tab-pane label="已接收" name="second">
  81. <dilTable v-bind.sync="second"> </dilTable>
  82. </el-tab-pane>
  83. <el-tab-pane label="已完成" name="third">
  84. <dilTable v-bind.sync="third"> </dilTable>
  85. </el-tab-pane>
  86. </el-tabs>
  87. </div>
  88. </template>
  89. </div>
  90. </template>
  91. <script>
  92. import { getCookie } from "@/utils/util.js";
  93. export default {
  94. data() {
  95. return {
  96. inputText: "",
  97. truckInput:null,
  98. userCarrierId: "",
  99. //是否弹出对话框
  100. dialogTableVisible: false,
  101. first: {
  102. //
  103. requestUrl:""
  104. },
  105. //车辆信息的表格
  106. truck: {
  107. requestUrl:
  108. "/api/v1/oms/getCapacityAndDriverList?apiId=246&carrierId=" + "",
  109. // 控制显示当选列
  110. selectionType: "radio",
  111. },
  112. //选中的运力id
  113. capacityId: null,
  114. activeName: "first",
  115. second: {
  116. requestUrl: "",
  117. },
  118. third: {
  119. requestUrl: "",
  120. },
  121. };
  122. },
  123. created() {
  124. this.first.requestUrl =
  125. "/api/v1/ams/getPlanOrder?apiId=260&orderStatus=4" + "&planId=" + this.$route.params.planId
  126. this.second.requestUrl =
  127. "/api/v1/ams/getPlanOrder?apiId=260&orderStatus=5" + "&planId=" + this.$route.params.planId
  128. this.third.requestUrl =
  129. "/api/v1/ams/getPlanOrder?apiId=260&orderStatus=2" + "&planId=" + this.$route.params.planId
  130. },
  131. methods: {
  132. getRequest() {
  133. this.first.requestUrl =
  134. "/api/v1/ams/getPlanOrder?apiId=260&orderStatus=4" + "&i=" + new Date() + "&planId=" + this.$route.params.planId
  135. this.second.requestUrl =
  136. "/api/v1/ams/getPlanOrder?apiId=260&orderStatus=5" + "&i=" + new Date() + "&planId=" + this.$route.params.planId
  137. },
  138. cancel(){
  139. this.$router.go(-1)
  140. },
  141. handleClick() {
  142. this.getRequirementMaterial();
  143. this.getRequest()
  144. },
  145. handleClose(done){
  146. done()
  147. this.$message.info("取消修改运力")
  148. },
  149. currentRadioChange1(row){
  150. console.log(row)
  151. this.capacityId = row.capacityId
  152. },
  153. getTruckRequestUrl(){
  154. if (getCookie("orgCode") == "chengyunshang") {
  155. this.truck.requestUrl =
  156. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" +
  157. getCookie("userId") + "&test=" + new Date();
  158. } else {
  159. this.truck.requestUrl =
  160. "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" + null + "&test=" + new Date();
  161. }
  162. },
  163. //修改运输订单
  164. updatePlan(scope){
  165. this.getTruckRequestUrl()
  166. this.orderId = scope.row.orderId
  167. this.dialogTableVisible = true
  168. console.log(scope.row.orderId)
  169. },
  170. updateTruckCapacity(){
  171. if(this.capacityId == null){
  172. this.$message.error("未选中运力")
  173. return
  174. }
  175. this.axios.post("/api/v1/oms/updateCapacityId",{
  176. capacityId:this.capacityId,
  177. orderId :this.orderId
  178. }).then((res) =>{
  179. if(res.data.code == "200"){
  180. this.$message.success("修改运力成功")
  181. this.dialogTableVisible = false
  182. this.getRequest()
  183. }else{
  184. this.$message.error("修改运力失败")
  185. this.dialogTableVisible = false
  186. this.getRequest()
  187. }
  188. })
  189. },
  190. clickTruck(){
  191. this.truck.requestUrl = "/api/v1/uc/getAllCapacityByCarrierLike?apiId=429&carrierSsoId=" + null + "&index=" + this.truckInput
  192. },
  193. getRequirementMaterial(row) {
  194. // 记录重复点击次数
  195. if (this.oldRow === row) {
  196. this.oldRowCount += 1;
  197. }
  198. // 切换当前详情表
  199. this.$refs.table.toggleRowExpansion(row);
  200. // 打开前关闭上一个详情表
  201. if (this.oldRow != "") {
  202. if (this.oldRow != row) {
  203. if (this.oldRowCount % 2 === 1) {
  204. this.$refs.table.toggleRowExpansion(this.oldRow);
  205. } else {
  206. this.oldRowCount = 1;
  207. }
  208. } else {
  209. this.oldRow = null;
  210. return;
  211. }
  212. }
  213. // 重置上一个点击对象
  214. this.oldRow = row;
  215. this.getMaterial(row.requirementId);
  216. },
  217. getMaterial(requirementId) {
  218. console.log(requirementId);
  219. this.axios
  220. .post("/api/v1/ams/getRequirementMaterial/" + requirementId)
  221. .then((res) => {
  222. this.tableData = res.data.data;
  223. console.log(res.data.data);
  224. });
  225. },
  226. //删除运输订单
  227. deleteClick(scope){
  228. this.$confirm('是否删除?', '提示', {
  229. confirmButtonText: '确定',
  230. cancelButtonText: '取消',
  231. type: 'warning',
  232. }).then(() => {
  233. this.axios
  234. .post("/api/v1/oms/closeOmstruckOrder?orderId=" + scope.row.orderId)
  235. .then((res) => {
  236. if (res.data.code == 200) {
  237. this.$message({
  238. type: "success",
  239. message: "删除成功!",
  240. });
  241. this.getRequest()
  242. } else {
  243. this.$message({
  244. message: "删除失败",
  245. type: "warning",
  246. });
  247. }
  248. });
  249. }).catch(() => {
  250. this.$message({
  251. type: 'info',
  252. message: '已取消删除'
  253. });
  254. });
  255. },
  256. },
  257. };
  258. </script>
  259. <style lang="scss">
  260. .inwardOrder {
  261. margin-top: 20px;
  262. margin-left: 20px;
  263. .sache {
  264. padding: 1.25rem 0.375rem;
  265. .el-input {
  266. width: 20%;
  267. margin-right: 1.25rem;
  268. }
  269. }
  270. }
  271. </style>