diff --git a/src/views/modules/sampleTracking/projectProofTracking.vue b/src/views/modules/sampleTracking/projectProofTracking.vue index 00b1491..7beb08b 100644 --- a/src/views/modules/sampleTracking/projectProofTracking.vue +++ b/src/views/modules/sampleTracking/projectProofTracking.vue @@ -52,6 +52,46 @@ + + + + + + + + + + + + + + + + + + + + @@ -1427,6 +1467,10 @@ export default { dryWetType: '', customerNo: '', proofingNo: '', + cProjectRegion: '', + engineer: '', + projectManager: '', + pic: '', projectPartSyncFlag: '', proofSyncFlag: '', proofingStatusList: [] @@ -1435,6 +1479,9 @@ export default { searchCustomerOptionLoading: false, searchCustomerQueryToken: 0, searchCustomerOptionInitialized: false, + searchEngineerOptions: [], + searchProjectManagerOptions: [], + searchPicOptions: [], trackingColumnList: cloneDefaultTrackingColumns(), hasUserTrackingColumnConfig: false, processColumns: cloneDefaultProcessColumns(), @@ -1618,7 +1665,11 @@ export default { }, activated () { this.loadUserBuList().then(() => { - return Promise.all([this.queryProcessColumns(), this.loadTrackingColumns()]) + return Promise.all([ + this.queryProcessColumns(), + this.loadTrackingColumns(), + this.loadSearchRoleOptions() + ]) }).then(() => { this.queryBuProcessConfig() this.getDataList() @@ -3529,7 +3580,7 @@ export default { roleDesc: '', active: queryData && queryData.active ? queryData.active : '', page: 1, - limit: 200 + limit: queryData && queryData.limit ? queryData.limit : 200 } return apiFn(params).then(({ data }) => { if (data && data.code === 0) { @@ -3986,6 +4037,10 @@ export default { this.searchData.dryWetType = '' this.searchData.customerNo = '' this.searchData.proofingNo = '' + this.searchData.cProjectRegion = '' + this.searchData.engineer = '' + this.searchData.projectManager = '' + this.searchData.pic = '' this.searchData.projectPartSyncFlag = '' this.searchData.proofSyncFlag = '' this.searchData.proofingStatusList = [] @@ -3994,6 +4049,46 @@ export default { this.getDataList('Y') }) }, + normalizeSearchRoleOptions (rows) { + const optionMap = {} + const options = [] + ;(Array.isArray(rows) ? rows : []).forEach(item => { + if (!item || this.isBlankValue(item.username)) { + return + } + const username = String(item.username).trim() + const userDisplay = this.isBlankValue(item.userDisplay) ? '' : String(item.userDisplay).trim() + const value = userDisplay ? (username + '-' + userDisplay) : username + if (optionMap[value]) { + return + } + optionMap[value] = true + options.push({ + value: value, + label: userDisplay || username, + username: username, + userDisplay: userDisplay + }) + }) + return options.sort((left, right) => String(left.label).localeCompare(String(right.label))) + }, + loadSearchRoleOptions () { + // 与一键创建人员弹窗同源:Engineer / PM/Sales / PIC(PjM) 分别对应角色接口 6 / 0 / 1。 + const roleQuery = { active: 'Y', limit: 1000 } + return Promise.all([ + this.fetchRoleListByApiKey('6', roleQuery), + this.fetchRoleListByApiKey('0', roleQuery), + this.fetchRoleListByApiKey('1', roleQuery) + ]).then(([engineerRows, projectManagerRows, picRows]) => { + this.searchEngineerOptions = this.normalizeSearchRoleOptions(engineerRows) + this.searchProjectManagerOptions = this.normalizeSearchRoleOptions(projectManagerRows) + this.searchPicOptions = this.normalizeSearchRoleOptions(picRows) + }).catch(() => { + this.searchEngineerOptions = [] + this.searchProjectManagerOptions = [] + this.searchPicOptions = [] + }) + }, selectionChange (rows) { this.selectionRows = rows || [] }, @@ -4221,7 +4316,8 @@ export default { return String(projectNo).trim() }, queryApplyOptionsByProjectNo (projectNo) { - const normalizedProjectNo = this.normalizeProjectNo(projectNo) + // 固定取项目编码前10位因为工程系统中项目编码前10位是唯一的,我们这边可能会有后缀或扩展位。 + const normalizedProjectNo = projectNo.substring(0, 10); if (!normalizedProjectNo) { return Promise.resolve([]) } @@ -4241,11 +4337,6 @@ export default { if (!item || this.isBlankValue(item.applyNo)) { return } - const applyStatus = this.isBlankValue(item.status) ? '' : String(item.status).trim() - // 业务要求:已完成的试验单不允许继续作为 tracking 打样单号使用。 - if (applyStatus === '草稿' || applyStatus === '已完成') { - return - } const rowProjectNo = this.normalizeProjectNo(item.projectNo).toUpperCase() // searchExpApplyList 按模糊 project_no 查询,这里再次做等值过滤,确保与 tracking 项目编码一一对应。 if (rowProjectNo !== matchedProjectNo) {