steel_inboundStatistics.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //入库统计
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <!-- <el-input
  6. placeholder="请输入内容"
  7. v-model="inputText"
  8. clearable>
  9. </el-input>
  10. -->
  11. <span>入库时间:</span>
  12. <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
  13. </el-date-picker>
  14. <span>至</span>
  15. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  16. </el-date-picker>
  17. <el-select v-model="region" placeholder="请选择班次">
  18. <el-option label="不选择班次" value="0"></el-option>
  19. <el-option label="早班" value="1"></el-option>
  20. <el-option label="中班" value="2"></el-option>
  21. <el-option label="晚班" value="3"></el-option>
  22. </el-select>
  23. <el-button type="primary" class="btn" @click="onclick">
  24. <i class="el-icon-search"></i>查询
  25. </el-button>
  26. </div>
  27. <div class="table">
  28. <dilTable v-bind.sync="options" >
  29. <!-- <el-table-column fixed="right" label="操作" width="150">
  30. <template slot-scope="scope">
  31. <el-button type="text" size="mini" @click="inboundDetails(scope)">
  32. 详情
  33. </el-button>
  34. </template>
  35. </el-table-column> -->
  36. </dilTable>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { sjTime } from "@/utils/sharedJsFile";
  42. import { getCookie } from '@/utils/util.js';
  43. export default {
  44. data(){
  45. return{
  46. inputText:"",
  47. startTime: null,
  48. endTime: null,
  49. region: "0",
  50. options:{
  51. // first请求数据的地址
  52. requestUrl: "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3,
  53. // selectionType: "select",
  54. // mapList: [],
  55. },
  56. }
  57. },
  58. methods:{
  59. // inboundDetails(scope){
  60. // this.$router.push("/inboundDetails/" + scope.row.inboundId)
  61. // },
  62. onclick(){
  63. let startTime = null;
  64. let endTime = null;
  65. // 判断用户有没有班次,有班次则提供默认时间
  66. if(this.region!=null){
  67. let date =null;
  68. let date2 =null;
  69. let year = null;
  70. let month =null;
  71. let day = null;
  72. let year2 = null;
  73. let month2 =null;
  74. let day2 = null;
  75. // 判断当前日期输入框中是否选择了时间,并且开始日期和结束日期是否是同一天
  76. if(this.startTime!=null){
  77. date = this.startTime;
  78. // 判断当前开始时间是标准时间还是字符串时间
  79. year = date.getFullYear(); // 年
  80. month = date.getMonth() + 1; // 月
  81. day = date.getDate(); // 日
  82. }
  83. if(this.endTime!=null){
  84. date2 = this.endTime;
  85. year2 = date2.getFullYear(); // 年
  86. month2 = date2.getMonth() + 1; // 月
  87. day2 = date2.getDate(); // 日 // 日
  88. }
  89. if(this.startTime==null&&this.endTime==null){
  90. // 获取当前的日期时间
  91. date = new Date();
  92. year = date.getFullYear(); // 年
  93. month = date.getMonth() + 1; // 月
  94. day = date.getDate(); // 日
  95. }
  96. // 判断开始日期和结束日期是否是同一天
  97. if(!(year==year2&&month==month2&&day==day2)&&(this.startTime!=null||this.endTime!=null)&&this.region==null){
  98. // 当不是同一天的时候,直接弹窗警告
  99. this.startTime = null;
  100. this.endTime = null;
  101. this.$message.warning("开始日期和结束日期不是同一天");
  102. }
  103. // 判断当前用户选择的具体班次
  104. if(this.region == 0){
  105. this.startTime = year+"-"+month+"-"+day+" "+"00:00:00";
  106. // 将结束时间加一
  107. day =parseInt(day) + 1;
  108. this.endTime = year+"-"+month+"-"+day+" "+"00:00:00";
  109. }else if(this.region == 1){
  110. this.startTime = year+"-"+month+"-"+day+" "+"07:30:00";
  111. this.endTime = year+"-"+month+"-"+day+" "+"15:30:00";
  112. }else if(this.region == 2){
  113. this.startTime = year+"-"+month+"-"+day+" "+"15:30:00";
  114. this.endTime = year+"-"+month+"-"+day+" "+"23:30:00";
  115. }else if(this.region == 3){
  116. this.endTime = year+"-"+month+"-"+day+" "+"07:30:00";
  117. // 将开始时间减一
  118. day =parseInt(day)-1;
  119. this.startTime = year+"-"+month+"-"+day+" "+"23:30:00";
  120. }
  121. this.startTime = new Date(this.startTime)
  122. this.endTime = new Date(this.endTime)
  123. console.log(this.startTime+"开始时间")
  124. console.log(this.endTime+"结束时间")
  125. // 将拼接好的日期转换为时间戳
  126. startTime = Date.parse(this.startTime)
  127. endTime = Date.parse(this.endTime)
  128. console.log(startTime+"开始时间2")
  129. console.log(endTime+"结束时间2")
  130. }else{
  131. if (this.startTime) {
  132. startTime = sjTime(this.startTime);
  133. }
  134. if (this.endTime) {
  135. endTime = sjTime(this.endTime);
  136. }
  137. }
  138. if (startTime && endTime) {
  139. if (startTime < endTime) {
  140. if(getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  141. this.options.requestUrl = "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  142. }else if(getCookie("orgCode") == "wuliuchuyunzhongxin"){
  143. this.options.requestUrl = "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&orderType=13&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  144. }else{
  145. this.options.requestUrl = '/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&userId=' + getCookie("orgCode") +"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  146. }
  147. } else {
  148. this.startTime = null;
  149. this.endTime = null;
  150. this.$message.warning("开始时间要比结束时间早");
  151. }
  152. } else {
  153. this.getRequestUrl()
  154. }
  155. },
  156. selectionChange(selection) {
  157. this.options.mapList = selection;
  158. },
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scode>
  163. .steel_inbound{
  164. .sache{
  165. height: 5rem;
  166. display: flex;
  167. align-items: center;
  168. padding-left: 1.875rem;
  169. }
  170. }
  171. </style>