Browse Source

优化质检项目Copy功能

master
Rex zhang 1 month ago
parent
commit
87819e42b4
  1. 3
      cclqms-java/src/main/java/com/gaotao/modules/pms/service/Impl/QcBaseInfoServiceImpl.java
  2. 8
      cclqms-vue/src/i18n/locales/qc.cn.js
  3. 8
      cclqms-vue/src/i18n/locales/qc.en.js
  4. 290
      cclqms-vue/src/views/modules/qc/qcPartAttribute.vue

3
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();

8
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: '排序',

8
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',

290
cclqms-vue/src/views/modules/qc/qcPartAttribute.vue

@ -1603,40 +1603,86 @@
<!-- 复制质检项目 -->
<el-dialog :title="$t('qc.partAttributePage.dialogQcSpecCopy')" :close-on-click-modal="false" v-drag
:visible.sync="qcSpecCopyDialogFlag" width="900px" append-to-body custom-class="config-dialog">
<!-- <div class="qc-spec-copy-hint">{{ $t('qc.partAttributePage.qcSpecCopyHint') }}</div> -->
<el-form :inline="true" label-position="top" style="margin-bottom: 8px;">
<el-form-item :label="$t('qc.table.materialCode')">
<el-input v-model="qcSpecCopySearchData.partNo" clearable style="width: 140px"
@keyup.enter.native="searchQcSpecCopyPartList"></el-input>
</el-form-item>
<el-form-item :label="$t('qc.table.materialName')">
<el-input v-model="qcSpecCopySearchData.partDesc" clearable style="width: 180px"
@keyup.enter.native="searchQcSpecCopyPartList"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" icon="el-icon-search" :loading="qcSpecCopyLoading"
@click="searchQcSpecCopyPartList">{{ $t('qc.common.search') }}</el-button>
</el-form-item>
</el-form>
<el-table :data="qcSpecCopyPartList" ref="qcSpecCopyPartTable" border height="360px"
v-loading="qcSpecCopyLoading" @selection-change="qcSpecCopyPartSelectionChange"
@row-click="qcSpecCopyPartClickRow" :row-key="getQcSpecCopyPartRowKey">
<el-table-column type="selection" width="45" align="center" :reserve-selection="true"></el-table-column>
<el-table-column prop="partNo" :label="$t('qc.table.materialCode')" min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" :label="$t('qc.table.materialName')" min-width="180"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partType" :label="$t('qc.table.partType')" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="spec" :label="$t('qc.table.spec')" min-width="120"
show-overflow-tooltip></el-table-column>
</el-table>
<el-pagination style="margin-top: 10px" @size-change="qcSpecCopySizeChange"
@current-change="qcSpecCopyCurrentChange" :current-page="qcSpecCopyPageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="qcSpecCopyPageSize" :total="qcSpecCopyTotalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
:visible.sync="qcSpecCopyDialogFlag" width="92%" top="4vh" append-to-body
custom-class="config-dialog qc-spec-copy-dialog">
<div class="qc-spec-copy-content">
<el-form :inline="true" size="small" class="qc-spec-copy-search-form">
<el-form-item :label="$t('qc.table.materialCode')">
<el-input v-model="qcSpecCopySearchData.partNo" clearable style="width: 150px"
@keyup.enter.native="searchQcSpecCopyPartList"></el-input>
</el-form-item>
<el-form-item :label="$t('qc.table.materialName')">
<el-input v-model="qcSpecCopySearchData.partDesc" clearable style="width: 190px"
@keyup.enter.native="searchQcSpecCopyPartList"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" :loading="qcSpecCopyLoading"
@click="searchQcSpecCopyPartList">{{ $t('qc.common.search') }}</el-button>
</el-form-item>
</el-form>
<div class="qc-spec-copy-section-header">
<span class="qc-spec-copy-section-title">{{ $t('qc.partAttributePage.qcSpecCopyAvailableParts') }}</span>
<el-button type="primary" size="small" icon="el-icon-plus"
:disabled="qcSpecCopyPartSelections.length === 0" @click="addQcSpecCopySelectedParts">
{{ $t('qc.partAttributePage.qcSpecCopyAddSelected', { count: qcSpecCopyPartSelections.length }) }}
</el-button>
</div>
<el-table :data="qcSpecCopyPartList" ref="qcSpecCopyPartTable" border height="230px"
v-loading="qcSpecCopyLoading" @selection-change="qcSpecCopyPartSelectionChange"
@row-click="qcSpecCopyPartClickRow" :row-key="getQcSpecCopyPartRowKey">
<el-table-column type="selection" width="45" align="center" :reserve-selection="true"
:selectable="isQcSpecCopyPartSelectable"></el-table-column>
<el-table-column prop="partNo" :label="$t('qc.table.materialCode')" min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" :label="$t('qc.table.materialName')" min-width="180"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partType" :label="$t('qc.table.partType')" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="spec" :label="$t('qc.table.spec')" min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('qc.partAttributePage.qcSpecCopyStatus')" width="90" align="center">
<template slot-scope="scope">
<el-tag v-if="isQcSpecCopyPartAdded(scope.row)" type="info" size="mini">
{{ $t('qc.partAttributePage.qcSpecCopyAdded') }}
</el-tag>
</template>
</el-table-column>
</el-table>
<el-pagination class="qc-spec-copy-pagination" @size-change="qcSpecCopySizeChange"
@current-change="qcSpecCopyCurrentChange" :current-page="qcSpecCopyPageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="qcSpecCopyPageSize" :total="qcSpecCopyTotalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<div class="qc-spec-copy-section-header qc-spec-copy-added-header">
<span class="qc-spec-copy-section-title">
{{ $t('qc.partAttributePage.qcSpecCopyAddedParts', { count: qcSpecCopyAddedParts.length }) }}
</span>
<el-button type="danger" plain size="small" icon="el-icon-delete"
:disabled="qcSpecCopyAddedParts.length === 0" @click="clearQcSpecCopyAddedParts">
{{ $t('qc.partAttributePage.qcSpecCopyClearAdded') }}
</el-button>
</div>
<el-table :data="qcSpecCopyAddedParts" border height="180px" :row-key="getQcSpecCopyPartRowKey">
<el-table-column prop="partNo" :label="$t('qc.table.materialCode')" min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" :label="$t('qc.table.materialName')" min-width="180"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partType" :label="$t('qc.table.partType')" min-width="100"
show-overflow-tooltip></el-table-column>
<el-table-column prop="spec" :label="$t('qc.table.spec')" min-width="120"
show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('qc.common.operation')" width="80" align="center">
<template slot-scope="scope">
<el-tooltip :content="$t('qc.partAttributePage.qcSpecCopyRemoveAdded')" placement="top">
<el-button type="text" icon="el-icon-delete" class="qc-spec-copy-remove-button"
@click="removeQcSpecCopyAddedPart(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmQcSpecCopy" :loading="qcSpecCopyConfirmLoading"
size="small">{{ $t('qc.common.confirm') }}</el-button>
@ -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;
}
</style>
<style>
/* The dialog is appended to body, so its size rules must not be scoped. */
.qc-spec-copy-dialog {
width: 780px !important;
max-width: 780px !important;
margin-bottom: 4vh;
}
.qc-spec-copy-dialog .el-dialog__body {
max-height: calc(92vh - 150px);
overflow-y: auto;
}
@media (max-width: 840px) {
.qc-spec-copy-dialog {
width: 92% !important;
max-width: 92% !important;
}
}
</style>
Loading…
Cancel
Save