outBoundWagon.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <!-- 出库 -->
  3. <div class="homeworkPath">
  4. <div class="top">
  5. <el-input placeholder="请输入内容" v-model="input" clearable style="width:200px"> </el-input>
  6. <el-date-picker style="margin: 10px;width:250px" v-model="startTime" type="datetime" placeholder="起始日期"></el-date-picker>
  7. <el-date-picker style="margin: 10px;width:250px" v-model="endTime" type="datetime" placeholder="结束日期"></el-date-picker>
  8. <el-button type="primary" class="btn" @click="onclick">
  9. <i class="el-icon-search"></i>查询
  10. </el-button>
  11. <el-button type="primary" class="btn" @click="insert"> 出库 </el-button>
  12. <el-button type="primary" @click="exportData()" ><i class="el-icon-download"></i>导出(Excel)</el-button>
  13. </div>
  14. <el-tabs v-model="activeName" @tab-click="handleClick">
  15. <el-tab-pane label="全部" name="first">
  16. <mergeRowTable v-bind.sync="option1" ref="excelDom" @func="calculate">
  17. <el-table-column fixed="right" label="操作" width="80">
  18. <template slot-scope="scope">
  19. <el-button
  20. @click="click(scope.row.resultId)"
  21. type="text"
  22. size="small"
  23. :disabled="scope.row.isEdit!=1"
  24. >修改</el-button
  25. >
  26. <el-button
  27. type="text"
  28. size="small"
  29. :disabled="scope.row.isEdit!=1"
  30. @click="deleteclick(scope.row.resultId)"
  31. >删除</el-button >
  32. </template>
  33. </el-table-column>
  34. </mergeRowTable>
  35. </el-tab-pane>
  36. <el-tab-pane label="待计量" name="second">
  37. <mergeRowTable v-bind.sync="option1" ref="excelDom" @func="calculate">
  38. <el-table-column fixed="right" label="操作" width="80">
  39. <template slot-scope="scope">
  40. <el-button
  41. @click="click(scope.row.resultId)"
  42. type="text"
  43. size="small"
  44. :disabled="scope.row.isEdit!=1"
  45. >修改</el-button
  46. >
  47. <el-button
  48. type="text"
  49. size="small"
  50. :disabled="scope.row.isEdit!=1"
  51. @click="deleteclick(scope.row.resultId)"
  52. >删除</el-button >
  53. </template>
  54. </el-table-column>
  55. </mergeRowTable>
  56. </el-tab-pane>
  57. </el-tabs>
  58. <div class="count" style="margin-right:50px;font-size:18px;">
  59. <div style="display:flex;flex-direction:row-reverse">总车数:{{dataTabel.length}}</div>
  60. <div style="display:flex;flex-direction:row-reverse">标重总吨位:{{sum}}</div>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import { getCookie } from "@/utils/util.js";
  66. import { sjTime } from "@/utils/sharedJsFile";
  67. export default {
  68. name: "inplantTMS",
  69. data() {
  70. return {
  71. input: "",
  72. Time: "",
  73. activeName: "first",
  74. option1: {
  75. // 表格请求数据的地址
  76. requestUrl: "/api/v1/wmsh/getUnLockPortStock?apiId=494",
  77. comparison: "resultNumber",
  78. columnIndexs: [0, 1, 2, 3, 4, 5],
  79. },
  80. startTime: null,
  81. endTime: null,
  82. tableTitle: "港口出库表",
  83. dataTabel:[],
  84. sum:0,
  85. };
  86. },
  87. filters: {},
  88. mounted(){
  89. this.onclick();
  90. },
  91. methods: {
  92. onclick() {
  93. if (this.activeName == "first") {
  94. if(this.checkSEDate()==true){
  95. this.option1.requestUrl =
  96. "/api/v1/wmsh/getUnLockPortStock?apiId=494&con=" + this.input
  97. +"&activeName="+this.activeName
  98. +"&startTime="+sjTime(this.startTime)
  99. +"&endTime="+sjTime(this.endTime);
  100. }else{
  101. this.option1.requestUrl =
  102. "/api/v1/wmsh/getUnLockPortStock?apiId=494&con=" + this.input
  103. +"&activeName="+this.activeName;
  104. }
  105. }else if(this.activeName == "second"){
  106. if(this.checkSEDate()==true){
  107. this.option1.requestUrl =
  108. "/api/v1/wmsh/getUnLockPortStock?apiId=494&con=" + this.input
  109. +"&activeName="+this.activeName
  110. +"&startTime="+sjTime(this.startTime)
  111. +"&endTime="+sjTime(this.endTime);
  112. }else{
  113. this.option1.requestUrl =
  114. "/api/v1/wmsh/getUnLockPortStock?apiId=494&con=" + this.input
  115. +"&activeName="+this.activeName;
  116. }
  117. }
  118. },
  119. insert() {
  120. this.$router.push("/addWagonLoadCopy");
  121. },
  122. handleClick(tab, event) {
  123. this.onclick();
  124. },
  125. click(resultId) {
  126. this.$router.push("/editOutBoundWagon/" + resultId);
  127. },
  128. deleteclick(resultId){
  129. this.$confirm("是否删除", "提示", {
  130. confirmButtonText: "确定",
  131. cancelButtonText: "取消",
  132. type: "warning",
  133. center: true
  134. })
  135. .then(() => {
  136. this.$message({
  137. type: "success",
  138. message: "删除成功!"
  139. });
  140. this.axios
  141. .post( "/api/v1/tms/deleteOutBoundWagonById?resultId=" + resultId)
  142. .then(() => {
  143. this.onclick();
  144. });
  145. })
  146. .catch(() => {
  147. this.$message({
  148. type: "info",
  149. message: "取消删除!"
  150. });
  151. });
  152. },
  153. //起止时间校验
  154. checkSEDate(){
  155. if(this.startTime && this.endTime && this.startTime<=this.endTime){
  156. return true;
  157. }else{
  158. return false;
  159. }
  160. },
  161. calculate(res){
  162. console.log("res",res);
  163. this.dataTabel=res.list;
  164. this.sum=0
  165. this.dataTabel.forEach(item => {
  166. this.sum+=item.weight;
  167. });
  168. }
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. .homeworkPath {
  174. .top {
  175. padding: 1.25rem 0.375rem;
  176. .el-input {
  177. width: 20%;
  178. margin-right: 40rpx;
  179. }
  180. .btn {
  181. width: 5.5%;
  182. margin-left: 0.25rem;
  183. }
  184. }
  185. }
  186. </style>