Browse Source

2026-01-06

物料档案管理->质量检验模板新增优化
master
fengyuan_yang 6 days ago
parent
commit
96bf3121bb
  1. 169
      src/views/modules/qc/qcPartAttribute.vue

169
src/views/modules/qc/qcPartAttribute.vue

@ -700,6 +700,7 @@
<el-table
height="210px"
:data="itemList1"
v-loading="itemList1Loading"
border
ref="itemTable1"
@row-click="itemClickRow1"
@ -822,8 +823,8 @@
</el-header>
<el-main style="width: 880px;height: 25px;margin-top: 50px;padding: 0 0 0 0;text-align:center">
<div>
<el-button type="primary" @click="addItem">添加<i class="el-icon-caret-bottom el-icon--right"></i></el-button>
<el-button type="primary" @click="deleteItem">删除<i class="el-icon-caret-top el-icon--right"></i></el-button>
<el-button type="primary" @click="addItem" :loading="addItemLoading">添加<i class="el-icon-caret-bottom el-icon--right" v-if="!addItemLoading"></i></el-button>
<el-button type="primary" @click="deleteItem" :loading="deleteItemLoading">删除<i class="el-icon-caret-top el-icon--right" v-if="!deleteItemLoading"></i></el-button>
</div>
</el-main>
<el-footer style="width: 1080px;height: 222px;padding: 0 0 0 0;margin-top: -4px">
@ -832,6 +833,7 @@
<el-table
height="200px"
:data="itemList2"
v-loading="itemList2Loading"
border
ref="itemTable2"
@row-click="itemClickRow2"
@ -1710,7 +1712,7 @@
serialNumber: '301003Table2OperationDesc',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'operationDesc',
columnProp: 'operation',
headerAlign: "center",
align: "left",
columnLabel: '工序',
@ -1728,7 +1730,7 @@
serialNumber: '301003Table2ResourceDesc',
tableId: "301003Table2",
tableName: "检验模板清单表",
columnProp: 'resourceDesc',
columnProp: 'resourceID',
headerAlign: "center",
align: "left",
columnLabel: '机台',
@ -1850,6 +1852,10 @@
fastAddFlag: false,
itemList1: [],
itemList2: [],
itemList1Loading: false, // loading
itemList2Loading: false, // loading
addItemLoading: false, // loading
deleteItemLoading: false, // loading
itemListRow1: {},
itemListRow2: {},
tempLevelRow: {},
@ -2295,10 +2301,10 @@
},
checkInspectionType () {
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
//
this.refreshTemplateLists()
//
if (this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '107') {
this.span1 = 12
this.span2 = 6
@ -2312,9 +2318,23 @@
},
checkInspectionType2 () {
this.refreshTemplateLists()
},
// loading
refreshTemplateLists () {
this.itemList1Loading = true
this.itemList2Loading = true
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
if (data) {
this.itemList1 = data.row1 || []
this.itemList2 = data.row2 || []
}
}).catch(err => {
console.error('加载模板列表失败:', err)
}).finally(() => {
this.itemList1Loading = false
this.itemList2Loading = false
})
},
@ -2347,25 +2367,60 @@
//
addFastModal () {
this.itemSelections1 = null
this.itemSelections2 = null
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
//
if (!this.detailData.partNo || !this.detailData.site) {
this.$message.warning('请先选择要设置模板的物料!')
return
}
//
if (!this.options || this.options.length === 0) {
this.$message.warning('检验类型数据加载中,请稍后再试')
return
}
//
this.itemSelections1 = []
this.itemSelections2 = []
//
this.detailData.inspectionTypeNo = this.options[0].inspectionTypeNo
this.checkInspectionType()
//
if (this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '107') {
this.span1 = 12
this.span2 = 6
this.span3 = 6
} else if (this.detailData.inspectionTypeNo === '105' || this.detailData.inspectionTypeNo === '109') {
this.span1 = 12
this.span2 = 12
} else {
this.span1 = 24
}
//
this.operationSelections = []
this.resourceSelections = []
this.dataListOperationSelections = []
this.operationData.operationDesc = ''
this.resourceData.resourceId = ''
this.resourceData.resourceDesc = ''
//
this.selectionManufacturer = []
this.selectionManufacturer2 = []
this.dataListManufacturerSelections = []
this.selectionCustomer = []
this.selectionCustomer2 = []
this.dataListCustomerSelections = []
//
this.fastAddFlag = true
// 使$nextTick
this.$nextTick(() => {
this.refreshTemplateLists()
})
},
//
@ -2392,37 +2447,42 @@
this.$message.warning('请选择可选模板!')
return
}
if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107') && (this.operationSelections.length === 0)) {
this.$message.warning('请选择工序!')
return
}
if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107') && (this.resourceSelections.length === 0)) {
this.$message.warning('请选择机台!')
return
}
if ((this.detailData.inspectionTypeNo === '105') && (this.selectionManufacturer == null || this.selectionManufacturer.length === 0)) {
this.$message.warning('请选择供应商!')
return
// IPQC/FQC
if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107')) {
if (this.resourceSelections.length > 0 && this.operationSelections.length === 0) {
this.$message.warning('如果选择机台,必须要选择工序!')
return
}
}
// loading
this.addItemLoading = true
//
let inData = {
site: this.detailData.site,
buNo: this.detailData.buNo,
attributeNo: this.detailData.partNo,
itemList: this.itemSelections1,
operation: this.operationSelections.length === 0 ? '' : this.operationSelections[0].operationDesc,
resourceID: this.resourceSelections.length === 0 ? '' : this.resourceSelections[0].resourceId,
manufacturerList: this.selectionManufacturer,
customerList: this.selectionCustomer,
// IPQC/FQC
operationList: this.operationSelections.map(item => item.operationDesc),
resourceIDList: this.resourceSelections.map(item => item.resourceId),
// IQC
manufacturerList: this.selectionManufacturer || [],
// OQC
customerList: this.selectionCustomer || [],
attributeType: this.detailData.attributeType,
inspectionTypeNo: this.detailData.inspectionTypeNo
}
savePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) {
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.$message.success('添加成功!')
//
this.refreshTemplateLists()
//
this.itemSelections1 = []
this.operationSelections = []
this.resourceSelections = []
this.selectionManufacturer = []
this.selectionManufacturer2 = []
this.selectionCustomer = []
@ -2430,6 +2490,10 @@
} else {
this.$message.error(data.msg)
}
}).catch(err => {
this.$message.error('添加失败:' + (err.message || '未知错误'))
}).finally(() => {
this.addItemLoading = false
})
},
@ -2439,8 +2503,12 @@
this.$message.warning('请选择已有模板!')
return
}
// loading
this.deleteItemLoading = true
let inData = {
attributeNo:this.detailData.partNo,
attributeNo: this.detailData.partNo,
itemList: this.itemSelections2,
attributeType: this.detailData.attributeType,
site: this.detailData.site,
@ -2448,14 +2516,17 @@
}
deletePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) {
getPartTemplateLists(this.detailData).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
})
this.$message.success('删除成功!')
//
this.refreshTemplateLists()
this.itemSelections2 = []
} else {
this.$message.error(data.msg)
}
}).catch(err => {
this.$message.error('删除失败:' + (err.message || '未知错误'))
}).finally(() => {
this.deleteItemLoading = false
})
},
@ -2702,11 +2773,11 @@
this.$message.warning('请选择标签类型!')
return
}
//
if (this.labelTemplateData.defaultFlag === '1') {
//
const existingDefault = this.labelTemplateList.find(item =>
const existingDefault = this.labelTemplateList.find(item =>
item.defaultFlag === '1' && item.labelTypeTb !== this.labelTemplateData.labelTypeTb
)
if (existingDefault) {
@ -2738,10 +2809,10 @@
return
}
}
this.doSaveLabelTemplate()
},
//
doSaveLabelTemplate () {
this.saveLoading = true
@ -3069,9 +3140,9 @@
this.operationSelections = val
},
//
operationSelect (selection, row) {
this.$refs.operationTable.clearSelection()
this.$refs.operationTable.toggleRowSelection(row, true)
//
},
getRowKeys (row) {
@ -3083,9 +3154,9 @@
this.resourceSelections = val
},
//
resourceSelect (selection, row) {
this.$refs.resourceTable.clearSelection()
this.$refs.resourceTable.toggleRowSelection(row, true)
//
},
getRowKeys2 (row) {

Loading…
Cancel
Save