steel_inbound.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //入库转预留
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <span class="text">入库时间:</span>
  6. <el-date-picker disabled v-model="startTime" type="datetime" placeholder="选择日期">
  7. </el-date-picker>
  8. <span class="text">至</span>
  9. <el-date-picker disabled v-model="endTime" type="datetime" placeholder="选择日期">
  10. </el-date-picker>
  11. <span class="text">物资类型</span>
  12. <el-autocomplete
  13. class="inputStyle"
  14. v-model="inputText"
  15. :fetch-suggestions="querySearch"
  16. placeholder="请输入内容"
  17. @select="handleSelect"
  18. ></el-autocomplete>
  19. <el-button type="primary" class="btn" @click="onclick">
  20. <i class="el-icon-search"></i>查询
  21. </el-button>
  22. <el-button type="primary" class="btn" @click="onreserved">
  23. 预留
  24. </el-button>
  25. </div>
  26. <div class="table">
  27. <dilTable v-if="tableShow" :selectionType="selectionType" v-bind.sync="options" >
  28. </dilTable>
  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. tableShow:false,
  39. selectionType:"",
  40. inputText:"",
  41. startTime: null,
  42. endTime: null,
  43. options:{
  44. // first请求数据的地址
  45. requestUrl: "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3,
  46. // selectionType: "select",
  47. // mapList: [],
  48. },
  49. }
  50. },
  51. mounted(){
  52. var date = new Date();
  53. let dateStr=this.formatDate(date, 'yyyy-MM-dd hh:mm:ss');
  54. this.startTime= Date.parse(new Date(dateStr));
  55. this.endTime=new Date(this.startTime+86400000);
  56. this.options.requestUrl= "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3+"&startTime=" + sjTime(this.startTime) + "&endTime=" + sjTime(this.endTime) ;
  57. this.tableShow=true;
  58. },
  59. methods:{
  60. formatDate (date, fmt) {
  61. if (/(y+)/.test(fmt)) {
  62. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
  63. }
  64. let o = {
  65. 'M+': date.getMonth() + 1,
  66. 'd+': date.getDate(),
  67. 'h+': 0,
  68. 'm+': 0,
  69. 's+': 0
  70. }
  71. for (let k in o) {
  72. if (new RegExp(`(${k})`).test(fmt)) {
  73. let str = o[k] + ''
  74. fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.padLeftZero(str))
  75. }
  76. }
  77. return fmt
  78. },
  79. padLeftZero (str) {
  80. return ('00' + str).substr(str.length)
  81. },
  82. querySearch(queryString, cb) {
  83. var restaurants = [
  84. {"value":"螺纹钢"},
  85. {"value":"盘螺"},
  86. {"value":"乱尺"}
  87. ];
  88. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  89. // 调用 callback 返回建议列表的数据
  90. cb(results);
  91. },
  92. createFilter(queryString) {
  93. return (restaurant) => {
  94. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  95. };
  96. },
  97. // inboundDetails(scope){
  98. // this.$router.push("/inboundDetails/" + scope.row.inboundId)
  99. // },
  100. onclick(){
  101. let startTime = null;
  102. let endTime = null;
  103. if (this.startTime) {
  104. startTime = sjTime(this.startTime);
  105. }
  106. if (this.endTime) {
  107. endTime = sjTime(this.endTime);
  108. }
  109. if (startTime && endTime) {
  110. if (startTime < endTime) {
  111. this.options.requestUrl = "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
  112. this.options.requestQuery={
  113. "materialNames":this.inputText
  114. }
  115. // this.selectionType="select";
  116. } else {
  117. this.startTime = null;
  118. this.endTime = null;
  119. this.$message.warning("开始时间要比结束时间早");
  120. }
  121. } else {
  122. this.$message.warning("没有选择时间段");
  123. // this.getRequestUrl()
  124. }
  125. },
  126. selectionChange(selection) {
  127. this.options.mapList = selection;
  128. },
  129. handleSelect(item) {
  130. console.log(item);
  131. },
  132. onreserved(){
  133. this.$router.push({
  134. path: "/addSteelInbound",
  135. });
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scode>
  141. .steel_inbound{
  142. margin-top: 30px;
  143. margin-left: 20px;
  144. .sache{
  145. display: flex;
  146. margin-bottom: 10px;
  147. padding-right: 10px;
  148. .inputStyle{
  149. width: 200px;
  150. margin-right: 5px;
  151. margin-left: 5px;
  152. }
  153. .text {
  154. text-align: left;
  155. line-height: 40px;
  156. }
  157. .el-date-editor {
  158. margin-right: 5px;
  159. margin-left: 5px;
  160. }
  161. .btn {
  162. margin-left: 10px;
  163. }
  164. .el-select {
  165. width: 100%;
  166. .el-input__inner {
  167. width: 150px;
  168. }
  169. }
  170. }
  171. }
  172. </style>