Browse Source

考勤管理-查询条件更改

jingbb 1 năm trước cách đây
mục cha
commit
3934cebc03

+ 34 - 1
src/views/oa/salary_management/Attendance/attendanceManagement.vue

@@ -7,7 +7,18 @@
           <a-row :gutter="24">
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
               <a-form-item label="时间">
-                <a-month-picker placeholder="请选择" :allowClear="false" v-model="yearWithMonth" @change="onChange" style="width:100% !important"/>
+                <a-range-picker
+                    style="width: 100% !important"
+                    v-model="DateTime"
+                    format="YYYY-MM"
+                    valueFormat="YYYY-MM"
+                    :mode="mode2"
+                    :open="open"
+                    :placeholder="['开始时间', '结束时间']"
+                    @panelChange="handlePanelChange2"
+                    @openChange="onDateChange"
+                    @change="changeData"
+                />
               </a-form-item>
             </a-col>
             <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -93,6 +104,8 @@
           selectedRowKeys:[],
           selectedRows:[],
           yearWithMonth:'',
+          open:false,
+          mode2: ['month', 'month'],
           // 表头
           columns: [
             {
@@ -153,6 +166,7 @@
         },
         searchReset(){
           this.queryParam={}
+          this.DateTime = []
           this.getTableList()
         },
         getTableList(){
@@ -185,6 +199,25 @@
           }
             
         },
+        changeData(value){
+            this.DateTime = value
+        },
+        onDateChange(status) {
+            if(status){
+                this.open = true;
+            }else{
+                this.open = false
+            }
+        },
+        handlePanelChange2(value,mode){
+            if (this.DateTime[1] && this.DateTime[1]._d != value[1]._d) {
+                this.open = false;
+            }
+            this.DateTime = value
+            this.queryParam.yearWithMonth_begin = this.DateTime[0]&&this.DateTime[0]!==''?moment(this.DateTime[0]).format('YYYY-MM'):''
+            this.queryParam.yearWithMonth_end = this.DateTime[1]&&this.DateTime[1]!==''?moment(this.DateTime[1]).format('YYYY-MM'):''
+            this.mode2 = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
+        },
         handleDownload(record){
           downFile('/salary/salaryAttendance/exportXls',{id:record.id,type:record.type}).then(data => {
             if (!data) {