1
lzhe
2024-12-06 2784bdb41eac8f55d52772f3b5fec38d7d399196
1
已修改1个文件
30 ■■■■ 文件已修改
src/views/mdc/first-workpiece.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/first-workpiece.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-26 09:36:18
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-11-27 15:44:14
 * @LastEditTime: 2024-12-06 10:47:53
 * @FilePath: /smart-web/src/views/mdc/status-record.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -137,14 +137,32 @@
        // }
    },
    mounted() {
        var date = new Date();
        var threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000;
        var threeDaysAgo = new Date(date.getTime() - threeDaysInMilliseconds);
        this.searchInfo.startDate = threeDaysAgo.toLocaleDateString().replace(/\//g,"-");
        this.searchInfo.endDate = date.toLocaleDateString().replace(/\//g,"-");
        this.setDate();  //设置开始,结束日期
        this.getTableData();
    },
    methods: {
        setDate() {
            var date = new Date();
            var threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000;
            var threeDaysAgo = new Date(date.getTime() - threeDaysInMilliseconds);
            // 辅助函数,用于将数字格式化为两位数
            function padZero(num) {
                return num < 10 ? '0' + num : num;
            }
            // 构建当前日期的字符串
            var currentYear = date.getFullYear();
            var currentMonth = padZero(date.getMonth() + 1); // 月份从0开始,所以需要加1
            var currentDay = padZero(date.getDate());
            this.searchInfo.startDate = currentYear + '-' + currentMonth + '-' + currentDay;
            // 构建三天前日期的字符串
            var previousYear = threeDaysAgo.getFullYear();
            var previousMonth = padZero(threeDaysAgo.getMonth() + 1);
            var previousDay = padZero(threeDaysAgo.getDate());
            this.searchInfo.endDate = previousYear + '-' + previousMonth + '-' + previousDay;
        },
        handleCurrentChange(val) {
            this.current = val;
            this.getTableData();