|
|
|
@ -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) { |
|
|
|
|