123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- //入库转预留
- <template>
- <div class="steel_inbound">
- <div class="sache">
- <span class="text">入库时间:</span>
- <el-date-picker disabled v-model="startTime" type="datetime" placeholder="选择日期">
- </el-date-picker>
- <span class="text">至</span>
- <el-date-picker disabled v-model="endTime" type="datetime" placeholder="选择日期">
- </el-date-picker>
- <span class="text">物资类型</span>
- <el-autocomplete
- class="inputStyle"
- v-model="inputText"
- :fetch-suggestions="querySearch"
- placeholder="请输入内容"
- @select="handleSelect"
- ></el-autocomplete>
- <el-button type="primary" class="btn" @click="onclick">
- <i class="el-icon-search"></i>查询
- </el-button>
- <el-button type="primary" class="btn" @click="onreserved">
- 预留
- </el-button>
- </div>
- <div class="table">
- <dilTable v-if="tableShow" :selectionType="selectionType" v-bind.sync="options" >
- </dilTable>
- </div>
- </div>
- </template>
- <script>
- import { sjTime } from "@/utils/sharedJsFile";
- import { getCookie } from '@/utils/util.js';
- export default {
- data(){
- return{
- tableShow:false,
- selectionType:"",
- inputText:"",
- startTime: null,
- endTime: null,
- options:{
- // first请求数据的地址
- requestUrl: "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3,
- // selectionType: "select",
- // mapList: [],
- },
- }
- },
- mounted(){
- var date = new Date();
- let dateStr=this.formatDate(date, 'yyyy-MM-dd hh:mm:ss');
-
- this.startTime= Date.parse(new Date(dateStr));
- this.endTime=new Date(this.startTime+86400000);
- this.options.requestUrl= "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3+"&startTime=" + sjTime(this.startTime) + "&endTime=" + sjTime(this.endTime) ;
- this.tableShow=true;
- },
- methods:{
- formatDate (date, fmt) {
- if (/(y+)/.test(fmt)) {
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
- }
- let o = {
- 'M+': date.getMonth() + 1,
- 'd+': date.getDate(),
- 'h+': 0,
- 'm+': 0,
- 's+': 0
- }
- for (let k in o) {
- if (new RegExp(`(${k})`).test(fmt)) {
- let str = o[k] + ''
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? str : this.padLeftZero(str))
- }
- }
- return fmt
- },
- padLeftZero (str) {
- return ('00' + str).substr(str.length)
- },
- querySearch(queryString, cb) {
- var restaurants = [
- {"value":"螺纹钢"},
- {"value":"盘螺"},
- {"value":"乱尺"}
- ];
- var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
- // 调用 callback 返回建议列表的数据
- cb(results);
- },
- createFilter(queryString) {
- return (restaurant) => {
- return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
- };
- },
- // inboundDetails(scope){
- // this.$router.push("/inboundDetails/" + scope.row.inboundId)
- // },
- onclick(){
- let startTime = null;
- let endTime = null;
- if (this.startTime) {
- startTime = sjTime(this.startTime);
- }
- if (this.endTime) {
- endTime = sjTime(this.endTime);
- }
- if (startTime && endTime) {
- if (startTime < endTime) {
- this.options.requestUrl = "/api/v1/wms/getWmsInboundResult?apiId=371&warehouseId="+3+"&startTime=" + startTime + "&endTime=" + endTime + "&i=" +new Date();
- this.options.requestQuery={
- "materialNames":this.inputText
- }
- // this.selectionType="select";
- } else {
- this.startTime = null;
- this.endTime = null;
- this.$message.warning("开始时间要比结束时间早");
- }
- } else {
- this.$message.warning("没有选择时间段");
- // this.getRequestUrl()
- }
- },
- selectionChange(selection) {
- this.options.mapList = selection;
- },
- handleSelect(item) {
- console.log(item);
- },
- onreserved(){
- this.$router.push({
- path: "/addSteelInbound",
- });
- }
- }
- }
- </script>
- <style lang="scss" scode>
- .steel_inbound{
- margin-top: 30px;
- margin-left: 20px;
-
- .sache{
- display: flex;
- margin-bottom: 10px;
- padding-right: 10px;
- .inputStyle{
- width: 200px;
- margin-right: 5px;
- margin-left: 5px;
- }
- .text {
- text-align: left;
- line-height: 40px;
- }
- .el-date-editor {
- margin-right: 5px;
- margin-left: 5px;
- }
- .btn {
- margin-left: 10px;
- }
- .el-select {
- width: 100%;
- .el-input__inner {
- width: 150px;
- }
- }
- }
- }
- </style>
|