diff --git a/src/views/modules/order/com_inspectionDetailList.vue b/src/views/modules/order/com_inspectionDetailList.vue
index c93d271..9de4986 100644
--- a/src/views/modules/order/com_inspectionDetailList.vue
+++ b/src/views/modules/order/com_inspectionDetailList.vue
@@ -22,6 +22,22 @@
{{scope.row[item.columnProp]}}
+
+
+
+ 跳转
+
+ -
+
+
@@ -70,6 +86,17 @@ export default {
showOverflowTooltip: true,
fixed: false
},
+ {
+ columnProp: 'inspectNo',
+ headerAlign: 'center',
+ align: 'center',
+ columnLabel: '检验单号',
+ columnWidth: '140',
+ columnHidden: false,
+ columnSortable: false,
+ showOverflowTooltip: true,
+ fixed: false
+ },
{
columnProp: 'partNo',
headerAlign: 'center',
@@ -186,6 +213,21 @@ export default {
currentChangeHandle(val) {
this.pageIndex = val
this.searchTable()
+ },
+
+ jumpToInspection(row) {
+ const inspectionNo = row && row.inspectNo ? String(row.inspectNo).trim() : ''
+ if (!inspectionNo) {
+ this.$message.warning('未找到检验单号')
+ return
+ }
+ this.$router.push({
+ name: 'qc-IQCResultEntry',
+ query: {
+ inspectionNo,
+ jumpMode: 'single'
+ }
+ })
}
}
}
diff --git a/src/views/modules/qc/IQCResultEntry.vue b/src/views/modules/qc/IQCResultEntry.vue
index 5541ea0..0944dec 100644
--- a/src/views/modules/qc/IQCResultEntry.vue
+++ b/src/views/modules/qc/IQCResultEntry.vue
@@ -829,20 +829,7 @@
watch: {
'$route.query.inspectionNo': {
handler (newVal) {
- if (newVal) {
- if (!this.searchData.site) {
- this.searchData.site = this.$store.state.user.site
- }
- if (!this.searchData.userName) {
- this.searchData.userName = this.$store.state.user.name
- }
- this.searchData.inspectionNo = newVal
-
- // 自动执行查询
- this.$nextTick(() => {
- this.getDataList()
- })
- }
+ this.handleRouteInspectionNo(newVal)
},
immediate: false // 不立即执行,由 created 处理首次加载
},
@@ -2035,50 +2022,24 @@
// this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
// this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
- if (this.$route.query.inspectionNo) {
- this.searchData.inspectionNo= this.$route.query.inspectionNo
-
-
+ const routeInspectionNo = this.resolveRouteInspectionNo()
+ const singleJumpMode = this.isSingleInspectionJumpRoute()
+ if (routeInspectionNo && !singleJumpMode) {
+ this.searchData.inspectionNo = routeInspectionNo
}
- // 接收路由参数,如果有 inspectionNo 则设置为查询条件,并清空其他筛选条件
- // if (this.$route.query.inspectionNo) {
- // // 重置 searchData,只保留必要的字段和 inspectionNo
- // this.searchData = {
- // site: '',
- // userName: this.$store.state.user.name,
- // inspectionNo: this.$route.query.inspectionNo,
- // inspectionTypeNo: '105',
- // isQualified: '',
- // buNo: '',
- // startDate: '',
- // endDate: '',
- // startDate2: '',
- // endDate2: '',
- // partNo: '',
- // partDesc: '',
- // cinvSourceCode: '',
- // sku: '',
- // state: '',
- // inspectionResult: '',
- // supplierDesc: '',
- // disposalMeasures: '',
- // inspectorName: '',
- // page: 1,
- // limit: 10,
- // poOrderNo: '',
- // poItemNo: '',
- // orderType: '',
- // states: ['未开始', '待检验'],
- // submissionType: '',
- // invdefinetype: ''
- // }
- // }
-
-
if (!this.authSearch) {
- // 获取数据列表
- this.getDataList()
+ if (routeInspectionNo && singleJumpMode) {
+ this.pageIndex = 1
+ this.getDataList({
+ useTemporaryInspectionNo: true,
+ inspectionNo: routeInspectionNo,
+ clearRouteQueryAfterLoad: true
+ })
+ } else {
+ // 获取数据列表
+ this.getDataList()
+ }
}
// 获取用户角色
this.getUserRoleList()
@@ -2086,6 +2047,92 @@
methods: {
+ resolveRouteInspectionNo () {
+ const inspectionNo = this.$route && this.$route.query ? this.$route.query.inspectionNo : ''
+ return inspectionNo ? String(inspectionNo).trim() : ''
+ },
+
+ isSingleInspectionJumpRoute () {
+ const jumpMode = this.$route && this.$route.query ? this.$route.query.jumpMode : ''
+ return String(jumpMode || '').trim() === 'single'
+ },
+
+ clearJumpQueryFromRoute () {
+ const routeQuery = this.$route && this.$route.query ? this.$route.query : {}
+ if (!routeQuery.inspectionNo && !routeQuery.jumpMode) {
+ return
+ }
+ const nextQuery = { ...routeQuery }
+ delete nextQuery.inspectionNo
+ delete nextQuery.jumpMode
+ const replaceTarget = this.$route && this.$route.name
+ ? { name: this.$route.name, params: this.$route.params, query: nextQuery }
+ : { path: this.$route.path, query: nextQuery }
+ this.$router.replace(replaceTarget).catch(() => {})
+ },
+
+ buildSingleInspectionSearchParams (inspectionNo) {
+ const targetInspectionNo = inspectionNo ? String(inspectionNo).trim() : ''
+ return {
+ site: this.searchData.site || this.$store.state.user.site,
+ userName: this.searchData.userName || this.$store.state.user.name,
+ inspectionNo: targetInspectionNo,
+ inspectionTypeNo: this.searchData.inspectionTypeNo || '105',
+ isQualified: '',
+ buNo: this.searchData.buNo || '',
+ startDate: '',
+ endDate: '',
+ startDate2: '',
+ endDate2: '',
+ partNo: '',
+ item: '',
+ partDesc: '',
+ cinvSourceCode: '',
+ sku: '',
+ state: '',
+ inspectionResult: '',
+ supplierDesc: '',
+ disposalMeasures: '',
+ inspectorName: '',
+ page: this.pageIndex,
+ limit: this.pageSize,
+ poOrderNo: '',
+ poItemNo: '',
+ orderType: '',
+ states: [],
+ submissionType: '',
+ invdefinetype: ''
+ }
+ },
+
+ handleRouteInspectionNo (inspectionNoValue) {
+ const inspectionNo = inspectionNoValue ? String(inspectionNoValue).trim() : ''
+ if (!inspectionNo) {
+ return
+ }
+ if (!this.searchData.site) {
+ this.searchData.site = this.$store.state.user.site
+ }
+ if (!this.searchData.userName) {
+ this.searchData.userName = this.$store.state.user.name
+ }
+ this.pageIndex = 1
+ if (this.isSingleInspectionJumpRoute()) {
+ this.$nextTick(() => {
+ this.getDataList({
+ useTemporaryInspectionNo: true,
+ inspectionNo,
+ clearRouteQueryAfterLoad: true
+ })
+ })
+ return
+ }
+ this.searchData.inspectionNo = inspectionNo
+ this.$nextTick(() => {
+ this.getDataList()
+ })
+ },
+
// 获取用户的bu
getSiteAndBuByUserName2 () {
let tempData = {
@@ -2636,22 +2683,55 @@
},
// 获取主信息数据列表
- getDataList () {
+ getDataList (options = {}) {
+ const useTemporaryInspectionNo = !!options.useTemporaryInspectionNo
+ const temporaryInspectionNo = options.inspectionNo ? String(options.inspectionNo).trim() : ''
+ const clearRouteQueryAfterLoad = !!options.clearRouteQueryAfterLoad
this.searchLoading = true
- this.searchData.limit = this.pageSize
- this.searchData.page = this.pageIndex
- qcIQCInspectionSearch(this.searchData).then(({data}) => {
+ let queryParams = null
+ if (useTemporaryInspectionNo) {
+ queryParams = this.buildSingleInspectionSearchParams(temporaryInspectionNo)
+ queryParams.limit = this.pageSize
+ queryParams.page = this.pageIndex
+ } else {
+ this.searchData.limit = this.pageSize
+ this.searchData.page = this.pageIndex
+ queryParams = this.searchData
+ }
+ qcIQCInspectionSearch(queryParams).then(({data}) => {
if (data.code === 0) {
- this.dataList = data.page.list
- this.pageIndex = data.page.currPage
- this.pageSize = data.page.pageSize
- this.totalPage = data.page.totalCount
- this.searchLoading = false
- } else {
- this.searchLoading = false
+ if (useTemporaryInspectionNo) {
+ const rows = (data.page && data.page.list) || []
+ const targetNo = temporaryInspectionNo
+ const exactMatchedRows = rows.filter(item => {
+ const rowInspectionNo = item && item.inspectionNo ? String(item.inspectionNo).trim() : ''
+ return rowInspectionNo === targetNo
+ })
+ this.dataList = exactMatchedRows.length > 0 ? [exactMatchedRows[0]] : []
+ this.pageIndex = 1
+ this.totalPage = this.dataList.length
+ } else {
+ this.dataList = data.page.list
+ this.pageIndex = data.page.currPage
+ this.pageSize = data.page.pageSize
+ this.totalPage = data.page.totalCount
+ }
+ } else if (useTemporaryInspectionNo) {
+ this.dataList = []
+ this.pageIndex = 1
+ this.totalPage = 0
}
- }).catch(()=>{
+ }).catch(() => {
+ if (useTemporaryInspectionNo) {
+ this.dataList = []
+ this.pageIndex = 1
+ this.totalPage = 0
+ }
+ }).finally(() => {
this.searchLoading = false
+ if (useTemporaryInspectionNo && clearRouteQueryAfterLoad) {
+ this.clearJumpQueryFromRoute()
+ }
})
},