工艺管理问题修改

dev-scheduling
zhangdi 3 weeks ago
parent 0974cda134
commit 07017a0b79
  1. 68
      src/views/processManagement/components/processMainte/partDetails.vue

@ -482,7 +482,9 @@
@node-click="handleNodeClick"
:default-expand-all="true"
:expand-on-click-node="false"
node-key="id"
ref="tree"
:current-node-key="currentNodeKey"
/>
</div>
<div class="process-right">
@ -617,6 +619,7 @@ export default {
},
data() {
return {
currentNodeKey: '',
showProcessVersion: false,
setCrewShow: false,
activeName: '1',
@ -628,7 +631,20 @@ export default {
processLevel: '1',
rankList: [],
rank: '2',
priorityList: [],
priorityList: [
{
label: '本次使用',
value: 1,
},
{
label: '正式工艺',
value: 2,
},
{
label: '临时工艺',
value: 3,
},
],
form1: {
tableData1: [], //
},
@ -824,15 +840,12 @@ export default {
},
//
handleNodeClick(nodes, node, self) {
console.log(9999999,nodes,node)
if (nodes.disabled) {
return false;
}
this.treeNodes = nodes;
this.treeLeave = node.level;
//
this.form1.tableData1 = [];
this.form2.tableData2 = [];
@ -842,8 +855,8 @@ export default {
if (this.treeLeave === 2) {
this.activeName = '1';
this.form1.tableData1 = nodes.processList;
console.log('默认点击选中第一个数据')
this.treeNodes.rawData.prority = this.treeNodes.rawData.prority+'';
console.log('默认点击选中第一个数据', this.treeNodes);
this.treeNodes.rawData.prority = Number(this.treeNodes.rawData.prority);
}
//
if (this.treeLeave === 3) {
@ -891,25 +904,45 @@ export default {
//
autoSelectFirstNode() {
this.$nextTick(() => {
if (!this.$refs || !this.$refs.tree) {
console.warn('el-tree 组件未找到,跳过自动选中');
return;
}
if (!this.data || this.data.length === 0) {
console.log('树数据为空,不自动选中');
return;
}
const rootNode = this.data[0];
console.log('根节点:', rootNode);
//
if (rootNode.children && rootNode.children.length > 0) {
if (
!rootNode.children ||
!Array.isArray(rootNode.children) ||
rootNode.children.length === 0
) {
console.warn('根节点无子节点,跳过自动选中');
return;
}
const firstChild = rootNode.children[0];
console.log('第一个子节点:', firstChild);
// 4. ID
if (!firstChild.id) {
console.error('第一个子节点 ID 为空,请检查 generateId 函数');
return;
}
//
if (this.$refs.tree) {
this.$refs.tree.setCurrentKey(firstChild.id);
// 5.
try {
this.$nextTick(() => {
this.currentNodeKey = firstChild.id
this.$refs.tree.setCurrentKey([firstChild.id], false);
});
} catch (error) {
console.error('setCurrentKey 执行失败:', error);
return;
}
//
// 6.
this.handleNodeClick(firstChild, {
level: firstChild.level,
parent: {
@ -917,9 +950,6 @@ export default {
isRoot: false,
},
});
} else {
console.log('根节点无子节点,不自动选中');
}
});
},
//
@ -1019,9 +1049,7 @@ export default {
const partCode = partInfo.partCode;
const generateId = (prefix, id, fallback) => {
return (
id || `${prefix}_${fallback}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
);
return id;
};
const formatCraftLabel = craftInfo => {

Loading…
Cancel
Save