-
{{ qcTask.qcName }}
+ class="qc-task-item">
-
-
{{ task.requestNo }}
-
{{ task.supplierName }}
+
+ {{ buildTaskLineText(task, qcTask.qcName) }}
@@ -162,6 +175,9 @@ export default {
allQcLoading: false,
allQcScheduleData: {}, // 存储所有QC的排程数据 { userName: [days] }
allScheduleDays: [], // 按日期组织的排程数据 [{ date, dateLabel, weekday, qcTasks: [...] }]
+ allQcQuery: {
+ startDate: ''
+ },
scheduleForm: {
qcOperator: '',
qcUserName: '',
@@ -224,7 +240,11 @@ export default {
loadQcList() {
console.log('[排程视图] 开始加载QC列表')
- const params = { page: 1, limit: 100 }
+ const params = {
+ page: 1,
+ limit: 100,
+ site: this.$store.state.user.site
+ }
getQcPersonList(params)
.then(({ data }) => {
if (data.code === 0 && data.page && data.page.list) {
@@ -356,23 +376,25 @@ export default {
}
this.loading = true
console.log('[排程视图] 开始加载排程数据, QC:', qc.userName)
- getScheduleView(qc.userName)
+ getScheduleView(qc.userName, this.getTodayDateString(), this.$store.state.user.site)
.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 taskStartDate = new Date(task.planStartDate)
+ const taskEndDate = new Date(task.planEndDate || task.planStartDate)
+ let currentDate = new Date(taskStartDate)
+ while (currentDate <= taskEndDate) {
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,
+ poNo: task.poNo,
supplierName: task.supplierName,
+ qcDisplay: qc.qcName,
inspectAddress: task.inspectAddress,
planStartDate: task.planStartDate,
planEndDate: task.planEndDate
@@ -408,13 +430,13 @@ export default {
this.loading = false
})
},
- generateNextDays(days) {
+ generateNextDays(days, startDate) {
const result = []
- const today = new Date()
+ const baseDate = this.parseDateString(startDate) || new Date()
const weekdays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
for (let i = 0; i < days; i++) {
- const date = new Date(today)
- date.setDate(today.getDate() + i)
+ const date = new Date(baseDate)
+ date.setDate(baseDate.getDate() + i)
result.push({
date: this.formatDate(date),
dateLabel: `${date.getMonth() + 1}/${date.getDate()}`,
@@ -424,6 +446,36 @@ export default {
}
return result
},
+ getTodayDateString() {
+ return this.formatDate(new Date())
+ },
+ parseDateString(dateStr) {
+ if (!dateStr) {
+ return null
+ }
+ const parts = String(dateStr).split('-')
+ if (parts.length !== 3) {
+ return null
+ }
+ const year = Number(parts[0])
+ const month = Number(parts[1]) - 1
+ const day = Number(parts[2])
+ const parsedDate = new Date(year, month, day)
+ if (Number.isNaN(parsedDate.getTime())) {
+ return null
+ }
+ return parsedDate
+ },
+ getSupplierDisplayName(supplierName) {
+ const value = supplierName || ''
+ return value.length > 30 ? value.substring(0, 30) : value
+ },
+ buildTaskLineText(task, qcDisplayName) {
+ const displayName = qcDisplayName || task.qcDisplay || (this.selectedQc ? this.selectedQc.qcName : '')
+ const poNo = task.poNo || ''
+ const supplierName = this.getSupplierDisplayName(task.supplierName)
+ return [displayName, poNo, supplierName].filter(item => item).join(' | ')
+ },
formatDate(date) {
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
@@ -437,6 +489,14 @@ export default {
// 显示所有QC排程弹窗
showAllQcSchedule() {
this.allQcScheduleDialogVisible = true
+ this.allQcQuery.startDate = this.getTodayDateString()
+ this.loadAllQcSchedule()
+ },
+ // 按起始日期查询所有QC排程
+ queryAllQcSchedule() {
+ if (!this.allQcQuery.startDate) {
+ this.allQcQuery.startDate = this.getTodayDateString()
+ }
this.loadAllQcSchedule()
},
// 加载所有QC的排程数据
@@ -445,23 +505,26 @@ export default {
this.$message.warning('暂无QC人员数据')
return
}
+ const startDate = this.allQcQuery.startDate || this.getTodayDateString()
+ this.allQcQuery.startDate = startDate
this.allQcLoading = true
const promises = this.qcList.map(qc => {
- return getScheduleView(qc.userName).then(({ data }) => {
+ return getScheduleView(qc.userName, startDate, this.$store.state.user.site).then(({ data }) => {
if (data.code === 0) {
- const days = this.generateNextDays(10)
+ const days = this.generateNextDays(10, startDate)
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 taskStartDate = new Date(task.planStartDate)
+ const taskEndDate = new Date(task.planEndDate || task.planStartDate)
+ let currentDate = new Date(taskStartDate)
+ while (currentDate <= taskEndDate) {
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,
+ poNo: task.poNo,
supplierName: task.supplierName,
inspectAddress: task.inspectAddress,
planStartDate: task.planStartDate,
@@ -477,17 +540,17 @@ export default {
}))
return { userName: qc.userName, qcName: qc.qcName, scheduleDays }
} else {
- return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10) }
+ return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10, startDate) }
}
}).catch(() => {
- return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10) }
+ return { userName: qc.userName, qcName: qc.qcName, scheduleDays: this.generateNextDays(10, startDate) }
})
})
Promise.all(promises).then(results => {
// 按日期重新组织数据
const daysMap = {}
- const baseDays = this.generateNextDays(10)
+ const baseDays = this.generateNextDays(10, startDate)
// 初始化每一天的数据结构
baseDays.forEach(day => {
@@ -665,35 +728,14 @@ export default {
border-color: #409eff;
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);
}
+}
- .task-no {
- font-size: 13px;
- font-weight: bold;
- color: #409eff;
- margin-bottom: 5px;
- }
-
- .task-supplier {
- font-size: 12px;
- color: #606266;
- word-wrap: break-word;
- word-break: break-all;
- white-space: normal;
- line-height: 1.5;
- margin-bottom: 4px;
- }
-
- .task-address {
- font-size: 10px;
- color: #909399;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-
- i {
- margin-right: 2px;
- }
- }
+.task-line-text {
+ font-size: 12px;
+ color: #303133;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.empty-slot {
@@ -733,6 +775,11 @@ export default {
}
/* 所有QC排程弹窗样式 */
+.all-qc-query-form {
+ padding: 0 10px;
+ margin-bottom: 6px;
+}
+
.all-qc-schedule-container {
max-height: 75vh;
overflow-y: auto;
@@ -826,15 +873,6 @@ export default {
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;
@@ -845,25 +883,10 @@ export default {
padding: 3px 5px;
background: #fff;
border-radius: 2px;
- font-size: 10px;
- color: #606266;
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 4px;
+ cursor: pointer;
- .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;
+ &:hover {
+ background: #ecf5ff;
}
}
}
diff --git a/src/views/modules/inspection/myTodoList.vue b/src/views/modules/inspection/myTodoList.vue
index 07add48..303de4c 100644
--- a/src/views/modules/inspection/myTodoList.vue
+++ b/src/views/modules/inspection/myTodoList.vue
@@ -22,8 +22,7 @@
:key="task.requestNo"
class="task-item"
@click="handleTaskClick(task, day.date)">
-
单号:{{ task.requestNo }}
-
{{ task.supplierName }}
+
{{ buildTaskLineText(task) }}
@@ -69,8 +68,11 @@ export default {
loadScheduleData () {
this.loading = true
const qcOperator = this.$store.state.user.name
+ const startDate = this.formatDate(new Date())
+ const site = this.$store.state.user.site
+ const qcDisplay = this.$store.state.user.userDisplay || this.$store.state.user.name
- getScheduleView(qcOperator).then(({ data }) => {
+ getScheduleView(qcOperator, startDate, site).then(({ data }) => {
if (data.code === 0 && data.list) {
const days = this.generateNextDays(10)
const tasksByDate = {}
@@ -85,7 +87,9 @@ export default {
if (!exists) {
tasksByDate[dateStr].push({
requestNo: task.requestNo,
+ poNo: task.poNo,
supplierName: task.supplierName,
+ qcDisplay: qcDisplay,
inspectAddress: task.inspectAddress,
planStartDate: task.planStartDate,
planEndDate: task.planEndDate
@@ -136,6 +140,16 @@ export default {
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
+ getSupplierDisplayName (supplierName) {
+ const value = supplierName || ''
+ return value.length > 30 ? value.substring(0, 30) : value
+ },
+ buildTaskLineText (task) {
+ const displayName = task.qcDisplay || this.$store.state.user.userDisplay || this.$store.state.user.name
+ const poNo = task.poNo || ''
+ const supplierName = this.getSupplierDisplayName(task.supplierName)
+ return [displayName, poNo, supplierName].filter(item => item).join(' | ')
+ },
// 点击任务卡片 - 只传递申请单号
handleTaskClick (task, date) {
@@ -256,32 +270,14 @@ export default {
box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);
transform: translateY(-2px);
}
+}
- .task-no {
- font-size: 13px;
- font-weight: bold;
- color: #409eff;
- margin-bottom: 5px;
- }
- .task-supplier {
- font-size: 12px;
- color: #606266;
- word-wrap: break-word;
- word-break: break-all;
- white-space: normal;
- line-height: 1.4;
- margin-bottom: 4px;
- }
- .task-address {
- font-size: 11px;
- color: #909399;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- i {
- margin-right: 3px;
- }
- }
+.task-line-text {
+ font-size: 12px;
+ color: #303133;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.empty-slot {
diff --git a/src/views/modules/qc/IQCFileTable.vue b/src/views/modules/qc/IQCFileTable.vue
index c565dff..0ec57f4 100644
--- a/src/views/modules/qc/IQCFileTable.vue
+++ b/src/views/modules/qc/IQCFileTable.vue
@@ -18,37 +18,53 @@ export default {
}
},
methods: {
+ getFileExt (row) {
+ const fromType = (row && row.fileType ? String(row.fileType) : '').trim()
+ if (fromType) {
+ return fromType.toLowerCase()
+ }
+ const fromSuffix = (row && row.fileSuffix ? String(row.fileSuffix) : '').trim()
+ if (fromSuffix) {
+ return fromSuffix.toLowerCase()
+ }
+ const fileName = row && row.fileName ? String(row.fileName) : ''
+ const lastDotIndex = fileName.lastIndexOf('.')
+ if (lastDotIndex >= 0 && lastDotIndex < fileName.length - 1) {
+ return fileName.substring(lastDotIndex + 1).toLowerCase()
+ }
+ return ''
+ },
+ getPreviewMimeType (ext) {
+ const image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
+ if (image.includes(ext)) {
+ return 'image/' + ext
+ }
+ const video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
+ if (video.includes(ext)) {
+ return 'video/' + ext
+ }
+ if (ext === 'txt') {
+ return 'text/plain'
+ }
+ if (ext === 'pdf') {
+ return 'application/pdf'
+ }
+ return ''
+ },
+ canPreview (row) {
+ const ext = this.getFileExt(row)
+ return !!this.getPreviewMimeType(ext)
+ },
emitFilePreviewed (row) {
this.$emit('file-previewed', row)
},
// 预览
previewFile (row) {
- // 预览文件
- let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
- let type = ''
- if (image.includes(row.fileType.toLowerCase())) {
- type = 'image/' + row.fileType
- }
- let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
- if (video.includes(row.fileType.toLowerCase())) {
- type = 'video/' + row.fileType
- }
- let txt = ['txt']
- if (txt.includes(row.fileType.toLowerCase())) {
- type = 'text/plain'
- }
- let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
- if (office.includes(row.fileType.toLowerCase())) {
- this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
- return
- }
- let pdf = ['pdf']
- if (pdf.includes(row.fileType.toLowerCase())) {
- type = 'application/pdf'
- }
- if (type === ''){
- this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
+ const fileExt = this.getFileExt(row)
+ const type = this.getPreviewMimeType(fileExt)
+ if (type === '') {
+ this.$message.warning(`暂不支持预览${fileExt || '该类型'}文件`)
return;
}
downLoadObjectFile(row).then(({data}) => {
@@ -63,31 +79,10 @@ export default {
// 预览
previewFileMes (row) {
- // 预览文件
- let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
- let type = ''
- if (image.includes(row.fileType.toLowerCase())) {
- type = 'image/' + row.fileType
- }
- let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
- if (video.includes(row.fileType.toLowerCase())) {
- type = 'video/' + row.fileType
- }
- let txt = ['txt']
- if (txt.includes(row.fileType.toLowerCase())) {
- type = 'text/plain'
- }
- let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
- if (office.includes(row.fileType.toLowerCase())) {
- this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
- return
- }
- let pdf = ['pdf']
- if (pdf.includes(row.fileType.toLowerCase())) {
- type = 'application/pdf'
- }
- if (type === ''){
- this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`)
+ const fileExt = this.getFileExt(row)
+ const type = this.getPreviewMimeType(fileExt)
+ if (type === '') {
+ this.$message.warning(`暂不支持预览${fileExt || '该类型'}文件`)
return;
}
downLoadObjectFileMes(row).then(({data}) => {
@@ -213,13 +208,19 @@ export default {
width="100"
label="操作">
-
+ 预览
下载
删除
-
+ 预览
下载