From 2fca78b4607264e13a11f0deb84c34c9ac9489cc Mon Sep 17 00:00:00 2001
From: yao-zengchun <yao-zengchun@smhc.co.jp>
Date: Fri, 23 May 2025 08:44:59 +0000
Subject: [PATCH] Merge branch 'wcd-2411-update' of http://192.168.1.110:5678/r/pms-upgrade into wcd

---
 eladmin-web-master/src/views/task/taskDaliy/index.vue |  126 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 121 insertions(+), 5 deletions(-)

diff --git a/eladmin-web-master/src/views/task/taskDaliy/index.vue b/eladmin-web-master/src/views/task/taskDaliy/index.vue
index 72f023a..d642071 100644
--- a/eladmin-web-master/src/views/task/taskDaliy/index.vue
+++ b/eladmin-web-master/src/views/task/taskDaliy/index.vue
@@ -153,6 +153,17 @@
         >
           统计
         </el-button>
+        <el-button
+          slot="right"
+          class="filter-item"
+          size="mini"
+          type="primary"
+          icon="el-icon-document"
+          style="margin-left: 4px !important;"
+          @click="toGenerateReport"
+        >
+          报告生成
+        </el-button>
       </crudOperation>
       <!--表单组件-->
       <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
@@ -305,6 +316,50 @@
           </el-table-column>
         </el-table>
       </el-dialog>
+
+      <!--报告生成表单组件-->
+      <el-dialog :close-on-click-modal="false" :before-close="closeGenerateReport" :visible.sync="generateReportParam.visible" title="报告生成" width="580px">
+        <el-form ref="reportForm" :model="generateReportParam.form" :rules="generateReportParam.rules" size="small" label-width="110px">
+          <el-form-item label="考勤日期" prop="attendTime">
+            <!-- <el-date-picker
+              v-model="generateReportParam.form.attendTime"
+              type="date"
+              placeholder="选择日期"
+              style="width: 370px;"
+              value-format="yyyy-MM-dd"
+              align="right"
+            /> -->
+            <el-date-picker
+              v-model="generateReportParam.form.attendTime"
+              type="daterange"
+              clearable
+              class="filter-item"
+              value-format="yyyy-MM-dd"
+              placeholder="请选择日期"
+              range-separator=" ~ "
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              style="width: 370px;"
+            />
+          </el-form-item>
+
+          <el-form-item label="所属员工" prop="userId">
+            <el-select v-model="generateReportParam.form.userId" filterable clearable placeholder="请选择" style="width: 370px;">
+              <el-option
+                v-for="item in users"
+                :key="item.id"
+                :label="item.nickName"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+          <div class="tips-content">*选择员工则生成选中员工的考勤报告,未选择员工则更新所有员工(暂为开发部所有员工)的考勤报告</div>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="text" @click="closeGenerateReport">取消</el-button>
+          <el-button :loading="generateReportParam.loading" type="primary" @click="doGenerateReport">确认</el-button>
+        </div>
+      </el-dialog>
       <!--表格渲染-->
       <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
         <el-table-column type="selection" width="55" />
@@ -347,7 +402,7 @@
         <el-table-column prop="remarks" label="备注" min-width="140px" />
         <el-table-column v-if="checkPer(['admin','taskDaliy:add','taskDaliy:edit','taskDaliy:del'])" label="操作" width="180px" align="center" fixed="right">
           <template slot-scope="scope">
-            <udOperation :data="scope.row" :permission="permission" >
+            <udOperation :data="scope.row" :permission="permission">
               <el-button
                 slot="left"
                 v-permission="permission.add"
@@ -405,6 +460,7 @@
 import crudTask from '@/api/task/task'
 import crudTaskUser from '@/api/task/taskUser'
 import crudAttendance from '@/api/attendance/attendance'
+import crudUser from '@/api/system/user'
 
 const defaultForm = { id: null, projectId: null, taskId: null, taskName: null, taskMongoId: null, taskUserMongo: {}, userId: null, fillDate: null, consumedHours: null, todayFixedHours: 0, todayAttendanceHours: 0, alreadyConsumedHours: 0, taskHours: 0, consumedWorkload: null, consumedWorkloadUnit: null, taskProgress: null, settlementStatus: constant.SETTLEMENT_STATUS_UNSETTLED, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
 export default {
@@ -439,7 +495,8 @@
         add: ['admin', 'taskDaliy:add'],
         edit: ['admin', 'taskDaliy:edit'],
         del: ['admin', 'taskDaliy:del'],
-        download: ['admin', 'taskDaliy:download']
+        download: ['admin', 'taskDaliy:download'],
+        report: ['admin', 'taskDaliy:report']
       },
       rules: {
         fillDate: [
@@ -539,7 +596,19 @@
       loadingQueryProjects: false,
       loadingQueryProjectsTwo: false,
       statisticsLoading: false,
-      statisticsData: []
+      statisticsData: [],
+      // 报告生成参数
+      generateReportParam: {
+        loading: false,
+        visible: false,
+        form: {
+          attendTime: [],
+          userId: null
+        },
+        rules: {
+          attendTime: [{ required: true, message: '考勤日期不能为空', trigger: 'change' }]
+        }
+      }
     }
   },
   computed: {
@@ -572,6 +641,12 @@
     'crud.status.edit': function() {
       this.editVar = this.form.consumedHours
     }
+  },
+  created() {
+    const that = this
+    crudUser.getAll().then(res => {
+      that.users = res
+    })
   },
   methods: {
     // 钩子:在获取表格数据之前执行,false 则代表不获取数据
@@ -761,7 +836,7 @@
           this.centerDialogVisibleTaskProgress = true
           if (this.confirmProgress) {
             // 如果确定了
-            const result = this.form.alreadyConsumedHours
+            // const result = this.form.alreadyConsumedHours
             // if (result > this.form.taskHours && !this.confirmHours) {
             //   this.centerDialogVisibleTaskHours = true
             //   if (this.confirmHours) {
@@ -979,7 +1054,7 @@
         // 判断是否为选中任务
         if (this.formTasks[i].id === this.form.taskId) {
           crudTask.getRelevantTaskUser({ 'taskId': this.form.taskId }).then(res => {
-            if (res == []) {
+            if (res === []) {
               this.formTaskUserIds = []
               return
             }
@@ -1054,6 +1129,41 @@
     submitDialogTaskProgress() {
       this.centerDialogVisibleTaskProgress = false
       this.confirmProgress = true
+    },
+    // 开启报告生成
+    toGenerateReport() {
+      const that = this
+      that.generateReportParam.visible = true
+    },
+    // 执行报告生成
+    doGenerateReport() {
+      const that = this
+      that.$refs.reportForm.validate((valid) => {
+        if (!valid) {
+          return
+        }
+        // 制作数据
+        const data = {
+          fillDates: that.generateReportParam.form.attendTime,
+          userId: that.generateReportParam.form.userId
+        }
+        that.$set(that.generateReportParam, 'loading', true)
+        // 生成报告
+        that.crud.crudMethod.generateReport(data).then(() => {
+          that.$message({ type: 'success', message: '操作成功' })
+          that.closeGenerateReport()
+        }).catch(() => {
+          that.$set(that.generateReportParam, 'loading', false)
+        })
+      })
+    },
+    // 关闭报告生成
+    closeGenerateReport() {
+      const that = this
+      that.$refs.reportForm.clearValidate()
+      that.$set(that.generateReportParam, 'loading', false)
+      that.$set(that.generateReportParam, 'visible', false)
+      that.$set(that.generateReportParam, 'form', { attendTime: [], userId: null })
     }
   }
 }
@@ -1063,4 +1173,10 @@
   adventTable tr:first-child {
     display: none;
   }
+  .tips-content {
+    font-size: 12px;
+    text-align: center;
+    color: red;
+    padding: 0px 40px;
+  }
 </style>

--
Gitblit v1.9.3