Browse Source

新品流程OK

master
常熟吴彦祖 3 days ago
parent
commit
d75a49b109
  1. 201
      src/views/modules/inspection/inspectionRequestList.vue

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

@ -101,7 +101,7 @@
style="width: 100px; height: 100px"/></span>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="160" label="操作">
<el-table-column fixed="right" header-align="center" align="center" width="260" label="操作">
<template slot-scope="scope">
<a v-if="isRowStatus(scope.row, ['Draft'])"
class="customer-a" @click="confirmInspection(scope.row)">确认</a>
@ -117,10 +117,11 @@
class="customer-a"
:style="(isRowStatus(scope.row, ['Draft']) || isRowStatus(scope.row, ['Confirmed'])) ? 'margin-left: 3px;' : ''"
@click="applyChangeRequest(scope.row)">申请变更</a>
<a class="customer-a" style="margin-left: 3px;" @click="exportRowExcel(scope.row)">导出</a>
<span v-if="!isRowStatus(scope.row, ['Draft', 'Confirmed', 'Audited', 'Scheduled'])"
class="customer-a"
style="color: #909399; cursor: default;">{{ scope.row.status }}</span>
<a class="customer-a" style="margin-left: 3px;" @click="exportRowExcel(scope.row)" v-if="isRowStatus(scope.row, [ 'Audited', 'Scheduled'])">导出验货通知</a>
<a class="customer-a" style="margin-left: 3px;" @click="exportInspectionResultExcel(scope.row)" v-if="isRowStatus(scope.row, [ 'InspectionCompleted'])">导出验货结果</a>
<!-- <span v-if="!isRowStatus(scope.row, ['Draft', 'Confirmed', 'Audited', 'Scheduled'])"-->
<!-- class="customer-a"-->
<!-- style="color: #909399; cursor: default;">{{ scope.row.status }}</span>-->
</template>
</el-table-column>
</el-table>
@ -1513,14 +1514,14 @@ export default {
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1InspectAddress',
serialNumber: 'InspectionTable1Status',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'inspectAddress',
columnProp: 'status',
headerAlign: 'center',
align: 'left',
columnLabel: '验货地址',
columnWidth: '200',
align: 'center',
columnLabel: '状态',
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1528,17 +1529,18 @@ export default {
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1InspectCityShort',
serialNumber: 'InspectionTable1QcOperator',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'inspectCityShort',
columnProp: 'qcOperator',
headerAlign: 'center',
align: 'left',
columnLabel: '城市简称',
columnWidth: '120',
columnLabel: 'QC人员',
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1549,14 +1551,14 @@ export default {
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1Contact',
serialNumber: 'InspectionTable1InspectAddress',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'inspectContract',
columnProp: 'inspectAddress',
headerAlign: 'center',
align: 'left',
columnLabel: '联系人',
columnWidth: '150',
columnLabel: '验货地址',
columnWidth: '200',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1567,14 +1569,14 @@ export default {
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1Remark',
serialNumber: 'InspectionTable1InspectCityShort',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'remark',
columnProp: 'inspectCityShort',
headerAlign: 'center',
align: 'left',
columnLabel: '备注',
columnWidth: '150',
columnLabel: '城市简称',
columnWidth: '120',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1585,14 +1587,14 @@ export default {
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1Status',
serialNumber: 'InspectionTable1Contact',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'status',
columnProp: 'inspectContract',
headerAlign: 'center',
align: 'center',
columnLabel: '状态',
columnWidth: '100',
align: 'left',
columnLabel: '联系人',
columnWidth: '150',
columnHidden: false,
columnImage: false,
columnSortable: false,
@ -1600,25 +1602,25 @@ export default {
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: 'InspectionTable1QcOperator',
serialNumber: 'InspectionTable1Remark',
tableId: 'InspectionTable1',
tableName: '检验申请单',
columnProp: 'qcOperator',
columnProp: 'remark',
headerAlign: 'center',
align: 'left',
columnLabel: 'QC人员',
columnWidth: '100',
columnLabel: '备注',
columnWidth: '150',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
}
},
]
}
},
@ -1671,9 +1673,31 @@ export default {
this.height = calculatedHeight
this.detailHeight = calculatedHeight
this.initPageData()
// fixed - rqrq
this.bindMainTableResizeListener()
})
},
beforeDestroy () {
// - rqrq
this.removeMainTableResizeListener()
},
methods: {
// / - rqrq
handleMainTableResize () {
this.$nextTick(() => {
if (this.$refs.mainTable) {
this.$refs.mainTable.doLayout()
}
})
},
// - rqrq
bindMainTableResizeListener () {
window.addEventListener('resize', this.handleMainTableResize)
},
// - rqrq
removeMainTableResizeListener () {
window.removeEventListener('resize', this.handleMainTableResize)
},
/**
* 页面初始化入口
* - 通用模式直接查询
@ -1935,6 +1959,8 @@ export default {
this.$nextTick(() => {
if (this.$refs.mainTable) {
// - rqrq
this.$refs.mainTable.doLayout()
this.$refs.mainTable.clearSelection()
}
})
@ -3824,6 +3850,94 @@ export default {
})
},
// Excelxlsx - rqrq
async exportInspectionResultExcel (row) {
// 1) - rqrq
if (!row || !row.requestNo) {
this.$message.warning('数据异常,无法导出验货结果Excel')
return
}
// 2) sitesite使 - rqrq
const requestSite = this.$store.state.user.site
if (!requestSite) {
this.$message.warning('站点不能为空,无法导出验货结果Excel')
return
}
// 3) Excelblobxlsx - rqrq
try {
const response = await this.$http({
url: this.$http.adornUrl(`/inspection/exportInspectResultExcel/${row.requestNo}`),
method: 'get',
params: { site: requestSite },
responseType: 'blob'
})
const responseBlob = response.data
const responseContentType = String(
(response.headers && (response.headers['content-type'] || response.headers['Content-Type'])) || ''
).toLowerCase()
// 4) json/ - rqrq
if (responseContentType.includes('application/json') || responseContentType.includes('text/plain') || responseContentType.includes('text/html')) {
const errorText = await this.readBlobAsText(responseBlob)
const errorMessage = this.extractBlobErrorMessage(errorText)
this.$message.error(errorMessage || '导出验货结果Excel失败,请稍后重试')
return
}
// 5) Excel - rqrq
const blob = new Blob([responseBlob], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
const downloadUrl = window.URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = downloadUrl
link.download = `验货结果_${row.requestNo}.xlsx`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
window.URL.revokeObjectURL(downloadUrl)
this.$message.success('导出验货结果Excel成功')
} catch (error) {
console.error('导出验货结果Excel失败:', error)
this.$message.error('导出验货结果Excel失败,请稍后重试')
}
},
// Blob - rqrq
readBlobAsText (blob) {
return new Promise((resolve) => {
if (!blob) {
resolve('')
return
}
const fileReader = new FileReader()
fileReader.onload = () => resolve(String(fileReader.result || ''))
fileReader.onerror = () => resolve('')
fileReader.readAsText(blob, 'utf-8')
})
},
// {"msg":"..."} - rqrq
extractBlobErrorMessage (rawText) {
if (!rawText) {
return ''
}
const normalizedText = String(rawText).trim()
if (!normalizedText) {
return ''
}
try {
const parsed = JSON.parse(normalizedText)
if (parsed && parsed.msg) {
return parsed.msg
}
} catch (e) {
// JSON - rqrq
}
return normalizedText.length > 200 ? normalizedText.substring(0, 200) : normalizedText
},
executeApplyChangeRequest (requestNo, changeRemark) {
this.applyChangeLoading = true
applyChangeInspectionRequest(requestNo, { changeRemark }).then(({ data }) => {
@ -3904,6 +4018,27 @@ export default {
overflow-x: hidden;
}
/* 主表固定列偶发“透明/叠层”修复:统一固定列背景并约束单元格单行,避免主表与fixed列行高漂移 - rqrq */
.customer-css /deep/ .el-table__fixed,
.customer-css /deep/ .el-table__fixed-right,
.customer-css /deep/ .el-table__fixed-right-patch {
background-color: #fff;
}
/* 固定列正文单元格始终白底,避免看到下层正文产生“透明”错觉 - rqrq */
.customer-css /deep/ .el-table__fixed-body-wrapper td,
.customer-css /deep/ .el-table__fixed-right .el-table__fixed-body-wrapper td {
background-color: #fff;
}
/* 主表与固定列统一单行展示,减少行高不一致导致的视觉错位 - rqrq */
.customer-css /deep/ .el-table__body-wrapper .cell,
.customer-css /deep/ .el-table__fixed-body-wrapper .cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/deep/ .customer-tab .el-tabs__content {
padding: 5px !important;
}

Loading…
Cancel
Save