loadCapacityDetail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <!-- 装机计重明细查询 -->
  3. <div class="loadCapacityDetail">
  4. <div class="frameCalculation">
  5. <span>装车开始时间</span>
  6. <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
  7. </el-date-picker>
  8. <span>至</span>
  9. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  10. </el-date-picker>
  11. <el-button type="primary" class="btn" @click="onclickSearch">
  12. <i class="el-icon-search"></i>查询
  13. </el-button>
  14. <el-button type="primary" @click="exportData()"
  15. ><i class="el-icon-download"></i>导出(Excel)</el-button
  16. >
  17. <span style="margin-left: 1rem;">合计净重:</span>
  18. <el-input v-model="totalNumber" :disabled="true" style="width: 100px;"></el-input>
  19. <span style="margin-left: 1rem;">合计车数:</span>
  20. <el-input v-model="totalCapacity" :disabled="true" style="width: 100px;"></el-input>
  21. <el-input placeholder="请输入装机车牌号/可查询当天车辆数据" v-model="input" style="width: 220px;margin-left: 1rem;" clearable>
  22. </el-input>
  23. <el-button type="primary" class="btn" @click="onclickCapacity">
  24. <i class="el-icon-search"></i>查询
  25. </el-button>
  26. </div>
  27. <div class="table">
  28. <mergeRowTable ref="excelDom" v-bind.sync="option" @func="func"></mergeRowTable>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import { sjTime } from "@/utils/sharedJsFile";
  34. import { getCookie } from "@/utils/util.js";
  35. export default {
  36. data() {
  37. return {
  38. totalNumber: null,
  39. totalCapacity: null,
  40. startTime: null,
  41. endTime: null,
  42. input: "",
  43. tableTitle: "装机计重明细报表",
  44. option: {
  45. // 表格请求数据的地址
  46. requestUrl: "api/v1/tms/getLoaderForResultDetail?apiId=480",
  47. comparison: "orderNumber",
  48. columnIndexs: [0, 1, 2, 4, 5, 6],
  49. },
  50. };
  51. },
  52. created() {
  53. if (
  54. getCookie("orgCode") == "dagangadmin" ||
  55. getCookie("orgCode") == "zidonghuabu"
  56. ) {
  57. this.option.requestUrl =
  58. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=null&endTime=null&i=" +
  59. new Date();
  60. } else if (getCookie("orgCode") == "wuliuchuyunzhongxin") {
  61. this.option.requestUrl =
  62. "/api/v1/tms/getLoaderForResultDetail?apiId=480&orderType=13&startTime=null&endTime=null&i=" +
  63. new Date();
  64. } else {
  65. this.option.requestUrl =
  66. "/api/v1/tms/getLoaderForResultDetail?apiId=480&userId=" +
  67. getCookie("orgCode") +
  68. "&startTime=null&endTime=null&i=" +
  69. new Date();
  70. }
  71. },
  72. methods: {
  73. func(res) {
  74. console.log(res);
  75. var resultNetWeightTotal = 0;
  76. var currentCapacityTotal = 0;
  77. res.list.forEach((e) => {
  78. currentCapacityTotal++;
  79. resultNetWeightTotal = resultNetWeightTotal + e.resultNetWeight;
  80. });
  81. this.totalNumber = resultNetWeightTotal.toFixed(2) + "t";
  82. this.totalCapacity = currentCapacityTotal;
  83. },
  84. onclickCapacity() {
  85. this.option.requestUrl =
  86. "/api/v1/tms/getLoaderForResultDetail?apiId=480&con=" + this.input;
  87. },
  88. getRequestUrl() {
  89. if (
  90. getCookie("orgCode") == "dagangadmin" ||
  91. getCookie("orgCode") == "zidonghuabu"||
  92. getCookie("orgCode")=="wuliuchuyunzhongxin"
  93. ) {
  94. this.option.requestUrl =
  95. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=null&endTime=null&i=" +
  96. new Date();
  97. } else {
  98. this.option.requestUrl =
  99. "/api/v1/tms/getLoaderForResultDetail?apiId=480&userId=" +
  100. getCookie("orgCode") +
  101. "&startTime=null&endTime=null&i=" +
  102. new Date();
  103. }
  104. },
  105. // 添加开始结束时间筛选
  106. onclickSearch() {
  107. console.log("aaaa");
  108. let startTime = null;
  109. let endTime = null;
  110. if (this.startTime) {
  111. startTime = sjTime(this.startTime);
  112. // console.log("startTime", startTime);
  113. }
  114. if (this.endTime) {
  115. endTime = sjTime(this.endTime);
  116. // console.log("endTime", endTime);
  117. }
  118. if (startTime && endTime) {
  119. if (startTime < endTime) {
  120. if (
  121. getCookie("orgCode") == "dagangadmin" ||
  122. getCookie("orgCode") == "zidonghuabu"
  123. ) {
  124. this.option.requestUrl =
  125. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=" +
  126. startTime +
  127. "&endTime=" +
  128. endTime +
  129. "&i=" +
  130. new Date();
  131. } else if (getCookie("orgCode") == "wuliuchuyunzhongxin") {
  132. this.option.requestUrl =
  133. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=" +
  134. startTime +
  135. "&endTime=" +
  136. endTime +
  137. "&i=" +
  138. new Date();
  139. }
  140. } else {
  141. this.startTime = null;
  142. this.endTime = null;
  143. this.$message.warning("开始时间要比结束时间早");
  144. }
  145. } else {
  146. this.getRequestUrl();
  147. }
  148. },
  149. },
  150. };
  151. </script>
  152. <style lang="scss" scoped>
  153. .purchasFuelNewMonitor {
  154. .frameCalculation {
  155. width: 100%;
  156. height: 100px;
  157. display: flex;
  158. align-items: center;
  159. padding-left: 50px;
  160. .el-date-editor {
  161. margin: 20px;
  162. }
  163. }
  164. }
  165. </style>