浏览代码

1.大中型-台账列表设置查询起止日期的默认值

GouGengquan 1 月之前
父节点
当前提交
6a1663ab6b
共有 1 个文件被更改,包括 25 次插入3 次删除
  1. 25 3
      src/views/statistical/major/ledgerList.vue

+ 25 - 3
src/views/statistical/major/ledgerList.vue

@@ -210,7 +210,7 @@
         </parentTable>
       </y-page-list-layout>
     </div>
-    <el-dialog :visible.sync="checkDialogVisible" center width="70%" top="0vh" >
+    <el-dialog :visible.sync="checkDialogVisible" center width="70%" top="5vh">
       <el-divider content-position="left">抽检扣分</el-divider>
       <el-form ref="spotCheck" :model="spotCheck">
         <div>
@@ -380,7 +380,7 @@ export default {
       pageData: { records: [] },
       listLoading: false,
       // 时间
-      selectDate: '',
+      selectDate: [],
       listQuery: {
         page: 1,
         size: 10,
@@ -455,9 +455,29 @@ export default {
     }
     this.getAllUser();
     this.getAllotDepartment();
+    this.selectDate.push(this.getDefaultStartDate());
+    this.selectDate.push(this.getDefaultEndDate());
     this.getMajorLedger();
   },
   methods: {
+    // 获取默认开始时间
+    getDefaultStartDate() {
+      let currentDate = new Date();
+      let currentYear = currentDate.getFullYear();
+      var currentMonth = String(currentDate.getMonth()).padStart(2, '0');
+      if (currentMonth == '00') {
+        currentYear = currentYear - 1;
+        currentMonth = 12;
+      }
+      return currentYear + '-' + currentMonth + '-' + '23';
+    },
+    // 获取默认结束时间
+    getDefaultEndDate() {
+      const currentDate = new Date();
+      const currentYear = currentDate.getFullYear();
+      var currentMonth = String(currentDate.getMonth() + 1).padStart(2, '0');
+      return currentYear + '-' + currentMonth + '-' + '22';
+    },
     // 获取所有用户下拉列表
     getAllUser() {
       this.$api.user.simpleAll().then((res) => {
@@ -476,7 +496,9 @@ export default {
     // 重置搜索条件
     resetParams() {
       this.exportStatus = true;
-      this.selectDate = '';
+      this.selectDate = [];
+      this.selectDate.push(this.getDefaultStartDate());
+      this.selectDate.push(this.getDefaultEndDate());
       this.$router.push({ query: {} });
       this.listQuery = {
         current: 1,