|
|
|
@ -114,7 +114,6 @@ |
|
|
|
style="width: 220px; margin-right: 12px" |
|
|
|
style="width: 220px; margin-right: 12px" |
|
|
|
clearable |
|
|
|
clearable |
|
|
|
filterable |
|
|
|
filterable |
|
|
|
:filter-method="handleFilter" |
|
|
|
|
|
|
|
></el-cascader> |
|
|
|
></el-cascader> |
|
|
|
|
|
|
|
|
|
|
|
<el-button type="primary" @click="modelLevelChange()" :loading="modelLevelLoading" |
|
|
|
<el-button type="primary" @click="modelLevelChange()" :loading="modelLevelLoading" |
|
|
|
@ -390,11 +389,6 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-form-item :prop="`tableData3[${scope.$index}].mtId`" :rules="formRules3.mtId"> |
|
|
|
<el-form-item :prop="`tableData3[${scope.$index}].mtId`" :rules="formRules3.mtId"> |
|
|
|
<!-- <el-input |
|
|
|
|
|
|
|
v-model="scope.row.tool" |
|
|
|
|
|
|
|
placeholder="请输入" |
|
|
|
|
|
|
|
style="width: 100%" |
|
|
|
|
|
|
|
></el-input> --> |
|
|
|
|
|
|
|
<jhSelect |
|
|
|
<jhSelect |
|
|
|
v-model="scope.row.mtId" |
|
|
|
v-model="scope.row.mtId" |
|
|
|
placeholder="请搜索选择" |
|
|
|
placeholder="请搜索选择" |
|
|
|
@ -600,7 +594,6 @@ export default { |
|
|
|
formRules1: { |
|
|
|
formRules1: { |
|
|
|
ppsId: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
ppsId: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
caId: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
caId: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
// proDes: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
|
|
|
|
isMain: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
isMain: [{ required: true, message: '请选择', trigger: ['change', 'submit'] }], |
|
|
|
processNo: [{ required: true, message: '请输入', trigger: ['change', 'submit'] }], |
|
|
|
processNo: [{ required: true, message: '请输入', trigger: ['change', 'submit'] }], |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -642,6 +635,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
cascaderValue: '', |
|
|
|
cascaderValue: '', |
|
|
|
cascaderOptions: [], |
|
|
|
cascaderOptions: [], |
|
|
|
|
|
|
|
cachedSelectedNodeId: null, // 缓存当前选中节点 ID |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
@ -679,8 +673,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.cascaderOptions = data_; |
|
|
|
this.cascaderOptions = data_; |
|
|
|
|
|
|
|
|
|
|
|
// this.filteredList = [...this.modelOption]; |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 导入检验项目模板 |
|
|
|
// 导入检验项目模板 |
|
|
|
@ -831,26 +823,7 @@ export default { |
|
|
|
this.rankList = res.data.data; |
|
|
|
this.rankList = res.data.data; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleFilter(keyword) { |
|
|
|
|
|
|
|
// 1. 无关键词时,显示全部数据 |
|
|
|
|
|
|
|
if (!keyword) { |
|
|
|
|
|
|
|
this.filteredList = [...this.modelOption]; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 统一转为小写,实现不区分大小写过滤 |
|
|
|
|
|
|
|
const lowerKeyword = keyword; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 同时匹配两个字段:name 或 pinyin 包含关键词即保留 |
|
|
|
|
|
|
|
this.filteredList = this.modelOption.filter(item => { |
|
|
|
|
|
|
|
// 字段1:姓名(转小写) |
|
|
|
|
|
|
|
const matchName = item.name.includes(lowerKeyword); |
|
|
|
|
|
|
|
// 字段2:拼音(转小写) |
|
|
|
|
|
|
|
const matchPinyin = item.modelNameStr.includes(lowerKeyword); |
|
|
|
|
|
|
|
// 只要有一个字段匹配,就保留该选项 |
|
|
|
|
|
|
|
return matchName || matchPinyin; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 工艺模板列表 |
|
|
|
// 工艺模板列表 |
|
|
|
async getModelList() { |
|
|
|
async getModelList() { |
|
|
|
await getModelList().then(res => { |
|
|
|
await getModelList().then(res => { |
|
|
|
@ -999,7 +972,7 @@ export default { |
|
|
|
updateTreeNode(this.data); |
|
|
|
updateTreeNode(this.data); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取零件信息详情数据 |
|
|
|
// 获取零件信息详情数据 |
|
|
|
async getDetails() { |
|
|
|
async getDetails(shouldRestoreSelection = false) { |
|
|
|
this.treeLoading = true; |
|
|
|
this.treeLoading = true; |
|
|
|
let query_ = {}; |
|
|
|
let query_ = {}; |
|
|
|
if (!this.updateRow.partVersion) { |
|
|
|
if (!this.updateRow.partVersion) { |
|
|
|
@ -1016,24 +989,79 @@ export default { |
|
|
|
rank: this.lastConfirmedRank, |
|
|
|
rank: this.lastConfirmedRank, |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
await getProcessAuthorized(query_) |
|
|
|
|
|
|
|
.then(res => { |
|
|
|
try { |
|
|
|
|
|
|
|
const res = await getProcessAuthorized(query_); |
|
|
|
this.treeLoading = false; |
|
|
|
this.treeLoading = false; |
|
|
|
this.data = this.transformCraftTree(res.data.data); |
|
|
|
this.data = this.transformCraftTree(res.data.data); |
|
|
|
this.partInfoData = res.data.data.partInfo; |
|
|
|
this.partInfoData = res.data.data.partInfo; |
|
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.autoSelectFirstProcess(); |
|
|
|
// 自动选中第一个工艺(初始加载) |
|
|
|
this.calculateTableHeight(); |
|
|
|
if (!shouldRestoreSelection && this.data.length > 0) { |
|
|
|
|
|
|
|
const rootNode = this.data[0]; |
|
|
|
|
|
|
|
this.handleNodeClick(rootNode, { |
|
|
|
|
|
|
|
level: 1, |
|
|
|
|
|
|
|
parent: { data: null, isRoot: true }, |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (this.partInfoData.partName == '石墨模') { |
|
|
|
if (this.$refs.tree) { |
|
|
|
let graphite = this.modelOption.find(item => item.name == '石墨模'); |
|
|
|
this.$refs.tree.setCurrentKey(rootNode.id); |
|
|
|
this.modelLevel = graphite.id; |
|
|
|
|
|
|
|
this.modelLevelChange(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
.catch(err => { |
|
|
|
// 恢复之前选中的节点 |
|
|
|
|
|
|
|
else if (shouldRestoreSelection && this.cachedSelectedNodeId) { |
|
|
|
|
|
|
|
this.restoreSelectedNode(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.calculateTableHeight(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
this.treeLoading = false; |
|
|
|
this.treeLoading = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 恢复选中节点 |
|
|
|
|
|
|
|
restoreSelectedNode() { |
|
|
|
|
|
|
|
const findAndSelectNode = nodes => { |
|
|
|
|
|
|
|
for (let node of nodes) { |
|
|
|
|
|
|
|
if (node.id === this.cachedSelectedNodeId) { |
|
|
|
|
|
|
|
// 模拟点击事件恢复数据 |
|
|
|
|
|
|
|
this.handleNodeClick(node, { |
|
|
|
|
|
|
|
level: node.level, |
|
|
|
|
|
|
|
parent: { |
|
|
|
|
|
|
|
data: this.getParentNode(this.data, node.id), |
|
|
|
|
|
|
|
isRoot: node.level === 1, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 视觉选中 |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
|
|
if (this.$refs.tree) { |
|
|
|
|
|
|
|
this.$refs.tree.setCurrentKey(node.id); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (node.children && node.children.length > 0) { |
|
|
|
|
|
|
|
if (findAndSelectNode(node.children)) return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
findAndSelectNode(this.data); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 辅助方法:获取父节点 |
|
|
|
|
|
|
|
getParentNode(nodes, targetId, parent = null) { |
|
|
|
|
|
|
|
for (let node of nodes) { |
|
|
|
|
|
|
|
if (node.id === targetId) { |
|
|
|
|
|
|
|
return parent; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (node.children && node.children.length > 0) { |
|
|
|
|
|
|
|
const found = this.getParentNode(node.children, targetId, node); |
|
|
|
|
|
|
|
if (found) return found; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
}, |
|
|
|
}, |
|
|
|
autoSelectFirstProcess() { |
|
|
|
autoSelectFirstProcess() { |
|
|
|
if (!this.data || this.data.length === 0) return; |
|
|
|
if (!this.data || this.data.length === 0) return; |
|
|
|
@ -1133,10 +1161,9 @@ export default { |
|
|
|
if (nodes.disabled && node.level !== 1) { |
|
|
|
if (nodes.disabled && node.level !== 1) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
// console.log(node.level, nodes, 'node.level'); |
|
|
|
|
|
|
|
this.calculateTableHeight(); |
|
|
|
this.calculateTableHeight(); |
|
|
|
this.treeLoading = true; |
|
|
|
this.treeLoading = true; |
|
|
|
|
|
|
|
this.cachedSelectedNodeId = nodes.id; |
|
|
|
this.treeNodes = nodes; |
|
|
|
this.treeNodes = nodes; |
|
|
|
const parentNode = node.parent; |
|
|
|
const parentNode = node.parent; |
|
|
|
|
|
|
|
|
|
|
|
@ -1145,10 +1172,8 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.treeLeave = node.level; |
|
|
|
this.treeLeave = node.level; |
|
|
|
|
|
|
|
|
|
|
|
// 清空现有表格数据 |
|
|
|
// 清空现有表格数据 |
|
|
|
this.clearTableData(); |
|
|
|
this.clearTableData(); |
|
|
|
|
|
|
|
|
|
|
|
// 根据节点层级加载对应数据 |
|
|
|
// 根据节点层级加载对应数据 |
|
|
|
if (this.treeLeave === 1) { |
|
|
|
if (this.treeLeave === 1) { |
|
|
|
// 🟢 零件节点:加载该零件下所有工艺的工序数据(只读) |
|
|
|
// 🟢 零件节点:加载该零件下所有工艺的工序数据(只读) |
|
|
|
@ -1255,7 +1280,6 @@ export default { |
|
|
|
this.$prompt('请输入零件号', '提示', { |
|
|
|
this.$prompt('请输入零件号', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
cancelButtonText: '取消', |
|
|
|
// inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/, |
|
|
|
|
|
|
|
inputErrorMessage: '零件号正确', |
|
|
|
inputErrorMessage: '零件号正确', |
|
|
|
}) |
|
|
|
}) |
|
|
|
.then(({ value }) => { |
|
|
|
.then(({ value }) => { |
|
|
|
@ -1264,7 +1288,6 @@ export default { |
|
|
|
partCode: value, |
|
|
|
partCode: value, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
console.log(9999999, node.data.id); |
|
|
|
|
|
|
|
craftBatchCopy(query).then(res => { |
|
|
|
craftBatchCopy(query).then(res => { |
|
|
|
this.$message.success('复制成功'); |
|
|
|
this.$message.success('复制成功'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -1626,7 +1649,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 处理传参 |
|
|
|
// 处理传参 |
|
|
|
if (this.treeNodes.rawData.qualityGradeCode) { |
|
|
|
if (this.treeNodes.rawData.qualityGradeCode) { |
|
|
|
let qualityInfo = this.rankList.find( |
|
|
|
let qualityInfo = this.rankList.find( |
|
|
|
@ -1645,7 +1667,7 @@ export default { |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.craftLoading = false; |
|
|
|
this.craftLoading = false; |
|
|
|
this.getDetails(); |
|
|
|
this.getDetails(true); |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
.catch(err => { |
|
|
|
this.craftLoading = false; |
|
|
|
this.craftLoading = false; |
|
|
|
@ -1678,7 +1700,8 @@ export default { |
|
|
|
deleteIds: this.form2.deleteIds, //删除ids |
|
|
|
deleteIds: this.form2.deleteIds, //删除ids |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
saveProcessProjectSave(query_).then(res => { |
|
|
|
saveProcessProjectSave(query_) |
|
|
|
|
|
|
|
.then(res => { |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.craftLoading = false; |
|
|
|
this.craftLoading = false; |
|
|
|
// ✅ 更新工序节点下的项目数据 |
|
|
|
// ✅ 更新工序节点下的项目数据 |
|
|
|
@ -1687,9 +1710,10 @@ export default { |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1702,7 +1726,8 @@ export default { |
|
|
|
processMeasuringToolEntities: this.form3.tableData3, //尺寸量具 |
|
|
|
processMeasuringToolEntities: this.form3.tableData3, //尺寸量具 |
|
|
|
deleteIds: this.form3.deleteIds, //删除ids |
|
|
|
deleteIds: this.form3.deleteIds, //删除ids |
|
|
|
}; |
|
|
|
}; |
|
|
|
saveProcessMeasuringTool(query_).then(res => { |
|
|
|
saveProcessMeasuringTool(query_) |
|
|
|
|
|
|
|
.then(res => { |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.craftLoading = false; |
|
|
|
this.craftLoading = false; |
|
|
|
// ✅ 更新工序节点下的量具数据 |
|
|
|
// ✅ 更新工序节点下的量具数据 |
|
|
|
@ -1711,9 +1736,10 @@ export default { |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1726,7 +1752,8 @@ export default { |
|
|
|
processMoldToolEntities: this.form4.tableData4, //尺寸量具 |
|
|
|
processMoldToolEntities: this.form4.tableData4, //尺寸量具 |
|
|
|
deleteIds: this.form4.deleteIds, //删除ids |
|
|
|
deleteIds: this.form4.deleteIds, //删除ids |
|
|
|
}; |
|
|
|
}; |
|
|
|
saveProcessMoldTool(query_).then(res => { |
|
|
|
saveProcessMoldTool(query_) |
|
|
|
|
|
|
|
.then(res => { |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.$message.success('保存成功'); |
|
|
|
this.craftLoading = false; |
|
|
|
this.craftLoading = false; |
|
|
|
// ✅ 更新工序节点下的工装数据 |
|
|
|
// ✅ 更新工序节点下的工装数据 |
|
|
|
@ -1735,9 +1762,10 @@ export default { |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.updateTreeNodeProject(); |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
this.refreshTableData(); // ✅ 刷新右侧表格 |
|
|
|
} |
|
|
|
} |
|
|
|
}).catch(err=>{ |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
this.craftLoading = false; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|