steel_inboundReal.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //真实入库作业
  2. <template>
  3. <div class="steel_inbound_real">
  4. <div class="sache">
  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-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-button type="primary" class="btn" @click="onreserved">
  21. 预留
  22. </el-button> -->
  23. </div>
  24. <div class="table">
  25. <dilTable v-bind.sync="options" @selection-change="selectionChange" ref="table">
  26. <!-- <el-table-column fixed="right" label="操作" width="150">
  27. <template slot-scope="scope">
  28. <el-button type="text" size="mini" @click="inboundDetails(scope)">
  29. 详情
  30. </el-button>
  31. </template>
  32. </el-table-column> -->
  33. </dilTable>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { sjTime } from "@/utils/sharedJsFile";
  39. import { getCookie } from '@/utils/util.js';
  40. export default {
  41. data(){
  42. return{
  43. inputText:"",
  44. startTime: null,
  45. endTime: null,
  46. region: "0",
  47. options:{
  48. // first请求数据的地址
  49. requestUrl: "/api/v1/wms/getWmsInboundResults?apiId=371&warehouseId="+3,
  50. // selectionType: "select",
  51. // mapList: [],
  52. },
  53. }
  54. },
  55. methods:{
  56. // inboundDetails(scope){
  57. // this.$router.push("/inboundDetails/" + scope.row.inboundId)
  58. // },
  59. onclick(){
  60. let startTime = null;
  61. let endTime = null;
  62. // 判断用户有没有班次,有班次则提供默认时间
  63. if(this.region!=null){
  64. let date =null;
  65. let date2 =null;
  66. let year = null;
  67. let month =null;
  68. let day = null;
  69. let year2 = null;
  70. let month2 =null;
  71. let day2 = null;
  72. // 判断当前日期输入框中是否选择了时间,并且开始日期和结束日期是否是同一天
  73. if(this.startTime!=null){
  74. date = this.startTime;
  75. // 判断当前开始时间是标准时间还是字符串时间
  76. year = date.getFullYear(); // 年
  77. month = date.getMonth() + 1; // 月
  78. day = date.getDate(); // 日
  79. }
  80. if(this.endTime!=null){
  81. date2 = this.endTime;
  82. year2 = date2.getFullYear(); // 年
  83. month2 = date2.getMonth() + 1; // 月
  84. day2 = date2.getDate(); // 日 // 日
  85. }
  86. if(this.startTime==null&&this.endTime==null){
  87. // 获取当前的日期时间
  88. date = new Date();
  89. year = date.getFullYear(); // 年
  90. month = date.getMonth() + 1; // 月
  91. day = date.getDate(); // 日
  92. }
  93. // 判断开始日期和结束日期是否是同一天
  94. if(!(year==year2&&month==month2&&day==day2)&&(this.startTime!=null||this.endTime!=null)&&this.region==null){
  95. // 当不是同一天的时候,直接弹窗警告
  96. this.startTime = null;
  97. this.endTime = null;
  98. this.$message.warning("开始日期和结束日期不是同一天");
  99. }
  100. // 判断当前用户选择的具体班次
  101. if(this.region == 0){
  102. this.startTime = year+"-"+month+"-"+day+" "+"00:00:00";
  103. // 将结束时间加一
  104. day =parseInt(day) + 1;
  105. this.endTime = year+"-"+month+"-"+day+" "+"00:00:00";
  106. }else if(this.region == 1){
  107. this.startTime = year+"-"+month+"-"+day+" "+"07:30:00";
  108. this.endTime = year+"-"+month+"-"+day+" "+"15:30:00";
  109. }else if(this.region == 2){
  110. this.startTime = year+"-"+month+"-"+day+" "+"15:30:00";
  111. this.endTime = year+"-"+month+"-"+day+" "+"23:30:00";
  112. }else if(this.region == 3){
  113. this.endTime = year+"-"+month+"-"+day+" "+"07:30:00";
  114. // 将开始时间减一
  115. day =parseInt(day)-1;
  116. this.startTime = year+"-"+month+"-"+day+" "+"23:30:00";
  117. }
  118. this.startTime = new Date(this.startTime)
  119. this.endTime = new Date(this.endTime)
  120. console.log(this.startTime+"开始时间")
  121. console.log(this.endTime+"结束时间")
  122. // 将拼接好的日期转换为时间戳
  123. startTime = Date.parse(this.startTime)
  124. endTime = Date.parse(this.endTime)
  125. console.log(startTime+"开始时间2")
  126. console.log(endTime+"结束时间2")
  127. }else{
  128. if (this.startTime) {
  129. startTime = sjTime(this.startTime);
  130. }
  131. if (this.endTime) {
  132. endTime = sjTime(this.endTime);
  133. }
  134. }
  135. // console.log(startTime)
  136. // console.log(endTime)
  137. if (startTime && endTime) {
  138. if (startTime < endTime) {
  139. // if(getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  140. this.options.requestUrl = "/api/v1/wms/getWmsInboundResults?apiId=371&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  141. // }else if(getCookie("orgCode") == "wuliuchuyunzhongxin"){
  142. // this.options.requestUrl = "/api/v1/wms/getWmsInboundResults?apiId=371&orderType=13&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  143. // }else{
  144. // this.options.requestUrl = '/api/v1/wms/getWmsInboundResults?apiId=371&userId=' + getCookie("orgCode") +"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  145. // }
  146. } else {
  147. this.startTime = null;
  148. this.endTime = null;
  149. this.$message.warning("开始时间要比结束时间早");
  150. }
  151. } else {
  152. // this.getRequestUrl()
  153. }
  154. },
  155. selectionChange(selection) {
  156. this.options.mapList = selection;
  157. },
  158. onreserved(){
  159. console.log("fahaahahahaha")
  160. if (this.options.mapList.length == 0) {
  161. this.$message({
  162. type: "warning",
  163. message: "请先选择入库单!",
  164. });
  165. } else {
  166. this.$confirm("是否预留", "提示", {
  167. confirmButtonText: "确定",
  168. cancelButtonText: "取消",
  169. type: "warning",
  170. center: true,
  171. })
  172. .then(() => {
  173. //初始化maplist
  174. var mapList = [];
  175. this.options.mapList.forEach((item, i) => {
  176. //初始化mapItem
  177. var mapItem = {
  178. //入库实绩表id
  179. inboundId: 0,
  180. // 给一个标记定义其为入库变为预留
  181. status: 0,
  182. };
  183. mapItem.inboundId = item.inboundId;
  184. mapList.push(mapItem);
  185. });
  186. this.$message({
  187. type: "success",
  188. message: "预留成功!",
  189. });
  190. console.log(mapList)
  191. this.axios.post("/api/v1/wms/changeReserved", mapList).then((res) => {
  192. console.log("res.data"+res.data)
  193. if (res.data >= 1) {
  194. //改变查询条件
  195.       this.$refs.table.setDataRequestQuery({
  196. });  
  197. this.$router.go(0);
  198. }
  199. });
  200. console.log("fdagfaahh")
  201. })
  202. .catch(() => {
  203. this.$message({
  204. type: "info",
  205. message: "取消上传!",
  206. });
  207. });
  208. }
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. .steel_inbound_real{
  215. .sache{
  216. display: flex;
  217. justify-content: start;
  218. align-items: center;
  219. line-height: 40px;
  220. height: 40px;
  221. padding-left: 1.875rem;
  222. .el-select {
  223. width: 100%;
  224. .el-input__inner {
  225. width: 150px;
  226. }
  227. }
  228. }
  229. }
  230. </style>