transportReserveFu.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <!-- 采购辅料运输预约 -->
  3. <div class="homeworkPath">
  4. <div class="top">
  5. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  6.       <el-button type="primary" class="btn" @click="onclick">
  7.         <i class="el-icon-search"></i>查询
  8.       </el-button>
  9. <el-button type="primary" @click="insertClick" >
  10. <i class="el-icon-plus"></i>新增
  11. </el-button>
  12. <el-button type="primary" @click="sendClick(0)" >
  13. <i class="el-icon-bottom"></i>下发
  14. </el-button>
  15. </div>
  16. <el-tabs v-model="activeName" @tab-click="handleClick">
  17. <!-- 未下发 -->
  18. <el-tab-pane label="未下发" name="first">
  19. <dilTable v-bind.sync="option1" ref="table" @selection-change="selectionChange">
  20. <el-table-column fixed="right" align="center" label="操作" width="120">
  21. <template slot-scope="scope">
  22. <el-button @click="sendClick(1,scope.row.orderId)" type="text" size="small">
  23. 下发
  24. </el-button>
  25. <el-button @click="updateClick(scope.row.orderId)" type="text" size="small">
  26. 修改
  27. </el-button>
  28. <el-button @click="deleteClick(scope.row.orderId, scope.row.capacityNumber)" type="text" size="small">
  29. 删除
  30. </el-button>
  31. </template>
  32. </el-table-column>
  33. </dilTable>
  34. </el-tab-pane>
  35. <!-- 已下发 -->
  36. <el-tab-pane label="已下发" name="second">
  37. <dilTable v-bind.sync="option2">
  38. <el-table-column fixed="right" align="center" label="操作" width="120">
  39. <template slot-scope="scope">
  40. <el-button @click="CloseClick(scope.row.orderId)" type="text" size="small">
  41. 关闭
  42. </el-button>
  43. </template>
  44. </el-table-column>
  45. </dilTable>
  46. </el-tab-pane>
  47. </el-tabs>
  48. </div>
  49. </template>
  50. <script>
  51. export default {
  52. name: "inplantTMS",
  53. data() {
  54. return {
  55. input: "",
  56. Time: "",
  57. activeName: "first",
  58. option1: {
  59. // 表格请求数据的地址
  60. requestUrl: "/api/v1/oms/getAllTruckOrder?apiId=141&orderStatus=3&orderType=5",
  61. // 控制显示多选列
  62. selectionType: "select",
  63. },
  64. option2: {
  65. // 表格请求数据的地址
  66. requestUrl: "/api/v1/oms/getAllTruckOrder?apiId=243&orderStatus=4&orderType=5",
  67. },
  68. selection:[],
  69. };
  70. },
  71. methods: {
  72. //获取选中的订单
  73. selectionChange(selection){
  74. this.selection = [];
  75. selection.forEach(e => {
  76. this.selection.push({orderId:e.orderId});
  77. });
  78. },
  79. onclick() {
  80.  if(this.activeName == "first"){
  81.         this.option1.requestUrl = "/api/v1/oms/getAllTruckOrder?apiId=141&orderStatus=3&orderType=5&con=" + this.input;
  82.       }else{
  83.         this.option2.requestUrl = "/api/v1/oms/getAllTruckOrder?apiId=243&orderStatus=4&orderType=5&con=" + this.input;
  84.       }
  85. },
  86. handleClick(tab, event) {
  87. console.log(tab, event);
  88. },
  89. // 下发
  90. CloseClick(orderId) {
  91. this.$confirm("是否关闭", "提示", {
  92. confirmButtonText: "确定",
  93. cancelButtonText: "取消",
  94. type: "warning",
  95. center: true,
  96. })
  97. this.$axios
  98. .post(
  99. "/api/v1/oms/CloseOrder",{
  100. orderId: orderId
  101. }
  102. )
  103. .then(() => {
  104. this.$router.go(0);
  105. })
  106. .then(() => {
  107. this.$message({
  108. type: "success",
  109. message: "关闭成功!",
  110. });
  111. // console.log(this.arr[0].text_prop);
  112. })
  113. .catch(() => {
  114. this.$message({
  115. type: "info",
  116. message: "取消关闭!",
  117. });
  118. });
  119. },
  120. //关闭
  121. sendClick(index,orderId) {
  122. this.$confirm("是否下发", "提示", {
  123. confirmButtonText: "确定",
  124. cancelButtonText: "取消",
  125. type: "warning",
  126. center: true,
  127. })
  128. .then(() => {
  129. let orderList = [];
  130. if(index == 0){
  131. if(this.selection.length > 0){
  132. orderList=this.selection;
  133. }else{
  134. this.$message({
  135. type: "warning",
  136. message: "请选择要下发的订单!",
  137. });
  138. }
  139. }else if(index == 1){
  140. orderList.push({orderId:orderId})
  141. }
  142. this.$axios
  143. .post(
  144. "/api/v1/oms/dispatchOrder",{
  145. mapList:orderList
  146. }
  147. )
  148. .then(() => {
  149. this.option1.requestUrl = "/api/v1/oms/getAllTruckOrder?apiId=141&orderStatus=3&orderType=5&i=0"
  150. });
  151. this.$message({
  152. type: "success",
  153. message: "下发成功!",
  154. });
  155. })
  156. .catch(() => {
  157. this.$message({
  158. type: "info",
  159. message: "取消下发!",
  160. });
  161. });
  162. },
  163. // 删除
  164. deleteClick(orderId, capacityNumber) {
  165. this.$confirm("是否删除", "提示", {
  166. confirmButtonText: "确定",
  167. cancelButtonText: "取消",
  168. type: "warning",
  169. center: true,
  170. })
  171. .then(() => {
  172. this.$message({
  173. type: "success",
  174. message: "删除成功!",
  175. });
  176. this.$axios
  177. .post(
  178. "/api/v1/oms/deleteOrder",{
  179. orderId: orderId,
  180. capacityNumber: capacityNumber
  181. }
  182. )
  183. .then(() => {
  184. this.$router.go(0);
  185. });
  186. })
  187. .catch(() => {
  188. this.$message({
  189. type: "info",
  190. message: "取消删除!",
  191. });
  192. });
  193. },
  194. //新增
  195. insertClick() {
  196. this.$router.push("/importedIngredients/transportReserveFuAdd/");
  197. },
  198. //修改
  199. updateClick(orderId) {
  200. this.$router.push("/importedIngredients/transportReserveFuEdit/" + orderId);
  201. },
  202. },
  203. };
  204. </script>
  205. <style lang='scss' scoped>
  206. .homeworkPath {
  207. .top {
  208. padding: 1.25rem 1.875rem;
  209. }
  210. }
  211. </style>