diff --git a/cclqms-java/src/main/java/com/gaotao/modules/pms/service/Impl/QcBaseInfoServiceImpl.java b/cclqms-java/src/main/java/com/gaotao/modules/pms/service/Impl/QcBaseInfoServiceImpl.java index 73d5c86..e170916 100644 --- a/cclqms-java/src/main/java/com/gaotao/modules/pms/service/Impl/QcBaseInfoServiceImpl.java +++ b/cclqms-java/src/main/java/com/gaotao/modules/pms/service/Impl/QcBaseInfoServiceImpl.java @@ -1303,9 +1303,6 @@ public class QcBaseInfoServiceImpl implements QcBaseInfoService { continue; } String targetPartNo = targetPart.getPartNo(); - if (StringUtils.equals(data.getPartNo(), targetPartNo)) { - continue; - } for (QcSpecData item : data.getItemList()) { String itemBuNo = resolveQcItemBuNo(data.getSite(), item); QcSpecData target = new QcSpecData(); diff --git a/cclqms-vue/src/i18n/locales/qc.cn.js b/cclqms-vue/src/i18n/locales/qc.cn.js index f216ea8..5fe9944 100644 --- a/cclqms-vue/src/i18n/locales/qc.cn.js +++ b/cclqms-vue/src/i18n/locales/qc.cn.js @@ -1122,6 +1122,14 @@ module.exports = { selectQcSpecCopyTarget: '请选择目标物料!', dialogQcSpecCopy: '复制质检项目', qcSpecCopyHint: '将当前主物料下勾选的质检项目复制到所选其它物料(已存在则覆盖)', + qcSpecCopyAvailableParts: '可选物料', + qcSpecCopyAddSelected: '加入已选({count})', + qcSpecCopyAddedParts: '已选物料({count})', + qcSpecCopyStatus: '状态', + qcSpecCopyAdded: '已添加', + qcSpecCopyClearAdded: '全部清空', + qcSpecCopyRemoveAdded: '从已选物料中移除', + selectQcSpecCopyAddedTarget: '请先将目标物料加入已选清单!', qcSpecCopyConfirm: '确认将 {itemCount} 个质检项目复制到 {targetCount} 个物料吗?', qcSpecCopySuccess: '复制成功', colSort: '排序', diff --git a/cclqms-vue/src/i18n/locales/qc.en.js b/cclqms-vue/src/i18n/locales/qc.en.js index 8e5b2a5..ed0cf61 100644 --- a/cclqms-vue/src/i18n/locales/qc.en.js +++ b/cclqms-vue/src/i18n/locales/qc.en.js @@ -1123,6 +1123,14 @@ module.exports = { selectQcSpecCopyTarget: 'Please select target material(s)!', dialogQcSpecCopy: 'Copy QC items', qcSpecCopyHint: 'Copy selected QC items from the current main material to other selected materials (overwrite if exists)', + qcSpecCopyAvailableParts: 'Available materials', + qcSpecCopyAddSelected: 'Add selected ({count})', + qcSpecCopyAddedParts: 'Selected materials ({count})', + qcSpecCopyStatus: 'Status', + qcSpecCopyAdded: 'Added', + qcSpecCopyClearAdded: 'Clear all', + qcSpecCopyRemoveAdded: 'Remove from selected materials', + selectQcSpecCopyAddedTarget: 'Add target material(s) to the selected list first!', qcSpecCopyConfirm: 'Copy {itemCount} QC item(s) to {targetCount} material(s)?', qcSpecCopySuccess: 'Copied successfully', colSort: 'Sort', diff --git a/cclqms-vue/src/views/modules/qc/qcPartAttribute.vue b/cclqms-vue/src/views/modules/qc/qcPartAttribute.vue index d5ebba8..40fd5fb 100644 --- a/cclqms-vue/src/views/modules/qc/qcPartAttribute.vue +++ b/cclqms-vue/src/views/modules/qc/qcPartAttribute.vue @@ -1603,40 +1603,86 @@ - - - - - - - - - - {{ $t('qc.common.search') }} - - - - - - - - - - - + :visible.sync="qcSpecCopyDialogFlag" width="92%" top="4vh" append-to-body + custom-class="config-dialog qc-spec-copy-dialog"> +
+ + + + + + + + + {{ $t('qc.common.search') }} + + + +
+ {{ $t('qc.partAttributePage.qcSpecCopyAvailableParts') }} + + {{ $t('qc.partAttributePage.qcSpecCopyAddSelected', { count: qcSpecCopyPartSelections.length }) }} + +
+ + + + + + + + + + + + + +
+ + {{ $t('qc.partAttributePage.qcSpecCopyAddedParts', { count: qcSpecCopyAddedParts.length }) }} + + + {{ $t('qc.partAttributePage.qcSpecCopyClearAdded') }} + +
+ + + + + + + + + +
{{ $t('qc.common.confirm') }} @@ -2329,7 +2375,6 @@ export default { site: '', buNo: '', userName: '', - excludePartNo: '', partNo: '', partDesc: '', page: 1, @@ -2337,6 +2382,7 @@ export default { }, qcSpecCopyPartList: [], qcSpecCopyPartSelections: [], + qcSpecCopyAddedParts: [], qcSpecCopyPageIndex: 1, qcSpecCopyPageSize: 20, qcSpecCopyTotalPage: 0, @@ -3259,15 +3305,24 @@ export default { }, mounted() { + window.addEventListener('resize', this.handleViewportResize) this.$nextTick(() => { - this.height = window.innerHeight / 2 - 100 - /*第二个表格高度的动态调整*/ - this.secondHeight = window.innerHeight - this.height - 170 + this.handleViewportResize() this.initQcSpecSortable() }) }, + activated() { + window.addEventListener('resize', this.handleViewportResize) + this.$nextTick(() => this.handleViewportResize()) + }, + + deactivated() { + window.removeEventListener('resize', this.handleViewportResize) + }, + beforeDestroy() { + window.removeEventListener('resize', this.handleViewportResize) this.destroyQcSpecSortable() }, @@ -3340,6 +3395,16 @@ export default { }, methods: { + // Keep both data grids usable on short screens and recalculate after viewport changes. + handleViewportResize() { + const viewportHeight = document.documentElement.clientHeight || window.innerHeight + const availableHeight = Math.max(viewportHeight - 170, 460) + const firstTableHeight = Math.max(180, Math.floor(availableHeight * 0.35)) + + this.height = firstTableHeight + this.secondHeight = Math.max(280, availableHeight - firstTableHeight) + }, + initPartAttributeI18n() { const t = (k) => this.$t('qc.partAttributePage.' + k) const tt = (k) => this.$t('qc.table.' + k) @@ -4127,7 +4192,6 @@ export default { site: this.partCurrentRow.site, buNo: this.partCurrentRow.buNo, userName: this.$store.state.user.name, - excludePartNo: this.partCurrentRow.partNo, partNo: '', partDesc: '', page: 1, @@ -4136,6 +4200,7 @@ export default { this.qcSpecCopyPageIndex = 1 this.qcSpecCopyPartList = [] this.qcSpecCopyPartSelections = [] + this.qcSpecCopyAddedParts = [] this.qcSpecCopyDialogFlag = true this.$nextTick(() => { if (this.$refs.qcSpecCopyPartTable) { @@ -4147,11 +4212,73 @@ export default { getQcSpecCopyPartRowKey(row) { return `${row.site}_${row.buNo}_${row.partNo}` }, + isQcSpecCopyPartAdded(row) { + const rowKey = this.getQcSpecCopyPartRowKey(row) + return this.qcSpecCopyAddedParts.some((item) => this.getQcSpecCopyPartRowKey(item) === rowKey) + }, + isQcSpecCopyPartSelectable(row) { + return !this.isQcSpecCopyPartAdded(row) + }, qcSpecCopyPartClickRow(row) { + if (!this.isQcSpecCopyPartSelectable(row)) { + return + } this.$refs.qcSpecCopyPartTable.toggleRowSelection(row) }, qcSpecCopyPartSelectionChange(val) { - this.qcSpecCopyPartSelections = val || [] + const currentPageKeys = new Set( + this.qcSpecCopyPartList.map((item) => this.getQcSpecCopyPartRowKey(item)) + ) + const selectedCurrentPageRows = (val || []).filter((item) => + currentPageKeys.has(this.getQcSpecCopyPartRowKey(item)) && this.isQcSpecCopyPartSelectable(item) + ) + const otherPageRows = this.qcSpecCopyPartSelections.filter((item) => + !currentPageKeys.has(this.getQcSpecCopyPartRowKey(item)) && this.isQcSpecCopyPartSelectable(item) + ) + + this.qcSpecCopyPartSelections = otherPageRows.concat(selectedCurrentPageRows) + }, + restoreQcSpecCopyPartSelection() { + if (!this.$refs.qcSpecCopyPartTable) { + return + } + const selectedKeys = new Set( + this.qcSpecCopyPartSelections.map((item) => this.getQcSpecCopyPartRowKey(item)) + ) + this.qcSpecCopyPartList.forEach((item) => { + this.$refs.qcSpecCopyPartTable.toggleRowSelection( + item, + selectedKeys.has(this.getQcSpecCopyPartRowKey(item)) + ) + }) + }, + addQcSpecCopySelectedParts() { + const addedKeys = new Set( + this.qcSpecCopyAddedParts.map((item) => this.getQcSpecCopyPartRowKey(item)) + ) + const newParts = this.qcSpecCopyPartSelections.filter((item) => { + const rowKey = this.getQcSpecCopyPartRowKey(item) + if (addedKeys.has(rowKey)) { + return false + } + addedKeys.add(rowKey) + return true + }) + + this.qcSpecCopyAddedParts = this.qcSpecCopyAddedParts.concat(newParts) + this.qcSpecCopyPartSelections = [] + if (this.$refs.qcSpecCopyPartTable) { + this.$refs.qcSpecCopyPartTable.clearSelection() + } + }, + removeQcSpecCopyAddedPart(row) { + const rowKey = this.getQcSpecCopyPartRowKey(row) + this.qcSpecCopyAddedParts = this.qcSpecCopyAddedParts.filter( + (item) => this.getQcSpecCopyPartRowKey(item) !== rowKey + ) + }, + clearQcSpecCopyAddedParts() { + this.qcSpecCopyAddedParts = [] }, searchQcSpecCopyPartList() { this.qcSpecCopyPageIndex = 1 @@ -4169,6 +4296,7 @@ export default { this.qcSpecCopyPageIndex = data.page.currPage this.qcSpecCopyPageSize = data.page.pageSize this.qcSpecCopyTotalPage = data.page.totalCount + this.$nextTick(() => this.restoreQcSpecCopyPartSelection()) } else { this.$message.error(data.msg) } @@ -4187,12 +4315,12 @@ export default { this.getQcSpecCopyPartList() }, confirmQcSpecCopy() { - if (!this.qcSpecCopyPartSelections || this.qcSpecCopyPartSelections.length === 0) { - this.$message.warning(this.$t('qc.partAttributePage.selectQcSpecCopyTarget')) + if (!this.qcSpecCopyAddedParts || this.qcSpecCopyAddedParts.length === 0) { + this.$message.warning(this.$t('qc.partAttributePage.selectQcSpecCopyAddedTarget')) return } const itemCount = this.qcSpecSelections.length - const targetCount = this.qcSpecCopyPartSelections.length + const targetCount = this.qcSpecCopyAddedParts.length this.$confirm( this.$t('qc.partAttributePage.qcSpecCopyConfirm', { itemCount, targetCount }), this.$t('qc.common.tip'), @@ -4208,7 +4336,7 @@ export default { buNo: this.partCurrentRow.buNo, partNo: this.partCurrentRow.partNo, createBy: this.$store.state.user.name, - targetPartList: this.qcSpecCopyPartSelections.map((item) => ({ + targetPartList: this.qcSpecCopyAddedParts.map((item) => ({ partNo: item.partNo, })), itemList: this.qcSpecSelections.map((item) => ({ @@ -7829,6 +7957,59 @@ export default { color: #606266; } +.qc-spec-copy-content { + padding: 14px 18px 16px; + background: #ffffff; +} + +.qc-spec-copy-search-form { + display: flex; + flex-wrap: wrap; + align-items: center; + margin-bottom: 2px; +} + +.qc-spec-copy-search-form .el-form-item { + margin: 0 14px 8px 0; +} + +.qc-spec-copy-section-header { + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + min-height: 36px; + margin-bottom: 6px; +} + +.qc-spec-copy-section-header .el-button { + margin-left: 12px; +} + +.qc-spec-copy-section-title { + color: #303133; + font-size: 14px; + font-weight: 600; +} + +.qc-spec-copy-pagination { + display: flex; + flex-wrap: wrap; + align-items: center; + margin-top: 8px; +} + +.qc-spec-copy-added-header { + margin-top: 10px; + padding-top: 8px; + border-top: 1px solid #dcdfe6; +} + +.qc-spec-copy-remove-button { + color: #f56c6c; + font-size: 17px; +} + .qc-spec-warning-dialog { padding: 16px 20px 12px; background: #f5f7fa; @@ -8159,3 +8340,24 @@ export default { background: #e8f4ff !important; } + +