From 819d40eb1bec7acb2b3adaa4a9a3f8d8eeca1dcc Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 24 十二月 2025 17:26:06 +0800
Subject: [PATCH] 上报

---
 src/views/workbench.vue |  384 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 333 insertions(+), 51 deletions(-)

diff --git a/src/views/workbench.vue b/src/views/workbench.vue
index 1d02a08..cd36e6f 100644
--- a/src/views/workbench.vue
+++ b/src/views/workbench.vue
@@ -19,6 +19,15 @@
           <span class="stat-number">{{ totalActiveTasks }}</span>
           <span class="stat-label">浠婃棩澶勭悊</span>
         </div>
+        <div style="display: flex;align-items: center">
+          <el-button size="mini" @click="handleAddReport()"
+                     class="report-btn"
+                     icon="el-icon-upload2">涓婃姤</el-button>
+          <el-button size="mini" @click="handleViewReport()"
+                     class="report-btn"
+                     icon="el-icon-view">鏌ョ湅涓婃姤</el-button>
+        </div>
+
       </div>
       <div class="user-profile">
 <!--        <el-dropdown>-->
@@ -123,6 +132,17 @@
                 </template>
               </el-table-column>
             </el-table>
+          </div>
+
+          <div class="pagination-container">
+            <el-pagination
+              @current-change="handleCurrentChange"
+              :current-page="waitTaskQuery.currentPage"
+              :page-size="waitTaskQuery.pageSize"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="waitTaskTotal"
+            >
+            </el-pagination>
           </div>
 
         </div>
@@ -233,16 +253,7 @@
               </el-table-column>
             </el-table>
           </div>
-          <div class="pagination-container">
-            <el-pagination
-              @current-change="handleCurrentChange"
-              :current-page="waitTaskQuery.currentPage"
-              :page-size="waitTaskQuery.pageSize"
-              layout="total, sizes, prev, pager, next, jumper"
-              :total="waitTaskTotal"
-            >
-            </el-pagination>
-          </div>
+
         </div>
       </div>
     </div>
@@ -300,6 +311,107 @@
         <el-button type="primary" @click="submitSaveSchedule">纭畾</el-button>
       </template>
     </el-dialog>
+    <el-dialog
+      :title="reportTitle"
+      :visible.sync="reportDialogVisible"
+      width="600px"
+      @close="resetReportForm"
+    >
+      <el-form
+        ref="reportFormRef"
+        :model="reportForm"
+        :rules="reportRules"
+        label-width="90px"
+      >
+        <el-form-item label="閫夋嫨椤圭洰" prop="projectId">
+          <el-select
+            v-model="reportForm.projectId"
+            clearable
+            placeholder="閫夋嫨椤圭洰"
+            style="width: 100%"
+          >
+            <el-option
+              v-for="project in allProjects"
+              :key="project.id"
+              :label="project.name"
+              :value="project.id"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="涓婃姤鍐呭" prop="content">
+          <el-input
+            v-model="reportForm.content"
+            type="textarea"
+            placeholder="璇疯緭鍏ヤ笂鎶ュ唴瀹�"
+            rows="4"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="涓婁紶闄勪欢">
+          <FileUpload v-model="reportForm.fileUrl" :isShowTip="true" />
+        </el-form-item>
+      </el-form>
+      <template v-slot:footer>
+        <el-button @click="reportDialogVisible = false">鍙栨秷</el-button>
+        <el-button type="primary" @click="submitReport">纭畾</el-button>
+      </template>
+    </el-dialog>
+    <el-dialog
+      title="涓婃姤璁板綍"
+      :visible.sync="reportListDialogVisible"
+      width="700px"
+    >
+      <div class="calendar-section">
+        <el-calendar v-model="reportCalendarDate">
+          <template
+            slot="dateCell"
+            slot-scope="{date, data}">
+            <div class="calendar-day">
+              {{ data.day.split('-').slice(2).join('-') }}
+              <div v-if="getReportCount(date) > 0" class="schedule-count">
+                {{ getReportCount(date) }}涓笂鎶�
+              </div>
+            </div>
+          </template>
+        </el-calendar>
+      </div>
+      <div class="schedule-list-section">
+        <div class="section-header">
+          <h3>涓婃姤鍒楄〃</h3>
+          <div>
+            <el-button type="text" icon="el-icon-refresh" @click="getReportList" :disabled="reportRefreshing">鍒锋柊</el-button>
+          </div>
+        </div>
+        <div class="schedule-list">
+          <el-table
+            v-loading="reportLoading"
+            :data="filteredReport"
+            style="width: 100%"
+            height="250">
+            <el-table-column
+              prop="time"
+              label="鏃堕棿"
+             >
+            </el-table-column>
+            <el-table-column
+              prop="title"
+              label="浜嬮」"
+             >
+            </el-table-column>
+            <el-table-column
+              label="鎿嶄綔">
+              <template slot-scope="scope">
+                <el-button size="mini" @click="handleEditReport(scope.row)">鏌ョ湅</el-button>
+                <el-button size="mini" @click="handleReturn(scope.row)" :disabled="scope.row.status !== 'PendingReview'">鎾ゅ洖</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+
+      </div>
+      <template v-slot:footer>
+        <el-button @click="reportListDialogVisible = false">鍏� 闂�</el-button>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -315,17 +427,27 @@
   del,
   countTodayTask,
 } from "@/api/workbench/workbench"
+
 import {getTaskIsAuditing} from "@/api/projectProcess/projectProcess";
 import {getProjectSelectList} from "@/api/index";
+import {addReport, reportByDate,delReport} from "@/api/report/report";
+import { formatDateToFrontend,formatDate,formatCalendarDate,getDayStartAndEnd } from "@/utils/date.js"
 export default {
 
   data() {
     return {
-
-
       diaLogTitle:"",
+      reportTitle:"",
       allProjects:[],
+
       scheduleDialogVisible: false,
+      reportLoading:false,
+
+      reportCurrentPageNum:1,
+      reportPageSize:5,
+      reportTotal:5,
+      reportDialogVisible: false,
+      reportListDialogVisible: false,
       // 鏂板锛氭柊澧炴棩绋嬭〃鍗曟暟鎹紙瀵瑰簲WorkStationSchedule瀹炰綋锛�
       scheduleForm: {
         id:'',
@@ -333,6 +455,12 @@
         completedTime: '',
         projectId:''
 
+      },
+      reportForm: {
+        id:'',
+        projectId: '',
+        content: '',
+        fileUrl: []
       },
       // 鏂板锛氳〃鍗曟牎楠岃鍒�
       scheduleRules: {
@@ -347,6 +475,15 @@
           {required:true,message: '璇烽�夋嫨椤圭洰', trigger: 'change'}
         ]
       },
+      reportRules: {
+        projectId: [
+          { required: true, message: '璇烽�夋嫨椤圭洰', trigger: 'change' }
+        ],
+        content: [
+          { required: true, message: '璇疯緭鍏ヤ笂鎶ュ唴瀹�', trigger: 'blur' },
+          { max: 500, message: '涓婃姤鍐呭鏈�澶�500涓瓧绗�', trigger: 'blur' }
+        ]
+      },
       queryParams: {
         taskName: '',
         taskType: 'todo',
@@ -359,6 +496,7 @@
         processName: '' // 娴佺▼鍚嶇О
       },
       waitTaskRefreshing:false,
+      reportRefreshing:false,
       scheduleRefreshing:false,
       auditHistoryRefreshing:false,
       loading:false,
@@ -381,20 +519,14 @@
         avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
         department: '椤圭洰閮�'
       },
-      currentDate: this.formatDate(new Date()),
+      currentDate: formatDate(new Date()),
       todayTasks: 0,
       todaySchedules: 0,
       totalActiveTasks: 0,
       activeProject: 'all',
       projects: [],
       tasks: [],
-      logs: [
-        { id: 1, time: '09:30', project: '灏勬椽甯傚浗瀹跺偍澶囨灄寤鸿椤圭洰锛堜竴鏈燂級', action: '鎻愪氦', detail: '鎻愪氦浜嗘柦宸ュ浘绾稿鏍哥敵璇�' },
-        { id: 2, time: '10:15', project: '灏勬椽甯傜櫧缇借倝楦′骇涓氬缓璁鹃」鐩�', action: '鏇存柊', detail: '鏇存柊浜嗘潗鏂欓噰璐竻鍗�' },
-        { id: 3, time: '11:00', project: '閬傚畞甯傚皠娲�2024鈥�2027骞村害涓滃寳鐗囧尯楂樻爣鍑嗗啘鐢板缓璁鹃」鐩�', action: '瀹屾垚', detail: '瀹屾垚浜嗙數鍔涜澶囨祴璇�' },
-        { id: 4, time: '14:30', project: '灏勬椽甯傜幇浠g涓氱ず鑼冨熀鍦板缓璁鹃」鐩�', action: '鍒涘缓', detail: '鍒涘缓浜嗘柊鐨勫畨瑁呰鍒�' },
-        { id: 5, time: '16:45', project: '灏勬椽甯傛脖鐗岄晣缁煎悎姘村埄璁炬柦寤鸿椤圭洰', action: '瀹℃壒', detail: '瀹℃壒閫氳繃浜嗗畨鍏ㄦ柟妗�' }
-      ],
+      logs: [],//鏃ュ織鏁版嵁瀵硅薄
       achievements: {
         completedTasks: 0,
         avgDuration: 0,
@@ -402,13 +534,50 @@
         completedSchedules: 0
       },
       calendarDate: new Date(),
-      schedules: []
+      lastCalendarDate:new Date(),
+      reportCalendarDate: new Date(),
+      lastReportCalendarDate: new Date(),
+      schedules: [],
+      reports:[]
     }
   },
+  watch:{
+    calendarDate(newDate, oldDate) {
+      // 鎺掗櫎銆岀偣鍑绘棩鏈熷崟鍏冩牸銆嶅鑷寸殑鍙樺寲锛堜粎鏃ユ湡鍙橈紝鏈堜唤/骞翠唤涓嶅彉锛�
+      const isOnlyDayChange =
+        newDate.getFullYear() === oldDate.getFullYear() &&
+        newDate.getMonth() === oldDate.getMonth() &&
+        newDate.getDate() !== oldDate.getDate();
+
+      if (!isOnlyDayChange) {
+        // 瑙﹀彂鎸夐挳鐐瑰嚮閫昏緫锛堜笂鏈�/涓嬫湀/浠婃棩锛�
+        this.getScheduleList();
+        this.lastCalendarDate = new Date(newDate); // 鏇存柊璁板綍鐨勬棩鏈�
+      }
+    },
+    reportCalendarDate(newDate, oldDate) {
+      // 鎺掗櫎銆岀偣鍑绘棩鏈熷崟鍏冩牸銆嶅鑷寸殑鍙樺寲锛堜粎鏃ユ湡鍙橈紝鏈堜唤/骞翠唤涓嶅彉锛�
+      const isOnlyDayChange =
+        newDate.getFullYear() === oldDate.getFullYear() &&
+        newDate.getMonth() === oldDate.getMonth() &&
+        newDate.getDate() !== oldDate.getDate();
+
+      if (!isOnlyDayChange) {
+        // 瑙﹀彂鎸夐挳鐐瑰嚮閫昏緫锛堜笂鏈�/涓嬫湀/浠婃棩锛�
+        this.getReportList();
+        this.lastReportCalendarDate = new Date(newDate); // 鏇存柊璁板綍鐨勬棩鏈�
+      }
+    },
+  },
   computed: {
+    // 璁$畻鑾峰緱鎸囧畾鏃ユ湡鏁版嵁
     filteredSchedules() {
-      const selectedDate = this.formatCalendarDate(this.calendarDate);
+      const selectedDate = formatCalendarDate(this.calendarDate);
       return this.schedules.filter(schedule => schedule.date === selectedDate);
+    },
+    filteredReport(){
+      const selectDate = formatCalendarDate(this.reportCalendarDate);
+      return this.reports.filter(report => report.date === selectDate);
     }
   },
   mounted() {
@@ -419,6 +588,33 @@
     this.getAuditHistoryPage();
   },
   methods: {
+    handleReturn(row){
+      delReport(row.id).then(res =>{
+        if (res.code === 200){
+          this.getReportList()
+        }
+      })
+    },
+    handleAddReport(){
+      this.reportTitle="鎻愪氦涓婃姤";
+      this.resetReportForm();
+      this.reportDialogVisible = true;
+    },
+    handleEditReport(row){
+      this.reportTitle="缂栬緫涓婃姤";
+      this.resetReportForm();
+      this.reportDialogVisible = true;
+
+      this.reportForm.id = row.id;
+      this.reportForm.projectId = row.projectId + ""; //鍏堣浆涓哄瓧绗︿覆绫诲瀷 鎻愪氦鐨勬椂鍊欒浆涓烘暟瀛�
+      this.reportForm.content = row.title;
+      this.reportForm.fileUrl = row.fileUrl;
+    },
+
+    handleViewReport(){
+      this.getReportList();
+      this.reportListDialogVisible = true;
+    },
     getAuditTypeText(auditType) {
       // 鏄犲皠鍏崇郴锛氬悗绔�� 鈫� 鍓嶇姹夊瓧
       const typeMap = {
@@ -439,6 +635,7 @@
         }
       })
     },
+    // 鑾峰緱涓嬫媺椤圭洰鏁版嵁
     initSelect(){
       getProjectSelectList().then(res =>{
         if (res.code === 200){
@@ -449,12 +646,34 @@
         }
       })
     },
+    // 鑾峰緱涓婃姤鍒楄〃鏁版嵁
+    getReportList(){
+      if (this.reportRefreshing){
+        return
+      }
+      const form ={
+        startTime: getDayStartAndEnd(this.reportCalendarDate).startTime,
+        endTime: getDayStartAndEnd(this.reportCalendarDate).endTime,
+        projectId:this.activeProject
+      }
+      this.reportLoading = true;
+      this.reportRefreshing = true;
+      // 鍚庣鎺ュ彛鑾峰緱鏁版嵁
+      reportByDate(form).then(res =>{
+        this.reportRefreshing = false;
+        this.reportLoading = false;
+        if (res.code === 200){
+          this.reports = res.data;
+        }
+      })
+    },
+    // 鑾峰緱鏃ョ▼鍒楄〃鏁版嵁
     getScheduleList(){
       if (this.scheduleRefreshing){
         return
       }
       const form ={
-        completedTime:this.formatDateToFrontend(this.calendarDate),
+        completedTime:formatDateToFrontend(this.calendarDate),
         projectId:this.activeProject
       }
       this.scheduleLoading = true
@@ -467,17 +686,7 @@
         }
       })
     },
-    formatDateToFrontend(date) {
-      if (!date) return '';
-      const d = new Date(date);
-      const year = d.getFullYear();
-      const month = (d.getMonth() + 1).toString().padStart(2, '0');
-      const day = d.getDate().toString().padStart(2, '0');
-      const hour = d.getHours().toString().padStart(2, '0');
-      const minute = d.getMinutes().toString().padStart(2, '0');
-      const second = d.getSeconds().toString().padStart(2, '0');
-      return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
-    },
+
     async submitSaveSchedule(){
       this.$refs.scheduleFormRef.validate((valid, fields) => {
         if (valid) {
@@ -485,7 +694,7 @@
           if (this.scheduleForm.id === null || this.scheduleForm.id ==='' || this.scheduleForm.id === undefined){
             const submitData = {
               content: this.scheduleForm.content,
-              completedTime: this.formatDateToFrontend(this.scheduleForm.completedTime),
+              completedTime: formatDateToFrontend(this.scheduleForm.completedTime),
               projectId:this.scheduleForm.projectId
             };
             this.$message.success('琛ㄥ崟鎻愪氦鎴愬姛锛�');
@@ -501,7 +710,7 @@
             const submitData = {
               id:this.scheduleForm.id,
               content: this.scheduleForm.content,
-              completedTime: this.formatDateToFrontend(this.scheduleForm.completedTime),
+              completedTime: formatDateToFrontend(this.scheduleForm.completedTime),
               projectId:this.scheduleForm.projectId
             };
             this.$message.success('琛ㄥ崟鎻愪氦鎴愬姛锛�');
@@ -551,6 +760,46 @@
         this.$refs.scheduleFormRef.resetFields();
       }
     },
+    resetReportForm() {
+      this.reportForm = {
+        projectId: '',
+        content: '',
+        fileUrl: []
+      };
+      if (this.$refs.reportFormRef) {
+        this.$refs.reportFormRef.resetFields();
+      }
+    },
+    submitReport() {
+
+      this.$refs.reportFormRef.validate(valid => {
+        if (valid) {
+          const matchItem = this.allProjects.find(item => item.id === this.reportForm.projectId);
+          let files=[];
+
+          this.reportForm.fileUrl.forEach(item =>{
+            if (item.url !== null || itme.url !== '')
+            files.push(item.url)
+          })
+          const submitData = {
+            projectId: Number(this.reportForm.projectId),
+            content: this.reportForm.content,
+            projectName:matchItem.name,
+            fileUrl: files
+          };
+
+          this.$message.success('涓婃姤鍐呭宸插噯澶囧氨缁�');
+          this.reportDialogVisible = false;
+          addReport(submitData).then(res =>{
+            if (res.code === 200){
+              this.getReportList();
+            }
+          })
+        } else {
+          this.$message.error('璇峰畬鍠勪笂鎶ヤ俊鎭�');
+        }
+      });
+    },
     addProject(){
       this.$router.push({path: '/projectEngineering/project/ProjectDetails'});
     },
@@ -597,8 +846,8 @@
         this.loading = false;
         this.waitTaskRefreshing = false;
         if (res.code === 200){
-          this.tasks = res.data.data;
-          this.waitTaskTotal = res.data.total;
+          this.tasks = res.data;
+          this.waitTaskTotal = res.total;
         }
 
       })
@@ -656,18 +905,6 @@
     isProjectNameTooLong(name) {
       return name.length > 10;
     },
-    formatDate(date) {
-      const year = date.getFullYear();
-      const month = date.getMonth() + 1;
-      const day = date.getDate();
-      return `${year}骞�${month}鏈�${day}鏃;
-    },
-    formatCalendarDate(date) {
-      const year = date.getFullYear();
-      const month = (date.getMonth() + 1).toString().padStart(2, '0');
-      const day = date.getDate().toString().padStart(2, '0');
-      return `${year}-${month}-${day}`;
-    },
     handleProjectSelect(index) {
       this.activeProject = index;
       console.log(this.activeProject)
@@ -684,6 +921,14 @@
     },
     handleTaskEdit(row) {
       console.log(row)
+      this.queryParams.projectId = row.checkPointInfo.id +"";
+      this.queryParams.processDefId = row.checkPointInfo.processDefinitionId;
+      this.queryParams.processInsId = row.checkPointInfo.processInstanceId;
+      this.queryParams.deployId = row.checkPointInfo.deployId;
+      this.queryParams.processName = row.checkPointInfo.processName;
+
+      console.log(this.queryParams)
+
       if (row.taskType === '瀹圭己') {
         this.$router.push({
           path: '/flowable/task/myProcess/send/index',
@@ -728,8 +973,15 @@
         })
       }
     },
+    // 鑾峰緱璁℃暟
+    getReportCount(date){
+      const dateStr = formatCalendarDate(date);
+      return this.reports.filter(s => s.date === dateStr).length;
+
+    },
+
     getScheduleCount(date) {
-      const dateStr = this.formatCalendarDate(date);
+      const dateStr = formatCalendarDate(date);
       return this.schedules.filter(s => s.date === dateStr).length;
     },
     handleDeleteSchedule(schedule) {
@@ -1009,4 +1261,34 @@
   padding: 0 !important;
   border: none !important;
 }
+.report-btn {
+  background: linear-gradient(135deg, #409eff, #1e88e5) !important;
+  border: none !important;
+  border-radius: 20px !important;
+  padding: 6px 16px !important;
+  color: white !important;
+  font-weight: 500 !important;
+  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3) !important;
+  transition: all 0.3s ease !important;
+  height: 32px !important;
+  margin-left: 10px;
+}
+.report-btn:hover {
+  background: linear-gradient(135deg, #66b1ff, #409eff) !important;
+  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4) !important;
+  transform: translateY(-1px);
+}
+
+.report-btn:active {
+  background: linear-gradient(135deg, #1e88e5, #0d6efd) !important;
+  box-shadow: 0 2px 6px rgba(64, 158, 255, 0.2) !important;
+  transform: translateY(0);
+}
+
+.report-btn:disabled {
+  background: #e0e0e0 !important;
+  color: #999 !important;
+  box-shadow: none !important;
+  transform: none !important;
+}
 </style>

--
Gitblit v1.8.0