工艺管理问题修改

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

Loading…
Cancel
Save