diff --git a/src/views/modules/inspection/com_inspectionRequestDetailTab.vue b/src/views/modules/inspection/com_inspectionRequestDetailTab.vue index 3283c9a..d417cb6 100644 --- a/src/views/modules/inspection/com_inspectionRequestDetailTab.vue +++ b/src/views/modules/inspection/com_inspectionRequestDetailTab.vue @@ -10,6 +10,9 @@ + + + diff --git a/src/views/modules/inspection/com_inspectionRequestPoDetailTab.vue b/src/views/modules/inspection/com_inspectionRequestPoDetailTab.vue index 1c67232..b73ea4a 100644 --- a/src/views/modules/inspection/com_inspectionRequestPoDetailTab.vue +++ b/src/views/modules/inspection/com_inspectionRequestPoDetailTab.vue @@ -11,6 +11,9 @@ + + + diff --git a/src/views/modules/inspection/com_inspectionResultTab.vue b/src/views/modules/inspection/com_inspectionResultTab.vue index 5dc88fb..9437ab0 100644 --- a/src/views/modules/inspection/com_inspectionResultTab.vue +++ b/src/views/modules/inspection/com_inspectionResultTab.vue @@ -12,6 +12,9 @@ + + + diff --git a/src/views/modules/inspection/com_inspectionScheduleView.vue b/src/views/modules/inspection/com_inspectionScheduleView.vue index 2e3cad8..cace17a 100644 --- a/src/views/modules/inspection/com_inspectionScheduleView.vue +++ b/src/views/modules/inspection/com_inspectionScheduleView.vue @@ -2,7 +2,15 @@
-
QC人员清单
+
+ QC人员清单 + 查看全部 +
@@ -88,6 +96,47 @@ 关闭
+ + + +
+
+
+
+ {{ day.dateLabel }} + {{ day.weekday }} +
+
+
+
{{ qcTask.qcName }}
+
+
+ {{ task.requestNo }} + {{ task.supplierName }} +
+
+
+
+ 暂无排程 +
+
+
+
+
+ +
@@ -109,6 +158,10 @@ export default { loading: false, qcTableHeight: 500, scheduleDialogVisible: false, + allQcScheduleDialogVisible: false, + allQcLoading: false, + allQcScheduleData: {}, // 存储所有QC的排程数据 { userName: [days] } + allScheduleDays: [], // 按日期组织的排程数据 [{ date, dateLabel, weekday, qcTasks: [...] }] scheduleForm: { qcOperator: '', qcUserName: '', @@ -159,7 +212,7 @@ export default { const rowHeight = 40 const headerHeight = 45 // 表头高度 const rowCount = 10 // 显示10行数据 - + this.qcTableHeight = (rowHeight * rowCount) + headerHeight + 2 // 加2px用于边框 }, // 强制刷新当前选中的QC排程视图(供父组件调用) @@ -170,7 +223,7 @@ export default { }, loadQcList() { console.log('[排程视图] 开始加载QC列表') - + const params = { page: 1, limit: 100 } getQcPersonList(params) .then(({ data }) => { @@ -242,14 +295,14 @@ export default { planEndDate: '', remark: '' } - + // 如果是已排程状态,加载当前排程数据用于修改 if (this.currentStatusDb === 'Scheduled' && this.currentRow && this.currentRow.planStartDate) { this.scheduleForm.planStartDate = this.currentRow.planStartDate || '' this.scheduleForm.planEndDate = this.currentRow.planEndDate || this.currentRow.planStartDate || '' this.scheduleForm.remark = this.currentRow.remark || '' } - + this.scheduleDialogVisible = true }, @@ -380,6 +433,98 @@ export default { handleTaskClick(task) { console.log('点击任务:', task) this.$emit('task-click', task) + }, + // 显示所有QC排程弹窗 + showAllQcSchedule() { + this.allQcScheduleDialogVisible = true + this.loadAllQcSchedule() + }, + // 加载所有QC的排程数据 + loadAllQcSchedule() { + if (!this.qcList || this.qcList.length === 0) { + this.$message.warning('暂无QC人员数据') + return + } + this.allQcLoading = true + const promises = this.qcList.map(qc => { + return getScheduleView(qc.userName).then(({ data }) => { + if (data.code === 0) { + const days = this.generateNextDays(10) + const tasksByDate = {} + ;(data.list || []).forEach(task => { + const startDate = new Date(task.planStartDate) + const endDate = new Date(task.planEndDate || task.planStartDate) + let currentDate = new Date(startDate) + while (currentDate <= endDate) { + const dateStr = this.formatDate(currentDate) + if (!tasksByDate[dateStr]) tasksByDate[dateStr] = [] + const exists = tasksByDate[dateStr].some(t => t.requestNo === task.requestNo) + if (!exists) { + tasksByDate[dateStr].push({ + requestNo: task.requestNo, + supplierName: task.supplierName, + inspectAddress: task.inspectAddress, + planStartDate: task.planStartDate, + planEndDate: task.planEndDate + }) + } + currentDate.setDate(currentDate.getDate() + 1) + } + }) + const scheduleDays = days.map(day => ({ + ...day, + tasks: tasksByDate[day.date] || [] + })) + return { userName: qc.userName, qcName: qc.qcName, scheduleDays } + } else { + return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10) } + } + }).catch(() => { + return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10) } + }) + }) + + Promise.all(promises).then(results => { + // 按日期重新组织数据 + const daysMap = {} + const baseDays = this.generateNextDays(10) + + // 初始化每一天的数据结构 + baseDays.forEach(day => { + daysMap[day.date] = { + date: day.date, + dateLabel: day.dateLabel, + weekday: day.weekday, + qcTasks: [] + } + }) + + // 将每个QC的任务分配到对应的日期 + results.forEach(result => { + result.scheduleDays.forEach(day => { + if (day.tasks && day.tasks.length > 0) { + if (daysMap[day.date]) { + daysMap[day.date].qcTasks.push({ + userName: result.userName, + qcName: result.qcName, + tasks: day.tasks + }) + } + } + }) + }) + + // 转换为数组并按日期排序 + this.allScheduleDays = Object.values(daysMap).sort((a, b) => a.date.localeCompare(b.date)) + this.allQcLoading = false + }).catch(() => { + this.allQcLoading = false + }) + }, + // 点击QC任务项 + handleQcTaskClick(qcTask) { + console.log('点击QC任务:', qcTask) + // 可以在这里添加查看详情等逻辑 } } } @@ -586,4 +731,152 @@ export default { font-size: 12px; border-radius: 3px; } + +/* 所有QC排程弹窗样式 */ +.all-qc-schedule-container { + max-height: 75vh; + overflow-y: auto; + padding: 10px; + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #dcdfe6; + border-radius: 3px; + + &:hover { + background: #c0c4cc; + } + } +} + +.schedule-days-grid { + display: grid; + grid-template-columns: repeat(5, 1fr); + gap: 12px; +} + +.schedule-day-card { + border: 2px solid #dcdfe6; + border-radius: 4px; + background: #fff; + display: flex; + flex-direction: column; + height: 280px; + width: 100%; + + .day-header { + padding: 8px 10px; + background: #f5f7fa; + border-bottom: 2px solid #dcdfe6; + display: flex; + justify-content: space-between; + align-items: center; + height: 38px; + flex-shrink: 0; + + .date-label { + font-size: 14px; + font-weight: bold; + color: #303133; + } + + .date-weekday { + font-size: 11px; + color: #909399; + } + } + + .day-body { + padding: 8px; + display: flex; + flex-direction: column; + gap: 6px; + height: calc(100% - 38px); + overflow-y: auto; + + &::-webkit-scrollbar { + width: 4px; + } + + &::-webkit-scrollbar-thumb { + background: #dcdfe6; + border-radius: 2px; + + &:hover { + background: #c0c4cc; + } + } + } +} + +.qc-task-item { + padding: 6px 8px; + background: #f5f7fa; + border: 1px solid #e4e7ed; + border-radius: 3px; + cursor: pointer; + transition: all 0.3s; + + &:hover { + background: #ecf5ff; + border-color: #409eff; + box-shadow: 0 2px 6px rgba(64, 158, 255, 0.12); + } + + .qc-name-tag { + font-size: 12px; + font-weight: bold; + color: #409eff; + margin-bottom: 4px; + padding-bottom: 3px; + border-bottom: 1px dashed #dcdfe6; + } + + .task-list { + display: flex; + flex-direction: column; + gap: 3px; + } + + .mini-task { + padding: 3px 5px; + background: #fff; + border-radius: 2px; + font-size: 10px; + color: #606266; + display: flex; + justify-content: space-between; + align-items: center; + gap: 4px; + + .task-no-text { + font-weight: 500; + color: #303133; + flex-shrink: 0; + } + + .task-supplier-text { + color: #909399; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + flex: 1; + } + } +} + +.empty-day { + flex: 1; + display: flex; + align-items: center; + justify-content: center; + + .empty-text { + color: #c0c4cc; + font-size: 13px; + } +} diff --git a/src/views/modules/inspection/inspectionRequestList.vue b/src/views/modules/inspection/inspectionRequestList.vue index 5221c32..1d59ca9 100644 --- a/src/views/modules/inspection/inspectionRequestList.vue +++ b/src/views/modules/inspection/inspectionRequestList.vue @@ -883,7 +883,10 @@ export default { needInspectDate: '' } this.poList = [] + this.filteredPoList = [] this.selectedPoList = [] + this.poSearchKeyword = '' + this.crdSortOrder = '' if (this.$refs.addFormData) { this.$refs.addFormData.clearValidate() }