Browse Source

2026-01-06

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

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

@ -700,6 +700,7 @@
<el-table <el-table
height="210px" height="210px"
:data="itemList1" :data="itemList1"
v-loading="itemList1Loading"
border border
ref="itemTable1" ref="itemTable1"
@row-click="itemClickRow1" @row-click="itemClickRow1"
@ -822,8 +823,8 @@
</el-header> </el-header>
<el-main style="width: 880px;height: 25px;margin-top: 50px;padding: 0 0 0 0;text-align:center"> <el-main style="width: 880px;height: 25px;margin-top: 50px;padding: 0 0 0 0;text-align:center">
<div> <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> </div>
</el-main> </el-main>
<el-footer style="width: 1080px;height: 222px;padding: 0 0 0 0;margin-top: -4px"> <el-footer style="width: 1080px;height: 222px;padding: 0 0 0 0;margin-top: -4px">
@ -832,6 +833,7 @@
<el-table <el-table
height="200px" height="200px"
:data="itemList2" :data="itemList2"
v-loading="itemList2Loading"
border border
ref="itemTable2" ref="itemTable2"
@row-click="itemClickRow2" @row-click="itemClickRow2"
@ -1710,7 +1712,7 @@
serialNumber: '301003Table2OperationDesc', serialNumber: '301003Table2OperationDesc',
tableId: "301003Table2", tableId: "301003Table2",
tableName: "检验模板清单表", tableName: "检验模板清单表",
columnProp: 'operationDesc',
columnProp: 'operation',
headerAlign: "center", headerAlign: "center",
align: "left", align: "left",
columnLabel: '工序', columnLabel: '工序',
@ -1728,7 +1730,7 @@
serialNumber: '301003Table2ResourceDesc', serialNumber: '301003Table2ResourceDesc',
tableId: "301003Table2", tableId: "301003Table2",
tableName: "检验模板清单表", tableName: "检验模板清单表",
columnProp: 'resourceDesc',
columnProp: 'resourceID',
headerAlign: "center", headerAlign: "center",
align: "left", align: "left",
columnLabel: '机台', columnLabel: '机台',
@ -1850,6 +1852,10 @@
fastAddFlag: false, fastAddFlag: false,
itemList1: [], itemList1: [],
itemList2: [], itemList2: [],
itemList1Loading: false, // loading
itemList2Loading: false, // loading
addItemLoading: false, // loading
deleteItemLoading: false, // loading
itemListRow1: {}, itemListRow1: {},
itemListRow2: {}, itemListRow2: {},
tempLevelRow: {}, tempLevelRow: {},
@ -2295,10 +2301,10 @@
}, },
checkInspectionType () { 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') { if (this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '107') {
this.span1 = 12 this.span1 = 12
this.span2 = 6 this.span2 = 6
@ -2312,9 +2318,23 @@
}, },
checkInspectionType2 () { checkInspectionType2 () {
this.refreshTemplateLists()
},
// loading
refreshTemplateLists () {
this.itemList1Loading = true
this.itemList2Loading = true
getPartTemplateLists(this.detailData).then(({data}) => { 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 () { 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.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.dataListOperationSelections = []
this.operationData.operationDesc = '' this.operationData.operationDesc = ''
this.resourceData.resourceId = '' this.resourceData.resourceId = ''
this.resourceData.resourceDesc = '' this.resourceData.resourceDesc = ''
//
this.selectionManufacturer = [] this.selectionManufacturer = []
this.selectionManufacturer2 = [] this.selectionManufacturer2 = []
this.dataListManufacturerSelections = [] this.dataListManufacturerSelections = []
this.selectionCustomer = [] this.selectionCustomer = []
this.selectionCustomer2 = [] this.selectionCustomer2 = []
this.dataListCustomerSelections = [] this.dataListCustomerSelections = []
//
this.fastAddFlag = true this.fastAddFlag = true
// 使$nextTick
this.$nextTick(() => {
this.refreshTemplateLists()
})
}, },
// //
@ -2392,37 +2447,42 @@
this.$message.warning('请选择可选模板!') this.$message.warning('请选择可选模板!')
return 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('请选择工序!')
// 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 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
} }
// loading
this.addItemLoading = true
//
let inData = { let inData = {
site: this.detailData.site, site: this.detailData.site,
buNo: this.detailData.buNo, buNo: this.detailData.buNo,
attributeNo: this.detailData.partNo, attributeNo: this.detailData.partNo,
itemList: this.itemSelections1, 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, attributeType: this.detailData.attributeType,
inspectionTypeNo: this.detailData.inspectionTypeNo inspectionTypeNo: this.detailData.inspectionTypeNo
} }
savePartAttributeDetails(inData).then(({data}) => { savePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) { 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.itemSelections1 = []
this.operationSelections = []
this.resourceSelections = []
this.selectionManufacturer = [] this.selectionManufacturer = []
this.selectionManufacturer2 = [] this.selectionManufacturer2 = []
this.selectionCustomer = [] this.selectionCustomer = []
@ -2430,6 +2490,10 @@
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}).catch(err => {
this.$message.error('添加失败:' + (err.message || '未知错误'))
}).finally(() => {
this.addItemLoading = false
}) })
}, },
@ -2439,6 +2503,10 @@
this.$message.warning('请选择已有模板!') this.$message.warning('请选择已有模板!')
return return
} }
// loading
this.deleteItemLoading = true
let inData = { let inData = {
attributeNo: this.detailData.partNo, attributeNo: this.detailData.partNo,
itemList: this.itemSelections2, itemList: this.itemSelections2,
@ -2448,14 +2516,17 @@
} }
deletePartAttributeDetails(inData).then(({data}) => { deletePartAttributeDetails(inData).then(({data}) => {
if (data && data.code === 0) { 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 = [] this.itemSelections2 = []
} else { } else {
this.$message.error(data.msg) this.$message.error(data.msg)
} }
}).catch(err => {
this.$message.error('删除失败:' + (err.message || '未知错误'))
}).finally(() => {
this.deleteItemLoading = false
}) })
}, },
@ -3069,9 +3140,9 @@
this.operationSelections = val this.operationSelections = val
}, },
//
operationSelect (selection, row) { operationSelect (selection, row) {
this.$refs.operationTable.clearSelection()
this.$refs.operationTable.toggleRowSelection(row, true)
//
}, },
getRowKeys (row) { getRowKeys (row) {
@ -3083,9 +3154,9 @@
this.resourceSelections = val this.resourceSelections = val
}, },
//
resourceSelect (selection, row) { resourceSelect (selection, row) {
this.$refs.resourceTable.clearSelection()
this.$refs.resourceTable.toggleRowSelection(row, true)
//
}, },
getRowKeys2 (row) { getRowKeys2 (row) {

Loading…
Cancel
Save