diff --git a/src/api/lab/lab.js b/src/api/lab/lab.js index f7bd0af..0cd8603 100644 --- a/src/api/lab/lab.js +++ b/src/api/lab/lab.js @@ -3,6 +3,9 @@ import { createAPI } from '@/utils/httpRequest.js' // 获取列表 export const getLabList = params => createAPI(`/lab/list`, 'get', params) +// 获取高级搜索列表 +export const getLabListAny = data => createAPI(`/lab/list/any`, 'post', data) + // 获取详情 export const getLabDetail = (site, referenceNo) => createAPI(`/lab/info`, 'get', { site, referenceNo }) diff --git a/src/api/rohs/rohs.js b/src/api/rohs/rohs.js index 93249b9..310a30f 100644 --- a/src/api/rohs/rohs.js +++ b/src/api/rohs/rohs.js @@ -3,6 +3,9 @@ import { createAPI } from "@/utils/httpRequest.js"; // 获取列表 export const getRohsList = params => createAPI(`/rohs/list`, 'get', params); +// 获取高级搜索列表 +export const getRohsListAny = data => createAPI(`/rohs/list/any`, 'post', data); + // 获取详情 export const getRohsDetail = (site, referenceNo) => createAPI(`/rohs/info`, 'get', { site, referenceNo }); diff --git a/src/views/modules/lab/labRecord.vue b/src/views/modules/lab/labRecord.vue index c246994..aef1ce6 100644 --- a/src/views/modules/lab/labRecord.vue +++ b/src/views/modules/lab/labRecord.vue @@ -869,6 +869,7 @@ + @@ -885,13 +886,15 @@ import ChooseList from '@/views/modules/common/Chooselist' import DictDataSelect from '../sys/dict-data-select.vue' import ApprovalInformation from '../changeManagement/approvalInformation.vue' import ossComponents from '../oss/ossComponents.vue' +import FilterSearch from '../../common/filterSearch.vue' export default { components: { ChooseList, DictDataSelect, ApprovalInformation, - ossComponents + ossComponents, + FilterSearch }, data () { return { @@ -915,6 +918,9 @@ export default { pageSize: 20, totalPage: 0, dataListLoading: false, + filterVisible: false, + isFilterSearch: false, + filterSearchData: {}, activeTable: 'basicInfo', menuId: '', @@ -2134,6 +2140,7 @@ export default { this.currentTestSpecFileList = [] this.currentTestReportFileList = [] this.approvalList = [] + this.isFilterSearch = false return } this.dataListSelections = [] @@ -2195,22 +2202,93 @@ export default { this.approvalList = [] this.dataListLoading = false }) + this.isFilterSearch = false }, sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 - this.getDataList() + if (this.isFilterSearch === false) { + this.getDataList() + } else { + this.queryByAnyField(this.filterSearchData) + } }, currentChangeHandle (val) { this.pageIndex = val - this.getDataList() + if (this.isFilterSearch === false) { + this.getDataList() + } else { + this.queryByAnyField(this.filterSearchData) + } }, searchHandle () { if (!this.authSearch) { return } - this.pageIndex = 1 - this.getDataList() + this.filterVisible = true + }, + queryByAnyField (params) { + const queryParams = { + ...(params || {}) + } + queryParams.no = this.pageIndex + queryParams.size = this.pageSize + queryParams.userId = this.$store.state.user.id.toString() + queryParams.site = this.searchData.site || '' + queryParams.menuId = this.menuId + this.dataListSelections = [] + this.dataListLoading = true + api.getLabListAny(queryParams).then(({data}) => { + if (data && data.code === 0) { + const list = (data.page && data.page.list) || [] + this.dataList = list.map(item => ({ + applicantName: '', + customerName: '', + projectName: '', + testerName: '', + nodeId: '', + nodeName: '', + currentApprover: '', + ...item + })) + this.totalPage = data.page.totalCount + this.$nextTick(() => { + if (this.$refs.labTable && this.dataList.length > 0) { + this.$refs.labTable.setCurrentRow(this.dataList[0]) + } else if (this.$refs.labTable) { + this.$refs.labTable.setCurrentRow() + } + }) + } else { + this.$message.warning((data && data.msg) || '搜索失败') + this.dataList = [] + this.totalPage = 0 + this.currentRow = {} + this.currentDetailRequestId += 1 + this.currentDetail = this.buildEmptyDetailData() + this.currentDetailLoading = false + this.currentJudgeCriteriaFileList = [] + this.currentTestSpecFileList = [] + this.currentTestReportFileList = [] + this.approvalList = [] + } + this.dataListLoading = false + }).catch(() => { + this.dataList = [] + this.totalPage = 0 + this.currentRow = {} + this.currentDetailRequestId += 1 + this.currentDetail = this.buildEmptyDetailData() + this.currentDetailLoading = false + this.currentJudgeCriteriaFileList = [] + this.currentTestSpecFileList = [] + this.currentTestReportFileList = [] + this.approvalList = [] + this.dataListLoading = false + }) + this.filterSearchData = JSON.parse(JSON.stringify(queryParams)) + this.isFilterSearch = true + this.filterVisible = false }, buildExportName () { const now = new Date() diff --git a/src/views/modules/rohs/rohsRecord.vue b/src/views/modules/rohs/rohsRecord.vue index 72f087f..eba9e5f 100644 --- a/src/views/modules/rohs/rohsRecord.vue +++ b/src/views/modules/rohs/rohsRecord.vue @@ -1015,6 +1015,7 @@ + @@ -1030,6 +1031,7 @@ import ossComponents from '../oss/ossComponents.vue' import ChooseList from '@/views/modules/common/Chooselist' import DictDataSelect from "../sys/dict-data-select.vue" import ApprovalInformation from "../changeManagement/approvalInformation.vue" +import FilterSearch from "../../common/filterSearch.vue" export default { components: { @@ -1037,7 +1039,8 @@ export default { ossComponents, ChooseList, DictDataSelect, - ApprovalInformation + ApprovalInformation, + FilterSearch }, data () { return { @@ -1256,6 +1259,9 @@ export default { operatorId: '', operatorName: '' }, + filterVisible: false, + isFilterSearch: false, + filterSearchData: {}, approvalList: [], plmRohsAuthorityArr: [], nodeAuthorityLoaded: false, @@ -2345,6 +2351,7 @@ export default { this.totalPage = 0 this.currentRow = {} this.approvalList = [] + this.isFilterSearch = false return } this.dataListLoading = true @@ -2407,24 +2414,97 @@ export default { this.approvalList = [] this.dataListLoading = false }) + this.isFilterSearch = false }, // 分页 sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 - this.getDataList() + if (this.isFilterSearch === false) { + this.getDataList() + } else { + this.queryByAnyField(this.filterSearchData) + } }, currentChangeHandle (val) { this.pageIndex = val - this.getDataList() + if (this.isFilterSearch === false) { + this.getDataList() + } else { + this.queryByAnyField(this.filterSearchData) + } }, // 搜索条件点击 searchHandle () { if (!this.authSearch) { return } - this.pageIndex = 1 - this.getDataList() + this.filterVisible = true + }, + queryByAnyField (params) { + const queryParams = { + ...(params || {}) + } + queryParams.no = this.pageIndex + queryParams.size = this.pageSize + queryParams.userId = this.$store.state.user.id.toString() + queryParams.site = this.$store.state.user.site + queryParams.menuId = this.menuId + this.dataListLoading = true + api.getRohsListAny(queryParams).then(({data}) => { + if (data && data.code === 0) { + const list = (data.page && data.page.list) || [] + this.dataList = list.map(item => { + return { + applicantName: '', + pmName: '', + npdEngineerName: '', + technicalPlanName: '', + buyerName: '', + endCustomerName: '', + projectName: '', + nodeId: '', + nodeName: '', + currentApprover: '', + commGroup1Desc: '', + commGroup2Desc: '', + commGroup3Desc: '', + hsfApproverName: '', + relatedPeopleName: '', + ...item + } + }) + this.dataListSelections = [] + this.totalPage = data.page.totalCount + this.$nextTick(() => { + if (this.$refs.rohsTable) { + this.$refs.rohsTable.clearSelection() + } + if (this.$refs.rohsTable && this.dataList.length > 0) { + this.$refs.rohsTable.setCurrentRow(this.dataList[0]) + } else if (this.$refs.rohsTable) { + this.$refs.rohsTable.setCurrentRow() + } + }) + } else { + this.$message.warning((data && data.msg) || '搜索失败') + this.dataList = [] + this.dataListSelections = [] + this.totalPage = 0 + this.currentRow = {} + this.approvalList = [] + } + this.dataListLoading = false + }).catch(() => { + this.dataList = [] + this.dataListSelections = [] + this.currentRow = {} + this.approvalList = [] + this.dataListLoading = false + }) + this.filterSearchData = JSON.parse(JSON.stringify(queryParams)) + this.isFilterSearch = true + this.filterVisible = false }, buildExportName () { const now = new Date()