Browse Source

fix(inspection): 修复排程功能逻辑和界面显示问题

- 修改排程视图中排程按钮显示条件,只在主表选中数据且状态为已下达时显示
- 移除无数据提示,改为始终显示左右两个面板
- 优化排程视图的数据加载逻辑,根据主表选择状态决定是否加载排程数据
- 修复QC人员切换时排程数据的加载时机问题
- 调整质量异议详情页面的输入框样式统一性
- 修复日期时间选择器图标的垂直居中显示问题
- 更新检验申请单列表的状态标签,将"已确认"改为"待审核","已审核"改为"已下达"
- 优化排程列表页面的排程成功处理逻辑,改为整页数据刷新
- 修复排程视图组件的高度自适应问题,将overflow设置为overflow-y: auto
master
qiankanghui 1 week ago
parent
commit
a8874e8636
  1. 146
      src/views/modules/inspection/com_inspectionScheduleView.vue
  2. 4
      src/views/modules/inspection/inspectionRequestList.vue
  3. 28
      src/views/modules/inspection/inspectionScheduleList.vue
  4. 177
      src/views/modules/quality/com_qualityIssueDetail.vue

146
src/views/modules/inspection/com_inspectionScheduleView.vue

@ -1,13 +1,5 @@
<template>
<div class="schedule-container">
<!-- 无数据提示 -->
<div v-if="!hasSelectedData" class="empty-state">
<i class="el-icon-info" style="font-size: 48px; color: #c0c4cc;"></i>
<p style="color: #909399; margin-top: 16px;">请先在主表中选择需要排程的申请单</p>
</div>
<!-- 有数据时显示正常内容 -->
<template v-else>
<!-- 左侧QC人员清单 -->
<div class="left-panel">
<div class="panel-title">QC人员清单</div>
@ -23,15 +15,20 @@
class="qc-table">
<el-table-column prop="qcName" label="姓名" width="80" align="center" />
<el-table-column prop="region" label="负责区域" min-width="90" show-overflow-tooltip />
<el-table-column label="操作" width="80" align="center" fixed="right" v-if="currentStatusDb !== 'Scheduled'">
<el-table-column label="操作" width="80" align="center" fixed="right">
<template slot-scope="scope">
<el-link type="primary" style="cursor: pointer;" @click.stop="openScheduleDialog(null, scope.row)">排程</el-link>
<!-- 只有当主表选中了数据且状态为已下达时才显示排程按钮 -->
<el-link
v-if="hasSelectedData && currentStatusDb === 'Audited'"
type="primary"
style="cursor: pointer;"
@click.stop="openScheduleDialog(null, scope.row)">排程</el-link>
</template>
</el-table-column>
</el-table>
</div>
<!-- 右侧:排程卡片 -->
<!-- 右侧:排程卡片始终显示 -->
<div class="right-panel">
<div class="panel-title">
<span v-if="selectedQc">{{ selectedQc.qcName }} - 排程视图未来10天</span>
@ -62,7 +59,6 @@
</div>
</div>
</div>
</template>
<!-- 排程弹窗 -->
<el-dialog
@ -124,6 +120,7 @@ export default {
}
},
computed: {
//
hasSelectedData() {
return this.requestNos && this.requestNos.length > 0
}
@ -132,41 +129,32 @@ export default {
requestNos: {
handler(newVal) {
if (newVal && newVal.length > 0) {
//
this.selectedQc = null
this.scheduleDays = []
this.loadQcList()
//
if (this.selectedQc) {
this.loadScheduleData(this.selectedQc)
}
} else {
this.selectedQc = null
this.scheduleDays = []
this.qcList = []
//
this.scheduleDays = this.generateNextDays(10)
}
}
},
immediate: true
}
},
mounted() {
console.log('[排程视图] 组件已挂载')
// QC
this.loadQcList()
},
methods: {
// QC
forceRefresh() {
console.log('[排程视图] 强制刷新,当前选中QC:', this.selectedQc)
if (this.selectedQc) {
this.loadScheduleData(this.selectedQc)
} else if (this.qcList.length > 0) {
// QCQC
this.selectedQc = this.qcList[0]
this.loadScheduleData(this.selectedQc)
this.$nextTick(() => {
if (this.$refs.qcTable) this.$refs.qcTable.setCurrentRow(this.selectedQc)
})
} else {
// QCQC
console.log('[排程视图] forceRefresh 被调用')
// QC
this.loadQcList()
}
},
loadQcList() {
console.log('[排程视图] 开始加载QC列表')
const params = { page: 1, limit: 100 }
getQcPersonList(params)
.then(({ data }) => {
@ -180,14 +168,26 @@ export default {
console.log('[排程视图] QC列表加载成功:', this.qcList)
if (this.qcList.length) {
// QC
if (!this.selectedQc || !this.qcList.some(q => q.userName === this.selectedQc.userName)) {
if (
!this.selectedQc ||
!this.qcList.some(q => q.userName === this.selectedQc.userName)
) {
this.selectedQc = this.qcList[0]
}
//
//
if (this.hasSelectedData) {
this.loadScheduleData(this.selectedQc)
} else {
this.scheduleDays = this.generateNextDays(10)
}
this.$nextTick(() => {
if (this.$refs.qcTable) this.$refs.qcTable.setCurrentRow(this.selectedQc)
if (this.$refs.qcTable) {
this.$refs.qcTable.setCurrentRow(this.selectedQc)
}
})
} else {
this.selectedQc = null
@ -210,11 +210,68 @@ export default {
handleQcSelect(row) {
if (!row) return
this.selectedQc = row
//
if (this.hasSelectedData) {
this.loadScheduleData(row)
} else {
this.scheduleDays = this.generateNextDays(10)
}
},
//
openScheduleDialog(task, qcRow) {
this.scheduleForm = {
qcOperator: qcRow ? qcRow.userName : '',
qcUserName: qcRow ? qcRow.qcName : '',
planStartDate: '',
planEndDate: '',
remark: ''
}
this.scheduleDialogVisible = true
},
// openScheduleDialog, submitSchedule, cancelSchedule, loadScheduleData, generateNextDays, formatDate, handleTaskClick
// loadScheduleData 使
//
cancelSchedule() {
this.scheduleDialogVisible = false
},
//
submitSchedule() {
this.$refs.scheduleForm.validate((valid) => {
if (!valid) return
if (!this.scheduleForm.planStartDate) {
this.$message.warning('请选择计划验货日期')
return
}
const params = {
requestNos: this.requestNos,
site: this.$store.state.user.site,
qcOperator: this.scheduleForm.qcOperator,
planStartDate: this.scheduleForm.planStartDate,
planEndDate: this.scheduleForm.planEndDate || this.scheduleForm.planStartDate,
remark: this.scheduleForm.remark
}
this.loading = true
scheduleInspectionRequest(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('排程成功')
this.scheduleDialogVisible = false
//
this.$emit('schedule-success')
} else {
this.$message.error((data && data.msg) || '排程失败')
}
this.loading = false
}).catch((error) => {
console.error('排程失败:', error)
this.$message.error('排程失败')
this.loading = false
})
})
},
loadScheduleData(qc) {
console.log('======loadScheduleData======')
console.log('qc=', qc)
if (!qc) {
console.warn('[排程视图] loadScheduleData 参数为空')
this.scheduleDays = this.generateNextDays(10)
@ -251,6 +308,15 @@ export default {
...day,
tasks: tasksByDate[day.date] || []
}))
console.log('scheduleDays=', this.scheduleDays)
console.log(
'任务总数=',
this.scheduleDays.reduce(
(sum, item) => sum + item.tasks.length,
0
)
)
console.log('[排程视图] 排程数据加载完成')
} else {
console.warn('[排程视图] 加载排程数据失败')
@ -359,7 +425,7 @@ export default {
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: 10px;
overflow: hidden;
overflow-y: auto;
}
.schedule-card {

4
src/views/modules/inspection/inspectionRequestList.vue

@ -21,8 +21,8 @@
<el-select v-model="searchData.status" clearable placeholder="全部" style="width: 100%">
<el-option label="全部" value="" />
<el-option label="草稿" value="Draft" />
<el-option label="已确认" value="Confirmed" />
<el-option label="已审核" value="Audited" />
<el-option label="待审核" value="Confirmed" />
<el-option label="已下达" value="Audited" />
<el-option label="已排程" value="Scheduled" />
<el-option label="已验货" value="Inspected" />
<el-option label="已取消" value="Cancelled" />

28
src/views/modules/inspection/inspectionScheduleList.vue

@ -131,7 +131,6 @@
<!-- 详情页签 -->
<el-tabs v-model="activeTab" @tab-click="handleTabClick" class="customer-tab" type="border-card">
<!-- 排程视图 -->
<!-- 排程视图 -->
<el-tab-pane label="排程" name="schedule">
<inspection-schedule-view
@ -139,7 +138,7 @@
:request-nos="selectedRequestNos"
:current-row="currentRow"
:current-status-db="currentRow.statusDb"
@schedule-success="getMainData" />
@schedule-success="handleScheduleSuccess" />
</el-tab-pane>
<!-- 基本信息 -->
<el-tab-pane label="基本信息" name="base">
@ -440,11 +439,6 @@ export default {
this.height = 250
this.detailHeight = 300
this.getMainData()
//
if (this.activeTab === 'schedule' && this.$refs.scheduleView) {
this.$refs.scheduleView.loadQcList()
}
})
},
methods: {
@ -529,6 +523,12 @@ export default {
this.getMainData()
},
// -
handleScheduleSuccess() {
// changeData
this.getMainData()
},
//
handleTabClick (tab) {
if (tab.name === 'schedule') {
@ -561,17 +561,22 @@ export default {
//
changeData (row) {
console.log('======changeData======')
console.log('row=', row)
this.currentRow = row ? JSON.parse(JSON.stringify(row)) : {}
if (row && row.requestNo) {
this.selectedRequestNos = [row.requestNo]
} else {
this.selectedRequestNos = []
}
this.$nextTick(() => {
// QC+
if (this.activeTab === 'schedule' && this.$refs.scheduleView) {
this.$refs.scheduleView.forceRefresh()
console.log('[排程] 刷新排程视图')
this.$refs.scheduleView.loadQcList()
}
})
},
//
mainTableRowClassName ({ row }) {
@ -622,9 +627,6 @@ export default {
},
created () {
this.getMainData()
}
}
</script>
<style scoped lang="scss">

177
src/views/modules/quality/com_qualityIssueDetail.vue

@ -525,7 +525,6 @@ export default {
}
}
</script>
<style scoped lang="scss">
.quality-issue-detail {
padding: 10px 15px;
@ -561,22 +560,20 @@ export default {
white-space: pre-wrap;
box-sizing: border-box;
}
.form-item .value.disabled {
background: #f5f7fa;
color: #909399;
}
.form-item.textarea-item .value.textarea-content {
min-height: 60px;
line-height: 1.5;
padding: 8px 10px;
}
/* 统一编辑模式输入框高度 */
/deep/ .el-input--small .el-input__inner,
/deep/ .el-textarea__inner,
/deep/ .el-select .el-input__inner,
/deep/ .el-date-editor .el-input__inner,
/deep/ .el-input-number .el-input__inner {
/* 统一编辑模式输入框样式 */
/deep/ .el-input--small .el-input__inner {
height: 32px;
line-height: 32px;
padding: 0 10px;
@ -586,25 +583,136 @@ export default {
background-color: #fff;
font-size: 13px;
}
/* 文本域样式 */
/deep/ .el-textarea__inner {
height: auto;
line-height: 1.5;
padding: 8px 10px;
min-height: 60px;
box-sizing: border-box;
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #fff;
font-size: 13px;
}
/deep/ .el-input-number--small {
width: 100%;
/* 下拉选择框 */
/deep/ .el-select .el-input__inner {
height: 32px;
line-height: 32px;
padding: 0 10px;
box-sizing: border-box;
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #fff;
font-size: 13px;
}
/deep/ .el-input-number--small .el-input-number__increase,
/deep/ .el-input-number--small .el-input-number__decrease {
height: 16px;
line-height: 16px;
/* 日期选择器容器 */
/deep/ .el-date-editor {
width: 100% !important;
}
/deep/ .el-date-editor.el-input,
/deep/ .el-date-editor.el-input__inner {
width: 100%;
}
/* 按钮样式:不长,自适应宽度 */
/* 日期选择器输入框 */
/deep/ .el-date-editor .el-input__inner {
height: 32px;
line-height: 32px;
padding: 0 30px 0 10px;
box-sizing: border-box;
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #fff;
font-size: 13px;
}
/* 日期时间选择器输入框 */
/deep/ .el-date-editor--datetime .el-input__inner {
padding: 0 40px 0 10px;
}
/* 修复图标垂直居中 - 关键 */
/deep/ .el-input {
line-height: 32px;
}
/deep/ .el-input__prefix,
/deep/ .el-input__suffix {
display: flex !important;
align-items: center !important;
justify-content: center !important;
height: 32px !important;
top: 0 !important;
bottom: auto !important;
line-height: 32px !important;
}
/deep/ .el-input__suffix {
right: 5px;
}
/deep/ .el-input__prefix {
left: 5px;
}
/deep/ .el-input__suffix-inner,
/deep/ .el-input__prefix-inner {
display: flex !important;
align-items: center !important;
height: 100% !important;
line-height: 32px !important;
}
/deep/ .el-input__icon {
line-height: 32px !important;
height: 32px !important;
width: 25px;
text-align: center;
font-size: 14px;
top: 0 !important;
}
/* 带后缀的输入框右侧留空间 */
/deep/ .el-input--suffix .el-input__inner {
padding-right: 30px;
}
/* 带前缀的输入框左侧留空间 */
/deep/ .el-input--prefix .el-input__inner {
padding-left: 30px;
}
/* 数字输入框 */
/deep/ .el-input-number--small {
width: 100%;
}
/deep/ .el-input-number--small .el-input__inner {
height: 32px;
line-height: 32px;
padding: 0 40px 0 10px;
box-sizing: border-box;
border: 1px solid #dcdfe6;
border-radius: 4px;
background-color: #fff;
font-size: 13px;
text-align: left;
}
/deep/ .el-input-number--small .el-input-number__increase,
/deep/ .el-input-number--small .el-input-number__decrease {
height: 15px;
line-height: 15px;
width: 28px;
font-size: 12px;
}
/* 按钮样式 */
.quality-issue-detail .el-button--small,
.quality-issue-detail .el-button--default {
height: 32px;
@ -615,32 +723,19 @@ export default {
min-width: auto;
width: auto;
}
.quality-issue-detail .el-button + .el-button {
margin-left: 10px;
}
/* 索赔信息区域:强制同行 */
.claim-section .el-row {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.claim-section .el-select {
width: 120px;
}
.claim-section .el-input-number {
width: 140px;
}
.claim-section .el-col {
flex: 1 1 auto;
}
/* 索赔信息区域 */
.claim-section {
border: 1px solid #dcdfe6;
padding: 10px 12px;
margin: 10px 0;
background: #fafafa;
}
.claim-title {
font-size: 14px;
font-weight: 500;
@ -649,6 +744,7 @@ export default {
padding-left: 8px;
border-left: 3px solid #409eff;
}
.btn-area {
display: flex;
justify-content: flex-end;
@ -661,4 +757,25 @@ export default {
min-width: 80px;
}
.claim-section /deep/ .el-select {
width: 100%;
}
.claim-section /deep/ .el-input-number {
width: 100%;
}
/* 日期时间选择器图标样式增强 */
/deep/ .el-date-editor--datetime {
.el-input__prefix,
.el-input__suffix {
height: 32px !important;
line-height: 32px !important;
}
.el-input__icon {
line-height: 32px !important;
height: 32px !important;
}
}
</style>
Loading…
Cancel
Save