loadCapacityDetail.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. ) {
  93. this.option.requestUrl =
  94. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=null&endTime=null&i=" +
  95. new Date();
  96. } else if (getCookie("orgCode") == "wuliuchunyunzhongxin") {
  97. this.option.requestUrl =
  98. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=null&endTime=null&i=" +
  99. new Date();
  100. } else {
  101. this.option.requestUrl =
  102. "/api/v1/tms/getLoaderForResultDetail?apiId=480&userId=" +
  103. getCookie("orgCode") +
  104. "&startTime=null&endTime=null&i=" +
  105. new Date();
  106. }
  107. },
  108. // 添加开始结束时间筛选
  109. onclickSearch() {
  110. console.log("aaaa");
  111. let startTime = null;
  112. let endTime = null;
  113. if (this.startTime) {
  114. startTime = sjTime(this.startTime);
  115. // console.log("startTime", startTime);
  116. }
  117. if (this.endTime) {
  118. endTime = sjTime(this.endTime);
  119. // console.log("endTime", endTime);
  120. }
  121. if (startTime && endTime) {
  122. if (startTime < endTime) {
  123. if (
  124. getCookie("orgCode") == "dagangadmin" ||
  125. getCookie("orgCode") == "zidonghuabu"
  126. ) {
  127. this.option.requestUrl =
  128. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=" +
  129. startTime +
  130. "&endTime=" +
  131. endTime +
  132. "&i=" +
  133. new Date();
  134. } else if (getCookie("orgCode") == "wuliuchunyunzhongxin") {
  135. this.option.requestUrl =
  136. "/api/v1/tms/getLoaderForResultDetail?apiId=480&startTime=" +
  137. startTime +
  138. "&endTime=" +
  139. endTime +
  140. "&i=" +
  141. new Date();
  142. }
  143. } else {
  144. this.startTime = null;
  145. this.endTime = null;
  146. this.$message.warning("开始时间要比结束时间早");
  147. }
  148. } else {
  149. this.getRequestUrl();
  150. }
  151. },
  152. },
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. .purchasFuelNewMonitor {
  157. .frameCalculation {
  158. width: 100%;
  159. height: 100px;
  160. display: flex;
  161. align-items: center;
  162. padding-left: 50px;
  163. .el-date-editor {
  164. margin: 20px;
  165. }
  166. }
  167. }
  168. </style>