|
@@ -69,6 +69,8 @@ export default window.$crudCommon({
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ treeData: [],
|
|
|
|
|
+
|
|
|
wideTableColumns: [],
|
|
wideTableColumns: [],
|
|
|
printTitle: "",
|
|
printTitle: "",
|
|
|
};
|
|
};
|
|
@@ -97,6 +99,8 @@ export default window.$crudCommon({
|
|
|
|
|
|
|
|
const column = this.findObject(this.option.column, "subjectId");
|
|
const column = this.findObject(this.option.column, "subjectId");
|
|
|
column.dicData = this.loopData(JSON.parse(JSON.stringify(res.data.data)), 0);
|
|
column.dicData = this.loopData(JSON.parse(JSON.stringify(res.data.data)), 0);
|
|
|
|
|
+
|
|
|
|
|
+ this.treeData = column.dicData;
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
@@ -123,6 +127,36 @@ export default window.$crudCommon({
|
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
this.$refs.printWideTable.printTable(isLandscape);
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ findParentNames(categories, childId, parentNames = []) {
|
|
|
|
|
+ const child = categories.find(cat => cat.id === childId);
|
|
|
|
|
+
|
|
|
|
|
+ if (!child || !child.parentId) {
|
|
|
|
|
+ return parentNames;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const parent = categories.find(cat => cat.id === child.parentId);
|
|
|
|
|
+ if (parent) {
|
|
|
|
|
+ parentNames.unshift(parent.name); // 添加到数组开头保持顺序
|
|
|
|
|
+ return this.findParentNames(categories, parent.id, parentNames);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return parentNames;
|
|
|
|
|
+ },
|
|
|
|
|
+ getFormData() {
|
|
|
|
|
+ let newList = [];
|
|
|
|
|
+ const getAllList = data => {
|
|
|
|
|
+ data.forEach(element => {
|
|
|
|
|
+ newList.push(element);
|
|
|
|
|
+ if (element.children && element.children.length) {
|
|
|
|
|
+ getAllList(element.children)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ getAllList(this.treeData);
|
|
|
|
|
+ let parentNames = this.findParentNames(newList, this.form.subjectId);
|
|
|
|
|
+
|
|
|
|
|
+ return { ...this.form, subjectName: `${parentNames.join('\\')}\\${this.form.$subjectId}` };
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
}, {
|
|
}, {
|
|
|
// 模块路径
|
|
// 模块路径
|