工艺管理问题修改

dev-scheduling
zhangdi 3 weeks ago
parent 0974cda134
commit 07017a0b79
  1. 94
      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,35 +904,52 @@ 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 (
// !rootNode.children ||
if (rootNode.children && rootNode.children.length > 0) { !Array.isArray(rootNode.children) ||
const firstChild = rootNode.children[0]; rootNode.children.length === 0
console.log('第一个子节点:', firstChild); ) {
console.warn('根节点无子节点,跳过自动选中');
// return;
if (this.$refs.tree) { }
this.$refs.tree.setCurrentKey(firstChild.id);
} const firstChild = rootNode.children[0];
// 4. ID
// if (!firstChild.id) {
this.handleNodeClick(firstChild, { console.error('第一个子节点 ID 为空,请检查 generateId 函数');
level: firstChild.level, return;
parent: { }
data: rootNode,
isRoot: false, // 5.
}, try {
this.$nextTick(() => {
this.currentNodeKey = firstChild.id
this.$refs.tree.setCurrentKey([firstChild.id], false);
}); });
} else { } catch (error) {
console.log('根节点无子节点,不自动选中'); console.error('setCurrentKey 执行失败:', error);
return;
} }
// 6.
this.handleNodeClick(firstChild, {
level: firstChild.level,
parent: {
data: rootNode,
isRoot: false,
},
});
}); });
}, },
// //
@ -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 => {
@ -1065,7 +1093,7 @@ export default {
return { return {
...processInfo, ...processInfo,
id: generateId('process', processInfo.id, processInfo.processNo), id: generateId('process', processInfo.id, processInfo.processNo),
label: processInfo.processNo+'-'+processInfo.processName, label: processInfo.processNo + '-' + processInfo.processName,
level: 3, level: 3,
rawData: { rawData: {
processInfo, processInfo,
@ -1076,7 +1104,7 @@ export default {
// //
children: (projectList || []).map(project => ({ children: (projectList || []).map(project => ({
id: generateId('project', project.id, project.projectCode), id: generateId('project', project.id, project.projectCode),
label: project.trialNo+'-'+project.projectName, label: project.trialNo + '-' + project.projectName,
level: 4, level: 4,
disabled: true, disabled: true,
rawData: project, rawData: project,

Loading…
Cancel
Save