马宇豪
2024-02-23 4cfbfd1b425f7b22b876ae6cae95c4fc29ae6bfb
src/views/stock/enterpriseSale.vue
@@ -4,12 +4,15 @@
            <el-row>
                时间:&emsp;&emsp;
                <el-date-picker
                    value-format="yyyy-MM-dd HH:mm:ss"
                    v-model="dateRange"
                    type="datetimerange"
                    type="daterange"
                    :default-time="['00:00:00','23:59:59']"
                    :picker-options="pickerOptions"
                    range-separator="-"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    :clearable="false"
                    :default-time="['00:00:00','23:59:59']">
                >
                </el-date-picker>
                <el-button class="filter-item" style="margin-left: 15px;" type="primary" icon="el-icon-refresh"
                           @click="refreshHandle">刷新
@@ -220,6 +223,25 @@
                    community:'',
                    enterpriseType:'',
                },
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
              totalRow:{}
            }
        },
@@ -228,7 +250,7 @@
            outStorageDetail,
            saleDetail
        },
        mounted(){
        created(){
            getManufacturerTree().then(res=>{
                this.manufacturerTree=(res.data) ;
            });
@@ -300,10 +322,35 @@
                this.$router.push({path:'/sale/info',query:{enterpriseNumber:enterpriseNumber,beginDate:this.queryForm.beginDate,endDate:this.queryForm.endDate}})
            },
            refreshHandle: function () {
                this.currentPage = 1
                this.queryForm = {
                    name: '',
                    beginDate:'',
                    endDate:'',
                    province:'',
                    city:'',
                    area:'',
                    town:'',
                    community:'',
                    enterpriseType:'',
                }
                this.dateRange = []
                this.queryDateHandle()
                this.getSaleList();
            },
            queryHandle: function () {
                this.currentPage = 1;
                const date1 = new Date(this.dateRange[0]);
                const date2 = new Date(this.dateRange[1]);
                const differenceInMs = Math.abs(date2 - date1);
                const differenceInDays = differenceInMs / (1000 * 60 * 60 * 24)
                if(differenceInDays > 32){
                    this.$message({
                        type: 'warning',
                        message: '时间跨度超过一个月的,请联系管理员查询数据'
                    })
                    return
                }
                this.getSaleList();
            },
            handleSizeChange: function (val) {
@@ -400,15 +447,20 @@
            },
            queryDateHandle(){
                // const end = new Date();
                // const start = new Date();
                // start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                // start.setHours(0);
                // start.setMinutes(0);
                // start.setSeconds(0);
                // this.dateRange.push(start,end);
                // this.queryForm.beginDate = start;
                // this.queryForm.endDate = end;
                const end = new Date();
                const start = new Date();
                start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                start.setHours(0);
                start.setMinutes(0);
                start.setSeconds(0);
                this.dateRange.push(start,end);
                this.queryForm.beginDate = start;
                this.queryForm.endDate = end;
                const start = new Date(end);
                start.setDate(start.getDate() - 7);
                this.dateRange[0] = start.toISOString().slice(0, 10) + " 00:00:00";
                this.dateRange[1] = end.toISOString().slice(0, 10) + " 23:59:59";
            },
            exportAllHandle () {
                const _this = this;