Forráskód Böngészése

feat: 公司改成按时间范围

xdd 1 hónapja
szülő
commit
11b18dcd1d

+ 28 - 9
src/views/course/courseTrafficLog/index.vue

@@ -7,7 +7,7 @@
 <!--        </el-select>-->
 <!--      </el-form-item>-->
       <el-form-item label="项目" prop="project">
-        <el-select v-model="form.project" placeholder="请选择项目" filterable clearable size="small">
+        <el-select v-model="queryParams.project" placeholder="请选择项目" filterable clearable size="small">
           <el-option
             v-for="dict in projectOptions"
             :key="dict.dictValue"
@@ -28,11 +28,12 @@
       </el-form-item>
       <el-form-item label="年月" prop="time">
         <el-date-picker
-          v-model="queryParams.time"
-          type="month"
+          v-model="time"
+          type="daterange"
           placeholder="选择年月"
           :picker-options="pickerOptions"
-          :value-format="'yyyy-MM'"
+          :value-format="'yyyy-MM-dd'"
+          @change="handleDateData"
         ></el-date-picker>
       </el-form-item>
       <el-form-item>
@@ -93,12 +94,20 @@ export default {
   name: "CourseTrafficLog",
   data() {
     return {
-      companyList:[],
       pickerOptions: {
-        shortcuts: [{ text: '本月', onClick: () => this.handleShortcut() }],
+        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]);
+          }
+        }]
       },
+      companyList:[],
       // 遮罩层
-      loading: true,
+      loading: false,
       // 导出遮罩层
       exportLoading: false,
       // 选中数组
@@ -119,8 +128,11 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      time: null,
       // 查询参数
       queryParams: {
+        startDate: null,
+        endDate: null,
         pageNum: 1,
         pageSize: 10,
         userId: null,
@@ -131,7 +143,6 @@ export default {
         companyUserId: null,
         companyId: null,
         courseId: null,
-        time:new Date().toISOString().slice(0, 7)
       },
       // 表单参数
       form: {},
@@ -147,11 +158,19 @@ export default {
     this.getDicts("sys_course_project").then(response => {
       this.projectOptions = response.data;
     });
-    this.getList();
     this.getAllCompany();
 
   },
   methods: {
+    handleDateData(){
+      if (this.time) {
+        this.queryParams.startDate = this.time[0];
+        this.queryParams.endDate = this.time[1];
+      } else {
+        this.queryParams.startDate = null;
+        this.queryParams.endDate = null;
+      }
+    },
     getAllCompany() {
       allList().then(response => {
         this.companyList = response.rows;

+ 0 - 1
src/views/course/courseWatchLog/index.vue

@@ -11,7 +11,6 @@
           <el-option
             v-for="dict in fsUserList"
             :key="`${dict.nickname} - ${dict.phone}`"
-            :label="`${dict.nickname} - ${dict.phone}`"
             :value="dict.userId">
           </el-option>
         </el-select>