steel_inboundStatistics.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. //入库统计
  2. <template>
  3. <div class="steel_inboundStatistics">
  4. <div class="sache">
  5. <span class="text">入库时间:</span>
  6. <el-date-picker v-model="startTime" type="datetime" placeholder="选择日期">
  7. </el-date-picker>
  8. <span class="text1">至</span>
  9. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  10. </el-date-picker>
  11. <el-select v-model="region" placeholder="请选择班次" style="width: auto;">
  12. <el-option label="不选择班次" value="0"></el-option>
  13. <el-option label="早班" value="1"></el-option>
  14. <el-option label="中班" value="2"></el-option>
  15. <el-option label="晚班" value="3"></el-option>
  16. </el-select>
  17. <el-button type="primary" class="btn" @click="onclick">
  18. <i class="el-icon-search"></i>查询
  19. </el-button>
  20. <el-col :span="3" v-html="'\u2003'"/>
  21. <span class="text">生产总件数</span>
  22. <el-input
  23. placeholder="请输入内容"
  24. v-model="input3"
  25. :disabled="true" class="inputs" style="width:10%">
  26. </el-input>
  27. <span class="text">生产总重量</span>
  28. <el-input
  29. placeholder="请输入内容"
  30. v-model="input4"
  31. :disabled="true" style="width:10%">
  32. </el-input>
  33. </div>
  34. <div class="table">
  35. <dilTable v-bind.sync="options" @func="func" :rowClassName="rowClassName">
  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. rowClassName({row, rowIndex}) {
  47. if (rowIndex === 0) {
  48. return 'success-row';
  49. }
  50. return '';
  51. },
  52. input1: '',
  53. input2: '',
  54. input3: '',
  55. input4: '',
  56. input5: '',
  57. inputText:"",
  58. startTime: null,
  59. endTime: null,
  60. region: "0",
  61. options:{
  62. // first请求数据的地址
  63. requestUrl: "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3,
  64. // selectionType: "select",
  65. // mapList: [],
  66. },
  67. }
  68. },
  69. created(){
  70. console.log(this.options.data)
  71. },
  72. methods:{
  73. func(res){
  74. // console.log(res.list[0])
  75. // this.input1 = this.input1 + e.furnaceNumber1,
  76. let num1 = 0;
  77. let num2 = 0;
  78. res.list.forEach(e => {
  79. console.log(e)
  80. console.log(e.count)
  81. console.log(e.weight)
  82. num1 = num1 + e.count,
  83. num2 = num2 + e.weight
  84. });
  85. this.input3 = num1;
  86. this.input4 = num2;
  87. // this.input1 = res.list[0].furnaceNumber1,
  88. // this.input2 = res.list[0].materialName,
  89. // this.input3 = res.list[0].count,
  90. // this.input4 = res.list[0].weight,
  91. // this.input5 = res.list[0].onetime
  92. },
  93. // inboundDetails(scope){
  94. // this.$router.push("/inboundDetails/" + scope.row.inboundId)
  95. // },
  96. onclick(){
  97. let startTime = null;
  98. let endTime = null;
  99. // 判断用户有没有班次,有班次则提供默认时间
  100. if(this.region!=null){
  101. let date =null;
  102. let date2 =null;
  103. let year = null;
  104. let month =null;
  105. let day = null;
  106. let year2 = null;
  107. let month2 =null;
  108. let day2 = null;
  109. // 判断当前日期输入框中是否选择了时间,并且开始日期和结束日期是否是同一天
  110. if(this.startTime!=null){
  111. date = this.startTime;
  112. // 判断当前开始时间是标准时间还是字符串时间
  113. year = date.getFullYear(); // 年
  114. month = date.getMonth() + 1; // 月
  115. day = date.getDate(); // 日
  116. }
  117. if(this.endTime!=null){
  118. date2 = this.endTime;
  119. year2 = date2.getFullYear(); // 年
  120. month2 = date2.getMonth() + 1; // 月
  121. day2 = date2.getDate(); // 日 // 日
  122. }
  123. if(this.startTime==null&&this.endTime==null){
  124. // 获取当前的日期时间
  125. date = new Date();
  126. year = date.getFullYear(); // 年
  127. month = date.getMonth() + 1; // 月
  128. day = date.getDate(); // 日
  129. }
  130. // 判断开始日期和结束日期是否是同一天
  131. if(!(year==year2&&month==month2&&day==day2)&&(this.startTime!=null||this.endTime!=null)&&this.region==null){
  132. // 当不是同一天的时候,直接弹窗警告
  133. this.startTime = null;
  134. this.endTime = null;
  135. this.$message.warning("开始日期和结束日期不是同一天");
  136. }
  137. // 判断当前用户选择的具体班次
  138. if(this.region == 0){
  139. this.startTime = year+"-"+month+"-"+day+" "+"00:00:00";
  140. // 将结束时间加一
  141. day =parseInt(day) + 1;
  142. this.endTime = year+"-"+month+"-"+day+" "+"00:00:00";
  143. }else if(this.region == 1){
  144. this.startTime = year+"-"+month+"-"+day+" "+"07:30:00";
  145. this.endTime = year+"-"+month+"-"+day+" "+"15:30:00";
  146. }else if(this.region == 2){
  147. this.startTime = year+"-"+month+"-"+day+" "+"15:30:00";
  148. this.endTime = year+"-"+month+"-"+day+" "+"23:30:00";
  149. }else if(this.region == 3){
  150. this.endTime = year+"-"+month+"-"+day+" "+"07:30:00";
  151. // 将开始时间减一
  152. day =parseInt(day)-1;
  153. this.startTime = year+"-"+month+"-"+day+" "+"23:30:00";
  154. }
  155. this.startTime = new Date(this.startTime)
  156. this.endTime = new Date(this.endTime)
  157. console.log(this.startTime+"开始时间")
  158. console.log(this.endTime+"结束时间")
  159. // 将拼接好的日期转换为时间戳
  160. startTime = Date.parse(this.startTime)
  161. endTime = Date.parse(this.endTime)
  162. console.log(startTime+"开始时间2")
  163. console.log(endTime+"结束时间2")
  164. }else{
  165. if (this.startTime) {
  166. startTime = sjTime(this.startTime);
  167. }
  168. if (this.endTime) {
  169. endTime = sjTime(this.endTime);
  170. }
  171. }
  172. if (startTime && endTime) {
  173. if (startTime < endTime) {
  174. // if(getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  175. this.options.requestUrl = "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  176. // }else if(getCookie("orgCode") == "wuliuchuyunzhongxin"){
  177. // this.options.requestUrl = "/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&orderType=13&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  178. // }else{
  179. // this.options.requestUrl = '/api/v1/wms/getWmsInboundResultStatistics?apiId=445&warehouseId="+3+"&userId=' + getCookie("orgCode") +"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  180. // }
  181. } else {
  182. this.startTime = null;
  183. this.endTime = null;
  184. this.$message.warning("开始时间要比结束时间早");
  185. }
  186. } else {
  187. this.getRequestUrl()
  188. }
  189. },
  190. selectionChange(selection) {
  191. this.options.mapList = selection;
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .steel_inboundStatistics {
  198. margin-top: 30px;
  199. margin-left: 20px;
  200. .sache{
  201. display: flex;
  202. margin-bottom: 10px;
  203. padding-right: 10px;
  204. .text {
  205. text-align: left;
  206. line-height: 40px;
  207. width: 70px;
  208. }
  209. .text1 {
  210. text-align: left;
  211. line-height: 40px;
  212. }
  213. .el-date-editor {
  214. margin-right: 5px;
  215. margin-left: 5px;
  216. }
  217. .btn {
  218. margin-left: 10px;
  219. }
  220. .el-select {
  221. width: 100%;
  222. .el-input__inner {
  223. width: 150px;
  224. }
  225. }
  226. }
  227. }
  228. </style>