Sfoglia il codice sorgente

考勤日报表,BUG修复

xiao547607 4 anni fa
parent
commit
056d43463d

+ 17 - 5
src/api/business/workScheduleAttendance.js

@@ -41,13 +41,24 @@ function batchRemove(idList) {
   });
 }
 
-function personWorkList(formData) {
-  return request.post(constant.serverUrl + "/business/workScheduleAttendance/personWorkList", formData);
+function attendanceMonth(formData) {
+  //按月统计
+  return request.post(constant.serverUrl + "/business/workScheduleAttendance/attendanceMonth", formData);
 }
 
-function exportXls(formData) {
+function attendanceMonthDetail(formData) {
+  //按月统计详细
+  return request.post(constant.serverUrl + "/business/workScheduleAttendance/attendanceMonthDetail", formData);
+}
+
+function attendanceDay(formData) {
+  //按日统计
+  return request.post(constant.serverUrl + "/business/workScheduleAttendance/attendanceDay", formData);
+}
+
+function exportMonthXls(formData) {
   //导出xls
-  return request.post(constant.serverUrl + "/business/workScheduleAttendance/exportXls", formData);
+  return request.post(constant.serverUrl + "/business/workScheduleAttendance/exportMonthXls", formData);
 }
 
 function dayStatPageList(formData) {
@@ -56,5 +67,6 @@ function dayStatPageList(formData) {
 
 
 export default {
-  pageList, create, edit, add, update, remove, batchRemove, personWorkList,exportXls,dayStatPageList
+  pageList, create, edit, add, update, remove, batchRemove, exportMonthXls, dayStatPageList,
+  attendanceMonth, attendanceMonthDetail, attendanceDay
 }

+ 39 - 26
src/routers/modules/business.js

@@ -25,32 +25,6 @@ var routers = [
                         title: '补卡申请记录'
                 }
         },
-        {
-                //考勤统计
-                path: '/business/workScheduleAttendance/list',
-                name: 'BusinessWorkScheduleAttendanceList',
-                // route level code-splitting
-                // this generates a separate chunk (about.[hash].js) for this route
-                // which is lazy-loaded when the route is visited.
-                component: () => import('@/views/business/workScheduleAttendance-list.vue'),
-                meta: {
-                        roles: ["admin"],
-                        title: '考勤统计'
-                }
-        },
-        {
-                //考勤统计
-                path: '/business/workScheduleAttendance/daylist',
-                name: 'BusinessWorkScheduleAttendanceDayList',
-                // route level code-splitting
-                // this generates a separate chunk (about.[hash].js) for this route
-                // which is lazy-loaded when the route is visited.
-                component: () => import('@/views/business/workScheduleAttendance-day-list.vue'),
-                meta: {
-                        roles: ["admin"],
-                        title: '考勤统计详细'
-                }
-        },
         {
                 //考勤日报表
                 path: '/business/workScheduleAttendance/dayStat',
@@ -103,6 +77,45 @@ var routers = [
                         title: '外勤打卡记录'
                 }
         },
+        {
+                //考勤按月统计
+                path: '/business/workScheduleAttendance/monthList',
+                name: 'BusinessWorkScheduleAttendanceMonthList',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/business/workScheduleAttendance-month-list.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '考勤按月统计'
+                }
+        },
+        {
+                //考勤按月统计详细
+                path: '/business/workScheduleAttendance/monthDetail',
+                name: 'BusinessWorkScheduleAttendanceMonthDetail',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/business/workScheduleAttendance-month-detail.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '考勤统计详细'
+                }
+        },
+        {
+                //考勤按日统计
+                path: '/business/workScheduleAttendance/dayList',
+                name: 'BusinessWorkScheduleAttendanceDayList',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/business/workScheduleAttendance-day-list.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '考勤按日统计'
+                }
+        },
 ]
 
 export default routers;

+ 3 - 3
src/views/base/workOver-list.vue

@@ -116,12 +116,12 @@
             <el-form-item label="加班原因:">
               <span>{{row.reason }}</span>
             </el-form-item>
-            <el-form-item label="审核意见:">
-              <span>{{row.approvalContent }}</span>
-            </el-form-item>
             <el-form-item label="审核时间:">
               <span>{{row.approvalTime }}</span>
             </el-form-item>
+            <el-form-item label="加班员工:">
+              <span>{{row.overPersonNames }}</span>
+            </el-form-item>
           </el-form>
         </template>
       </el-table-column>

+ 1 - 1
src/views/business/workAttendance-list.vue

@@ -187,7 +187,7 @@ export default {
       ruleValidate: {
         companyId: [{ required: true, message: "不能为空", trigger: "blur" }],
         timeRanges: [
-          { required: true, message: "请选择事件范围", trigger: "blur" }
+          { required: true, message: "请选择时间范围", trigger: "blur" }
         ]
       },
       queryModel: {

+ 404 - 231
src/views/business/workScheduleAttendance-day-list.vue

@@ -6,7 +6,7 @@
         <a href="#">系统管理</a>
       </el-breadcrumb-item>
       <el-breadcrumb-item>
-        <a href="/workScheduleAttendance">考勤统计明细</a>
+        <a href="/workScheduleAttendance">考勤按日统计</a>
       </el-breadcrumb-item>
     </el-breadcrumb>
     <el-divider></el-divider>
@@ -16,146 +16,203 @@
     <el-form
       ref="queryForm"
       :model="queryModel"
+      :rules="ruleValidate"
       inline
       class="demo-form-inline"
     >
-      <el-form-item label="统计区间" prop="timeRanges">
-        <el-date-picker
-          v-model="queryModel.timeRanges"
-          type="monthrange"
-          range-separator="至"
-          start-placeholder="开始月份"
-          end-placeholder="结束月份"
-          value-format="yyyy-MM"
-          :default-time="timeRangesDefaultTime"
-          size="mini"
-        ></el-date-picker>
-      </el-form-item>
-      <el-form-item>
-        <el-button
-          type="primary"
-          size="mini"
-          icon="ios-search"
-          @click="changePage(1)"
-          :loading="loading"
-          >查询</el-button
-        >&nbsp;
-        <el-button
-          type="info"
-          size="mini"
-          style="margin-left: 8px"
-          @click="handleReset('queryForm')"
-          >重置</el-button
-        >&nbsp;
-        <el-button
+      <div>
+        <el-row>
+          <el-form-item label="统计区间" prop="queryDate">
+            <el-date-picker
+              v-model="queryModel.queryDate"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="选择日期"
+              size="mini"
+            >
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="单位/部门" prop="companyId">
+            <el-select-tree
+              :props="props"
+              :options="companyResult"
+              v-model="queryModel.companyId"
+              height="200"
+            ></el-select-tree>
+            &nbsp;
+            <el-checkbox v-model="queryModel.subordinate"
+              >是否包含下级单位</el-checkbox
+            >
+          </el-form-item>
+          <el-form-item label="姓名" prop="name">
+            <el-input
+              type="text"
+              size="mini"
+              v-model="queryModel.name"
+              style="width: 100px"
+            ></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button
+              type="primary"
+              size="mini"
+              style="margin-left: 8px"
+              @click="handleQuery('queryForm')"
+              >查询</el-button
+            >&nbsp;
+            <el-button
+              type="info"
+              size="mini"
+              style="margin-left: 8px"
+              @click="handleReset('queryForm')"
+              >重置</el-button
+            >
+          </el-form-item>
+        </el-row>
+      </div>
+    </el-form>
+    <el-divider></el-divider>
+    <el-row class="button-group">
+      <!-- <el-button
+        type="primary"
+        size="small"
+        plain
+        icon="el-icon-download"
+        :loading="xlsLoading"
+        @click="downloadAll"
+        >导出数据</el-button
+      > -->
+      <el-button
         type="primary"
-        size="mini"
+        size="small"
         plain
         icon="el-icon-printer"
         @click="printReport"
-        >打印报表</el-button>
-      </el-form-item>
-    </el-form>
-    <el-divider></el-divider>
-    <el-row class="button-group">
-      <div v-html="showMessage"></div>
-    </el-row>
-    <section id="printContent">
-      <el-table
-        ref="formTable"
-        stripe
-        :data="tableData"
-        :height="tableHeight"
-        style="min-height: 400px"
-        v-loading="loading"
-        @sort-change="sortChange"
-        @selection-change="handleSelectionChange"
+        >打印报表</el-button
       >
-        <el-table-column
-          prop="attendanceDate"
-          label="日期"
-          width="180"
-        ></el-table-column>
-        <el-table-column prop="shiftNumbers" label="班次" width="180">
-          <template slot-scope="{ row }">
-            <span
-              v-if="
-                row.onWorkStatus != '1' &&
-                row.onWorkStatus != '1' &&
-                row.onWorkStatus != null
-              "
-            >
-              {{ row.onWorkStatusN }}
-            </span>
-            <span v-else>
-              {{ row.shiftNumbers }}
-            </span>
-          </template>
-        </el-table-column>
-        <el-table-column prop="onWorkRecordTime" label="上班打卡时间" width="180"
-          ><template slot-scope="{ row }">
-            <span v-if="row.onWorkStatus == '1' && row.onWorkResult != '0'">
-              {{ row.onWorkRecordTime }}
-            </span>
-            <span v-else></span>
-          </template>
-        </el-table-column>
-        <el-table-column prop="onWorkResult" label="上班打卡状态" width="180">
-          <template slot-scope="{ row }">
-            <span v-if="row.onWorkStatus == '1' && row.onWorkResult == '0'">
-              {{ row.onWorkResultN }}
-            </span>
-            <span
-              v-else-if="
-                row.onWorkStatus == '1' &&
-                (row.onWorkResult =='2' || row.onWorkResult =='3')
-              "
-            >
-              {{ row.onWorkResultN }} {{ row.onLateLeaveMinuteN }}
-            </span>
-            <span v-else></span>
-          </template>
-        </el-table-column>
-        <el-table-column prop="offWorkRecordTime" label="下班打卡时间" width="180"
-          ><template slot-scope="{ row }">
-            <span v-if="row.offWorkStatus == '1' && row.offWorkResult != '0'">
-              {{ row.offWorkRecordTime }}</span
-            >
-            <span v-else> </span> </template
-        ></el-table-column>
-        <el-table-column prop="offWorkResult" label="下班打卡状态" width="180">
-          <template slot-scope="{ row }">
-            <span v-if="row.offWorkStatus == '1' && row.offWorkResult == '0'">
-              {{ row.offWorkResultN }}
-            </span>
-            <span
-              v-if="
-                row.offWorkStatus == '1' &&
-                (row.offWorkResult == '2' || row.offWorkResult == '3')
-              "
-            >
-              {{ row.offWorkResultN }} {{ row.offLateLeaveMinuteN }}
-            </span>
-            <span v-else></span>
-          </template>
-        </el-table-column>
-        <el-table-column
-          prop="absenteeismDays"
-          label="旷工天数"
-          width="180"
-        ></el-table-column>
-        <el-table-column
-          prop="notSwipingNum"
-          label="未打卡次数"
-          width="180"
-        ></el-table-column>
-      </el-table>
-    </section>
+    </el-row>
+    <el-table
+      id="printAttendanceListContent"
+      ref="formTable"
+      stripe
+      :data="tableData"
+      :height="tableHeight"
+      style="width: 100%"
+      v-loading="loading"
+      :element-loading-text="loadingText"
+    >
+      <el-table-column
+        type="index"
+        label="序号"
+        :index="indexMethod"
+        fixed="left"
+        width="50"
+      ></el-table-column>
+      <el-table-column
+        prop="personInfo.name"
+        label="姓名"
+        width="120"
+        fixed="left"
+      ></el-table-column
+      ><el-table-column
+        prop="personInfo.companyName"
+        label="部门"
+        width="120"
+        fixed="left"
+      ></el-table-column>
+      <el-table-column
+        prop="personInfo.jobNumber"
+        label="工号"
+        width="80"
+        fixed="left"
+      ></el-table-column>
+      <el-table-column prop="shiftNumbers" label="班次" width="180">
+        <template slot-scope="{ row }">
+          <span
+            v-if="
+              row.onWorkStatus != '1' &&
+              row.onWorkStatus != '1' &&
+              row.onWorkStatus != null
+            "
+          >
+            {{ row.onWorkStatusN }}
+          </span>
+          <span v-else>
+            {{ row.shiftNumbers }}
+          </span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="onWorkRecordTime" label="上班打卡时间" width="180"
+        ><template slot-scope="{ row }">
+          <span v-if="row.onWorkStatus == '1' && row.onWorkResult != '0'">
+            {{ row.onWorkRecordTime }}
+          </span>
+          <span v-else></span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="onWorkResult" label="上班打卡状态" width="180">
+        <template slot-scope="{ row }">
+          <span v-if="row.onWorkStatus == '1' && row.onWorkResult == '0'">
+            {{ row.onWorkResultN }}
+          </span>
+          <span
+            v-else-if="
+              row.onWorkStatus == '1' &&
+              (row.onWorkResult == '2' || row.onWorkResult == '3')
+            "
+          >
+            {{ row.onWorkResultN }} {{ row.onLateLeaveMinuteN }}
+          </span>
+          <span v-else></span>
+        </template>
+      </el-table-column>
+      <el-table-column prop="offWorkRecordTime" label="下班打卡时间" width="180"
+        ><template slot-scope="{ row }">
+          <span v-if="row.offWorkStatus == '1' && row.offWorkResult != '0'">
+            {{ row.offWorkRecordTime }}</span
+          >
+          <span v-else> </span> </template
+      ></el-table-column>
+      <el-table-column prop="offWorkResult" label="下班打卡状态" width="180">
+        <template slot-scope="{ row }">
+          <span v-if="row.offWorkStatus == '1' && row.offWorkResult == '0'">
+            {{ row.offWorkResultN }}
+          </span>
+          <span
+            v-if="
+              row.offWorkStatus == '1' &&
+              (row.offWorkResult == '2' || row.offWorkResult == '3')
+            "
+          >
+            {{ row.offWorkResultN }} {{ row.offLateLeaveMinuteN }}
+          </span>
+          <span v-else></span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        prop="absenteeismDays"
+        label="旷工天数"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="notSwipingNum"
+        label="未打卡次数"
+        width="180"
+      ></el-table-column>
+    </el-table>
+    <workScheduleAttendance-detail
+      v-if="showModal"
+      :businessKey="businessKey"
+      :title="modalTitle"
+      @close="onDetailModalClose"
+    ></workScheduleAttendance-detail>
   </div>
 </template>
 <script>
 import Constant from "@/constant";
 import workScheduleAttendanceApi from "@/api/business/workScheduleAttendance";
+import companyInfoApi from "@/api/base/companyInfo";
+import SelectTree from "@/components/SelectTree";
 import NProgress from "nprogress"; // progress bar
 import "nprogress/nprogress.css"; // progress bar style
 import pageUtil from "@/utils/page";
@@ -166,9 +223,17 @@ export default {
     var self = this;
 
     return {
+      ruleValidate: {
+        companyId: [{ required: true, message: "不能为空", trigger: "blur" }],
+        queryDate: [
+          { required: true, message: "请选择查询时间", trigger: "blur" },
+        ],
+      },
       queryModel: {
-        timeRanges: "",
-        personId: "",
+        companyId: "",
+        queryDate: "",
+        subordinate: false,
+        name: "",
       },
       loading: false,
       tableData: [],
@@ -183,89 +248,103 @@ export default {
       showModal: false,
       modalTitle: "",
       businessKey: "",
+      treeData: [],
+      props: {
+        // 配置项(必选)
+        value: "id",
+        label: "name",
+        children: "children",
+      },
+      companyResult: [],
       tableHeight: 400,
-      personInfo: "",
-      showMessage: "",
       timeRangesDefaultTime: [],
+      loadingText: "加载中",
+      xlsLoading: false,
     };
   },
+  created() {
+    var self = this;
+    companyInfoApi.treeList().then(function (response) {
+      var jsonData = response.data;
+      if (jsonData.result) {
+        if (jsonData.data != null && jsonData.data != "") {
+          self.companyResult = jsonData.data;
+        }
+      }
+    });
+  },
   methods: {
-    printReport() {
-      var title = this.personInfo.name + "考勤统计明细";
+    indexMethod(index) {
+      return (this.pageIndex - 1) * this.pageSize + (index + 1);
+    },
+    changePage(pageIndex) {
+      var self = this;
+      self.pageIndex = pageIndex;
 
-      var rows = JSON.parse(JSON.stringify(this.tableData));
+      var formData = new FormData();
 
-      rows.forEach(row=>{
-        //非上班状态并且未正常打卡,则显示当前工作状态
-        if(row.onWorkStatus != "1" &&
-           row.onWorkResult != "1" &&
-           row.onWorkStatus != null){
-           rows.shiftNumbers = row.onWorkStatusN;
-        }
-        
-        //非上班状态或者缺卡,则上班考勤时间不显示
-        if(row.onWorkStatus != "1" || row.onWorkResult == "0"){
-          row.onWorkRecordTime = "";
-        }
+      // formData.append("pageIndex", self.pageIndex);
+      // formData.append("pageSize", self.pageSize);
 
-        //如果是上班状态且上班缺卡
-        if(row.onWorkStatus == "1" && row.onWorkResult == "0"){
-          row.onWorkResult = row.onWorkResultN;
-        }
-        else if(row.onWorkStatus == "1" 
-            && (row.onWorkResult == "2" || row.onWorkResult == "3")
-        ){
-          //如果是上班状态但上班迟到或早退
-          row.onWorkResult = row.onWorkResultN + ' ' + row.onLateLeaveMinuteN;
-        }
-        else{
-          row.onWorkResult = "";
-        }
+      if (self.queryModel.companyId == null) {
+        self.queryModel.companyId = "";
+      }
 
-        //非上班状态或者缺卡,则下班考勤时间不显示
-        if(row.offWorkStatus != "1" || row.offWorkResult == "0"){
-          row.offWorkRecordTime = "";
-        }
+      formData.append("companyId", self.queryModel.companyId);
+      formData.append("subordinate", self.queryModel.subordinate);
 
-        //如果是上班状态且下班缺卡
-        if(row.offWorkStatus == "1" && row.offWorkResult == "0"){
-          row.offWorkResult = row.offWorkResultN;
-        }
-        else if(row.offWorkStatus == "1" 
-            && (row.offWorkResult == "2" || row.offWorkResult == "3")
-        ){
-          //如果是上班状态但下班迟到或早退
-          row.offWorkResult = row.offWorkResultN + ' ' + row.offLateLeaveMinuteN;
-        }
-        else{
-          row.offWorkResult = "";
-        }
-      });
+      formData.append("name", self.queryModel.name);
 
-      pageUtil.printTable(rows,
-      [
-        { field: 'attendanceDate', displayName: '日期'},
-        { field: 'shiftNumbers', displayName: '班次'},
-        { field: 'onWorkRecordTime', displayName: '上班打卡时间'},
-        { field: 'onWorkResult', displayName: '上班打卡状态'},
-        { field: 'offWorkRecordTime', displayName: '下班打卡时间'},
-        { field: 'offWorkResult', displayName: '下班打卡状态'},
-        { field: 'absenteeismDays', displayName: '旷工天数'},
-        { field: 'notSwipingNum', displayName: '未打卡次数'}
-      ],title);
-    },
-    changePage(pageIndex) {
-      var self = this;
+      formData.append("queryDate", self.queryModel.queryDate);
 
       self.loading = true;
+      self.loadingText = "加载中";
+      self.xlsLoading = true;
+
+      workScheduleAttendanceApi
+        .attendanceDay(formData)
+        .then(function (response) {
+          var jsonData = response.data;
+
+          self.loading = false;
+          self.xlsLoading = false;
+
+          if (jsonData.result) {
+            self.tableData = jsonData.data.wsaList;
 
+            //self.totalPages = jsonData.data.totalPages;
+            //self.totalElements = jsonData.data.recordsTotal;
+
+            //45为分页栏的高度
+            //页面高度-列表上面的高度-分页栏高度
+            self.tableHeight =
+              window.innerHeight - self.$refs.formTable.$el.offsetTop - 100;
+          } else {
+            self.$message({
+              type: "warning",
+              message: jsonData.message,
+            });
+          }
+        });
+    },
+
+    downloadAll() {
+      //导出
+      var self = this;
       var formData = new FormData();
+      if (self.queryModel.companyId == null) {
+        self.queryModel.companyId = "";
+      }
 
-      formData.append("personId", self.queryModel.personId);
+      formData.append("companyId", self.queryModel.companyId);
+      formData.append("subordinate", self.queryModel.subordinate);
+
+      formData.append("name", self.queryModel.name);
 
-      var timeRanges = self.queryModel.timeRanges + "";
       var startDate = "";
       var endDate = "";
+      var timeRanges = self.queryModel.timeRanges + "";
+
       if (timeRanges != "" && timeRanges != null) {
         timeRanges = timeRanges.split(",");
         startDate = timeRanges[0];
@@ -275,39 +354,28 @@ export default {
       formData.append("startMonth", startDate);
       formData.append("endMonth", endDate);
 
-      if (this.field != null) {
-        formData.append("field", this.field);
-      }
-
-      if (this.direction != null) {
-        formData.append("direction", this.direction);
-      }
-
-      workScheduleAttendanceApi
-        .pageList(formData)
-        .then(function (response) {
-          self.loading = false;
+      self.loading = true;
+      self.loadingText = "加载中";
 
-          var jsonData = response.data.data;
+      workScheduleAttendanceApi.exportXls(formData).then(function (response) {
+        self.loading = false;
+        var jsonData = response.data;
+        if (jsonData.result) {
+          if (jsonData.data != null) {
+            if (document.location.href.startsWith("https://")) {
+              jsonData.data = jsonData.data.replace("http://", "https://");
+            }
 
-          self.tableData = jsonData.wsaList;
-          self.personInfo = jsonData.personInfo;
-          let message = "查询结果 部门:" + self.personInfo.companyName;
-          let message2 = "      工号:" + self.personInfo.jobNumber;
-          let message3 = "      姓名:" + self.personInfo.name;
-          if (self.personInfo.jobNumber == null) {
-            self.showMessage = message + message3;
-          } else {
-            self.showMessage = message + message2 + message3;
+            self.$message({
+              showClose: true,
+              type: "success",
+              dangerouslyUseHTMLString: true,
+              message: `报表已生成,<a href="${jsonData.data}" target="_blank">点击下载报表</a>&nbsp;`,
+              duration: 30000,
+            });
           }
-
-          self.tableHeight =
-            window.innerHeight - self.$refs.formTable.$el.offsetTop - 100;
-        })
-        .catch((error) => {
-          self.loading = false;
-          // self.$message.error(error + "");
-        });
+        }
+      });
     },
     pageSizeChange(pageSize) {
       this.pageSize = pageSize;
@@ -328,6 +396,63 @@ export default {
     handleReset(name) {
       this.$refs[name].resetFields();
     },
+    handleAdd() {
+      this.modalTitle = "新增";
+      this.businessKey = "";
+      this.showModal = true;
+    },
+    handleDelete(record) {
+      var self = this;
+
+      self
+        .$confirm("是否确认删除?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then(() => {
+          workScheduleAttendanceApi.remove(record.id).then(function (response) {
+            var jsonData = response.data;
+
+            if (jsonData.result) {
+              // var index = self.tableData.indexOf(record);
+              // self.tableData.splice(index, 1);
+              self.changePage(self.pageIndex);
+
+              self.$message({
+                type: "success",
+                message: "删除成功!",
+              });
+            }
+          });
+        });
+    },
+    handleBatchDelete() {
+      var self = this;
+
+      var idList = this.multipleSelection.map((record) => {
+        return record.id;
+      });
+
+      this.$confirm("是否确认删除选中项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        workScheduleAttendanceApi.batchRemove(idList).then(function (response) {
+          var jsonData = response.data;
+
+          if (jsonData.result) {
+            self.changePage(self.pageIndex);
+
+            self.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+          }
+        });
+      });
+    },
     onDetailModalClose(refreshed) {
       //保存成功后回调
       this.showModal = false;
@@ -336,15 +461,63 @@ export default {
         this.changePage(this.pageIndex);
       }
     },
+    handleQuery() {
+      var self = this;
+      this.$refs["queryForm"].validate((valid) => {
+        if (valid) {
+          self.changePage(1);
+        }
+      });
+    },
+    printReport() {
+      var title = "考勤统计表";
+
+      var rows = JSON.parse(JSON.stringify(this.tableData));
+
+      var index = 0;
+
+      rows.forEach((row) => {
+        row.index = ++index;
+
+        if (row.personInfo.jobNumber == null) {
+          row.personInfo.jobNumber = "";
+        }
+
+        if (row.shiftNumbers == null) {
+          row.shiftNumbers = "";
+          row.onWorkRecordTime = "";
+          row.onWorkResultN = "";
+          row.offWorkRecordTime = "";
+          row.offWorkResultN = "";
+          row.absenteeismDays = "";
+          row.notSwipingNum = "";
+        }
+      });
+
+      pageUtil.printTable(
+        rows,
+        [
+          { field: "index", displayName: "序号" ,columnSize: "2%"},
+          { field: "personInfo.name", displayName: "姓名", columnSize: "8%" },
+          { field: "personInfo.companyName", displayName: "部门" ,columnSize: "8%" },
+          { field: "personInfo.jobNumber", displayName: "工号" },
+          { field: "shiftNumbers", displayName: "班次" },
+          { field: "onWorkRecordTime", displayName: "上班打卡时间", columnSize: "8%"},
+          { field: "onWorkResultN", displayName: "上班打卡状态" },
+          { field: "offWorkRecordTime", displayName: "下班打卡时间", columnSize: "8%" },
+          { field: "offWorkResultN", displayName: "下班打卡状态" },
+          { field: "absenteeismDays", displayName: "旷工天数" },
+          { field: "notSwipingNum", displayName: "未打卡次数" },
+        ],
+        title
+      );
+    },
   },
   mounted: function () {
-    var personId = this.$route.query.personId;
-    var timeRanges = this.$route.query.timeRanges;
-    this.queryModel.personId = personId;
-    let tims = timeRanges.split(",");
-    this.queryModel.timeRanges = [tims[0], tims[1]];
-
-    this.changePage();
+    //this.changePage(1);
+  },
+  components: {
+    "el-select-tree": SelectTree,
   },
 };
 </script>

+ 370 - 0
src/views/business/workScheduleAttendance-month-detail.vue

@@ -0,0 +1,370 @@
+<template>
+  <div>
+    <el-breadcrumb separator=">">
+      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="#">系统管理</a>
+      </el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="/workScheduleAttendance">考勤按月统计明细</a>
+      </el-breadcrumb-item>
+    </el-breadcrumb>
+    <el-divider></el-divider>
+    <!--
+      要resetFields起作用,必须配置:model和prop
+    -->
+    <el-form
+      ref="queryForm"
+      :model="queryModel"
+      inline
+      class="demo-form-inline"
+    >
+      <el-form-item label="统计区间" prop="timeRanges">
+        <el-date-picker
+          v-model="queryModel.timeRanges"
+          type="monthrange"
+          range-separator="至"
+          start-placeholder="开始月份"
+          end-placeholder="结束月份"
+          value-format="yyyy-MM"
+          :default-time="timeRangesDefaultTime"
+          size="mini"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          size="mini"
+          icon="ios-search"
+          @click="changePage(1)"
+          :loading="loading"
+          >查询</el-button
+        >&nbsp;
+        <el-button
+          type="info"
+          size="mini"
+          style="margin-left: 8px"
+          @click="handleReset('queryForm')"
+          >重置</el-button
+        >&nbsp;
+        <el-button
+        type="primary"
+        size="mini"
+        plain
+        icon="el-icon-printer"
+        @click="printReport"
+        >打印报表</el-button>
+      </el-form-item>
+    </el-form>
+    <el-divider></el-divider>
+    <el-row class="button-group">
+      <div v-html="showMessage"></div>
+    </el-row>
+    <section id="printContent">
+      <el-table
+        ref="formTable"
+        stripe
+        :data="tableData"
+        :height="tableHeight"
+        style="min-height: 400px"
+        v-loading="loading"
+        @sort-change="sortChange"
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column
+          prop="attendanceDate"
+          label="日期"
+          width="180"
+        ></el-table-column>
+        <el-table-column prop="shiftNumbers" label="班次" width="180">
+          <template slot-scope="{ row }">
+            <span
+              v-if="
+                row.onWorkStatus != '1' &&
+                row.onWorkStatus != '1' &&
+                row.onWorkStatus != null
+              "
+            >
+              {{ row.onWorkStatusN }}
+            </span>
+            <span v-else>
+              {{ row.shiftNumbers }}
+            </span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="onWorkRecordTime" label="上班打卡时间" width="180"
+          ><template slot-scope="{ row }">
+            <span v-if="row.onWorkStatus == '1' && row.onWorkResult != '0'">
+              {{ row.onWorkRecordTime }}
+            </span>
+            <span v-else></span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="onWorkResult" label="上班打卡状态" width="180">
+          <template slot-scope="{ row }">
+            <span v-if="row.onWorkStatus == '1' && row.onWorkResult == '0'">
+              {{ row.onWorkResultN }}
+            </span>
+            <span
+              v-else-if="
+                row.onWorkStatus == '1' &&
+                (row.onWorkResult =='2' || row.onWorkResult =='3')
+              "
+            >
+              {{ row.onWorkResultN }} {{ row.onLateLeaveMinuteN }}
+            </span>
+            <span v-else></span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="offWorkRecordTime" label="下班打卡时间" width="180"
+          ><template slot-scope="{ row }">
+            <span v-if="row.offWorkStatus == '1' && row.offWorkResult != '0'">
+              {{ row.offWorkRecordTime }}</span
+            >
+            <span v-else> </span> </template
+        ></el-table-column>
+        <el-table-column prop="offWorkResult" label="下班打卡状态" width="180">
+          <template slot-scope="{ row }">
+            <span v-if="row.offWorkStatus == '1' && row.offWorkResult == '0'">
+              {{ row.offWorkResultN }}
+            </span>
+            <span
+              v-if="
+                row.offWorkStatus == '1' &&
+                (row.offWorkResult == '2' || row.offWorkResult == '3')
+              "
+            >
+              {{ row.offWorkResultN }} {{ row.offLateLeaveMinuteN }}
+            </span>
+            <span v-else></span>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="absenteeismDays"
+          label="旷工天数"
+          width="180"
+        ></el-table-column>
+        <el-table-column
+          prop="notSwipingNum"
+          label="未打卡次数"
+          width="180"
+        ></el-table-column>
+      </el-table>
+    </section>
+  </div>
+</template>
+<script>
+import Constant from "@/constant";
+import workScheduleAttendanceApi from "@/api/business/workScheduleAttendance";
+import NProgress from "nprogress"; // progress bar
+import "nprogress/nprogress.css"; // progress bar style
+import pageUtil from "@/utils/page";
+
+export default {
+  name: "BusinessWorkScheduleAttendanceMonthDetail",
+  data() {
+    var self = this;
+
+    return {
+      queryModel: {
+        timeRanges: "",
+        personId: "",
+      },
+      loading: false,
+      tableData: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPages: 0,
+      totalElements: 0,
+      field: "",
+      direction: "",
+      pageSizeList: [10, 20, 30],
+      multipleSelection: [],
+      showModal: false,
+      modalTitle: "",
+      businessKey: "",
+      tableHeight: 400,
+      personInfo: "",
+      showMessage: "",
+      timeRangesDefaultTime: [],
+    };
+  },
+  methods: {
+    printReport() {
+      var title = this.personInfo.name + "考勤统计明细";
+
+      var rows = JSON.parse(JSON.stringify(this.tableData));
+
+      rows.forEach(row=>{
+        //非上班状态并且未正常打卡,则显示当前工作状态
+        if(row.onWorkStatus != "1" &&
+           row.onWorkResult != "1" &&
+           row.onWorkStatus != null){
+           rows.shiftNumbers = row.onWorkStatusN;
+        }
+        
+        //非上班状态或者缺卡,则上班考勤时间不显示
+        if(row.onWorkStatus != "1" || row.onWorkResult == "0"){
+          row.onWorkRecordTime = "";
+        }
+
+        //如果是上班状态且上班缺卡
+        if(row.onWorkStatus == "1" && row.onWorkResult == "0"){
+          row.onWorkResult = row.onWorkResultN;
+        }
+        else if(row.onWorkStatus == "1" 
+            && (row.onWorkResult == "2" || row.onWorkResult == "3")
+        ){
+          //如果是上班状态但上班迟到或早退
+          row.onWorkResult = row.onWorkResultN + ' ' + row.onLateLeaveMinuteN;
+        }
+        else{
+          row.onWorkResult = "";
+        }
+
+        //非上班状态或者缺卡,则下班考勤时间不显示
+        if(row.offWorkStatus != "1" || row.offWorkResult == "0"){
+          row.offWorkRecordTime = "";
+        }
+
+        //如果是上班状态且下班缺卡
+        if(row.offWorkStatus == "1" && row.offWorkResult == "0"){
+          row.offWorkResult = row.offWorkResultN;
+        }
+        else if(row.offWorkStatus == "1" 
+            && (row.offWorkResult == "2" || row.offWorkResult == "3")
+        ){
+          //如果是上班状态但下班迟到或早退
+          row.offWorkResult = row.offWorkResultN + ' ' + row.offLateLeaveMinuteN;
+        }
+        else{
+          row.offWorkResult = "";
+        }
+      });
+
+      pageUtil.printTable(rows,
+      [
+        { field: 'attendanceDate', displayName: '日期'},
+        { field: 'shiftNumbers', displayName: '班次'},
+        { field: 'onWorkRecordTime', displayName: '上班打卡时间'},
+        { field: 'onWorkResult', displayName: '上班打卡状态'},
+        { field: 'offWorkRecordTime', displayName: '下班打卡时间'},
+        { field: 'offWorkResult', displayName: '下班打卡状态'},
+        { field: 'absenteeismDays', displayName: '旷工天数'},
+        { field: 'notSwipingNum', displayName: '未打卡次数'}
+      ],title);
+    },
+    changePage(pageIndex) {
+      var self = this;
+
+      self.loading = true;
+
+      var formData = new FormData();
+
+      formData.append("personId", self.queryModel.personId);
+
+      var timeRanges = self.queryModel.timeRanges + "";
+      var startDate = "";
+      var endDate = "";
+      if (timeRanges != "" && timeRanges != null) {
+        timeRanges = timeRanges.split(",");
+        startDate = timeRanges[0];
+        endDate = timeRanges[1];
+      }
+
+      formData.append("startMonth", startDate);
+      formData.append("endMonth", endDate);
+
+      if (this.field != null) {
+        formData.append("field", this.field);
+      }
+
+      if (this.direction != null) {
+        formData.append("direction", this.direction);
+      }
+
+      workScheduleAttendanceApi
+        .attendanceMonthDetail(formData)
+        .then(function (response) {
+          self.loading = false;
+
+          var jsonData = response.data.data;
+
+          self.tableData = jsonData.wsaList;
+          self.personInfo = jsonData.personInfo;
+          let message = "查询结果 部门:" + self.personInfo.companyName;
+          let message2 = "      工号:" + self.personInfo.jobNumber;
+          let message3 = "      姓名:" + self.personInfo.name;
+          if (self.personInfo.jobNumber == null) {
+            self.showMessage = message + message3;
+          } else {
+            self.showMessage = message + message2 + message3;
+          }
+
+          self.tableHeight =
+            window.innerHeight - self.$refs.formTable.$el.offsetTop - 100;
+        })
+        .catch((error) => {
+          self.loading = false;
+          // self.$message.error(error + "");
+        });
+    },
+    pageSizeChange(pageSize) {
+      this.pageSize = pageSize;
+
+      this.$nextTick(() => {
+        this.changePage(this.pageIndex);
+      });
+    },
+    sortChange(data) {
+      this.field = data.column.field;
+      this.direction = data.order;
+
+      this.changePage(this.pageIndex);
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    handleReset(name) {
+      this.$refs[name].resetFields();
+    },
+    onDetailModalClose(refreshed) {
+      //保存成功后回调
+      this.showModal = false;
+
+      if (refreshed) {
+        this.changePage(this.pageIndex);
+      }
+    },
+  },
+  mounted: function () {
+    var personId = this.$route.query.personId;
+    var timeRanges = this.$route.query.timeRanges;
+    this.queryModel.personId = personId;
+    let tims = timeRanges.split(",");
+    this.queryModel.timeRanges = [tims[0], tims[1]];
+
+    this.changePage();
+  },
+};
+</script>
+<style lang="scss" scoped>
+.el-breadcrumb {
+  margin: 10px;
+  line-height: 20px;
+}
+
+.el-divider {
+  margin: 5px 0;
+}
+
+.demo-form-inline {
+  margin-left: 10px;
+  text-align: left;
+}
+
+.button-group {
+  margin-left: 10px;
+  text-align: left;
+}
+</style>

+ 10 - 7
src/views/business/workScheduleAttendance-list.vue → src/views/business/workScheduleAttendance-month-list.vue

@@ -6,7 +6,7 @@
         <a href="#">系统管理</a>
       </el-breadcrumb-item>
       <el-breadcrumb-item>
-        <a href="/workScheduleAttendance">考勤统计</a>
+        <a href="/workScheduleAttendance">考勤按月统计</a>
       </el-breadcrumb-item>
     </el-breadcrumb>
     <el-divider></el-divider>
@@ -219,7 +219,7 @@ import "nprogress/nprogress.css"; // progress bar style
 import pageUtil from "@/utils/page";
 
 export default {
-  name: "BusinessWorkScheduleAttendanceList",
+  name: "BusinessWorkScheduleAttendanceMonthList",
   data() {
     var self = this;
 
@@ -227,7 +227,7 @@ export default {
       ruleValidate: {
         companyId: [{ required: true, message: "不能为空", trigger: "blur" }],
         timeRanges: [
-          { required: true, message: "请选择事件范围", trigger: "blur" },
+          { required: true, message: "请选择时间范围", trigger: "blur" },
         ],
       },
       queryModel: {
@@ -260,6 +260,7 @@ export default {
       tableHeight: 400,
       timeRangesDefaultTime: [],
       loadingText: "加载中",
+      xlsLoading:false,
     };
   },
   created() {
@@ -311,7 +312,7 @@ export default {
       self.loading = true;
       self.loadingText = "加载中";
 
-      workScheduleAttendanceApi.personWorkList(formData).then(function (response) {
+      workScheduleAttendanceApi.attendanceMonth(formData).then(function (response) {
         var jsonData = response.data;
 
         self.loading = false;
@@ -362,10 +363,12 @@ export default {
       formData.append("endMonth", endDate);
 
       self.loading = true;
+      self.xlsLoading = true;
       self.loadingText = "加载中";
 
-      workScheduleAttendanceApi.exportXls(formData).then(function (response) {
+      workScheduleAttendanceApi.exportMonthXls(formData).then(function (response) {
         self.loading = false;
+        self.xlsLoading = false;
         var jsonData = response.data;
         if (jsonData.result) {
           if (jsonData.data != null) {
@@ -478,11 +481,11 @@ export default {
     },
     
     handleOpen(record) {
-      var path = "/business/workScheduleAttendance/dayList";
+      var path = "/business/workScheduleAttendance/monthDetail";
 
       this.$store
         .dispatch("tagsView/delView", {
-          name: "BusinessWorkScheduleAttendanceDayList",
+          name: "BusinessWorkScheduleAttendanceMonthDetail",
           path: path,
         })
         .then(({ visitedViews }) => {

+ 5 - 0
yarn.lock

@@ -6676,6 +6676,11 @@ pretty-error@^2.0.2:
     renderkid "^2.0.1"
     utila "~0.4"
 
+print-js@^1.6.0:
+  version "1.6.0"
+  resolved "https://registry.yarnpkg.com/print-js/-/print-js-1.6.0.tgz#692b046cf31992b46afa6c6d8a9db1c69d431d1f"
+  integrity sha512-BfnOIzSKbqGRtO4o0rnj/K3681BSd2QUrsIZy/+WdCIugjIswjmx3lDEZpXB2ruGf9d4b3YNINri81+J0FsBWg==
+
 private@^0.1.6:
   version "0.1.8"
   resolved "https://registry.npm.taobao.org/private/download/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"